// $Id$ // // File: DPaddleHit_factory.cc // Created: Thu Dec 8 08:05:34 EST 2011 // Creator: davidl (on Linux ifarm1102 2.6.18-128.7.1.el5 x86_64) // #include #include using namespace std; #include "DPaddleHit_factory.h" using namespace jana; //------------------ // init //------------------ jerror_t DPaddleHit_factory::init(void) { return NOERROR; } //------------------ // brun //------------------ jerror_t DPaddleHit_factory::brun(jana::JEventLoop *eventLoop, int runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t DPaddleHit_factory::evnt(JEventLoop *loop, int eventnumber) { vector windowRawData; loop->Get(windowRawData); for(unsigned int i=0; ichan > 9)continue; const D250EventTime *eventTime = NULL; wrd->GetSingle(eventTime); if(!eventTime)continue; // need associated D250EventTime object for time if(eventTime->slot!=5)continue; // Create new hit object DPaddleHit *hit = new DPaddleHit; hit->AddAssociatedObject(wrd); hit->AddAssociatedObject(eventTime); hit->chid = wrd->chan%5; hit->orientation = wrd->chan/5; _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 DPaddleHit_factory::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t DPaddleHit_factory::fini(void) { return NOERROR; }