00001 #include "TPlasticsProc.h"
00002
00003 #include "TProfile.h"
00004 #include "TF1.h"
00005 #include "TMath.h"
00006
00007 TPlasticsProc::TPlasticsProc(const char* name) : TCBMBeamtimeProc(name),
00008 fCrateInputEvent(0),
00009 fTriglogInputEvent(0),
00010 fVftxInputEvent(0),
00011 fOutputEvent(0)
00012 {
00013 TGo4Log::Info("**** TPlasticsProc: Create instance %s" , name );
00014
00015 fPar = (TPlasticsParam*) MakeParameter("PlasticsPar", "TPlasticsParam");
00016
00017 fVftxPar = (TVftxParam*) GetParameter("VftxPar");
00018 if( 0 == fVftxPar )
00019 fVftxPar = (TVftxParam*) MakeParameter("VftxPar", "TVftxParam");
00020
00021
00022
00023
00024 dCaenBinSize = 25000.0/1024.0;
00025
00026 if( 0 < fPar->uNbPlastics)
00027 {
00028 fBeamProfilePlasticsTime =
00029 MakeTH2('D', "Plastics/BeamProfilePlasticsTime",
00030 "Beam profile for Plastics" ,
00031 2400,-30000,30000,
00032 fPar->uNbPlastics, 0, fPar->uNbPlastics,
00033 "Left right dt [ps]", "Plastic index []" );
00034
00035 Bool_t bOneCaenPlastic = kFALSE;
00036 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fPar->uNbPlastics; uPlasticIndex++)
00037 if( 0 == fPar->uPlasticTdcType[uPlasticIndex] )
00038 {
00039 bOneCaenPlastic = kTRUE;
00040 break;
00041 }
00042 if( kTRUE == bOneCaenPlastic)
00043 {
00044 fReference2ProfilePlastics =
00045 MakeTH2('D', "Plastics/DiamondProfilePlastics",
00046 "Time profile against Diamond for Plastics" ,
00047 6000,-300000,300000,
00048 fPar->uNbPlastics, 0, fPar->uNbPlastics,
00049 "t(Diamond) - ( t(left)+ t(right) )/2 [ps]", "Plastic index []" );
00050
00051 fReference1ProfilePlastics =
00052 MakeTH2('D', "Plastics/ReferenceProfilePlastics",
00053 "Time profile against Reference for Plastics" ,
00054 6000,-300000,300000,
00055 fPar->uNbPlastics, 0, fPar->uNbPlastics,
00056 "t(Reference) - ( t(left)+ t(right) )/2 [ps]", "Plastic index []" );
00057 }
00058 else if( -1 < fVftxPar->iMainReferenceTdc )
00059 {
00060 if( -1 < fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] )
00061 {
00062 fReference1ProfilePlastics =
00063 MakeTH2('D', "Plastics/Reference1ProfilePlastics",
00064 "Time profile against 1st Reference signal for Plastics" ,
00065 6000,-300000,300000,
00066 fPar->uNbPlastics, 0, fPar->uNbPlastics,
00067 "t(Reference 1) - Mean Plastic Time [ps]", "Plastic index []" );
00068 if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00069 fMeanRefProfilePlastics =
00070 MakeTH2('D', "Plastics/MeanRefProfilePlastics",
00071 "Profile against mean of 1st and 2nd reference signal for Plastics" ,
00072 6000,-300000,300000,
00073 fPar->uNbPlastics, 0, fPar->uNbPlastics,
00074 "Distance Mean Time to Mean Reference [ps]", "Plastic index []" ) ;
00075 }
00076 if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00077 fReference2ProfilePlastics =
00078 MakeTH2('D', "Plastics/Reference2ProfilePlastics",
00079 "Time profile against 2nd Reference signal (Diamond) for Plastics" ,
00080 6000,-300000,300000,
00081 fPar->uNbPlastics, 0, fPar->uNbPlastics,
00082 "t(Reference 2) - Mean Plastic Time [ps]", "Plastic index []" );
00083 }
00084
00085
00086 fTotLeftPlastics =
00087 MakeTH2('D', "Plastics/TotLeftProfilePlastics",
00088 "Left Tot profile for Plastics" ,
00089 2000, -50, 50,
00090 fPar->uNbPlastics, 0. , (Double_t)fPar->uNbPlastics,
00091 "Left Tot [ns]", "Plastic index []" ) ; ;
00092
00093
00094 fTotRightPlastics =
00095 MakeTH2('D', "Plastics/TotRightProfilePlastics",
00096 "Right Tot profile for Plastics" ,
00097 2000, -50, 50,
00098 fPar->uNbPlastics, 0. , (Double_t)fPar->uNbPlastics,
00099 "Right Tot [ns]", "Plastics index []" ) ;
00100
00101
00102 fMultiplicityPlastics =
00103 MakeTH2('I', "Plastics/MultiplicityPlastics",
00104 "Plastics Multiplicity " ,
00105 fPar->uNbPlastics, 0. , (Double_t)fPar->uNbPlastics,
00106 TVftxBoardData::MaxMult, 0, TVftxBoardData::MaxMult,
00107 "Plastics index []",
00108 "Multiplicity (Number of Hits/event) []" ) ;
00109 }
00110
00111 TGo4Log::Info("**** TPlasticsProc: Instance %s created", name );
00112 }
00113
00114
00115 TPlasticsProc::~TPlasticsProc()
00116 {
00117 cout << "**** TPlasticsProc: Delete instance " << endl;
00118 }
00119
00120 void TPlasticsProc::InitEvent(TGo4EventElement* outevnt)
00121 {
00122
00123
00124
00125
00126 if(fCrateInputEvent==0)
00127 {
00128 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00129 if(btevent)
00130 {
00131 fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE"));
00132 }
00133 else
00134 {
00135 fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(GetInputEvent());
00136 }
00137 if(fCrateInputEvent==0) {
00138 GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: no input event TMbsCrateEvent!!! STOP GO4");
00139 }
00140 }
00141 if(fTriglogInputEvent==0)
00142 {
00143 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00144 if(btevent)
00145 {
00146 fTriglogInputEvent=dynamic_cast<TTriglogEvent*>(btevent->GetSubEvent("TRIGLOG"));
00147 }
00148
00149 if(fTriglogInputEvent==0) {
00150 GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: input event is/has not a TTriglogEvent!!! STOP GO4");
00151 }
00152 }
00153 if(fVftxInputEvent==0)
00154 {
00155 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00156 if(btevent)
00157 {
00158 fVftxInputEvent=dynamic_cast<TVftxEvent*>(btevent->GetSubEvent("VFTX"));
00159 }
00160
00161 if(fVftxInputEvent==0) {
00162 GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: input event has no TVftxEvent!!! STOP GO4");
00163 }
00164 }
00165
00166
00167
00168
00169 if(fOutputEvent==0)
00170 {
00171 TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00172 if(btevent)
00173 {
00174 fOutputEvent=dynamic_cast<TPlasticsEvent*>(btevent->GetSubEvent( "PLASTICS" ) );
00175 }
00176 else
00177 {
00178 fOutputEvent= dynamic_cast<TPlasticsEvent*>(outevnt);
00179 }
00180 if(fOutputEvent==0) {
00181 GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: output event is not a TPlasticsEvent!!! STOP GO4");
00182 }
00183 else {
00184
00185 }
00186 }
00187
00188 }
00189
00190 void TPlasticsProc::FinalizeEvent()
00191 {
00192 hitCurrent.Clear();
00193
00194 if( !( ( -1 == fPar->iTriggerSelection) ||
00195 ( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>fPar->iTriggerSelection)&0x1 ) ) ) ||
00196 0 == fPar->uNbPlastics )
00197 {
00198 fOutputEvent->SetValid(kTRUE);
00199 return;
00200 }
00201
00202 for( UInt_t uPlasticIndex = 0; uPlasticIndex < fPar->uNbPlastics; uPlasticIndex++)
00203 {
00204 if( 1 == fPar->uPlasticTdcType[uPlasticIndex] )
00205 {
00206
00207 if(fVftxInputEvent && fVftxInputEvent->IsValid())
00208 {
00209 if( 2 == fPar->uNbSides[uPlasticIndex] )
00210 ProcessVftxPlasticDouble( uPlasticIndex );
00211 else ProcessVftxPlasticSingle( uPlasticIndex );
00212 }
00213 }
00214 else
00215 {
00216
00217 if(fCrateInputEvent && fCrateInputEvent->IsValid())
00218 {
00219 if( 2 == fPar->uNbSides[uPlasticIndex] )
00220 ProcessCaenPlasticDouble( uPlasticIndex );
00221 else ProcessCaenPlasticSingle( uPlasticIndex );
00222 }
00223
00224 }
00225 fMultiplicityPlastics->Fill(uPlasticIndex,
00226 (fOutputEvent->fHits[uPlasticIndex]).size() );
00227 }
00228
00229 fOutputEvent->SetValid(kTRUE);
00230 }
00231
00232
00233 void TPlasticsProc::ProcessCaenPlasticSingle( UInt_t uPlasticIndex, Double_t dCaenOtherOffset )
00234 {
00235
00236 for(Int_t iHitIndex = 0;
00237 iHitIndex<(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).hit_lead[
00238 fPar->uChannelPlasticLeftTime[uPlasticIndex] ];
00239 iHitIndex++)
00240 {
00241
00242 if( -1 < (fCrateInputEvent->fMtdc[
00243 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00244 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] )
00245 {
00246 if( -1 < (fCrateInputEvent->fMtdc[
00247 fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00248 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex] )
00249 {
00250 fTotLeftPlastics->Fill(
00251 ( (fCrateInputEvent->fMtdc[
00252 fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00253 fPar->uChannelPlasticLeftTot[uPlasticIndex]][iHitIndex]
00254 -(fCrateInputEvent->fMtdc[
00255 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00256 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00257 )*dCaenBinSize*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00258 - fPar->dTotOffsetListLeft[uPlasticIndex],
00259 (Double_t)uPlasticIndex );
00260
00261 if( -1 < fPar->iDiamondTdcVFTX && -1 < fPar->iDiamondChannelVFTX )
00262 if( -1 < (fCrateInputEvent->fMtdc[
00263 fPar->iDiamondTdcVFTX ]).lead_multi[
00264 fPar->iDiamondChannelVFTX][0] )
00265 {
00266 fReference2ProfilePlastics->Fill(
00267 ( ( ( (fCrateInputEvent->fMtdc[fPar->iDiamondTdcVFTX ]).lead_multi[
00268 fPar->iDiamondChannelVFTX][0])*dCaenBinSize -
00269 (fCrateInputEvent->fMtdc[
00270 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00271 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00272 )*dCaenBinSize
00273 + fPar->dOffsetListLeft[uPlasticIndex]
00274 ),
00275 (Double_t)uPlasticIndex );
00276 }
00277 if( -1 < fPar->iReferenceTdc && -1 < fPar->iReferenceChannel )
00278 if( -1 < (fCrateInputEvent->fMtdc[
00279 fPar->iReferenceTdc ]).lead_multi[
00280 fPar->iReferenceChannel][0])
00281 {
00282 fReference1ProfilePlastics->Fill(
00283 ( ( ( (fCrateInputEvent->fMtdc[fPar->iReferenceTdc ]).lead_multi[
00284 fPar->iReferenceChannel][0])*dCaenBinSize -
00285 (fCrateInputEvent->fMtdc[
00286 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00287 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00288 )*dCaenBinSize
00289 + fPar->dOffsetListLeft[uPlasticIndex]
00290 ),
00291 (Double_t)uPlasticIndex );
00292 }
00293
00294
00295 hitCurrent.dTimeLeft = dCaenBinSize*( (fCrateInputEvent->fMtdc[
00296 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00297 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] )
00298 + fPar->dOffsetListLeft[uPlasticIndex]
00299 - dCaenOtherOffset;
00300
00301
00302 hitCurrent.dTotLeft =
00303 ( (fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00304 fPar->uChannelPlasticLeftTot[uPlasticIndex]][iHitIndex]
00305 -(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00306 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00307 )*dCaenBinSize*fPar->dToTGainListLeft[uPlasticIndex]
00308 - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00309
00310 hitCurrent.Clear();
00311 }
00312 }
00313 }
00314 return;
00315 }
00316 void TPlasticsProc::ProcessCaenPlasticDouble( UInt_t uPlasticIndex, Double_t dCaenOtherOffset )
00317 {
00318
00319 for(Int_t iHitIndex = 0;
00320 iHitIndex<(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).hit_lead[
00321 fPar->uChannelPlasticLeftTime[uPlasticIndex] ] &&
00322 iHitIndex<(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]).hit_lead[
00323 fPar->uChannelPlasticRightTime[uPlasticIndex] ];
00324 iHitIndex++)
00325 {
00326
00327 if( -1 < (fCrateInputEvent->fMtdc[
00328 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00329 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] &&
00330 -1 < (fCrateInputEvent->fMtdc[
00331 fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00332 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex] )
00333 {
00334 fBeamProfilePlasticsTime->Fill(
00335 ( ( (fCrateInputEvent->fMtdc[
00336 fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00337 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00338 -(fCrateInputEvent->fMtdc[
00339 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00340 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00341 )*dCaenBinSize
00342 + fPar->dOffsetListRight[uPlasticIndex]
00343 - fPar->dOffsetListLeft[uPlasticIndex]
00344 ),
00345 ((Double_t)uPlasticIndex) +0.00001 );
00346
00347 if( -1 < (fCrateInputEvent->fMtdc[
00348 fPar->uTdcPlasticRightTot[uPlasticIndex] ]).trail_multi[
00349 fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00350 {
00351 fTotRightPlastics->Fill(
00352 ( (fCrateInputEvent->fMtdc[
00353 fPar->uTdcPlasticRightTot[uPlasticIndex] ]).trail_multi[
00354 fPar->uChannelPlasticRightTot[uPlasticIndex]][iHitIndex]
00355 -(fCrateInputEvent->fMtdc[
00356 fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00357 fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00358 )*dCaenBinSize*fPar->dToTGainListRight[uPlasticIndex]/1000.0
00359 - fPar->dTotOffsetListRight[uPlasticIndex],
00360 (Double_t)uPlasticIndex );
00361 }
00362
00363 if( -1 < (fCrateInputEvent->fMtdc[
00364 fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00365 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex] )
00366 {
00367 fTotLeftPlastics->Fill(
00368 ( (fCrateInputEvent->fMtdc[
00369 fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00370 fPar->uChannelPlasticLeftTot[uPlasticIndex]][iHitIndex]
00371 -(fCrateInputEvent->fMtdc[
00372 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00373 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00374 )*dCaenBinSize*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00375 - fPar->dTotOffsetListLeft[uPlasticIndex],
00376 (Double_t)uPlasticIndex );
00377
00378 if( -1 < (fCrateInputEvent->fMtdc[
00379 fPar->uTdcPlasticRightTot[uPlasticIndex] ]).trail_multi[
00380 fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00381 {
00382 if( -1 < fPar->iDiamondTdcVFTX && -1 < fPar->iDiamondChannelVFTX )
00383 if( -1 < (fCrateInputEvent->fMtdc[
00384 fPar->iDiamondTdcVFTX ]).lead_multi[
00385 fPar->iDiamondChannelVFTX][0] )
00386 {
00387 fReference2ProfilePlastics->Fill(
00388 ( ( ( (fCrateInputEvent->fMtdc[fPar->iDiamondTdcVFTX ]).lead_multi[
00389 fPar->iDiamondChannelVFTX][0])*dCaenBinSize -
00390 ( ( (fCrateInputEvent->fMtdc[
00391 fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00392 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00393 + (fCrateInputEvent->fMtdc[
00394 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00395 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00396 )*dCaenBinSize
00397 + fPar->dOffsetListRight[uPlasticIndex]
00398 + fPar->dOffsetListLeft[uPlasticIndex]
00399 )/2.
00400 ) ),
00401 (Double_t)uPlasticIndex );
00402 }
00403 if( -1 < fPar->iReferenceTdc && -1 < fPar->iReferenceChannel )
00404 if( -1 < (fCrateInputEvent->fMtdc[
00405 fPar->iReferenceTdc ]).lead_multi[
00406 fPar->iReferenceChannel][0])
00407 {
00408 fReference1ProfilePlastics->Fill(
00409 ( ( ( (fCrateInputEvent->fMtdc[fPar->iReferenceTdc ]).lead_multi[
00410 fPar->iReferenceChannel][0])*dCaenBinSize -
00411 ( ( (fCrateInputEvent->fMtdc[
00412 fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00413 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00414 + (fCrateInputEvent->fMtdc[
00415 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00416 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00417 )*dCaenBinSize
00418 + fPar->dOffsetListRight[uPlasticIndex]
00419 + fPar->dOffsetListLeft[uPlasticIndex]
00420 )/2.
00421 ) ),
00422 (Double_t)uPlasticIndex );
00423 }
00424
00425
00426 hitCurrent.dTimeLeft = dCaenBinSize*( (fCrateInputEvent->fMtdc[
00427 fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00428 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] )
00429 + fPar->dOffsetListLeft[uPlasticIndex]
00430 - dCaenOtherOffset;
00431
00432
00433 hitCurrent.dTotLeft =
00434 ( (fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00435 fPar->uChannelPlasticLeftTot[uPlasticIndex]][iHitIndex]
00436 -(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ]).lead_multi[
00437 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00438 )*dCaenBinSize*fPar->dToTGainListLeft[uPlasticIndex]
00439 - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00440
00441 hitCurrent.dTimeRight = dCaenBinSize*( (fCrateInputEvent->fMtdc[
00442 fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00443 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex] )
00444 + fPar->dOffsetListRight[uPlasticIndex]
00445 - dCaenOtherOffset;
00446
00447
00448 hitCurrent.dTotRight =
00449 ( (fCrateInputEvent->fMtdc[ fPar->uTdcPlasticRightTot[uPlasticIndex] ]).trail_multi[
00450 fPar->uChannelPlasticRightTot[uPlasticIndex]][iHitIndex]
00451 -(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00452 fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00453 )*dCaenBinSize*fPar->dToTGainListRight[uPlasticIndex]
00454 - fPar->dTotOffsetListRight[uPlasticIndex]*1000.0;
00455
00456 (fOutputEvent->fHits[uPlasticIndex]).push_back( hitCurrent );
00457
00458 hitCurrent.Clear();
00459 }
00460 }
00461 }
00462 }
00463 return;
00464 }
00465
00466 void TPlasticsProc::ProcessVftxPlasticSingle( UInt_t uPlasticIndex, Double_t dVftxOtherOffset )
00467 {
00468
00469 for(Int_t iHitIndex = 0;
00470 iHitIndex<(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).iMultiplicity[
00471 fPar->uChannelPlasticLeftTime[uPlasticIndex] ];
00472 iHitIndex++)
00473 {
00474 if( -1 < (fVftxInputEvent->fVftxBoards[
00475 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00476 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] )
00477 {
00478 Double_t dAutoOffset = CLOCK_TIME*( fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] );
00479
00480
00481 if( -1 < (fVftxInputEvent->fVftxBoards[
00482 fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00483 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex] )
00484 {
00485 fTotLeftPlastics->Fill(
00486 ( (fVftxInputEvent->fVftxBoards[
00487 fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00488 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex]
00489 -(fVftxInputEvent->fVftxBoards[
00490 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00491 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00492 - fPar->dOffsetListLeft[uPlasticIndex]
00493 )*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00494 - fPar->dTotOffsetListLeft[uPlasticIndex],
00495 (Double_t)uPlasticIndex );
00496
00497
00498
00499 if( -1 < fVftxPar->iMainReferenceTdc )
00500 {
00501
00502 if( -1 < fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] )
00503 if( -1 < (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00504 fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc]][0])
00505 {
00506 fReference1ProfilePlastics->Fill(
00507 ( ( (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00508 fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc]][0] -
00509 (fVftxInputEvent->fVftxBoards[
00510 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00511 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00512 + fPar->dOffsetListLeft[uPlasticIndex]
00513 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffset : 0.0)
00514 ) ),
00515 (Double_t)uPlasticIndex );
00516
00517 if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00518 if( -1 < (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00519 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc]][0])
00520 {
00521 Double_t dRefMeanSum = 0.;
00522 dRefMeanSum += (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00523 fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] ][0];
00524 dRefMeanSum += (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00525 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] ][0];
00526 fMeanRefProfilePlastics->Fill(
00527 ( ( dRefMeanSum/2. -
00528 (fVftxInputEvent->fVftxBoards[
00529 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00530 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00531 + fPar->dOffsetListLeft[uPlasticIndex]
00532 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffset : 0.0)
00533 ) ),
00534 (Double_t)uPlasticIndex );
00535 }
00536 }
00537
00538 if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00539 if( -1 < (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00540 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc]][0])
00541 {
00542 fReference2ProfilePlastics->Fill(
00543 ( ( (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00544 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc]][0] -
00545 (fVftxInputEvent->fVftxBoards[
00546 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00547 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00548 + fPar->dOffsetListLeft[uPlasticIndex]
00549 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffset : 0.0)
00550 ) ),
00551 (Double_t)uPlasticIndex );
00552 }
00553 }
00554
00555
00556 hitCurrent.dTimeLeft = (fVftxInputEvent->fVftxBoards[
00557 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00558 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00559 + fPar->dOffsetListLeft[uPlasticIndex]
00560 - dVftxOtherOffset
00561 - CLOCK_TIME*( 1 == fVftxPar->uAutomaticOffsetEnable?
00562 fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] : 0.0);
00563
00564
00565
00566 hitCurrent.dTotLeft =
00567 ( (fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00568 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex]
00569 -(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00570 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00571 - fPar->dOffsetListLeft[uPlasticIndex]
00572 )*fPar->dToTGainListLeft[uPlasticIndex]
00573 - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00574
00575 (fOutputEvent->fHits[uPlasticIndex]).push_back( hitCurrent );
00576
00577 hitCurrent.Clear();
00578 }
00579 }
00580 }
00581
00582 return;
00583 }
00584 void TPlasticsProc::ProcessVftxPlasticDouble( UInt_t uPlasticIndex, Double_t dVftxOtherOffset )
00585 {
00586
00587 for(Int_t iHitIndex = 0;
00588 iHitIndex<(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).iMultiplicity[
00589 fPar->uChannelPlasticLeftTime[uPlasticIndex] ] &&
00590 iHitIndex<(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).iMultiplicity[
00591 fPar->uChannelPlasticRightTime[uPlasticIndex] ];
00592 iHitIndex++)
00593 {
00594 if( -1 < (fVftxInputEvent->fVftxBoards[
00595 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00596 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] &&
00597 -1 < (fVftxInputEvent->fVftxBoards[
00598 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00599 fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex] )
00600 {
00601 Double_t dAutoOffset = CLOCK_TIME*(
00602 fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]
00603 -fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] );
00604 Double_t dAutoOffsetSum = CLOCK_TIME*(
00605 fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]
00606 +fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] );
00607
00608 fBeamProfilePlasticsTime->Fill(
00609 ( (fVftxInputEvent->fVftxBoards[
00610 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00611 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00612 -(fVftxInputEvent->fVftxBoards[
00613 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00614 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00615 + fPar->dOffsetListRight[uPlasticIndex]
00616 - fPar->dOffsetListLeft[uPlasticIndex]
00617 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffset : 0.0)
00618 ),
00619 ((Double_t)uPlasticIndex) +0.00001 );
00620
00621
00622 if( -1 < (fVftxInputEvent->fVftxBoards[
00623 fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00624 fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00625 {
00626 fTotRightPlastics->Fill(
00627 ( (fVftxInputEvent->fVftxBoards[
00628 fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00629 fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex]
00630 -(fVftxInputEvent->fVftxBoards[
00631 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00632 fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00633 )*fPar->dToTGainListRight[uPlasticIndex]/1000.0
00634 - fPar->dOffsetListRight[uPlasticIndex]/1000.0
00635 - fPar->dTotOffsetListRight[uPlasticIndex],
00636 (Double_t)uPlasticIndex );
00637 }
00638
00639 if( -1 < (fVftxInputEvent->fVftxBoards[
00640 fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00641 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex] )
00642 {
00643 fTotLeftPlastics->Fill(
00644 ( (fVftxInputEvent->fVftxBoards[
00645 fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00646 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex]
00647 -(fVftxInputEvent->fVftxBoards[
00648 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00649 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00650 )*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00651 - fPar->dOffsetListLeft[uPlasticIndex]/1000.0
00652 - fPar->dTotOffsetListLeft[uPlasticIndex],
00653 (Double_t)uPlasticIndex );
00654
00655
00656 if( -1 < (fVftxInputEvent->fVftxBoards[
00657 fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00658 fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00659 {
00660
00661 if( -1 < fVftxPar->iMainReferenceTdc )
00662 {
00663
00664 if( -1 < fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] )
00665 if( -1 < (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00666 fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc]][0])
00667 {
00668 fReference1ProfilePlastics->Fill(
00669 ( ( (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00670 fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc]][0] -
00671 ( (fVftxInputEvent->fVftxBoards[
00672 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00673 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00674 +(fVftxInputEvent->fVftxBoards[
00675 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00676 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00677 + fPar->dOffsetListRight[uPlasticIndex]
00678 + fPar->dOffsetListLeft[uPlasticIndex]
00679 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffsetSum : 0.0)
00680 )/2.
00681 ) ),
00682 (Double_t)uPlasticIndex );
00683
00684 if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00685 if( -1 < (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00686 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc]][0])
00687 {
00688 Double_t dRefMeanSum = 0.;
00689 dRefMeanSum += (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00690 fVftxPar->iVftxReference1Channel[fVftxPar->iMainReferenceTdc] ][0];
00691 dRefMeanSum += (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00692 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] ][0];
00693 fMeanRefProfilePlastics->Fill(
00694 ( ( dRefMeanSum/2. -
00695 ( (fVftxInputEvent->fVftxBoards[
00696 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00697 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00698 +(fVftxInputEvent->fVftxBoards[
00699 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00700 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00701 + fPar->dOffsetListRight[uPlasticIndex]
00702 + fPar->dOffsetListLeft[uPlasticIndex]
00703 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffsetSum : 0.0)
00704 )/2.
00705 ) ),
00706 (Double_t)uPlasticIndex );
00707 }
00708 }
00709
00710 if( -1 < fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc] )
00711 if( -1 < (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00712 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc]][0])
00713 {
00714 fReference2ProfilePlastics->Fill(
00715 ( ( (fVftxInputEvent->fVftxBoards[fVftxPar->iMainReferenceTdc] ).dTimeCorr[
00716 fVftxPar->iVftxReference2Channel[fVftxPar->iMainReferenceTdc]][0] -
00717 ( (fVftxInputEvent->fVftxBoards[
00718 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00719 fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00720 +(fVftxInputEvent->fVftxBoards[
00721 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00722 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00723 + fPar->dOffsetListRight[uPlasticIndex]
00724 + fPar->dOffsetListLeft[uPlasticIndex]
00725 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffsetSum : 0.0)
00726 )/2.
00727 ) ),
00728 (Double_t)uPlasticIndex );
00729 }
00730 }
00731
00732
00733 hitCurrent.dTimeLeft = (fVftxInputEvent->fVftxBoards[
00734 fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00735 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00736 + fPar->dOffsetListLeft[uPlasticIndex]
00737 - dVftxOtherOffset
00738 - CLOCK_TIME*( 1 == fVftxPar->uAutomaticOffsetEnable?
00739 fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] : 0.0);
00740
00741
00742
00743 hitCurrent.dTotLeft =
00744 ( (fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00745 fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex]
00746 -(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00747 fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00748 )*fPar->dToTGainListLeft[uPlasticIndex]
00749 - fPar->dOffsetListLeft[uPlasticIndex]
00750 - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00751
00752 hitCurrent.dTimeRight = (fVftxInputEvent->fVftxBoards[
00753 fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00754 fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00755 + fPar->dOffsetListRight[uPlasticIndex]
00756 - dVftxOtherOffset
00757 - CLOCK_TIME*( 1 == fVftxPar->uAutomaticOffsetEnable?
00758 fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] : 0.0);
00759
00760
00761 hitCurrent.dTotRight =
00762 ( (fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00763 fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex]
00764 -(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00765 fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00766 )*fPar->dToTGainListRight[uPlasticIndex]
00767 - fPar->dOffsetListRight[uPlasticIndex]
00768 - fPar->dTotOffsetListRight[uPlasticIndex]*1000.0;
00769
00770 (fOutputEvent->fHits[uPlasticIndex]).push_back( hitCurrent );
00771
00772 hitCurrent.Clear();
00773 }
00774 }
00775 }
00776 }
00777
00778 return;
00779 }
00780
00781