00001 #include "TSiStripsProc.h" 00002 00003 TSiStripsProc::TSiStripsProc(const char* name) : TCBMBeamtimeProc(name),fExploderInputEvent(0), fOutputEvent(0),fBeamEvent(0) 00004 { 00005 cout << "**** TSiStripsProc: Create instance" << name << endl; 00006 00007 fPar = (TSiStripsParam*) MakeParameter("SiStripsPar", "TSiStripsParam"); 00008 00009 00010 TString obname, obtitle; 00011 00012 printf("TSiStripsProc Histograms created \n"); 00013 fflush ( stdout); 00014 } 00015 00016 00017 TSiStripsProc::~TSiStripsProc() 00018 { 00019 } 00020 00021 void TSiStripsProc::InitEvent(TGo4EventElement* outevnt) 00022 { 00023 // first assign input event: 00024 // since input event object is never discarded within processor lifetime, 00025 // we just search for subevent by name once to speed up processing 00026 if(fExploderInputEvent==0) 00027 { 00028 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent()); 00029 if(btevent) 00030 { 00031 fExploderInputEvent=dynamic_cast<TExploderEvent*>(btevent->GetSubEvent("EXPLODER")); 00032 } 00033 else 00034 { 00035 fExploderInputEvent=dynamic_cast<TExploderEvent*>(GetInputEvent()); 00036 00037 } 00038 if(fExploderInputEvent==0) { 00039 GO4_STOP_ANALYSIS_MESSAGE("**** TSiStripsProc: Fatal error: input event is not a TExploderEvent!!! STOP GO4"); 00040 } 00041 } 00042 // then assign output event 00043 // since output event object is never discarded within processor lifetime, 00044 // we just search for subevent by name once to speed up processing 00045 if(fOutputEvent==0) 00046 { 00047 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt); 00048 if(btevent) 00049 { 00050 fOutputEvent=dynamic_cast<TSiStripsEvent*>(btevent->GetSubEvent("SISTRIPS")); 00051 // since output event object is never discarded within processor lifetime, 00052 // we just search for subevent by name once to speed up processing 00053 if(fBeamEvent==0) 00054 fBeamEvent=dynamic_cast<TBeamMonitorEvent*>(btevent->GetSubEvent("BEAM")); 00055 } 00056 else 00057 { 00058 00059 fOutputEvent= dynamic_cast<TSiStripsEvent*>(outevnt); 00060 } 00061 if(fOutputEvent==0) { 00062 GO4_STOP_ANALYSIS_MESSAGE("**** TSiStripsProc: Fatal error: output event is not a TSiStripsEvent!!! STOP GO4"); 00063 } 00064 } 00065 } 00066 00067 void TSiStripsProc::FinalizeEvent() 00068 { 00069 // correlate with beam only if we are in combined mode 00070 if (fExploderInputEvent->IsValid()) 00071 { 00072 // do something here 00073 00074 if(fBeamEvent) 00075 { 00076 // here may correlate with beam information from other detectors 00077 } 00078 00079 00080 00081 } // if BeamEvent 00082 } 00083 00084 00085