2 // Class AliRsnTOFCorrectionESD
4 // General implementation of a single cut strategy, which can be:
5 // - a value contained in a given interval [--> IsBetween() ]
6 // - a value equal to a given reference [--> MatchesValue()]
8 // In all cases, the reference value(s) is (are) given as data members
9 // and each kind of cut requires a given value type (Int, UInt, Double),
10 // but the cut check procedure is then automatized and chosen thanks to
11 // an enumeration of the implemented cut types.
12 // At the end, the user (or any other point which uses this object) has
13 // to use the method IsSelected() to check if this cut has been passed.
15 // authors: Martin Vala (martin.vala@cern.ch)
16 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
19 #include <Riostream.h>
22 #include "AliESDEvent.h"
23 #include "AliTOFT0maker.h"
24 #include "AliTOFcalib.h"
25 #include "AliCDBManager.h"
27 #include "AliRsnTOFCorrectionESD.h"
29 ClassImp(AliRsnTOFCorrectionESD)
31 //Bool_t AliRsnTOFCorrectionESD::fgTOFcalibrateESD = kTRUE;
32 Bool_t AliRsnTOFCorrectionESD::fgTOFcorrectTExp = kTRUE;
33 Bool_t AliRsnTOFCorrectionESD::fgTOFuseT0 = kTRUE;
34 Bool_t AliRsnTOFCorrectionESD::fgTOFtuneMC = kFALSE;
35 Double_t AliRsnTOFCorrectionESD::fgTOFresolution = 100.0;
36 AliTOFT0maker* AliRsnTOFCorrectionESD::fgTOFmaker = 0x0;
37 AliTOFcalib* AliRsnTOFCorrectionESD::fgTOFcalib = 0x0;
38 Int_t AliRsnTOFCorrectionESD::fgLastRun = -1;
40 //_________________________________________________________________________________________________
41 AliRsnTOFCorrectionESD::AliRsnTOFCorrectionESD(Bool_t isMC, Double_t tofRes)
42 : fOwnESDpid(kFALSE), fESDpid(0x0)
45 // Default constructor.
49 fgTOFresolution = tofRes;
52 //_________________________________________________________________________________________________
53 AliRsnTOFCorrectionESD::AliRsnTOFCorrectionESD(const AliRsnTOFCorrectionESD& copy)
54 : TObject(copy), fOwnESDpid(copy.fOwnESDpid), fESDpid(copy.fESDpid)
61 //_________________________________________________________________________________________________
62 AliRsnTOFCorrectionESD& AliRsnTOFCorrectionESD::operator=(const AliRsnTOFCorrectionESD& copy)
65 // Assignment operator
69 fOwnESDpid = copy.fOwnESDpid;
70 fESDpid = copy.fESDpid;
75 //_________________________________________________________________________________________________
76 void AliRsnTOFCorrectionESD::ProcessEvent(AliESDEvent *esd)
79 // Repeats the PID for current event.
80 // In order to avoid to repeat the initialization of calib object
81 // when this is not needed, this function uses the data-members
82 // to check if the run has changed.
85 // compare run number with static data member
86 Int_t run = esd->GetRunNumber();
88 // initialize only if run number has changed
89 if (run != fgLastRun) {
90 AliInfo("============================================================================================");
91 AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", fgLastRun, run));
92 AliInfo("============================================================================================");
95 AliCDBManager::Instance()->SetDefaultStorage("raw://");
96 AliCDBManager::Instance()->SetRun(fgLastRun);
98 if (fgTOFmaker) delete fgTOFmaker;
99 if (fgTOFcalib) delete fgTOFcalib;
101 fgTOFcalib = new AliTOFcalib();
103 fgTOFcalib->SetRemoveMeanT0(kFALSE);
104 fgTOFcalib->SetCalibrateTOFsignal(kFALSE);
106 fgTOFcalib->SetRemoveMeanT0(kTRUE);
107 fgTOFcalib->SetCalibrateTOFsignal(kTRUE);
109 if (fgTOFcorrectTExp) fgTOFcalib->SetCorrectTExp(kTRUE);
112 fgTOFmaker = new AliTOFT0maker(fESDpid, fgTOFcalib);
113 fgTOFmaker->SetTimeResolution(fgTOFresolution);
116 // if the ESDpid object is not present, create it
118 fESDpid = new AliESDpid;
122 // repeat the calibration and PID computations
123 /*if (fgTOFcalibrateESD)*/ fgTOFcalib->CalibrateESD(esd);
124 if (fgTOFtuneMC) fgTOFmaker->TuneForMC(esd);
126 fgTOFmaker->ComputeT0TOF(esd);
127 fgTOFmaker->ApplyT0TOF(esd);
128 fESDpid->MakePID(esd, kFALSE, 0.);