// $Id$ // // File: JEventProcessor_hdl3_timing.cc // Created: Wed Mar 9 23:03:38 EST 2016 // Creator: davidl (on Linux gluon48.jlab.org 2.6.32-431.20.3.el6.x86_64 x86_64) // #include using namespace std; #include "JEventProcessor_hdl3_timing.h" using namespace jana; #include #include #include // Routine used to create our JEventProcessor #include #include extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new JEventProcessor_hdl3_timing()); } } // "C" //------------------ // JEventProcessor_hdl3_timing (Constructor) //------------------ JEventProcessor_hdl3_timing::JEventProcessor_hdl3_timing() { Ibeam = 0; } //------------------ // ~JEventProcessor_hdl3_timing (Destructor) //------------------ JEventProcessor_hdl3_timing::~JEventProcessor_hdl3_timing() { } //------------------ // init //------------------ jerror_t JEventProcessor_hdl3_timing::init(void) { japp->RootWriteLock(); rootfile = new TFile("hdl3_timing.root" ,"RECREATE"); ttiming = new TTree("timing", "Time profiling of EVIO processing"); ttiming->Branch("buff_size/i", &buff_size); ttiming->Branch("tevent/D", &tevent); ttiming->Branch("tevio_read/D", &prof_time[JEventSource_EVIO::kTimeEVIORead]); ttiming->Branch("tdom_tree/D", &prof_time[JEventSource_EVIO::kTimeDOMTree]); ttiming->Branch("tevio_parse/D", &prof_time[JEventSource_EVIO::kTimeEVIOParse]); ttiming->Branch("tget_objs/D", &prof_time[JEventSource_EVIO::kTimeGetObjects]); ttiming->Branch("tsort_objs/D", &prof_time[JEventSource_EVIO::kTimeSortObjects]); ttiming->Branch("temulation/D", &prof_time[JEventSource_EVIO::kTimeEmulation]); ttiming->Branch("tassociation/D", &prof_time[JEventSource_EVIO::kTimeAssociation]); ttiming->Branch("tped_copy/D", &prof_time[JEventSource_EVIO::kTImeFADCPedestalCopy]); ttiming->Branch("tcopy_to_factory/D", &prof_time[JEventSource_EVIO::kTimeCopyToFactory]); ttiming->Branch("tcopy_bor/D", &prof_time[JEventSource_EVIO::kTimeCopyBOR]); ttiming->Branch("ttranslation/D", &prof_time[JEventSource_EVIO::kTimeTranslationTable]); ttiming->Branch("tparsef250/D", &prof_time[JEventSource_EVIO::kTimeParsef250]); ttiming->Branch("tparsef250wrd/D", &prof_time[JEventSource_EVIO::kTimeParsef250WindowRawData]); ttiming->Branch("tparsef250assoc/D", &prof_time[JEventSource_EVIO::kTimeParsef250Association]); ttiming->Branch("tparsef250sort/D", &prof_time[JEventSource_EVIO::kTimeParsef250Sort]); ttiming->Branch("tparsef250link/D", &prof_time[JEventSource_EVIO::kTimeParsef250Link]); ttiming->Branch("tparsef125/D", &prof_time[JEventSource_EVIO::kTimeParsef125]); ttiming->Branch("tparseF1TDC/D", &prof_time[JEventSource_EVIO::kTimeParseF1TDC]); ttiming->Branch("tparseCAEN1190/D", &prof_time[JEventSource_EVIO::kTimeParseCAEN1190]); ttiming->Branch("Ibeam/D", &Ibeam); japp->RootUnLock(); return NOERROR; } //------------------ // brun //------------------ jerror_t JEventProcessor_hdl3_timing::brun(JEventLoop *eventLoop, int32_t runnumber) { // This is called whenever the run number changes return NOERROR; } //------------------ // evnt //------------------ jerror_t JEventProcessor_hdl3_timing::evnt(JEventLoop *loop, uint64_t eventnumber) { double now = GetTime(); static double last_now = 0.0; tevent = now - last_now; last_now = now; vector epicsvalues; loop->Get(epicsvalues); if(!epicsvalues.empty()){ for(uint32_t i=0; iname=="IPM5C11B.VAL"){ Ibeam = epicsvalues[i]->fval; cout << "Ibeam set to " << Ibeam << endl; } } return NOERROR; } // This activates the parsing of the event so the times will be valid. vector l1triggers; // loop->Get(l1triggers); void *ref = loop->GetJEvent().GetRef(); japp->RootWriteLock(); for(int i=0; iFill(); japp->RootUnLock(); return NOERROR; } //------------------ // erun //------------------ jerror_t JEventProcessor_hdl3_timing::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t JEventProcessor_hdl3_timing::fini(void) { if(rootfile){ japp->RootWriteLock(); rootfile->Write(); delete rootfile; japp->RootUnLock(); } return NOERROR; }