cov fix
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AliT0TenderSupply.cxx
CommitLineData
c9a7f36c 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16///////////////////////////////////////////////////////////////////////////\r
17// //\r
18// T0 Tender supply //\r
19// //\r
20// //\r
21///////////////////////////////////////////////////////////////////////////\r
22\r
23#include <AliESDEvent.h>\r
24#include <AliESDtrack.h>\r
25\r
26#include <AliTender.h>\r
27#include <AliT0TenderSupply.h>\r
28\r
29\r
30ClassImp(AliT0TenderSupply)\r
31\r
32//________________________________________________________________________\r
33AliT0TenderSupply::AliT0TenderSupply():\r
34 AliTenderSupply(),\r
35 fCorrectMeanTime(kFALSE),\r
36 fCorrectStartTimeOnAmplSatur(kFALSE),\r
37 fAmplitudeThreshold(100) \r
38{\r
39 //\r
40 // default constructor\r
41 //\r
42 for(int i=0; i<3; i++) fTimeOffset[i]=0;\r
43}\r
44\r
45//________________________________________________________________________\r
46AliT0TenderSupply::AliT0TenderSupply(const char *name, const AliTender *tender):\r
47 AliTenderSupply(name,tender),\r
48 fCorrectMeanTime(kFALSE),\r
49 fCorrectStartTimeOnAmplSatur(kFALSE),\r
50 fAmplitudeThreshold(100) \r
51{\r
52 //\r
53 // constructor\r
54 //\r
55 for(int i=0; i<3; i++) fTimeOffset[i]=0;\r
56}\r
57\r
58//________________________________________________________________________\r
59AliT0TenderSupply::~AliT0TenderSupply(){\r
60 //\r
61 // destructor\r
62 //\r
63 \r
64}\r
65\r
66//________________________________________________________________________\r
67void AliT0TenderSupply::Init(){\r
68 //\r
69 // Init\r
70 //\r
71 Int_t run = fTender->GetRun();\r
72 if (run == 0) return; // to skip first init, when we don't have yet a run number\r
73\r
74 fCorrectMeanTime = kFALSE; //reset\r
75 for(int i=0; i<3; i++) fTimeOffset[i]=0;\r
76\r
77 if(run==167706){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=37.636; fTimeOffset[1]=38.2358; fTimeOffset[2] =37.2348;}\r
78 if(run==167711){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=7.71361; fTimeOffset[1]=15.0231; fTimeOffset[2] =18.0363;}\r
79 if(run==167713){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=19.4678; fTimeOffset[1]=8.26494; fTimeOffset[2] =39.7651;}\r
80 if(run==167806){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=32.8404; fTimeOffset[1]=25.6742; fTimeOffset[2] =43.0574;}\r
81 if(run==167807){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=39.2029; fTimeOffset[1]=15.9077; fTimeOffset[2] =46.8384;}\r
82 if(run==167808){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=27.2107; fTimeOffset[1]=20.1576; fTimeOffset[2] =27.9818;}\r
83 if(run==167813){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=22.5833; fTimeOffset[1]=16.1395; fTimeOffset[2] =31.3737;}\r
84 if(run==167814){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=37.756; fTimeOffset[1]=20.6428; fTimeOffset[2] =56.2365;}\r
85 if(run==167818){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=38.7765; fTimeOffset[1]=37.3998; fTimeOffset[2] =35.8552;}\r
86 if(run==167902){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=41.0647; fTimeOffset[1]=31.3968; fTimeOffset[2] =33.8023;}\r
87 if(run==167903){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=35.2311; fTimeOffset[1]=49.3209; fTimeOffset[2] =30.5427;}\r
88 if(run==167915){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=33.2731; fTimeOffset[1]=27.4272; fTimeOffset[2] =35.8073;}\r
89 if(run==167920){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=31.8057; fTimeOffset[1]=21.8993; fTimeOffset[2] =36.615;}\r
90 if(run==167921){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=30.6407; fTimeOffset[1]=8.60546; fTimeOffset[2] =53.1829;}\r
91 if(run==167985){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=31.7908; fTimeOffset[1]=25.753; fTimeOffset[2] =37.3178;}\r
92 if(run==167986){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=22.331; fTimeOffset[1]=4.7895; fTimeOffset[2] =40.9276;}\r
93 if(run==167987){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=30.4746; fTimeOffset[1]=15.5886; fTimeOffset[2] =50.3252;}\r
94 if(run==167988){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=45.1788; fTimeOffset[1]=29.2541; fTimeOffset[2] =67.222;}\r
95 if(run==168066){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=23.5272; fTimeOffset[1]=26.8631; fTimeOffset[2] =31.2057;}\r
96 if(run==168068){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=32.4972; fTimeOffset[1]=9.76024; fTimeOffset[2] =48.3329;}\r
97 if(run==168069){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=25.6839; fTimeOffset[1]=11.4422; fTimeOffset[2] =34.8375;}\r
98 if(run==168076){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=39.2055; fTimeOffset[1]=25.607; fTimeOffset[2] =52.0409;}\r
99 if(run==168103){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=67.7271; fTimeOffset[1]=50.5392; fTimeOffset[2] =48.0866;}\r
100 if(run==168104){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=42.6881; fTimeOffset[1]=43.5591; fTimeOffset[2] =48.7308;}\r
101 if(run==168105){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=29.958; fTimeOffset[1]=8.65483; fTimeOffset[2] =42.7843;}\r
102 if(run==168107){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=39.0088; fTimeOffset[1]=26.1971; fTimeOffset[2] =53.5561;}\r
103 if(run==168108){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=47.8417; fTimeOffset[1]=33.5841; fTimeOffset[2] =60.2913;}\r
104 if(run==168115){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=26.9248; fTimeOffset[1]=16.2735; fTimeOffset[2] =37.1457;}\r
105 if(run==168171){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=841.144; fTimeOffset[1]=927.182; fTimeOffset[2] =751.284;}\r
106 if(run==168172){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=868.888; fTimeOffset[1]=972.012; fTimeOffset[2] =766.496;}\r
107 if(run==168173){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=833.223; fTimeOffset[1]=925.62; fTimeOffset[2] =732.57;}\r
108 if(run==168175){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=807.481; fTimeOffset[1]=900.059; fTimeOffset[2] =718.232;}\r
109 if(run==168181){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=78.7363; fTimeOffset[1]=115.034; fTimeOffset[2] =39.0348;}\r
110 if(run==168203){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=34.9107; fTimeOffset[1]=18.5032; fTimeOffset[2] =50.9434;}\r
111 if(run==168204){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=800.427; fTimeOffset[1]=875.242; fTimeOffset[2] =744.428;}\r
112 if(run==168205){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=70.2692; fTimeOffset[1]=57.6408; fTimeOffset[2] =75.372;}\r
113 if(run==168206){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=754.293; fTimeOffset[1]=846.635; fTimeOffset[2] =670.418;}\r
114 if(run==168207){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=26.3374; fTimeOffset[1]=-54.9438; fTimeOffset[2] =76.9511;}\r
115 if(run==168208){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=73.6404; fTimeOffset[1]=20.3787; fTimeOffset[2] =75.0944;}\r
116 if(run==168212){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=57.4094; fTimeOffset[1]=38.2747; fTimeOffset[2] =41.9405;}\r
117 if(run==168213){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=35.4503; fTimeOffset[1]=27.5827; fTimeOffset[2] =39.1856;}\r
118 if(run==168310){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=28.6722; fTimeOffset[1]=33.2269; fTimeOffset[2] =27.9654;}\r
119 if(run==168311){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=40.203; fTimeOffset[1]=19.1132; fTimeOffset[2] =56.441;}\r
120 if(run==168318){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=20.5591; fTimeOffset[1]=26.1756; fTimeOffset[2] =16.0513;}\r
121 if(run==168322){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=56.2993; fTimeOffset[1]=44.9021; fTimeOffset[2] =61.1342;}\r
122 if(run==168325){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=44.1044; fTimeOffset[1]=24.2727; fTimeOffset[2] =61.4175;}\r
123 if(run==168341){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=43.254; fTimeOffset[1]=40.1345; fTimeOffset[2] =44.7359;}\r
124 if(run==168342){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=55.7112; fTimeOffset[1]=48.5852; fTimeOffset[2] =56.7952;}\r
125 if(run==168356){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=-34.5093; fTimeOffset[1]=-5.55039; fTimeOffset[2] =-65.6368;}\r
126 if(run==168361){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=-248.811; fTimeOffset[1]=-250.006; fTimeOffset[2] =-153.319;}\r
127 if(run==168362){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=53.8183; fTimeOffset[1]=48.2561; fTimeOffset[2] =54.1145;}\r
128 if(run==168458){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=33.4396; fTimeOffset[1]=32.8394; fTimeOffset[2] =39.4757;}\r
129 if(run==168460){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=43.74; fTimeOffset[1]=49.8685; fTimeOffset[2] =41.4665;}\r
130 if(run==168461){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=29.7889; fTimeOffset[1]=27.8432; fTimeOffset[2] =38.4801;}\r
131 if(run==168464){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=33.1291; fTimeOffset[1]=23.5964; fTimeOffset[2] =38.9655;}\r
132 if(run==168467){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=37.1316; fTimeOffset[1]=48.4763; fTimeOffset[2] =19.1521;}\r
133 if(run==168511){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=45.4487; fTimeOffset[1]=31.5609; fTimeOffset[2] =44.3649;}\r
134 if(run==168512){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=34.615; fTimeOffset[1]=24.6349; fTimeOffset[2] =38.7753;}\r
135 if(run==168514){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=28.8178; fTimeOffset[1]=22.1466; fTimeOffset[2] =40.6307;}\r
136 if(run==168777){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=32.2621; fTimeOffset[1]=17.7215; fTimeOffset[2] =44.2911;}\r
137 if(run==168826){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=27.7899; fTimeOffset[1]=19.4315; fTimeOffset[2] =34.24;}\r
138 if(run==168984){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=21.9251; fTimeOffset[1]=4.93046; fTimeOffset[2] =27.7368;}\r
139 if(run==168988){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=32.3264; fTimeOffset[1]=19.2958; fTimeOffset[2] =42.3047;}\r
140 if(run==168992){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=40.2228; fTimeOffset[1]=27.3191; fTimeOffset[2] =51.0479;}\r
141 if(run==169035){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=16.2383; fTimeOffset[1]=12.7409; fTimeOffset[2] =21.7943;}\r
142 if(run==169044){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=18.3657; fTimeOffset[1]=2.523; fTimeOffset[2] =39.3647;}\r
143 if(run==169040){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=30 ; fTimeOffset[1]=-42; fTimeOffset[2] = 0;}\r
144 if(run==169045){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=29.9529; fTimeOffset[1]=21.3877; fTimeOffset[2] =35.4287;}\r
145 if(run==169094){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=16.3535; fTimeOffset[1]=12.5777; fTimeOffset[2] =15.5841;}\r
146 if(run==169099){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=24.34; fTimeOffset[1]=17.5334; fTimeOffset[2] =28.812;}\r
147 if(run==169143){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=34.3485; fTimeOffset[1]=-2.89818; fTimeOffset[2] =67.149;}\r
148 if(run==169145){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=30.1335; fTimeOffset[1]=13.647; fTimeOffset[2] =44.4143;}\r
149 if(run==169148){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=28.0664; fTimeOffset[1]=15.8024; fTimeOffset[2] =32.7707;}\r
150 if(run==169156){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=20.3655; fTimeOffset[1]=15.1023; fTimeOffset[2] =28.4647;}\r
151 if(run==169160){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=9.7256; fTimeOffset[1]=3.94123; fTimeOffset[2] =16.3137;}\r
152 if(run==169167){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=30.4764; fTimeOffset[1]=11.632; fTimeOffset[2] =42.8243;}\r
153 if(run==169238){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=15.5803; fTimeOffset[1]=17.6367; fTimeOffset[2] =12.3469;}\r
154 if(run==169411){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=40.604; fTimeOffset[1]=24.3761; fTimeOffset[2] =56.2715;}\r
155 if(run==169415){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=45.9346; fTimeOffset[1]=27.2209; fTimeOffset[2] =54.7067;}\r
156 if(run==169417){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=33.8899; fTimeOffset[1]=25.979; fTimeOffset[2] =45.0143;}\r
157 if(run==169418){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=34.6481; fTimeOffset[1]=31.0951; fTimeOffset[2] =39.9321;}\r
158 if(run==169419){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=42.138; fTimeOffset[1]=32.447; fTimeOffset[2] =47.7478;}\r
159 if(run==169420){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=51.7414; fTimeOffset[1]=42.8009; fTimeOffset[2] =56.2767;}\r
160 if(run==169498){ fCorrectMeanTime = kTRUE; fTimeOffset[0]=47.3734; fTimeOffset[1]=48.0008; fTimeOffset[2] =45.101;}\r
161\r
162 //-----\r
163 /*\r
164\r
165 fCorrectStartTimeOnAmplSatur = kFALSE;\r
166 fAmplitudeThreshold = 100; //in mips\r
167\r
168 if(167693<= run && run<=170593){ // LHC11h\r
169 fCorrectStartTimeOnAmplSatur = kTRUE;\r
170 fAmplitudeThreshold = 40; //in mips\r
171 }\r
172 */\r
173}\r
174\r
175//________________________________________________________________________\r
176void AliT0TenderSupply::ProcessEvent(){\r
177 //\r
178 // loop over all online T0 candidates and flag\r
179 // selected daughter tracks using the status bis of the TObject\r
180 //\r
181\r
182 AliESDEvent *event=fTender->GetEvent();\r
183 if (!event) return;\r
184\r
185 //Do something when the run number changed, like loading OCDB entries etc.\r
186 if(fTender->RunChanged()){\r
187 Init();\r
188 }\r
189\r
190\r
191 if(fCorrectStartTimeOnAmplSatur){\r
192 //correct A side ORA on amplitude saturation\r
193 const Double32_t* time = event->GetT0time();\r
194 const Double32_t* amplitude = event->GetT0amplitude();\r
195\r
196 Int_t idxOfFirstPmtA = -1;\r
197 Double32_t timeOrA = 99999;\r
198 for(int ipmt=12; ipmt<24; ipmt++){ //loop over A side\r
199 if( amplitude[ipmt] < fAmplitudeThreshold){\r
200 if( time[ipmt] > -200 && time[ipmt]!=0 && time[ipmt] < timeOrA ){ \r
201 timeOrA = time[ipmt];\r
202 idxOfFirstPmtA = ipmt;\r
203 }\r
204 }\r
205 }\r
206\r
207 if(idxOfFirstPmtA>-1){ //a hit in aside with less than 40 mips\r
208 const Double32_t* mean = event->GetT0TOF();\r
209 Double32_t timeOrC = mean[2];\r
210 Double32_t timeOrAplusOrC = (timeOrA+timeOrC)/2;\r
211\r
212 event->SetT0TOF(0, timeOrAplusOrC);\r
213 event->SetT0TOF(1, timeOrA);\r
214 }\r
215 }\r
216\r
217 //...........................................\r
218 if(fCorrectMeanTime){\r
219 // correct mean time offsets \r
220 const Double32_t* mean = event->GetT0TOF();\r
221 for(int it0=0; it0<3; it0++){\r
222 if(-200 < mean[it0]){\r
223 event->SetT0TOF(it0, mean[it0] - fTimeOffset[it0]); \r
224 }\r
225 }\r
226 }\r
227\r
228}\r