DataQualityReader Class Reference

#include <DataQualityReader.h>

Inheritance diagram for DataQualityReader:

JobCModule List of all members.

Public Member Functions

 DataQualityReader ()
 ~DataQualityReader ()
void BeginJob ()
JobCResult Reco (MomNavigator *mom)
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)
Bool_t ApplyFilter (CandDataQualityHandle *cdh)

Private Attributes

Bool_t fRecord
Bool_t fSnarl
Bool_t fFilter
Int_t fCounter
DQHeaderfDQHeader
DQRawDigitsfDQRawDigits
DQHotColdElectronicsfDQHotColdElectronics
DQLightInjectionfDQLightInjection
DQSpillServerfDQSpillServer
Int_t fWriteDataQuality
Int_t fWriteDeadChips
Int_t fFilterOnOff
Int_t fFilterBadDataQuality
Int_t fFilterLowMultiplicity
Int_t fFilterHighMultiplicity
Int_t fFilterWord
TFile * fDataQualityFile
TTree * fDataQualityTree
Int_t Time
Int_t RunType
Int_t Run
Int_t SubRun
Int_t TimeFrame
Int_t Snarl
Int_t TriggerSource
Int_t TriggerTime
Int_t ErrorCode
Int_t CrateMask
Int_t PreTriggerDigits
Int_t PostTriggerDigits
Int_t SnarlMultiplicity
Int_t SpillStatus
Int_t SpillType
Int_t SpillTimeError
Int_t LiTrigger
Int_t LiTime
Int_t LiSubtractedTime
Int_t LiRelativeTime
Int_t LiCalibPoint
Int_t LiCalibType
Int_t LiPulserBox
Int_t LiPulserLed
Int_t LiPulseHeight
Int_t LiPulseWidth
Int_t ColdChips
Int_t HotChips
Int_t BusyChips
Int_t ReadoutErrors
Int_t DataQuality
TFile * fDeadChipFile
TTree * fDeadChipTree
Int_t Entries
Int_t ChannelId
Int_t Adc
Int_t Tdc
Int_t TriggerRate
Int_t ChipStatus

Detailed Description

Definition at line 21 of file DataQualityReader.h.


Constructor & Destructor Documentation

DataQualityReader::DataQualityReader (  ) 

Definition at line 48 of file DataQualityReader.cxx.

References Msg::kDebug, and MSG.

00048                                      : 
00049   fRecord(0),
00050   fSnarl(0),
00051   fFilter(0),
00052   fCounter(0),
00053   fDQHeader(0),
00054   fDQRawDigits(0),
00055   fDQHotColdElectronics(0),
00056   fDQLightInjection(0),
00057   fDQSpillServer(0),
00058   fWriteDataQuality(0),
00059   fWriteDeadChips(0),
00060   fFilterOnOff(0),
00061   fFilterBadDataQuality(0),
00062   fFilterLowMultiplicity(0),
00063   fFilterHighMultiplicity(0),
00064   fFilterWord(0),
00065   fDataQualityFile(0),
00066   fDataQualityTree(0),
00067   fDeadChipFile(0),
00068   fDeadChipTree(0)
00069 {
00070   MSG("DataQuality",Msg::kDebug) << " *** DataQualityReader::DataQualityReader() *** " << endl;
00071 
00072   // Create the monitoring objects which extract the 
00073   // monitoring information from the raw data blocks
00074 
00075   fDQHeader = new DQHeader();
00076   fDQRawDigits = new DQRawDigits();
00077   fDQHotColdElectronics = new DQHotColdElectronics();
00078   fDQLightInjection = new DQLightInjection();
00079   fDQSpillServer = new DQSpillServer();
00080 }

DataQualityReader::~DataQualityReader (  ) 

Definition at line 82 of file DataQualityReader.cxx.

References fDQHeader, fDQHotColdElectronics, fDQLightInjection, fDQRawDigits, fDQSpillServer, Msg::kInfo, and MSG.

00083 {
00084   MSG("DataQuality",Msg::kInfo) << " *** DataQualityReader::~DataQualityReader() *** " << endl;
00085 
00086   delete fDQHeader;
00087   delete fDQRawDigits;
00088   delete fDQHotColdElectronics;
00089   delete fDQLightInjection;
00090   delete fDQSpillServer;
00091 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 232 of file DataQualityReader.cxx.

References Adc, BusyChips, ChannelId, ChipStatus, ColdChips, CrateMask, DataQuality, Entries, ErrorCode, fDataQualityFile, fDataQualityTree, fDeadChipFile, fDeadChipTree, CandRecord::FindCandHandle(), fWriteDataQuality, fWriteDeadChips, CandDataQualityHandle::GetBusyChips(), CandDataQualityHandle::GetColdChips(), CandDataQualityHandle::GetCrateMask(), CandDataQualityHandle::GetDataQuality(), CandHandle::GetDaughterIterator(), CandDataQualityHandle::GetErrorCode(), MomNavigator::GetFragment(), CandDataQualityHandle::GetHotChips(), CandDataQualityHandle::GetLiCalibPoint(), CandDataQualityHandle::GetLiCalibType(), CandDataQualityHandle::GetLiPulseHeight(), CandDataQualityHandle::GetLiPulserBox(), CandDataQualityHandle::GetLiPulserLed(), CandDataQualityHandle::GetLiPulseWidth(), CandDataQualityHandle::GetLiRelativeTime(), CandDataQualityHandle::GetLiSubtractedTime(), CandDataQualityHandle::GetLiTime(), CandDataQualityHandle::GetLiTrigger(), CandDataQualityHandle::GetPostTriggerDigits(), CandDataQualityHandle::GetPreTriggerDigits(), CandDataQualityHandle::GetReadoutErrors(), CandDataQualityHandle::GetRun(), CandDataQualityHandle::GetRunType(), CandDataQualityHandle::GetSnarl(), CandDataQualityHandle::GetSnarlMultiplicity(), CandDataQualityHandle::GetSpillStatus(), CandDataQualityHandle::GetSpillTimeError(), CandDataQualityHandle::GetSpillType(), CandDataQualityHandle::GetSubRun(), CandDataQualityHandle::GetTime(), CandDataQualityHandle::GetTimeFrame(), CandDataQualityHandle::GetTriggerSource(), CandDataQualityHandle::GetTriggerTime(), HotChips, Msg::kDebug, JobCResult::kPassed, LiCalibPoint, LiCalibType, LiPulseHeight, LiPulserBox, LiPulserLed, LiPulseWidth, LiRelativeTime, LiSubtractedTime, LiTime, LiTrigger, MSG, PostTriggerDigits, PreTriggerDigits, ReadoutErrors, Run, RunType, Snarl, SnarlMultiplicity, SpillStatus, SpillTimeError, SpillType, SubRun, Tdc, Time, TimeFrame, TriggerRate, TriggerSource, and TriggerTime.

00233 {
00234   MSG("DataQuality",Msg::kDebug) << " *** DataQualityReader::Ana(...) *** " << endl;
00235 
00236   JobCResult result(JobCResult::kPassed);
00237 
00238   // Write out data quality and/or dead chip info
00239 
00240   CandRecord* candrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00241   if( candrec ){
00242     CandDataQualityHandle* cdh = dynamic_cast<CandDataQualityHandle*>(candrec->FindCandHandle("CandDataQualityHandle"));
00243     if( cdh ){
00244 
00245       Time=cdh->GetTime();
00246       RunType=cdh->GetRunType();
00247       Run=cdh->GetRun();
00248       SubRun=cdh->GetSubRun();
00249       TimeFrame=cdh->GetTimeFrame();
00250       Snarl=cdh->GetSnarl();
00251       TriggerSource=cdh->GetTriggerSource();
00252       TriggerTime=cdh->GetTriggerTime();
00253       ErrorCode=cdh->GetErrorCode();
00254       CrateMask=cdh->GetCrateMask();
00255       PreTriggerDigits=cdh->GetPreTriggerDigits();
00256       PostTriggerDigits=cdh->GetPostTriggerDigits();
00257       SnarlMultiplicity=cdh->GetSnarlMultiplicity();
00258       SpillStatus=cdh->GetSpillStatus();
00259       SpillType=cdh->GetSpillType();
00260       SpillTimeError=cdh->GetSpillTimeError();
00261       LiTrigger=cdh->GetLiTrigger();
00262       LiTime=cdh->GetLiTime();
00263       LiSubtractedTime=cdh->GetLiSubtractedTime();
00264       LiRelativeTime=cdh->GetLiRelativeTime();
00265       LiCalibPoint=cdh->GetLiCalibPoint();
00266       LiCalibType=cdh->GetLiCalibType();
00267       LiPulserBox=cdh->GetLiPulserBox();
00268       LiPulserLed=cdh->GetLiPulserLed();
00269       LiPulseHeight=cdh->GetLiPulseHeight();
00270       LiPulseWidth=cdh->GetLiPulseWidth();
00271       ColdChips=cdh->GetColdChips();
00272       HotChips=cdh->GetHotChips();
00273       BusyChips=cdh->GetBusyChips();
00274       ReadoutErrors=cdh->GetReadoutErrors();   
00275       DataQuality=cdh->GetDataQuality();
00276 
00277       if(fWriteDataQuality && !fDataQualityFile){
00278         TString mystring("dataquality.root");
00279         TDirectory* tmpd = gDirectory;
00280         fDataQualityFile = new TFile(mystring.Data(),"RECREATE");
00281         fDataQualityTree = new TTree("DataQuality","DataQuality");
00282         fDataQualityTree->SetAutoSave(300);
00283         fDataQualityTree->Branch("Time",&Time,"Time/I");
00284         fDataQualityTree->Branch("RunType",&RunType,"RunType/I");
00285         fDataQualityTree->Branch("Run",&Run,"Run/I");
00286         fDataQualityTree->Branch("SubRun",&SubRun,"SubRun/I");
00287         fDataQualityTree->Branch("TimeFrame",&TimeFrame,"TimeFrame/I");
00288         fDataQualityTree->Branch("Snarl",&Snarl,"Snarl/I");
00289         fDataQualityTree->Branch("TriggerSource",&TriggerSource,"TriggerSource/I");
00290         fDataQualityTree->Branch("TriggerTime",&TriggerTime,"TriggerTime/I");
00291         fDataQualityTree->Branch("ErrorCode",&ErrorCode,"ErrorCode/I");
00292         fDataQualityTree->Branch("CrateMask",&CrateMask,"CrateMask/I");
00293         fDataQualityTree->Branch("PreTriggerDigits",&PreTriggerDigits,"PreTriggerDigits/I");
00294         fDataQualityTree->Branch("PostTriggerDigits",&PostTriggerDigits,"PostTriggerDigits/I");
00295         fDataQualityTree->Branch("SnarlMultiplicity",&SnarlMultiplicity,"SnarlMultiplicity/I");
00296         fDataQualityTree->Branch("SpillStatus",&SpillStatus,"SpillStatus/I");
00297         fDataQualityTree->Branch("SpillType",&SpillType,"SpillType/I");
00298         fDataQualityTree->Branch("SpillTimeError",&SpillTimeError,"SpillTimeError/I");
00299         fDataQualityTree->Branch("LiTrigger",&LiTrigger,"LiTrigger/I");
00300         fDataQualityTree->Branch("LiTime",&LiTime,"LiTime/I");
00301         fDataQualityTree->Branch("LiSubtractedTime",&LiSubtractedTime,"LiSubtractedTime/I");
00302         fDataQualityTree->Branch("LiRelativeTime",&LiRelativeTime,"LiRelativeTime/I");
00303         fDataQualityTree->Branch("LiCalibPoint",&LiCalibPoint,"LiCalibPoint/I");
00304         fDataQualityTree->Branch("LiCalibType",&LiCalibType,"LiCalibType/I");
00305         fDataQualityTree->Branch("LiPulserBox",&LiPulserBox,"LiPulserBox/I");
00306         fDataQualityTree->Branch("LiPulserLed",&LiPulserLed,"LiPulserLed/I");
00307         fDataQualityTree->Branch("LiPulseHeight",&LiPulseHeight,"LiPulseHeight/I");
00308         fDataQualityTree->Branch("LiPulseWidth",&LiPulseWidth,"LiPulseWidth/I");
00309         fDataQualityTree->Branch("ColdChips",&ColdChips,"ColdChips/I");
00310         fDataQualityTree->Branch("HotChips",&HotChips,"HotChips/I");
00311         fDataQualityTree->Branch("BusyChips",&BusyChips,"BusyChips/I");
00312         fDataQualityTree->Branch("ReadoutErrors",&ReadoutErrors,"ReadoutErrors/I");
00313         fDataQualityTree->Branch("DataQuality",&DataQuality,"DataQuality/I");
00314         gDirectory = tmpd;
00315       }
00316 
00317       if(fWriteDataQuality && fDataQualityFile){
00318         TDirectory* tmpd = gDirectory;
00319         fDataQualityFile->cd();
00320         fDataQualityTree->Fill();
00321         gDirectory = tmpd;
00322       }
00323       
00324       TIter deadchipitr(cdh->GetDaughterIterator());
00325       while(CandDeadChipHandle* deadchip = dynamic_cast<CandDeadChipHandle*>(deadchipitr())){
00326         if( deadchip ){
00327         
00328           Entries=deadchip->GetEntries();
00329           ChannelId=deadchip->GetChannelId().GetChAdd();
00330           Adc=deadchip->GetAdc();
00331           Tdc=deadchip->GetTdc();
00332           ErrorCode=deadchip->GetErrorCode();
00333           TriggerRate=deadchip->GetTriggerRate();
00334           ChipStatus=deadchip->GetChipStatus();
00335 
00336           if(fWriteDeadChips && !fDeadChipFile){
00337             TString mystring("deadchips.root");
00338             TDirectory* tmpd = gDirectory;
00339             fDeadChipFile = new TFile(mystring.Data(),"RECREATE");
00340             fDeadChipTree = new TTree("DeadChips","DeadChips");
00341             fDeadChipTree->SetAutoSave(300);
00342             fDeadChipTree->Branch("Time",&Time,"Time/I");
00343             fDeadChipTree->Branch("Run",&Run,"Run/I");
00344             fDeadChipTree->Branch("SubRun",&SubRun,"SubRun/I");
00345             fDeadChipTree->Branch("TimeFrame",&TimeFrame,"TimeFrame/I");
00346             fDeadChipTree->Branch("Snarl",&Snarl,"Snarl/I");
00347             fDeadChipTree->Branch("Entries",&Entries,"Entries/I");
00348             fDeadChipTree->Branch("ChannelId",&ChannelId,"ChannelId/I");
00349             fDeadChipTree->Branch("Adc",&Adc,"Adc/I");
00350             fDeadChipTree->Branch("Tdc",&Tdc,"Tdc/I");
00351             fDeadChipTree->Branch("ErrorCode",&ErrorCode,"ErrorCode/I");
00352             fDeadChipTree->Branch("TriggerRate",&TriggerRate,"TriggerRate/I");
00353             fDeadChipTree->Branch("ChipStatus",&ChipStatus,"ChipStatus/I");
00354             gDirectory = tmpd;
00355           }
00356 
00357           if(fWriteDeadChips && fDeadChipFile){
00358             TDirectory* tmpd = gDirectory;
00359             fDeadChipFile->cd();
00360             fDeadChipTree->Fill();
00361             gDirectory = tmpd;
00362           }
00363         }
00364 
00365       }
00366     }
00367   }
00368 
00369   return result;
00370 }

Bool_t DataQualityReader::ApplyFilter ( CandDataQualityHandle cdh  )  [private]

Definition at line 558 of file DataQualityReader.cxx.

References fFilterWord, CandDataQualityHandle::GetDataQuality(), Msg::kVerbose, and MSG.

Referenced by Reco().

00559 {
00560   // APPLY DATA QUALITY FILTER
00561   // =========================
00562   // pass events if:
00563   //  (a) no filter word
00564   //  (b) no problem with data quality
00565   //  (c) filter mask doesn't match quality bits
00566 
00567   Bool_t filter=0;
00568 
00569   if( ( fFilterWord==0 || cdh->GetDataQuality()==0 )
00570    || ( (cdh->GetDataQuality()&fFilterWord)==0 ) ) filter=1;
00571 
00572   MSG("DataQuality",Msg::kVerbose) << "  APPLY FILTER [filterword=" << fFilterWord << ", quality=" << cdh->GetDataQuality() << ", filter=" << filter << "]" << endl;
00573 
00574   return filter;
00575 }

void DataQualityReader::BeginJob (  )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 93 of file DataQualityReader.cxx.

References Msg::kInfo, and MSG.

00094 {
00095   MSG("DataQuality",Msg::kInfo) << " *** DataQualityReader::BeginJob() *** " << endl;
00096 
00097 }

void DataQualityReader::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 391 of file DataQualityReader.cxx.

References fFilterOnOff, fFilterWord, fWriteDataQuality, fWriteDeadChips, Registry::Get(), CandDataQuality::kBad, Msg::kDebug, CandDataQuality::kHighMultiplicity, CandDataQuality::kLowMultiplicity, and MSG.

00392 {
00393   MSG("DataQuality",Msg::kDebug) << " *** DataQualityReader::Config() *** " << endl;
00394 
00395   Int_t tmpint;
00396   Int_t tmpFilterWord;
00397     
00398   if(r.Get("WriteDataQuality",tmpint)) fWriteDataQuality = tmpint;
00399   if(r.Get("WriteDeadChips",tmpint)) fWriteDeadChips = tmpint;
00400   if(r.Get("FilterOnOff",tmpint)) fFilterOnOff = tmpint;
00401 
00402   if(r.Get("FilterBadDataQuality",tmpint)){ 
00403     if(tmpint){
00404       tmpFilterWord = fFilterWord;
00405       fFilterWord |= CandDataQuality::kBad; 
00406       MSG("DataQuality",Msg::kDebug) << "  Filter bad data quality : " << tmpFilterWord << "|CandDataQuality::kBad = " << fFilterWord << endl; 
00407     }
00408   }
00409 
00410   if(r.Get("FilterLowMultiplicity",tmpint)){ 
00411     if(tmpint){
00412       tmpFilterWord = fFilterWord;
00413       fFilterWord |= CandDataQuality::kLowMultiplicity; 
00414       MSG("DataQuality",Msg::kDebug) << "  Filter low multiplicity : " << tmpFilterWord << "|CandDataQuality::kLowMultiplicity = " << fFilterWord << endl; 
00415     }
00416   }
00417 
00418   if(r.Get("FilterHighMultiplicity",tmpint)){ 
00419     if(tmpint){
00420       tmpFilterWord = fFilterWord;
00421       fFilterWord |= CandDataQuality::kHighMultiplicity; 
00422       MSG("DataQuality",Msg::kDebug) << "  Filter high multiplicity : " << tmpFilterWord << "|CandDataQuality::kHighMultiplicity = " << fFilterWord << endl; 
00423     }
00424   }
00425 
00426   if(r.Get("FilterWord",tmpint)){
00427     if(tmpint){
00428       tmpFilterWord = fFilterWord;
00429       fFilterWord |= tmpint; 
00430       MSG("DataQuality",Msg::kDebug) << "  Filter word : " << tmpFilterWord << "|" << tmpint << " = " << fFilterWord << endl; 
00431     }
00432   }
00433 
00434   MSG("DataQuality",Msg::kDebug)
00435     << "  configuration: " << endl
00436     << "     WriteDataQuality=" << fWriteDataQuality << endl
00437     << "     WriteDeadChips=" << fWriteDeadChips << endl
00438     << "     FilterOnOff=" << fFilterOnOff << endl
00439     << "     FilterWord=" << fFilterWord << endl;
00440 
00441   return;
00442 }

const Registry & DataQualityReader::DefaultConfig (  )  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 372 of file DataQualityReader.cxx.

References fFilterBadDataQuality, fFilterHighMultiplicity, fFilterLowMultiplicity, fFilterOnOff, fFilterWord, fWriteDataQuality, fWriteDeadChips, Msg::kDebug, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00373 {
00374   MSG("DataQuality",Msg::kDebug) << " *** DataQualityReader::DefaultConfig() *** " << endl;
00375 
00376   static Registry r;
00377   r.SetName("DataQualityReader.config.default");
00378   r.UnLockValues();
00379   r.Set("WriteDataQuality",fWriteDataQuality);
00380   r.Set("WriteDeadChips",fWriteDeadChips);
00381   r.Set("FilterOnOff",fFilterOnOff);
00382   r.Set("FilterBadDataQuality",fFilterBadDataQuality);
00383   r.Set("FilterLowMultiplicity",fFilterLowMultiplicity);
00384   r.Set("FilterHighMultiplicity",fFilterHighMultiplicity);
00385   r.Set("FilterWord",fFilterWord);
00386   r.LockValues();
00387                    
00388   return r;
00389 }

void DataQualityReader::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 453 of file DataQualityReader.cxx.

References fDataQualityFile, fDataQualityTree, fDeadChipFile, fDeadChipTree, Msg::kInfo, and MSG.

00454 {
00455   MSG("DataQuality",Msg::kInfo) << " *** DataQualityReader::EndJob() *** " << endl;
00456 
00457   if(fDataQualityFile){
00458     MSG("DataQuality",Msg::kInfo) << " *** saving data quality info to file ... " << endl;
00459     TDirectory* tmpd = gDirectory;
00460     fDataQualityFile->cd();
00461     fDataQualityTree->Write();
00462     fDataQualityFile->Close();
00463     gDirectory = tmpd;
00464     MSG("DataQuality",Msg::kInfo) << "      ... data quality info saved to file *** " << endl;
00465   }
00466 
00467   if(fDeadChipFile){
00468     MSG("DataQuality",Msg::kInfo) << " *** saving dead chip info to file ... " << endl;
00469     TDirectory* tmpd = gDirectory;
00470     fDeadChipFile->cd();
00471     fDeadChipTree->Write();
00472     fDeadChipFile->Close();
00473     gDirectory = tmpd;
00474     MSG("DataQuality",Msg::kInfo) << "      ... dead chip info saved to file *** " << endl;
00475   }
00476 }

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

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 444 of file DataQualityReader.cxx.

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

00445 {
00446   TString cmd = command->PopCmd();
00447   if(cmd=="Set"){
00448     TString opt = command->PopOpt();
00449 
00450   }
00451 }

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

Definition at line 500 of file DataQualityReader.cxx.

References fDQHeader, fDQHotColdElectronics, fDQLightInjection, fDQRawDigits, fDQSpillServer, fSnarl, Msg::kDebug, MSG, DQLightInjection::Process(), DQSpillServer::Process(), DQHotColdElectronics::Process(), DQRawDigits::Process(), and DQHeader::Process().

Referenced by Reco().

00501 {
00502 
00503   // HEADER BLOCKS
00504   // =============
00505   if(obj->InheritsFrom("RawDaqHeaderBlock")){
00506     MSG("DataQuality",Msg::kDebug) << " ... found RawDaqHeaderBlock " << endl;
00507     RawDaqHeaderBlock* rdb = (RawDaqHeaderBlock*)(obj);
00508     fDQHeader->Process(rdb);
00509     fDQRawDigits->Process(rdb);
00510   }
00511 
00512   if(obj->InheritsFrom("RawSnarlHeaderBlock")){
00513     MSG("DataQuality",Msg::kDebug) << " ... found RawSnarlHeaderBlock " << endl;
00514     RawSnarlHeaderBlock* rdb = (RawSnarlHeaderBlock*)(obj);
00515     fDQHeader->Process(rdb);
00516     fDQRawDigits->Process(rdb);
00517   }
00518 
00519   // MONITORING BLOCKS
00520   // =================
00521   if(obj->InheritsFrom("RawTpSinglesSummaryBlock")){
00522     MSG("DataQuality",Msg::kDebug) << " ... found RawTpSinglesSummaryBlock " << endl;
00523     RawTpSinglesSummaryBlock* rdb = (RawTpSinglesSummaryBlock*)(obj);
00524     fDQHotColdElectronics->Process(rdb);
00525   }
00526 
00527   if(obj->InheritsFrom("RawSpillServerMonitorBlock")){
00528     MSG("DataQuality",Msg::kDebug) << " ... found RawSpillServerMonitorBlock " << endl;
00529     RawSpillServerMonitorBlock* rdb = (RawSpillServerMonitorBlock*)(obj);
00530     fDQSpillServer->Process(rdb);
00531   }
00532 
00533   if(obj->InheritsFrom("RawLiTpmtDigitsBlock")){
00534     MSG("DataQuality",Msg::kDebug) << " ... found RawLiTpmtDigitsBlock " << endl;
00535     RawLiTpmtDigitsBlock* rdb = (RawLiTpmtDigitsBlock*)(obj);
00536     fDQLightInjection->Process(rdb);
00537   }
00538 
00539   // LIGHT INJECTION BLOCKS
00540   // ======================
00541   if(obj->InheritsFrom("RawLIAdcSummaryBlock")){
00542     MSG("DataQuality",Msg::kDebug) << " ... found RawLIAdcSummaryBlock " << endl;
00543     RawLIAdcSummaryBlock* rdb = (RawLIAdcSummaryBlock*)(obj);
00544     fDQLightInjection->Process(rdb);
00545   }
00546 
00547   // RAW DATA BLOCKS
00548   // ===============
00549   if(obj->InheritsFrom("RawDigitDataBlock")){
00550     MSG("DataQuality",Msg::kDebug) << " ... found RawDigitDataBlock " << endl;
00551     RawDigitDataBlock* rdb = (RawDigitDataBlock*)(obj);
00552     fDQRawDigits->Process(rdb);
00553     fSnarl=1;
00554   }
00555 
00556 }

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

Definition at line 478 of file DataQualityReader.cxx.

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

Referenced by Reco().

00479 {
00480 
00481   // DAQ HEADER
00482   // ==========
00483   if(obj->InheritsFrom("RawDaqHeader")){
00484     MSG("DataQuality",Msg::kDebug) << " ... found RawDaqHeader " << endl;
00485     RawDaqHeader* hdr = (RawDaqHeader*)(obj);
00486     fDQHeader->Process(hdr);
00487     fDQRawDigits->Process(hdr);
00488   }
00489 
00490   // SNARL HEADER
00491   // ============
00492   if(obj->InheritsFrom("RawDaqSnarlHeader")){
00493     MSG("DataQuality",Msg::kDebug) << " ... found RawDaqSnarlHeader " << endl;
00494     RawDaqSnarlHeader* hdr = (RawDaqSnarlHeader*)(obj);
00495     fDQHeader->Process(hdr);
00496     fDQRawDigits->Process(hdr);
00497   }
00498 }

JobCResult DataQualityReader::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 99 of file DataQualityReader.cxx.

References MomNavigator::AdoptFragment(), RecJobHistory::Append(), ApplyFilter(), RecJobHistory::CreateJobRecord(), fCounter, fDQHeader, fDQHotColdElectronics, fDQLightInjection, fDQRawDigits, fDQSpillServer, fFilter, fFilterOnOff, CandRecord::FindCandHandle(), MomNavigator::FragmentIter(), fRecord, fSnarl, AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), RecMinos::GetJobHistory(), DQHeader::GetRun(), DQHeader::GetSnarl(), RecJobHistory::kCand, Msg::kDebug, Msg::kInfo, JobCResult::kPassed, Msg::kWarning, CandDataQuality::MakeCandidate(), MSG, ProcessBlock(), ProcessHeader(), run(), CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), JobCResult::SetPassed(), and CandHandle::SetTitle().

00100 {
00101   MSG("DataQuality",Msg::kInfo) << " *** DataQualityReader::Reco(...) *** " << endl;
00102  
00103   JobCResult result(JobCResult::kPassed);
00104 
00105   VldContext vldc;
00106   TObject* momobject = 0;
00107   Int_t run,snarl;
00108 
00109   fRecord=0;
00110   fSnarl=0;
00111   fFilter=0;
00112 
00113   // ===================
00114   // PROCESS RAW RECORDS
00115   // ===================
00116   // Iterate over raw records in mom and extract 
00117   // monitoring information from raw data blocks
00118 
00119   TIter momitr(mom->FragmentIter());
00120   RawRecord* rawrec = 0;
00121   while((momobject = momitr())){
00122     if(momobject->InheritsFrom("RawRecord")){
00123       fRecord=1;
00124       fCounter++;
00125       MSG("DataQuality",Msg::kInfo) << "  *** RAW RECORD [" << fCounter << "] ***  " << endl;
00126       rawrec = dynamic_cast<RawRecord*>(momobject);
00127  
00128       // Get the raw header and extract validity context
00129       vldc = rawrec->GetRawHeader()->GetVldContext();
00130       this->ProcessHeader((TObject*)(rawrec->GetRawHeader()));
00131       
00132       // Iterate over the raw blocks in raw record
00133       TIter rawrecitr = rawrec->GetRawBlockIter();
00134       TObject* tob = 0;
00135       while((tob = rawrecitr())){
00136         MSG("DataQuality",Msg::kDebug) << " " << tob->GetName() << endl;
00137         this->ProcessBlock(tob);
00138       }  
00139 
00140     }
00141   }
00142 
00143   if( !rawrec ){
00144     MSG("DataQuality",Msg::kWarning) << "  *** FAILED TO FIND RAW RECORD ***  " << endl;
00145     return result.SetFailed();
00146   }
00147 
00148   // ===========================
00149   // MAKE DATA QUALITY CANDIDATE
00150   // ===========================
00151   // If the raw record contains a snarl then create a new
00152   // data quality candidate and add it to the CandRecord  
00153 
00154   if( fSnarl ){
00155     MSG("DataQuality",Msg::kInfo) << "  *** MAKING DATA QUALITY CANDIDATE *** " << endl;
00156     run=fDQHeader->GetRun();
00157     snarl=fDQHeader->GetSnarl();
00158 
00159     // Get the CandRecord 
00160     CandRecord* candrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00161     if(candrec==0) {
00162       MSG("DataQuality",Msg::kInfo) << "  *** MAKING NEW CANDRECORD (" << run << "," << snarl << ") ***" << endl;
00163       CandHeader *head = new CandHeader(vldc,run,snarl);
00164       candrec = new CandRecord(head);
00165       candrec->SetName("PrimaryCandidateRecord");
00166       candrec->SetTitle("Created from RawRecord.");
00167 
00168       RecJobHistory& jobhist
00169               = const_cast<RecJobHistory&>(candrec->GetJobHistory());
00170       jobhist.Append(rawrec->GetJobHistory());
00171       jobhist.CreateJobRecord(RecJobHistory::kCand);
00172 
00173       mom->AdoptFragment(candrec);
00174     }
00175 
00176     AlgFactory &af = AlgFactory::GetInstance();
00177     AlgHandle ah = af.GetAlgHandle("AlgDataQuality", "default"); 
00178 
00179     // Package up the monitoring objects and 
00180     // pass them to the data quality algorithm
00181     TObjArray* mycx = new TObjArray();
00182     mycx->Add(fDQHeader);
00183     mycx->Add(fDQRawDigits);
00184     mycx->Add(fDQHotColdElectronics);
00185     mycx->Add(fDQLightInjection);
00186     mycx->Add(fDQSpillServer);
00187 
00188     CandContext cx(this, mom);
00189     cx.SetCandRecord(candrec);
00190     cx.SetDataIn(mycx);
00191     CandDataQualityHandle dataquality = CandDataQuality::MakeCandidate(ah,cx);
00192     dataquality.SetName("CandDataQualityHandle");
00193     dataquality.SetTitle(TString("Created by CandDataQualityReader"));
00194 
00195     candrec->SecureCandHandle(dataquality);
00196 
00197     delete mycx;
00198   }
00199 
00200   // APPLY DATA QUALITY FILTER
00201   // =========================
00202   // apply filter based on data quality status bits
00203 
00204   if( fFilterOnOff ){
00205     MSG("DataQuality",Msg::kDebug) << " *** DATA QUALITY FILTER *** " << endl;
00206 
00207     if( fSnarl ){
00208       CandRecord* candrec = dynamic_cast<CandRecord*>(mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00209       if( candrec ){
00210         CandDataQualityHandle* cdh = dynamic_cast<CandDataQualityHandle*>(candrec->FindCandHandle("CandDataQualityHandle"));
00211         if( cdh ){
00212           fFilter = this->ApplyFilter(cdh);
00213         }
00214       }
00215     }
00216           
00217     if( fFilter ){
00218       MSG("DataQuality",Msg::kDebug) << "   *** PASSED FILTER *** " << endl;
00219       result.SetPassed();
00220     }
00221     else{
00222       MSG("DataQuality",Msg::kDebug) << "   *** FAILED FILTER *** " << endl;
00223       result.SetFailed();
00224     }
00225   }
00226 
00227   MSG("DataQuality",Msg::kInfo) << " *** DataQualityReader::Reco(...) FINISHED *** " << endl;
00228 
00229   return result;
00230 }


Member Data Documentation

Int_t DataQualityReader::Adc [private]

Definition at line 99 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::BusyChips [private]

Definition at line 91 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::ChannelId [private]

Definition at line 98 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::ChipStatus [private]

Definition at line 102 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::ColdChips [private]

Definition at line 89 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::CrateMask [private]

Definition at line 72 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::DataQuality [private]

Definition at line 93 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::Entries [private]

Definition at line 97 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::ErrorCode [private]

Definition at line 71 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::fCounter [private]

Definition at line 41 of file DataQualityReader.h.

Referenced by Reco().

TFile* DataQualityReader::fDataQualityFile [private]

Definition at line 61 of file DataQualityReader.h.

Referenced by Ana(), and EndJob().

TTree* DataQualityReader::fDataQualityTree [private]

Definition at line 62 of file DataQualityReader.h.

Referenced by Ana(), and EndJob().

TFile* DataQualityReader::fDeadChipFile [private]

Definition at line 95 of file DataQualityReader.h.

Referenced by Ana(), and EndJob().

TTree* DataQualityReader::fDeadChipTree [private]

Definition at line 96 of file DataQualityReader.h.

Referenced by Ana(), and EndJob().

DQHeader* DataQualityReader::fDQHeader [private]

Definition at line 43 of file DataQualityReader.h.

Referenced by ProcessBlock(), ProcessHeader(), Reco(), and ~DataQualityReader().

DQHotColdElectronics* DataQualityReader::fDQHotColdElectronics [private]

Definition at line 45 of file DataQualityReader.h.

Referenced by ProcessBlock(), Reco(), and ~DataQualityReader().

DQLightInjection* DataQualityReader::fDQLightInjection [private]

Definition at line 46 of file DataQualityReader.h.

Referenced by ProcessBlock(), Reco(), and ~DataQualityReader().

DQRawDigits* DataQualityReader::fDQRawDigits [private]

Definition at line 44 of file DataQualityReader.h.

Referenced by ProcessBlock(), ProcessHeader(), Reco(), and ~DataQualityReader().

DQSpillServer* DataQualityReader::fDQSpillServer [private]

Definition at line 47 of file DataQualityReader.h.

Referenced by ProcessBlock(), Reco(), and ~DataQualityReader().

Bool_t DataQualityReader::fFilter [private]

Definition at line 40 of file DataQualityReader.h.

Referenced by Reco().

Int_t DataQualityReader::fFilterBadDataQuality [private]

Definition at line 56 of file DataQualityReader.h.

Referenced by DefaultConfig().

Int_t DataQualityReader::fFilterHighMultiplicity [private]

Definition at line 58 of file DataQualityReader.h.

Referenced by DefaultConfig().

Int_t DataQualityReader::fFilterLowMultiplicity [private]

Definition at line 57 of file DataQualityReader.h.

Referenced by DefaultConfig().

Int_t DataQualityReader::fFilterOnOff [private]

Definition at line 55 of file DataQualityReader.h.

Referenced by Config(), DefaultConfig(), and Reco().

Int_t DataQualityReader::fFilterWord [private]

Definition at line 59 of file DataQualityReader.h.

Referenced by ApplyFilter(), Config(), and DefaultConfig().

Bool_t DataQualityReader::fRecord [private]

Definition at line 38 of file DataQualityReader.h.

Referenced by Reco().

Bool_t DataQualityReader::fSnarl [private]

Definition at line 39 of file DataQualityReader.h.

Referenced by ProcessBlock(), and Reco().

Int_t DataQualityReader::fWriteDataQuality [private]

Definition at line 53 of file DataQualityReader.h.

Referenced by Ana(), Config(), and DefaultConfig().

Int_t DataQualityReader::fWriteDeadChips [private]

Definition at line 54 of file DataQualityReader.h.

Referenced by Ana(), Config(), and DefaultConfig().

Int_t DataQualityReader::HotChips [private]

Definition at line 90 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiCalibPoint [private]

Definition at line 83 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiCalibType [private]

Definition at line 84 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiPulseHeight [private]

Definition at line 87 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiPulserBox [private]

Definition at line 85 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiPulserLed [private]

Definition at line 86 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiPulseWidth [private]

Definition at line 88 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiRelativeTime [private]

Definition at line 82 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiSubtractedTime [private]

Definition at line 81 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiTime [private]

Definition at line 80 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::LiTrigger [private]

Definition at line 79 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::PostTriggerDigits [private]

Definition at line 74 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::PreTriggerDigits [private]

Definition at line 73 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::ReadoutErrors [private]

Definition at line 92 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::Run [private]

Definition at line 65 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::RunType [private]

Definition at line 64 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::Snarl [private]

Definition at line 68 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::SnarlMultiplicity [private]

Definition at line 75 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::SpillStatus [private]

Definition at line 76 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::SpillTimeError [private]

Definition at line 78 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::SpillType [private]

Definition at line 77 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::SubRun [private]

Definition at line 66 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::Tdc [private]

Definition at line 100 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::Time [private]

Definition at line 63 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::TimeFrame [private]

Definition at line 67 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::TriggerRate [private]

Definition at line 101 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::TriggerSource [private]

Definition at line 69 of file DataQualityReader.h.

Referenced by Ana().

Int_t DataQualityReader::TriggerTime [private]

Definition at line 70 of file DataQualityReader.h.

Referenced by Ana().


The documentation for this class was generated from the following files:
Generated on Wed Dec 10 22:49:25 2014 for loon by  doxygen 1.4.7