#include #include #include #include "JEventProcessor_DF1TDCConfig.h" #include using namespace std; using namespace jana; #include "DAQ/DF1TDCHit.h" // Routine used to create our JEventProcessor extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddProcessor(new JEventProcessor_DF1TDCConfig()); } } JEventProcessor_DF1TDCConfig::JEventProcessor_DF1TDCConfig() { } JEventProcessor_DF1TDCConfig::~JEventProcessor_DF1TDCConfig() { } jerror_t JEventProcessor_DF1TDCConfig::init(void) { japp->RootWriteLock(); //ACQUIRE ROOT LOCK!! // Create root folder for ST and cd to it, store main dir TDirectory *main = gDirectory; main->cd(); gDirectory->mkdir("DF1TDCConfig")->cd(); outtree = new TTree("DF1TDCConfigTree","DF1TDCConfigTree"); // # of hits outtree->Branch("nDF1TDCConfig",&nDF1TDCConfig,"nDF1TDCConfig/I"); outtree->Branch("rocid",&rocid,"rocid[nDF1TDCConfig]/i"); outtree->Branch("refcnt",&refcnt,"refcnt[nDF1TDCConfig]/s"); outtree->Branch("hsdiv",&hsdiv,"hsdiv[nDF1TDCConfig]/s"); outtree->Branch("refclkdiv",&refclkdiv,"refclkdiv[nDF1TDCConfig]/s"); japp->RootUnLock(); //RELEASE ROOT LOCK!! cout << "end of init" << endl; return NOERROR; } //---------------------------------------------------------------------------------- jerror_t JEventProcessor_DF1TDCConfig::brun(JEventLoop *eventLoop, int runnumber) { // This is called whenever the run number changes return NOERROR; } //---------------------------------------------------------------------------------- jerror_t JEventProcessor_DF1TDCConfig::evnt(JEventLoop *eventLoop, int eventnumber) { // Get all data objects first so we minimize the time we hold the ROOT mutex lock vector df1tdcconfig; // ST eventLoop->Get(df1tdcconfig); // Lock ROOT mutex so other threads won't interfere japp->RootWriteLock(); nDF1TDCConfig = df1tdcconfig.size(); assert(nDF1TDCConfig < NMAX); for(unsigned int i=0;irocid; refcnt[i] = df1tdcconfig[i]->REFCNT; hsdiv[i] = df1tdcconfig[i]->HSDIV; refclkdiv[i] = df1tdcconfig[i]->REFCLKDIV; // cout << "rocid[" << i << "] = " << rocid[i] << endl; } if(nDF1TDCConfig!=0) cout << "event " << eventnumber << " nDF1TDCConfig = " << nDF1TDCConfig << endl; outtree->Fill(); // Lock ROOT mutex so other threads won't interfere japp->RootUnLock(); return NOERROR; } //---------------------------------------------------------------------------------- jerror_t JEventProcessor_DF1TDCConfig::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; } //---------------------------------------------------------------------------------- jerror_t JEventProcessor_DF1TDCConfig::fini(void) { // Called before program exit after event processing is finished. return NOERROR; } //---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------