OltTimeScan Class Reference

#include <OltTimeScan.h>

Inheritance diagram for OltTimeScan:
JobCModule

List of all members.

Public Member Functions

 OltTimeScan ()
 ~OltTimeScan ()
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 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 28 of file OltTimeScan.h.


Constructor & Destructor Documentation

OltTimeScan::OltTimeScan (  ) 

Definition at line 56 of file OltTimeScan.cxx.

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

OltTimeScan::~OltTimeScan (  ) 

Definition at line 72 of file OltTimeScan.cxx.

References fFile, and fTree.

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


Member Function Documentation

void OltTimeScan::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 181 of file OltTimeScan.cxx.

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

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

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

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

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

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 81 of file OltTimeScan.cxx.

References fDoPlex, fDump, fPlex, MomNavigator::FragmentIter(), fRecord, fTreeIndex, fTreeTF, RawDataBlock::GetBlockId(), RawDigitDataBlock::GetDatumIter(), PlexSEIdAltL::GetEnd(), RawDeadChipBlock::GetNumberOfEntries(), PlexSEIdAltL::GetPlane(), RawRecord::GetRawBlockIter(), RawRunCommentBlock::GetRunComment(), PlexHandle::GetSEIdAltL(), RawSnarlHeaderBlock::GetSnarl(), RawDigit::GetTDC(), RawSnarlHeaderBlock::GetTimeFrameNo(), RawSnarlHeaderBlock::GetVldContext(), it, JobCResult::kAOK, Msg::kInfo, and MSG.

00082 {
00083   int plane[2][61] = {{0}, {0}};
00084   TIter iter = mom->FragmentIter();
00085   while (TObject *obj = iter.Next()) {
00086     RawRecord *rawrec = dynamic_cast<RawRecord *>(obj);
00087     if (rawrec) {
00088       ++fRecord;
00089       MSG("Olt",Msg::kInfo) <<"---------------New Record---------------"<<endl;
00090       TIter recit = rawrec->GetRawBlockIter();
00091       while (TObject *obj = recit.Next()) {
00092         RawDataBlock *rawdata = dynamic_cast<RawDataBlock *>(obj);
00093         if (rawdata) {
00094           if (rawdata->InheritsFrom("RawSnarlHeaderBlock")) {
00095             RawSnarlHeaderBlock *rshb =dynamic_cast<RawSnarlHeaderBlock *>(rawdata);
00096             fTreeTF = rshb->GetTimeFrameNo();
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           MSG("Olt",Msg::kInfo) <<fRecord<<": "<<rawdata->GetBlockId()<<endl;
00103           if (fDump) {
00104           RawDigitDataBlock *rddb = dynamic_cast<RawDigitDataBlock *>(rawdata);
00105           if (rddb) {
00106             multimap<int,RawDigit *> hitmap;
00107             TIter it = rddb->GetDatumIter();
00108             while (TObject *obj = it.Next()) {
00109               RawVaDigit *rvd = dynamic_cast<RawVaDigit *>(obj);
00110               if (rvd) {
00111                 hitmap.insert(pair<int,RawDigit *>(rvd->GetTDC(),rvd));
00112               }
00113               RawQieDigit *rqd = dynamic_cast<RawQieDigit *>(obj);
00114               if (rqd) {
00115                 hitmap.insert(pair<int,RawDigit *>(int(rqd->GetTDC()*16*58.0/77.0 + 133),rqd));
00116               }
00117              }
00118 
00119             for (multimap<int,RawDigit *>::iterator it = hitmap.begin();
00120                  it!=hitmap.end();++it) {
00121               if (!fDoPlex) {         MSG("Olt",Msg::kInfo)<<(*it).first<<" "<<*((*it).second)<<endl; }
00122               else {
00123                 // Use the plex
00124                 RawChannelId rcid = (*it).second->GetChannel();
00125                 PlexSEIdAltL altl= fPlex->GetSEIdAltL(rcid);
00126                 MSG("Olt",Msg::kInfo)<<"Time: "<<(*it).first<<" Plane "<<altl.GetPlane()
00127                                      <<" End "<<altl.GetEnd()
00128                                      <<"   "<<rcid<<endl;
00129                 int p = altl.GetPlane();
00130                 if (p>-1 && p < 61) ++plane[altl.GetEnd()-1][p];
00131               }
00132             }
00133             for (int q=0;q<2;q++) {
00134             for (int i=0;i<61;i++) {
00135               if (plane[q][i]==0) {cout<<"-";}
00136               else if (plane[q][i]>9) {cout<<"9";}
00137               else {cout<<plane[q][i];}
00138 
00139             }
00140             cout<<endl;
00141             }
00142            }
00143           }       
00144           RawRunCommentBlock *rc = dynamic_cast<RawRunCommentBlock *>(rawdata);
00145           if (rc) cout<<rc->GetRunComment()<<endl;
00146 
00147           RawDeadChipBlock *dead = dynamic_cast<RawDeadChipBlock *>(rawdata);
00148           if (dead) cout<<"Dead Chips: "<<dead->GetNumberOfEntries()<<endl;
00149         }
00150       }
00151       
00152     }
00153   }
00154   return JobCResult::kAOK;
00155 
00156 }


Member Data Documentation

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

Definition at line 50 of file OltTimeScan.h.

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

Definition at line 51 of file OltTimeScan.h.

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

Definition at line 49 of file OltTimeScan.h.

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

Definition at line 52 of file OltTimeScan.h.

int OltTimeScan::fCrateNSec [private]

Definition at line 63 of file OltTimeScan.h.

int OltTimeScan::fCrateSec [private]

Definition at line 62 of file OltTimeScan.h.

bool OltTimeScan::fDoPlex [private]

Definition at line 55 of file OltTimeScan.h.

Referenced by Config(), and Reco().

bool OltTimeScan::fDump [private]

Definition at line 54 of file OltTimeScan.h.

Referenced by Config(), and Reco().

TFile* OltTimeScan::fFile [private]

Definition at line 59 of file OltTimeScan.h.

Referenced by ~OltTimeScan().

Definition at line 56 of file OltTimeScan.h.

Referenced by Reco().

int OltTimeScan::fRecord [private]

Definition at line 53 of file OltTimeScan.h.

Referenced by Reco().

TTree* OltTimeScan::fTree [private]

Definition at line 58 of file OltTimeScan.h.

Referenced by ~OltTimeScan().

int OltTimeScan::fTreeCrate [private]

Definition at line 60 of file OltTimeScan.h.

int OltTimeScan::fTreeIndex [private]

Definition at line 65 of file OltTimeScan.h.

Referenced by Reco().

int OltTimeScan::fTreeTF [private]

Definition at line 64 of file OltTimeScan.h.

Referenced by Reco().

int OltTimeScan::fTreeTime [private]

Definition at line 61 of file OltTimeScan.h.


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1