00001 #include "TMatchingProc.h"
00002
00003 #include "TMath.h"
00004 #include "TF1.h"
00005 #include "TFitResult.h"
00006 #include "TLatex.h"
00007
00008 TMatchingProc::TMatchingProc(const char* name) : TCBMBeamtimeProc(name),
00009 fCrateInputEvent(0),
00010 fTriglogInputEvent(0),
00011 fVftxInputEvent(0),
00012 fScalersInputEvent(0),
00013 fOutputEvent(0)
00014 {
00015 TGo4Log::Info("**** TMatchingProc: Create instance %s" , name );
00016
00017 for( UInt_t uRpcIndex = 0; uRpcIndex < NB_RPC; uRpcIndex++ )
00018 fRpcInputEvent[uRpcIndex] = 0;
00019 for( UInt_t uPlasticIndex = 0; uPlasticIndex < NB_PLASTICS; uPlasticIndex++ )
00020 fPlasticsInputEvent[uPlasticIndex] = 0;
00021
00022 fPar = (TMatchingParam*) MakeParameter("MatchingPar", "TMatchingParam");
00023
00024 fParAnalysis = (TGsiAug12Param*) GetParameter("GsiAug12Par");
00025 for( UInt_t uRpcIndex = 0; uRpcIndex < fParAnalysis->uNbRpc; uRpcIndex++ )
00026 {
00027 fParRpc[uRpcIndex] = (TRpcParam*) GetParameter( Form("RpcPar_%02d", uRpcIndex));
00028 if( 0 == fParRpc[uRpcIndex])
00029 cout<<"Parameter for Rpc"<<uRpcIndex<<" not found => Matching Histo disabled"<<endl;
00030 }
00031
00032 UInt_t uRpcVsRpcIndex = 0;
00033 for( UInt_t uRpcIndex = 0; uRpcIndex < fParAnalysis->uNbRpc; uRpcIndex++ )
00034 {
00035 if( 0 < fParRpc[uRpcIndex]->uNbStrips )
00036 {
00037
00038 if( 1 == fPar->uEnableSingleRpcHistos )
00039 {
00040
00041 fSingleEvtClusterPosDisplay[uRpcIndex] =
00042 MakeTH2('D', Form("Matching/%s/fSingleEvtClusterPosDisplay_%s",
00043 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpcIndex]->sStripRpcName.Data()),
00044 Form("%s Clusters: Single event display", fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00045 400, -50, 50,
00046 400, -50, 50,
00047 "X [cm]", "Y [cm]" ) ;
00048 fSingleEvtClusterPosDisplay[uRpcIndex]->SetMarkerSize(1);
00049 fSingleEvtClusterPosDisplay[uRpcIndex]->SetMarkerColor( 1 + uRpcIndex);
00050 fSingleEvtClusterPosDisplay[uRpcIndex]->SetMarkerStyle(20 + uRpcIndex);
00051
00052
00053 if( 1 == fPar->uEnableRpcLeftRightTot )
00054 {
00055
00056 fRpcStrLeftRightTotAllData[uRpcIndex] =
00057 MakeTH2('I', Form("Matching/%s/RpcTotCompAllData_%s",
00058 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpcIndex]->sStripRpcName.Data()),
00059 Form("%s fired strips: comparison of left & right Tot, all TDC data cases", fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00060 550, -5000, 50000,
00061 550, -5000, 50000,
00062 "Tot Left [ps]", "Tot Right [ps]" ) ;
00063
00064 fRpcStrLeftRightTotSingleTdcData[uRpcIndex] =
00065 MakeTH2('I', Form("Matching/%s/RpcTotCompSingleData_%s",
00066 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpcIndex]->sStripRpcName.Data()),
00067 Form("%s fired strips: comparison of left & right Tot, only 1 TDC data per edge/side", fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00068 550, -5000, 50000,
00069 550, -5000, 50000,
00070 "Tot Left [ps]", "Tot Right [ps]" ) ;
00071 }
00072 }
00073
00074
00075 if( 1 == fPar->uEnableMultiRpcHistos )
00076 for( UInt_t uRpc2Index = uRpcIndex+1; uRpc2Index < fParAnalysis->uNbRpc; uRpc2Index++ )
00077 {
00078 if( 0 < fParRpc[uRpc2Index]->uNbStrips )
00079 {
00080 TString sFolder = Form("Rpc%02dRpc%02d", uRpcIndex, uRpc2Index);
00081
00082 fMulRpc1MulRpc2[uRpcVsRpcIndex] = MakeTH2('D',
00083 Form("Matching/%s/Mul%sMul%s", sFolder.Data(),
00084 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00085 Form("Cluster Multiplicity %s vs Cluster Multiplicity %s",
00086 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00087 20, 0, 20,
00088 20, 0, 20,
00089 Form("Multiplicity %s", fParRpc[uRpcIndex]->sStripRpcName.Data()),
00090 Form("Multiplicity %s", fParRpc[uRpc2Index]->sStripRpcName.Data()) );
00091
00092
00093 fXMatchingMul1[uRpcVsRpcIndex] = MakeTH2('D',
00094 Form("Matching/%s/fMul1XMatching_%s_%s", sFolder.Data(),
00095 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00096 Form("%s Clusters X vs %s Clusters X, events with 1 cluster in each RPC",
00097 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00098 300, -150, 150,
00099 300, -150, 150,
00100 Form("%s Clusters X [cm]", fParRpc[uRpcIndex]->sStripRpcName.Data()),
00101 Form("%s Clusters X [cm]", fParRpc[uRpc2Index]->sStripRpcName.Data()) );
00102 fYMatchingMul1[uRpcVsRpcIndex] = MakeTH2('D',
00103 Form("Matching/%s/fMul1YMatching_%s_%s", sFolder.Data(),
00104 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00105 Form("%s Clusters Y vs %s Clusters Y, events with 1 cluster in each RPC",
00106 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00107 300, -150, 150,
00108 300, -150, 150,
00109 Form("%s Clusters Y [cm]", fParRpc[uRpcIndex]->sStripRpcName.Data()),
00110 Form("%s Clusters Y [cm]", fParRpc[uRpc2Index]->sStripRpcName.Data()) );
00111 fMatchingMul1[uRpcVsRpcIndex] = MakeTH2('D',
00112 Form("Matching/%s/fMul1Matching_%s_%s", sFolder.Data(),
00113 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00114 Form("%s vs %s Clusters: dX / dY, events with 1 cluster in each RPC",
00115 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00116 400, -50, 50,
00117 400, -50, 50,
00118 "dX [cm]", "dY [cm]" ) ;
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 fDtMul1[uRpcVsRpcIndex]= MakeTH1('D',
00142 Form("Matching/%s/Dt/Mul1Dt_%s_%s", sFolder.Data(),
00143 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00144 Form("%s vs %s Clusters: Mean time difference, events with 1 clusters in each RPC",
00145 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00146 40000, -200000, 200000,
00147 Form("Dt = Cluster Mean time(%s) - Cluster Mean time(%s) [ps]",
00148 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data() ),
00149 "Counts []" ) ;
00150
00151
00152 fMatchingMul1Rpc1[uRpcVsRpcIndex] = MakeTH2('D',
00153 Form("Matching/%s/fMulBuc1Matching_%s_%s", sFolder.Data(),
00154 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00155 Form("%s vs %s Clusters: dX / dY, events with 1 cluster in %s RPC",
00156 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data(),
00157 fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00158 400, -100, 100,
00159 400, -100, 100,
00160 "dX [cm]", "dY [cm]" ) ;
00161 fMatchingMul1Rpc2[uRpcVsRpcIndex] = MakeTH2('D',
00162 Form("Matching/%s/fMulBuc1Matching_%s_%s", sFolder.Data(),
00163 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00164 Form("%s vs %s Clusters: dX / dY, events with 1 cluster in %s RPC",
00165 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data(),
00166 fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00167 400, -100, 100,
00168 400, -100, 100,
00169 "dX [cm]", "dY [cm]" ) ;
00170
00171
00172 fXMatchingMul2[uRpcVsRpcIndex]= MakeTH2('D',
00173 Form("Matching/%s/fMul2XMatching_%s_%s", sFolder.Data(),
00174 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00175 Form("%s Clusters X vs %s Clusters X, events with 1-2 clusters in each RPC",
00176 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00177 300, -150, 150,
00178 300, -150, 150,
00179 Form("%s Clusters X [cm]", fParRpc[uRpcIndex]->sStripRpcName.Data()),
00180 Form("%s Clusters X [cm]", fParRpc[uRpc2Index]->sStripRpcName.Data()) );
00181 fYMatchingMul2[uRpcVsRpcIndex]= MakeTH2('D',
00182 Form("Matching/%s/fMul2YMatching_%s_%s", sFolder.Data(),
00183 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00184 Form("%s Clusters Y vs %s Clusters Y, events with 1-2 clusters in each RPC",
00185 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00186 300, -150, 150,
00187 300, -150, 150,
00188 Form("%s Clusters Y [cm]", fParRpc[uRpcIndex]->sStripRpcName.Data()),
00189 Form("%s Clusters Y [cm]", fParRpc[uRpc2Index]->sStripRpcName.Data()) );
00190 fMatchingMul2[uRpcVsRpcIndex]= MakeTH2('D',
00191 Form("Matching/%s/fMul2Matching_%s_%s", sFolder.Data(),
00192 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00193 Form("%s vs %s Clusters: dX / dY, events with 1-2 clusters in each RPC",
00194 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00195 400, -100, 100,
00196 400, -100, 100,
00197 "dX [cm]", "dY [cm]" ) ;
00198
00199
00200 fRpc1M1Rpc2R1R2[uRpcVsRpcIndex]= MakeTH2('D',
00201 Form("Matching/%s/ClusterDist/Rpc1M1Rpc2R1R2_%s_%s", sFolder.Data(),
00202 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00203 Form("Events with 1 cluster in %s, 2 in %s, R(Rpc1-Rpc2) for each possibility",
00204 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00205 200, 0, 50,
00206 200, 0, 50,
00207 "R1 [cm]", "R2 [cm]" ) ;
00208 fRpc2M1Rpc1R1R2[uRpcVsRpcIndex]= MakeTH2('D',
00209 Form("Matching/%s/ClusterDist/Rpc2M1Rpc1R1R2_%s_%s", sFolder.Data(),
00210 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00211 Form("Events with 1 cluster in %s, 2 in %s, R(Rpc1-Rpc2) for each possibility",
00212 fParRpc[uRpc2Index]->sStripRpcName.Data(), fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00213 200, 0, 50,
00214 200, 0, 50,
00215 "R1 [cm]", "R2 [cm]" ) ;
00216
00217 fBestDistanceRpc1Index[uRpcVsRpcIndex]= MakeTH2('D',
00218 Form("Matching/%s/fBestDistanceVsRpc1Index_%s_%s", sFolder.Data(),
00219 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00220 Form("Best R(%s Clusters) for each %s cluster",
00221 fParRpc[uRpc2Index]->sStripRpcName.Data(), fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00222 fParRpc[uRpcIndex]->uNbStrips/2, -0.5, fParRpc[uRpcIndex]->uNbStrips/2 -0.5,
00223 200, 0, 50,
00224 "Cluster Index []", "R [cm]" ) ;
00225 fBestDistanceRpc2Index[uRpcVsRpcIndex]= MakeTH2('D',
00226 Form("Matching/%s/fBestDistanceVsRpc2Index_%s_%s", sFolder.Data(),
00227 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00228 Form("Best R(%s Clusters) for each %s cluster",
00229 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00230 fParRpc[uRpc2Index]->uNbStrips/2, -0.5, fParRpc[uRpc2Index]->uNbStrips/2 -0.5,
00231 200, 0, 50,
00232 "Cluster Index []", "R [cm]" ) ;
00233 fNbRpc2MatchingVsRpc1Index[ uRpcVsRpcIndex]= MakeTH2('D',
00234 Form("Matching/%s/fNbRpc2MatchingVsRpc1Index_%s_%s", sFolder.Data(),
00235 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00236 Form("Nb of %s cluster matching position for each %s cluster",
00237 fParRpc[uRpc2Index]->sStripRpcName.Data(), fParRpc[uRpcIndex]->sStripRpcName.Data()) ,
00238 fParRpc[uRpcIndex]->uNbStrips/2, -0.5, fParRpc[uRpcIndex]->uNbStrips/2 -0.5,
00239 fParRpc[uRpc2Index]->uNbStrips/2, -0.5, fParRpc[uRpc2Index]->uNbStrips/2 -0.5,
00240 "Cluster Index []", "nb Matching clusters []" ) ;
00241 fNbRpc1MatchingVsRpc2Index[ uRpcVsRpcIndex]= MakeTH2('D',
00242 Form("Matching/%s/NbRpc1MatchingVsRpc2Index_%s_%s", sFolder.Data(),
00243 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00244 Form("Nb of %s cluster matching position for each %s cluster",
00245 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00246 fParRpc[uRpc2Index]->uNbStrips/2, -0.5, fParRpc[uRpc2Index]->uNbStrips/2 -0.5,
00247 fParRpc[uRpcIndex]->uNbStrips/2, -0.5, fParRpc[uRpcIndex]->uNbStrips/2 -0.5,
00248 "Cluster Index []", "nb Matching clusters []" ) ;
00249 fBestMatchingAllMul[uRpcVsRpcIndex ]= MakeTH2('D',
00250 Form("Matching/%s/fBestMatchingAllMul_%s_%s", sFolder.Data(),
00251 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()),
00252 Form("%s vs %s Clusters: dX / dY, best cluster match",
00253 fParRpc[uRpcIndex]->sStripRpcName.Data(), fParRpc[uRpc2Index]->sStripRpcName.Data()) ,
00254 400, -100, 100,
00255 400, -100, 100,
00256 "dX [cm]", "dY [cm]" ) ;
00257 }
00258 uRpcVsRpcIndex ++;
00259 }
00260 }
00261 else if( uRpcIndex + 1 < fParAnalysis->uNbRpc)
00262 uRpcVsRpcIndex += fParAnalysis->uNbRpc - uRpcIndex - 1;
00263 }
00264
00265 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fParAnalysis->uNbPlastics; uPlasticIndex++ )
00266 {
00267 fParPlastics[uPlasticIndex] = (TPlasticsParam*) GetParameter( Form("PlasticsPar_%02d", uPlasticIndex));
00268 if( 0 == fParPlastics[uPlasticIndex])
00269 cout<<"Parameter for Plastics"<<uPlasticIndex<<" not found => Matching Histo disabled"<<endl;
00270 }
00271
00272 UInt_t uPlasticsVsPlasticsIndex = 0;
00273 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fParAnalysis->uNbPlastics; uPlasticIndex++ )
00274 {
00275 if( 0 < fParPlastics[uPlasticIndex]->uNbPlastics )
00276 {
00277
00278 if( 1 == fPar->uEnableSinglePlasticsHistos )
00279 {
00280 TString sTitleX = "(t_{L}^{Pla 1}+t_{R}^{Pla 1})/2 - (t_{L}^{Pla 2}+t_{R}^{Pla 2})/2 [ps]";
00281
00282 f2PlasticsWalkLeft1[ uPlasticIndex ] = MakeTH2( 'D',
00283 Form("Matching/Plastics%02d/PlasticsWalkLeft1_%02d", uPlasticIndex, uPlasticIndex),
00284 "Time differemce between 1st and 2nd Plastic against ToT 1st Plastic left end" ,
00285 50, 0, 25000,
00286 500, -2500, 2500,
00287 "ToT left end Plastic 1 [ps]", "" ) ;
00288 f2PlasticsWalkLeft1[uPlasticIndex]->GetYaxis()->SetTitle( sTitleX.Data() );
00289 f2PlasticsWalkRight1[ uPlasticIndex ] = MakeTH2( 'D',
00290 Form("Matching/Plastics%02d/PlasticsWalkRight1_%02d", uPlasticIndex, uPlasticIndex),
00291 "Time differemce between 1st and 2nd Plastic against ToT 1st Plastic right end" ,
00292 50, 0, 25000,
00293 500, -2500, 2500,
00294 "ToT right end Plastic 1 [ps]", "" ) ;
00295 f2PlasticsWalkRight1[uPlasticIndex]->GetYaxis()->SetTitle( sTitleX.Data() );
00296 f2PlasticsWalkLeft2[ uPlasticIndex ] = MakeTH2( 'D',
00297 Form("Matching/Plastics%02d/PlasticsWalkLeft2_%02d", uPlasticIndex, uPlasticIndex),
00298 "Time differemce between 1st and 2nd Plastic against ToT 2nd Plastic left end" ,
00299 50, 0, 25000,
00300 500, -2500, 2500,
00301 "ToT left end Plastic 2 [ps]", "" ) ;
00302 f2PlasticsWalkLeft2[uPlasticIndex]->GetYaxis()->SetTitle( sTitleX.Data() );
00303 f2PlasticsWalkRight2[ uPlasticIndex ] = MakeTH2( 'D',
00304 Form("Matching/Plastics%02d/PlasticsWalkRight2_%02d", uPlasticIndex, uPlasticIndex),
00305 "Time differemce between 1st and 2nd Plastic against ToT 2nd Plastic right end" ,
00306 50, 0, 25000,
00307 500, -2500, 2500,
00308 "ToT right end Plastic 2 [ps]", "" ) ;
00309 f2PlasticsWalkRight2[uPlasticIndex]->GetYaxis()->SetTitle( sTitleX.Data() );
00310
00311
00312 if( 1 == fPar->uEnablePlasticLeftRightTot )
00313 for( UInt_t uScintIndex = 0; uScintIndex < fParPlastics[uPlasticIndex]->uNbPlastics; uScintIndex++ )
00314 {
00315
00316 fPlasticsLeftRightTotAllData[uPlasticIndex][uScintIndex] =
00317 MakeTH2('I', Form("Matching/Plastics%02d/PlaTotCompAllData_%1d_%02d",
00318 uPlasticIndex, uScintIndex, uPlasticIndex),
00319 Form("Scint. %1d in plastics grp %02d: comparison of left & right Tot, all TDC data cases",
00320 uScintIndex, uPlasticIndex) ,
00321 550, -5000, 50000,
00322 550, -5000, 50000,
00323 "Tot Left [ps]", "Tot Right [ps]" ) ;
00324
00325 fPlasticsLeftRightTotSingleTdcData[uPlasticIndex][uScintIndex] =
00326 MakeTH2('I', Form("Matching/Plastics%02d/PlaTotCompSingleData_%1d_%02d",
00327 uPlasticIndex, uScintIndex, uPlasticIndex),
00328 Form("Scint. %1d in plastics grp %02d: comparison of left & right Tot, only 1 TDC data per edge/side",
00329 uScintIndex, uPlasticIndex) ,
00330 550, -5000, 50000,
00331 550, -5000, 50000,
00332 "Tot Left [ps]", "Tot Right [ps]" ) ;
00333 }
00334 }
00335
00336
00337 if( 1 == fPar->uEnableMultiPlasticsHistos )
00338 for( UInt_t uPlastic2Index = uPlasticIndex+1; uPlastic2Index < fParAnalysis->uNbPlastics; uPlastic2Index++ )
00339 {
00340 if( 0 < fParPlastics[uPlastic2Index]->uNbPlastics )
00341 {
00342 TString sFolder = Form("Pla%02dPla%02d", uPlasticIndex, uPlastic2Index);
00343
00344 for( UInt_t uScintIndex = 0; uScintIndex < NB_PLASTICS_MAX; uScintIndex++ )
00345 if( uScintIndex < fParPlastics[uPlasticIndex]->uNbPlastics &&
00346 uScintIndex < fParPlastics[uPlastic2Index]->uNbPlastics )
00347 {
00348 f2PlasticsHitsNbComp[uPlasticsVsPlasticsIndex][uScintIndex] = MakeTH2( 'D',
00349 Form("Matching/%s/Scint%1dHitsNbComp_%02d_%02d", sFolder.Data(), uScintIndex, uPlasticIndex, uPlastic2Index),
00350 Form("Comparison of the nb of hits in scintillator %1d between plastics groups %02d and %02d",
00351 uScintIndex, uPlasticIndex, uPlastic2Index) ,
00352 10, 0, 10,
00353 10, 0, 10,
00354 Form("Nb hits for Scintillator %d in group %02d", uScintIndex, uPlasticIndex),
00355 Form("Nb hits for Scintillator %d in group %02d", uScintIndex, uPlastic2Index) ) ;
00356 }
00357
00358 f2PlasticsTimeDiffComp[uPlasticsVsPlasticsIndex] = MakeTH2( 'D',
00359 Form("Matching/%s/TimeDiffComp_%02d_%02d", sFolder.Data(), uPlasticIndex, uPlastic2Index),
00360 "Comparison of the time difference between 1st and 2nd Plastic of a pair in each TDC" ,
00361 500, -2500, 2500,
00362 500, -2500, 2500,
00363 "", "" ) ;
00364 TString sTitleX = Form("Group %02d: (t_{L}^{Pla 1}+t_{R}^{Pla 1})/2 - (t_{L}^{Pla 2}+t_{R}^{Pla 2})/2 [ps]", uPlasticIndex );
00365 f2PlasticsTimeDiffComp[uPlasticsVsPlasticsIndex]->GetXaxis()->SetTitle( sTitleX.Data() );
00366 TString sTitleY = Form("Group %02d: (t_{L}^{Pla 1}+t_{R}^{Pla 1})/2 - (t_{L}^{Pla 2}+t_{R}^{Pla 2})/2 [ps]", uPlastic2Index );
00367 f2PlasticsTimeDiffComp[uPlasticsVsPlasticsIndex]->GetYaxis()->SetTitle( sTitleY.Data() );
00368 }
00369 uPlasticsVsPlasticsIndex ++;
00370 }
00371 }
00372 else if( uPlasticIndex + 1 < fParAnalysis->uNbPlastics)
00373 uPlasticsVsPlasticsIndex += fParAnalysis->uNbPlastics - uPlasticIndex - 1;
00374 }
00375
00376
00377 }
00378
00379
00380 TMatchingProc::~TMatchingProc()
00381 {
00382 cout << "**** TMatchingProc: Delete instance " << endl;
00383
00384 }
00385
00386 void TMatchingProc::InitEvent(TGo4EventElement* outevnt)
00387 {
00388
00389
00390
00391
00392 if(fCrateInputEvent==0)
00393 {
00394 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00395 if(btevent)
00396 {
00397 fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE"));
00398 }
00399 else
00400 {
00401 fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(GetInputEvent());
00402 }
00403 if(fCrateInputEvent==0) {
00404 GO4_STOP_ANALYSIS_MESSAGE("**** TMatchingProc: Fatal error: no input event TMbsCrateEvent!!! STOP GO4");
00405 }
00406 }
00407 if(fTriglogInputEvent==0 && kTRUE == fParAnalysis->bWithTriglog)
00408 {
00409 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00410 if(btevent)
00411 {
00412 fTriglogInputEvent=dynamic_cast<TTriglogEvent*>(btevent->GetSubEvent("TRIGLOG"));
00413 }
00414
00415 if(fTriglogInputEvent==0) {
00416 GO4_STOP_ANALYSIS_MESSAGE("**** TMatchingProc: Fatal error: input event is/has not a TTriglogEvent!!! STOP GO4");
00417 }
00418 }
00419 if(fVftxInputEvent==0)
00420 {
00421 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Detector"));
00422 if(btevent)
00423 {
00424 fVftxInputEvent=dynamic_cast<TVftxEvent*>(btevent->GetSubEvent("VFTX"));
00425 }
00426
00427 if(fVftxInputEvent==0) {
00428 GO4_STOP_ANALYSIS_MESSAGE("**** TMatchingProc: Fatal error: input event is/has not a TVftxEvent!!! STOP GO4");
00429 }
00430 }
00431
00432 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Tracking"));
00433 if(btevent)
00434 {
00435 for( UInt_t uRpcIndex = 0; uRpcIndex < fParAnalysis->uNbRpc; uRpcIndex++ )
00436 if( 0 == fRpcInputEvent[uRpcIndex] )
00437 fRpcInputEvent[uRpcIndex]=dynamic_cast<TRpcEvent*>( btevent->GetSubEvent( Form("RPC_%02d", uRpcIndex) ) );
00438 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fParAnalysis->uNbPlastics; uPlasticIndex++ )
00439 if( 0 == fPlasticsInputEvent[uPlasticIndex])
00440 fPlasticsInputEvent[uPlasticIndex]=dynamic_cast<TPlasticsEvent*>(
00441 btevent->GetSubEvent( Form("PLASTICS_%02d", uPlasticIndex) ) );
00442
00443 if( 0 == fScalersInputEvent )
00444 fScalersInputEvent=dynamic_cast<TScalersEvent*>(btevent->GetSubEvent("SCALERS"));
00445 }
00446 if(fScalersInputEvent==0)
00447 {
00448 GO4_STOP_ANALYSIS_MESSAGE("**** TMatchingProc: Fatal error: input event is/has not a TScalersEvent!!! STOP GO4");
00449 }
00450 for( UInt_t uRpcIndex = 0; uRpcIndex < fParAnalysis->uNbRpc; uRpcIndex++ )
00451 if( 0 == fRpcInputEvent[uRpcIndex])
00452 {
00453 GO4_STOP_ANALYSIS_MESSAGE(
00454 "**** TMatchingProc: Fatal error: input event is/has not a TRpcEvent for RPC %02d!!! STOP GO4",
00455 uRpcIndex);
00456 }
00457 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fParAnalysis->uNbPlastics; uPlasticIndex++ )
00458 if( 0 == fPlasticsInputEvent[uPlasticIndex])
00459 {
00460 GO4_STOP_ANALYSIS_MESSAGE(
00461 "**** TMatchingProc: Fatal error: input event is/has not a TPlasticsEvent for PLASTICS %02d!!! STOP GO4",
00462 uPlasticIndex);
00463 }
00464
00465
00466
00467
00468 if(fOutputEvent==0)
00469 {
00470 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00471 if(btevent)
00472 {
00473 fOutputEvent=dynamic_cast<TMatchingEvent*>(btevent->GetSubEvent("MATCHING"));
00474 }
00475 else
00476 {
00477
00478 fOutputEvent= dynamic_cast<TMatchingEvent*>(outevnt);
00479 }
00480 if(fOutputEvent==0) {
00481 GO4_STOP_ANALYSIS_MESSAGE("**** TMatchingProc: Fatal error: output event is not a TMatchingEvent!!! STOP GO4");
00482 }
00483 else {
00484
00485 }
00486 }
00487 }
00488
00489 void TMatchingProc::FinalizeEvent()
00490 {
00491 if( -1 < fParAnalysis->iTriggerRejection && kTRUE == fParAnalysis->bWithTriglog)
00492 if( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>fParAnalysis->iTriggerRejection)&0x1 ) )
00493 {
00494
00495 return;
00496 }
00497
00498 Bool_t bSelectedTrigger = kFALSE;
00499 if( -1 == fPar->iTriggerSelection || kFALSE == fParAnalysis->bWithTriglog )
00500 bSelectedTrigger = kTRUE;
00501 else if( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>(fPar->iTriggerSelection)) & 0x1) )
00502 bSelectedTrigger = kTRUE;
00503
00504 if( kTRUE == bSelectedTrigger )
00505 {
00506 UInt_t uRpcVsRpcIndex = 0;
00507 for( UInt_t uRpcIndex = 0; uRpcIndex < fParAnalysis->uNbRpc; uRpcIndex++ )
00508 {
00509 if( 0 < (fRpcInputEvent[uRpcIndex]->fEvents).size() &&
00510 0 < fParRpc[uRpcIndex]->uNbStrips )
00511 {
00512
00513 if( 1 == fPar->uEnableSingleRpcHistos )
00514 {
00515
00516 fSingleEvtClusterPosDisplay[uRpcIndex]->Reset();
00517 for(UInt_t uCluster = 0; uCluster < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(); uCluster++)
00518 {
00519 fSingleEvtClusterPosDisplay[uRpcIndex]->Fill(
00520 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).dX + fParRpc[uRpcIndex]->dStripRpcPosX,
00521 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).dY + fParRpc[uRpcIndex]->dStripRpcPosY );
00522
00523
00524 if( 1 == fPar->uEnableRpcLeftRightTot )
00525 for(UInt_t uFiredStrip = 0; uFiredStrip < (((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).fHits).size(); uFiredStrip++ )
00526 {
00527 fRpcStrLeftRightTotAllData[uRpcIndex]->Fill(
00528 (((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).fHits[uFiredStrip]).dTotLeft,
00529 (((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).fHits[uFiredStrip]).dTotRight
00530 );
00531 if( kFALSE == (((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).fHits[uFiredStrip]).IsMultiEdge() )
00532 fRpcStrLeftRightTotSingleTdcData[uRpcIndex]->Fill(
00533 (((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).fHits[uFiredStrip]).dTotLeft,
00534 (((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uCluster]).fHits[uFiredStrip]).dTotRight
00535 );
00536 }
00537 }
00538 }
00539
00540
00541 if( 1 == fPar->uEnableMultiRpcHistos )
00542 for( UInt_t uRpc2Index = uRpcIndex + 1; uRpc2Index < fParAnalysis->uNbRpc; uRpc2Index++ )
00543 {
00544 if( 0 < (fRpcInputEvent[uRpc2Index]->fEvents).size() &&
00545 0 < fParRpc[uRpc2Index]->uNbStrips )
00546 {
00547 fMulRpc1MulRpc2[uRpcVsRpcIndex]->Fill(
00548 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(),
00549 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size());
00550
00551 if( 0<((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size()
00552 && 0<((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size() )
00553 {
00554
00555 if( 1 == ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size() )
00556 {
00557
00558 if( 1 == ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size())
00559 {
00560
00561 fXMatchingMul1[uRpcVsRpcIndex]->Fill(
00562 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX,
00563 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX);
00564 fYMatchingMul1[uRpcVsRpcIndex]->Fill(
00565 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY,
00566 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY);
00567 fMatchingMul1[uRpcVsRpcIndex]->Fill(
00568 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00569 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX),
00570 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00571 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) );
00572
00573 fDtMul1[uRpcVsRpcIndex]->Fill(
00574 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dMeanTime
00575 - ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dMeanTime );
00576 }
00577
00578
00579 if( 2 == ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size() )
00580 fRpc1M1Rpc2R1R2[uRpcVsRpcIndex]->Fill(
00581 TMath::Sqrt(
00582 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00583 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00584 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00585 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00586 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00587 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00588 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00589 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) ),
00590 TMath::Sqrt(
00591 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00592 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00593 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00594 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00595 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00596 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00597 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00598 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) ));
00599
00600
00601 for(UInt_t uClusterRpc2 = 0; uClusterRpc2 < ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size(); uClusterRpc2++)
00602 fMatchingMul1Rpc1[uRpcVsRpcIndex]->Fill(
00603 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00604 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dX + fParRpc[uRpc2Index]->dStripRpcPosX),
00605 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00606 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) );
00607 }
00608
00609 else if( 1 == ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size() )
00610 {
00611
00612 if( 2 == ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size())
00613 fRpc2M1Rpc1R1R2[uRpcVsRpcIndex]->Fill(
00614 TMath::Sqrt(
00615 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00616 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00617 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00618 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00619 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00620 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00621 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00622 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) ),
00623 TMath::Sqrt(
00624 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00625 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00626 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00627 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00628 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00629 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00630 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00631 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) ));
00632
00633
00634 for(UInt_t uClusterRpc1 = 0; uClusterRpc1 < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(); uClusterRpc1++)
00635 fMatchingMul1Rpc2[uRpcVsRpcIndex]->Fill(
00636 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00637 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX),
00638 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00639 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) );
00640 }
00641
00642 else if( 2 == ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size() &&
00643 2 == ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size() )
00644 {
00645 for(UInt_t uClusterRpc1 = 0; uClusterRpc1 < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(); uClusterRpc1++)
00646 {
00647 Double_t dR1 = TMath::Sqrt(
00648 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00649 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00650 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00651 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00652 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00653 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00654 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00655 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[0]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) );
00656 Double_t dR2 = TMath::Sqrt(
00657 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00658 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00659 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00660 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00661 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00662 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00663 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00664 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[1]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) );
00665 UInt_t uIndexBestCluster = dR2 < dR1 ? 1 : 0;
00666
00667 fXMatchingMul2[uRpcVsRpcIndex]->Fill(
00668 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX,
00669 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uIndexBestCluster]).dX + fParRpc[uRpc2Index]->dStripRpcPosX);
00670 fYMatchingMul2[uRpcVsRpcIndex]->Fill(
00671 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY,
00672 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uIndexBestCluster]).dY + fParRpc[uRpc2Index]->dStripRpcPosY);
00673 fMatchingMul2[uRpcVsRpcIndex]->Fill(
00674 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00675 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uIndexBestCluster]).dX + fParRpc[uRpc2Index]->dStripRpcPosX),
00676 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00677 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uIndexBestCluster]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) );
00678 }
00679 }
00680
00681
00682 Int_t iNbRpc1ClustersMatchingPosition = 0;
00683 Int_t iNbRpc2ClustersMatchingPosition = 0;
00684 Bool_t bLessClustersInRpc2 =
00685 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size() < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size();
00686 for(UInt_t uClusterRpc1 = 0; uClusterRpc1 < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(); uClusterRpc1++)
00687 {
00688 UInt_t uBestRpc2Cluster = ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size();
00689 Double_t dBestDistance = -1;
00690
00691 for(UInt_t uClusterRpc2 = 0; uClusterRpc2 < ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size(); uClusterRpc2++)
00692 {
00693 Double_t dDR = TMath::Sqrt(
00694 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00695 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00696 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00697 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00698 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00699 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00700 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00701 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) );
00702 if( dDR <= 3.0 )
00703 iNbRpc2ClustersMatchingPosition++;
00704 if( dDR < dBestDistance || dBestDistance < 0 )
00705 {
00706 uBestRpc2Cluster = uClusterRpc1;
00707 dBestDistance = dDR;
00708 }
00709
00710 }
00711
00712 if( uBestRpc2Cluster < ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size() && 0 < dBestDistance )
00713 {
00714 fBestDistanceRpc1Index[uRpcVsRpcIndex]->Fill( uClusterRpc1, dBestDistance);
00715
00716
00717 if( kFALSE == bLessClustersInRpc2 )
00718 fBestMatchingAllMul[uRpcVsRpcIndex]->Fill(
00719 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uBestRpc2Cluster]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00720 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpc2Index]->dStripRpcPosX),
00721 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uBestRpc2Cluster]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00722 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpc2Index]->dStripRpcPosY));
00723 }
00724
00725 fNbRpc2MatchingVsRpc1Index[uRpcVsRpcIndex]->Fill(
00726 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(), iNbRpc2ClustersMatchingPosition );
00727 }
00728
00729 for(UInt_t uClusterRpc2 = 0; uClusterRpc2 < ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size(); uClusterRpc2++)
00730 {
00731 UInt_t uBestRpc1Cluster = ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size();
00732 Double_t dBestDistance = -1;
00733
00734 for(UInt_t uClusterRpc1 = 0; uClusterRpc1 < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size(); uClusterRpc1++)
00735 {
00736 Double_t dDR = TMath::Sqrt(
00737 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00738 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) )*
00739 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00740 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dX + fParRpc[uRpc2Index]->dStripRpcPosX) ) +
00741 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00742 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) )*
00743 ( ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uClusterRpc1]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00744 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dY + fParRpc[uRpc2Index]->dStripRpcPosY) ) );
00745 if( dDR <= 3.0 )
00746 iNbRpc1ClustersMatchingPosition++;
00747 if( dDR < dBestDistance || dBestDistance < 0 )
00748 {
00749 uBestRpc1Cluster = uClusterRpc1;
00750 dBestDistance = dDR;
00751 }
00752
00753 }
00754
00755 if( uBestRpc1Cluster < ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters).size() && 0 < dBestDistance )
00756 {
00757 fBestDistanceRpc2Index[uRpcVsRpcIndex]->Fill( uClusterRpc2, dBestDistance);
00758
00759
00760 if( kTRUE == bLessClustersInRpc2 )
00761 fBestMatchingAllMul[uRpcVsRpcIndex]->Fill(
00762 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uBestRpc1Cluster]).dX + fParRpc[uRpcIndex]->dStripRpcPosX
00763 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dX + fParRpc[uRpc2Index]->dStripRpcPosX),
00764 ((fRpcInputEvent[uRpcIndex]->fEvents[0]).fClusters[uBestRpc1Cluster]).dY + fParRpc[uRpcIndex]->dStripRpcPosY
00765 -( ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters[uClusterRpc2]).dY + fParRpc[uRpc2Index]->dStripRpcPosY));
00766 }
00767
00768 fNbRpc1MatchingVsRpc2Index[uRpcVsRpcIndex]->Fill(
00769 ((fRpcInputEvent[uRpc2Index]->fEvents[0]).fClusters).size(), iNbRpc1ClustersMatchingPosition );
00770 }
00771 }
00772 }
00773 uRpcVsRpcIndex ++;
00774 }
00775 }
00776 else if( uRpcIndex + 1 < fParAnalysis->uNbRpc)
00777 uRpcVsRpcIndex += fParAnalysis->uNbRpc - uRpcIndex - 1;
00778 }
00779 UInt_t uPlasticsVsPlasticsIndex = 0;
00780 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fParAnalysis->uNbPlastics; uPlasticIndex++ )
00781 {
00782 if( 0 < (fPlasticsInputEvent[uPlasticIndex]->fEvents).size() &&
00783 0 < fParPlastics[uPlasticIndex]->uNbPlastics )
00784 {
00785 Double_t dTimeDiff1 = 0;
00786 Bool_t bAtLeastOneHitBothScintFirstGroup =
00787 0 < ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[0]).size() &&
00788 0 < ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[1]).size() ? kTRUE : kFALSE ;
00789
00790
00791 if( 1 == fPar->uEnableSinglePlasticsHistos )
00792 {
00793 if( kTRUE == bAtLeastOneHitBothScintFirstGroup )
00794 {
00795 dTimeDiff1 =
00796 ( ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[0])[0].dTimeLeft +
00797 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[0])[0].dTimeRight )/2.0
00798 -( ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[1])[0].dTimeLeft +
00799 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[1])[0].dTimeRight )/2.0;
00800 f2PlasticsWalkLeft1[ uPlasticIndex ]->Fill(
00801 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[0])[0].dTotLeft,
00802 dTimeDiff1 );
00803 f2PlasticsWalkRight1[ uPlasticIndex ]->Fill(
00804 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[0])[0].dTotRight,
00805 dTimeDiff1 );
00806 f2PlasticsWalkLeft2[ uPlasticIndex ]->Fill(
00807 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[1])[0].dTotLeft,
00808 dTimeDiff1 );
00809 f2PlasticsWalkRight2[ uPlasticIndex ]->Fill(
00810 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[1])[0].dTotRight,
00811 dTimeDiff1 );
00812 }
00813
00814
00815 if( 1 == fPar->uEnablePlasticLeftRightTot )
00816 for( UInt_t uScintIndex = 0; uScintIndex < fParPlastics[uPlasticIndex]->uNbPlastics; uScintIndex++ )
00817 {
00818 for( UInt_t uHit = 0; uHit < ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex]).size(); uHit++ )
00819 {
00820 fPlasticsLeftRightTotAllData[uPlasticIndex][uScintIndex]->Fill(
00821 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex])[uHit].dTotLeft,
00822 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex])[uHit].dTotRight);
00823 }
00824 if( 1 == ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex]).size() )
00825 if( kFALSE == ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex])[0].IsMultiEdge())
00826 fPlasticsLeftRightTotSingleTdcData[uPlasticIndex][uScintIndex]->Fill(
00827 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex])[0].dTotLeft,
00828 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex])[0].dTotRight);
00829 }
00830 }
00831
00832
00833 if( 1 == fPar->uEnableMultiPlasticsHistos )
00834 for( UInt_t uPlastic2Index = uPlasticIndex + 1; uPlastic2Index < fParAnalysis->uNbPlastics; uPlastic2Index++ )
00835 {
00836 if( 0 < (fPlasticsInputEvent[uPlastic2Index]->fEvents).size() &&
00837 0 < fParPlastics[uPlastic2Index]->uNbPlastics )
00838 {
00839 for( UInt_t uScintIndex = 0; uScintIndex < NB_PLASTICS_MAX; uScintIndex++ )
00840 if( uScintIndex < fParPlastics[uPlasticIndex]->uNbPlastics &&
00841 uScintIndex < fParPlastics[uPlastic2Index]->uNbPlastics )
00842 {
00843 f2PlasticsHitsNbComp[uPlasticsVsPlasticsIndex][uScintIndex]->Fill(
00844 ( (fPlasticsInputEvent[uPlasticIndex]->fEvents[0]).fHits[uScintIndex]).size(),
00845 ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[uScintIndex]).size() );
00846 }
00847
00848 if( kTRUE == bAtLeastOneHitBothScintFirstGroup &&
00849 0 < ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[0]).size() &&
00850 0 < ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[1]).size() )
00851 {
00852 Double_t dTimeDiff2 =
00853 ( ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[0])[0].dTimeLeft +
00854 ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[0])[0].dTimeRight )/2.0
00855 -( ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[1])[0].dTimeLeft +
00856 ( (fPlasticsInputEvent[uPlastic2Index]->fEvents[0]).fHits[1])[0].dTimeRight )/2.0;
00857 f2PlasticsTimeDiffComp[uPlasticsVsPlasticsIndex]->Fill(dTimeDiff1, dTimeDiff2);
00858 }
00859 }
00860 uPlasticsVsPlasticsIndex ++;
00861 }
00862 }
00863 else if( uPlasticIndex + 1 < fParAnalysis->uNbPlastics)
00864 uPlasticsVsPlasticsIndex += fParAnalysis->uNbPlastics - uPlasticIndex - 1;
00865 }
00866 }
00867
00868 fOutputEvent->SetValid(kTRUE);
00869 }