OltRawLI Class Reference

#include <OltRawLI.h>

Inheritance diagram for OltRawLI:
JobCModule

List of all members.

Public Member Functions

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

Private Attributes

int fRecord
bool fDump
bool fDoPlex
PlexHandlefPlex
TTree * fTree
TFile * fFile
int fTreeCrate
int fTreeTime
int fElec
int fTreeTF
int fTreeIndex
int fTrigTime
int fTreeSubTime

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 28 of file OltRawLI.h.


Constructor & Destructor Documentation

OltRawLI::OltRawLI (  ) 

Definition at line 56 of file OltRawLI.cxx.

00057 {
00058   fRecord = 0;
00059   TDirectory *save = gDirectory;
00060   fFile = new TFile("/home/pa/rawli.root","RECREATE");
00061   fTree = new TTree("tree","Raw LI Timing Summary");
00062   fTree->Branch("crate",&fTreeCrate,"crate/I");
00063   fTree->Branch("time",&fTreeTime,"time/I");
00064   fTree->Branch("subtime",&fTreeSubTime,"subtime/I");
00065   fTree->Branch("elec",&fElec,"elec/I");
00066   fTree->Branch("tf",&fTreeTF,"tf/I");
00067   fTree->Branch("index",&fTreeIndex,"index/I");
00068   save->cd();
00069   fPlex = 0;
00070 }

OltRawLI::~OltRawLI (  ) 

Definition at line 72 of file OltRawLI.cxx.

References fFile, and fTree.

00073 {
00074   TDirectory *save = gDirectory;
00075   fFile->cd();
00076   fTree->Print();
00077   fTree->Write();
00078   fFile->Close();
00079   save->cd();
00080 }


Member Function Documentation

void OltRawLI::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 178 of file OltRawLI.cxx.

References fDoPlex, fDump, and Registry::Get().

00179 {
00180   int   tmpb;
00181   cout<<"Teapots\n";
00182   cout<<r<<endl;
00183   if (r.Get("DumpData",tmpb)) { cout<<"Hello "<<tmpb<<endl;fDump = bool(tmpb); }
00184   if (r.Get("Plex",tmpb)) { cout<<"Plex "<<tmpb<<endl;fDoPlex = bool(tmpb); }
00185 }

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

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

00158 {
00159 
00160   static Registry r; // Default configuration for module
00161 
00162 
00163   std::string name = this->JobCModule::GetName();
00164   name += ".config.default";
00165   r.SetName(name.c_str());
00166 
00167   // Set values in configuration
00168   r.UnLockValues();
00169   r.Set("DumpData", true);
00170   r.Set("Plex", true);
00171   r.LockValues();
00172 
00173   return r;
00174 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 82 of file OltRawLI.cxx.

References CHAD_TRIGPMT, fDoPlex, fElec, fPlex, MomNavigator::FragmentIter(), fRecord, fTree, fTreeCrate, fTreeIndex, fTreeSubTime, fTreeTF, fTreeTime, fTrigTime, RawChannelId::GetChAdd(), RawDigit::GetChannel(), RawChannelId::GetCrate(), RawDigitDataBlock::GetDatumIter(), RawRecord::GetRawBlockIter(), RawSnarlHeaderBlock::GetSnarl(), RawDigit::GetTDC(), RawSnarlHeaderBlock::GetTimeFrameNo(), RawSnarlHeaderBlock::GetVldContext(), it, JobCResult::kAOK, Msg::kInfo, Msg::kVerbose, Msg::kWarning, and MSG.

00083 {
00084   TIter iter = mom->FragmentIter();
00085   while (TObject *obj = iter.Next()) {
00086     RawRecord *rawrec = dynamic_cast<RawRecord *>(obj);
00087     if (rawrec) {
00088       ++fRecord;
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("RawSnarlHeaderBlock")) {
00094             RawSnarlHeaderBlock *rshb =dynamic_cast<RawSnarlHeaderBlock *>(rawdata);
00095             fTreeTF = rshb->GetTimeFrameNo();
00096             fTreeIndex = rshb->GetSnarl();
00097             MSG("Olt",Msg::kInfo)<<"Timeframe "<<fTreeTF<<"  "
00098                                  <<"Snarl "<<rshb->GetSnarl()<<endl;
00099             if (fDoPlex && !fPlex) fPlex = new PlexHandle(rshb->GetVldContext());
00100           } 
00101           //      fTreeIndex = 0;
00102           RawDigitDataBlock *rddb = dynamic_cast<RawDigitDataBlock *>(rawdata);
00103           if (rddb) {
00104             multimap<int,RawDigit *> hitmap;
00105             bool gottrig = false;
00106             TIter it = rddb->GetDatumIter();
00107             while (TObject *obj = it.Next()) {
00108               RawVaDigit *rvd = dynamic_cast<RawVaDigit *>(obj);
00109               if (rvd) {
00110                 hitmap.insert(pair<int,RawDigit *>(rvd->GetTDC(),rvd));
00111                 RawChannelId rcid = rvd->GetChannel();
00112                 if (rcid.GetCrate()==0 && CHAD_TRIGPMT==rcid.GetChAdd()) {
00113                   fTrigTime = rvd->GetTDC();
00114                   gottrig = true;
00115                   MSG("Olt",Msg::kVerbose)<<"Trigger PMT is at "<<fTrigTime<<endl;
00116                 }
00117               }
00118               RawQieDigit *rqd = dynamic_cast<RawQieDigit *>(obj);
00119               if (rqd) {
00120                 hitmap.insert(pair<int,RawDigit *>(int(rqd->GetTDC()*16*58.0/77.0 + 133),rqd));
00121               }
00122             }
00123             if (!gottrig) MSG("Olt",Msg::kWarning)<<"Missing Trigger PMT in tf "<<fTreeTF<<" snarl "<<fTreeIndex<<endl;
00124             for (multimap<int,RawDigit *>::iterator it = hitmap.begin();
00125                  it!=hitmap.end();++it) {
00126               RawQieDigit *q = dynamic_cast<RawQieDigit *>((*it).second);
00127               if (q) {
00128                 fElec = 2;
00129                 fTreeTime = int(q->GetTDC()*16*58.0/77.0 + 133);
00130               } else {
00131                 fElec = 1;
00132                 fTreeTime = (*it).second->GetTDC();
00133               }
00134               RawChannelId rcid = (*it).second->GetChannel();
00135               fTreeCrate = rcid.GetCrate();
00136               fTreeSubTime = fTreeTime - fTrigTime;
00137               MSG("Olt",Msg::kVerbose)<<"Time "<<fTreeTime<<" Trig "<<fTrigTime<<endl;
00138               fTree->Fill();
00139 
00140         
00141             }
00142           }
00143           
00144           
00145           
00146         }
00147       }
00148       
00149     }
00150   }
00151   return JobCResult::kAOK;
00152   
00153 }


Member Data Documentation

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

Definition at line 50 of file OltRawLI.h.

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

Definition at line 51 of file OltRawLI.h.

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

Definition at line 49 of file OltRawLI.h.

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

Definition at line 52 of file OltRawLI.h.

Referenced by Reco().

bool OltRawLI::fDoPlex [private]

Definition at line 55 of file OltRawLI.h.

Referenced by Config(), and Reco().

bool OltRawLI::fDump [private]

Definition at line 54 of file OltRawLI.h.

Referenced by Config().

int OltRawLI::fElec [private]

Definition at line 62 of file OltRawLI.h.

Referenced by Reco().

TFile* OltRawLI::fFile [private]

Definition at line 59 of file OltRawLI.h.

Referenced by ~OltRawLI().

Definition at line 56 of file OltRawLI.h.

Referenced by Reco().

int OltRawLI::fRecord [private]

Definition at line 53 of file OltRawLI.h.

Referenced by Reco().

TTree* OltRawLI::fTree [private]

Definition at line 58 of file OltRawLI.h.

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

int OltRawLI::fTreeCrate [private]

Definition at line 60 of file OltRawLI.h.

Referenced by Reco().

int OltRawLI::fTreeIndex [private]

Definition at line 64 of file OltRawLI.h.

Referenced by Reco().

int OltRawLI::fTreeSubTime [private]

Definition at line 66 of file OltRawLI.h.

Referenced by Reco().

int OltRawLI::fTreeTF [private]

Definition at line 63 of file OltRawLI.h.

Referenced by Reco().

int OltRawLI::fTreeTime [private]

Definition at line 61 of file OltRawLI.h.

Referenced by Reco().

int OltRawLI::fTrigTime [private]

Definition at line 65 of file OltRawLI.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