]>
Commit | Line | Data |
---|---|---|
dc7ca31d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
72e48d95 | 17 | /********************************************************************* |
18 | * T0 reconstruction and filling ESD | |
19 | * - reconstruct mean time (interation time) | |
20 | * - vertex position | |
21 | * - multiplicity | |
22 | ********************************************************************/ | |
dc7ca31d | 23 | |
af885e0f | 24 | #include <AliESDEvent.h> |
dc7ca31d | 25 | #include "AliLog.h" |
dc7ca31d | 26 | #include "AliT0RecPoint.h" |
27 | #include "AliRawReader.h" | |
28 | #include "AliT0RawReader.h" | |
dc7ca31d | 29 | #include "AliT0digit.h" |
30 | #include "AliT0Reconstructor.h" | |
31 | #include "AliT0Parameters.h" | |
c41ceaac | 32 | #include "AliT0Calibrator.h" |
dc7ca31d | 33 | |
34 | #include <TArrayI.h> | |
35 | #include <TGraph.h> | |
aad72f45 | 36 | #include <TMath.h> |
b09247a2 | 37 | #include <Riostream.h> |
dc7ca31d | 38 | |
39 | ClassImp(AliT0Reconstructor) | |
40 | ||
c41ceaac | 41 | AliT0Reconstructor:: AliT0Reconstructor(): AliReconstructor(), |
f16935f7 | 42 | fdZonA(0), |
43 | fdZonC(0), | |
44 | fZposition(0), | |
45 | fParam(NULL), | |
2e6a5ee0 | 46 | fAmpLEDrec(), |
c883fdf2 | 47 | fQTC(0), |
48 | fAmpLED(0), | |
2e6a5ee0 | 49 | fCalib() |
e0bba6cc | 50 | { |
72e48d95 | 51 | //constructor |
52 | ||
c41ceaac | 53 | AliDebug(1,"Start reconstructor "); |
74adb36a | 54 | |
55 | fParam = AliT0Parameters::Instance(); | |
56 | fParam->Init(); | |
c883fdf2 | 57 | TString option = GetOption(); |
58 | ||
74adb36a | 59 | for (Int_t i=0; i<24; i++){ |
2e6a5ee0 | 60 | TGraph* gr = fParam ->GetAmpLEDRec(i); |
29ed1d0e | 61 | if (gr) fAmpLEDrec.AddAtAndExpand(gr,i) ; |
c883fdf2 | 62 | TGraph* gr1 = fParam ->GetAmpLED(i); |
63 | if (gr1) fAmpLED.AddAtAndExpand(gr1,i) ; | |
64 | TGraph* gr2 = fParam ->GetQTC(i); | |
65 | if (gr2) fQTC.AddAtAndExpand(gr2,i) ; | |
66 | ||
67 | } | |
29ed1d0e | 68 | |
f16935f7 | 69 | fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1")); |
70 | fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15")); | |
12e9daf9 | 71 | fCalib = new AliT0Calibrator(); |
72 | ||
c41ceaac | 73 | } |
74 | //____________________________________________________________________ | |
e0bba6cc | 75 | |
c41ceaac | 76 | AliT0Reconstructor::AliT0Reconstructor(const AliT0Reconstructor &r): |
d76c31f4 | 77 | AliReconstructor(r), |
f16935f7 | 78 | fdZonA(0), |
79 | fdZonC(0), | |
80 | fZposition(0), | |
81 | fParam(NULL), | |
2e6a5ee0 | 82 | fAmpLEDrec(), |
c883fdf2 | 83 | fQTC(0), |
84 | fAmpLED(0), | |
2e6a5ee0 | 85 | fCalib() |
86 | ||
f16935f7 | 87 | { |
c41ceaac | 88 | // |
89 | // AliT0Reconstructor copy constructor | |
90 | // | |
e0bba6cc | 91 | |
c41ceaac | 92 | ((AliT0Reconstructor &) r).Copy(*this); |
e0bba6cc | 93 | |
94 | } | |
95 | ||
c41ceaac | 96 | //_____________________________________________________________________________ |
97 | AliT0Reconstructor &AliT0Reconstructor::operator=(const AliT0Reconstructor &r) | |
dc7ca31d | 98 | { |
c41ceaac | 99 | // |
100 | // Assignment operator | |
101 | // | |
102 | ||
103 | if (this != &r) ((AliT0Reconstructor &) r).Copy(*this); | |
104 | return *this; | |
e0bba6cc | 105 | |
dc7ca31d | 106 | } |
c41ceaac | 107 | |
108 | //_____________________________________________________________________________ | |
109 | ||
dc7ca31d | 110 | void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const |
94c27e4f | 111 | |
dc7ca31d | 112 | { |
94c27e4f | 113 | // T0 digits reconstruction |
114 | // T0RecPoint writing | |
c41ceaac | 115 | |
74adb36a | 116 | |
c41ceaac | 117 | TArrayI * timeCFD = new TArrayI(24); |
118 | TArrayI * timeLED = new TArrayI(24); | |
119 | TArrayI * chargeQT0 = new TArrayI(24); | |
120 | TArrayI * chargeQT1 = new TArrayI(24); | |
74adb36a | 121 | |
dc7ca31d | 122 | |
94c27e4f | 123 | // Int_t mV2Mip = param->GetmV2Mip(); |
dc7ca31d | 124 | //mV2Mip = param->GetmV2Mip(); |
8955c6b4 | 125 | Float_t channelWidth = fParam->GetChannelWidth() ; |
12e9daf9 | 126 | // Int_t meanT0 = fParam->GetMeanT0(); |
94c27e4f | 127 | |
dc7ca31d | 128 | AliDebug(1,Form("Start DIGITS reconstruction ")); |
94c27e4f | 129 | |
2e6a5ee0 | 130 | |
131 | TBranch *brDigits=digitsTree->GetBranch("T0"); | |
e0bba6cc | 132 | AliT0digit *fDigits = new AliT0digit() ; |
dc7ca31d | 133 | if (brDigits) { |
134 | brDigits->SetAddress(&fDigits); | |
135 | }else{ | |
f16935f7 | 136 | AliError(Form("EXEC Branch T0 digits not found")); |
137 | return; | |
dc7ca31d | 138 | } |
e0bba6cc | 139 | |
c41ceaac | 140 | digitsTree->GetEvent(0); |
141 | digitsTree->GetEntry(0); | |
142 | brDigits->GetEntry(0); | |
143 | fDigits->GetTimeCFD(*timeCFD); | |
144 | fDigits->GetTimeLED(*timeLED); | |
145 | fDigits->GetQT0(*chargeQT0); | |
146 | fDigits->GetQT1(*chargeQT1); | |
446d6ec4 | 147 | Int_t onlineMean = fDigits->MeanTime(); |
c883fdf2 | 148 | |
c41ceaac | 149 | |
150 | Float_t besttimeA=999999; | |
151 | Float_t besttimeC=999999; | |
152 | Int_t pmtBestA=99999; | |
153 | Int_t pmtBestC=99999; | |
dc7ca31d | 154 | Float_t timeDiff=999999, meanTime=0; |
155 | ||
c883fdf2 | 156 | Int_t mv2MIP = fParam-> GetmV2Mip(); |
157 | ||
e0bba6cc | 158 | |
94c27e4f | 159 | AliT0RecPoint* frecpoints= new AliT0RecPoint (); |
160 | clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1); | |
161 | ||
12e9daf9 | 162 | Float_t time[24], adc[24]; |
dc7ca31d | 163 | for (Int_t ipmt=0; ipmt<24; ipmt++) { |
c41ceaac | 164 | if(timeCFD->At(ipmt)>0 ){ |
29d3e0eb | 165 | Double_t qt0 = Double_t(chargeQT0->At(ipmt)); |
166 | Double_t qt1 = Double_t(chargeQT1->At(ipmt)); | |
12e9daf9 | 167 | if((qt1-qt0)>0) adc[ipmt] = Int_t (TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000))); |
168 | ||
2e6a5ee0 | 169 | time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(qt1) , timeCFD->At(ipmt), "pdc" ) ; |
c883fdf2 | 170 | |
c41ceaac | 171 | //LED |
a7027400 | 172 | Float_t ampLED; //LED |
29d3e0eb | 173 | Double_t sl = (timeLED->At(ipmt) - time[ipmt])*channelWidth; |
a7027400 | 174 | if( adc[ipmt]/Float_t(mv2MIP) < 20) |
175 | { | |
176 | Double_t qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.); | |
177 | ampLED = qt/Float_t(mv2MIP); | |
178 | AliDebug(1,Form(" ipmt %i QTC %f ch QTC in MIP %f, time in chann %f (led-cfd) %f in MIPs %f", | |
179 | ipmt, adc[ipmt], adc[ipmt]/Float_t(mv2MIP), time[ipmt],sl,ampLED )); | |
180 | } | |
181 | else | |
182 | { AliDebug(1,Form(" amplitude %f MIPs on PMT %i, write QTC in both ", (adc[ipmt]/Float_t(mv2MIP)), ipmt)); | |
183 | ampLED=adc[ipmt]/Float_t(mv2MIP);} | |
c883fdf2 | 184 | frecpoints->SetTime(ipmt,time[ipmt]); |
185 | frecpoints->SetAmp(ipmt,adc[ipmt]/Float_t(mv2MIP)); | |
c724dd64 | 186 | frecpoints->SetAmpLED(ipmt,ampLED); |
dc7ca31d | 187 | } |
188 | else { | |
189 | time[ipmt] = 0; | |
190 | adc[ipmt] = 0; | |
191 | } | |
192 | } | |
94c27e4f | 193 | |
dc7ca31d | 194 | for (Int_t ipmt=0; ipmt<12; ipmt++){ |
195 | if(time[ipmt] > 1 ) { | |
c41ceaac | 196 | if(time[ipmt]<besttimeC){ |
197 | besttimeC=time[ipmt]; //timeC | |
198 | pmtBestC=ipmt; | |
dc7ca31d | 199 | } |
200 | } | |
201 | } | |
202 | for ( Int_t ipmt=12; ipmt<24; ipmt++){ | |
203 | if(time[ipmt] > 1) { | |
c41ceaac | 204 | if(time[ipmt]<besttimeA) { |
205 | besttimeA=time[ipmt]; //timeA | |
206 | pmtBestA=ipmt;} | |
dc7ca31d | 207 | } |
208 | } | |
c41ceaac | 209 | if(besttimeA !=999999) frecpoints->SetTimeBestA(Int_t(besttimeA)); |
210 | if( besttimeC != 999999 ) frecpoints->SetTimeBestC(Int_t(besttimeC)); | |
12e9daf9 | 211 | AliDebug(1,Form(" besttimeA %f ch, besttimeC %f ch",besttimeA, besttimeC)); |
dc7ca31d | 212 | Float_t c = 0.0299792; // cm/ps |
213 | Float_t vertex = 0; | |
c41ceaac | 214 | if(besttimeA !=999999 && besttimeC != 999999 ){ |
12e9daf9 | 215 | timeDiff = (besttimeC - besttimeA)*channelWidth; |
446d6ec4 | 216 | meanTime = (Float_t((besttimeA + besttimeC -4000)/2) * channelWidth); |
12e9daf9 | 217 | // meanTime = (meanT0 - (besttimeA + besttimeC)/2) * channelWidth; |
f16935f7 | 218 | vertex = c*(timeDiff)/2. + (fdZonA - fdZonC)/2; //-(lenr-lenl))/2; |
dc7ca31d | 219 | frecpoints->SetVertex(vertex); |
220 | frecpoints->SetMeanTime(Int_t(meanTime)); | |
446d6ec4 | 221 | //online mean |
222 | frecpoints->SetOnlineMean(Int_t(onlineMean * channelWidth)); | |
223 | AliDebug(1,Form(" timeDiff %f ps, meanTime %f ps, vertex %f cm online mean %i ps",timeDiff, meanTime,vertex, Int_t(onlineMean * channelWidth ))); | |
dc7ca31d | 224 | |
225 | } | |
446d6ec4 | 226 | |
94c27e4f | 227 | //time in each channel as time[ipmt]-MeanTimeinThisChannel(with vertex=0) |
446d6ec4 | 228 | /* |
94c27e4f | 229 | for (Int_t ipmt=0; ipmt<24; ipmt++) { |
230 | if(time[ipmt]>1) { | |
446d6ec4 | 231 | // time[ipmt] = (time[ipmt] - fTime0vertex[ipmt])*channelWidth; |
12e9daf9 | 232 | time[ipmt] =Int_t ( Float_t(time[ipmt]) * channelWidth); |
94c27e4f | 233 | frecpoints->SetTime(ipmt,time[ipmt]); |
234 | } | |
235 | } | |
446d6ec4 | 236 | */ |
dc7ca31d | 237 | clustersTree->Fill(); |
bd375212 | 238 | |
239 | delete timeCFD; | |
240 | delete timeLED; | |
241 | delete chargeQT0; | |
242 | delete chargeQT1; | |
dc7ca31d | 243 | } |
244 | ||
245 | ||
c41ceaac | 246 | //_______________________________________________________________________ |
247 | ||
248 | void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) const | |
249 | { | |
94c27e4f | 250 | // T0 raw -> |
251 | // T0RecPoint writing | |
252 | ||
253 | //Q->T-> coefficients !!!! should be measured!!! | |
e8ed1cd0 | 254 | Int_t allData[110][5]; |
2e6a5ee0 | 255 | |
e8ed1cd0 | 256 | Int_t timeCFD[24], timeLED[24], chargeQT0[24], chargeQT1[24]; |
aaa0a98f | 257 | TString option = GetOption(); |
2e6a5ee0 | 258 | AliDebug(10,Form("Option: %s\n", option.Data())); |
259 | ||
260 | for (Int_t i0=0; i0<105; i0++) | |
261 | { | |
262 | for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0; | |
263 | } | |
264 | ||
12e9daf9 | 265 | Float_t besttimeA=9999999; |
266 | Float_t besttimeC=9999999; | |
2e6a5ee0 | 267 | Int_t pmtBestA=99999; |
268 | Int_t pmtBestC=99999; | |
12e9daf9 | 269 | Float_t timeDiff=9999999, meanTime=0; |
2e6a5ee0 | 270 | Double_t qt=0; |
c883fdf2 | 271 | Int_t mv2MIP = fParam-> GetmV2Mip(); |
272 | ||
2e6a5ee0 | 273 | AliT0RecPoint* frecpoints= new AliT0RecPoint (); |
274 | ||
275 | recTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1); | |
276 | ||
277 | ||
278 | AliDebug(10," before read data "); | |
279 | AliT0RawReader myrawreader(rawReader); | |
280 | if (!myrawreader.Next()) | |
281 | AliDebug(1,Form(" no raw data found!!")); | |
282 | else | |
283 | { | |
284 | for (Int_t i=0; i<105; i++) { | |
285 | for (Int_t iHit=0; iHit<5; iHit++) | |
286 | { | |
287 | allData[i][iHit] = myrawreader.GetData(i,iHit); | |
288 | } | |
289 | } | |
290 | ||
291 | Float_t channelWidth = fParam->GetChannelWidth() ; | |
292 | ||
12e9daf9 | 293 | // Int_t meanT0 = fParam->GetMeanT0(); |
2e6a5ee0 | 294 | if(option == "pdc"){ |
295 | for (Int_t in=0; in<24; in++) | |
296 | { | |
297 | ||
298 | timeLED[in] = allData[in+1][0] ; | |
299 | timeCFD[in] = allData[in+25][0] ; | |
300 | chargeQT1[in] = allData[in+57][0] ; | |
a7027400 | 301 | chargeQT0[in] = allData[in+81][0] ; |
2e6a5ee0 | 302 | } |
303 | } | |
304 | ||
305 | if(option == "cosmic") { | |
306 | for (Int_t in=0; in<12; in++) | |
307 | { | |
308 | timeCFD[in] = allData[in+1][0] ; | |
309 | timeCFD[in+12] = allData[in+56+1][0] ; | |
310 | timeLED[in] = allData[in+12+1][0] ; | |
311 | timeLED[in+12] = allData[in+68+1][0] ; | |
312 | } | |
313 | ||
c883fdf2 | 314 | for (Int_t in=0; in<12; in++) |
2e6a5ee0 | 315 | { |
c883fdf2 | 316 | chargeQT1[in]=allData[2*in+25][0]; |
317 | chargeQT0[in]=allData[2*in+26][0]; | |
2e6a5ee0 | 318 | } |
c883fdf2 | 319 | |
320 | for (Int_t in=12; in<24; in++) | |
2e6a5ee0 | 321 | { |
c883fdf2 | 322 | chargeQT1[in]=allData[2*in+57][0]; |
323 | chargeQT0[in]=allData[2*in+58][0]; | |
2e6a5ee0 | 324 | } |
325 | ||
326 | } | |
327 | for (Int_t in=0; in<24; in++) | |
c883fdf2 | 328 | AliDebug(10, Form(" readed Raw %i %i %i %i %i", |
329 | in, timeLED[in],timeCFD[in],chargeQT0[in],chargeQT1[in])); | |
446d6ec4 | 330 | Int_t onlineMean = allData[49][0]; |
2e6a5ee0 | 331 | |
12e9daf9 | 332 | Float_t time[24], adc[24]; |
2e6a5ee0 | 333 | for (Int_t ipmt=0; ipmt<24; ipmt++) { |
334 | if(timeCFD[ipmt]>0 && timeLED[ipmt]>0){ | |
335 | ||
336 | if(option == "pdc"){ | |
337 | Double_t qt0 = Double_t(chargeQT0[ipmt]); | |
338 | Double_t qt1 = Double_t(chargeQT1[ipmt]); | |
29ed1d0e | 339 | if((qt1-qt0)>0) adc[ipmt] = Int_t(TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000.))); |
2e6a5ee0 | 340 | time[ipmt] = fCalib-> WalkCorrection( ipmt,Int_t(qt1) , timeCFD[ipmt], "pdc" ) ; |
341 | Double_t sl = (timeLED[ipmt] - time[ipmt])*channelWidth; | |
a7027400 | 342 | printf(" amplitude %f %f\n",adc[ipmt]/Float_t(mv2MIP), sl); |
343 | //pp collison | |
344 | if( adc[ipmt]/Float_t(mv2MIP) < 20) | |
345 | { | |
346 | if(fAmpLEDrec.At(ipmt)) | |
347 | qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.); | |
348 | } | |
349 | else //PbPb | |
350 | { AliDebug(1,Form(" amplitude %f MIPs on PMT %i, write QTC in both ", (adc[ipmt]/Float_t(mv2MIP)), ipmt)); | |
351 | qt=adc[ipmt]/Float_t(mv2MIP);} | |
352 | ||
c883fdf2 | 353 | frecpoints->SetTime(ipmt,time[ipmt]); |
354 | frecpoints->SetAmp(ipmt,adc[ipmt]/Float_t(mv2MIP)); | |
355 | frecpoints->SetAmpLED(ipmt,qt/Float_t(mv2MIP)); | |
446d6ec4 | 356 | AliDebug(10,Form(" QTC %f mv, time in chann %f ampLED %f",adc[ipmt] ,time[ipmt], qt)); |
c883fdf2 | 357 | AliDebug(10,Form(" Amlitude in MIPS LED %f , QTC %f \n ", adc[ipmt]/Float_t(mv2MIP),qt/Float_t(mv2MIP))); |
2e6a5ee0 | 358 | } |
359 | if(option == "cosmic") { | |
2e6a5ee0 | 360 | if(( chargeQT1[ipmt] - chargeQT0[ipmt])>0) |
361 | adc[ipmt] = chargeQT1[ipmt] - chargeQT0[ipmt]; | |
362 | else | |
363 | adc[ipmt] = 0; | |
364 | // time[ipmt] = fCalib-> WalkCorrection( ipmt, adc[ipmt], timeCFD[ipmt],"cosmic" ) ; | |
c883fdf2 | 365 | |
2e6a5ee0 | 366 | Double_t sl = timeLED[ipmt] - timeCFD[ipmt]; |
367 | time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(sl), timeCFD[ipmt],"cosmic" ) ; | |
2e6a5ee0 | 368 | time[ipmt] = time[ipmt] - allData[0][0] + 5000; |
c883fdf2 | 369 | AliDebug(10,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ", |
370 | ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl))); | |
371 | Double_t ampMip =( (TGraph*)fAmpLED.At(ipmt))->Eval(sl); | |
372 | Double_t qtMip = ((TGraph*)fQTC.At(ipmt))->Eval(adc[ipmt]); | |
373 | AliDebug(10,Form(" Amlitude in MIPS LED %f , QTC %f \n ",ampMip,qtMip)); | |
374 | ||
2e6a5ee0 | 375 | frecpoints->SetTime(ipmt, Float_t(time[ipmt]) ); |
c883fdf2 | 376 | frecpoints->SetAmp(ipmt, Float_t( ampMip)); //for cosmic &pp beam |
377 | frecpoints->SetAmpLED(ipmt, Float_t(qtMip)); | |
378 | ||
379 | ||
2e6a5ee0 | 380 | } |
381 | ||
382 | } | |
383 | else { | |
384 | time[ipmt] = 0; | |
385 | adc[ipmt] = 0; | |
386 | } | |
387 | } | |
388 | ||
389 | for (Int_t ipmt=0; ipmt<12; ipmt++){ | |
390 | if(time[ipmt] > 1 ) { | |
391 | if(time[ipmt]<besttimeC){ | |
392 | besttimeC=time[ipmt]; //timeC | |
393 | pmtBestC=ipmt; | |
394 | } | |
395 | } | |
396 | } | |
397 | for ( Int_t ipmt=12; ipmt<24; ipmt++){ | |
398 | if(time[ipmt] > 1) { | |
399 | if(time[ipmt]<besttimeA) { | |
400 | besttimeA=time[ipmt]; //timeA | |
401 | pmtBestA=ipmt;} | |
402 | } | |
403 | } | |
404 | if(besttimeA !=9999999) frecpoints->SetTimeBestA(Int_t(besttimeA)); | |
405 | if( besttimeC != 9999999 ) frecpoints->SetTimeBestC(Int_t(besttimeC)); | |
12e9daf9 | 406 | AliDebug(1,Form(" besttimeA %f ps, besttimeC %f ps",besttimeA, besttimeC)); |
2e6a5ee0 | 407 | Float_t c = 0.0299792; // cm/ps |
408 | Float_t vertex = 99999; | |
409 | if(besttimeA <9999999 && besttimeC < 9999999 ){ | |
12e9daf9 | 410 | timeDiff = ( besttimeC - besttimeA) *channelWidth; |
446d6ec4 | 411 | if(option == "pdc"){ |
412 | // meanTime = (besttimeA + besttimeC)/2 * channelWidth; | |
413 | meanTime = (besttimeA + besttimeC-4000.)/2 * channelWidth; | |
414 | onlineMean = Int_t (onlineMean * channelWidth); | |
415 | } | |
416 | if(option == "cosmic") { | |
12e9daf9 | 417 | meanTime = Float_t((besttimeA + besttimeC)/2); |
446d6ec4 | 418 | onlineMean = onlineMean -allData[0][0];; |
419 | } | |
12e9daf9 | 420 | vertex = c*(timeDiff)/2.+ (fdZonA - fdZonC)/2; |
2e6a5ee0 | 421 | frecpoints->SetVertex(vertex); |
422 | frecpoints->SetMeanTime(Int_t(meanTime)); | |
446d6ec4 | 423 | AliDebug(1,Form(" timeDiff %f ps, meanTime %f ps, vertex %f cm online mean %i ",timeDiff, meanTime,vertex, onlineMean)); |
2e6a5ee0 | 424 | |
425 | } | |
426 | } // if (else )raw data | |
427 | recTree->Fill(); | |
428 | if(frecpoints) delete frecpoints; | |
c41ceaac | 429 | } |
430 | //____________________________________________________________ | |
431 | ||
d76c31f4 | 432 | void AliT0Reconstructor::FillESD(TTree */*digitsTree*/, TTree *clustersTree, AliESDEvent *pESD) const |
dc7ca31d | 433 | { |
434 | ||
435 | /*************************************************** | |
436 | Resonstruct digits to vertex position | |
437 | ****************************************************/ | |
438 | ||
dc7ca31d | 439 | AliDebug(1,Form("Start FillESD T0")); |
440 | ||
d76c31f4 | 441 | TTree *treeR = clustersTree; |
dc7ca31d | 442 | |
443 | AliT0RecPoint* frecpoints= new AliT0RecPoint (); | |
444 | if (!frecpoints) { | |
445 | AliError("Reconstruct Fill ESD >> no recpoints found"); | |
446 | return; | |
447 | } | |
448 | ||
449 | AliDebug(1,Form("Start FillESD T0")); | |
450 | TBranch *brRec = treeR->GetBranch("T0"); | |
451 | if (brRec) { | |
452 | brRec->SetAddress(&frecpoints); | |
453 | }else{ | |
f16935f7 | 454 | AliError(Form("EXEC Branch T0 rec not found")); |
dc7ca31d | 455 | return; |
456 | } | |
457 | ||
458 | brRec->GetEntry(0); | |
f16935f7 | 459 | Float_t amp[24], time[24]; |
460 | Float_t zPosition = frecpoints -> GetVertex(); | |
461 | Float_t timeStart = frecpoints -> GetMeanTime() ; | |
462 | for ( Int_t i=0; i<24; i++) { | |
94c27e4f | 463 | time[i] = Float_t (frecpoints -> GetTime(i)); // ps to ns |
dc7ca31d | 464 | amp[i] = frecpoints -> GetAmp(i); |
465 | } | |
f16935f7 | 466 | pESD->SetT0zVertex(zPosition); //vertex Z position |
dc7ca31d | 467 | pESD->SetT0(timeStart); // interaction time |
468 | pESD->SetT0time(time); // best TOF on each PMT | |
469 | pESD->SetT0amplitude(amp); // number of particles(MIPs) on each PMT | |
5325480c | 470 | |
f16935f7 | 471 | AliDebug(1,Form(" Z position %f cm, T0 %f ps",zPosition , timeStart)); |
dc7ca31d | 472 | |
dc7ca31d | 473 | } // vertex in 3 sigma |
474 | ||
475 | ||
476 | ||
477 | ||
478 | ||
479 |