]>
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 | ||
74adb36a | 53 | fParam = AliT0Parameters::Instance(); |
54 | fParam->Init(); | |
c883fdf2 | 55 | |
74adb36a | 56 | for (Int_t i=0; i<24; i++){ |
2e6a5ee0 | 57 | TGraph* gr = fParam ->GetAmpLEDRec(i); |
29ed1d0e | 58 | if (gr) fAmpLEDrec.AddAtAndExpand(gr,i) ; |
c883fdf2 | 59 | TGraph* gr1 = fParam ->GetAmpLED(i); |
60 | if (gr1) fAmpLED.AddAtAndExpand(gr1,i) ; | |
61 | TGraph* gr2 = fParam ->GetQTC(i); | |
539b9cb9 | 62 | if (gr2) fQTC.AddAtAndExpand(gr2,i) ; |
c883fdf2 | 63 | } |
539b9cb9 | 64 | |
29ed1d0e | 65 | |
adf36b9d | 66 | // fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1")); |
67 | //fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15")); | |
68 | ||
539b9cb9 | 69 | |
12e9daf9 | 70 | fCalib = new AliT0Calibrator(); |
71 | ||
dc7ca31d | 72 | } |
c41ceaac | 73 | |
74 | //_____________________________________________________________________________ | |
dc7ca31d | 75 | void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const |
94c27e4f | 76 | |
dc7ca31d | 77 | { |
94c27e4f | 78 | // T0 digits reconstruction |
c555f418 | 79 | Int_t refAmp = GetRecoParam()->GetRefAmp(); |
776de217 | 80 | |
c41ceaac | 81 | TArrayI * timeCFD = new TArrayI(24); |
82 | TArrayI * timeLED = new TArrayI(24); | |
83 | TArrayI * chargeQT0 = new TArrayI(24); | |
84 | TArrayI * chargeQT1 = new TArrayI(24); | |
74adb36a | 85 | |
d0bcd1fb | 86 | |
8955c6b4 | 87 | Float_t channelWidth = fParam->GetChannelWidth() ; |
b95e8d87 | 88 | Float_t meanVertex = fParam->GetMeanVertex(); |
776de217 | 89 | Float_t c = 0.0299792; // cm/ps |
adf36b9d | 90 | Double32_t vertex = 9999999; |
91 | Double32_t timeDiff=999999, meanTime=999999, timeclock=999999; | |
776de217 | 92 | |
94c27e4f | 93 | |
dc7ca31d | 94 | AliDebug(1,Form("Start DIGITS reconstruction ")); |
94c27e4f | 95 | |
2e6a5ee0 | 96 | |
d0bcd1fb | 97 | TBranch *brDigits=digitsTree->GetBranch("T0"); |
e0bba6cc | 98 | AliT0digit *fDigits = new AliT0digit() ; |
dc7ca31d | 99 | if (brDigits) { |
100 | brDigits->SetAddress(&fDigits); | |
101 | }else{ | |
f16935f7 | 102 | AliError(Form("EXEC Branch T0 digits not found")); |
103 | return; | |
dc7ca31d | 104 | } |
e0bba6cc | 105 | |
c41ceaac | 106 | digitsTree->GetEvent(0); |
107 | digitsTree->GetEntry(0); | |
108 | brDigits->GetEntry(0); | |
109 | fDigits->GetTimeCFD(*timeCFD); | |
110 | fDigits->GetTimeLED(*timeLED); | |
111 | fDigits->GetQT0(*chargeQT0); | |
112 | fDigits->GetQT1(*chargeQT1); | |
446d6ec4 | 113 | Int_t onlineMean = fDigits->MeanTime(); |
c883fdf2 | 114 | |
adf36b9d | 115 | Bool_t tr[5]; |
116 | for (Int_t i=0; i<5; i++) tr[i]=false; | |
c41ceaac | 117 | |
adf36b9d | 118 | Double32_t besttimeA=999999; |
119 | Double32_t besttimeC=999999; | |
c41ceaac | 120 | Int_t pmtBestA=99999; |
121 | Int_t pmtBestC=99999; | |
dc7ca31d | 122 | |
94c27e4f | 123 | AliT0RecPoint* frecpoints= new AliT0RecPoint (); |
124 | clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1); | |
125 | ||
b95e8d87 | 126 | Float_t time[24], adc[24]; |
dc7ca31d | 127 | for (Int_t ipmt=0; ipmt<24; ipmt++) { |
c41ceaac | 128 | if(timeCFD->At(ipmt)>0 ){ |
d0bcd1fb | 129 | if(( chargeQT1->At(ipmt) - chargeQT0->At(ipmt))>0) |
130 | adc[ipmt] = chargeQT1->At(ipmt) - chargeQT0->At(ipmt); | |
a7027400 | 131 | else |
d0bcd1fb | 132 | adc[ipmt] = 0; |
133 | ||
541b42c4 | 134 | // time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD->At(ipmt)) ; |
d0bcd1fb | 135 | |
136 | Double_t sl = Double_t(timeLED->At(ipmt) - timeCFD->At(ipmt)); | |
541b42c4 | 137 | time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD->At(ipmt) ) ; |
d0bcd1fb | 138 | AliDebug(10,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ", |
139 | ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl))); | |
776de217 | 140 | |
d0bcd1fb | 141 | Double_t ampMip =((TGraph*)fAmpLED.At(ipmt))->Eval(sl); |
142 | Double_t qtMip = ((TGraph*)fQTC.At(ipmt))->Eval(adc[ipmt]); | |
143 | AliDebug(10,Form(" Amlitude in MIPS LED %f , QTC %f in channels %i\n ",ampMip,qtMip, adc[ipmt])); | |
144 | ||
145 | frecpoints->SetTime(ipmt, Float_t(time[ipmt]) ); | |
146 | frecpoints->SetAmp(ipmt, Float_t( ampMip)); //for cosmic &pp beam | |
147 | frecpoints->SetAmpLED(ipmt, Float_t(qtMip)); | |
148 | ||
dc7ca31d | 149 | } |
150 | else { | |
151 | time[ipmt] = 0; | |
152 | adc[ipmt] = 0; | |
153 | } | |
154 | } | |
94c27e4f | 155 | |
dc7ca31d | 156 | for (Int_t ipmt=0; ipmt<12; ipmt++){ |
157 | if(time[ipmt] > 1 ) { | |
c41ceaac | 158 | if(time[ipmt]<besttimeC){ |
159 | besttimeC=time[ipmt]; //timeC | |
160 | pmtBestC=ipmt; | |
dc7ca31d | 161 | } |
162 | } | |
163 | } | |
164 | for ( Int_t ipmt=12; ipmt<24; ipmt++){ | |
165 | if(time[ipmt] > 1) { | |
c41ceaac | 166 | if(time[ipmt]<besttimeA) { |
167 | besttimeA=time[ipmt]; //timeA | |
168 | pmtBestA=ipmt;} | |
dc7ca31d | 169 | } |
170 | } | |
adf36b9d | 171 | if(besttimeA < 999999) { |
172 | frecpoints->SetTimeBestA(Int_t(besttimeA *channelWidth)); | |
173 | tr[1]=true; | |
174 | } | |
175 | if( besttimeC < 999999 ) { | |
176 | frecpoints->SetTimeBestC(Int_t(besttimeC *channelWidth)); | |
177 | tr[2]=true; | |
178 | } | |
d0bcd1fb | 179 | AliDebug(10,Form(" besttimeA %f ch, besttimeC %f ch",besttimeA, besttimeC)); |
adf36b9d | 180 | if(besttimeA <999999 && besttimeC < 999999 ){ |
9b83615d | 181 | // timeDiff = (besttimeC - besttimeA)*channelWidth; |
182 | timeDiff = (besttimeA - besttimeC)*channelWidth; | |
adf36b9d | 183 | meanTime = (besttimeA + besttimeC)/2;// * channelWidth); |
184 | timeclock = meanTime *channelWidth ; | |
185 | vertex = meanVertex - c*(timeDiff)/2.;// + (fdZonA - fdZonC)/2; | |
186 | tr[0]=true; | |
187 | } | |
188 | frecpoints->SetVertex(vertex); | |
189 | frecpoints->SetMeanTime(meanTime); | |
190 | frecpoints->SetT0clock(timeclock); | |
191 | frecpoints->SetT0Trig(tr); | |
192 | ||
193 | for (Int_t i=0; i<5; i++) { | |
194 | printf(" T0 trigers %i ",tr[i]); | |
195 | } | |
196 | printf(" \n "); | |
197 | ||
198 | //online mean | |
199 | frecpoints->SetOnlineMean(Int_t(onlineMean)); | |
200 | AliDebug(10,Form(" timeDiff %i #channel, meanTime %i #channel, vertex %f cm online mean %i timeclock %i ps",timeDiff, meanTime,vertex, Int_t(onlineMean), timeclock)); | |
201 | ||
202 | ||
203 | ||
204 | ||
b95e8d87 | 205 | |
dc7ca31d | 206 | clustersTree->Fill(); |
bd375212 | 207 | |
208 | delete timeCFD; | |
209 | delete timeLED; | |
210 | delete chargeQT0; | |
211 | delete chargeQT1; | |
dc7ca31d | 212 | } |
213 | ||
214 | ||
c41ceaac | 215 | //_______________________________________________________________________ |
216 | ||
217 | void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) const | |
218 | { | |
94c27e4f | 219 | // T0 raw -> |
539b9cb9 | 220 | // |
221 | // reference amplitude and time ref. point from reco param | |
222 | ||
c555f418 | 223 | Int_t refAmp = GetRecoParam()->GetRefAmp(); |
224 | Int_t refPoint = GetRecoParam()->GetRefPoint(); | |
adf36b9d | 225 | Float_t latencyL1 = GetRecoParam()->GetLatencyL1(); |
e9626e76 | 226 | Float_t latencyL1A = GetRecoParam()->GetLatencyL1A(); |
227 | Float_t latencyL1C = GetRecoParam()->GetLatencyL1C(); | |
adf36b9d | 228 | Float_t latencyHPTDC = GetRecoParam()->GetLatencyHPTDC(); |
229 | Float_t vertexshift = GetRecoParam()->GetVertexShift(); | |
e9626e76 | 230 | AliDebug(10,Form(" LatencyL1 %f latencyL1A %f latencyL1C %f latencyHPTDC %f \n",latencyL1,latencyL1A,latencyL1C, latencyHPTDC)); |
e8ed1cd0 | 231 | Int_t allData[110][5]; |
2e6a5ee0 | 232 | |
e8ed1cd0 | 233 | Int_t timeCFD[24], timeLED[24], chargeQT0[24], chargeQT1[24]; |
adf36b9d | 234 | Double32_t timeDiff=999999, meanTime=999999, timeclock=999999; |
235 | Float_t c = 29.9792458; // cm/ns | |
236 | Double32_t vertex = 9999999; | |
776de217 | 237 | Int_t onlineMean=0; |
adf36b9d | 238 | |
bce12dc5 | 239 | for (Int_t i0=0; i0<105; i0++) |
240 | { | |
241 | for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0; | |
242 | } | |
2e6a5ee0 | 243 | |
adf36b9d | 244 | Double32_t besttimeA=9999999; |
245 | Double32_t besttimeC=9999999; | |
bce12dc5 | 246 | Int_t pmtBestA=99999; |
247 | Int_t pmtBestC=99999; | |
e9626e76 | 248 | // Float_t meanVertex = fParam->GetMeanVertex(); |
249 | Float_t meanVertex = 0; | |
29a60970 | 250 | |
bce12dc5 | 251 | AliT0RecPoint* frecpoints= new AliT0RecPoint (); |
252 | ||
253 | recTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1); | |
2e6a5ee0 | 254 | |
bce12dc5 | 255 | AliDebug(10," before read data "); |
256 | AliT0RawReader myrawreader(rawReader); | |
776de217 | 257 | |
258 | UInt_t type =rawReader->GetType(); | |
259 | ||
bce12dc5 | 260 | if (!myrawreader.Next()) |
261 | AliDebug(1,Form(" no raw data found!!")); | |
262 | else | |
263 | { | |
776de217 | 264 | if(type == 7) { //only physics |
bce12dc5 | 265 | for (Int_t i=0; i<105; i++) { |
266 | for (Int_t iHit=0; iHit<5; iHit++) | |
267 | { | |
268 | allData[i][iHit] = myrawreader.GetData(i,iHit); | |
269 | } | |
270 | } | |
541b42c4 | 271 | Int_t ref=0; |
272 | if (refPoint>0) | |
adf36b9d | 273 | ref = allData[refPoint][0]-5000; |
541b42c4 | 274 | |
bce12dc5 | 275 | Float_t channelWidth = fParam->GetChannelWidth() ; |
276 | ||
277 | // Int_t meanT0 = fParam->GetMeanT0(); | |
d0bcd1fb | 278 | |
bce12dc5 | 279 | |
280 | for (Int_t in=0; in<12; in++) | |
281 | { | |
282 | timeCFD[in] = allData[in+1][0] ; | |
283 | timeCFD[in+12] = allData[in+56+1][0] ; | |
284 | timeLED[in] = allData[in+12+1][0] ; | |
285 | timeLED[in+12] = allData[in+68+1][0] ; | |
d0bcd1fb | 286 | AliDebug(10, Form(" readed i %i cfdC %i cfdA %i ledC %i ledA%i ", |
287 | in, timeCFD[in],timeCFD[in+12],timeLED[in], | |
288 | timeLED[in+12])); | |
bce12dc5 | 289 | } |
290 | ||
291 | for (Int_t in=0; in<12; in++) | |
292 | { | |
d0bcd1fb | 293 | chargeQT0[in]=allData[2*in+25][0]; |
294 | chargeQT1[in]=allData[2*in+26][0]; | |
bce12dc5 | 295 | } |
296 | ||
297 | for (Int_t in=12; in<24; in++) | |
298 | { | |
d0bcd1fb | 299 | chargeQT0[in]=allData[2*in+57][0]; |
300 | chargeQT1[in]=allData[2*in+58][0]; | |
bce12dc5 | 301 | } |
302 | ||
d0bcd1fb | 303 | // } //cosmic with physics event |
2e6a5ee0 | 304 | for (Int_t in=0; in<24; in++) |
c883fdf2 | 305 | AliDebug(10, Form(" readed Raw %i %i %i %i %i", |
306 | in, timeLED[in],timeCFD[in],chargeQT0[in],chargeQT1[in])); | |
776de217 | 307 | onlineMean = allData[49][0]; |
2e6a5ee0 | 308 | |
adf36b9d | 309 | Double32_t time[24], adc[24]; |
2e6a5ee0 | 310 | for (Int_t ipmt=0; ipmt<24; ipmt++) { |
311 | if(timeCFD[ipmt]>0 && timeLED[ipmt]>0){ | |
bce12dc5 | 312 | //for simulated data |
d0bcd1fb | 313 | //for physics data |
314 | if(( chargeQT1[ipmt] - chargeQT0[ipmt])>0) | |
541b42c4 | 315 | adc[ipmt] = chargeQT0[ipmt] - chargeQT1[ipmt]; |
d0bcd1fb | 316 | else |
317 | adc[ipmt] = 0; | |
bce12dc5 | 318 | |
539b9cb9 | 319 | |
40043664 | 320 | // time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD[ipmt] ) ; |
bce12dc5 | 321 | |
d0bcd1fb | 322 | Double_t sl = timeLED[ipmt] - timeCFD[ipmt]; |
40043664 | 323 | time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl), timeCFD[ipmt] ) ; |
d0bcd1fb | 324 | AliDebug(10,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ", |
325 | ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl))); | |
326 | Double_t ampMip =( (TGraph*)fAmpLED.At(ipmt))->Eval(sl); | |
327 | Double_t qtMip = ((TGraph*)fQTC.At(ipmt))->Eval(adc[ipmt]); | |
328 | AliDebug(10,Form(" Amlitude in MIPS LED %f ; QTC %f; in channels %i\n ",ampMip,qtMip, adc[ipmt])); | |
bce12dc5 | 329 | |
adf36b9d | 330 | // frecpoints->SetTime(ipmt, Float_t(time[ipmt]) ); |
331 | frecpoints->SetTime(ipmt,Double32_t(timeCFD[ipmt])); | |
332 | frecpoints->SetAmpLED(ipmt, Double32_t( qtMip)); //for cosmic &pp beam | |
333 | frecpoints->SetAmp(ipmt, Double32_t(ampMip)); | |
bce12dc5 | 334 | |
2e6a5ee0 | 335 | } |
336 | else { | |
337 | time[ipmt] = 0; | |
338 | adc[ipmt] = 0; | |
339 | } | |
340 | } | |
341 | ||
342 | for (Int_t ipmt=0; ipmt<12; ipmt++){ | |
343 | if(time[ipmt] > 1 ) { | |
344 | if(time[ipmt]<besttimeC){ | |
345 | besttimeC=time[ipmt]; //timeC | |
346 | pmtBestC=ipmt; | |
347 | } | |
348 | } | |
349 | } | |
350 | for ( Int_t ipmt=12; ipmt<24; ipmt++){ | |
351 | if(time[ipmt] > 1) { | |
352 | if(time[ipmt]<besttimeA) { | |
353 | besttimeA=time[ipmt]; //timeA | |
354 | pmtBestA=ipmt;} | |
355 | } | |
356 | } | |
adf36b9d | 357 | if(besttimeA < 999999) |
e9626e76 | 358 | frecpoints->SetTimeBestA(0.001* besttimeA * channelWidth - latencyHPTDC + latencyL1A); |
adf36b9d | 359 | if( besttimeC < 999999 ) |
e9626e76 | 360 | frecpoints->SetTimeBestC( 0.001 *besttimeC * channelWidth - latencyHPTDC + latencyL1C); |
adf36b9d | 361 | AliDebug(10,Form(" pmtA %i besttimeA %f ps, pmtC %i besttimeC %f ps", |
d0bcd1fb | 362 | pmtBestA,besttimeA, pmtBestC, besttimeC)); |
adf36b9d | 363 | if(besttimeA <999999 && besttimeC < 999999 ){ |
364 | timeDiff = ( besttimeA - besttimeC) *0.001 * channelWidth; | |
e9626e76 | 365 | timeclock = 0.001*channelWidth * Float_t( besttimeA+besttimeC)/2. - latencyHPTDC + latencyL1; |
adf36b9d | 366 | meanTime = (besttimeA+besttimeC-2.*Float_t(ref))/2.; |
367 | vertex = meanVertex - c*(timeDiff)/2. + vertexshift; //+ (fdZonA - fdZonC)/2; | |
368 | } | |
776de217 | 369 | } //if phys event |
adf36b9d | 370 | AliDebug(5,Form(" timeDiff %f #channel, meanTime %f #channel, TOFmean%f vertex %f cm meanVertex %f online mean %i \n",timeDiff, meanTime,timeclock, vertex,meanVertex, onlineMean)); |
776de217 | 371 | frecpoints->SetT0clock(timeclock); |
372 | frecpoints->SetVertex(vertex); | |
adf36b9d | 373 | frecpoints->SetMeanTime(meanTime); |
776de217 | 374 | frecpoints->SetOnlineMean(Int_t(onlineMean)); |
adf36b9d | 375 | // Set triggers |
376 | ||
377 | Bool_t tr[5]; | |
378 | Int_t trchan[5]= {50,51,52,55,56}; | |
379 | for (Int_t i=0; i<5; i++) tr[i]=false; | |
380 | for (Int_t itr=0; itr<5; itr++) { | |
381 | if(allData[trchan[itr]][0]>0) tr[itr]=true; | |
382 | frecpoints->SetT0Trig(tr); | |
383 | } | |
384 | for (Int_t i=0; i<5; i++) | |
385 | printf(" T0 trigers %i ",tr[i]); | |
386 | printf(" \n "); | |
387 | ||
388 | ||
389 | } // if (else )raw data | |
390 | recTree->Fill(); | |
391 | if(frecpoints) delete frecpoints; | |
392 | } | |
393 | ||
394 | ||
395 | //____________________________________________________________ | |
396 | ||
397 | void AliT0Reconstructor::FillESD(TTree */*digitsTree*/, TTree *clustersTree, AliESDEvent *pESD) const | |
398 | { | |
dc7ca31d | 399 | |
400 | /*************************************************** | |
401 | Resonstruct digits to vertex position | |
402 | ****************************************************/ | |
403 | ||
dc7ca31d | 404 | AliDebug(1,Form("Start FillESD T0")); |
0d96e32b | 405 | |
adf36b9d | 406 | Float_t c = 29.9792458; // cm/ns |
407 | Float_t currentVertex=0, shift=0; | |
408 | Int_t ncont=0; | |
409 | const AliESDVertex* vertex = pESD->GetPrimaryVertex(); | |
410 | if (!vertex) vertex = pESD->GetPrimaryVertexSPD(); | |
411 | if (!vertex) vertex = pESD->GetPrimaryVertexTPC(); | |
412 | if (!vertex) vertex = pESD->GetVertex(); | |
413 | ||
414 | if (vertex) { | |
415 | AliDebug(2, Form("Got %s (%s) from ESD: %f", | |
416 | vertex->GetName(), vertex->GetTitle(), vertex->GetZ())); | |
417 | currentVertex = vertex->GetZ(); | |
418 | ||
419 | ncont = vertex->GetNContributors(); | |
420 | // cout<<" spdver "<<spdver<<" ncont "<<ncont<<endl; | |
421 | if(ncont>3 ) { | |
422 | // hVertexSPD->Fill(spdver); | |
423 | shift = currentVertex/c; | |
424 | // cout<<" vertex shif "<<shift<<" vertex "<<spdver<<" IsFromVertexer3D "<<fverSPD->IsFromVertexer3D()<<endl; | |
425 | } | |
426 | } | |
d76c31f4 | 427 | TTree *treeR = clustersTree; |
dc7ca31d | 428 | |
429 | AliT0RecPoint* frecpoints= new AliT0RecPoint (); | |
430 | if (!frecpoints) { | |
431 | AliError("Reconstruct Fill ESD >> no recpoints found"); | |
432 | return; | |
433 | } | |
434 | ||
435 | AliDebug(1,Form("Start FillESD T0")); | |
436 | TBranch *brRec = treeR->GetBranch("T0"); | |
437 | if (brRec) { | |
438 | brRec->SetAddress(&frecpoints); | |
439 | }else{ | |
f16935f7 | 440 | AliError(Form("EXEC Branch T0 rec not found")); |
dc7ca31d | 441 | return; |
442 | } | |
443 | ||
444 | brRec->GetEntry(0); | |
adf36b9d | 445 | Double32_t amp[24], time[24]; |
446 | Double32_t timeClock[3]; | |
447 | Double32_t zPosition = frecpoints -> GetVertex(); | |
448 | Double32_t timeStart = frecpoints -> GetMeanTime(); | |
449 | timeClock[0] = frecpoints -> GetT0clock() ; | |
450 | timeClock[1] = frecpoints -> GetBestTimeA() + shift; | |
451 | timeClock[2] = frecpoints -> GetBestTimeC() - shift; | |
452 | for ( Int_t i=0; i<24; i++) { | |
453 | time[i] = frecpoints -> GetTime(i); // ps to ns | |
dc7ca31d | 454 | amp[i] = frecpoints -> GetAmp(i); |
455 | } | |
adf36b9d | 456 | Int_t trig= frecpoints ->GetT0Trig(); |
457 | pESD->SetT0Trig(trig); | |
458 | ||
f16935f7 | 459 | pESD->SetT0zVertex(zPosition); //vertex Z position |
dc7ca31d | 460 | pESD->SetT0(timeStart); // interaction time |
adf36b9d | 461 | for(Int_t i=0; i<3; i++) |
462 | pESD->SetT0TOF(i,timeClock[i]); // interaction time (ns) | |
dc7ca31d | 463 | pESD->SetT0time(time); // best TOF on each PMT |
464 | pESD->SetT0amplitude(amp); // number of particles(MIPs) on each PMT | |
adf36b9d | 465 | |
466 | AliDebug(1,Form("T0: Vertex %f (T0A+T0C)/2 %f #channels T0signal %f ns OrA %f ns OrC %f T0trig %i\n",zPosition, timeStart, timeClock[0], timeClock[1], timeClock[2], trig)); | |
467 | ||
468 | ||
dc7ca31d | 469 | } // vertex in 3 sigma |
470 | ||
471 | ||
472 | ||
473 | ||
474 | ||
475 |