00001 #include "TBucharestProc.h" 00002 00003 #include "TSystem.h" 00004 #include "TROOT.h" 00005 00006 #include "TGo4Log.h" 00007 00008 TBucharestProc::TBucharestProc(const char* name) : TCBMBeamtimeProc(name),fCrateInputEvent(0), fOutputEvent(0),fBeamEvent(0) 00009 { 00010 cout << "**** TBucharestProc: Create instance" << name << endl; 00011 00012 fPar = (TBucharestParam*) MakeParameter("BucharestPar", "TBucharestParam"); 00013 00014 00015 TString setupmacro = "set_BucharestPar.C"; 00016 if (!gSystem->AccessPathName(setupmacro.Data())) { 00017 TGo4Log::Info("Executing Bucharest parameter setup script %s", setupmacro.Data()); 00018 gROOT->ProcessLine(Form(".x %s", setupmacro.Data())); 00019 } else { 00020 TGo4Log::Info("NO Bucharest parameter setup script %s. Use previous values!", setupmacro.Data()); 00021 } 00022 00023 // TString obname, obtitle; 00024 // printf("TBucharestProc Histograms created \n"); 00025 // fflush ( stdout); 00026 } 00027 00028 00029 TBucharestProc::~TBucharestProc() 00030 { 00031 } 00032 00033 void TBucharestProc::InitEvent(TGo4EventElement* outevnt) 00034 { 00035 // first assign input event: 00036 // since input event object is never discarded within processor lifetime, 00037 // we just search for subevent by name once to speed up processing 00038 if(fCrateInputEvent==0) 00039 { 00040 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent()); 00041 if(btevent) 00042 { 00043 fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE")); 00044 } 00045 else 00046 { 00047 fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(GetInputEvent()); 00048 00049 } 00050 if(fCrateInputEvent==0) { 00051 GO4_STOP_ANALYSIS_MESSAGE("**** TBucharestProc: Fatal error: input event is not a TMbsCrateEvent!!! STOP GO4"); 00052 } 00053 } 00054 // then assign output event 00055 // since output event object is never discarded within processor lifetime, 00056 // we just search for subevent by name once to speed up processing 00057 if(fOutputEvent==0) 00058 { 00059 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt); 00060 if(btevent) 00061 { 00062 fOutputEvent=dynamic_cast<TBucharestEvent*>(btevent->GetSubEvent("TRDBUCHAREST")); 00063 // since output event object is never discarded within processor lifetime, 00064 // we just search for subevent by name once to speed up processing 00065 if(fBeamEvent==0) 00066 fBeamEvent=dynamic_cast<TBeamMonitorEvent*>(btevent->GetSubEvent("BEAM")); 00067 } 00068 else 00069 { 00070 00071 fOutputEvent= dynamic_cast<TBucharestEvent*>(outevnt); 00072 } 00073 if(fOutputEvent==0) { 00074 GO4_STOP_ANALYSIS_MESSAGE("**** TBucharestProc: Fatal error: output event is not a TBucharestEvent!!! STOP GO4"); 00075 } 00076 } 00077 } 00078 00079 void TBucharestProc::FinalizeEvent() 00080 { 00081 // correlate with beam only if we are in combined mode 00082 if (fBeamEvent && fCrateInputEvent->IsValid()) 00083 { 00084 00085 } // if BeamEvent 00086 } 00087 00088 00089