OltBlockScan Class Reference

#include <OltBlockScan.h>

Inheritance diagram for OltBlockScan:
JobCModule

List of all members.

Public Member Functions

 OltBlockScan ()
 ~OltBlockScan ()
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Attributes

int fRecord
bool fDump
int fNumDump
bool fDoTree
int fStartTF
TTree * fTree
TFile * fFile
int fTreeCrate
int fTreeTime
int fCrateSec
int fCrateNSec
int fTreeTF
int fTreeIndex

Static Private Attributes

static const int CHAD_TOF = 0x1602
static const int CHAD_CER1 = 0x5b0
static const int CHAD_CER2 = 0x590
static const int CHAD_TRIGPMT = 0x1524

Detailed Description

Definition at line 26 of file OltBlockScan.h.


Constructor & Destructor Documentation

OltBlockScan::OltBlockScan (  ) 

Definition at line 55 of file OltBlockScan.cxx.

00056 {
00057   fRecord = 0;
00058   TDirectory *save = gDirectory;
00059   fFile = new TFile("/home/pa/bs.root","RECREATE");
00060   fTree = new TTree("tree","Timing Summary");
00061   fTree->Branch("crate",&fTreeCrate,"crate/I");
00062   fTree->Branch("time",&fTreeTime,"time/I");
00063   fTree->Branch("sec",&fCrateSec,"sec/I");
00064   fTree->Branch("nsec",&fCrateNSec,"nsec/I");
00065   fTree->Branch("tf",&fTreeTF,"tf/I");
00066   fTree->Branch("index",&fTreeIndex,"index/I");
00067   save->cd();
00068 }

OltBlockScan::~OltBlockScan (  ) 

Definition at line 70 of file OltBlockScan.cxx.

References fFile, and fTree.

00071 {
00072   TDirectory *save = gDirectory;
00073   fFile->cd();
00074   fTree->Write();
00075   fFile->Close();
00076   save->cd();
00077 }


Member Function Documentation

void OltBlockScan::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 195 of file OltBlockScan.cxx.

References fDoTree, fDump, fNumDump, fStartTF, and Registry::Get().

00196 {
00197   int   tmpb;
00198   cout<<"Teapots\n";
00199   cout<<r<<endl;
00200   if (r.Get("DumpData",tmpb)) { cout<<"Hello "<<tmpb<<endl;fDump = bool(tmpb); }  
00201   if (r.Get("DoTree",tmpb)) fDoTree = bool(tmpb);
00202   if (r.Get("StartTF",tmpb)) fStartTF = tmpb;
00203   if (r.Get("NumDump",tmpb)) fNumDump = tmpb;
00204 }

const Registry & OltBlockScan::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 172 of file OltBlockScan.cxx.

References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00173 {
00174 
00175   static Registry r; // Default configuration for module
00176 
00177 
00178   std::string name = this->JobCModule::GetName();
00179   name += ".config.default";
00180   r.SetName(name.c_str());
00181 
00182   // Set values in configuration
00183   r.UnLockValues();
00184   r.Set("DumpData", true);
00185   r.Set("NumDump",10);
00186   r.Set("DoTree", false);
00187   r.Set("StartTF",0);
00188   r.LockValues();
00189 
00190   return r;
00191 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 79 of file OltBlockScan.cxx.

References fCrateNSec, fCrateSec, fDoTree, fDump, fFile, fNumDump, MomNavigator::FragmentIter(), fRecord, fStartTF, fTree, fTreeCrate, fTreeIndex, fTreeTF, fTreeTime, RawDataBlock::GetBlockId(), RawDigit::GetChannel(), RawChannelId::GetCrate(), RawDigit::GetCrateT0(), RawDigitDataBlock::GetDatumIter(), VldTimeStamp::GetNanoSec(), RawRecord::GetRawBlockIter(), RawSnarlHeaderBlock::GetRun(), RawDaqHeaderBlock::GetRun(), RawRunCommentBlock::GetRunComment(), RawRunConfigBlock::GetRunConfig(), VldTimeStamp::GetSec(), RawDaqHeaderBlock::GetSubRun(), RawSnarlHeaderBlock::GetSubRun(), RawDigit::GetTDC(), RawSnarlHeaderBlock::GetTimeFrameNo(), RawDaqHeaderBlock::GetTimeStamp(), RawSnarlHeaderBlock::GetTriggerTime(), it, JobCResult::kAOK, Msg::kInfo, and MSG.

00080 {
00081   //MSG("Olt",Msg::kVerbose) << "OltModule::Reco()\n";
00082   // Find RawRecord fragment in MOM.
00083   TIter iter = mom->FragmentIter();
00084   while (TObject *obj = iter.Next()) {
00085     RawRecord *rawrec = dynamic_cast<RawRecord *>(obj);
00086     if (rawrec) {
00087       ++fRecord;
00088       MSG("Olt",Msg::kInfo) <<"---------------New Record---------------"<<endl;
00089       TIter recit = rawrec->GetRawBlockIter();
00090       while (TObject *obj = recit.Next()) {
00091         RawDataBlock *rawdata = dynamic_cast<RawDataBlock *>(obj);
00092         if (rawdata) {
00093           if (rawdata->InheritsFrom("RawDaqHeaderBlock")) {
00094             RawDaqHeaderBlock *rshb =dynamic_cast<RawDaqHeaderBlock *>(rawdata);
00095             MSG("Olt",Msg::kInfo)<<rshb->GetRun()<<" "<<rshb->GetSubRun()<<" "<<rshb->GetTimeStamp()<<endl;
00096           }
00097           if (rawdata->InheritsFrom("RawSnarlHeaderBlock")) {
00098             RawSnarlHeaderBlock *rshb =dynamic_cast<RawSnarlHeaderBlock *>(rawdata);
00099             fTreeTF = rshb->GetTimeFrameNo();
00100             MSG("Olt",Msg::kInfo) <<"Timeframe  "<<rshb->GetTriggerTime()<<endl;
00101             MSG("Olt",Msg::kInfo) <<"Run  "<<rshb->GetRun()<<" subrun "
00102 << rshb->GetSubRun()<<endl;
00103             MSG("Olt",Msg::kInfo) <<"Timeframe  "<<fTreeTF<<endl;
00104           } 
00105           fTreeIndex = 0;
00106           MSG("Olt",Msg::kInfo) <<fRecord<<": "<<rawdata->GetBlockId()<<endl;
00107           if (fDump) {
00108             RawDigitDataBlock *rddb = dynamic_cast<RawDigitDataBlock *>(rawdata);
00109             if (rddb) {
00110               if (fTreeTF>fStartTF) {
00111                 TIter it = rddb->GetDatumIter();
00112                 int vnumber = 0;
00113                 int qnumber = 0;
00114                 while (TObject *obj = it.Next()) {
00115                   RawVaDigit *rvd = dynamic_cast<RawVaDigit *>(obj);
00116                   if (rvd) {
00117                   ++vnumber;
00118                   if (fNumDump>0 && vnumber>fNumDump) continue;
00119                     MSG("Olt",Msg::kInfo)<<fTreeTF<<" "<<*rvd<<endl;
00120                     fTreeCrate = 0;
00121                     fTreeTime = rvd->GetTDC();
00122                     fCrateSec = rvd->GetCrateT0().GetSec();
00123                     fCrateNSec = rvd->GetCrateT0().GetNanoSec();
00124                     //fTreeTF = fRecord;
00125                     TDirectory *save = gDirectory;
00126                     if (fDoTree) {
00127                       fFile->cd();
00128                       fTree->Fill();
00129                       save->cd();
00130                     }
00131                     ++fTreeIndex;
00132                   }
00133                   RawQieDigit *rqd = dynamic_cast<RawQieDigit *>(obj);
00134                   if (rqd) {
00135                   ++qnumber;
00136                   if (fNumDump>0 && qnumber>fNumDump) break;
00137                     MSG("Olt",Msg::kInfo)<<fTreeTF<<" "<<*rqd<<endl;
00138                 RawChannelId rcid = rqd->GetChannel();
00139                 fTreeCrate = rcid.GetCrate();
00140 //                  fTreeCrate = 1;
00141                     fTreeTime = rqd->GetTDC();
00142                     fCrateSec = rqd->GetCrateT0().GetSec();
00143                     fCrateNSec = rqd->GetCrateT0().GetNanoSec();
00144                     //fTreeTF = fRecord;
00145                     if (fDoTree) {
00146                       TDirectory *save = gDirectory;
00147                       fFile->cd();
00148                       fTree->Fill();
00149                       save->cd();
00150                     }
00151                     ++fTreeIndex;
00152                   }
00153                 }
00154               }
00155             }   
00156           }  
00157           RawRunCommentBlock *rc = dynamic_cast<RawRunCommentBlock *>(rawdata);
00158           if (rc) cout<<rc->GetRunComment()<<endl;
00159           RawRunConfigBlock *rcc = dynamic_cast<RawRunConfigBlock *>(rawdata);
00160           if (rcc) cout<<rcc->GetRunConfig()<<endl;
00161         }
00162       }
00163       
00164     }
00165   }
00166   return JobCResult::kAOK;
00167 
00168 }


Member Data Documentation

const int OltBlockScan::CHAD_CER1 = 0x5b0 [static, private]

Definition at line 48 of file OltBlockScan.h.

const int OltBlockScan::CHAD_CER2 = 0x590 [static, private]

Definition at line 49 of file OltBlockScan.h.

const int OltBlockScan::CHAD_TOF = 0x1602 [static, private]

Definition at line 47 of file OltBlockScan.h.

const int OltBlockScan::CHAD_TRIGPMT = 0x1524 [static, private]

Definition at line 50 of file OltBlockScan.h.

int OltBlockScan::fCrateNSec [private]

Definition at line 61 of file OltBlockScan.h.

Referenced by Reco().

int OltBlockScan::fCrateSec [private]

Definition at line 60 of file OltBlockScan.h.

Referenced by Reco().

bool OltBlockScan::fDoTree [private]

Definition at line 54 of file OltBlockScan.h.

Referenced by Config(), and Reco().

bool OltBlockScan::fDump [private]

Definition at line 52 of file OltBlockScan.h.

Referenced by Config(), and Reco().

TFile* OltBlockScan::fFile [private]

Definition at line 57 of file OltBlockScan.h.

Referenced by Reco(), and ~OltBlockScan().

int OltBlockScan::fNumDump [private]

Definition at line 53 of file OltBlockScan.h.

Referenced by Config(), and Reco().

int OltBlockScan::fRecord [private]

Definition at line 51 of file OltBlockScan.h.

Referenced by Reco().

int OltBlockScan::fStartTF [private]

Definition at line 55 of file OltBlockScan.h.

Referenced by Config(), and Reco().

TTree* OltBlockScan::fTree [private]

Definition at line 56 of file OltBlockScan.h.

Referenced by Reco(), and ~OltBlockScan().

int OltBlockScan::fTreeCrate [private]

Definition at line 58 of file OltBlockScan.h.

Referenced by Reco().

int OltBlockScan::fTreeIndex [private]

Definition at line 63 of file OltBlockScan.h.

Referenced by Reco().

int OltBlockScan::fTreeTF [private]

Definition at line 62 of file OltBlockScan.h.

Referenced by Reco().

int OltBlockScan::fTreeTime [private]

Definition at line 59 of file OltBlockScan.h.

Referenced by Reco().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1