• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

beamtime/gsi-aug12/get4v10/go4/PLASTICS/TPlasticsProc.cxx (r4864/r3872)

Go to the documentation of this file.
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 fGet4v1InputEvent(0),
00012 fOutputEvent(0)
00013 {
00014    TGo4Log::Info("**** TPlasticsProc: Create instance %s" , name );
00015 
00016    fPar = (TPlasticsParam*) MakeParameter("PlasticsPar", "TPlasticsParam");
00017 
00018    fVftxPar = (TVftxParam*) GetParameter("VftxPar");
00019    if( 0 == fVftxPar )
00020       fVftxPar = (TVftxParam*) MakeParameter("VftxPar", "TVftxParam");
00021 
00022    //~ cout<<name<<endl;
00023 
00024    // To be put as preprocessor somewhere ? (T1290Data.h?)
00025    dCaenBinSize     = 25000.0/1024.0;
00026 
00027    if( 0 < fPar->uNbPlastics)
00028    {
00029       fBeamProfilePlasticsTime =
00030          MakeTH2('D', "Plastics/BeamProfilePlasticsTime",
00031          "Beam profile for Plastics" ,
00032          2400,-30000,30000,  // <= To be put as param later
00033          fPar->uNbPlastics, 0, fPar->uNbPlastics,
00034          "Left right dt [ps]", "Plastic index []" );
00035 
00036       fDiamondProfilePlastics =
00037          MakeTH2('D', "Plastics/DiamondProfilePlastics",
00038          "Time profile against Diamond for Plastics" ,
00039          6000,-300000,300000,  // <= To be put as param later
00040          fPar->uNbPlastics, 0, fPar->uNbPlastics,
00041          "t(Diamond) - ( t(left)+ t(right) )/2 [ps]", "Plastic index []" );
00042 
00043       fReferenceProfilePlastics =
00044          MakeTH2('D', "Plastics/ReferenceProfilePlastics",
00045          "Time profile against Reference for Plastics" ,
00046          6000,-300000,300000,  // <= To be put as param later
00047          fPar->uNbPlastics, 0, fPar->uNbPlastics,
00048          "t(Reference) - ( t(left)+ t(right) )/2 [ps]", "Plastic index []" );
00049 
00050       // Maybe put the size of thez Tot histo in time as an option in parameter file
00051       fTotLeftPlastics =
00052             MakeTH2('D', "Plastics/TotLeftProfilePlastics",
00053             "Left Tot profile for Plastics" ,
00054             2000, -50, 50,
00055             fPar->uNbPlastics, 0. , (Double_t)fPar->uNbPlastics,
00056             "Left Tot [ns]", "Plastic index []" ) ; ;
00057 
00058       // Maybe put the size of thez Tot histo in time as an option in parameter file
00059       fTotRightPlastics =
00060             MakeTH2('D', "Plastics/TotRightProfilePlastics",
00061             "Right Tot profile for Plastics" ,
00062             2000, -50, 50,
00063             fPar->uNbPlastics, 0. , (Double_t)fPar->uNbPlastics,
00064             "Right Tot [ns]", "Plastics index []" ) ;
00065 
00066       // Multiplicity plots
00067       fMultiplicityPlastics =
00068             MakeTH2('I', "Plastics/MultiplicityPlastics",
00069             "Plastics Multiplicity " ,
00070             fPar->uNbPlastics, 0. , (Double_t)fPar->uNbPlastics,
00071             TVftxBoardData::MaxMult, 0, TVftxBoardData::MaxMult,
00072             "Plastics index []",
00073             "Multiplicity (Number of Hits/event) []" ) ;
00074    } // if( 0 < fPar->uNbPlastics)
00075 
00076    TGo4Log::Info("**** TPlasticsProc: Instance %s created", name );
00077 }
00078 
00079 
00080 TPlasticsProc::~TPlasticsProc()
00081 {
00082    cout << "**** TPlasticsProc: Delete instance " << endl;
00083 }
00084 
00085 void TPlasticsProc::InitEvent(TGo4EventElement* outevnt)
00086 {
00087    // first assign input event:
00088    // since input event object is never discarded within processor lifetime,
00089    // we just search for subevent by name once to speed up processing
00090 
00091    if(fCrateInputEvent==0)
00092    {
00093           TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00094           if(btevent)
00095           {
00096                  fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE"));
00097           }
00098           else
00099           {
00100                  fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(GetInputEvent());
00101           }
00102           if(fCrateInputEvent==0) {
00103                  GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: no input event TMbsCrateEvent!!! STOP GO4");
00104           }
00105    } // if(fCrateInputEvent==0)
00106    if(fTriglogInputEvent==0)
00107    {
00108           TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00109           if(btevent)
00110           {
00111                  fTriglogInputEvent=dynamic_cast<TTriglogEvent*>(btevent->GetSubEvent("TRIGLOG"));
00112           }
00113 
00114           if(fTriglogInputEvent==0) {
00115                  GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: input event is/has not a TTriglogEvent!!! STOP GO4");
00116           }
00117    } // if(fTriglogInputEvent==0)
00118    if(fVftxInputEvent==0)
00119    {
00120           TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00121           if(btevent)
00122           {
00123                  fVftxInputEvent=dynamic_cast<TVftxEvent*>(btevent->GetSubEvent("VFTX"));
00124           }
00125 
00126           if(fVftxInputEvent==0) {
00127                  GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: input event has no TVftxEvent!!! STOP GO4");
00128           }
00129    } // if(fVftxInputEvent==0)
00130    if(fGet4v1InputEvent==0)
00131    {
00132      TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00133      if(btevent)
00134      {
00135         fGet4v1InputEvent=dynamic_cast<TGet4v1Event*>(btevent->GetSubEvent("ROCGET4V10"));
00136      }
00137 
00138      if(fGet4v1InputEvent==0) {
00139        GO4_STOP_ANALYSIS_MESSAGE("**** TRpcProc: Fatal error: input event has no TGet4v1Event!!! STOP GO4");
00140      }
00141    } // if(fGet4v1InputEvent==0)
00142 
00143    // then assign output event
00144    // since output event object is never discarded within processor lifetime,
00145    // we just search for subevent by name once to speed up processing
00146    if(fOutputEvent==0)
00147    {
00148       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00149       if(btevent)
00150       {
00151          fOutputEvent=dynamic_cast<TPlasticsEvent*>(btevent->GetSubEvent( "PLASTICS" ) );
00152       }
00153       else
00154       {
00155          fOutputEvent= dynamic_cast<TPlasticsEvent*>(outevnt);
00156       }
00157       if(fOutputEvent==0) {
00158          GO4_STOP_ANALYSIS_MESSAGE("**** TPlasticsProc: Fatal error: output event is not a TPlasticsEvent!!! STOP GO4");
00159       }
00160       else {
00161          //     BuildEvent(dynamic_cast<TGo4MbsSubEvent*>(btevent->GetSubEvent("MBSCRATE")));
00162       }
00163    }
00164 
00165 }
00166 
00167 void TPlasticsProc::FinalizeEvent()
00168 {
00169    hitCurrent.Clear();
00170 
00171    // No plastic is defined => skip processing
00172    if( 0 == fPar->uNbPlastics )
00173    {
00174       fOutputEvent->SetValid(kTRUE);
00175       return;
00176    }
00177 
00178    for( UInt_t uPlasticIndex = 0; uPlasticIndex < fPar->uNbPlastics; uPlasticIndex++)
00179    {
00180       if( 3 == fPar->uPlasticTdcType[uPlasticIndex] )
00181       {
00182 /*
00183  * No multi-event for now !!!
00184  * TODO:
00185  *    - multi event output event
00186  *    - resize output event event vector
00187  *    - fill for specific plastic the corresponding events...
00188          for( UInt_t uGet4EventIndex = 0; uGet4EventIndex < fGet4v1InputEvent->fEvents.size(); uGet4EventIndex++)
00189          {
00190             eventCurrent.Clear();
00191             ProcessGet4v10PlasticDouble( uGet4EventIndex, uStripIndex );
00192          }
00193  */
00194          if( 0 == fGet4v1InputEvent->fEvents.size() )
00195          {
00196 
00197             fMultiplicityPlastics->Fill(uPlasticIndex, 0 );
00198             continue;
00199          }
00200          if( 1 < fGet4v1InputEvent->fEvents.size() )
00201             TGo4Log::Info("*+--+* TPlasticsProc: warning, more than 1 get4 event in inputevent, only first will be used" );
00202          ProcessGet4v10PlasticDouble( 0, uPlasticIndex );
00203          fMultiplicityPlastics->Fill(uPlasticIndex,
00204                (fOutputEvent->fHits[uPlasticIndex]).size() );
00205       } // if( 3 == fPar->fPar->uPlasticTdcType[uPlasticIndex] ) => GET4 v1.0 !!!
00206       else if(  fPar->uPlasticTdcType[uPlasticIndex] < 3 )
00207       {
00208          if( 1 == fPar->uPlasticTdcType[uPlasticIndex] )
00209          {
00210             // The trigger selection is active and we have another trigger => skip processing
00211             if( !( ( -1 == fPar->iTriggerSelection) ||
00212                 ( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>fPar->iTriggerSelection)&0x1 )  ) ) )
00213                continue;
00214 
00215             // Check that the VFTX data are valid after calibration
00216             if(fVftxInputEvent && fVftxInputEvent->IsValid())
00217             {
00218                ProcessVftxPlasticDouble( uPlasticIndex );
00219             } // if(fVftxInputEvent && fVftxInputEvent->IsValid())
00220          } // else if( 1 == fPar->uPlasticTdcType[uPlasticIndex] ) => VFTX  !!!
00221          else
00222          {
00223             // The trigger selection is active and we have another trigger => skip processing
00224             if( !( ( -1 == fPar->iTriggerSelection) ||
00225                 ( 1 == ((fTriglogInputEvent->fVulomTriggerPattern>>fPar->iTriggerSelection)&0x1 )  ) ) )
00226                continue;
00227             // Check that the MBS unpack event is valid
00228             if(fCrateInputEvent && fCrateInputEvent->IsValid())
00229             {
00230                ProcessCaenPlasticDouble( uPlasticIndex );
00231             } // if(fCrateInputEvent && fCrateInputEvent->IsValid())
00232 
00233          } // else of if( 1 == fPar->uPlasticTdcType[uPlasticIndex] ) => CAEN  !!!
00234          fMultiplicityPlastics->Fill(uPlasticIndex,
00235                (fOutputEvent->fHits[uPlasticIndex]).size() );
00236       } // else if( fPar->uPlasticTdcType[uPlasticIndex] < 3 ) => NOT Get4 v1.0
00237    }
00238 
00239    fOutputEvent->SetValid(kTRUE);
00240 }
00241 
00242 /**************************************************************************************************/
00243 void TPlasticsProc::ProcessCaenPlasticDouble( UInt_t uPlasticIndex, Double_t dCaenOtherOffset )
00244 {
00245    // Test if both time are there
00246    for(Int_t iHitIndex = 0;
00247          iHitIndex<(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).hit_lead[
00248                                                      fPar->uChannelPlasticLeftTime[uPlasticIndex] ] &&
00249           iHitIndex<(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticRightTime[uPlasticIndex]  ]).hit_lead[
00250                                                      fPar->uChannelPlasticRightTime[uPlasticIndex] ];
00251          iHitIndex++)
00252    {
00253       // Test if both time are there
00254       if( -1 < (fCrateInputEvent->fMtdc[
00255                   fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00256                            fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] &&
00257           -1 < (fCrateInputEvent->fMtdc[
00258                         fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00259                            fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex] )
00260       {
00261          fBeamProfilePlasticsTime->Fill(
00262                                ( ( (fCrateInputEvent->fMtdc[
00263                                        fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00264                                           fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00265                                   -(fCrateInputEvent->fMtdc[
00266                                        fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00267                                           fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00268                                 )*dCaenBinSize
00269                                 + fPar->dOffsetListRight[uPlasticIndex]
00270                                 - fPar->dOffsetListLeft[uPlasticIndex]
00271                                      ),
00272                ((Double_t)uPlasticIndex) +0.00001 );
00273 
00274          if( -1 < (fCrateInputEvent->fMtdc[
00275                            fPar->uTdcPlasticRightTot[uPlasticIndex]  ]).trail_multi[
00276                               fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00277          {
00278             fTotRightPlastics->Fill(
00279                ( (fCrateInputEvent->fMtdc[
00280                      fPar->uTdcPlasticRightTot[uPlasticIndex] ]).trail_multi[
00281                         fPar->uChannelPlasticRightTot[uPlasticIndex]][iHitIndex]
00282                  -(fCrateInputEvent->fMtdc[
00283                      fPar->uTdcPlasticRightTime[uPlasticIndex]  ]).lead_multi[
00284                         fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00285                )*dCaenBinSize*fPar->dToTGainListRight[uPlasticIndex]/1000.0
00286                - fPar->dTotOffsetListRight[uPlasticIndex],
00287                (Double_t)uPlasticIndex  );
00288          } // if valid Tot on right side
00289 
00290          if( -1 < (fCrateInputEvent->fMtdc[
00291                            fPar->uTdcPlasticLeftTot[uPlasticIndex]  ]).trail_multi[
00292                               fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex] )
00293          {
00294             fTotLeftPlastics->Fill(
00295                ( (fCrateInputEvent->fMtdc[
00296                      fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00297                         fPar->uChannelPlasticLeftTot[uPlasticIndex]][iHitIndex]
00298                  -(fCrateInputEvent->fMtdc[
00299                      fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00300                         fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00301                )*dCaenBinSize*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00302                - fPar->dTotOffsetListLeft[uPlasticIndex],
00303                (Double_t)uPlasticIndex  );
00304 
00305             if( -1 < (fCrateInputEvent->fMtdc[
00306                               fPar->uTdcPlasticRightTot[uPlasticIndex]  ]).trail_multi[
00307                                  fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00308             {
00309                if( -1 < fPar->iDiamondTdcVFTX && -1 < fPar->iDiamondChannelVFTX )
00310                   if( -1 < (fCrateInputEvent->fMtdc[
00311                                fPar->iDiamondTdcVFTX ]).lead_multi[
00312                                fPar->iDiamondChannelVFTX][0] )
00313                {
00314                  fDiamondProfilePlastics->Fill(
00315                   ( ( ( (fCrateInputEvent->fMtdc[fPar->iDiamondTdcVFTX ]).lead_multi[
00316                          fPar->iDiamondChannelVFTX][0])*dCaenBinSize -
00317                       ( (  (fCrateInputEvent->fMtdc[
00318                             fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00319                                fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00320                          + (fCrateInputEvent->fMtdc[
00321                             fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00322                                fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00323                         )*dCaenBinSize
00324                         + fPar->dOffsetListRight[uPlasticIndex]
00325                         + fPar->dOffsetListLeft[uPlasticIndex]
00326                       )/2.
00327                           ) ),
00328                    (Double_t)uPlasticIndex );
00329                } // if Diamond info defined and Diamond time there
00330                if( -1 < fPar->iReferenceTdc && -1 < fPar->iReferenceChannel )
00331                   if( -1 < (fCrateInputEvent->fMtdc[
00332                                fPar->iReferenceTdc ]).lead_multi[
00333                                fPar->iReferenceChannel][0])
00334                {
00335                   fReferenceProfilePlastics->Fill(
00336                   ( ( ( (fCrateInputEvent->fMtdc[fPar->iReferenceTdc ]).lead_multi[
00337                           fPar->iReferenceChannel][0])*dCaenBinSize -
00338                       ( (  (fCrateInputEvent->fMtdc[
00339                             fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00340                                fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00341                          + (fCrateInputEvent->fMtdc[
00342                             fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00343                                fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00344                         )*dCaenBinSize
00345                         + fPar->dOffsetListRight[uPlasticIndex]
00346                         + fPar->dOffsetListLeft[uPlasticIndex]
00347                       )/2.
00348                           ) ),
00349                    (Double_t)uPlasticIndex );
00350                } // if Reference info defined and Reference time there
00351 
00352                // Store time including offset!
00353                hitCurrent.dTimeLeft  = dCaenBinSize*( (fCrateInputEvent->fMtdc[
00354                                          fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00355                                               fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] )
00356                                        + fPar->dOffsetListLeft[uPlasticIndex]
00357                                        - dCaenOtherOffset;
00358                // Store tot including offset and gain!
00359                // Missing the offset for the coarse counter overflow!!!!
00360                hitCurrent.dTotLeft   =
00361                   ( (fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTot[uPlasticIndex] ]).trail_multi[
00362                                           fPar->uChannelPlasticLeftTot[uPlasticIndex]][iHitIndex]
00363                    -(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticLeftTime[uPlasticIndex]  ]).lead_multi[
00364                                           fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00365                   )*dCaenBinSize*fPar->dToTGainListLeft[uPlasticIndex]
00366                   - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00367                // Store time including offset!
00368                hitCurrent.dTimeRight = dCaenBinSize*( (fCrateInputEvent->fMtdc[
00369                                            fPar->uTdcPlasticRightTime[uPlasticIndex] ]).lead_multi[
00370                                               fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex] )
00371                                        + fPar->dOffsetListRight[uPlasticIndex]
00372                                        - dCaenOtherOffset;
00373                // Store tot including offset and gain!
00374                // Missing the offset for the coarse counter overflow!!!!
00375                hitCurrent.dTotRight  =
00376                   ( (fCrateInputEvent->fMtdc[ fPar->uTdcPlasticRightTot[uPlasticIndex] ]).trail_multi[
00377                                           fPar->uChannelPlasticRightTot[uPlasticIndex]][iHitIndex]
00378                    -(fCrateInputEvent->fMtdc[ fPar->uTdcPlasticRightTime[uPlasticIndex]  ]).lead_multi[
00379                                           fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00380                   )*dCaenBinSize*fPar->dToTGainListRight[uPlasticIndex]
00381                   - fPar->dTotOffsetListRight[uPlasticIndex]*1000.0;
00382 
00383                (fOutputEvent->fHits[uPlasticIndex]).push_back( hitCurrent );
00384 
00385                hitCurrent.Clear();
00386             }// if valid trailing edge also on right side => valid hit!
00387          } // if valid Tot on left side
00388       } // if( valid on both ends!)
00389    } // for TdcDataIndex in both end
00390    return;
00391 }
00392 void TPlasticsProc::ProcessVftxPlasticDouble( UInt_t uPlasticIndex, Double_t dVftxOtherOffset )
00393 {
00394    // Test if both time are there
00395    for(Int_t iHitIndex = 0;
00396          iHitIndex<(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).iMultiplicity[
00397                    fPar->uChannelPlasticLeftTime[uPlasticIndex] ] &&
00398           iHitIndex<(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]  ).iMultiplicity[
00399                     fPar->uChannelPlasticRightTime[uPlasticIndex] ];
00400          iHitIndex++)
00401    {
00402       if( -1 < (fVftxInputEvent->fVftxBoards[
00403                   fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00404                      fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex] &&
00405           -1 < (fVftxInputEvent->fVftxBoards[
00406                   fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00407                      fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex] )
00408       {
00409          Double_t dAutoOffset = CLOCK_TIME*(
00410                fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]
00411               -fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] );
00412          Double_t dAutoOffsetSum = CLOCK_TIME*(
00413                fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticRightTime[uPlasticIndex] ]
00414               +fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] );
00415 
00416          fBeamProfilePlasticsTime->Fill(
00417                                ( (fVftxInputEvent->fVftxBoards[
00418                                     fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00419                                        fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00420                                 -(fVftxInputEvent->fVftxBoards[
00421                                     fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00422                                        fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00423                                 + fPar->dOffsetListRight[uPlasticIndex]
00424                                 - fPar->dOffsetListLeft[uPlasticIndex]
00425                                 - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffset : 0.0)
00426                                      ),
00427                ((Double_t)uPlasticIndex) +0.00001 );
00428 
00429          // Check Right tot is there
00430          if( -1 < (fVftxInputEvent->fVftxBoards[
00431                                  fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00432                                     fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00433          {
00434             fTotRightPlastics->Fill(
00435                ( (fVftxInputEvent->fVftxBoards[
00436                      fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00437                         fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex]
00438                  -(fVftxInputEvent->fVftxBoards[
00439                      fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00440                         fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00441                 )*fPar->dToTGainListRight[uPlasticIndex]/1000.0
00442                 - fPar->dTotOffsetListRight[uPlasticIndex],
00443                (Double_t)uPlasticIndex );
00444          } // if valid trailing edge on right side
00445          // Check Left tot is there
00446          if( -1 < (fVftxInputEvent->fVftxBoards[
00447                                  fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00448                                     fPar->uChannelPlasticLeftTot[uPlasticIndex] ][iHitIndex] )
00449          {
00450             fTotLeftPlastics->Fill(
00451                ( (fVftxInputEvent->fVftxBoards[
00452                      fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00453                         fPar->uChannelPlasticLeftTot[uPlasticIndex]  ][iHitIndex]
00454                  -(fVftxInputEvent->fVftxBoards[
00455                      fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00456                         fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00457                 )*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00458                 - fPar->dTotOffsetListLeft[uPlasticIndex],
00459                (Double_t)uPlasticIndex );
00460 
00461             // Check last time info there => valid hit!
00462             if( -1 < (fVftxInputEvent->fVftxBoards[
00463                                     fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00464                                        fPar->uChannelPlasticRightTot[uPlasticIndex] ][iHitIndex] )
00465             {
00466                if( -1 < fPar->iDiamondTdcVFTX && -1 < fPar->iDiamondChannelVFTX )
00467                   if( -1 < (fVftxInputEvent->fVftxBoards[fPar->iDiamondTdcVFTX] ).dTimeCorr[fPar->iDiamondChannelVFTX][0])
00468                {
00469                  fDiamondProfilePlastics->Fill(
00470                   ( ( (fVftxInputEvent->fVftxBoards[fPar->iDiamondTdcVFTX] ).dTimeCorr[fPar->iDiamondChannelVFTX][0] -
00471                       ( (fVftxInputEvent->fVftxBoards[
00472                             fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00473                                fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00474                         +(fVftxInputEvent->fVftxBoards[
00475                             fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00476                                fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00477                         + fPar->dOffsetListRight[uPlasticIndex]
00478                         + fPar->dOffsetListLeft[uPlasticIndex]
00479                         - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffsetSum : 0.0)
00480                       )/2.
00481                           ) ),
00482                    (Double_t)uPlasticIndex );
00483                } // if Diamond info defined and Diamond time there
00484                if( -1 < fPar->iReferenceTdc && -1 < fPar->iReferenceChannel )
00485                   if( -1 < (fVftxInputEvent->fVftxBoards[fPar->iReferenceTdc] ).dTimeCorr[fPar->iReferenceChannel][0])
00486                {
00487                   fReferenceProfilePlastics->Fill(
00488                   ( ( (fVftxInputEvent->fVftxBoards[fPar->iReferenceTdc] ).dTimeCorr[fPar->iReferenceChannel][0] -
00489                       ( (fVftxInputEvent->fVftxBoards[
00490                             fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00491                                fPar->uChannelPlasticRightTime[uPlasticIndex]][iHitIndex]
00492                         +(fVftxInputEvent->fVftxBoards[
00493                             fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00494                                fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00495                         + fPar->dOffsetListRight[uPlasticIndex]
00496                         + fPar->dOffsetListLeft[uPlasticIndex]
00497                         - ( 1 == fVftxPar->uAutomaticOffsetEnable? dAutoOffsetSum : 0.0)
00498                       )/2.
00499                           ) ),
00500                    (Double_t)uPlasticIndex );
00501                } // if Reference info defined and Reference time there
00502 
00503                // Store time including offset!
00504                hitCurrent.dTimeLeft  = (fVftxInputEvent->fVftxBoards[
00505                                            fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00506                                              fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00507                                        + fPar->dOffsetListLeft[uPlasticIndex]
00508                                        - dVftxOtherOffset
00509                                        - CLOCK_TIME*( 1 == fVftxPar->uAutomaticOffsetEnable?
00510                                              fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticLeftTime[ uPlasticIndex] ] : 0.0);
00511 
00512                // Store tot including offset and gain!
00513                // Missing the offset for the coarse counter overflow!!!!
00514                hitCurrent.dTotLeft   =
00515                   ( (fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTot[uPlasticIndex] ] ).dTimeCorr[
00516                         fPar->uChannelPlasticLeftTot[uPlasticIndex]  ][iHitIndex]
00517                    -(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).dTimeCorr[
00518                         fPar->uChannelPlasticLeftTime[uPlasticIndex] ][iHitIndex]
00519                   )*fPar->dToTGainListLeft[uPlasticIndex]
00520                   - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00521                //Store time including offset!
00522                hitCurrent.dTimeRight = (fVftxInputEvent->fVftxBoards[
00523                                            fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00524                                              fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00525                                        + fPar->dOffsetListRight[uPlasticIndex]
00526                                        - dVftxOtherOffset
00527                                        - CLOCK_TIME*( 1 == fVftxPar->uAutomaticOffsetEnable?
00528                                              fVftxPar->iAutomaticTdcOffset[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] : 0.0);
00529                // Store tot including offset and gain!
00530                // Missing the offset for the coarse counter overflow!!!!
00531                hitCurrent.dTotRight  =
00532                   ( (fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticRightTot[uPlasticIndex] ] ).dTimeCorr[
00533                         fPar->uChannelPlasticRightTot[uPlasticIndex]  ][iHitIndex]
00534                    -(fVftxInputEvent->fVftxBoards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).dTimeCorr[
00535                         fPar->uChannelPlasticRightTime[uPlasticIndex] ][iHitIndex]
00536                   )*fPar->dToTGainListRight[uPlasticIndex]
00537                   - fPar->dTotOffsetListRight[uPlasticIndex]*1000.0;
00538 
00539                (fOutputEvent->fHits[uPlasticIndex]).push_back( hitCurrent );
00540 
00541                hitCurrent.Clear();
00542             }// if valid trailing edge also on right side => valid hit!
00543          } // if valid trailing edge on left side
00544       } // if( valid on both ends!)
00545    } // for TdcDataIndex in both end
00546 
00547    return;
00548 }
00549 void TPlasticsProc::ProcessGet4v10PlasticDouble( UInt_t uEventIndex , UInt_t uPlasticIndex, Double_t dGet4v10OtherOffset )
00550 {
00551    // Test if both time are there
00552    for( Int_t iHitIndex = 0;
00553          iHitIndex < ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00554                          fGet4Boards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).
00555                            fHits[ fPar->uChannelPlasticLeftTime[uPlasticIndex] ].size() ) &&
00556          iHitIndex < ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00557                          fGet4Boards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).
00558                            fHits[ fPar->uChannelPlasticRightTime[uPlasticIndex] ].size() );
00559          iHitIndex++)
00560    {
00561       fBeamProfilePlasticsTime->Fill(
00562                             ( ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00563                                     fGet4Boards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).
00564                                       fHits[ fPar->uChannelPlasticRightTime[uPlasticIndex] ] )[iHitIndex].GetHitTime()
00565                              -( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00566                                     fGet4Boards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).
00567                                       fHits[ fPar->uChannelPlasticLeftTime[uPlasticIndex] ] )[iHitIndex].GetHitTime()
00568                              + fPar->dOffsetListRight[uPlasticIndex]
00569                              - fPar->dOffsetListLeft[uPlasticIndex]
00570                                   ),
00571             ((Double_t)uPlasticIndex) +0.00001 );
00572 
00573       // Right Tot always there as GET4 unpack define hit with time+tot!
00574       fTotRightPlastics->Fill(
00575           ( ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00576                    fGet4Boards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).
00577                      fHits[ fPar->uChannelPlasticRightTime[uPlasticIndex] ] )[iHitIndex].GetTot()
00578           )*fPar->dToTGainListRight[uPlasticIndex]/1000.0
00579           - fPar->dTotOffsetListRight[uPlasticIndex],
00580          (Double_t)uPlasticIndex );
00581       // Left tot always there as GET4 unpack define hit with time+tot!
00582       fTotLeftPlastics->Fill(
00583           ( ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00584                    fGet4Boards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).
00585                      fHits[ fPar->uChannelPlasticLeftTime[uPlasticIndex] ] )[iHitIndex].GetTot()
00586           )*fPar->dToTGainListLeft[uPlasticIndex]/1000.0
00587           - fPar->dTotOffsetListLeft[uPlasticIndex],
00588          (Double_t)uPlasticIndex );
00589 
00590       // Store time including offset!
00591       hitCurrent.dTimeLeft  = ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00592                                  fGet4Boards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).
00593                                    fHits[ fPar->uChannelPlasticLeftTime[uPlasticIndex] ] )[iHitIndex].GetHitTime()
00594                               + fPar->dOffsetListLeft[uPlasticIndex]
00595                               - dGet4v10OtherOffset;
00596 
00597       // Store tot including offset and gain!
00598       // Missing the offset for the coarse counter overflow!!!!
00599       hitCurrent.dTotLeft   =
00600          ( ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00601                   fGet4Boards[ fPar->uTdcPlasticLeftTime[uPlasticIndex] ] ).
00602                     fHits[ fPar->uChannelPlasticLeftTime[uPlasticIndex] ] )[iHitIndex].GetTot()
00603          )*fPar->dToTGainListLeft[uPlasticIndex]
00604          - fPar->dTotOffsetListLeft[uPlasticIndex]*1000.0;
00605       //Store time including offset!
00606       hitCurrent.dTimeRight = ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00607                                  fGet4Boards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).
00608                                    fHits[ fPar->uChannelPlasticRightTime[uPlasticIndex] ] )[iHitIndex].GetHitTime()
00609                               + fPar->dOffsetListRight[uPlasticIndex]
00610                               - dGet4v10OtherOffset;
00611       // Store tot including offset and gain!
00612       // Missing the offset for the coarse counter overflow!!!!
00613       hitCurrent.dTotRight  =
00614          ( ( ( (fGet4v1InputEvent->fEvents[uEventIndex]).
00615                   fGet4Boards[ fPar->uTdcPlasticRightTime[uPlasticIndex] ] ).
00616                     fHits[ fPar->uChannelPlasticRightTime[uPlasticIndex] ] )[iHitIndex].GetTot()
00617          )*fPar->dToTGainListRight[uPlasticIndex]
00618          - fPar->dTotOffsetListRight[uPlasticIndex]*1000.0;
00619 
00620       (fOutputEvent->fHits[uPlasticIndex]).push_back( hitCurrent );
00621 
00622       hitCurrent.Clear();
00623    } // for TdcDataIndex in both end
00624 
00625    return;
00626 }
00627 
00628 /**************************************************************************************************/

Generated on Tue Dec 10 2013 04:52:20 for ROCsoft by  doxygen 1.7.1