00001
00002
00003 #include "TGem1Proc.h"
00004
00005 int xGSI[2][128] = { {8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,8,6,4,2,9,11,13,15,
00006 13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6,13,15,9,11,4,2,8,6},
00007 {7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,7,5,3,1,10,12,14,16,
00008 14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5,14,16,10,12,3,1,7,5} };
00009 int yGSI[2][128] = { {16,16,16,16,16,16,16,16,15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12,11,11,11,11,11,11,11,11,
00010 10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,
00011 1,1,1,1,1,1,1,1},
00012 {16,16,16,16,16,16,16,16,15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12,11,11,11,11,11,11,11,11,
00013 10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,
00014 1,1,1,1,1,1,1,1} };
00015
00016
00017
00018 TGem1Proc::TGem1Proc(const char* name) : TCBMBeamtimeProc(name),
00019 fOutputEvent(0)
00020 {
00021 cout << "**** TGem1ProcTTRDSpadicProc: Create instance " << name << endl;
00022
00023 fPar = (TGem1Param*) MakeParameter("Gem1Par", "TGem1Param", "set_Gem1Par.C");
00024
00025 fMappingGSI_GEM1 = MakeTH2('I', "Gem1/MappingGSI_GEM1", "MAPPING GSI for station 1 ", 20, 0., 19., 20, 0., 19., "Mapping_X", "Mapping_Y");
00026 fMappingGSI_GEM2 = MakeTH2('I', "Gem1/MappingGSI_GEM2", "MAPPING GSI for station 2 ", 20, 0., 19., 20, 0., 19., "Mapping_X", "Mapping_Y");
00027 fMappingGSI_GEM3 = MakeTH2('I', "Gem1/MappingGSI_GEM3", "MAPPING GSI for station 3 ", 20, 0., 19., 20, 0., 19., "Mapping_X", "Mapping_Y");
00028
00029 fRocInputEvent = 0;
00030 fOutputEvent = 0;
00031
00032 }
00033
00034 TGem1Proc::~TGem1Proc()
00035 {
00036 }
00037
00038 void TGem1Proc::InitEvent(TGo4EventElement* outevnt)
00039 {
00040
00041
00042
00043 if(fRocInputEvent==0)
00044 {
00045 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00046 if(btevent)
00047 {
00048 fRocInputEvent = dynamic_cast<TRocEvent*>(btevent->GetSubEvent("ROC"));
00049 }
00050 else
00051 {
00052 fRocInputEvent = dynamic_cast<TRocEvent*>(GetInputEvent());
00053 }
00054
00055 if (fRocInputEvent==0) {
00056 GO4_STOP_ANALYSIS_MESSAGE("**** TRICHProc: Fatal error: input event is not a TRocEvent!!! STOP GO4");
00057 }
00058
00059 }
00060
00061
00062
00063
00064 if(fOutputEvent==0)
00065 {
00066 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00067 if(btevent)
00068 {
00069 fOutputEvent=dynamic_cast<TGem1Event*>(btevent->GetSubEvent("Gem1"));
00070 }
00071 else
00072 {
00073 fOutputEvent= dynamic_cast<TGem1Event*>(outevnt);
00074 }
00075 if(fOutputEvent==0) {
00076 GO4_STOP_ANALYSIS_MESSAGE("**** TGem1Proc: Fatal error: output event is not a TGem1Event!!! STOP GO4");
00077 }
00078 }
00079 }
00080
00081 void TGem1Proc::FinalizeEvent()
00082 {
00083
00084 for (int nn=0; nn<3; nn++) {
00085
00086
00087
00088 int rocid(0);
00089 if (nn == 0) rocid = fPar->fRoc1; else
00090 if (nn == 1) rocid = fPar->fRoc2; else
00091 if (nn == 2) rocid = fPar->fRoc3;
00092
00093 TRocData* RocData=dynamic_cast<TRocData*>(fRocInputEvent->getEventElement(rocid));
00094 if (RocData==0) continue;
00095
00096 for (unsigned MessageNr=0; MessageNr<RocData->fExtMessages.size(); MessageNr++) {
00097
00098
00099
00100
00101 TRocMessageExtended msg = RocData->fExtMessages.at(MessageNr);
00102 if (msg.GetMessageType() != roc::MSG_HIT) continue;
00103
00104
00105
00106 UInt_t dataROC=msg.GetRocNumber();
00107 UInt_t nxid = msg.GetNxNumber();
00108 UInt_t nxch=msg.GetNxChNum();
00109 Double_t dataHitTime=msg.GetTriggerDeltaT();
00110 Int_t dataHitADCraw=msg.GetNxADC();
00111 Int_t dataHitADCcor=msg.GetCorrectedNxADC();
00112
00113 int z;
00114
00115 if(rocid == 2)
00116 {
00117 if(nxid ==0)
00118 {
00119 z = 1;
00120 }
00121 else if(nxid ==2)
00122 {
00123 z =0;
00124 }
00125 fMappingGSI_GEM1->Fill((17-xGSI[z][nxch]),yGSI[z][nxch]);
00126 }
00127 if(rocid == 3)
00128 {
00129 if(nxid ==0)
00130 {
00131 z = 1;
00132 }
00133 else if(nxid ==2)
00134 {
00135 z =0;
00136 }
00137 fMappingGSI_GEM2->Fill((17-xGSI[z][nxch]),yGSI[z][nxch]);
00138 }
00139 if(rocid == 4)
00140 {
00141 if(nxid ==0)
00142 {
00143 z = 1;
00144 }
00145 else if(nxid ==2)
00146 {
00147 z =0;
00148 }
00149 fMappingGSI_GEM3->Fill((17-xGSI[z][nxch]),yGSI[z][nxch]);
00150 }
00151
00152 }
00153 }
00154
00155 }