// $Id$ // // File: DMiniFCALHit_factory.cc // Created: Thu Dec 1 13:49:07 EST 2011 // Creator: davidl (on Linux ifarm1102 2.6.18-128.7.1.el5 x86_64) // #include #include using namespace std; #include "DMiniFCALHit_factory.h" #include "FCALTEST2011/D250WindowRawData.h" #include "FCALTEST2011/D250EventTime.h" using namespace jana; //------------------ // init //------------------ jerror_t DMiniFCALHit_factory::init(void) { return NOERROR; } //------------------ // brun //------------------ jerror_t DMiniFCALHit_factory::brun(jana::JEventLoop *eventLoop, int runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t DMiniFCALHit_factory::evnt(JEventLoop *loop, int eventnumber) { vector windowRawData; loop->Get(windowRawData); for(unsigned int i=0; iGetSingle(eventTime); if(!eventTime)continue; // need associated D250EventTime object for time // Determine row and column from slot and channel int col = wrd->chan%5; int row = wrd->chan/5 + (eventTime->slot==9 ? 3:0); // Ignore channels that are not calorimeter blocks if(col<0 || col>4 || row<0 || row>4)continue; if(eventTime->slot==5)continue; if(eventTime->slot==7 && wrd->chan>14)continue; if(eventTime->slot==9 && wrd->chan>9)continue; // Create new hit object DMiniFCALHit *hit = new DMiniFCALHit; hit->col = col; hit->row = row; hit->AddAssociatedObject(wrd); hit->AddAssociatedObject(eventTime); _data.push_back(hit); // Determine pedestal from first 10 samples hit->ped = 0.0; unsigned int Nped_samples=0; for(; Nped_samples<10; Nped_samples++){ if(Nped_samples>=wrd->samples.size())break; hit->ped += (double)wrd->samples[Nped_samples]; } hit->ped /= (double)Nped_samples; // Sum all samples and subtract pedestal hit->sum = 0; for(unsigned int j=0; jsamples.size(); j++){ hit->sum += (double)wrd->samples[j] - hit->ped; } } return NOERROR; } //------------------ // erun //------------------ jerror_t DMiniFCALHit_factory::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t DMiniFCALHit_factory::fini(void) { return NOERROR; }