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 **************************************************************************/
20 // 1. The laser track is associated with the mirror
21 // see function FindMirror
23 // 2. The laser track is accepted for the analysis under certain condition
24 // (see function Accpet laser)
26 // 3. The drift velocity and jitter is calculated event by event
27 // (see function drift velocity)
29 // 4. The tracks are refitted at different sectors
33 // 4.c) parabola with common P2 for inner and outer
35 // To make laser scan the user interaction neccessary
38 gSystem->Load("libANALYSIS");
39 gSystem->Load("libTPCcalib");
40 TFile fcalib("CalibObjectsTrain2.root");
41 AliTPCcalibLaser * laser = ( AliTPCcalibLaser *)fcalib->Get("laserTPC");
42 laser->DumpMeanInfo(-0,0)
43 TFile fmean("laserMean.root")
45 // laser track clasification;
47 TCut cutT("cutT","abs(Tr.fP[3])<0.06");
48 TCut cutN("cutN","fTPCncls>70");
49 TCut cutP("cutP","abs(atan2(x1,x0)-atan2(lx1,lx0))<0.03")
50 TCut cutA = cutT+cutPt+cutP;
51 TChain * chainTrL = tool.MakeChain("laser.txt","Track",0,10200);
58 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
59 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
60 AliXRDPROOFtoolkit tool;
61 TChain * chain = tool.MakeChain("laserScan.txt","Mean",0,10200);
63 AliTPCcalibLaser::DumpScanInfo(chain)
64 TFile fscan("laserScan.root")
65 TTree * treeT = (TTree*)fscan.Get("Mean")
69 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
70 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
71 AliXRDPROOFtoolkit tool;
72 TChain * chainDrift = tool.MakeChainRandom("laser.txt","driftv",0,50);
74 TChain * chainDriftN = tool.MakeChainRandom("laser.txt","driftvN",0,50);
75 chainDriftN->Lookup();
79 TChain * chain = tool.MakeChain("laser.txt","Residuals",0,10200);
81 TChain * chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
83 TChain * chainTrack = tool.MakeChainRandom("laser.txt","Track",0,30);
90 #include "TLinearFitter.h"
91 #include "AliTPCcalibLaser.h"
92 #include "AliExternalTrackParam.h"
93 #include "AliESDEvent.h"
94 #include "AliESDfriend.h"
95 #include "AliESDtrack.h"
96 #include "AliTPCTracklet.h"
100 #include "TVectorD.h"
101 #include "TTreeStream.h"
104 #include "TGraphErrors.h"
105 #include "AliTPCclusterMI.h"
106 #include "AliTPCseed.h"
107 #include "AliTracker.h"
109 #include "TClonesArray.h"
115 #include "TStatToolkit.h"
119 #include "TTreeStream.h"
122 #include "AliTPCLaserTrack.h"
123 #include "AliTPCcalibDB.h"
124 #include "AliTPCParam.h"
125 #include "AliTPCParamSR.h"
126 #include "TTimeStamp.h"
127 #include "AliDCSSensorArray.h"
128 #include "AliDCSSensor.h"
132 ClassImp(AliTPCcalibLaser)
134 AliTPCcalibLaser::AliTPCcalibLaser():
141 fTracksEsdParam(336),
151 fHisLaser(0), // N dim histogram of laser
152 fHisNclIn(0), //->Number of clusters inner
153 fHisNclOut(0), //->Number of clusters outer
154 fHisNclIO(0), //->Number of cluster inner outer
155 fHisLclIn(0), //->Level arm inner
156 fHisLclOut(0), //->Level arm outer
157 fHisLclIO(0), //->Number of cluster inner outer
158 fHisdEdx(0), //->dEdx histo
159 fHisdZfit(0), //->distance to the mirror after linear fit
162 fHisChi2YIn1(0), //->chi2 y inner - line
163 fHisChi2YOut1(0), //->chi2 y inner - line
164 fHisChi2YIn2(0), //->chi2 y inner - parabola
165 fHisChi2YOut2(0), //->chi2 y inner - parabola
166 fHisChi2YIO1(0), //->chi2 y IO - common
167 fHisChi2ZIn1(0), //->chi2 z inner - line
168 fHisChi2ZOut1(0), //->chi2 z inner - line
169 fHisChi2ZIn2(0), //->chi2 z inner - parabola
170 fHisChi2ZOut2(0), //->chi2 z inner - parabola
171 fHisChi2ZIO1(0), //->chi2 z IO - common
174 fHisPy1vP0(0), //-> delta y P0outer-P0inner - line
175 fHisPy2vP0(0), //-> delta y P0outer-P0inner - parabola
176 fHisPy3vP0(0), //-> delta y P0outer-P0inner - common parabola
177 fHisPy1vP1(0), //-> delta ky P1outer-P1inner - line
178 fHisPy2vP1(0), //-> delta ky P1outer-P1inner - parabola
179 fHisPy3vP1(0), //-> delta ky P1outer-P1inner - common parabola
180 fHisPy2vP2In(0), //-> Curv P2inner - parabola
181 fHisPy2vP2Out(0), //-> Curv P2outer - parabola
182 fHisPy3vP2IO(0), //-> Curv P2outerinner - common parabola
185 fHisPz1vP0(0), //-> delta z P0outer-P0inner - line
186 fHisPz2vP0(0), //-> delta z P0outer-P0inner - parabola
187 fHisPz3vP0(0), //-> delta z P0outer-P0inner - common parabola
188 fHisPz1vP1(0), //-> delta kz P1outer-P1inner - line
189 fHisPz2vP1(0), //-> delta kz P1outer-P1inner - parabola
190 fHisPz3vP1(0), //-> delta kz P1outer-P1inner - common parabola
191 fHisPz2vP2In(0), //-> Curv P2inner - parabola
192 fHisPz2vP2Out(0), //-> Curv P2outer - parabola
193 fHisPz3vP2IO(0), //-> Curv P2outerinner - common parabola
195 fDeltaYres(336), //->2D histo of residuals
196 fDeltaZres(336), //->2D histo fo residuals
197 fDeltaYres2(336), //->2D histo of residuals
198 fDeltaZres2(336), //->2D histo fo residuals
199 fDeltaYresAbs(336), //->2D histo of residuals
200 fDeltaZresAbs(336), //->2D histo of residuals
201 //fDeltaYres3(336), //->2D histo of residuals
202 //fDeltaZres3(336), //->2D histo fo residuals
203 fFitAside(new TVectorD(5)),
204 fFitCside(new TVectorD(5)),
205 fFitACside(new TVectorD(6)),
210 fBeamSectorOuter(336),
211 fBeamSectorInner(336),
212 fBeamOffsetYOuter(336),
213 fBeamSlopeYOuter(336),
214 fBeamOffsetYInner(336),
215 fBeamSlopeYInner(336),
216 fBeamOffsetZOuter(336),
217 fBeamSlopeZOuter(336),
218 fBeamOffsetZInner(336),
219 fBeamSlopeZInner(336),
220 fInverseSlopeZ(kTRUE)
225 fTracksEsdParam.SetOwner(kTRUE);
228 AliTPCcalibLaser::AliTPCcalibLaser(const Text_t *name, const Text_t *title, Bool_t full):
235 fTracksEsdParam(336),
239 fDeltaZ(336), // array of histograms of delta z for each track
240 fDeltaP3(336), // array of histograms of delta z for each track
241 fDeltaP4(336), // array of histograms of P3 for each track
242 fDeltaPhi(336), // array of histograms of P4 for each track
243 fDeltaPhiP(336), // array of histograms of delta z for each track
244 fSignals(336), // array of dedx signals
247 fHisLaser(0), // N dim histogram of laser
248 fHisNclIn(0), //->Number of clusters inner
249 fHisNclOut(0), //->Number of clusters outer
250 fHisNclIO(0), //->Number of cluster inner outer
251 fHisLclIn(0), //->Level arm inner
252 fHisLclOut(0), //->Level arm outer
253 fHisLclIO(0), //->Number of cluster inner outer
254 fHisdEdx(0), //->dEdx histo
255 fHisdZfit(0), //->distance to the mirror after linear fit
258 fHisChi2YIn1(0), //->chi2 y inner - line
259 fHisChi2YOut1(0), //->chi2 y inner - line
260 fHisChi2YIn2(0), //->chi2 y inner - parabola
261 fHisChi2YOut2(0), //->chi2 y inner - parabola
262 fHisChi2YIO1(0), //->chi2 y IO - common
263 fHisChi2ZIn1(0), //->chi2 z inner - line
264 fHisChi2ZOut1(0), //->chi2 z inner - line
265 fHisChi2ZIn2(0), //->chi2 z inner - parabola
266 fHisChi2ZOut2(0), //->chi2 z inner - parabola
267 fHisChi2ZIO1(0), //->chi2 z IO - common
270 fHisPy1vP0(0), //-> delta y P0outer-P0inner - line
271 fHisPy2vP0(0), //-> delta y P0outer-P0inner - parabola
272 fHisPy3vP0(0), //-> delta y P0outer-P0inner - common parabola
273 fHisPy1vP1(0), //-> delta ky P1outer-P1inner - line
274 fHisPy2vP1(0), //-> delta ky P1outer-P1inner - parabola
275 fHisPy3vP1(0), //-> delta ky P1outer-P1inner - common parabola
276 fHisPy2vP2In(0), //-> Curv P2inner - parabola
277 fHisPy2vP2Out(0), //-> Curv P2outer - parabola
278 fHisPy3vP2IO(0), //-> Curv P2outerinner - common parabola
281 fHisPz1vP0(0), //-> delta z P0outer-P0inner - line
282 fHisPz2vP0(0), //-> delta z P0outer-P0inner - parabola
283 fHisPz3vP0(0), //-> delta z P0outer-P0inner - common parabola
284 fHisPz1vP1(0), //-> delta kz P1outer-P1inner - line
285 fHisPz2vP1(0), //-> delta kz P1outer-P1inner - parabola
286 fHisPz3vP1(0), //-> delta kz P1outer-P1inner - common parabola
287 fHisPz2vP2In(0), //-> Curv P2inner - parabola
288 fHisPz2vP2Out(0), //-> Curv P2outer - parabola
289 fHisPz3vP2IO(0), //-> Curv P2outerinner - common parabola
301 fFitAside(new TVectorD(5)), // drift fit - A side
302 fFitCside(new TVectorD(5)), // drift fit - C- side
303 fFitACside(new TVectorD(6)), // drift fit - AC- side
304 fEdgeXcuts(3), // cuts in local x direction; used in the refit of the laser tracks
305 fEdgeYcuts(3), // cuts in local y direction; used in the refit of the laser tracks
306 fNClCuts(5), // cuts on the number of clusters per tracklet; used in the refit of the laser tracks
307 fNcuts(0), // number of cuts
308 fBeamSectorOuter(336),
309 fBeamSectorInner(336),
310 fBeamOffsetYOuter(336),
311 fBeamSlopeYOuter(336),
312 fBeamOffsetYInner(336),
313 fBeamSlopeYInner(336),
314 fBeamOffsetZOuter(336),
315 fBeamSlopeZOuter(336),
316 fBeamOffsetZInner(336),
317 fBeamSlopeZInner(336),
318 fInverseSlopeZ(kTRUE)
325 fTracksEsdParam.SetOwner(kTRUE);
328 AliTPCcalibLaser::AliTPCcalibLaser(const AliTPCcalibLaser& calibLaser):
329 AliTPCcalibBase(calibLaser),
335 fTracksEsdParam(336),
337 fFullCalib(calibLaser.fFullCalib),
339 fDeltaZ(calibLaser.fDeltaZ), // array of histograms of delta z for each track
340 fDeltaP3(((calibLaser.fDeltaP3))), // array of histograms of delta z for each track
341 fDeltaP4(((calibLaser.fDeltaP4))), // array of histograms of P3 for each track
342 fDeltaPhi(((calibLaser.fDeltaPhi))), // array of histograms of P4 for each track
343 fDeltaPhiP(((calibLaser.fDeltaPhiP))), // array of histograms of delta z for each track
344 fSignals(((calibLaser.fSignals))), // array of dedx signals
347 fHisLaser(0), // N dim histogram of laser
348 fHisNclIn(new TH2F(*(calibLaser.fHisNclIn))), //->Number of clusters inner
349 fHisNclOut(new TH2F(*(calibLaser.fHisNclOut))), //->Number of clusters outer
350 fHisNclIO(new TH2F(*(calibLaser.fHisNclIO))), //->Number of cluster inner outer
351 fHisLclIn(new TH2F(*(calibLaser.fHisLclIn))), //->Level arm inner
352 fHisLclOut(new TH2F(*(calibLaser.fHisLclOut))), //->Level arm outer
353 fHisLclIO(new TH2F(*(calibLaser.fHisLclIO))), //->Number of cluster inner outer
354 fHisdEdx(new TH2F(*(calibLaser.fHisdEdx))), //
355 fHisdZfit(new TH2F(*(calibLaser.fHisdZfit))), //->distance to the mirror after linear fit
358 fHisChi2YIn1(new TH2F(*(calibLaser.fHisChi2YIn1))), //->chi2 y inner - line
359 fHisChi2YOut1(new TH2F(*(calibLaser.fHisChi2YOut1))), //->chi2 y inner - line
360 fHisChi2YIn2(new TH2F(*(calibLaser.fHisChi2YIn2))), //->chi2 y inner - parabola
361 fHisChi2YOut2(new TH2F(*(calibLaser.fHisChi2YOut2))), //->chi2 y inner - parabola
362 fHisChi2YIO1(new TH2F(*(calibLaser.fHisChi2YIO1))), //->chi2 y IO - common
363 fHisChi2ZIn1(new TH2F(*(calibLaser.fHisChi2ZIn1))), //->chi2 z inner - line
364 fHisChi2ZOut1(new TH2F(*(calibLaser.fHisChi2ZOut1))), //->chi2 z inner - line
365 fHisChi2ZIn2(new TH2F(*(calibLaser.fHisChi2ZIn2))), //->chi2 z inner - parabola
366 fHisChi2ZOut2(new TH2F(*(calibLaser.fHisChi2ZOut2))), //->chi2 z inner - parabola
367 fHisChi2ZIO1(new TH2F(*(calibLaser.fHisChi2ZIO1))), //->chi2 z IO - common
370 fHisPy1vP0(new TH2F(*(calibLaser.fHisPy1vP0))), //-> delta y P0outer-P0inner - line
371 fHisPy2vP0(new TH2F(*(calibLaser.fHisPy2vP0))), //-> delta y P0outer-P0inner - parabola
372 fHisPy3vP0(new TH2F(*(calibLaser.fHisPy3vP0))), //-> delta y P0outer-P0inner - common parabola
373 fHisPy1vP1(new TH2F(*(calibLaser.fHisPy1vP1))), //-> delta ky P1outer-P1inner - line
374 fHisPy2vP1(new TH2F(*(calibLaser.fHisPy2vP1))), //-> delta ky P1outer-P1inner - parabola
375 fHisPy3vP1(new TH2F(*(calibLaser.fHisPy3vP1))), //-> delta ky P1outer-P1inner - common parabola
376 fHisPy2vP2In(new TH2F(*(calibLaser.fHisPy2vP2In))), //-> Curv P2inner - parabola
377 fHisPy2vP2Out(new TH2F(*(calibLaser.fHisPy2vP2Out))), //-> Curv P2outer - parabola
378 fHisPy3vP2IO(new TH2F(*(calibLaser.fHisPy3vP2IO))), //-> Curv P2outerinner - common parabola
381 fHisPz1vP0(new TH2F(*(calibLaser.fHisPz1vP0))), //-> delta z P0outer-P0inner - line
382 fHisPz2vP0(new TH2F(*(calibLaser.fHisPz2vP0))), //-> delta z P0outer-P0inner - parabola
383 fHisPz3vP0(new TH2F(*(calibLaser.fHisPz3vP0))), //-> delta z P0outer-P0inner - common parabola
384 fHisPz1vP1(new TH2F(*(calibLaser. fHisPz1vP1))), //-> delta kz P1outer-P1inner - line
385 fHisPz2vP1(new TH2F(*(calibLaser.fHisPz2vP1))), //-> delta kz P1outer-P1inner - parabola
386 fHisPz3vP1(new TH2F(*(calibLaser.fHisPz3vP1))), //-> delta kz P1outer-P1inner - common parabola
387 fHisPz2vP2In(new TH2F(*(calibLaser.fHisPz2vP2In))), //-> Curv P2inner - parabola
388 fHisPz2vP2Out(new TH2F(*(calibLaser. fHisPz2vP2Out))), //-> Curv P2outer - parabola
389 fHisPz3vP2IO(new TH2F(*(calibLaser.fHisPz3vP2IO))), //-> Curv P2outerinner - common parabola
392 fDeltaYres(((calibLaser.fDeltaYres))),
393 fDeltaZres(((calibLaser.fDeltaZres))),
394 fDeltaYres2(((calibLaser.fDeltaYres))),
395 fDeltaZres2(((calibLaser.fDeltaZres))),
396 fDeltaYresAbs(((calibLaser.fDeltaYresAbs))),
397 fDeltaZresAbs(((calibLaser.fDeltaZresAbs))),
398 // fDeltaYres3(((calibLaser.fDeltaYres))),
399 //fDeltaZres3(((calibLaser.fDeltaZres))),
400 fFitAside(new TVectorD(5)), // drift fit - A side
401 fFitCside(new TVectorD(5)), // drift fit - C- side
402 fFitACside(new TVectorD(6)), // drift fit - C- side
403 fEdgeXcuts(3), // cuts in local x direction; used in the refit of the laser tracks
404 fEdgeYcuts(3), // cuts in local y direction; used in the refit of the laser tracks
405 fNClCuts(5), // cuts on the number of clusters per tracklet; used in the refit of the laser tracks
406 fNcuts(0), // number of cuts
407 fBeamSectorOuter(336),
408 fBeamSectorInner(336),
409 fBeamOffsetYOuter(336),
410 fBeamSlopeYOuter(336),
411 fBeamOffsetYInner(336),
412 fBeamSlopeYInner(336),
413 fBeamOffsetZOuter(336),
414 fBeamSlopeZOuter(336),
415 fBeamOffsetZInner(336),
416 fBeamSlopeZInner(336),
417 fInverseSlopeZ(calibLaser.fInverseSlopeZ)
427 AliTPCcalibLaser & AliTPCcalibLaser::operator=(const AliTPCcalibLaser& calibLaser){
429 // assgnment operator
431 if (this != &calibLaser) {
432 new (this) AliTPCcalibLaser(calibLaser);
441 AliTPCcalibLaser::~AliTPCcalibLaser() {
446 delete fHisLaser; //->
447 delete fHisNclIn; //->Number of clusters inner
448 delete fHisNclOut; //->Number of clusters outer
449 delete fHisNclIO; //->Number of cluster inner outer
450 delete fHisLclIn; //->Level arm inner
451 delete fHisLclOut; //->Level arm outer
452 delete fHisLclIO; //->Number of cluster inner outer
457 delete fHisChi2YIn1; //->chi2 y inner - line
458 delete fHisChi2YOut1; //->chi2 y inner - line
459 delete fHisChi2YIn2; //->chi2 y inner - parabola
460 delete fHisChi2YOut2; //->chi2 y inner - parabola
461 delete fHisChi2YIO1; //->chi2 y IO - common
462 delete fHisChi2ZIn1; //->chi2 z inner - line
463 delete fHisChi2ZOut1; //->chi2 z inner - line
464 delete fHisChi2ZIn2; //->chi2 z inner - parabola
465 delete fHisChi2ZOut2; //->chi2 z inner - parabola
466 delete fHisChi2ZIO1; //->chi2 z IO - common
469 delete fHisPy1vP0; //-> delta y P0outer-P0inner - line
470 delete fHisPy2vP0; //-> delta y P0outer-P0inner - parabola
471 delete fHisPy3vP0; //-> delta y P0outer-P0inner - common parabola
472 delete fHisPy1vP1; //-> delta ky P1outer-P1inner - line
473 delete fHisPy2vP1; //-> delta ky P1outer-P1inner - parabola
474 delete fHisPy3vP1; //-> delta ky P1outer-P1inner - common parabola
475 delete fHisPy2vP2In; //-> Curv P2inner - parabola
476 delete fHisPy2vP2Out; //-> Curv P2outer - parabola
477 delete fHisPy3vP2IO; //-> Curv P2outerinner - common parabola
480 delete fHisPz1vP0; //-> delta z P0outer-P0inner - line
481 delete fHisPz2vP0; //-> delta z P0outer-P0inner - parabola
482 delete fHisPz3vP0; //-> delta z P0outer-P0inner - common parabola
483 delete fHisPz1vP1; //-> delta kz P1outer-P1inner - line
484 delete fHisPz2vP1; //-> delta kz P1outer-P1inner - parabola
485 delete fHisPz3vP1; //-> delta kz P1outer-P1inner - common parabola
486 delete fHisPz2vP2In; //-> Curv P2inner - parabola
487 delete fHisPz2vP2Out; //-> Curv P2outer - parabola
488 delete fHisPz3vP2IO; //-> Curv P2outerinner - common parabola
493 fDeltaZ.SetOwner(); //-> array of histograms of delta z for each track
494 fDeltaP3.SetOwner(); //-> array of histograms of P3 for each track
495 fDeltaP4.SetOwner(); //-> array of histograms of P4 for each track
496 fDeltaPhi.SetOwner(); //-> array of histograms of delta z for each track
497 fDeltaPhiP.SetOwner(); //-> array of histograms of delta z for each track
498 fSignals.SetOwner(); //->Array of dedx signals
500 fDeltaZ.Delete(); //-> array of histograms of delta z for each track
501 fDeltaP3.Delete(); //-> array of histograms of P3 for each track
502 fDeltaP4.Delete(); //-> array of histograms of P4 for each track
503 fDeltaPhi.Delete(); //-> array of histograms of delta z for each track
504 fDeltaPhiP.Delete(); //-> array of histograms of delta z for each track
505 fSignals.Delete(); //->Array of dedx signals
507 fDeltaYres.SetOwner();
509 fDeltaZres.SetOwner();
511 fDeltaYres2.SetOwner();
512 fDeltaYres2.Delete();
513 fDeltaZres2.SetOwner();
514 fDeltaZres2.Delete();
516 fDeltaYresAbs.SetOwner();
517 fDeltaYresAbs.Delete();
518 fDeltaZresAbs.SetOwner();
519 fDeltaZresAbs.Delete();
524 void AliTPCcalibLaser::Process(AliESDEvent * event) {
527 // Loop over tracks and call Process function
535 fESDfriend=static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
539 if (fESD->GetNumberOfTracks()<kMinTracks) return; //not enough tracks
540 AliDebug(4,Form("Event number in current file: %d",event->GetEventNumberInFile()));
542 // find CE background if present
544 if (AliTPCLaserTrack::GetTracks()==0) AliTPCLaserTrack::LoadTracks();
545 TH1D hisCE("hhisCE","hhisCE",100,-100,100);
546 for (Int_t i=0;i<fESD->GetNumberOfTracks();++i) {
547 AliESDtrack *track=fESD->GetTrack(i);
548 if (!track) continue;
549 hisCE.Fill(track->GetZ());
550 hisCE.Fill(track->GetZ()+2);
551 hisCE.Fill(track->GetZ()-2);
559 fTracksEsdParam.Delete();
560 for (Int_t id=0; id<336;id++) {
562 fClusterCounter[id]=0;
566 Int_t n=fESD->GetNumberOfTracks();
568 for (Int_t i=0;i<n;++i) {
569 AliESDfriendTrack *friendTrack=fESDfriend->GetTrack(i);
570 if (!friendTrack) continue;
571 AliESDtrack *track=fESD->GetTrack(i);
572 Double_t binC = hisCE.GetBinContent(hisCE.FindBin(track->GetZ()));
573 if (binC>336) continue; //remove CE background
574 TObject *calibObject=0;
576 for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j)
577 if ((seed=dynamic_cast<AliTPCseed*>(calibObject)))
581 Int_t id = FindMirror(track,seed);
582 if (id>=0) counter++;
587 if (counter<kMinTracks) return;
591 if (!fFullCalib) return;
592 static Bool_t init=kFALSE;
594 init = kTRUE; // way around for PROOF - to be investigated
598 for (Int_t id=0; id<336; id++){
600 if (!fTracksEsdParam.At(id)) continue;
601 if (fClusterSatur[id]>0.3) continue; // tracks in saturation
603 if ( AcceptLaser(id) && fFitZ[id]<0.5){
611 void AliTPCcalibLaser::MakeDistHisto(Int_t id){
615 // for (Int_t id=0; id<336; id++){
618 if (!fTracksEsdParam.At(id)) return;
619 if (!AcceptLaser(id)) return;
620 Double_t xhis[12]={0,0,0,0,0,0,0,0,0,0,0,0};
623 TH1F * hisdz = (TH1F*)fDeltaZ.At(id);
624 if (!hisdz) MakeFitHistos();
625 hisdz = (TH1F*)fDeltaZ.At(id);
626 TH1F * hisP3 = (TH1F*)fDeltaP3.At(id);
627 TH1F * hisP4 = (TH1F*)fDeltaP4.At(id);
628 TH1F * hisdphi = (TH1F*)fDeltaPhi.At(id);
629 TH1F * hisdphiP = (TH1F*)fDeltaPhiP.At(id);
630 TH1F * hisSignal = (TH1F*)fSignals.At(id);
633 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
634 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
635 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
644 param->GetPxPyPz(pxyz);
646 ltrp->GetPxPyPz(lpxyz);
648 Float_t dz = param->GetZ()-ltrp->GetZ();
649 Float_t dphi = (TMath::ATan2(xyz[1],xyz[0])- TMath::ATan2(lxyz[1],lxyz[0]))*254.;
650 Float_t dphiP = param->GetParameter()[2]-ltrp->GetParameter()[2];
651 if (hisdz) hisdz->Fill(dz);
652 if (hisP3) hisP3->Fill(param->GetParameter()[3]);
653 if (hisP4) hisP4->Fill(param->GetParameter()[4]);
654 if (hisdphi) hisdphi->Fill(dphi);
655 if (hisdphiP) hisdphiP->Fill(dphiP);
656 if (hisSignal) hisSignal->Fill(TMath::Sqrt(TMath::Abs(track->GetTPCsignal())));
658 xhis[0] = ltrp->GetId();
659 xhis[1] = ltrp->GetSide();
660 xhis[2] = ltrp->GetRod();
661 xhis[3] = ltrp->GetBundle();
662 xhis[4] = ltrp->GetBeam();
665 xhis[7] = param->GetParameter()[2]-ltrp->GetParameter()[2]; //dp2
666 xhis[8] = param->GetParameter()[3]-ltrp->GetParameter()[3]; //dp3
667 xhis[9] = param->GetParameter()[4];
668 xhis[10]= track->GetTPCNcls();
669 xhis[11]= TMath::Sqrt(TMath::Abs(track->GetTPCsignal()));
671 fHisLaser->Fill(xhis);
674 void AliTPCcalibLaser::FitDriftV(){
676 // Fit corrections to the drift velocity - linear approximation in the z and global y
677 //The transfromatiom from the drift time to the z position done in AliTPCTracnsform class
682 z = s* (z0 - vd*(t-t0))
686 vd - nominal drift velocity
687 zs - miscalibrated position
689 zs = s*(z0 - vd*(1+vr)*(t-(t0+dt))
690 vr - relative change of the drift velocity
695 zs ~ z - s*vr*(z0-s*z)+s*dzt
696 --------------------------------
697 1. Correction function vr constant:
700 dz = zs-z = -s*vr *(z0-s*z)+s*dzt
701 dzs/dl = dz/dl +s*s*vr*dz/dl
705 const Float_t kZCut = 240; // remove the closest laser beam
706 const Float_t kSaturCut = 0.05; // remove saturated lasers - cut on fraction of saturated
707 const Float_t kDistCut = 3; // distance sigma cut
708 const Float_t kDistCutAbs = 0.25;
709 const Float_t kMinClusters = 60; // minimal amount of the clusters
710 const Float_t kMinSignal = 16; // minimal mean height of the signal
711 const Float_t kChi2Cut = 0.1; // chi2 cut to accept drift fit
712 static TLinearFitter fdriftA(3,"hyp2");
713 static TLinearFitter fdriftC(3,"hyp2");
714 static TLinearFitter fdriftAC(4,"hyp3");
715 TVectorD fitA(3),fitC(3),fitAC(4);
717 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
718 AliTPCParam * tpcparam = calib->GetParameters();
720 for (Int_t id=0; id<336; id++) fFitZ[id]=0;
730 for (Int_t iter=0; iter<3; iter++){
731 fdriftA.ClearPoints();
732 fdriftC.ClearPoints();
733 fdriftAC.ClearPoints();
735 for (Int_t id=0; id<336; id++){
736 if (!fTracksEsdParam.At(id)) continue;
737 if (!AcceptLaser(id)) continue;
738 if ( fClusterSatur[id]>kSaturCut) continue;
739 if ( fClusterCounter[id]<kMinClusters) continue;
740 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
741 if (track->GetTPCsignal()<kMinSignal) continue;
742 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
743 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
750 param->GetPxPyPz(pxyz);
752 ltrp->GetPxPyPz(lpxyz);
753 if (TMath::Abs(lxyz[2])>kZCut) continue;
754 Float_t sz = (ltrp->GetSide()==0) ? TMath::Sqrt(chi2A): TMath::Sqrt(chi2C);
755 if (npointsAC>0) sz =TMath::Sqrt(chi2AC);
756 if (TMath::Abs(fFitZ[id])>sz*kDistCut) continue;
757 if (iter>0 && TMath::Abs(fFitZ[id])>kDistCutAbs) continue;
760 Double_t zlength = tpcparam->GetZLength(0);
761 Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
762 Double_t mdrift = zlength-TMath::Abs(xyz[2]);
763 Double_t xxx[2] = {ldrift,lxyz[1]*ldrift/(zlength*250.)};
764 if (ltrp->GetSide()==0){
765 fdriftA.AddPoint(xxx,mdrift,1);
767 fdriftC.AddPoint(xxx,mdrift,1);
769 Double_t xxx2[3] = {ltrp->GetSide(), ldrift,lxyz[1]*ldrift/(zlength*250.)};
770 fdriftAC.AddPoint(xxx2,mdrift,1);
773 if (fdriftA.GetNpoints()>10){
776 if (iter==0) fdriftA.EvalRobust(0.7);
777 else fdriftA.EvalRobust(0.8);
778 fdriftA.GetParameters(fitA);
779 npointsA= fdriftA.GetNpoints();
780 chi2A = fdriftA.GetChisquare()/fdriftA.GetNpoints();
781 if (chi2A<kChi2Cut ||(*fFitAside)[0]==0 ) {
782 if (fFitAside->GetNoElements()<5) fFitAside->ResizeTo(5);
783 (*fFitAside)[0] = fitA[0];
784 (*fFitAside)[1] = fitA[1];
785 (*fFitAside)[2] = fitA[2];
786 (*fFitAside)[3] = fdriftA.GetNpoints();
787 (*fFitAside)[4] = chi2A;
790 if (fdriftC.GetNpoints()>10){
792 if (iter==0) fdriftC.EvalRobust(0.7);
793 else fdriftC.EvalRobust(0.8);
795 fdriftC.GetParameters(fitC);
796 npointsC= fdriftC.GetNpoints();
797 chi2C = fdriftC.GetChisquare()/fdriftC.GetNpoints();
798 if (chi2C<kChi2Cut||(*fFitCside)[0]==0) {
799 if (fFitCside->GetNoElements()<5) fFitCside->ResizeTo(5);
800 (*fFitCside)[0] = fitC[0];
801 (*fFitCside)[1] = fitC[1];
802 (*fFitCside)[2] = fitC[2];
803 (*fFitCside)[3] = fdriftC.GetNpoints();
804 (*fFitCside)[4] = chi2C;
808 if (fdriftAC.GetNpoints()>10&&fdriftC.GetNpoints()>10&&fdriftA.GetNpoints()>10){
810 if (iter==0) fdriftAC.EvalRobust(0.7);
811 else fdriftAC.EvalRobust(0.8);
813 fdriftAC.GetParameters(fitAC);
814 npointsAC= fdriftAC.GetNpoints();
815 chi2AC = fdriftAC.GetChisquare()/fdriftAC.GetNpoints();
816 if (chi2AC<kChi2Cut||(*fFitACside)[0]==0) (*fFitACside) = fitAC;
819 for (Int_t id=0; id<336; id++){
820 if (!fTracksEsdParam.At(id)) continue;
822 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
823 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
829 param->GetPxPyPz(pxyz);
831 ltrp->GetPxPyPz(lpxyz);
832 Double_t zlength = tpcparam->GetZLength(0);
833 Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
834 Double_t mdrift = zlength-TMath::Abs(xyz[2]);
837 if (ltrp->GetSide()==0){
838 fz = (fitA)[0]+(fitA)[1]*ldrift+(fitA)[2]*lxyz[1]*ldrift/(zlength*250.);
840 fz = (fitC)[0]+(fitC)[1]*ldrift+(fitC)[2]*lxyz[1]*ldrift/(zlength*250.);
843 fz = (fitAC)[0]+(fitAC)[1]*ltrp->GetSide()+(fitAC)[2]*ldrift+(fitAC)[3]*lxyz[1]*ldrift/(zlength*250.);
848 TTreeSRedirector *cstream = GetDebugStreamer();
849 TTimeStamp tstamp(fTime);
850 Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
851 Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
852 Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
853 Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
854 Double_t temp0 = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
855 Double_t temp1 = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
856 TVectorD vecGoofie(20);
857 AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
859 for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
860 AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
861 if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
865 (*cstream)<<"driftv"<<
866 "run="<<fRun<< // run number
867 "event="<<fEvent<< // event number
868 "time="<<fTime<< // time stamp of event
869 "trigger="<<fTrigger<< // trigger
870 "mag="<<fMagF<< // magnetic field
871 // Environment values
872 "press0="<<valuePressure0<<
873 "press1="<<valuePressure1<<
874 "pt0="<<ptrelative0<<
875 "pt1="<<ptrelative1<<
878 "vecGoofie.="<<&vecGoofie<<
882 "driftA.="<<fFitAside<<
883 "driftC.="<<fFitCside<<
884 "driftAC.="<<fFitACside<<
896 Bool_t AliTPCcalibLaser::FitDriftV(Float_t minFraction){
898 // Fit corrections to the drift velocity - linear approximation in the z and global y
899 //The transfromatiom from the drift time to the z position done in AliTPCTracnsform class
901 // Source of outlyers :
902 // 0. Track in the saturation - postpeak
903 // 1. gating grid close the part of the signal for first bundle
905 // The robust fit is performed in 2 itterations /robust fraction controlled by kFraction/
906 // 1. Robust fit is used in the itteration number 0
907 // only fraction of laser uted
908 // 2. Only the tracks close to the fit used in the second itteration
912 z = s* (z0 - vd*(t-t0))
916 vd - nominal drift velocity
917 zs - miscalibrated position
919 zs = s*(z0 - vd*(1+vr)*(t-(t0+dt))
920 vr - relative change of the drift velocity
925 zs ~ z - s*vr*(z0-s*z)+s*dzt
926 --------------------------------
927 1. Correction function vr constant:
930 dz = zs-z = -s*vr *(z0-s*z)+s*dzt
931 dzs/dl = dz/dl +s*s*vr*dz/dl
934 const Int_t knLaser = 336; //n laser tracks
935 const Float_t kFraction[2] = {0.70,0.95}; // robust fit fraction
937 const Float_t kSaturCut = 0.05; // remove saturated lasers - cut on fraction of saturated
938 const Float_t kDistCut = 3.; // distance sigma cut - 3 sigma
939 const Float_t kDistCutAbs = 1.; // absolute cut 1 cm
940 const Float_t kMinClusters = 60.; // minimal amount of the clusters
941 const Float_t kMinSignal = 10.; // minimal mean height of the signal
942 const Float_t kChi2Cut = 1.0; // chi2 cut to accept drift fit
944 static TLinearFitter fdriftA(3,"hyp2");
945 static TLinearFitter fdriftC(3,"hyp2");
946 static TLinearFitter fdriftAC(4,"hyp3");
947 TVectorD fitA(3),fitC(3),fitAC(4);
949 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
950 AliTPCParam * tpcparam = calib->GetParameters();
954 for (Int_t id=0; id<336; id++) fFitZ[id]=0;
955 if (fFitAside->GetNoElements()<5) fFitAside->ResizeTo(5);
956 if (fFitCside->GetNoElements()<5) fFitCside->ResizeTo(5);
957 for (Int_t i=0;i<5; i++){
969 Int_t nbA[4]={0,0,0,0};
970 Int_t nbC[4]={0,0,0,0};
971 TVectorD vecZM(336); // measured z potion of laser
972 TVectorD vecA(336); // accepted laser
973 TVectorD vecZF(336); // fitted position
974 TVectorD vecDz(336); // deltaZ
975 TVectorD vecZS(336); // surveyed position of laser
976 // additional variable to cut
977 TVectorD vecdEdx(336); // dEdx
978 TVectorD vecSy(336); // shape y
979 TVectorD vecSz(336); // shape z
982 for (Int_t id=0; id<336; id++){
984 AliTPCLaserTrack *ltrp =
985 (AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
986 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
987 AliTPCseed * seed = (AliTPCseed*)fTracksTPC.At(id);
988 vecZM(id)= (param==0) ? 0:param->GetZ();
989 vecZS(id)= ltrp->GetZ();
992 vecdEdx(id)=(seed)?seed->GetdEdx():0;
993 vecSy(id) =(seed)?seed->CookShape(1):0;
994 vecSz(id) =(seed)?seed->CookShape(2):0;
997 if (!fTracksEsdParam.At(id)) reject|=1;
998 if (!param) continue;
999 if (!AcceptLaser(id)) reject|=2;
1000 if ( fClusterSatur[id]>kSaturCut) reject|=4;
1001 if ( fClusterCounter[id]<kMinClusters) reject|=8;
1003 if (reject>0) continue;
1004 if (ltrp->GetSide()==0){
1006 nbA[ltrp->GetBundle()]++;
1008 if (ltrp->GetSide()==1){
1010 nbC[ltrp->GetBundle()]++;
1014 // reject "bad events"
1019 if (npointsA<minFraction*0.5*knLaser && npointsC<minFraction*0.5*knLaser)
1021 for (Int_t i=0;i<4;i++){
1022 //count accepted for all layers
1023 if (nbA[i]>minFraction*0.5*0.25*knLaser) naA++;
1024 if (nbC[i]>minFraction*0.5*0.25*knLaser) naC++;
1026 if (naA<3 &&naC<3) isOK=kFALSE;
1027 if (isOK==kFALSE) return kFALSE;
1032 for (Int_t iter=0; iter<2; iter++){
1033 fdriftA.ClearPoints();
1034 fdriftC.ClearPoints();
1035 fdriftAC.ClearPoints();
1036 npointsA=0; npointsC=0; npointsAC=0;
1038 for (Int_t id=0; id<336; id++){
1039 if (!fTracksEsdParam.At(id)) continue;
1040 if (!AcceptLaser(id)) continue;
1041 if ( fClusterSatur[id]>kSaturCut) continue;
1042 if ( fClusterCounter[id]<kMinClusters) continue;
1043 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
1044 if (track->GetTPCsignal()<kMinSignal) continue;
1045 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
1046 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
1052 param->GetPxPyPz(pxyz);
1054 ltrp->GetPxPyPz(lpxyz);
1055 Float_t sz = (ltrp->GetSide()==0) ? TMath::Sqrt(chi2A): TMath::Sqrt(chi2C);
1056 if (npointsAC>0) sz =TMath::Sqrt(chi2AC);
1057 if (iter>0 && TMath::Abs(fFitZ[id])>sz*kDistCut) continue;
1058 if (iter>0 && TMath::Abs(fFitZ[id])>kDistCutAbs) continue;
1060 // // drift distance
1061 // Double_t zlength = tpcparam->GetZLength(0);
1062 // Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
1063 // Double_t mdrift = zlength-TMath::Abs(xyz[2]);
1065 Double_t zlength = (ltrp->GetSide()==0)? tpcparam->GetZLength(36): tpcparam->GetZLength(71);
1066 Double_t ldrift = (ltrp->GetSide()==0)?zlength-lxyz[2]:lxyz[2]+zlength;
1067 Double_t mdrift = (ltrp->GetSide()==0)?zlength-xyz[2]:xyz[2]+zlength;
1070 Double_t xxx[2] = {ldrift,lxyz[1]*ldrift/(zlength*250.)};
1071 if (iter==0 &<rp->GetBundle()==0) continue;
1072 // skip bundle 0 - can be wrong in the 0 iteration
1073 if (ltrp->GetSide()==0){
1074 fdriftA.AddPoint(xxx,mdrift,1);
1076 fdriftC.AddPoint(xxx,mdrift,1);
1078 Double_t xxx2[3] = {ltrp->GetSide(), ldrift,lxyz[1]*ldrift/(zlength*250.)};
1079 fdriftAC.AddPoint(xxx2,mdrift,1);
1082 if (fdriftA.GetNpoints()>minFraction*0.5*knLaser){
1085 npointsA= fdriftA.GetNpoints();
1086 chi2A = fdriftA.GetChisquare()/fdriftA.GetNpoints();
1087 fdriftA.EvalRobust(kFraction[iter]);
1088 fdriftA.GetParameters(fitA);
1089 if (chi2A<kChi2Cut ||(*fFitAside)[0]==0 ) {
1090 if (fFitAside->GetNoElements()<5) fFitAside->ResizeTo(5);
1091 (*fFitAside)[0] = fitA[0];
1092 (*fFitAside)[1] = fitA[1];
1093 (*fFitAside)[2] = fitA[2];
1094 (*fFitAside)[3] = fdriftA.GetNpoints();
1095 (*fFitAside)[4] = chi2A;
1098 if (fdriftC.GetNpoints()>minFraction*0.5*knLaser){
1100 npointsC= fdriftC.GetNpoints();
1101 chi2C = fdriftC.GetChisquare()/fdriftC.GetNpoints();
1102 fdriftC.EvalRobust(kFraction[iter]);
1103 fdriftC.GetParameters(fitC);
1104 if (chi2C<kChi2Cut||(*fFitCside)[0]==0) {
1105 if (fFitCside->GetNoElements()<5) fFitCside->ResizeTo(5);
1106 (*fFitCside)[0] = fitC[0];
1107 (*fFitCside)[1] = fitC[1];
1108 (*fFitCside)[2] = fitC[2];
1109 (*fFitCside)[3] = fdriftC.GetNpoints();
1110 (*fFitCside)[4] = chi2C;
1114 if (fdriftAC.GetNpoints()>minFraction*knLaser){
1116 npointsAC= fdriftAC.GetNpoints();
1117 chi2AC = fdriftAC.GetChisquare()/fdriftAC.GetNpoints();
1118 fdriftAC.EvalRobust(kFraction[iter]);
1119 fdriftAC.GetParameters(fitAC);
1120 if (chi2AC<kChi2Cut||(*fFitACside)[0]==0) (*fFitACside) = fitAC;
1121 (*fFitACside)[0] = fitAC[0];
1122 (*fFitACside)[1] = fitAC[1];
1123 (*fFitACside)[2] = fitAC[2];
1124 (*fFitACside)[3] = fdriftAC.GetNpoints();
1125 (*fFitACside)[4] = chi2AC;
1128 for (Int_t id=0; id<336; id++){
1129 if (!fTracksEsdParam.At(id)) continue;
1131 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
1132 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
1138 param->GetPxPyPz(pxyz);
1140 ltrp->GetPxPyPz(lpxyz);
1141 //Double_t zlength = tpcparam->GetZLength(0);
1142 //Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
1143 //Double_t mdrift = zlength-TMath::Abs(xyz[2]);
1144 Double_t zlength = (ltrp->GetSide()==0)? tpcparam->GetZLength(36): tpcparam->GetZLength(71);
1145 Double_t ldrift = (ltrp->GetSide()==0)?zlength-lxyz[2]:lxyz[2]+zlength;
1146 Double_t mdrift = (ltrp->GetSide()==0)?zlength-xyz[2]:xyz[2]+zlength;
1150 if (ltrp->GetSide()==0){
1151 fz = (fitA)[0]+(fitA)[1]*ldrift+(fitA)[2]*lxyz[1]*ldrift/(zlength*250.);
1153 fz = (fitC)[0]+(fitC)[1]*ldrift+(fitC)[2]*lxyz[1]*ldrift/(zlength*250.);
1156 //fz = (fitAC)[0]+(fitAC)[1]*ltrp->GetSide()+(fitAC)[2]*ldrift+(fitAC)[3]*lxyz[1]*ldrift/(zlength*250.);
1158 fFitZ[id]=mdrift-fz;
1160 vecDz[id]=mdrift-fz;
1162 if (fStreamLevel>0){
1163 TTreeSRedirector *cstream = GetDebugStreamer();
1164 TTimeStamp tstamp(fTime);
1165 Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
1166 Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
1167 Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
1168 Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
1169 Double_t temp0 = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
1170 Double_t temp1 = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
1171 TVectorD vecGoofie(20);
1172 AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
1174 for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
1175 AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
1176 if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
1180 (*cstream)<<"driftvN"<<
1181 "run="<<fRun<< // run number
1182 "event="<<fEvent<< // event number
1183 "time="<<fTime<< // time stamp of event
1184 "trigger="<<fTrigger<< // trigger
1185 "mag="<<fMagF<< // magnetic field
1186 // Environment values
1187 "press0="<<valuePressure0<<
1188 "press1="<<valuePressure1<<
1189 "pt0="<<ptrelative0<<
1190 "pt1="<<ptrelative1<<
1193 "vecGoofie.="<<&vecGoofie<<
1196 "vecZM.="<<&vecZM<< // measured z position
1197 "vecZS.="<<&vecZS<< // surveyed z position
1198 "vecZF.="<<&vecZF<< // fitted z position
1199 "vecDz.="<<&vecDz<< // fitted z position
1200 "vecA.="<<&vecA<< // accept laser flag
1201 "vecdEdx.="<<&vecdEdx<< // dEdx - to cut on
1202 "vecSy.="<<&vecSy<< // shape y - to cut on
1203 "vecSz.="<<&vecSz<< // shape z - to cut on
1206 "driftA.="<<fFitAside<<
1207 "driftC.="<<fFitCside<<
1208 "driftAC.="<<fFitACside<<
1218 variables to check in debug mode:
1220 chainDriftN->SetAlias("driftS","250-abs(vecZS.fElements)");
1221 chainDriftN->SetAlias("driftM","250-abs(vecZM.fElements)");
1222 chainDriftN->SetAlias("driftF","vecZF.fElements");
1223 chainDriftN->SetAlias("deltaZ","driftF-driftM"); //deltaZ
1224 TCut cutA="iter==1&&sqrt(chi2A)<0.1&&vecZS.fElements>0&&vecA.fElements==0";
1225 TCut cutC="iter==1&&sqrt(chi2C)<0.1&&vecZS.fElements<0&&vecA.fElements==0";
1234 Float_t AliTPCcalibLaser::GetDistance(AliExternalTrackParam *param, AliTPCLaserTrack *ltrp){
1236 // get distance between mirror and laser track
1247 dist+=TMath::Abs((TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*param->GetX());
1250 // apply drift correction if already exist
1253 if (ltrp->GetSide()==0){
1254 if ((*fFitAside)[1]>0.) dz = ((*fFitAside)[0]+(*fFitAside)[1]*lxyz[2]+(*fFitAside)[2]*lxyz[1])-xyz[2];
1256 if ((*fFitCside)[1]>0.) dz = ((*fFitCside)[0]+(*fFitCside)[1]*lxyz[2]+(*fFitCside)[2]*lxyz[1])-xyz[2];
1258 if (TMath::Abs(dz)>3*(TMath::Abs(lxyz[2]-xyz[2])+1)) dz= TMath::Abs(lxyz[2]-xyz[2]);
1259 dist+=TMath::Abs(dz);
1261 // phi dist - divergence on 50 cm
1263 dist = TMath::Abs((param->GetParameter()[2]-ltrp->GetParameter()[2])*50);
1268 Bool_t AliTPCcalibLaser::AcceptLaser(Int_t id){
1273 TCut cutP0("cutP0","abs((atan2(x1,x0)-atan2(lx1,lx0))*254)<1.5");
1274 TCut cutP1("cutP1","abs(LTr.fP[1]-Tr.fP[1])<30");
1275 TCut cutP2("cutP2","abs(LTr.fP[2]-Tr.fP[2])<0.03");
1276 TCut cutP3("cutP3","abs(Tr.fP[3])<0.05");
1278 TCut cutA = cutP0+cutP1+cutP2+cutP3+cutP4;
1280 AliExternalTrackParam *param =(AliExternalTrackParam*)fTracksEsdParam.At(id);
1281 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
1282 //AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
1287 if (TMath::Abs((TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*254)>1.5) return kFALSE; //cut y- P0
1288 if (TMath::Abs(param->GetParameter()[1]-ltrp->GetParameter()[1])>30) return kFALSE; // cutZ -P1
1289 if (TMath::Abs(param->GetParameter()[2]-ltrp->GetParameter()[2])>0.03) return kFALSE; // cut -P2
1290 if (TMath::Abs(param->GetParameter()[3])>0.05) return kFALSE; // cut Tl -P3
1297 Int_t AliTPCcalibLaser::FindMirror(AliESDtrack *track, AliTPCseed *seed){
1299 // Find corresponding mirror
1300 // add the corresponding tracks
1302 if (!track->GetOuterParam()) return -1;
1304 Float_t kRadius0 = 252;
1305 Float_t kRadius = 254.2;
1307 Float_t counterSatur=0;
1310 for (Int_t irow=158;irow>-1;--irow) {
1311 AliTPCclusterMI *c=seed->GetClusterPointer(irow);
1313 Double_t pedgeY = c->GetX()*TMath::DegToRad()*(10)-TMath::Abs(c->GetY());
1314 Double_t pedgeX = TMath::Min((irow)*0.75, (159.-irow)*1.5);
1315 if (pedgeY<3) continue;
1316 if (pedgeX<3) continue;
1318 if (c->GetDetector()%36<18) csideA++;
1319 if (c->GetDetector()%36>=18) csideC++;
1320 if (c->GetMax()>900) counterSatur++;
1322 counterSatur/=(countercl+1);
1326 if (csideA<0.9*seed->GetNumberOfClusters() && csideC<0.9*seed->GetNumberOfClusters()) return 0; // cross laser track can not happen
1329 if (csideC>0.5*seed->GetNumberOfClusters()) side=1;
1332 AliExternalTrackParam param(*(track->GetOuterParam()));
1333 AliTracker::PropagateTrackTo(¶m,kRadius0,0.10566,3,kTRUE);
1334 AliTracker::PropagateTrackTo(¶m,kRadius,0.10566,0.1,kTRUE);
1335 AliTPCLaserTrack ltr;
1336 AliTPCLaserTrack *ltrp=0x0;
1337 // AliTPCLaserTrack *ltrpjw=0x0;
1339 Int_t id = AliTPCLaserTrack::IdentifyTrack(¶m,side);
1340 // Int_t idjw = AliTPCLaserTrack::IdentifyTrackJW(¶m);
1341 //AliDebug(4,Form("Identified Track: %03d (%03d)",id,idjw));
1343 if (id!=-1 && (AliTPCLaserTrack::GetTracks()->UncheckedAt(id)))
1344 ltrp=(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
1348 if (id<0) return -1;
1349 if (ltrp->GetSide()!=side) return -1;
1355 if (counterSatur>fClusterSatur[id]) fClusterSatur[id]=counterSatur;
1358 Float_t radius=TMath::Abs(ltrp->GetX());
1359 param.Rotate(ltrp->GetAlpha());
1360 AliTracker::PropagateTrackTo(¶m,radius,0.10566,0.01,kFALSE);
1362 if (!fTracksMirror.At(id)) fTracksMirror.AddAt(ltrp,id);
1363 Bool_t accept=kTRUE;
1365 // choose closer track
1367 AliExternalTrackParam * param0 = (AliExternalTrackParam *)fTracksEsdParam.At(id);
1369 Float_t dist0=GetDistance(param0,ltrp);
1370 Float_t dist1=GetDistance(¶m,ltrp);
1371 if (dist0<dist1) accept=kFALSE;
1375 fClusterCounter[id]=countercl;
1376 fTracksEsdParam.AddAt(param.Clone(),id);
1377 fTracksEsd.AddAt(track,id);
1378 fTracksTPC.AddAt(seed,id);
1385 void AliTPCcalibLaser::DumpLaser(Int_t id) {
1387 // Dump Laser info to the tree
1389 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
1390 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
1391 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
1400 param->GetPxPyPz(pxyz);
1402 ltrp->GetPxPyPz(lpxyz);
1403 Float_t dist3D = GetDistance(param,ltrp);
1404 Float_t dist0 = (TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*param->GetX();
1405 Float_t distphi = (param->GetParameter()[2]-ltrp->GetParameter()[2])*50;
1408 if (fStreamLevel>0){
1409 TTreeSRedirector *cstream = GetDebugStreamer();
1410 Int_t time = fESD->GetTimeStamp();
1411 Bool_t accept = AcceptLaser(id);
1413 (*cstream)<<"Track"<<
1415 "run="<<fRun<< // run number
1416 "event="<<fEvent<< // event number
1417 "time="<<fTime<< // time stamp of event
1418 "trigger="<<fTrigger<< // trigger
1419 "mag="<<fMagF<< // magnetic field
1423 "driftA.="<<fFitAside<<
1424 "driftC.="<<fFitCside<<
1428 "distphi="<<distphi<<
1431 "counter="<<fCounter[id]<<
1432 "clcounter="<<fClusterCounter[id]<<
1433 "satur="<<fClusterSatur[id]<<
1457 void AliTPCcalibLaser::RefitLaserJW(Int_t id){
1459 // Refit the track with different tracklet models:
1460 // 1. Per ROC using the kalman filter, different edge cuts
1461 // 2. Per ROC linear in y and z
1462 // 3. Per ROC quadratic in y and z
1463 // 4. Per track offset for each sector, linear for each sector, common quadratic
1464 // store x, y, z information for all models and the cluster to calculate the residuals
1467 // The clusters which do not fulfill given criteria are skipped
1469 // Cluters removed from fit
1470 // 1. Extended shape > kShapeCut
1471 // 2. In saturation Max > kMax
1472 // 3. Distance to edge < cutEdge
1474 // Clusters not used for the calibration:
1476 // 1. Extended shape > kShapeCut
1477 // 2. In saturation Max > kMax
1480 AliTPCseed *track = (AliTPCseed*)fTracksTPC.At(id);
1481 AliExternalTrackParam *extparam=(AliExternalTrackParam*)fTracksEsdParam.At(id);
1482 AliTPCLaserTrack *ltrp = (AliTPCLaserTrack*)fTracksMirror.At(id);
1484 AliTPCclusterMI dummyCl;
1487 Int_t kMaxTracklets=2;
1488 Float_t kShapeCut = 1.3;
1489 Float_t kRatioCut = 2.;
1491 Float_t kMax = 900.;
1494 //=============================================//
1495 // Linear Fitters for the Different Approaches //
1496 //=============================================//
1497 //linear fit model in y and z; inner - outer sector, combined with offset
1498 static TLinearFitter fy1I(2,"hyp1");
1499 static TLinearFitter fy1O(2,"hyp1");
1500 static TLinearFitter fz1I(2,"hyp1");
1501 static TLinearFitter fz1O(2,"hyp1");
1502 static TLinearFitter fy1IO(3,"hyp2");
1503 static TLinearFitter fz1IO(3,"hyp2");
1504 //quadratic fit model in y and z; inner - sector
1505 static TLinearFitter fy2I(3,"hyp2");
1506 static TLinearFitter fy2O(3,"hyp2");
1507 static TLinearFitter fz2I(3,"hyp2");
1508 static TLinearFitter fz2O(3,"hyp2");
1509 //common quadratic fit for IROC and OROC in y and z
1510 static TLinearFitter fy4(5,"hyp4");
1511 static TLinearFitter fz4(5,"hyp4");
1521 //=============================//
1522 // Loop over all Tracklet Cuts //
1523 //=============================//
1524 for (Int_t icut=0; icut<fNcuts; icut++){
1525 Float_t xinMin = 2500, xinMax=-90;
1526 Float_t xoutMin=2500, xoutMax=-90;
1527 Float_t msigmaYIn=0;
1528 Float_t msigmaYOut=0;
1529 Float_t mqratioIn=0;
1530 Float_t mqratioOut=0;
1533 AliDebug(4,Form("Processing cut %d for track with ID %d",icut,id));
1535 Double_t edgeCutX = fEdgeXcuts[icut];
1536 Double_t edgeCutY = fEdgeYcuts[icut];
1537 Int_t nclCut = (Int_t)fNClCuts[icut];
1538 //=========================//
1539 // Parameters to calculate //
1540 //=========================//
1541 //fit parameter inner, outer tracklet and combined fit
1542 TVectorD vecy1resInner(2),vecz1resInner(2); //pol1 fit parameters inner
1543 TVectorD vecy2resInner(3),vecz2resInner(3); //pol2 fit parameters inner
1545 TVectorD vecy1resOuter(2),vecz1resOuter(2); //pol1 fit parameters outer
1546 TVectorD vecy2resOuter(3),vecz2resOuter(3); //pol2 fit parameters outer
1547 TVectorD vecy4res(5),vecz4res(5);
1548 TVectorD vecy1resIO(3),vecz1resIO(3);
1549 // cluster and track positions for each row - used for residuals
1550 TVectorD vecgX(159); // global X
1551 TVectorD vecgY(159); // global Y
1552 TVectorD vecgZ(159); // global Z
1554 TVectorD vecX(159); // x is the same for all (row center)
1555 TVectorD vecYkalman(159); // y from kalman fit
1556 TVectorD vecZkalman(159); // z from kalman fit
1557 TVectorD vecY1(159); // y from pol1 fit per ROC
1558 TVectorD vecZ1(159); // z from pol1 fit per ROC
1559 TVectorD vecY1IO(159); // y from pol1 fit per ROC
1560 TVectorD vecZ1IO(159); // z from pol1 fit per ROC
1561 TVectorD vecY2(159); // y from pol2 fit per ROC
1562 TVectorD vecZ2(159); // z from pol2 fit per ROC
1563 TVectorD vecY4(159); // y from sector fit
1564 TVectorD vecZ4(159); // z from sector fit
1565 TVectorD vecClY(159); // y cluster position
1566 TVectorD vecClZ(159); // z cluster position
1567 TVectorD vecSec(159); // sector for each row
1568 TVectorD isReject(159); // flag - cluster to be rejected
1570 Double_t chi2I1z=0; // chi2 of pol1 fit in z (inner)
1571 Double_t chi2I1y=0; // chi2 of pol1 fit in y (inner)
1572 Double_t chi2O1z=0; // chi2 of pol1 fit in z (outer)
1573 Double_t chi2O1y=0; // chi2 of pol1 fit in y (outer)
1574 Double_t chi2IO1z=0; // chi2 of pol1 fit in z (outer)
1575 Double_t chi2IO1y=0; // chi2 of pol1 fit in y (outer)
1576 Double_t chi2I2z=0; // chi2 of pol2 fit in z (inner)
1577 Double_t chi2I2y=0; // chi2 of pol2 fit in y (inner)
1578 Double_t chi2O2z=0; // chi2 of pol2 fit in z (outer)
1579 Double_t chi2O2y=0; // chi2 of pol2 fit in y (outer)
1580 Double_t chi2IOz=0; // chi2 of hyp4 fit in z (inner+outer)
1581 Double_t chi2IOy=0; // chi2 of hyp4 fit in y (inner+outer)
1583 Int_t innerSector = -1; // number of inner sector
1584 Int_t outerSector = -1; // number of outer sector
1585 Int_t nclI=0; // number of clusters (inner)
1586 Int_t nclO=0; // number of clusters (outer)
1587 //=================================================//
1588 // Perform the Kalman Fit using the Tracklet Class //
1589 //=================================================//
1590 AliTPCTracklet::SetEdgeCut(edgeCutX,edgeCutY);
1591 TObjArray tracklets=
1592 AliTPCTracklet::CreateTracklets(track,AliTPCTracklet::kKalman,
1593 kFALSE,nclCut,kMaxTracklets);
1594 // tracklet pointers
1595 AliTPCTracklet *trInner = (AliTPCTracklet*)tracklets.At(0);
1596 AliTPCTracklet *trOuter = (AliTPCTracklet*)tracklets.At(1);
1597 AliTPCTracklet *tr=0x0;
1598 AliTPCTracklet dummy;
1599 //continue if we didn't find a tracklet
1600 if ( !trInner && !trOuter ) continue;
1601 //================================================================================//
1602 // Swap Inner and Outer if necessary (inner sector is definde by smaller local x) //
1603 //================================================================================//
1604 if ( trInner && trOuter ){
1605 if ( !trInner->GetInner() || !trOuter->GetInner() ) continue;
1606 if ( trInner->GetInner()->GetX() > trOuter->GetInner()->GetX() ){
1610 AliDebug(5,Form("Swapped Sectors: %02d (%f) <-> %02d (%f)", trOuter->GetSector(), trOuter->GetInner()->GetX(), trInner->GetSector(), trInner->GetInner()->GetX()));
1614 if ( !trInner->GetInner() ) continue;
1616 if ( trInner->GetSector()>35 ){
1621 if ( !trOuter->GetInner() ) continue;
1623 if ( trOuter->GetSector()<36 ){
1629 innerSector = trInner->GetSector();
1630 if ( innerSector>=0 ) AliDebug(5,Form("Found inner Sector %02d at X %.2f", innerSector, trInner->GetInner()->GetX()));
1631 outerSector = trOuter->GetSector();
1632 if ( outerSector>=0 ) AliDebug(5,Form("Found outer Sector %02d at X %.2f", outerSector, trOuter->GetInner()->GetX()));
1634 // array of clusters
1635 TClonesArray arrCl("AliTPCclusterMI",159);
1636 arrCl.ExpandCreateFast(159);
1637 //=======================================//
1638 // fill fitters with cluster information //
1639 //=======================================//
1640 AliDebug(3,"Filing Cluster Information");
1645 for (Int_t irow=158;irow>-1;--irow) {
1646 AliTPCclusterMI *c=track->GetClusterPointer(irow);
1647 AliTPCclusterMI &cl = (AliTPCclusterMI&) (*arrCl[irow]);
1652 Float_t meanY=0, sumY=0;
1653 for (Int_t drow=-1;drow<=1;drow++) {
1654 if (irow+drow<0) continue;
1655 if (irow+drow>158) continue;
1656 AliTPCclusterMI *ccurrent=track->GetClusterPointer(irow);
1657 if (!ccurrent) continue;
1658 Int_t roc = static_cast<Int_t>(ccurrent->GetDetector());
1659 if ( roc!=innerSector && roc!=outerSector ) continue;
1660 if (ccurrent->GetX()<10) continue;
1661 if (ccurrent->GetY()==0) continue;
1662 meanY+=ccurrent->GetY();
1665 if (sumY>0) meanY/=sumY;
1670 Double_t pedgeY = c->GetX()*TMath::Tan(TMath::DegToRad()*(10))-TMath::Abs(meanY);
1671 Double_t pedgeX = TMath::Min((irow)*0.75, (159.-irow)*1.5);
1674 Int_t roc = static_cast<Int_t>(c->GetDetector());
1675 if ( roc!=innerSector && roc!=outerSector ) continue;
1677 //store clusters in clones array
1680 if (c->GetMax()<4) continue; // noise cluster?
1681 if (TMath::Abs(c->GetY())<0.0001) continue; // noise cluster?
1683 vecX[irow] = c->GetX();
1684 vecClY[irow] = c->GetY();
1685 vecClZ[irow] = c->GetZ();
1688 // c->GetGlobalXYZ(gxyz);
1689 // vecgX[irow] = gxyz[0];
1690 // vecgY[irow] = gxyz[1];
1691 // vecgZ[irow] = gxyz[2];
1693 Double_t x = vecX[irow]-133.4; //reference is between IROC and OROC
1694 Double_t y = vecClY[irow];
1695 Double_t z = vecClZ[irow];
1697 Double_t x2[2]={x,x*x}; //linear and parabolic parameters
1698 Double_t x4[4]={0,0,0,0}; //hyp4 parameters
1699 Double_t xIO[2]={0,x}; //common linear + offset IROC-OROC
1700 if ( roc == innerSector ) {
1701 x4[0]=1; //offset inner - outer sector
1702 x4[1]=x; //slope parameter inner sector
1705 x4[2]=x; //slope parameter outer sector
1707 x4[3]=x*x; //common parabolic shape
1708 if (pedgeX < fEdgeXcuts[icut]) continue;
1709 if (pedgeY < fEdgeYcuts[icut]) continue;
1710 if (c->GetMax()>900) continue; // cluster in saturation
1712 if ( roc==innerSector ){
1713 fy1I.AddPoint(x2,y);
1714 fz1I.AddPoint(x2,z);
1715 fy2I.AddPoint(x2,y);
1716 fz2I.AddPoint(x2,z);
1718 if (c->GetX()<xinMin) xinMin=c->GetX();
1719 if (c->GetX()>xinMax) xinMax=c->GetX();
1721 msigmaYIn +=TMath::Sqrt(c->GetSigmaY2());
1722 mqratioIn +=c->GetMax()/c->GetQ();
1725 if ( roc==outerSector ){
1726 fy1O.AddPoint(x2,y);
1727 fz1O.AddPoint(x2,z);
1728 fy2O.AddPoint(x2,y);
1729 fz2O.AddPoint(x2,z);
1731 if (c->GetX()<xoutMin) xoutMin=c->GetX();
1732 if (c->GetX()>xoutMax) xoutMax=c->GetX();
1733 msigmaYOut +=TMath::Sqrt(c->GetSigmaY2());
1734 mqratioOut +=c->GetMax()/c->GetQ();
1739 fy1IO.AddPoint(xIO,y);
1740 fz1IO.AddPoint(xIO,z);
1750 //======================================//
1751 // Evaluate and retrieve fit parameters //
1752 //======================================//
1753 AliDebug(5,Form("Evaluating fits with inner (outer) Sec: %02d (%02d)",innerSector,outerSector));
1755 if ( (innerSector>-1) && (fy1I.GetNpoints()>0) ){
1760 fy1I.GetParameters(vecy1resInner);
1761 fz1I.GetParameters(vecz1resInner);
1762 fy2I.GetParameters(vecy2resInner);
1763 fz2I.GetParameters(vecz2resInner);
1764 chi2I1y=fy1I.GetChisquare()/(fy1I.GetNpoints()-2);
1765 chi2I1z=fz1I.GetChisquare()/(fz1I.GetNpoints()-2);
1766 chi2I2y=fy2I.GetChisquare()/(fy2I.GetNpoints()-3);
1767 chi2I2z=fz2I.GetChisquare()/(fz2I.GetNpoints()-3);
1770 if ( (outerSector>-1) && (fy1O.GetNpoints()>0) ){
1775 fy1O.GetParameters(vecy1resOuter);
1776 fz1O.GetParameters(vecz1resOuter);
1777 fy2O.GetParameters(vecy2resOuter);
1778 fz2O.GetParameters(vecz2resOuter);
1779 chi2O1y=fy1O.GetChisquare()/(fy1O.GetNpoints()-2);
1780 chi2O1z=fz1O.GetChisquare()/(fz1O.GetNpoints()-2);
1781 chi2O2y=fy2O.GetChisquare()/(fy2O.GetNpoints()-3);
1782 chi2O2z=fz2O.GetChisquare()/(fz2O.GetNpoints()-3);
1785 if ( innerSector>0 && outerSector>0 ){
1786 if (fy4.GetNpoints()>0) {
1788 fy4.GetParameters(vecy4res);
1789 chi2IOy=fy4.GetChisquare()/(fy4.GetNpoints()-5);
1791 if (fz4.GetNpoints()>0) {
1793 fz4.GetParameters(vecz4res);
1794 chi2IOz=fz4.GetChisquare()/(fz4.GetNpoints()-5);
1796 if (fy1IO.GetNpoints()>0) {
1798 fy1IO.GetParameters(vecy1resIO);
1799 chi2IO1y=fy1IO.GetChisquare()/(fy1IO.GetNpoints()-3);
1801 if (fz1IO.GetNpoints()>0) {
1803 fz1IO.GetParameters(vecz1resIO);
1804 chi2IO1z=fz1IO.GetChisquare()/(fz1IO.GetNpoints()-3);
1808 fy4.ClearPoints(); fz4.ClearPoints();
1809 fy1I.ClearPoints(); fy1O.ClearPoints();
1810 fz1I.ClearPoints(); fz1O.ClearPoints();
1811 fy2I.ClearPoints(); fy2O.ClearPoints();
1812 fz2I.ClearPoints(); fz2O.ClearPoints();
1813 fy1IO.ClearPoints(); fz1IO.ClearPoints();
1814 //==============================//
1815 // calculate tracklet positions //
1816 //==============================//
1817 AliDebug(4,"Calculate tracklet positions");
1818 for (Int_t irow=158;irow>-1;--irow) {
1820 AliTPCclusterMI *c=track->GetClusterPointer(irow);
1821 if ( vecSec[irow]!=innerSector && vecSec[irow]!=outerSector ) { // no cluster in given sectors
1825 if (!c) { //no cluster
1828 if (c->GetMax()>kMax){ //saturation
1831 if ( vecSec[irow] == outerSector ) { //extended shape
1832 if (c->GetMax()/c->GetQ()> mqratioOut*kRatioCut) isReject[irow]+=8;
1833 if (TMath::Sqrt(c->GetSigmaY2())>msigmaYOut*kShapeCut) isReject[irow]+=16;
1835 if (c->GetMax()/c->GetQ()> mqratioIn*kRatioCut) isReject[irow]+=8;
1836 if (TMath::Sqrt(c->GetSigmaY2())>msigmaYIn*kShapeCut) isReject[irow]+=16;
1842 if ( vecSec[irow]==-1 ) continue; //no cluster info
1843 if ( vecSec[irow]!=innerSector && vecSec[irow]!=outerSector ) continue;
1845 Double_t x=vecX[irow];
1846 Double_t xref=x-133.4;
1848 Double_t yoffInner=0;
1849 Double_t zoffInner=0;
1850 Double_t yoffInner1=0;
1851 Double_t zoffInner1=0;
1852 Double_t yslopeInner=0;
1853 Double_t yslopeOuter=0;
1854 Double_t zslopeInner=0;
1855 Double_t zslopeOuter=0;
1856 //positions of hyperplane fits
1857 if ( vecSec[irow] == outerSector ) {
1859 vecY1[irow]=vecy1resOuter[0]+vecy1resOuter[1]*xref;
1860 vecZ1[irow]=vecz1resOuter[0]+vecz1resOuter[1]*xref;
1861 vecY2[irow]=vecy2resOuter[0]+vecy2resOuter[1]*xref+vecy2resOuter[2]*xref*xref;
1862 vecZ2[irow]=vecz2resOuter[0]+vecz2resOuter[1]*xref+vecz2resOuter[2]*xref*xref;
1863 yslopeOuter=vecy4res[3];
1864 zslopeOuter=vecz4res[3];
1867 vecY1[irow]=vecy1resInner[0]+vecy1resInner[1]*xref;
1868 vecZ1[irow]=vecz1resInner[0]+vecz1resInner[1]*xref;
1869 vecY2[irow]=vecy2resInner[0]+vecy2resInner[1]*xref+vecy2resInner[2]*xref*xref;
1870 vecZ2[irow]=vecz2resInner[0]+vecz2resInner[1]*xref+vecz2resInner[2]*xref*xref;
1871 yoffInner=vecy4res[1];
1872 zoffInner=vecz4res[1];
1873 yoffInner1=vecy1resIO[1];
1874 zoffInner1=vecz1resIO[1];
1875 yslopeInner=vecy4res[2];
1876 zslopeInner=vecz4res[2];
1878 vecY1IO[irow]=vecy1resIO[0]+yoffInner1+vecy1resIO[2]*xref;
1879 vecZ1IO[irow]=vecz1resIO[0]+zoffInner1+vecz1resIO[2]*xref;
1880 vecY4[irow]=vecy4res[0]+yoffInner+yslopeInner*xref+yslopeOuter*xref+vecy4res[4]*xref*xref;
1881 vecZ4[irow]=vecz4res[0]+zoffInner+zslopeInner*xref+zslopeOuter*xref+vecz4res[4]*xref*xref;
1882 //positions of kalman fits
1883 Double_t gxyz[3],xyz[3];
1884 AliExternalTrackParam *param = 0x0;
1886 param=tr->GetInner();
1888 param->GetXYZ(gxyz);
1889 Float_t bz = AliTracker::GetBz(gxyz);
1890 param->GetYAt(x, bz, xyz[1]);
1891 param->GetZAt(x, bz, xyz[2]);
1892 vecYkalman[irow]=xyz[1];
1893 vecZkalman[irow]=xyz[2];
1900 //=====================================================================//
1901 // write results from the different tracklet fits with debug streamers //
1902 //=====================================================================//
1903 if (fStreamLevel>4){
1904 TTreeSRedirector *cstream = GetDebugStreamer();
1906 Float_t dedx = track->GetdEdx();
1907 (*cstream)<<"FitModels"<<
1908 "run="<<fRun<< // run number
1909 "event="<<fEvent<< // event number
1910 "time="<<fTime<< // time stamp of event
1911 "trigger="<<fTrigger<< // trigger
1912 "mag="<<fMagF<< // magnetic field
1915 "edgeCutX=" << edgeCutX <<
1916 "edgeCutY=" << edgeCutY <<
1917 "nclCut=" << nclCut <<
1918 "innerSector="<< innerSector <<
1919 "outerSector="<< outerSector <<
1922 "Tr.=" << extparam <<
1923 "yPol1In.=" << &vecy1resInner <<
1924 "zPol1In.=" << &vecz1resInner <<
1925 "yPol1InOut.="<< &vecy1resIO <<
1926 "zPol1InOut.="<< &vecz1resIO <<
1927 "yPol2In.=" << &vecy2resInner <<
1928 "zPol2In.=" << &vecz2resInner <<
1929 "yPol1Out.=" << &vecy1resOuter <<
1930 "zPol1Out.=" << &vecz1resOuter <<
1931 "yPol2Out.=" << &vecy2resOuter <<
1932 "zPol2Out.=" << &vecz2resOuter <<
1933 "yInOut.=" << &vecy4res <<
1934 "zInOut.=" << &vecz4res <<
1935 "chi2y1In=" << chi2I1y <<
1936 "chi2z1In=" << chi2I1z <<
1937 "chi2y1InOut="<< chi2IO1y <<
1938 "chi2z1InOut="<< chi2IO1z <<
1939 "chi2y1Out=" << chi2O1y <<
1940 "chi2z1Out=" << chi2O1z <<
1941 "chi2y2In=" << chi2I2y <<
1942 "chi2z2In=" << chi2I2z <<
1943 "chi2y2Out=" << chi2O2y <<
1944 "chi2z2Out=" << chi2O2z <<
1945 "chi2yInOut=" << chi2IOy <<
1946 "chi2zInOut=" << chi2IOz <<
1947 "trletIn.=" << trInner <<
1948 "trletOut.=" << trOuter <<
1951 "xinMin=" << xinMin<<
1952 "xinMax=" << xinMax<<
1953 "xoutMin=" << xoutMin<<
1954 "xoutMax=" << xoutMax<<
1955 "msigmaYIn=" <<msigmaYIn<<
1956 "msigmaYOut=" <<msigmaYOut<<
1957 "mqratioIn=" <<mqratioIn<<
1958 "mqratioOut=" << mqratioOut <<
1963 // wirte residuals information
1964 if (fStreamLevel>5){
1965 TTreeSRedirector *cstream = GetDebugStreamer();
1967 Float_t dedx = track->GetdEdx();
1968 (*cstream)<<"Residuals"<<
1969 "run="<<fRun<< // run number
1970 "event="<<fEvent<< // event number
1971 "time="<<fTime<< // time stamp of event
1972 "trigger="<<fTrigger<< // trigger
1973 "mag="<<fMagF<< // magnetic field
1976 "edgeCutX=" << edgeCutX <<
1977 "edgeCutY=" << edgeCutY <<
1978 "nclCut=" << nclCut <<
1980 "Tr.=" << extparam<<
1983 "vX.=" << &vecgX<< // global x
1984 "vY.=" << &vecgY<< // global y
1985 "vZ.=" << &vecgZ<< // global z
1987 "TrYpol1.=" << &vecY1 <<
1988 "TrZpol1.=" << &vecZ1 <<
1989 "TrYpol2.=" << &vecY2 <<
1990 "TrZpol2.=" << &vecZ2 <<
1991 "TrYpol1InOut.="<< &vecY1IO <<
1992 "TrZpol1InOut.="<< &vecZ1IO <<
1993 "TrYInOut.=" << &vecY4 <<
1994 "TrZInOut.=" << &vecZ4 <<
1995 "ClY.=" << &vecClY <<
1996 "ClZ.=" << &vecClZ <<
1997 "isReject.=" << &isReject<<
1998 "sec.=" << &vecSec <<
2001 "xinMin=" << xinMin<<
2002 "xinMax=" << xinMax<<
2003 "xoutMin=" << xoutMin<<
2004 "xoutMax=" << xoutMax<<
2005 "msigmaYIn=" <<msigmaYIn<<
2006 "msigmaYOut=" <<msigmaYOut<<
2007 "mqratioIn=" <<mqratioIn<<
2008 "mqratioOut=" << mqratioOut <<
2009 "yInOut.=" << &vecy4res <<
2010 "zInOut.=" << &vecz4res <<
2012 "chi2y1In=" << chi2I1y << //
2013 "chi2z1In=" << chi2I1z <<
2014 "chi2y1Out=" << chi2O1y <<
2015 "chi2z1Out=" << chi2O1z <<
2016 "chi2y1InOut="<< chi2IO1y <<
2017 "chi2z1InOut="<< chi2IO1z <<
2018 "chi2y2In=" << chi2I2y <<
2019 "chi2z2In=" << chi2I2z <<
2020 "chi2y2Out=" << chi2O2y <<
2021 "chi2z2Out=" << chi2O2z <<
2022 "chi2yInOut=" << chi2IOy <<
2023 "chi2zInOut=" << chi2IOz <<
2025 "yPol1In.=" << &vecy1resInner <<
2026 "zPol1In.=" << &vecz1resInner <<
2027 "yPol2In.=" << &vecy2resInner <<
2028 "zPol2In.=" << &vecz2resInner <<
2029 "yPol1Out.=" << &vecy1resOuter <<
2030 "zPol1Out.=" << &vecz1resOuter <<
2031 "yPol1InOut.="<< &vecy1resIO <<
2032 "zPol1InOut.="<< &vecz1resIO <<
2033 "yPol2Out.=" << &vecy2resOuter <<
2034 "zPol2Out.=" << &vecz2resOuter <<
2040 //==========================//
2041 // Fill Residual Histograms //
2042 //==========================//
2043 if (!fHisNclIn) MakeFitHistos();
2045 TH2F *profy = (TH2F*)fDeltaYres.UncheckedAt(id);
2046 TH2F *profz = (TH2F*)fDeltaZres.UncheckedAt(id);
2047 TH2F *profy2 = (TH2F*)fDeltaYres2.UncheckedAt(id);
2048 TH2F *profz2 = (TH2F*)fDeltaZres2.UncheckedAt(id);
2049 TH2F *profyabs = (TH2F*)fDeltaYresAbs.UncheckedAt(id);
2050 TH2F *profzabs = (TH2F*)fDeltaZresAbs.UncheckedAt(id);
2051 // TH2F *profy3 = (TH2F*)fDeltaYres3.UncheckedAt(id);
2052 //TH2F *profz3 = (TH2F*)fDeltaZres3.UncheckedAt(id);
2054 for (Int_t irow=158;irow>-1;--irow) {
2055 if (vecSec[irow]==-1)continue; // no cluster info
2056 if (isReject[irow]>0.5) continue; //
2057 Double_t ycl = vecClY[irow];
2058 Double_t yfit = vecY1[irow];
2059 Double_t yfit2 = vecY2[irow];
2060 Double_t x = vecX[irow];
2061 Double_t yabsbeam = -1000;
2062 if(vecSec[irow]==outerSector && outerSector==fBeamSectorOuter[id])
2063 yabsbeam = fBeamSlopeYOuter[id]*x + fBeamOffsetYOuter[id];
2064 else if(innerSector==fBeamSectorInner[id])
2065 yabsbeam = fBeamSlopeYInner[id]*x + fBeamOffsetYInner[id];
2067 // Double_t yfit3 = vecY2[irow];
2068 Double_t zcl = vecClZ[irow];
2069 Double_t zfit = vecZ1[irow];
2070 Double_t zfit2 = vecZ2[irow];
2071 //Double_t zfit3 = vecZ2[irow];
2074 // The expressions for zcorrected has been obtained by
2075 // inverting the fits in the FitDriftV() method (ignoring the
2076 // global y dependence for now):
2078 // 250 - zmeasured = [0] + [1]*(250 - zreal) + .... (yglobal)
2080 // zreal = (zmeasured + [0] - (1-[1])*250.0)/[1]
2083 // 250 + zmeasured = [0] + [1]*(250+zreal) + .... (yglobal)
2085 // zreal = (zmeasured - [0] + (1 - [1])*250.0)/[1]
2087 Double_t dzabs = -1000;
2088 if (ltrp->GetSide()==0){
2089 if ((*fFitAside)[1]>0.) {
2090 // ignore global y dependence for now
2091 Double_t zcorrected = (zcl + (*fFitAside)[0] -
2092 (1.0-(*fFitAside)[1])*250.0)/(*fFitAside)[1];
2093 // zcorrected = zcl;
2094 if(vecSec[irow]==outerSector && (outerSector%36)==fBeamSectorOuter[id])
2095 dzabs = zcorrected -fBeamSlopeZOuter[id]*x -fBeamOffsetZOuter[id];
2096 else if((innerSector%36)==fBeamSectorInner[id])
2097 dzabs = zcorrected -fBeamSlopeZInner[id]*x -fBeamOffsetZInner[id];
2100 if ((*fFitCside)[1]>0.) {
2101 Double_t zcorrected = (zcl - (*fFitCside)[0] +
2102 (1.0-(*fFitCside)[1])*250.0)/(*fFitCside)[1];
2103 // zcorrected = zcl;
2104 if(vecSec[irow]==outerSector && (outerSector%36)==fBeamSectorOuter[id])
2105 dzabs = zcorrected -fBeamSlopeZOuter[id]*x -fBeamOffsetZOuter[id];
2106 else if((innerSector%36)==fBeamSectorInner[id])
2107 dzabs = zcorrected -fBeamSlopeZInner[id]*x -fBeamOffsetZInner[id];
2111 if (TMath::Abs(yfit-ycl)<2&&TMath::Abs(zfit-zcl)<2){
2113 profy->Fill(irow,ycl-yfit);
2114 profy2->Fill(irow,ycl-yfit2);
2116 profyabs->Fill(irow,-0.99);
2118 profyabs->Fill(irow,ycl-yabsbeam);
2120 // profy3->Fill(irow,ycl-yfit3);
2123 profz->Fill(irow,zcl-zfit);
2124 profz2->Fill(irow,zcl-zfit2);
2125 //profz3->Fill(irow,zcl-zfit3);
2127 profzabs->Fill(irow,-0.99);
2129 profzabs->Fill(irow,dzabs);
2135 // Fill laser fit histograms
2137 Float_t dedx = track->GetdEdx();
2138 if (nclI>20&&nclO>20){
2139 fHisNclIn->Fill(id,nclI); //->Number of clusters inner
2140 fHisNclOut->Fill(id,nclO); //->Number of clusters outer
2141 fHisNclIO->Fill(id,nclI+nclO); //->Number of cluster inner outer
2143 fHisLclIn->Fill(id,xinMax-xinMin); //->Level arm inner
2144 fHisLclOut->Fill(id,xoutMax-xoutMin); //->Level arm outer
2145 fHisLclIO->Fill(id,xoutMax-xinMin); //->Number of cluster inner outer
2147 fHisdEdx->Fill(id,TMath::Sqrt(TMath::Abs(dedx)));
2148 fHisdZfit->Fill(id,fFitZ[id]);
2151 fHisChi2YIn1->Fill(id,TMath::Sqrt(chi2I1y)); //->chi2 y inner - line
2152 fHisChi2YOut1->Fill(id,TMath::Sqrt(chi2O1y)); //->chi2 y inner - line
2153 fHisChi2YIn2->Fill(id,TMath::Sqrt(chi2I2y)); //->chi2 y inner - parabola
2154 fHisChi2YOut2->Fill(id,TMath::Sqrt(chi2O2y)); //->chi2 y inner - parabola
2155 fHisChi2YIO1->Fill(id,TMath::Sqrt(chi2IOy)); //->chi2 y IO - common
2158 fHisChi2ZIn1->Fill(id,TMath::Sqrt(chi2I1z)); //->chi2 z inner - line
2159 fHisChi2ZOut1->Fill(id,TMath::Sqrt(chi2O1z)); //->chi2 z inner - line
2160 fHisChi2ZIn2->Fill(id,TMath::Sqrt(chi2O2y)); //->chi2 z inner - parabola
2161 fHisChi2ZOut2->Fill(id,TMath::Sqrt(chi2O2z)); //->chi2 z inner - parabola
2162 fHisChi2ZIO1->Fill(id,TMath::Sqrt(chi2IOz)); //->chi2 z IO - common
2165 fHisPy1vP0->Fill(id,vecy1resOuter[0]-vecy1resInner[0]); //-> delta y P0outer-P0inner - line
2166 fHisPy2vP0->Fill(id,vecy2resOuter[0]-vecy2resInner[0]); //-> delta y P0outer-P0inner - parabola
2167 fHisPy3vP0->Fill(id,vecy4res[1]); //-> delta y P0outer-P0inner - common parabola
2169 fHisPy1vP1->Fill(id,vecy1resOuter[1]-vecy1resInner[1]); //-> delta ky P1outer-P1inner - line
2170 fHisPy2vP1->Fill(id,vecy2resOuter[1]-vecy2resInner[1]); //-> delta ky P1outer-P1inner - parabola
2171 fHisPy3vP1->Fill(id,vecy4res[3]-vecy4res[2]); //-> delta ky P1outer-P1inner - common parabola
2173 fHisPy3vP2IO->Fill(id,vecy4res[4]); //-> Curv P2outerinner - common parabola
2174 fHisPz1vP0->Fill(id,vecz1resOuter[0]-vecz1resInner[0]); //-> delta z P0outer-P0inner - line
2175 fHisPz2vP0->Fill(id,vecz2resOuter[0]-vecz2resInner[0]); //-> delta z P0outer-P0inner - parabola
2176 fHisPz3vP0->Fill(id,vecz4res[1]); //-> delta z P0outer-P0inner - common parabola
2178 fHisPz1vP1->Fill(id,vecz1resOuter[1]-vecz1resInner[1]); //-> delta kz P1outer-P1inner - line
2179 fHisPz2vP1->Fill(id,vecz2resOuter[1]-vecz2resInner[1]); //-> delta kz P1outer-P1inner - parabola
2180 fHisPz3vP1->Fill(id,vecz4res[3]-vecz4res[2]); //-> delta kz P1outer-P1inner - common parabola
2181 fHisPz3vP2IO->Fill(id,vecz4res[4]); //-> Curv P2outerinner - common parabola
2184 fHisPy2vP2In->Fill(id,vecy2resInner[2]); //-> Curv P2inner - parabola
2185 fHisPz2vP2In->Fill(id,vecz2resInner[2]); //-> Curv P2inner - parabola
2189 fHisPz2vP2Out->Fill(id,vecz2resOuter[2]); //-> Curv P2outer - parabola
2190 fHisPy2vP2Out->Fill(id,vecy2resOuter[2]); //-> Curv P2outer - parabola
2198 void AliTPCcalibLaser::DumpMeanInfo(Float_t bfield, Int_t run){
2200 // Dump information about laser beams
2201 // isOK variable indicates usability of the beam
2202 // Beam is not usable if:
2203 // a. No entries in range (krmsCut0)
2204 // b. Big sperad (krmscut1)
2205 // c. RMSto fit sigma bigger then (kmultiCut)
2206 // d. Too big angular spread
2209 const Float_t krmsCut0=0.001;
2210 const Float_t krmsCut1=0.16;
2211 const Float_t kmultiCut=2;
2212 const Float_t kcutP0=0.002;
2214 AliTPCcalibLaser *laser = this;
2215 TTreeSRedirector *pcstream = new TTreeSRedirector("laserMean.root");
2216 TF1 fg("fg","gaus");
2218 // start set up for absolute residuals analysis
2219 //AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
2220 // AliTPCParam * tpcparam = calib->GetParameters();
2221 AliTPCParam * tpcparam = 0;
2222 if (!tpcparam) tpcparam = new AliTPCParamSR;
2224 SetBeamParameters(fBeamOffsetYOuter, fBeamSlopeYOuter, fBeamSectorOuter,0);
2225 SetBeamParameters(fBeamOffsetYInner, fBeamSlopeYInner, fBeamSectorInner,1);
2226 TLinearFitter lfabsyInner(2);
2227 lfabsyInner.SetFormula("1 ++ x");
2228 TLinearFitter lfabszInner(2);
2229 lfabszInner.SetFormula("1 ++ x");
2231 TLinearFitter lfabsyOuter(2);
2232 lfabsyOuter.SetFormula("1 ++ x");
2233 TLinearFitter lfabszOuter(2);
2234 lfabszOuter.SetFormula("1 ++ x");
2235 // end set up for absolute residuals analysis
2239 for (Int_t id=0; id<336; id++){
2241 TH1F * hisphi = (TH1F*)laser->fDeltaPhi.At(id);
2242 TH1F * hisphiP = (TH1F*)laser->fDeltaPhiP.At(id);
2243 TH1F * hisZ = (TH1F*)laser->fDeltaZ.At(id);
2244 TH1F * hisP3 = (TH1F*)laser->fDeltaP3.At(id);
2245 TH1F * hisP4 = (TH1F*)laser->fDeltaP4.At(id);
2246 TH1F * hisS = (TH1F*)laser->fSignals.At(id);
2247 //if (!hisphi) continue;
2248 Double_t entries = (hisphi==0)? 0: hisphi->GetEntries();
2249 //if (entries<minEntries) continue;
2251 AliTPCLaserTrack *ltrp = (AliTPCLaserTrack*)fTracksMirror.At(id);
2253 AliTPCLaserTrack::LoadTracks();
2254 ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
2256 pcstream->GetFile()->cd();
2257 if (hisphi) hisphi->Write();
2258 if (hisphiP) hisphiP->Write();
2259 if (hisZ) hisZ->Write();
2260 if (hisP3) hisP3->Write();
2261 if (hisP4) hisP4->Write();
2263 Float_t meanphi = hisphi->GetMean();
2264 Float_t rmsphi = hisphi->GetRMS();
2266 Float_t meanphiP = hisphiP->GetMean();
2267 Float_t rmsphiP = hisphiP->GetRMS();
2268 Float_t meanZ = hisZ->GetMean();
2269 Float_t rmsZ = hisZ->GetRMS();
2270 if (hisphi->GetRMS()>hisphi->GetBinWidth(1))
2271 hisphi->Fit(&fg,"","",hisphi->GetMean()-4*hisphi->GetRMS(),hisphi->GetMean()+4*hisphi->GetRMS());
2272 Double_t gphi1 = fg.GetParameter(1);
2273 Double_t gphi2 = fg.GetParameter(2);
2274 if (hisphiP->GetRMS()>0)
2275 hisphiP->Fit(&fg,"","",hisphiP->GetMean()-4*hisphiP->GetRMS(),hisphiP->GetMean()+4*hisphiP->GetRMS());
2276 Double_t gphiP1 = fg.GetParameter(1);
2277 Double_t gphiP2 = fg.GetParameter(2);
2279 if (hisZ->GetRMS()>hisZ->GetBinWidth(1))
2280 hisZ->Fit(&fg,"","");
2281 Double_t gz1 = fg.GetParameter(1);
2282 Double_t gz2 = fg.GetParameter(2);
2284 if (hisP3->GetRMS()>hisP3->GetBinWidth(1))
2285 hisP3->Fit(&fg,"","",hisP3->GetMean()-4*hisP3->GetRMS(),hisP3->GetMean()+4*hisP3->GetRMS());
2286 Double_t gp31 = fg.GetParameter(1);
2287 Double_t gp32 = fg.GetParameter(2);
2289 if (hisP4->GetRMS()>hisP4->GetBinWidth(1))
2290 hisP4->Fit(&fg,"","",hisP4->GetMean()-4*hisP4->GetRMS(),hisP4->GetMean()+4*hisP4->GetRMS());
2291 Double_t gp41 = fg.GetParameter(1);
2292 Double_t gp42 = fg.GetParameter(2);
2294 Float_t meanS=hisS->GetMean();
2299 ltrp->GetPxPyPz(lpxyz);
2301 if (rmsphi<krmsCut0) isOK=kFALSE; // empty in range - not entries inside
2302 if (rmsphi>krmsCut1) isOK=kFALSE; // empty in range - not entries inside
2303 if (rmsphi>krmsCut0) if (gphi2/rmsphi>kmultiCut) isOK=kFALSE; // multi peak structure
2304 if (gphiP2>kcutP0) isOK=kFALSE;
2310 his = fHisNclIn->ProjectionY("aaa",id+1,id+1);
2311 Float_t mnclIn = his->GetMean();
2313 his = fHisNclOut->ProjectionY("aaa",id+1,id+1);
2314 Float_t mnclOut = his->GetMean();
2316 his = fHisNclIO->ProjectionY("aaa",id+1,id+1);
2317 Float_t mnclIO = his->GetMean();
2319 his = fHisLclIn->ProjectionY("aaa",id+1,id+1);
2320 Float_t mLclIn = his->GetMean();
2322 his = fHisLclOut->ProjectionY("aaa",id+1,id+1);
2323 Float_t mLclOut = his->GetMean();
2325 his = fHisLclIO->ProjectionY("aaa",id+1,id+1);
2326 Float_t mLclIO = his->GetMean();
2329 his = fHisdEdx->ProjectionY("aaa",id+1,id+1);
2330 Float_t mdEdx = his->GetMean();
2336 his = fHisChi2YIn1->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - line
2337 Float_t mChi2YIn1= his->GetMean();
2339 his = fHisChi2YOut1->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - line
2340 Float_t mChi2YOut1 = his->GetMean();
2342 his = fHisChi2YIn2->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - parabola
2343 Float_t mChi2YIn2 = his->GetMean();
2345 his = fHisChi2YOut2->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - parabola
2346 Float_t mChi2YOut2 = his->GetMean();
2348 his = fHisChi2YIO1->ProjectionY("aaa",id+1,id+1); //->chi2 y IO - common
2349 Float_t mChi2YIO1 = his->GetMean();
2351 his = fHisChi2ZIn1->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - line
2352 Float_t mChi2ZIn1 = his->GetMean();
2354 his = fHisChi2ZOut1->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - line
2355 Float_t mChi2ZOut1 = his->GetMean();
2357 his = fHisChi2ZIn2->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - parabola
2358 Float_t mChi2ZIn2 = his->GetMean();
2360 his = fHisChi2ZOut2->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - parabola
2361 Float_t mChi2ZOut2 = his->GetMean();
2363 his = fHisChi2ZIO1->ProjectionY("aaa",id+1,id+1); //->chi2 z IO - common
2364 Float_t mChi2ZIO1 = his->GetMean();
2369 his = fHisdZfit->ProjectionY("aaa",id+1,id+1);
2370 Float_t edZfit = his->GetEntries();
2371 Float_t mdZfit = his->GetMean();
2372 Float_t rdZfit = his->GetRMS();
2375 his = fHisPy1vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - line
2376 Float_t ePy1vP0 = his->GetEntries();
2377 Float_t mPy1vP0 = his->GetMean();
2378 Float_t rPy1vP0 = his->GetRMS();
2381 his = fHisPy2vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - parabola
2382 Float_t ePy2vP0 = his->GetEntries();
2383 Float_t mPy2vP0 = his->GetMean();
2384 Float_t rPy2vP0 = his->GetRMS();
2387 his = fHisPy3vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - common parabola
2388 Float_t ePy3vP0 = his->GetEntries();
2389 Float_t mPy3vP0 = his->GetMean();
2390 Float_t rPy3vP0 = his->GetRMS();
2393 his = fHisPy1vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - line
2394 Float_t ePy1vP1 = his->GetEntries();
2395 Float_t mPy1vP1 = his->GetMean();
2396 Float_t rPy1vP1 = his->GetRMS();
2399 his = fHisPy2vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - parabola
2400 Float_t ePy2vP1 = his->GetEntries();
2401 Float_t mPy2vP1 = his->GetMean();
2402 Float_t rPy2vP1 = his->GetRMS();
2405 his = fHisPy3vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - common parabola
2406 Float_t ePy3vP1 = his->GetEntries();
2407 Float_t mPy3vP1 = his->GetMean();
2408 Float_t rPy3vP1 = his->GetRMS();
2411 his = fHisPy2vP2In->ProjectionY("aaa",id+1,id+1); //-> Curv P2inner - parabola
2412 Float_t ePy2vP2In = his->GetEntries();
2413 Float_t mPy2vP2In = his->GetMean();
2414 Float_t rPy2vP2In = his->GetRMS();
2417 his = fHisPy2vP2Out->ProjectionY("aaa",id+1,id+1); //-> Curv P2outer - parabola
2418 Float_t ePy2vP2Out = his->GetEntries();
2419 Float_t mPy2vP2Out = his->GetMean();
2420 Float_t rPy2vP2Out = his->GetRMS();
2423 his = fHisPy3vP2IO->ProjectionY("aaa",id+1,id+1); //-> Curv P2outerinner - common parabola
2424 Float_t ePy3vP2IO = his->GetEntries();
2425 Float_t mPy3vP2IO = his->GetMean();
2426 Float_t rPy3vP2IO = his->GetRMS();
2431 his = fHisPz1vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - line
2432 Float_t ePz1vP0 = his->GetEntries();
2433 Float_t mPz1vP0 = his->GetMean();
2434 Float_t rPz1vP0 = his->GetRMS();
2437 his = fHisPz2vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - parabola
2438 Float_t ePz2vP0 = his->GetEntries();
2439 Float_t mPz2vP0 = his->GetMean();
2440 Float_t rPz2vP0 = his->GetRMS();
2443 his = fHisPz3vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - common parabola
2444 Float_t ePz3vP0 = his->GetEntries();
2445 Float_t mPz3vP0 = his->GetMean();
2446 Float_t rPz3vP0 = his->GetRMS();
2449 his = fHisPz1vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - line
2450 Float_t ePz1vP1 = his->GetEntries();
2451 Float_t mPz1vP1 = his->GetMean();
2452 Float_t rPz1vP1 = his->GetRMS();
2455 his = fHisPz2vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - parabola
2456 Float_t ePz2vP1 = his->GetEntries();
2457 Float_t mPz2vP1 = his->GetMean();
2458 Float_t rPz2vP1 = his->GetRMS();
2461 his = fHisPz3vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - common parabola
2462 Float_t ePz3vP1 = his->GetEntries();
2463 Float_t mPz3vP1 = his->GetMean();
2464 Float_t rPz3vP1 = his->GetRMS();
2467 his = fHisPz2vP2In->ProjectionY("aaa",id+1,id+1); //-> Curv P2inner - parabola
2468 Float_t ePz2vP2In = his->GetEntries();
2469 Float_t mPz2vP2In = his->GetMean();
2470 Float_t rPz2vP2In = his->GetRMS();
2473 his = fHisPz2vP2Out->ProjectionY("aaa",id+1,id+1); //-> Curv P2outer - parabola
2474 Float_t ePz2vP2Out = his->GetEntries();
2475 Float_t mPz2vP2Out = his->GetMean();
2476 Float_t rPz2vP2Out = his->GetRMS();
2479 his = fHisPz3vP2IO->ProjectionY("aaa",id+1,id+1); //-> Curv P2outerinner - common parabola
2480 Float_t ePz3vP2IO = his->GetEntries();
2481 Float_t mPz3vP2IO = his->GetMean();
2482 Float_t rPz3vP2IO = his->GetRMS();
2485 // Fit absolute laser residuals
2486 TH2F* histAbsY = (TH2F*)laser->fDeltaYresAbs[id];
2487 TH2F* histAbsZ = (TH2F*)laser->fDeltaZresAbs[id];
2489 Int_t secInner = TMath::Nint(fBeamSectorInner[id]);
2490 Int_t secOuter = TMath::Nint(fBeamSectorOuter[id]);
2492 TVectorD vecX(159); // X
2493 TVectorD vecY(159); // Y
2494 TVectorD vecR(159); // R
2495 TVectorD vecDY(159); // absolute residuals in Y
2496 TVectorD vecDZ(159); // absolute residuals in Z
2497 TVectorD vecN(159); // number of clusters
2498 TVectorD vecEy(159); //error y
2499 TVectorD vecEz(159); //error z
2500 TVectorD vecPhi(159); // local tangent
2501 TVectorD vecPhiR(159); // local tangent
2503 lfabsyInner.ClearPoints();
2504 lfabszInner.ClearPoints();
2505 lfabsyOuter.ClearPoints();
2506 lfabszOuter.ClearPoints();
2509 Float_t yAbsInOffset = -100;
2510 Float_t yAbsInSlope = -100;
2511 Float_t yAbsInDeltay = -100;
2513 Float_t zAbsInOffset = -100;
2514 Float_t zAbsInSlope = -100;
2515 Float_t zAbsInDeltaz = -100;
2517 Float_t yAbsOutOffset = -100;
2518 Float_t yAbsOutSlope = -100;
2519 Float_t yAbsOutDeltay = -100;
2521 Float_t zAbsOutOffset = -100;
2522 Float_t zAbsOutSlope = -100;
2523 Float_t zAbsOutDeltaz = -100;
2525 Float_t lasTanPhiLocIn = -100;
2526 Float_t lasTanPhiLocOut = -100;
2528 if(histAbsY->GetEntries()>0) {
2530 Double_t rotAngOut = 10;
2531 Double_t rotAngIn = 10;
2532 if((secInner%36)!=(secOuter%36))
2533 rotAngIn += 20; // 30 degrees
2535 // Calculate laser mirror X position in local frame
2536 Double_t laserposOut =
2537 TMath::Abs(ltrp->GetX()*TMath::Cos(rotAngOut*TMath::DegToRad()));
2538 Double_t laserposIn =
2539 TMath::Abs(ltrp->GetX()*TMath::Cos(rotAngIn*TMath::DegToRad()));
2541 // Calculate laser tan phi in local frame
2542 lasTanPhiLocOut = TMath::ASin(ltrp->GetSnp());
2543 if(lasTanPhiLocOut<0) {
2544 lasTanPhiLocIn = lasTanPhiLocOut - rotAngIn*TMath::DegToRad();
2545 lasTanPhiLocOut -= rotAngOut*TMath::DegToRad();
2548 lasTanPhiLocIn = lasTanPhiLocOut + rotAngIn*TMath::DegToRad();
2549 lasTanPhiLocOut += rotAngOut*TMath::DegToRad();
2552 lasTanPhiLocIn = TMath::Tan(lasTanPhiLocIn);
2553 lasTanPhiLocOut = TMath::Tan(lasTanPhiLocOut);
2555 TProfile* yprof = histAbsY->ProfileX("yprof");
2556 TProfile* zprof = histAbsZ->ProfileX("zprof");
2558 for(Int_t bin = 1; bin<=159; bin++) {
2560 if(yprof->GetBinEntries(bin)<10&&
2561 zprof->GetBinEntries(bin)<10) {
2565 // There is a problem in defining inner and outer sectors for
2566 // the outer beams (0 and 6) where both sectors are OROCs. To
2567 // make sure there is no overlap row 94 to 99 are cutted.
2568 if(((ltrp->GetBeam()==0)||(ltrp->GetBeam()==6))&&bin>=95&&bin<=100)
2571 Int_t row = (bin-1);
2575 Bool_t isOuter = kTRUE;
2576 Int_t sector = TMath::Nint(fBeamSectorOuter[id]);
2579 (((ltrp->GetBeam()==0)||(ltrp->GetBeam()==6))&&bin<=95)) {
2582 sector = TMath::Nint(fBeamSectorInner[id]);
2586 Double_t x = tpcparam->GetPadRowRadii(sector, row); // slope
2587 vecN[bin-1] =yprof->GetBinEntries(bin);
2588 vecEy[bin-1]=yprof->GetBinError(bin);
2589 vecEz[bin-1]=zprof->GetBinError(bin);
2591 vecDY[bin-1] = yprof->GetBinContent(bin);
2592 vecDZ[bin-1] = zprof->GetBinContent(bin);
2593 if(!isOuter) { // inner
2594 vecPhi[bin-1]=lasTanPhiLocIn;
2595 // Calculate local y from residual and database
2596 Double_t y = fBeamSlopeYInner[id]*x + fBeamOffsetYInner[id]
2599 Double_t r = TMath::Sqrt(x*x + y*y);
2601 // Find angle between laser vector and R vector
2602 // cos angle = (x,y).(1,fBeamSlopeYInner)/R/sqrt(1+fBeamSlopeYInner**2)
2603 Double_t cosPhi = x + y*fBeamSlopeYInner[id];
2604 cosPhi /= r*TMath::Sqrt(1+fBeamSlopeYInner[id]*fBeamSlopeYInner[id]);
2605 vecPhiR[bin-1] = TMath::Tan(TMath::ACos(cosPhi));
2606 if(lasTanPhiLocIn<0)
2607 vecPhiR[bin-1]*=-1; // to have the same sign
2609 if(yprof->GetBinEntries(bin)>=10) {
2610 lfabsyInner.AddPoint(&x, yprof->GetBinContent(bin),
2611 TMath::Max(yprof->GetBinError(bin), 0.001));
2613 if(zprof->GetBinEntries(bin)>=10) {
2614 lfabszInner.AddPoint(&x, zprof->GetBinContent(bin),
2615 TMath::Max(zprof->GetBinError(bin), 0.001));
2618 vecPhi[bin-1]=lasTanPhiLocOut;
2619 // Calculate local y from residual and database
2620 Double_t y = fBeamSlopeYOuter[id]*x + fBeamOffsetYOuter[id]
2623 Double_t r = TMath::Sqrt(x*x + y*y);
2626 Double_t cosPhi = x + y*fBeamSlopeYOuter[id];
2627 cosPhi /= r*TMath::Sqrt(1+fBeamSlopeYOuter[id]*fBeamSlopeYOuter[id]);
2628 vecPhiR[bin-1] = TMath::Tan(TMath::ACos(cosPhi));
2629 if(lasTanPhiLocOut<0)
2630 vecPhiR[bin-1]*=-1; // to have the same sign
2632 if(yprof->GetBinEntries(bin)>=10) {
2633 lfabsyOuter.AddPoint(&x, yprof->GetBinContent(bin),
2634 TMath::Max(yprof->GetBinError(bin), 0.001));
2636 if(zprof->GetBinEntries(bin)>=10) {
2637 lfabszOuter.AddPoint(&x, zprof->GetBinContent(bin),
2638 TMath::Max(zprof->GetBinError(bin), 0.001));
2644 delete yprof; delete zprof;
2647 // Fit laser abs residuals with linear robust fit (exclude 5% outliers)
2648 nClInY = lfabsyInner.GetNpoints();
2649 if(lfabsyInner.GetNpoints()>10) {
2650 lfabsyInner.EvalRobust(0.95);
2653 lfabsyInner.GetParameters(result);
2654 yAbsInOffset = result[0];
2655 yAbsInSlope = result[1];
2656 yAbsInDeltay = yAbsInSlope*laserposIn + yAbsInOffset;
2658 nClInZ = lfabszInner.GetNpoints();
2659 if(lfabszInner.GetNpoints()>10) {
2660 lfabszInner.EvalRobust(0.95);
2663 lfabszInner.GetParameters(result);
2664 zAbsInOffset = result[0];
2665 zAbsInSlope = result[1];
2666 zAbsInDeltaz = zAbsInSlope*laserposIn + zAbsInOffset;
2668 nClOutY = lfabsyOuter.GetNpoints();
2669 if(lfabsyOuter.GetNpoints()>10) {
2670 lfabsyOuter.EvalRobust(0.95);
2673 lfabsyOuter.GetParameters(result);
2674 yAbsOutOffset = result[0];
2675 yAbsOutSlope = result[1];
2676 yAbsOutDeltay = yAbsOutSlope*laserposOut + yAbsOutOffset;
2678 nClOutZ = lfabszOuter.GetNpoints();
2679 if(lfabszOuter.GetNpoints()>10) {
2680 lfabszOuter.EvalRobust(0.95);
2683 lfabszOuter.GetParameters(result);
2684 zAbsOutOffset = result[0];
2685 zAbsOutSlope = result[1];
2686 zAbsOutDeltaz = zAbsOutSlope*laserposOut + zAbsOutOffset;
2692 Float_t coverIA=AliTPCcalibDB::GetCoverVoltage(run,0,itime);
2693 Float_t coverIC=AliTPCcalibDB::GetCoverVoltage(run,18,itime);
2694 Float_t coverOA=AliTPCcalibDB::GetCoverVoltage(run,36,itime);
2695 Float_t coverOC=AliTPCcalibDB::GetCoverVoltage(run,54,itime);
2697 Float_t skirtA=AliTPCcalibDB::GetSkirtVoltage(run,0,itime);
2698 Float_t skirtC=AliTPCcalibDB::GetSkirtVoltage(run,18,itime);
2700 Float_t ggOffA=AliTPCcalibDB::GetGGoffsetVoltage(run,0,itime);
2701 Float_t ggOffC=AliTPCcalibDB::GetGGoffsetVoltage(run,18,itime);
2704 (*pcstream)<<"Mean"<<
2717 "id="<<id<< // track id
2718 "entries="<<entries<< // number of entries
2719 "bz="<<bfield<< // bfield
2720 "LTr.="<<ltrp<< // refernece track
2722 "mnclIn="<<mnclIn<< // mean number of clusters in inner
2723 "mnclOut="<<mnclOut<< // mean number of clusters in outer
2724 "mnclIO="<<mnclIO<< // mean number of clusters in inner+outer
2725 "mLclIn="<<mLclIn<< // mean number of clusters in inner
2726 "mLclOut="<<mLclOut<< // mean number of clusters in outer
2727 "mLclIO="<<mLclIO<< // mean number of clusters in inner+outer
2728 "mdEdx="<<mdEdx<< // mean dEdx
2729 "edZfit="<<edZfit<< // entries z fit
2730 "mdZfit="<<mdZfit<< // mean z fit
2731 "rdZfit="<<rdZfit<< // RMS z fit
2734 "mChi2YIn1="<<mChi2YIn1<< //->chi2 y inner - line
2735 "mChi2YOut1="<<mChi2YOut1<< //->chi2 y inner - line
2736 "mChi2YIn2="<<mChi2YIn2<< //->chi2 y inner - parabola
2737 "mChi2YOut2="<<mChi2YOut2<< //->chi2 y inner - parabola
2738 "mChi2YIO1="<<mChi2YIO1<< //->chi2 y IO - common
2739 "mChi2ZIn1="<<mChi2ZIn1<< //->chi2 z inner - line
2740 "mChi2ZOut1="<<mChi2ZOut1<< //->chi2 z inner - line
2741 "mChi2ZIn2="<<mChi2ZIn2<< //->chi2 z inner - parabola
2742 "mChi2ZOut2="<<mChi2ZOut2<< //->chi2 z inner - parabola
2743 "mChi2ZIO1="<<mChi2ZIO1<< //->chi2 z IO - common
2746 "ePy1vP0="<<ePy1vP0<<
2747 "mPy1vP0="<<mPy1vP0<<
2748 "rPy1vP0="<<rPy1vP0<<
2749 "ePy2vP0="<<ePy2vP0<<
2750 "mPy2vP0="<<mPy2vP0<<
2751 "rPy2vP0="<<rPy2vP0<<
2752 "ePy3vP0="<<ePy3vP0<<
2753 "mPy3vP0="<<mPy3vP0<<
2754 "rPy3vP0="<<rPy3vP0<<
2755 "ePy1vP1="<<ePy1vP1<<
2756 "mPy1vP1="<<mPy1vP1<<
2757 "rPy1vP1="<<rPy1vP1<<
2758 "ePy2vP1="<<ePy2vP1<<
2759 "mPy2vP1="<<mPy2vP1<<
2760 "rPy2vP1="<<rPy2vP1<<
2761 "ePy3vP1="<<ePy3vP1<<
2762 "mPy3vP1="<<mPy3vP1<<
2763 "rPy3vP1="<<rPy3vP1<<
2764 "ePy2vP2In="<<ePy2vP2In<<
2765 "mPy2vP2In="<<mPy2vP2In<<
2766 "rPy2vP2In="<<rPy2vP2In<<
2767 "ePy2vP2Out="<<ePy2vP2Out<<
2768 "mPy2vP2Out="<<mPy2vP2Out<<
2769 "rPy2vP2Out="<<rPy2vP2Out<<
2770 "ePy3vP2IO="<<ePy3vP2IO<<
2771 "mPy3vP2IO="<<mPy3vP2IO<<
2772 "rPy3vP2IO="<<rPy3vP2IO<<
2775 "ePz1vP0="<<ePz1vP0<<
2776 "mPz1vP0="<<mPz1vP0<<
2777 "rPz1vP0="<<rPz1vP0<<
2778 "ePz2vP0="<<ePz2vP0<<
2779 "mPz2vP0="<<mPz2vP0<<
2780 "rPz2vP0="<<rPz2vP0<<
2781 "ePz3vP0="<<ePz3vP0<<
2782 "mPz3vP0="<<mPz3vP0<<
2783 "rPz3vP0="<<rPz3vP0<<
2784 "ePz1vP1="<<ePz1vP1<<
2785 "mPz1vP1="<<mPz1vP1<<
2786 "rPz1vP1="<<rPz1vP1<<
2787 "ePz2vP1="<<ePz2vP1<<
2788 "mPz2vP1="<<mPz2vP1<<
2789 "rPz2vP1="<<rPz2vP1<<
2790 "ePz3vP1="<<ePz3vP1<<
2791 "mPz3vP1="<<mPz3vP1<<
2792 "rPz3vP1="<<rPz3vP1<<
2793 "ePz2vP2In="<<ePz2vP2In<<
2794 "mPz2vP2In="<<mPz2vP2In<<
2795 "rPz2vP2In="<<rPz2vP2In<<
2796 "ePz2vP2Out="<<ePz2vP2Out<<
2797 "mPz2vP2Out="<<mPz2vP2Out<<
2798 "rPz2vP2Out="<<rPz2vP2Out<<
2799 "ePz3vP2IO="<<ePz3vP2IO<<
2800 "mPz3vP2IO="<<mPz3vP2IO<<
2801 "rPz3vP2IO="<<rPz3vP2IO<<
2805 "lx0="<<lxyz[0]<< // reference x
2806 "lx1="<<lxyz[1]<< // reference y
2807 "lx2="<<lxyz[2]<< // refernece z
2808 "lpx0="<<lpxyz[0]<< // reference x
2809 "lpx1="<<lpxyz[1]<< // reference y
2810 "lpx2="<<lpxyz[2]<< // refernece z
2814 "mphi="<<meanphi<< //
2815 "rmsphi="<<rmsphi<< //
2819 "mphiP="<<meanphiP<< //
2820 "rmsphiP="<<rmsphiP<< //
2829 "gp31="<<gp31<< //gaus mean - tgl
2830 "gp32="<<gp32<< //gaus rms -tgl
2831 "gp41="<<gp41<< //gaus mean - P4
2832 "gp42="<<gp42<< //gaus rms - P4
2833 // Parameters from abs res analysis
2834 "SecIn="<<secInner<< // inner sector
2835 "SecOut="<<secOuter<< // outer sector
2836 "lasTanPhiLocIn="<<lasTanPhiLocIn<< // laser tan phi in local frame (inner)
2837 "lasTanPhiLocOut="<<lasTanPhiLocOut<<// laser tan phi in local frame (outer)
2838 "X.="<<&vecX<< // local x
2839 "Y.="<<&vecY<< // local y
2840 "R.="<<&vecR<< // radius
2841 "dY.="<<&vecDY<< // abs y residuals
2842 "dZ.="<<&vecDZ<< // abs z residuals
2843 "eY.="<<&vecEy<< // error of y residuals
2844 "eZ.="<<&vecEz<< // error of z residuals
2845 "kY.="<<&vecPhi<< // local tangent y (fixed for sector)
2846 "kYR.="<<&vecPhiR<< // tangent between laser and R vector (varies inside sector)
2847 "nCl.="<<&vecN<< // number of clusters
2849 "nClInY="<<nClInY<< // Number of clusters for inner y
2850 "yAbsInOffset="<<yAbsInOffset<< // fitted offset absres (inner y)
2851 "yAbsInSlope="<<yAbsInSlope << // fitted slope absres (inner y)
2852 "yAbsInDeltay="<<yAbsInDeltay<< // fitted laser offset absres (inner y)
2853 "nClInZ="<<nClInZ<< // Number of clusters for inner z
2854 "zAbsInOffset="<<zAbsInOffset<< // fitted offset absres (inner z)
2855 "zAbsInSlope="<<zAbsInSlope << // fitted slope absres (inner z)
2856 "zAbsInDeltaz="<<zAbsInDeltaz<< // fitted laser offset absres (inner z)
2858 "nClOutY="<<nClOutY<< // Number of clusters for outer y
2859 "yAbsOutOffset="<<yAbsOutOffset<< // fitted offset absres (outer y)
2860 "yAbsOutSlope="<<yAbsOutSlope << // fitted slope absres (outer y)
2861 "yAbsOutDeltay="<<yAbsOutDeltay<< // fitted laser offset absres (outer y)
2862 "nClOutZ="<<nClOutZ<< // Number of clusters for outer z
2863 "zAbsOutOffset="<<zAbsOutOffset<< // fitted offset absres (outer z)
2864 "zAbsOutSlope="<<zAbsOutSlope << // fitted slope absres (outer z)
2865 "zAbsOutDeltaz="<<zAbsOutDeltaz<< // fitted laser offset absres (outer z)
2872 TFile fmean("laserMean.root");
2882 void AliTPCcalibLaser::DumpScanInfo(TTree * chain, const char * cutUser){
2886 TTreeSRedirector *pcstream = new TTreeSRedirector("laserScan.root");
2887 TFile * f = pcstream->GetFile();
2889 f->mkdir("dirphiP");
2891 TF1 fp("p1","pol1");
2896 char grnamefull[1000];
2899 Double_t mphiP[100];
2900 Double_t smphi[100];
2901 Double_t smphiP[100];
2912 for (Int_t id=0; id<336; id++){
2914 sprintf(cut,"fId==%d&&%s",id,cutUser);
2915 Int_t entries = chain->Draw("bz",cut,"goff");
2916 if (entries<3) continue;
2917 AliTPCLaserTrack *ltrp = 0;
2918 if (!AliTPCLaserTrack::GetTracks()) AliTPCLaserTrack::LoadTracks();
2919 ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
2923 ltrp->GetPxPyPz(lpxyz);
2925 chain->Draw("bz",cut,"goff");
2926 memcpy(bz, chain->GetV1(), entries*sizeof(Double_t));
2927 chain->Draw("0.01*abs(bz)+0.02",cut,"goff");
2928 memcpy(sbz, chain->GetV1(), entries*sizeof(Double_t));
2930 chain->Draw("gphi1",cut,"goff");
2931 memcpy(mphi, chain->GetV1(), entries*sizeof(Double_t));
2932 chain->Draw("0.05*abs(mphi)+abs(gphi2)*0.5+0.05",cut,"goff");
2933 memcpy(smphi, chain->GetV1(), entries*sizeof(Double_t));
2935 chain->Draw("gphiP1",cut,"goff");
2936 memcpy(mphiP, chain->GetV1(), entries*sizeof(Double_t));
2937 chain->Draw("0.05*abs(mphiP)+abs(gphiP2)*0.5+0.001",cut,"goff");
2938 memcpy(smphiP, chain->GetV1(), entries*sizeof(Double_t));
2940 chain->Draw("gz1",cut,"goff");
2941 memcpy(mZ, chain->GetV1(), entries*sizeof(Double_t));
2942 chain->Draw("0.01*abs(meanZ)+abs(gz2)*0.5+0.1",cut,"goff");
2943 memcpy(smZ, chain->GetV1(), entries*sizeof(Double_t));
2946 sprintf(grnamefull,"Side_%d_Bundle_%d_Rod_%d_Beam_%d",
2947 ltrp->GetSide(), ltrp->GetBundle(), ltrp->GetRod(), ltrp->GetBeam());
2954 for (Int_t ientry=0; ientry<entries; ientry++){
2955 if (TMath::Abs(bz[ientry])<0.05){
2956 phiB0 = mphi[ientry];
2957 phiPB0 = mphiP[ientry];
2961 TGraphErrors *grphi = new TGraphErrors(entries,bz,mphi,sbz,smphi);
2964 pphi[0] = fp.GetParameter(0); // offset
2965 pphi[1] = fp.GetParameter(1); // slope
2966 pphi[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2967 sprintf(grname,"phi_id%d",id);
2968 grphi->SetName(grname); grphi->SetTitle(grnamefull);
2969 grphi->GetXaxis()->SetTitle("b_{z} (T)");
2970 grphi->GetYaxis()->SetTitle("#Delta r#phi (cm)");
2971 grphi->SetMaximum(1.2);
2972 grphi->SetMinimum(-1.2);
2976 gPad->SaveAs(Form("pic/phi/phi_%s.gif",grnamefull));
2979 TGraphErrors *grphiP = new TGraphErrors(entries,bz,mphiP,sbz,smphiP);
2982 pphiP[0] = fp.GetParameter(0); // offset
2983 pphiP[1] = fp.GetParameter(1); // slope
2984 pphiP[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2985 sprintf(grname,"phiP_id%d",id);
2986 grphiP->SetName(grname); grphiP->SetTitle(grnamefull);
2987 grphiP->GetXaxis()->SetTitle("b_{z} (T)");
2988 grphiP->GetYaxis()->SetTitle("#Delta #phi (rad)");
2989 grphiP->SetMaximum(pphiP[0]+0.005);
2990 grphiP->SetMinimum(pphiP[0]-0.005);
2992 gPad->SaveAs(Form("pic/phiP/phiP_%s.gif",grnamefull));
2997 TGraphErrors *grmZ = new TGraphErrors(entries,bz,mZ,sbz,smZ);
3000 pmZ[0] = fp.GetParameter(0); // offset
3001 pmZ[1] = fp.GetParameter(1); // slope
3002 pmZ[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
3003 sprintf(grname,"mZ_id%d",id);
3004 grmZ->SetName(grname); grmZ->SetTitle(grnamefull);
3005 grmZ->GetXaxis()->SetTitle("b_{z} (T)");
3006 grmZ->GetYaxis()->SetTitle("#Delta z (cm)");
3008 gPad->SaveAs(Form("pic/z/z_%s.gif",grnamefull));
3014 for (Int_t ientry=0; ientry<entries; ientry++){
3015 (*pcstream)<<"Mean"<<
3018 "entries="<<entries<<
3020 "lx0="<<lxyz[0]<< // reference x
3021 "lx1="<<lxyz[1]<< // reference y
3022 "lx2="<<lxyz[2]<< // refernece z
3023 "lpx0="<<lpxyz[0]<< // reference x
3024 "lpx1="<<lpxyz[1]<< // reference y
3025 "lpx2="<<lpxyz[2]<< // refernece z
3027 "phiB0="<<phiB0<< // position shift at 0 field
3028 "phiPB0="<<phiPB0<< // angular shift at 0 field
3029 "zB0="<<zB0<< // z shift for 0 field
3031 "gphi1="<<mphi[ientry]<< // mean - from gaus fit
3032 "pphi0="<<pphi[0]<< // offset
3033 "pphi1="<<pphi[1]<< // slope
3034 "pphi2="<<pphi[2]<< // norm chi2
3036 "gphiP1="<<mphiP[ientry]<< // mean - from gaus fit
3037 "pphiP0="<<pphiP[0]<< // offset
3038 "pphiP1="<<pphiP[1]<< // slope
3039 "pphiP2="<<pphiP[2]<< // norm chi2
3041 "gz1="<<mZ[ientry]<<
3042 "pmZ0="<<pmZ[0]<< // offset
3043 "pmZ1="<<pmZ[1]<< // slope
3044 "pmZ2="<<pmZ[2]<< // norm chi2
3054 void AliTPCcalibLaser::Analyze(){
3061 Long64_t AliTPCcalibLaser::Merge(TCollection *li) {
3063 TIterator* iter = li->MakeIterator();
3064 AliTPCcalibLaser* cal = 0;
3065 static Int_t counter0=0;
3066 while ((cal = (AliTPCcalibLaser*)iter->Next())) {
3067 if (!cal->InheritsFrom(AliTPCcalibLaser::Class())) {
3068 // Error("Merge","Attempt to add object of class %s to a %s", cal->ClassName(), this->ClassName());
3071 printf("Marging number %d\n", counter0);
3074 MergeFitHistos(cal);
3079 // TProfile *hp=0x0;
3080 //TProfile *hpm=0x0;
3082 for (Int_t id=0; id<336; id++){
3083 // merge fDeltaZ histograms
3084 hm = (TH1F*)cal->fDeltaZ.At(id);
3085 h = (TH1F*)fDeltaZ.At(id);
3087 h=new TH1F(Form("hisdz%d",id),Form("hisdz%d",id),1000,-10,10);
3089 fDeltaZ.AddAt(h,id);
3092 // merge fP3 histograms
3093 hm = (TH1F*)cal->fDeltaP3.At(id);
3094 h = (TH1F*)fDeltaP3.At(id);
3096 h=new TH1F(Form("hisPar3v%d",id),Form("hisPar3v%d",id),400,-0.06,0.06);
3098 fDeltaP3.AddAt(h,id);
3101 // merge fP4 histograms
3102 hm = (TH1F*)cal->fDeltaP4.At(id);
3103 h = (TH1F*)fDeltaP4.At(id);
3105 h=new TH1F(Form("hisPar4v%d",id),Form("hisPar4v%d",id),200,-0.06,0.06);
3107 fDeltaP4.AddAt(h,id);
3112 // merge fDeltaPhi histograms
3113 hm = (TH1F*)cal->fDeltaPhi.At(id);
3114 h = (TH1F*)fDeltaPhi.At(id);
3116 h= new TH1F(Form("hisdphi%d",id),Form("hisdphi%d",id),1000,-1,1);
3118 fDeltaPhi.AddAt(h,id);
3121 // merge fDeltaPhiP histograms
3122 hm = (TH1F*)cal->fDeltaPhiP.At(id);
3123 h = (TH1F*)fDeltaPhiP.At(id);
3125 h=new TH1F(Form("hisdphiP%d",id),Form("hisdphiP%d",id),1000,-0.01,0.01);
3127 fDeltaPhiP.AddAt(h,id);
3130 // merge fSignals histograms
3131 hm = (TH1F*)cal->fSignals.At(id);
3132 h = (TH1F*)fSignals.At(id);
3134 h=new TH1F(Form("hisSignal%d",id),Form("hisSignal%d",id),100,0,300);
3136 fSignals.AddAt(h,id);
3141 // merge ProfileY histograms -0
3142 h2m = (TH2F*)cal->fDeltaYres.At(id);
3143 h2 = (TH2F*)fDeltaYres.At(id);
3144 if (h2m&&h2) h2->Add(h2m);
3146 h2m = (TH2F*)cal->fDeltaZres.At(id);
3147 h2 = (TH2F*)fDeltaZres.At(id);
3148 if (h2m&&h2) h2->Add(h2m);
3149 // merge ProfileY histograms - 2
3150 h2m = (TH2F*)cal->fDeltaYres2.At(id);
3151 h2 = (TH2F*)fDeltaYres2.At(id);
3152 if (h2m&&h2) h2->Add(h2m);
3154 h2m = (TH2F*)cal->fDeltaZres2.At(id);
3155 h2 = (TH2F*)fDeltaZres2.At(id);
3156 if (h2m&&h2) h2->Add(h2m);
3158 // merge ProfileY histograms - abs
3159 h2m = (TH2F*)cal->fDeltaYresAbs.At(id);
3160 h2 = (TH2F*)fDeltaYresAbs.At(id);
3161 if (h2m&&h2) h2->Add(h2m);
3163 h2m = (TH2F*)cal->fDeltaZresAbs.At(id);
3164 h2 = (TH2F*)fDeltaZresAbs.At(id);
3165 if (h2m&&h2) h2->Add(h2m);
3166 // merge ProfileY histograms - 3
3167 //h2m = (TH2F*)cal->fDeltaYres3.At(id);
3168 //h2 = (TH2F*)fDeltaYres3.At(id);
3169 //if (h2m) h2->Add(h2m);
3171 //h2m = (TH2F*)cal->fDeltaZres3.At(id);
3172 //h2 = (TH2F*)fDeltaZres3.At(id);
3173 //if (h2m) h->Add(h2m);
3181 void AliTPCcalibLaser::MakeFitHistos(){
3183 // Make a fit histograms
3185 // Number of clusters
3187 //TH2F *fHisNclIn; //->Number of clusters inner
3188 //TH2F *fHisNclOut; //->Number of clusters outer
3189 //TH2F *fHisNclIO; //->Number of cluster inner outer
3190 // TH2F *fHisdEdx; //->dEdx histo
3191 fHisNclIn = new TH2F("HisNclIn","HisNclIn",336,0,336,64,10,64);
3192 fHisNclOut = new TH2F("HisNclOut","HisNclOut",336,0,336,100,10,100);
3193 fHisNclIO = new TH2F("HisNclIO","HisNclIO",336,0,336,160,10,160);
3195 fHisLclIn = new TH2F("HisLclIn","HisLclIn",336,0,336,64,10,64);
3196 fHisLclOut = new TH2F("HisLclOut","HisLclOut",336,0,336,100,10,150);
3197 fHisLclIO = new TH2F("HisLclIO","HisLclIO",336,0,336,160,10,160);
3199 fHisdEdx = new TH2F("HisdEdx","HisdEdx",336,0,336,160,1,50);
3200 fHisdZfit = new TH2F("HisdZfit","HisdZfit",336,0,336,300,-0.3,0.3);
3205 // TH2F *fHisChi2YIn1; //->chi2 y inner - line
3206 // TH2F *fHisChi2YOut1; //->chi2 y inner - line
3207 // TH2F *fHisChi2YIn2; //->chi2 y inner - parabola
3208 // TH2F *fHisChi2YOut2; //->chi2 y inner - parabola
3209 // TH2F *fHisChi2YIO1; //->chi2 y IO - common
3210 fHisChi2YIn1 = new TH2F("Chi2YIn1","Chi2YIn1",336,0,336,500,0.001,0.5);
3211 fHisChi2YOut1 = new TH2F("Chi2YOut1","Chi2YOut1",336,0,336,500,0.001,0.5);
3212 fHisChi2YIn2 = new TH2F("Chi2YIn2","Chi2YIn2",336,0,336,500,0.001,0.5);
3213 fHisChi2YOut2 = new TH2F("Chi2YOut2","Chi2YOut2",336,0,336,500,0.001,0.5);
3214 fHisChi2YIO1 = new TH2F("Chi2YIO1","Chi2YIO1",336,0,336,500,0.001,0.5);
3215 // TH2F *fHisChi2ZIn1; //->chi2 z inner - line
3216 // TH2F *fHisChi2ZOut1; //->chi2 z inner - line
3217 // TH2F *fHisChi2ZIn2; //->chi2 z inner - parabola
3218 // TH2F *fHisChi2ZOut2; //->chi2 z inner - parabola
3219 // TH2F *fHisChi2ZIO1; //->chi2 z IO - common
3220 fHisChi2ZIn1 = new TH2F("Chi2ZIn1","Chi2ZIn1",336,0,336,500,0.001,0.5);
3221 fHisChi2ZOut1 = new TH2F("Chi2ZOut1","Chi2ZOut1",336,0,336,500,0.001,0.5);
3222 fHisChi2ZIn2 = new TH2F("Chi2ZIn2","Chi2ZIn2",336,0,336,500,0.001,0.5);
3223 fHisChi2ZOut2 = new TH2F("Chi2ZOut2","Chi2ZOut2",336,0,336,500,0.001,0.5);
3224 fHisChi2ZIO1 = new TH2F("Chi2ZIO1","Chi2ZIO1",336,0,336,500,0.001,0.5);
3229 // TH2F *fHisPy1vP0; //-> delta y P0outer-P0inner - line
3230 // TH2F *fHisPy2vP0; //-> delta y P0outer-P0inner - parabola
3231 // TH2F *fHisPy3vP0; //-> delta y P0outer-P0inner - common parabola
3232 // TH2F *fHisPy1vP1; //-> delta ky P1outer-P1inner - line
3233 // TH2F *fHisPy2vP1; //-> delta ky P1outer-P1inner - parabola
3234 // TH2F *fHisPy3vP1; //-> delta ky P1outer-P1inner - common parabola
3235 // TH2F *fHisPy2vP2In; //-> Curv P2inner - parabola
3236 // TH2F *fHisPy2vP2Out; //-> Curv P2outer - parabola
3237 // TH2F *fHisPy3vP2IO; //-> Curv P2outerinner - common parabola
3238 fHisPy1vP0 = new TH2F("HisPy1vP0", "HisPy1vP0",336,0,336,500,-0.3,0.3);
3239 fHisPy2vP0 = new TH2F("HisPy2vP0", "HisPy2vP0",336,0,336,500,-0.3,0.3);
3240 fHisPy3vP0 = new TH2F("HisPy3vP0", "HisPy3vP0",336,0,336,500,-0.3,0.3);
3241 fHisPy1vP1 = new TH2F("HisPy1vP1", "HisPy1vP1",336,0,336,500,-0.01,0.01);
3242 fHisPy2vP1 = new TH2F("HisPy2vP1", "HisPy2vP1",336,0,336,500,-0.01,0.01);
3243 fHisPy3vP1 = new TH2F("HisPy3vP1", "HisPy3vP1",336,0,336,500,-0.01,0.01);
3244 fHisPy2vP2In = new TH2F("HisPy2vP2In", "HisPy2vP2In",336,0,336,500,-0.0003,0.0003);
3245 fHisPy2vP2Out= new TH2F("HisPy2vP2Out","HisPy2vP2Out",336,0,336,500,-0.0003,0.0003);
3246 fHisPy3vP2IO = new TH2F("HisPy3vP2IO", "HisPy3vP2IO",336,0,336,500,-0.0003,0.0003);
3249 // TH2F *fHisPz1vP0; //-> delta z P0outer-P0inner - line
3250 // TH2F *fHisPz2vP0; //-> delta z P0outer-P0inner - parabola
3251 // TH2F *fHisPz3vP0; //-> delta z P0outer-P0inner - common parabola
3252 // TH2F *fHisPz1vP1; //-> delta kz P1outer-P1inner - line
3253 // TH2F *fHisPz2vP1; //-> delta kz P1outer-P1inner - parabola
3254 // TH2F *fHisPz3vP1; //-> delta kz P1outer-P1inner - common parabola
3255 // TH2F *fHisPz2vP2In; //-> Curv P2inner - parabola
3256 // TH2F *fHisPz2vP2Out; //-> Curv P2outer - parabola
3257 // TH2F *fHisPz3vP2IO; //-> Curv P2outerinner - common parabola
3258 fHisPz1vP0 = new TH2F("HisPz1vP0", "HisPz1vP0",336,0,336,500,-0.3,0.3);
3259 fHisPz2vP0 = new TH2F("HisPz2vP0", "HisPz2vP0",336,0,336,500,-0.3,0.3);
3260 fHisPz3vP0 = new TH2F("HisPz3vP0", "HisPz3vP0",336,0,336,500,-0.3,0.3);
3261 fHisPz1vP1 = new TH2F("HisPz1vP1", "HisPz1vP1",336,0,336,500,-0.01,0.01);
3262 fHisPz2vP1 = new TH2F("HisPz2vP1", "HisPz2vP1",336,0,336,500,-0.01,0.01);
3263 fHisPz3vP1 = new TH2F("HisPz3vP1", "HisPz3vP1",336,0,336,500,-0.01,0.01);
3264 fHisPz2vP2In = new TH2F("HisPz2vP2In", "HisPz2vP2In",336,0,336,500,-0.0003,0.0003);
3265 fHisPz2vP2Out= new TH2F("HisPz2vP2Out","HisPz2vP2Out",336,0,336,500,-0.0002,0.0002);
3266 fHisPz3vP2IO = new TH2F("HisPz3vP2IO", "HisPz3vP2IO",336,0,336,500,-0.0002,0.0002);
3268 fHisNclIn->SetDirectory(0); //->Number of clusters inner
3269 fHisNclOut->SetDirectory(0); //->Number of clusters outer
3270 fHisNclIO->SetDirectory(0); //->Number of cluster inner outer
3271 fHisLclIn->SetDirectory(0); //->Level arm inner
3272 fHisLclOut->SetDirectory(0); //->Level arm outer
3273 fHisLclIO->SetDirectory(0); //->Number of cluster inner outer
3274 fHisdEdx->SetDirectory(0); //->Number of cluster inner outer
3275 fHisdZfit->SetDirectory(0); //->Number of cluster inner outer
3278 fHisChi2YIn1->SetDirectory(0); //->chi2 y inner - line
3279 fHisChi2YOut1->SetDirectory(0); //->chi2 y inner - line
3280 fHisChi2YIn2->SetDirectory(0); //->chi2 y inner - parabola
3281 fHisChi2YOut2->SetDirectory(0); //->chi2 y inner - parabola
3282 fHisChi2YIO1->SetDirectory(0); //->chi2 y IO - common
3283 fHisChi2ZIn1->SetDirectory(0); //->chi2 z inner - line
3284 fHisChi2ZOut1->SetDirectory(0); //->chi2 z inner - line
3285 fHisChi2ZIn2->SetDirectory(0); //->chi2 z inner - parabola
3286 fHisChi2ZOut2->SetDirectory(0); //->chi2 z inner - parabola
3287 fHisChi2ZIO1->SetDirectory(0); //->chi2 z IO - common
3290 fHisPy1vP0->SetDirectory(0); //-> delta y P0outer-P0inner - line
3291 fHisPy2vP0->SetDirectory(0); //-> delta y P0outer-P0inner - parabola
3292 fHisPy3vP0->SetDirectory(0); //-> delta y P0outer-P0inner - common parabola
3293 fHisPy1vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - line
3294 fHisPy2vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - parabola
3295 fHisPy3vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - common parabola
3296 fHisPy2vP2In->SetDirectory(0); //-> Curv P2inner - parabola
3297 fHisPy2vP2Out->SetDirectory(0); //-> Curv P2outer - parabola
3298 fHisPy3vP2IO->SetDirectory(0); //-> Curv P2outerinner - common parabola
3301 fHisPz1vP0->SetDirectory(0); //-> delta z P0outer-P0inner - line
3302 fHisPz2vP0->SetDirectory(0); //-> delta z P0outer-P0inner - parabola
3303 fHisPz3vP0->SetDirectory(0); //-> delta z P0outer-P0inner - common parabola
3304 fHisPz1vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - line
3305 fHisPz2vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - parabola
3306 fHisPz3vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - common parabola
3307 fHisPz2vP2In->SetDirectory(0); //-> Curv P2inner - parabola
3308 fHisPz2vP2Out->SetDirectory(0); //-> Curv P2outer - parabola
3309 fHisPz3vP2IO->SetDirectory(0); //-> Curv P2outerinner - common parabola
3315 for (Int_t id=0; id<336;id++){
3316 TH2F *profy = (TH2F*)fDeltaYres.UncheckedAt(id);
3317 TH2F *profz = (TH2F*)fDeltaZres.UncheckedAt(id);
3318 TH2F *profy2 = (TH2F*)fDeltaYres2.UncheckedAt(id);
3319 TH2F *profz2 = (TH2F*)fDeltaZres2.UncheckedAt(id);
3320 TH2F *profyabs = (TH2F*)fDeltaYresAbs.UncheckedAt(id);
3321 TH2F *profzabs = (TH2F*)fDeltaYresAbs.UncheckedAt(id);
3322 // TH2F *profy3 = (TH2F*)fDeltaYres3.UncheckedAt(id);
3323 //TH2F *profz3 = (TH2F*)fDeltaZres3.UncheckedAt(id);
3325 profy=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d -Linear",id),160,0,160,50,-0.5,0.5);
3326 profy->SetDirectory(0);
3327 fDeltaYres.AddAt(profy,id);
3328 profy2=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d -Parabolic",id),160,0,160,50,-0.5,0.5);
3329 profy2->SetDirectory(0);
3330 fDeltaYres2.AddAt(profy2,id);
3331 profyabs=new TH2F(Form("pryabs%03d",id),Form("Y Residuals for Laser Beam %03d -Absolute",id),160,0,160,100,-1.0,1.0); // has to be bigger based on earlier studies
3332 profyabs->SetDirectory(0);
3333 fDeltaYresAbs.AddAt(profyabs,id);
3334 //profy3=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d- Parabolic2",id),160,0,160,100,-0.5,0.5);
3335 //profy3->SetDirectory(0);
3336 //fDeltaYres3.AddAt(profy3,id);
3339 profz=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d Linear",id),160,0,160,50,-0.5,0.5);
3340 profz->SetDirectory(0);
3341 fDeltaZres.AddAt(profz,id);
3342 profz2=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d - Parabolic",id),160,0,160,50,-0.5,0.5);
3343 profz2->SetDirectory(0);
3344 fDeltaZres2.AddAt(profz2,id);
3345 profzabs=new TH2F(Form("przabs%03d",id),Form("Z Residuals for Laser Beam %03d -Absolute",id),160,0,160,100,-1.0,1.0); // has to be bigger based on earlier studies
3346 profzabs->SetDirectory(0);
3347 fDeltaZresAbs.AddAt(profzabs,id);
3348 //profz3=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d- Parabolic2",id),160,0,160,100,-0.5,0.5);
3349 //profz3->SetDirectory(0);
3350 //fDeltaZres3.AddAt(profz3,id);
3355 for (Int_t id=0; id<336;id++){
3356 TH1F * hisdz = (TH1F*)fDeltaZ.At(id);
3357 TH1F * hisP3 = (TH1F*)fDeltaP3.At(id);
3358 TH1F * hisP4 = (TH1F*)fDeltaP4.At(id);
3360 TH1F * hisdphi = (TH1F*)fDeltaPhi.At(id);
3361 TH1F * hisdphiP = (TH1F*)fDeltaPhiP.At(id);
3362 TH1F * hisSignal = (TH1F*)fSignals.At(id);
3365 hisdz = new TH1F(Form("hisdz%d",id),Form("hisdz%d",id),1000,-10,10);
3366 hisdz->SetDirectory(0);
3367 fDeltaZ.AddAt(hisdz,id);
3369 hisP3 = new TH1F(Form("hisPar3v%d",id),Form("hisPar3v%d",id),400,-0.06,0.06);
3370 hisP3->SetDirectory(0);
3371 fDeltaP3.AddAt(hisP3,id);
3373 hisP4 = new TH1F(Form("hisPar4v%d",id),Form("hisPar4v%d",id),200,-0.06,0.06);
3374 hisP4->SetDirectory(0);
3375 fDeltaP4.AddAt(hisP4,id);
3378 hisdphi = new TH1F(Form("hisdphi%d",id),Form("hisdphi%d",id),1000,-1,1);
3379 hisdphi->SetDirectory(0);
3380 fDeltaPhi.AddAt(hisdphi,id);
3382 hisdphiP = new TH1F(Form("hisdphiP%d",id),Form("hisdphiP%d",id),1000,-0.01,0.01);
3383 hisdphiP->SetDirectory(0);
3384 fDeltaPhiP.AddAt(hisdphiP,id);
3385 hisSignal = new TH1F(Form("hisSignal%d",id),Form("hisSignal%d",id),100,0,300);
3386 hisSignal->SetDirectory(0);
3387 fSignals.AddAt(hisSignal,id);
3391 SetBeamParameters(fBeamOffsetZOuter, fBeamSlopeZOuter, fBeamSectorOuter,2);
3392 SetBeamParameters(fBeamOffsetZInner, fBeamSlopeZInner, fBeamSectorInner,3);
3393 SetBeamParameters(fBeamOffsetYOuter, fBeamSlopeYOuter, fBeamSectorOuter,0);
3394 SetBeamParameters(fBeamOffsetYInner, fBeamSlopeYInner, fBeamSectorInner,1);
3398 // id side rod bundle beam dP0 dP1 dP2 dP3 dP4 ncl dEdx
3399 Int_t binsLaser[12]= {336, //id
3411 Double_t xminLaser[12]= {0, //id
3423 Double_t xmaxLaser[12]= {336, //id
3436 TString nameLaser[12]= {"id",
3448 TString titleLaser[12]= {"id",
3460 fHisLaser = new THnSparseS("dLaser","#Delta_{Laser}", 12, binsLaser,xminLaser, xmaxLaser);
3461 for (Int_t iaxis=1; iaxis<12; iaxis++){
3462 fHisLaser->GetAxis(iaxis)->SetName(nameLaser[iaxis]);
3463 fHisLaser->GetAxis(iaxis)->SetTitle(titleLaser[iaxis]);
3467 void AliTPCcalibLaser::MergeFitHistos(AliTPCcalibLaser * laser){
3469 // Merge content of histograms
3471 // Only first histogram is checked - all other should be the same
3472 if (fHisLaser &&laser->fHisLaser) fHisLaser->Add(laser->fHisLaser);
3474 if (!laser->fHisNclIn) return; // empty histograms
3475 if (!fHisNclIn) MakeFitHistos();
3477 fHisNclIn->Add(laser->fHisNclIn ); //->Number of clusters inner
3478 fHisNclOut->Add(laser->fHisNclOut ); //->Number of clusters outer
3479 fHisNclIO->Add(laser->fHisNclIO ); //->Number of cluster inner outer
3480 fHisLclIn->Add(laser->fHisLclIn ); //->Level arm inner
3481 fHisLclOut->Add(laser->fHisLclOut ); //->Level arm outer
3482 fHisLclIO->Add(laser->fHisLclIO ); //->Number of cluster inner outer
3483 fHisdEdx->Add(laser->fHisdEdx ); //->dedx
3484 fHisdZfit->Add(laser->fHisdZfit ); //->dedx
3487 fHisChi2YIn1->Add(laser->fHisChi2YIn1 ); //->chi2 y inner - line
3488 fHisChi2YOut1->Add(laser->fHisChi2YOut1 ); //->chi2 y inner - line
3489 fHisChi2YIn2->Add(laser->fHisChi2YIn2 ); //->chi2 y inner - parabola
3490 fHisChi2YOut2->Add(laser->fHisChi2YOut2 ); //->chi2 y inner - parabola
3491 fHisChi2YIO1->Add(laser->fHisChi2YIO1 ); //->chi2 y IO - common
3492 fHisChi2ZIn1->Add(laser->fHisChi2ZIn1 ); //->chi2 z inner - line
3493 fHisChi2ZOut1->Add(laser->fHisChi2ZOut1 ); //->chi2 z inner - line
3494 fHisChi2ZIn2->Add(laser->fHisChi2ZIn2 ); //->chi2 z inner - parabola
3495 fHisChi2ZOut2->Add(laser->fHisChi2ZOut2 ); //->chi2 z inner - parabola
3496 fHisChi2ZIO1->Add(laser->fHisChi2ZIO1 ); //->chi2 z IO - common
3499 fHisPy1vP0->Add(laser->fHisPy1vP0 ); //-> delta y P0outer-P0inner - line
3500 fHisPy2vP0->Add(laser->fHisPy2vP0 ); //-> delta y P0outer-P0inner - parabola
3501 fHisPy3vP0->Add(laser->fHisPy3vP0 ); //-> delta y P0outer-P0inner - common parabola
3502 fHisPy1vP1->Add(laser->fHisPy1vP1 ); //-> delta ky P1outer-P1inner - line
3503 fHisPy2vP1->Add(laser->fHisPy2vP1 ); //-> delta ky P1outer-P1inner - parabola
3504 fHisPy3vP1->Add(laser->fHisPy3vP1 ); //-> delta ky P1outer-P1inner - common parabola
3505 fHisPy2vP2In->Add(laser-> fHisPy2vP2In ); //-> Curv P2inner - parabola
3506 fHisPy2vP2Out->Add(laser->fHisPy2vP2Out ); //-> Curv P2outer - parabola
3507 fHisPy3vP2IO->Add(laser->fHisPy3vP2IO ); //-> Curv P2outerinner - common parabola
3510 fHisPz1vP0->Add(laser->fHisPz1vP0 ); //-> delta z P0outer-P0inner - line
3511 fHisPz2vP0->Add(laser->fHisPz2vP0 ); //-> delta z P0outer-P0inner - parabola
3512 fHisPz3vP0->Add(laser->fHisPz3vP0 ); //-> delta z P0outer-P0inner - common parabola
3513 fHisPz1vP1->Add(laser->fHisPz1vP1 ); //-> delta kz P1outer-P1inner - line
3514 fHisPz2vP1->Add(laser->fHisPz2vP1 ); //-> delta kz P1outer-P1inner - parabola
3515 fHisPz3vP1->Add(laser->fHisPz3vP1 ); //-> delta kz P1outer-P1inner - common parabola
3516 fHisPz2vP2In->Add(laser->fHisPz2vP2In ); //-> Curv P2inner - parabola
3517 fHisPz2vP2Out->Add(laser->fHisPz2vP2Out ); //-> Curv P2outer - parabola
3518 fHisPz3vP2IO->Add(laser->fHisPz3vP2IO ); //-> Curv P2outerinner - common parabola
3531 void AliTPCcalibLaser::DumpFitInfo(TTree * chainFit,Int_t id){
3533 // Dump fit information - collect information from the streamers
3536 TChain * chainFit=0;
3537 TChain * chainTrack=0;
3540 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
3541 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
3542 AliXRDPROOFtoolkit tool;
3543 chainTrack = tool.MakeChain("laser.txt","Track",0,10200);
3544 chainTrack->Lookup();
3545 chainTrack->SetProof(kTRUE);
3546 chainDrift = tool.MakeChain("laser.txt","driftv",0,10200);
3547 chainDrift->Lookup();
3548 chainDrift->SetProof(kTRUE);
3550 chain = tool.MakeChain("laser.txt","Residuals",0,10200);
3552 chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
3554 chainFit->SetProof(kTRUE);
3555 chain->SetProof(kTRUE);
3556 AliTPCLaserTrack::LoadTracks();
3557 //AliTPCcalibLaser::DumpFitInfo(chainFit,0);
3563 TCut cutP3("abs(Tr.fP[3])<0.1");
3564 TCut cutP4("abs(Tr.fP[4])<0.5");
3565 TCut cutPx = cutP3+cutP4;
3566 TCut cutChi2YOut("sqrt(chi2y2Out*dEdx)<5&&chi2y2Out>0");
3567 TCut cutChi2ZOut("sqrt(chi2z2Out*dEdx)<5&&chi2z2Out>0");
3568 TCut cutChi2YIn("sqrt(chi2y2In*dEdx)<5&&chi2y2In>0");
3569 TCut cutChi2ZIn("sqrt(chi2z2In*dEdx)<5&&chi2z2In>0");
3571 TCut cutdEdx("sqrt(dEdx)>3");
3572 TCut cutDY("abs(yPol2In.fElements[2]*nclI*nclI/4.)<3");
3573 TCut cutN("nclO>20&&nclI>20");
3574 TCut cutA = cutChi2YOut+cutChi2ZOut+cutChi2YIn+cutChi2ZIn+cutN+cutdEdx+cutPx+"accept";
3578 TCut cutClY("abs(Cl[].fY-TrYpol2.fElements)<0.15");
3579 TCut cutClZ("abs(Cl[].fZ-TrZpol2.fElements)<0.15");
3580 TCut cutClX("abs(Cl[].fX)>10");
3581 TCut cutE("abs(Cl[].fY/Cl[].fX)<0.14");
3582 TCut cutSY("sqrt(Cl[].fSigmaY2)>0.05");
3583 TCut cutSZ("sqrt(Cl[].fSigmaZ2)>0.05");
3584 TCut cutQ("sqrt(Cl[].fMax)>4");
3585 TCut cutCl=cutClY+cutClZ+cutClX+cutE+cutSY+cutSZ+cutQ;
3589 TH1F * phisAccept = 0;
3591 TProfile * pdEdx = 0;
3599 TProfile * pNclI = 0;
3600 TProfile * pNclO = 0;
3602 TProfile * pchi2YIn =0;
3603 TProfile * pchi2ZIn =0;
3604 TProfile * pchi2YOut =0;
3605 TProfile * pchi2ZOut =0;
3606 TProfile * pchi2YInOut =0;
3607 TProfile * pchi2ZInOut =0;;
3609 chainFit->Draw("LTr.fId>>hisAl(350,0,350)","LTr.fId<350");
3610 phisAl = (TH1F*)gROOT->FindObject("hisAl");
3611 chainFit->Draw("LTr.fId>>hisAccept(350,0,350)","LTr.fId<350"+cutA);
3612 phisAccept = (TH1F*)gROOT->FindObject("hisAccept");
3613 chainFit->Draw("LTr.fId>>hisOut(350,0,350)","LTr.fId<350"+!cutA);
3614 phisOut = (TH1F*)gROOT->FindObject("hisOut");
3616 chainFit->Draw("sqrt(dEdx):LTr.fId>>hdEdx(350,0,350)","","prof");
3617 pdEdx = (TProfile*)gROOT->FindObject("hdEdx");
3620 chainFit->Draw("Tr.fP[0]:LTr.fId>>hP0(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
3621 pP0 = (TProfile*)gROOT->FindObject("hP0");
3622 chainFit->Draw("Tr.fP[1]:LTr.fId>>hP1(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
3623 pP1 = (TProfile*)gROOT->FindObject("hP1");
3624 chainFit->Draw("Tr.fP[2]:LTr.fId>>hP2(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
3625 pP2 = (TProfile*)gROOT->FindObject("hP2");
3626 chainFit->Draw("Tr.fP[3]:LTr.fId>>hP3(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
3627 pP3 = (TProfile*)gROOT->FindObject("hP3");
3628 chainFit->Draw("Tr.fP[4]:LTr.fId>>hP4(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
3629 pP4 = (TProfile*)gROOT->FindObject("hP4");
3631 chainFit->Draw("nclI:LTr.fId>>hNclI(350,0,350)","","prof");
3632 pNclI = (TProfile*)gROOT->FindObject("hNclI");
3633 chainFit->Draw("nclO:LTr.fId>>hNclO(350,0,350)","","prof");
3634 pNclO = (TProfile*)gROOT->FindObject("hNclO");
3637 chainFit->Draw("sqrt(chi2y2In):LTr.fId>>hChi2YIn(350,0,350)",cutA+"","prof");
3638 pchi2YIn = (TProfile*)gROOT->FindObject("hChi2YIn");
3639 chainFit->Draw("sqrt(chi2y2Out):LTr.fId>>hChi2YOut(350,0,350)",cutA+"","prof");
3640 pchi2YOut = (TProfile*)gROOT->FindObject("hChi2YOut");
3641 chainFit->Draw("sqrt(chi2yInOut):LTr.fId>>hChi2YInOut(350,0,350)",cutA+"","prof");
3642 pchi2YInOut = (TProfile*)gROOT->FindObject("hChi2YInOut");
3643 chainFit->Draw("sqrt(chi2z2In):LTr.fId>>hChi2ZIn(350,0,350)",cutA+"","prof");
3644 pchi2ZIn = (TProfile*)gROOT->FindObject("hChi2ZIn");
3645 chainFit->Draw("sqrt(chi2z2Out):LTr.fId>>hChi2ZOut(350,0,350)",cutA+"","prof");
3646 pchi2ZOut = (TProfile*)gROOT->FindObject("hChi2ZOut");
3647 chainFit->Draw("sqrt(chi2zInOut):LTr.fId>>hChi2ZInOut(350,0,350)",cutA+"","prof");
3648 pchi2ZInOut = (TProfile*)gROOT->FindObject("hChi2ZInOut");
3650 // second derivatives
3652 TH2F * phisPy2In = new TH2F("Py2Inner","Py2Inner",350,0,350,100,-0.001,0.001);
3653 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>Py2Inner",cutA,"");
3654 TH2F * phisPy2Out = new TH2F("Py2Outer","Py2Outer",350,0,350,200,-0.0005,0.0005);
3655 chainFit->Draw("yPol2Out.fElements[2]:LTr.fId>>Py2Outer",cutA,"");
3656 TH2F * phisPy2InOut = new TH2F("Py2InOut","Py2InOut",350,0,350,200,-0.0005,0.0005);
3657 chainFit->Draw("yInOut.fElements[4]:LTr.fId>>Py2InOut",cutA,"");
3659 phisPy2In->FitSlicesY();
3660 TH1D * phisPy2InEntries = (TH1D*)gROOT->FindObject("Py2Inner_0");
3661 TH1D * phisPy2InMean = (TH1D*)gROOT->FindObject("Py2Inner_1");
3662 TH1D * phisPy2InSigma = (TH1D*)gROOT->FindObject("Py2Inner_2");
3664 phisPy2Out->FitSlicesY();
3665 TH1D * phisPy2OutEntries = (TH1D*)gROOT->FindObject("Py2Outer_0");
3666 TH1D * phisPy2OutMean = (TH1D*)gROOT->FindObject("Py2Outer_1");
3667 TH1D * phisPy2OutSigma = (TH1D*)gROOT->FindObject("Py2Outer_2");
3669 phisPy2InOut->FitSlicesY();
3670 TH1D * phisPy2InOutEntries = (TH1D*)gROOT->FindObject("Py2InOut_0");
3671 TH1D * phisPy2InOutMean = (TH1D*)gROOT->FindObject("Py2InOut_1");
3672 TH1D * phisPy2InOutSigma = (TH1D*)gROOT->FindObject("Py2InOut_2");
3674 TH2F * phisPz2In = new TH2F("Pz2Inner","Pz2Inner",350,0,350,100,-0.001,0.001);
3675 chainFit->Draw("zPol2In.fElements[2]:LTr.fId>>Pz2Inner",cutA,"");
3676 TH2F * phisPz2Out = new TH2F("Pz2Outer","Pz2Outer",350,0,350,200,-0.0005,0.0005);
3677 chainFit->Draw("zPol2Out.fElements[2]:LTr.fId>>Pz2Outer",cutA,"");
3678 TH2F * phisPz2InOut = new TH2F("Pz2InOut","Pz2InOut",350,0,350,200,-0.0005,0.0005);
3679 chainFit->Draw("zInOut.fElements[4]:LTr.fId>>Pz2InOut",cutA,"");
3681 phisPz2In->FitSlicesY();
3682 TH1D * phisPz2InEntries = (TH1D*)gROOT->FindObject("Pz2Inner_0");
3683 TH1D * phisPz2InMean = (TH1D*)gROOT->FindObject("Pz2Inner_1");
3684 TH1D * phisPz2InSigma = (TH1D*)gROOT->FindObject("Pz2Inner_2");
3686 phisPz2Out->FitSlicesY();
3687 TH1D * phisPz2OutEntries = (TH1D*)gROOT->FindObject("Pz2Outer_0");
3688 TH1D * phisPz2OutMean = (TH1D*)gROOT->FindObject("Pz2Outer_1");
3689 TH1D * phisPz2OutSigma = (TH1D*)gROOT->FindObject("Pz2Outer_2");
3691 phisPz2InOut->FitSlicesY();
3692 TH1D * phisPz2InOutEntries = (TH1D*)gROOT->FindObject("Pz2InOut_0");
3693 TH1D * phisPz2InOutMean = (TH1D*)gROOT->FindObject("Pz2InOut_1");
3694 TH1D * phisPz2InOutSigma = (TH1D*)gROOT->FindObject("Pz2InOut_2");
3701 TTreeSRedirector *pcstream = new TTreeSRedirector("vscan.root");
3702 for (Int_t ilaser=0; ilaser<336; ilaser++){
3703 Float_t all=phisAl->GetBinContent(ilaser+1);
3704 Float_t accept=phisAccept->GetBinContent(ilaser+1);
3705 Float_t out=phisOut->GetBinContent(ilaser+1);
3706 Float_t sdedx = pdEdx->GetBinContent(ilaser+1);
3707 Float_t mP0 = pP0->GetBinContent(ilaser+1);
3708 Float_t mP1 = pP1->GetBinContent(ilaser+1);
3709 Float_t mP2 = pP2->GetBinContent(ilaser+1);
3710 Float_t mP3 = pP3->GetBinContent(ilaser+1);
3711 Float_t mP4 = pP4->GetBinContent(ilaser+1);
3714 Float_t nclI = pNclI->GetBinContent(ilaser+1);
3715 Float_t nclO = pNclO->GetBinContent(ilaser+1);
3717 Float_t chi2YIn=pchi2YIn->GetBinContent(ilaser+1);
3718 Float_t chi2YOut=pchi2YOut->GetBinContent(ilaser+1);
3719 Float_t chi2YInOut=pchi2YInOut->GetBinContent(ilaser+1);
3720 Float_t chi2ZIn=pchi2ZIn->GetBinContent(ilaser+1);
3721 Float_t chi2ZOut=pchi2ZOut->GetBinContent(ilaser+1);
3722 Float_t chi2ZInOut=pchi2ZInOut->GetBinContent(ilaser+1);
3724 Float_t entriesPy2In = phisPy2InEntries->GetBinContent(ilaser+1);
3725 Float_t meanPy2In = phisPy2InMean->GetBinContent(ilaser+1);
3726 Float_t sigmaPy2In = phisPy2InSigma->GetBinContent(ilaser+1);
3728 Float_t entriesPy2Out = phisPy2OutEntries->GetBinContent(ilaser+1);
3729 Float_t meanPy2Out = phisPy2OutMean->GetBinContent(ilaser+1);
3730 Float_t sigmaPy2Out = phisPy2OutSigma->GetBinContent(ilaser+1);
3732 Float_t entriesPy2InOut = phisPy2InOutEntries->GetBinContent(ilaser+1);
3733 Float_t meanPy2InOut = phisPy2InOutMean->GetBinContent(ilaser+1);
3734 Float_t sigmaPy2InOut = phisPy2InOutSigma->GetBinContent(ilaser+1);
3736 Float_t entriesPz2In = phisPz2InEntries->GetBinContent(ilaser+1);
3737 Float_t meanPz2In = phisPz2InMean->GetBinContent(ilaser+1);
3738 Float_t sigmaPz2In = phisPz2InSigma->GetBinContent(ilaser+1);
3740 Float_t entriesPz2Out = phisPz2OutEntries->GetBinContent(ilaser+1);
3741 Float_t meanPz2Out = phisPz2OutMean->GetBinContent(ilaser+1);
3742 Float_t sigmaPz2Out = phisPz2OutSigma->GetBinContent(ilaser+1);
3744 Float_t entriesPz2InOut = phisPz2InOutEntries->GetBinContent(ilaser+1);
3745 Float_t meanPz2InOut = phisPz2InOutMean->GetBinContent(ilaser+1);
3746 Float_t sigmaPz2InOut = phisPz2InOutSigma->GetBinContent(ilaser+1);
3748 AliTPCLaserTrack* ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(ilaser);
3749 (*pcstream)<<"Scan"<<
3763 "chi2YIn="<<chi2YIn<<
3764 "chi2YOut="<<chi2YOut<<
3765 "chi2YInOut="<<chi2YInOut<<
3766 "chi2ZIn="<<chi2ZIn<<
3767 "chi2ZOut="<<chi2ZOut<<
3768 "chi2ZInOut="<<chi2ZInOut<<
3770 "nPy2In="<<entriesPy2In<<
3771 "mPy2In="<<meanPy2In<<
3772 "sPy2In="<<sigmaPy2In<<
3774 "nPy2Out="<<entriesPy2Out<<
3775 "mPy2Out="<<meanPy2Out<<
3776 "sPy2Out="<<sigmaPy2Out<<
3778 "nPy2InOut="<<entriesPy2InOut<<
3779 "mPy2InOut="<<meanPy2InOut<<
3780 "sPy2InOut="<<sigmaPy2InOut<<
3782 "nPz2In="<<entriesPz2In<<
3783 "mPz2In="<<meanPz2In<<
3784 "sPz2In="<<sigmaPz2In<<
3786 "nPz2Out="<<entriesPz2Out<<
3787 "mPz2Out="<<meanPz2Out<<
3788 "sPz2Out="<<sigmaPz2Out<<
3790 "nPz2InOut="<<entriesPz2InOut<<
3791 "mPz2InOut="<<meanPz2InOut<<
3792 "sPz2InOut="<<sigmaPz2InOut<<
3800 void AliTPCcalibLaser::SetBeamParameters(TVectorD& meanOffset,
3801 TVectorD& meanSlope,
3802 TVectorD& sectorArray,
3805 // This method should ideally go in AliTPCLaser
3806 // option == 0 (pads outer - closest to beam)
3807 // option == 1 (pads inner)
3808 // option == 2 (time outer)
3809 // option == 3 (time inner)
3810 Int_t nFailures = 0;
3812 for(Int_t id = 0; id < 336; id++) {
3814 if (!AliTPCLaserTrack::GetTracks())
3815 AliTPCLaserTrack::LoadTracks();
3816 AliTPCLaserTrack *ltrp =
3817 (AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
3819 AliExternalTrackParam trackParam(*ltrp);
3821 Double_t deltaangle = 10.0; // sector is 1/2 a sector away from mirror
3822 if((option==1 || option==3)&& (ltrp->GetBeam()<=1 || ltrp->GetBeam()>=5))
3823 deltaangle = 30.0; // inner sector is 1 sector further away from mirror
3825 Double_t angle = trackParam.GetAlpha();
3827 angle += 2*TMath::Pi();
3828 if(trackParam.GetSnp()>0) // track points to sector "before"
3829 angle -= deltaangle*TMath::DegToRad();
3830 else // track points to sector "after"
3831 angle += deltaangle*TMath::DegToRad();
3833 Bool_t success = trackParam.Rotate(angle);
3836 // cout << "WARNING: Rotate failed for ID: " << id << endl;
3840 angle *= TMath::RadToDeg();
3842 Int_t sector = TMath::Nint((angle-10.0)/20.0);
3847 if(ltrp->GetSide()==1) // C side
3849 if(option==0 || option==2)
3851 if((option==1||option==3)&&(ltrp->GetBeam()==0||ltrp->GetBeam()==6))
3854 sectorArray[id] = sector;
3856 const Double_t x0 = 0;
3858 Double_t slopey = TMath::Tan(TMath::ASin(trackParam.GetSnp()));
3859 Double_t slopez = trackParam.GetTgl();
3860 // One needs a factor sqrt(1+slopey**2) to take into account the
3861 // longer path length
3862 slopez *= TMath::Sqrt(1.0 + slopey*slopey);
3863 if(fInverseSlopeZ) // wrong sign in database, should be fixed there
3865 // Double_t offsetz = trackParam.GetZ();
3866 Double_t offsety = trackParam.GetY() + slopey*(x0-trackParam.GetX());
3867 Double_t offsetz = trackParam.GetZ() + slopez*(x0-trackParam.GetX());
3868 if(option==2 || option==3) {
3869 meanOffset[id] = offsetz; meanSlope[id] = slopez;
3871 meanOffset[id] = offsety; meanSlope[id] = slopey;
3876 AliWarning(Form("Rotate method failed %d times", nFailures));
3881 TFile f("vscan.root");
3886 chain->Draw("Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","",10000);
3888 chain->Draw("Cl[].fY-TrYpol1.fElements:Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","prof",10000);
3891 chain->Draw("Cl.fY-TrYpol1.fElements-AliTPCClusterParam::SPosCorrection(0,1,Cl[].fPad,Cl[].fTimeBin,Cl[].fZ,Cl[].fSigmaY2,Cl[].fSigmaZ2,Cl[].fMax):Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","prof",10000);
3894 chain->Draw("Cl[].fZ-TrZpol1.fElements-0*AliTPCClusterParam::SPosCorrection(1,1,Cl[].fPad,Cl[].fTimeBin,Cl[].fZ,Cl[].fSigmaY2,Cl[].fSigmaZ2,Cl[].fMax):Cl[].fTimeBin-int(Cl[].fTimeBin)",cutA+cutCl+"Cl[].fZ>0","prof",10000)
3903 // check edge effects
3904 chain->Draw("Cl.fY-TrYpol1.fElements:Cl.fY/Cl.fX",""+cutA+cutCl,"prof",10000)
3906 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fZ>0"+cutA+cutCl+cutE,"prof",100000)
3908 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fX>80&&Cl.fZ>0&&Cl.fDetector>35"+cutA+cutCl+cutE,"prof",100000)
3912 chainFit->Draw("yInOut.fElements[4]:LTr.fP[2]","LTr.fP[1]<0"+cutA,"prof",1000);
3913 chainFit->Draw("yPol2In.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutD,"prof")
3924 dedge = sign(Cl.fY)*(Cl.fX*tan(pi/18)-abs(Cl.fY))
3927 chain->Draw("sign(Cl.fY)*(Cl.fY-TrYpol1.fElements):pi/18-abs(Cl.fY/Cl.fX)>>hisYdphi(100,0,0.03)",""+cutA+cutCl,"prof",10000)
3929 chain->Draw("sign(Cl.fY)*(Cl.fY-TrYpol1.fElements):Cl.fX*(pi/18-abs(Cl.fY/Cl.fX))>>hisYdy(100,0,5)",""+cutA+cutCl,"prof",10000)
3935 chain->Draw("sign(Cl.fY)*(Cl.fY-TrYpol1.fElements):Cl.fX*(pi/18-abs(Cl.fY/Cl.fX))>>hisYdyIROC(100,0,5)","Cl.fDetector<36"+cutA+cutCl,"prof",100000)
3937 chain->Draw("sign(Cl.fY)*(Cl.fY-TrYpol1.fElements):Cl.fX*(pi/18-abs(Cl.fY/Cl.fX))>>hisYdyOROC(100,0,5)","Cl.fDetector>36"+cutA+cutCl,"prof",100000)
3941 chain->Draw("Cl.fY-TrYpol1.fElements:sign(Cl.fY)*(Cl.fX*tan(pi/18)-abs(Cl.fY))>>his(100,-5,5)",""+cutA+cutCl,"prof",100000)
3943 chain->Draw("Cl.fY-TrYpol1.fElements:sign(Cl.fY)*(Cl.fX*tan(pi/18)-abs(Cl.fY))>>hisdyInner(100,-5,5)","Cl.fDetector<36"+cutA+cutCl,"prof",100000)
3952 chainFit->Draw("yPol2Out.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutDY,"prof")
3954 chainFit->Draw("yPol2In.fElements[2]*64*64/4.:LTr.fP[2]","nclI>20&<r.fP[1]<0"+cutA+cutDY,"prof")
3958 chainFit->Draw("LTr.fId","nclI>10",100000)
3960 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>his(350,0,350,100,-0.002,0.002)","nclI>20","")
3962 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>hisPy2In0(350,0,350,100,-0.002,0.002)","nclI>20","");
3964 TH2 * phisPy2In = (TH2*) gROOT->FindObject("hisPy2In0")
3974 gSystem->Load("libSTAT.so")
3975 TStatToolkit toolkit;
3981 TCut cutA("entries>2&&pphi2<3&&abs(gphiP1-pphiP0)<0.003&&abs(gz1)<6");
3986 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz++"; //1
3987 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*LTr.fP[2]++"; //2
3988 fstring+="(abs(LTr.fP[1]/250)^1-1)*bz++"; //3
3989 fstring+="(abs(LTr.fP[1]/250)-1)*bz*LTr.fP[2]++"; //4
3991 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*sin(atan2(lx1,lx0))++" //5
3992 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*sin(atan2(lx1,lx0))*LTr.fP[2]++" //6
3993 fstring+="(abs(LTr.fP[1]/250)-1)*bz*sin(atan2(lx1,lx0))++" //7
3994 fstring+="(abs(LTr.fP[1]/250)-1)*bz*sin(atan2(lx1,lx0))*LTr.fP[2]++" //8
3996 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*cos(atan2(lx1,lx0))++" //9
3997 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*cos(atan2(lx1,lx0))*LTr.fP[2]++" //10
3998 fstring+="(abs(LTr.fP[1]/250)-1)*bz*cos(atan2(lx1,lx0))++" //11
3999 fstring+="(abs(LTr.fP[1]/250)-1)*bz*cos(atan2(lx1,lx0))*LTr.fP[2]++" //12
4004 TString *strq0 = toolkit.FitPlane(treeT,"gphi1-pphi0",fstring->Data(), "fSide==1"+cutA, chi2,npoints,fitParam,covMatrix);
4006 treeT->SetAlias("fit",strq0->Data());
4009 TString *strqP = toolkit.FitPlane(treeT,"1000*(gphiP1-pphiP0)",fstring->Data(), "fSide==1"+cutA, chi2,npoints,fitParam,covMatrix);
4011 treeT->SetAlias("fitP",strqP->Data());
4014 TString *strqDrift = toolkit.FitPlane(treeT,"gz1","LTr.fP[1]++(1-2*(fSide==1))++lx1", cutA, chi2,npoints,fitParam,covMatrix);
4015 treeT->SetAlias("fitD",strqDrift->Data());
4018 treeT->Draw("fit:LTr.fP[1]","abs(bz+0.4)<0.05"+cutA,"");
4020 for (Int_t i=0; i<6;i++){
4021 treeT->SetLineColor(i+2);
4022 treeT->SetMarkerSize(1);
4023 treeT->SetMarkerStyle(22+i);
4024 treeT->SetMarkerColor(i+2);
4026 treeT->Draw("fit:LTr.fP[1]",Form("abs(bz+0.4)<0.05&fRod==%d",i)+cutA,"same");
4034 TTree * tree = (TTree*)f.Get("FitModels");
4036 TEventList listLFit0("listLFit0","listLFit0");
4037 TEventList listLFit1("listLFit1","listLFit1");
4038 tree->Draw(">>listLFit0","seed.fdEdx<200&&seed.fdEdx>40");
4039 tree->SetEventList(&listLFit0);
4044 gSystem->Load("libSTAT.so")
4045 TStatToolkit toolkit;
4051 chain->SetAlias("dp","((Cl.fPad-int(Cl.fPad))*pi)");
4052 chain->SetAlias("dt","((Cl.fTimeBin-int(Cl.fTimeBin))*pi)");
4056 fstring+="cos(dp)++";
4057 fstring+="sin(dp)++";
4058 fstring+="cos(dt)++";
4059 fstring+="sin(dt)++";
4061 TString *str = toolkit.FitPlane(chain,"Cl.fZ-TrZInOut.fElements",fstring->Data(), "Cl.fDetector>35", chi2,npoints,fitParam,covMatrix,-1,0,200);
4074 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
4075 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
4076 AliXRDPROOFtoolkit tool;
4077 TChain * chainTrack = tool.MakeChain("laser.txt","Track",0,10200);
4078 chainTrack->Lookup();
4079 chainTrack->SetProof(kTRUE);
4081 TChain * chain = tool.MakeChain("laser.txt","Residuals",0,10200);
4083 TChain * chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
4085 chainFit->SetProof(kTRUE);
4086 chain->SetProof(kTRUE);
4090 TCut cutChi2YOut("sqrt(chi2y2Out*dEdx)<10");
4091 TCut cutChi2ZOut("sqrt(chi2z2Out*dEdx)<10");
4092 TCut cutChi2YIn("sqrt(chi2y2In*dEdx)<10");
4093 TCut cutChi2ZIn("sqrt(chi2z2In*dEdx)<10");
4095 TCut cutdEdx("sqrt(dEdx)<30&&sqrt(dEdx)>3");
4096 TCut cutDY("abs(yPol2In.fElements[2]*nclO*nclO/4.)<3")
4097 TCut cutN("nclO>20&&nclI>20");
4098 TCut cutA = cutChi2YOut+cutChi2ZOut+cutChi2YIn+cutChi2ZIn+cutN+cutdEdx;
4102 TCut cutClY("abs(Cl.fY-TrYpol2.fElements)<0.2");
4103 TCut cutClZ("abs(Cl.fZ-TrZpol2.fElements)<0.4");
4104 TCut cutClX("abs(Cl.fX)>10");
4105 TCut cutE("abs(Cl.fY/Cl.fX)<0.14");
4106 TCut cutCl=cutClY+cutClZ+cutClX;
4109 // check edge effects
4110 chain->Draw("Cl.fY-TrYpol1.fElements:Cl.fY/Cl.fX",""+cutA+cutCl,"prof",10000)
4112 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fZ>0"+cutA+cutCl+cutE,"prof",100000)
4114 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fX>80&&Cl.fZ>0&&Cl.fDetector>35"+cutA+cutCl+cutE,"prof",100000)
4118 chainFit->Draw("yInOut.fElements[4]:LTr.fP[2]","LTr.fP[1]<0"+cutA,"prof",1000);
4119 chainFit->Draw("yPol2In.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutD,"prof")