DumpBadElectronics Class Reference

#include <DumpBadElectronics.h>

Inheritance diagram for DumpBadElectronics:
JobCModule

List of all members.

Public Member Functions

 DumpBadElectronics ()
 ~DumpBadElectronics ()
void BeginJob ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void HandleCommand (JobCommand *command)
void EndJob ()

Private Member Functions

void ProcessHeader (TObject *obj)
void ProcessBlock (TObject *obj)
void WriteOutResults ()

Private Attributes

Int_t fTime
Int_t fRecord
Int_t fCounter
DQHeaderfDQHeader
DQHotColdElectronicsfDQHotColdElectronics
TFile * fBadElectronicsFile
TTree * fBadElectronicsTree
Int_t Time
Int_t Crates
Int_t CratesInReadout
Int_t ColdChips [2]
Int_t HotChips [2]

Detailed Description

Definition at line 15 of file DumpBadElectronics.h.


Constructor & Destructor Documentation

DumpBadElectronics::DumpBadElectronics (  ) 

Definition at line 28 of file DumpBadElectronics.cxx.

References Msg::kInfo, and MSG.

00028                                        :
00029   fTime(0),
00030   fRecord(0),
00031   fCounter(0),
00032   fDQHeader(0),
00033   fDQHotColdElectronics(0),
00034   fBadElectronicsFile(0),
00035   fBadElectronicsTree(0)
00036 {
00037   MSG("DataQuality",Msg::kInfo) << " *** DumpBadElectronics::DumpBadElectronics() *** " << endl;
00038 
00039   // Create the monitoring objects which extract the
00040   // monitoring information from the raw data blocks
00041 
00042   fDQHeader = new DQHeader();
00043   fDQHotColdElectronics = new DQHotColdElectronics();
00044 }

DumpBadElectronics::~DumpBadElectronics (  ) 

Definition at line 46 of file DumpBadElectronics.cxx.

References fDQHeader, fDQHotColdElectronics, Msg::kInfo, and MSG.

00047 {
00048   MSG("DataQuality",Msg::kInfo) << " *** DumpBadElectronics::~DumpBadElectronics() *** " << endl;
00049 
00050   delete fDQHeader;  
00051   delete fDQHotColdElectronics;
00052 
00053 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 61 of file DumpBadElectronics.cxx.

References fCounter, fDQHotColdElectronics, MomNavigator::FragmentIter(), fRecord, fTime, RawRecord::GetRawBlockIter(), RawRecord::GetRawHeader(), DQHotColdElectronics::GetTime(), Msg::kDebug, Msg::kInfo, JobCResult::kPassed, Msg::kWarning, MSG, ProcessBlock(), ProcessHeader(), JobCResult::SetFailed(), and WriteOutResults().

00062 {
00063   MSG("DataQuality",Msg::kDebug) << " *** DumpBadElectronics::Ana(...) *** " << endl;
00064 
00065   JobCResult result(JobCResult::kPassed);
00066 
00067   TObject* momobject = 0;
00068 
00069   fRecord=0;
00070 
00071   // PROCESS RAW RECORDS
00072   // ===================
00073   // Iterate over raw records in mom and extract
00074   // monitoring information from raw data blocks
00075                    
00076   TIter momitr(mom->FragmentIter());
00077   while((momobject = momitr())){
00078     if(momobject->InheritsFrom("RawRecord")){
00079       fRecord=1;
00080       fCounter++;
00081       MSG("DataQuality",Msg::kInfo) << "  *** RAW RECORD [" << fCounter << "] ***  " << endl;
00082       RawRecord* rawrec = dynamic_cast<RawRecord*>(momobject);
00083 
00084       // Process the raw header
00085       this->ProcessHeader((TObject*)(rawrec->GetRawHeader()));
00086 
00087       // Iterate over the raw blocks in raw record
00088       TIter rawrecitr = rawrec->GetRawBlockIter();
00089       TObject* tob = 0;
00090       while((tob = rawrecitr())){
00091         MSG("DataQuality",Msg::kDebug) << " " << tob->GetName() << endl;
00092         this->ProcessBlock(tob);
00093       }
00094                                                        
00095     }
00096   }
00097                                               
00098   if( !fRecord ){
00099     MSG("DataQuality",Msg::kWarning) << "  *** FAILED TO FIND RAW RECORD ***  " << endl;
00100     return result.SetFailed();
00101   }
00102 
00103   // WRITE OUT RESULTS
00104   // =================
00105 
00106   if( fDQHotColdElectronics->GetTime()>fTime ){
00107     fTime=fDQHotColdElectronics->GetTime();
00108     this->WriteOutResults();
00109   }
00110 
00111   return result;
00112 }

void DumpBadElectronics::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 55 of file DumpBadElectronics.cxx.

References Msg::kInfo, and MSG.

00056 {
00057   MSG("DataQuality",Msg::kInfo) << " *** DumpBadElectronics::BeginJob() *** " << endl;
00058 
00059 }

void DumpBadElectronics::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 127 of file DumpBadElectronics.cxx.

References Msg::kInfo, and MSG.

00128 {
00129   MSG("DataQuality",Msg::kInfo) << " *** DumpBadElectronics::Config() *** " << endl;
00130 
00131 }

const Registry & DumpBadElectronics::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 114 of file DumpBadElectronics.cxx.

References Msg::kInfo, Registry::LockValues(), MSG, and Registry::UnLockValues().

00115 {
00116   MSG("DataQuality",Msg::kInfo) << " *** DumpBadElectronics::DefaultConfig() *** " << endl;
00117  
00118   static Registry r;
00119   r.SetName("DumpBadElectronics.config.default");
00120   r.UnLockValues();
00121   
00122   r.LockValues();
00123                                                  
00124   return r;
00125 }

void DumpBadElectronics::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 142 of file DumpBadElectronics.cxx.

References fBadElectronicsFile, fBadElectronicsTree, Msg::kInfo, and MSG.

00143 {
00144   MSG("DataQuality",Msg::kInfo) << " *** DumpBadElectronics::EndJob() *** " << endl;
00145  
00146   if(fBadElectronicsFile){
00147     MSG("DataQuality",Msg::kInfo) << " *** saving info to file ... " << endl;
00148     TDirectory* tmpd = gDirectory;
00149     fBadElectronicsFile->cd();
00150     fBadElectronicsTree->Write();
00151     fBadElectronicsFile->Close();
00152     gDirectory = tmpd;
00153     MSG("DataQuality",Msg::kInfo) << "      ... info saved to file *** " << endl;
00154   }
00155 }

void DumpBadElectronics::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 133 of file DumpBadElectronics.cxx.

References JobCommand::PopCmd(), and JobCommand::PopOpt().

00134 {
00135   TString cmd = command->PopCmd();
00136   if(cmd=="Set"){
00137     TString opt = command->PopOpt();
00138  
00139   }
00140 }

void DumpBadElectronics::ProcessBlock ( TObject *  obj  )  [private]

Definition at line 177 of file DumpBadElectronics.cxx.

References fDQHeader, fDQHotColdElectronics, Msg::kDebug, MSG, DQHotColdElectronics::Process(), and DQHeader::Process().

Referenced by Ana().

00178 {
00179              
00180   // HEADER BLOCKS
00181   // =============
00182   if(obj->InheritsFrom("RawDaqHeaderBlock")){
00183     MSG("DataQuality",Msg::kDebug) << " ... found RawDaqHeaderBlock " << endl;
00184     RawDaqHeaderBlock* rdb = (RawDaqHeaderBlock*)(obj);
00185     fDQHeader->Process(rdb); 
00186   }
00187                               
00188   if(obj->InheritsFrom("RawSnarlHeaderBlock")){
00189     MSG("DataQuality",Msg::kDebug) << " ... found RawSnarlHeaderBlock " << endl;
00190     RawSnarlHeaderBlock* rdb = (RawSnarlHeaderBlock*)(obj);
00191     fDQHeader->Process(rdb);
00192   }
00193                                                           
00194   // TP SINGLES SUMMARY BLOCK
00195   // ========================
00196   if(obj->InheritsFrom("RawTpSinglesSummaryBlock")){
00197     MSG("DataQuality",Msg::kDebug) << " ... found RawTpSinglesSummaryBlock " << endl;
00198     RawTpSinglesSummaryBlock* rdb = (RawTpSinglesSummaryBlock*)(obj);
00199     fDQHotColdElectronics->Process(rdb);
00200   }
00201 
00202 }

void DumpBadElectronics::ProcessHeader ( TObject *  obj  )  [private]

Definition at line 157 of file DumpBadElectronics.cxx.

References fDQHeader, Msg::kDebug, MSG, and DQHeader::Process().

Referenced by Ana().

00158 {
00159                                                                   
00160   // DAQ HEADER
00161   // ==========
00162   if(obj->InheritsFrom("RawDaqHeader")){
00163     MSG("DataQuality",Msg::kDebug) << " ... found RawDaqHeader " << endl;
00164     RawDaqHeader* hdr = (RawDaqHeader*)(obj);
00165     fDQHeader->Process(hdr);
00166   }
00167                                                          
00168   // SNARL HEADER
00169   // ============
00170   if(obj->InheritsFrom("RawDaqSnarlHeader")){
00171     MSG("DataQuality",Msg::kDebug) << " ... found RawDaqSnarlHeader " << endl;
00172     RawDaqSnarlHeader* hdr = (RawDaqSnarlHeader*)(obj);
00173     fDQHeader->Process(hdr);
00174   }
00175 }

void DumpBadElectronics::WriteOutResults (  )  [private]

Definition at line 204 of file DumpBadElectronics.cxx.

References ColdChips, Crates, CratesInReadout, fBadElectronicsFile, fBadElectronicsTree, fDQHotColdElectronics, DQHotColdElectronics::GetColdChips(), DQHotColdElectronics::GetHotChips(), DQHotColdElectronics::GetNumberOfCrates(), DQHotColdElectronics::GetNumberOfCratesInReadout(), DQHotColdElectronics::GetTime(), HotChips, Msg::kVerbose, MSG, and Time.

Referenced by Ana().

00205 {
00206   MSG("DataQuality",Msg::kVerbose) << " *** DumpBadElectronics::WriteOutResults() *** " << endl;
00207 
00208   Time=fDQHotColdElectronics->GetTime();
00209   Crates=fDQHotColdElectronics->GetNumberOfCrates();
00210   CratesInReadout=fDQHotColdElectronics->GetNumberOfCratesInReadout();
00211 
00212   for(Int_t k=0;k<2;k++){
00213     ColdChips[k]=fDQHotColdElectronics->GetColdChips(k+1);
00214     HotChips[k]=fDQHotColdElectronics->GetHotChips(k+1);
00215   }
00216 
00217   if(!fBadElectronicsFile){
00218     TString mystring("badchips.root");
00219     TDirectory* tmpd = gDirectory;
00220     fBadElectronicsFile = new TFile(mystring.Data(),"RECREATE");
00221     fBadElectronicsTree = new TTree("BadChips","BadChips");
00222     fBadElectronicsTree->SetAutoSave(300);
00223     fBadElectronicsTree->Branch("Time",&Time,"Time/I");
00224     fBadElectronicsTree->Branch("Crates",&Crates,"Crates/I");
00225     fBadElectronicsTree->Branch("CratesInReadout",&CratesInReadout,"CratesInReadout/I");
00226     fBadElectronicsTree->Branch("ColdChips",ColdChips,"ColdChips[2]/I");
00227     fBadElectronicsTree->Branch("HotChips",HotChips,"HotChips[2]/I");
00228     gDirectory = tmpd;
00229   }
00230  
00231   if(fBadElectronicsFile){
00232     TDirectory* tmpd = gDirectory;
00233     fBadElectronicsFile->cd();
00234     fBadElectronicsTree->Fill();
00235     gDirectory = tmpd;
00236   }
00237 
00238 }


Member Data Documentation

Int_t DumpBadElectronics::ColdChips[2] [private]

Definition at line 47 of file DumpBadElectronics.h.

Referenced by WriteOutResults().

Int_t DumpBadElectronics::Crates [private]

Definition at line 45 of file DumpBadElectronics.h.

Referenced by WriteOutResults().

Definition at line 46 of file DumpBadElectronics.h.

Referenced by WriteOutResults().

Definition at line 41 of file DumpBadElectronics.h.

Referenced by EndJob(), and WriteOutResults().

Definition at line 42 of file DumpBadElectronics.h.

Referenced by EndJob(), and WriteOutResults().

Definition at line 33 of file DumpBadElectronics.h.

Referenced by Ana().

Definition at line 35 of file DumpBadElectronics.h.

Referenced by ProcessBlock(), ProcessHeader(), and ~DumpBadElectronics().

Definition at line 36 of file DumpBadElectronics.h.

Referenced by Ana(), ProcessBlock(), WriteOutResults(), and ~DumpBadElectronics().

Int_t DumpBadElectronics::fRecord [private]

Definition at line 32 of file DumpBadElectronics.h.

Referenced by Ana().

Int_t DumpBadElectronics::fTime [private]

Definition at line 31 of file DumpBadElectronics.h.

Referenced by Ana().

Int_t DumpBadElectronics::HotChips[2] [private]

Definition at line 48 of file DumpBadElectronics.h.

Referenced by WriteOutResults().

Int_t DumpBadElectronics::Time [private]

Definition at line 44 of file DumpBadElectronics.h.

Referenced by WriteOutResults().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1