OltEnds Class Reference

#include <OltEnds.h>

Inheritance diagram for OltEnds:
JobCModule

List of all members.

Public Member Functions

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

Private Attributes

int fRecord
bool fDump
TTree * fTree
TFile * fFile
int fTreeCrate
int fTreeTime
int fCrateSec
int fCrateNSec
int fTreeTF
int fTreeIndex
VldContext fVld
TH2F * fBothEnds
TH2F * fEnd0
TH2F * fEnd1

Detailed Description

Definition at line 28 of file OltEnds.h.


Constructor & Destructor Documentation

OltEnds::OltEnds (  ) 

Definition at line 57 of file OltEnds.cxx.

00058 {
00059   fRecord = 0;
00060   TDirectory *save = gDirectory;
00061   fFile = new TFile("/home/pa/ends.root","RECREATE");
00062   fBothEnds = new TH2F("bothends","ADC: Both Ends Hit",500,0,10000,500,0,10000);
00063   save->cd();
00064 }

OltEnds::~OltEnds (  ) 

Definition at line 66 of file OltEnds.cxx.

References fBothEnds, and fFile.

00067 {
00068   TDirectory *save = gDirectory;
00069   fFile->cd();
00070   fBothEnds->Write();
00071   fFile->Close();
00072   save->cd();
00073 }


Member Function Documentation

void OltEnds::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 202 of file OltEnds.cxx.

References fDump, and Registry::Get().

00203 {
00204   int   tmpb;
00205   cout<<"Teapots\n";
00206   cout<<r<<endl;
00207   if (r.Get("DumpData",tmpb)) { cout<<"Hello "<<tmpb<<endl;fDump = bool(tmpb); }
00208 }

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

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

00183 {
00184 
00185   static Registry r; // Default configuration for module
00186 
00187 
00188   std::string name = this->JobCModule::GetName();
00189   name += ".config.default";
00190   r.SetName(name.c_str());
00191 
00192   // Set values in configuration
00193   r.UnLockValues();
00194   r.Set("DumpData", true);
00195   r.LockValues();
00196 
00197   return r;
00198 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 75 of file OltEnds.cxx.

References fBothEnds, MomNavigator::FragmentIter(), fRecord, fTreeIndex, fTreeTF, fVld, RawDigit::GetADC(), PlexSEIdAltL::GetBestSEId(), RawDigit::GetChannel(), RawDigitDataBlock::GetDatumIter(), PlexStripEndId::GetEnd(), PlexPlaneId::GetPlane(), RawRecord::GetRawBlockIter(), RawRunCommentBlock::GetRunComment(), PlexHandle::GetSEIdAltL(), PlexStripEndId::GetStrip(), RawSnarlHeaderBlock::GetTimeFrameNo(), RawSnarlHeaderBlock::GetVldContext(), it, JobCResult::kAOK, Msg::kInfo, MSG, and Munits::second.

00076 {
00077   TIter iter = mom->FragmentIter();
00078   while (TObject *obj = iter.Next()) {
00079     RawRecord *rawrec = dynamic_cast<RawRecord *>(obj);
00080     if (rawrec) {
00081       ++fRecord;
00082       TIter recit = rawrec->GetRawBlockIter();
00083       while (TObject *obj = recit.Next()) {
00084         RawDataBlock *rawdata = dynamic_cast<RawDataBlock *>(obj);
00085         if (rawdata) {
00086           if (rawdata->InheritsFrom("RawSnarlHeaderBlock")) {
00087             RawSnarlHeaderBlock *rshb =dynamic_cast<RawSnarlHeaderBlock *>(rawdata);
00088             fTreeTF = rshb->GetTimeFrameNo();
00089             fVld = rshb->GetVldContext();
00090             MSG("Olt",Msg::kInfo)<<"Timeframe "<<fTreeTF<<endl;
00091           } 
00092           fTreeIndex = 0;
00093           RawDigitDataBlock *rddb = dynamic_cast<RawDigitDataBlock *>(rawdata);
00094           if (rddb) {
00095             multimap<int,RawDigit *> hitmap[2]; // map from (plane*25 + strip)
00096             map<int,int> adc[2];
00097             PlexHandle plex(fVld);
00098             TIter it = rddb->GetDatumIter();
00099             while (TObject *obj = it.Next()) {
00100               RawVaDigit *rvd = dynamic_cast<RawVaDigit *>(obj);
00101               if (rvd) {
00102                 //cout<<*rvd<<endl;
00103                 PlexSEIdAltL altl = plex.GetSEIdAltL(rvd->GetChannel());
00104                 if (altl.size()>0) {
00105                   PlexStripEndId seid = altl.GetBestSEId();
00106                   //cout<<seid<<endl;
00107                   int plane = seid.GetPlane();
00108                   int strip = seid.GetStrip();
00109                   int end = int(seid.GetEnd());
00110                   if (end>0 && end<3) {
00111                     cout<<seid.GetEnd()<<endl;
00112                     cout<<"V "<<end<<" "<<plane<<" "<<strip<<endl;
00113                     hitmap[end-1].insert(pair<int,RawDigit *>(plane*25 + strip,rvd));
00114                     adc[end-1][plane*25 + strip] +=rvd->GetADC();
00115                   }
00116                 }
00117               }
00118               RawQieDigit *rqd = dynamic_cast<RawQieDigit *>(obj);
00119               if (rqd) {
00120                 //cout<<*rqd<<endl;
00121                 PlexSEIdAltL altl = plex.GetSEIdAltL(rqd->GetChannel());
00122                 if (altl.size()>0) {
00123                   PlexStripEndId seid = altl.GetBestSEId();
00124                   //cout<<seid<<endl;
00125                   int plane = seid.GetPlane();
00126                   int strip = seid.GetStrip();
00127                   int end = int(seid.GetEnd());
00128                   if (end>0 && end<3) {
00129                     cout<<seid.GetEnd()<<endl;
00130                     cout<<"Q "<<end<<" "<<plane<<" "<<strip<<endl;
00131                     hitmap[end-1].insert(pair<int,RawDigit *>(plane*25 + strip,rqd));           
00132                     adc[end-1][plane*25 + strip] +=(rqd->GetADC()-50);
00133                   }
00134                 }
00135               }
00136             }
00137             // Now match up hits...
00138             map<int,int>::iterator mit[2];
00139             for (int i=0;i<2;i++) mit[i] = adc[i].begin();
00140             for (;;) {
00141              if (mit[0]==adc[0].end() && mit[1]==adc[1].end()) break;
00142              if (mit[0]==adc[0].end()) {
00143                 // Side 1 only left:
00144                 ++(mit[1]);
00145               }
00146               else if (mit[1] == adc[1].end()) {
00147                 ++(mit[0]);
00148               }
00149               else {
00150                 int ind0 = (*(mit[0])).first;
00151                 int ind1 = (*(mit[1])).first;
00152                 
00153                 if (ind0==ind1) {
00154                   //Matched hits
00155                   fBothEnds->Fill((*(mit[0])).second,(*(mit[1])).second);
00156                   cout<<"Matched a hit"<<endl;
00157                   ++(mit[0]); ++(mit[1]);
00158                 }
00159                 else if (ind0 < ind1 ) {
00160                   // only on side 0
00161                   ++(mit[0]);
00162                 }
00163                 else if (ind0 > ind1) {
00164                   // only on side 1
00165                   ++(mit[1]);
00166                 }
00167               }
00168              
00169             }
00170           }
00171           RawRunCommentBlock *rc = dynamic_cast<RawRunCommentBlock *>(rawdata);
00172           if (rc) cout<<rc->GetRunComment()<<endl;
00173         }
00174       }
00175     }
00176   }
00177   return JobCResult::kAOK;
00178 }


Member Data Documentation

TH2F* OltEnds::fBothEnds [private]

Definition at line 65 of file OltEnds.h.

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

int OltEnds::fCrateNSec [private]

Definition at line 57 of file OltEnds.h.

int OltEnds::fCrateSec [private]

Definition at line 56 of file OltEnds.h.

bool OltEnds::fDump [private]

Definition at line 50 of file OltEnds.h.

Referenced by Config().

TH2F* OltEnds::fEnd0 [private]

Definition at line 66 of file OltEnds.h.

TH2F* OltEnds::fEnd1 [private]

Definition at line 67 of file OltEnds.h.

TFile* OltEnds::fFile [private]

Definition at line 53 of file OltEnds.h.

Referenced by ~OltEnds().

int OltEnds::fRecord [private]

Definition at line 49 of file OltEnds.h.

Referenced by Reco().

TTree* OltEnds::fTree [private]

Definition at line 52 of file OltEnds.h.

int OltEnds::fTreeCrate [private]

Definition at line 54 of file OltEnds.h.

int OltEnds::fTreeIndex [private]

Definition at line 59 of file OltEnds.h.

Referenced by Reco().

int OltEnds::fTreeTF [private]

Definition at line 58 of file OltEnds.h.

Referenced by Reco().

int OltEnds::fTreeTime [private]

Definition at line 55 of file OltEnds.h.

Definition at line 63 of file OltEnds.h.

Referenced by Reco().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1