// $Id$ // // File: DRemoteScintillatorHit_factory.cc // Created: Fri Dec 2 16:58:45 EST 2011 // Creator: davidl (on Linux ifarm1102 2.6.18-128.7.1.el5 x86_64) // #include #include using namespace std; #include "DRemoteScintillatorHit_factory.h" using namespace jana; //------------------ // init //------------------ jerror_t DRemoteScintillatorHit_factory::init(void) { return NOERROR; } //------------------ // brun //------------------ jerror_t DRemoteScintillatorHit_factory::brun(jana::JEventLoop *eventLoop, int runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t DRemoteScintillatorHit_factory::evnt(JEventLoop *loop, int eventnumber) { vector windowRawData; loop->Get(windowRawData); for(unsigned int i=0; ichan != 15)continue; const D250EventTime *eventTime = NULL; wrd->GetSingle(eventTime); if(!eventTime)continue; // need associated D250EventTime object for time if(eventTime->slot!=9)continue; // Create new hit object DRemoteScintillatorHit *hit = new DRemoteScintillatorHit; 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 DRemoteScintillatorHit_factory::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t DRemoteScintillatorHit_factory::fini(void) { return NOERROR; }