FarDetVarcErrorsDump Class Reference

#include <FarDetVarcErrorsDump.h>

Inheritance diagram for FarDetVarcErrorsDump:
JobCModule

List of all members.

Public Member Functions

 FarDetVarcErrorsDump ()
 ~FarDetVarcErrorsDump ()
void BeginJob ()
JobCResult Ana (const MomNavigator *mom)
void EndJob ()

Private Attributes

TFile * fVarcErrorsFile
TTree * fVarcErrorsTree
Int_t date
Int_t time
Int_t run
Int_t timeframe
Int_t timeblock
Int_t sparserr
Int_t etcerr
Int_t crate
Int_t varc
Int_t etc
Int_t errcode

Detailed Description

Definition at line 11 of file FarDetVarcErrorsDump.h.


Constructor & Destructor Documentation

FarDetVarcErrorsDump::FarDetVarcErrorsDump (  ) 

Definition at line 23 of file FarDetVarcErrorsDump.cxx.

00023                                            :
00024   fVarcErrorsFile(0), 
00025   fVarcErrorsTree(0)
00026 {
00027 
00028 }

FarDetVarcErrorsDump::~FarDetVarcErrorsDump (  ) 

Definition at line 30 of file FarDetVarcErrorsDump.cxx.

00031 {
00032 
00033 }


Member Function Documentation

JobCResult FarDetVarcErrorsDump::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 41 of file FarDetVarcErrorsDump.cxx.

References crate, date, errcode, etc, etcerr, MomNavigator::FragmentIter(), fVarcErrorsFile, fVarcErrorsTree, RawVarcErrorInTfBlock::GetCrateId(), RawVarcErrorInTfBlock::GetNumberOfEtcErrors(), RawVarcErrorInTfBlock::GetNumberOfSparsErrors(), RawDaqHeaderBlock::GetRun(), RawDaqHeaderBlock::GetTimeFrameNum(), RawDaqHeaderBlock::GetTimeStamp(), Msg::kDebug, JobCResult::kPassed, MSG, run, sparserr, time, timeblock, timeframe, RawVarcErrorInTfBlock::UnpackEtcError(), RawVarcErrorInTfBlock::UnpackSparsError(), and varc.

00042 {
00043   MSG("FarDetVarcErrorsDump",Msg::kDebug) << " *** FarDetVarcErrorsDump::Ana(...) *** " << endl;
00044 
00045   UShort_t timeBlock,crateId,varcId,etcId,errCode;
00046 
00047   JobCResult result(JobCResult::kPassed);
00048 
00049   TIter momitr(mom->FragmentIter());
00050   while(const RawRecord* rawrec = dynamic_cast<const RawRecord*>(momitr())){
00051   
00052     MSG("FarDetVarcErrorsDump",Msg::kDebug) << "  *** NEXT RECORD ***  " << endl;  
00053 
00054     TIter rawrecitr = rawrec->GetRawBlockIter();
00055     TObject *tob;
00056     while((tob = rawrecitr())){
00057       MSG("FarDetVarcErrorsDump",Msg::kDebug) << tob->GetName() << endl;
00058 
00059       if(tob->InheritsFrom("RawDaqHeaderBlock")){
00060         MSG("FarDetVarcErrorsDump",Msg::kDebug) << " ... found RawDaqHeaderBlock " << endl;
00061         RawDaqHeaderBlock* rdb = (RawDaqHeaderBlock*)(tob);
00062         run = rdb->GetRun(); 
00063         timeframe = rdb->GetTimeFrameNum(); 
00064         date = (((VldTimeStamp)(rdb->GetTimeStamp())).GetSec()-1059696000)/(3600*24);
00065         time = (((VldTimeStamp)(rdb->GetTimeStamp())).GetSec()-1059696000)%(3600*24);
00066         MSG("FarDetVarcErrorsDump",Msg::kDebug) << "   ... timeframe=" << timeframe << endl; 
00067       }
00068 
00069       if(tob->InheritsFrom("RawVarcErrorInTfBlock")){
00070         MSG("FarDetDataQualityModule",Msg::kDebug) << " ... found RawVarcErrorInTfBlock" << endl;
00071         RawVarcErrorInTfBlock* rdb = (RawVarcErrorInTfBlock*)(tob);
00072     
00073         if( !fVarcErrorsFile ){
00074           //TString mystring("./results/fardet.rate");
00075           //mystring.Append("."); mystring+=run; 
00076           //mystring.Append(".root");
00077           TString mystring("fardet.varcerrors.root");
00078           TDirectory* tmpd = gDirectory;
00079           fVarcErrorsFile = new TFile(mystring.Data(),"RECREATE");
00080           fVarcErrorsTree = new TTree("VarcErrorsTree","VarcErrorsTree");
00081           fVarcErrorsTree->SetAutoSave(100);
00082           fVarcErrorsTree->Branch("date",&date,"date/I");
00083           fVarcErrorsTree->Branch("time",&time,"time/I");
00084           fVarcErrorsTree->Branch("run",&run,"run/I");
00085           fVarcErrorsTree->Branch("timeframe",&timeframe,"timeframe/I");
00086           fVarcErrorsTree->Branch("timeblock",&timeblock,"timeblock/I");
00087           fVarcErrorsTree->Branch("crate",&crate,"crate/I");
00088           fVarcErrorsTree->Branch("varc",&varc,"varc/I");
00089           fVarcErrorsTree->Branch("etc",&etc,"etc/I");
00090           fVarcErrorsTree->Branch("sparserr",&sparserr,"sparserr/I");
00091           fVarcErrorsTree->Branch("etcerr",&etcerr,"etcerr/I");
00092           fVarcErrorsTree->Branch("errcode",&errcode,"errcode/I");
00093           gDirectory = tmpd; 
00094         }
00095 
00096         crateId = rdb->GetCrateId();
00097         crateId-=1792;
00098 
00099         for(Int_t k=0;k<rdb->GetNumberOfSparsErrors();k++){
00100           rdb->UnpackSparsError(k,timeBlock,varcId,errCode);
00101           timeblock = timeBlock;
00102           crate = crateId;
00103           varc = varcId;
00104           etc = -1;
00105           sparserr = 1;
00106           etcerr = 0;
00107           errcode = errCode;
00108           TDirectory* tmpddd = gDirectory;
00109           fVarcErrorsFile->cd();
00110           fVarcErrorsTree->Fill();
00111           gDirectory = tmpddd;
00112         }
00113 
00114         for(Int_t k=0;k<rdb->GetNumberOfEtcErrors();k++){
00115           rdb->UnpackEtcError(k,timeBlock,varcId,etcId,errCode);
00116           timeblock = timeBlock;
00117           crate = crateId;
00118           varc = varcId;
00119           etc = etcId;
00120           sparserr = 0;
00121           etcerr = 1;
00122           errcode = errCode;
00123           TDirectory* tmpddd = gDirectory;
00124           fVarcErrorsFile->cd();
00125           fVarcErrorsTree->Fill();
00126           gDirectory = tmpddd;
00127         }
00128 
00129       }
00130 
00131     }
00132   }
00133   
00134   MSG("FarDetVarcErrorsDump",Msg::kDebug) << " *** FarDetVarcErrorsDump::Ana( ) FINISHED *** " << endl;
00135 
00136   return result;
00137 
00138 }

void FarDetVarcErrorsDump::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 35 of file FarDetVarcErrorsDump.cxx.

References Msg::kInfo, and MSG.

00036 {
00037   MSG("FarDetVarcErrorsDump",Msg::kInfo) << " *** FarDetVarcErrorsDump::BeginJob() *** " << endl;
00038 
00039 }

void FarDetVarcErrorsDump::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 140 of file FarDetVarcErrorsDump.cxx.

References fVarcErrorsFile, fVarcErrorsTree, Msg::kInfo, and MSG.

00141 {
00142   MSG("FarDetVarcErrorsDump",Msg::kInfo) << " *** FarDetVarcErrorsDump::EndJob() *** " << endl;
00143   if(fVarcErrorsFile){
00144     MSG("FarDetVarcErrorsDump",Msg::kInfo) << " *** saving data to file *** " << endl;
00145     TDirectory* tmpddd = gDirectory;
00146     fVarcErrorsFile->cd();
00147     fVarcErrorsTree->Write();
00148     fVarcErrorsFile->Close();
00149     gDirectory = tmpddd;
00150     MSG("FarDetVarcErrorsDump",Msg::kInfo) << " *** data saved to file *** " << endl;
00151   }
00152 }


Member Data Documentation

Int_t FarDetVarcErrorsDump::crate [private]

Definition at line 29 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Int_t FarDetVarcErrorsDump::date [private]

Definition at line 26 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Definition at line 30 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Int_t FarDetVarcErrorsDump::etc [private]

Definition at line 29 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Definition at line 28 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Definition at line 23 of file FarDetVarcErrorsDump.h.

Referenced by Ana(), and EndJob().

Definition at line 24 of file FarDetVarcErrorsDump.h.

Referenced by Ana(), and EndJob().

Int_t FarDetVarcErrorsDump::run [private]

Definition at line 27 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Definition at line 28 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Int_t FarDetVarcErrorsDump::time [private]

Definition at line 26 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Definition at line 27 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Definition at line 27 of file FarDetVarcErrorsDump.h.

Referenced by Ana().

Int_t FarDetVarcErrorsDump::varc [private]

Definition at line 29 of file FarDetVarcErrorsDump.h.

Referenced by Ana().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1