1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////
18 // recalculate the TOF signal from the TOF raw signal //
19 // using the updates in the OCDB //
21 ////////////////////////////////////////////////////////////////////
23 #include "AliTOFChannelOnlineStatusArray.h"
24 #include "TObjArray.h"
25 #include "AliTOFDeltaBCOffset.h"
26 #include "AliTOFCTPLatency.h"
27 #include "AliTOFRunParams.h"
28 #include "AliESDEvent.h"
29 #include "AliESDtrack.h"
30 #include "AliCDBManager.h"
31 #include "AliCDBEntry.h"
32 #include "AliTOFChannelOffline.h"
33 #include "AliTOFGeometry.h"
35 #include "AliTOFcalibESD.h"
37 ClassImp(AliTOFcalibESD)
39 //______________________________________________________________-
41 AliTOFcalibESD::AliTOFcalibESD() :
44 fChannelStatusArray(NULL),
45 fParOfflineArray(NULL),
46 fDeltaBCOffsetObj(NULL),
57 //______________________________________________________________-
59 AliTOFcalibESD::~AliTOFcalibESD()
66 //______________________________________________________________-
69 AliTOFcalibESD::Init(Int_t run)
75 /* get cdb instance */
76 AliCDBManager *cdb = AliCDBManager::Instance();
77 AliCDBEntry *entry = NULL;
79 /* get channel status array */
80 entry = cdb->Get("TOF/Calib/Status", run);
81 if (!entry || !entry->GetObject()) return kFALSE;
82 fChannelStatusArray = (AliTOFChannelOnlineStatusArray *)entry->GetObject();
83 /* get par offline array */
84 entry = cdb->Get("TOF/Calib/ParOffline", run);
85 if (!entry || !entry->GetObject()) return kFALSE;
86 fParOfflineArray = (TObjArray *)entry->GetObject();
87 /* get deltaBC offset obj */
88 entry = cdb->Get("TOF/Calib/DeltaBCOffset", run);
89 if (!entry || !entry->GetObject()) return kFALSE;
90 fDeltaBCOffsetObj = (AliTOFDeltaBCOffset *)entry->GetObject();
91 /* get CTP latency obj */
92 entry = cdb->Get("TOF/Calib/CTPLatency", run);
93 if (!entry || !entry->GetObject()) return kFALSE;
94 fCTPLatencyObj = (AliTOFCTPLatency *)entry->GetObject();
95 /* get run params obj */
96 entry = cdb->Get("TOF/Calib/RunParams", run);
97 if (!entry || !entry->GetObject()) return kFALSE;
98 fRunParamsObj = (AliTOFRunParams *)entry->GetObject();
105 //______________________________________________________________-
108 AliTOFcalibESD::CalibrateESD(AliESDEvent *event)
114 /* get global calibration params */
115 AliTOFChannelOffline *parOffline = NULL;
116 // Int_t deltaBCOffset = fDeltaBCOffsetObj->GetDeltaBCOffset(); //see below
117 Float_t ctpLatency = fCTPLatencyObj->GetCTPLatency();
118 Float_t tdcLatencyWindow;
119 Float_t timezero = fRunParamsObj->EvalT0(event->GetTimeStamp());
121 fTOFResolution=fRunParamsObj->EvalTOFResolution(event->GetTimeStamp());
123 /* loop over tracks */
124 AliESDtrack *track = NULL;
125 Int_t index, l0l1, deltaBC;
127 for (Int_t itrk = 0; itrk < event->GetNumberOfTracks(); itrk++) {
130 track = event->GetTrack(itrk);
131 if (!track || !(track->GetStatus() & AliESDtrack::kTOFout)) continue;
134 index = track->GetTOFCalChannel();
135 time = track->GetTOFsignalRaw();
136 tot = track->GetTOFsignalToT();
137 l0l1 = track->GetTOFL0L1();
138 deltaBC = track->GetTOFDeltaBC();
140 /* get channel dependent calibration params */
141 parOffline = (AliTOFChannelOffline *)fParOfflineArray->At(index);
142 tdcLatencyWindow = fChannelStatusArray->GetLatencyWindow(index) * 1.e3;
144 /* deltaBC correction (inhibited for the time being) */
145 // time -= (deltaBC - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth();
146 /* L0-L1 latency correction */
147 time += l0l1 * AliTOFGeometry::BunchCrossingBinWidth();
148 /* CTP latency correction */
150 /* TDC latency window correction */
151 time -= tdcLatencyWindow;
152 /* time-zero correction */
154 /* time calibration correction */
155 if (tot < AliTOFGeometry::SlewTOTMin())
156 tot = AliTOFGeometry::SlewTOTMin();
157 if (tot > AliTOFGeometry::SlewTOTMax())
158 tot = AliTOFGeometry::SlewTOTMax();
159 for (Int_t islew = 0; islew < 6; islew++)
160 time -= parOffline->GetSlewPar(islew) * TMath::Power(tot, islew) * 1.e3;
162 /* set new TOF signal */
163 track->SetTOFsignal(time);