// $Id$ // // File: JEventProcessor_fcal_beamtest_hists.cc // Created: Tue Nov 29 15:47:50 EST 2011 // Creator: davidl (on Linux ifarm1102 2.6.18-128.7.1.el5 x86_64) // #include using namespace std; #include "JEventProcessor_fcal_beamtest_hists.h" using namespace jana; #include "FCALTEST2011/D250WindowRawData.h" #include "FCALTEST2011/D250EventTime.h" #include "FCALTEST2011/DRemoteScintillatorHit.h" #include "FCALTEST2011/DMiniFCALHit.h" #include "FCALTEST2011/DPaddleHit.h" // Routine used to create our JEventProcessor #include extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new JEventProcessor_fcal_beamtest_hists()); } } // "C" //------------------ // JEventProcessor_fcal_beamtest_hists (Constructor) //------------------ JEventProcessor_fcal_beamtest_hists::JEventProcessor_fcal_beamtest_hists() { } //------------------ // ~JEventProcessor_fcal_beamtest_hists (Destructor) //------------------ JEventProcessor_fcal_beamtest_hists::~JEventProcessor_fcal_beamtest_hists() { } //------------------ // init //------------------ jerror_t JEventProcessor_fcal_beamtest_hists::init(void) { chan_vs_sum_slot5 = new TH2D("chan_vs_sum_slot5", "", 8192, 0.0, 8E8, 16, -0.5, 15.5); chan_vs_sum_slot7 = (TH2D*)chan_vs_sum_slot5->Clone("chan_vs_sum_slot7"); chan_vs_sum_slot9 = (TH2D*)chan_vs_sum_slot5->Clone("chan_vs_sum_slot9"); sum_all = new TH1D("sum_all", "Sum of all 25 blocks", 500, -50.0, 4000.0); sum_all_with_remote = (TH1D*)sum_all->Clone("sum_all_with_remote"); Nhpaddles = new TH1D("Nhpaddles", "Num. of horizontal paddles firing per event", 6, -0.5, 5.5); Nvpaddles = new TH1D("Nhpaddles", "Num. of vertical paddles firing per event", 6, -0.5, 5.5); Nhpaddles_with_remote = (TH1D*)Nhpaddles->Clone("Nhpaddles_with_remote"); Nvpaddles_with_remote = (TH1D*)Nvpaddles->Clone("Nvpaddles_with_remote"); return NOERROR; } //------------------ // brun //------------------ jerror_t JEventProcessor_fcal_beamtest_hists::brun(JEventLoop *eventLoop, int runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t JEventProcessor_fcal_beamtest_hists::evnt(JEventLoop *loop, int eventnumber) { vector windowRawData; vector hits; vector paddles; const DRemoteScintillatorHit *remote_scint=NULL; try{ loop->Get(windowRawData); loop->Get(hits); loop->Get(paddles); loop->GetSingle(remote_scint); }catch(...){ return NOERROR; } // Channel vs. integral for each module for(unsigned int i=0; ichan; uint32_t sum = 0; for(unsigned int j=0; jsamples.size(); j++){ sum += wrd->samples[j]; } const D250EventTime *eventTime = NULL; wrd->GetSingle(eventTime); if(eventTime){ switch(eventTime->slot){ case 5: chan_vs_sum_slot5->Fill(sum, chan); break; case 7: chan_vs_sum_slot7->Fill(sum, chan); break; case 9: chan_vs_sum_slot9->Fill(sum, chan); break; } } } // Integral over whole calorimeter double sum = 0.0; for(unsigned int i=0; isum; } sum_all->Fill(sum); if(remote_scint->sum>1000.0) sum_all_with_remote->Fill(sum); // Number of paddles int Nh = 0; int Nv = 0; for(unsigned int i=0; isum>1000){ if(paddles[i]->orientation==0){ Nh++; }else{ Nv++; } } } Nhpaddles->Fill((double)Nh); Nvpaddles->Fill((double)Nv); if(remote_scint->sum>1000.0) { Nhpaddles_with_remote->Fill((double)Nh); Nvpaddles_with_remote->Fill((double)Nv); } return NOERROR; } //------------------ // erun //------------------ jerror_t JEventProcessor_fcal_beamtest_hists::erun(void) { // This is called whenever the run number changes, before it is // changed to give you a chance to clean up before processing // events from the next run number. return NOERROR; } //------------------ // fini //------------------ jerror_t JEventProcessor_fcal_beamtest_hists::fini(void) { // Called before program exit after event processing is finished. return NOERROR; }