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("CalibObjects.root");
41 TObjArray * array = (TObjArray*)fcalib.Get("TPCCalib");
42 AliTPCcalibLaser * laser = ( AliTPCcalibLaser *)array->FindObject("laserTPC");
43 laser->DumpMeanInfo(-0,0)
44 TFile fmean("laserMean.root")
46 // laser track clasification;
48 TCut cutT("cutT","abs(Tr.fP[3])<0.06");
49 TCut cutPt("cutPt","abs(Tr.fP[4])<0.1");
50 TCut cutN("cutN","fTPCncls>70");
51 TCut cutP("cutP","abs(atan2(x1,x0)-atan2(lx1,lx0))<0.03")
52 TCut cutA = cutT+cutPt+cutP;
53 TChain * chainTrL = tool.MakeChain("laser.txt","Track",0,10200);
60 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
61 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
62 AliXRDPROOFtoolkit tool;
63 TChain * chain = tool.MakeChain("laserScan.txt","Mean",0,10200);
65 AliTPCcalibLaser::DumpScanInfo(chain)
66 TFile fscan("laserScan.root")
67 TTree * treeT = (TTree*)fscan.Get("Mean")
71 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
72 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
73 AliXRDPROOFtoolkit tool;
74 TChain * chainDrift = tool.MakeChain("laser.txt","driftv",0,10200);
77 TChain * chain = tool.MakeChain("laser.txt","Residuals",0,10200);
79 TChain * chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
86 #include "TLinearFitter.h"
87 #include "AliTPCcalibLaser.h"
88 #include "AliExternalTrackParam.h"
89 #include "AliESDEvent.h"
90 #include "AliESDfriend.h"
91 #include "AliESDtrack.h"
92 #include "AliTPCTracklet.h"
97 #include "TTreeStream.h"
100 #include "TGraphErrors.h"
101 #include "AliTPCclusterMI.h"
102 #include "AliTPCseed.h"
103 #include "AliTracker.h"
105 #include "TClonesArray.h"
111 #include "TStatToolkit.h"
115 #include "TTreeStream.h"
118 #include "AliTPCLaserTrack.h"
119 #include "AliTPCcalibDB.h"
120 #include "AliTPCParam.h"
121 #include "TTimeStamp.h"
122 #include "AliDCSSensorArray.h"
123 #include "AliDCSSensor.h"
127 ClassImp(AliTPCcalibLaser)
129 AliTPCcalibLaser::AliTPCcalibLaser():
136 fTracksEsdParam(336),
146 fHisLaser(0), // N dim histogram of laser
147 fHisNclIn(0), //->Number of clusters inner
148 fHisNclOut(0), //->Number of clusters outer
149 fHisNclIO(0), //->Number of cluster inner outer
150 fHisLclIn(0), //->Level arm inner
151 fHisLclOut(0), //->Level arm outer
152 fHisLclIO(0), //->Number of cluster inner outer
153 fHisdEdx(0), //->dEdx histo
154 fHisdZfit(0), //->distance to the mirror after linear fit
157 fHisChi2YIn1(0), //->chi2 y inner - line
158 fHisChi2YOut1(0), //->chi2 y inner - line
159 fHisChi2YIn2(0), //->chi2 y inner - parabola
160 fHisChi2YOut2(0), //->chi2 y inner - parabola
161 fHisChi2YIO1(0), //->chi2 y IO - common
162 fHisChi2ZIn1(0), //->chi2 z inner - line
163 fHisChi2ZOut1(0), //->chi2 z inner - line
164 fHisChi2ZIn2(0), //->chi2 z inner - parabola
165 fHisChi2ZOut2(0), //->chi2 z inner - parabola
166 fHisChi2ZIO1(0), //->chi2 z IO - common
169 fHisPy1vP0(0), //-> delta y P0outer-P0inner - line
170 fHisPy2vP0(0), //-> delta y P0outer-P0inner - parabola
171 fHisPy3vP0(0), //-> delta y P0outer-P0inner - common parabola
172 fHisPy1vP1(0), //-> delta ky P1outer-P1inner - line
173 fHisPy2vP1(0), //-> delta ky P1outer-P1inner - parabola
174 fHisPy3vP1(0), //-> delta ky P1outer-P1inner - common parabola
175 fHisPy2vP2In(0), //-> Curv P2inner - parabola
176 fHisPy2vP2Out(0), //-> Curv P2outer - parabola
177 fHisPy3vP2IO(0), //-> Curv P2outerinner - common parabola
180 fHisPz1vP0(0), //-> delta z P0outer-P0inner - line
181 fHisPz2vP0(0), //-> delta z P0outer-P0inner - parabola
182 fHisPz3vP0(0), //-> delta z P0outer-P0inner - common parabola
183 fHisPz1vP1(0), //-> delta kz P1outer-P1inner - line
184 fHisPz2vP1(0), //-> delta kz P1outer-P1inner - parabola
185 fHisPz3vP1(0), //-> delta kz P1outer-P1inner - common parabola
186 fHisPz2vP2In(0), //-> Curv P2inner - parabola
187 fHisPz2vP2Out(0), //-> Curv P2outer - parabola
188 fHisPz3vP2IO(0), //-> Curv P2outerinner - common parabola
190 fDeltaYres(336), //->2D histo of residuals
191 fDeltaZres(336), //->2D histo fo residuals
192 fDeltaYres2(336), //->2D histo of residuals
193 fDeltaZres2(336), //->2D histo fo residuals
194 fDeltaYresAbs(336), //->2D histo of residuals
195 fDeltaZresAbs(336), //->2D histo of residuals
196 //fDeltaYres3(336), //->2D histo of residuals
197 //fDeltaZres3(336), //->2D histo fo residuals
198 fFitAside(new TVectorD(5)),
199 fFitCside(new TVectorD(5)),
200 fFitACside(new TVectorD(6)),
205 fBeamSectorOuter(336),
206 fBeamSectorInner(336),
207 fBeamOffsetYOuter(336),
208 fBeamSlopeYOuter(336),
209 fBeamOffsetYInner(336),
210 fBeamSlopeYInner(336),
211 fBeamOffsetZOuter(336),
212 fBeamSlopeZOuter(336),
213 fBeamOffsetZInner(336),
214 fBeamSlopeZInner(336),
215 fInverseSlopeZ(kTRUE)
220 fTracksEsdParam.SetOwner(kTRUE);
223 AliTPCcalibLaser::AliTPCcalibLaser(const Text_t *name, const Text_t *title, Bool_t full):
230 fTracksEsdParam(336),
234 fDeltaZ(336), // array of histograms of delta z for each track
235 fDeltaP3(336), // array of histograms of delta z for each track
236 fDeltaP4(336), // array of histograms of P3 for each track
237 fDeltaPhi(336), // array of histograms of P4 for each track
238 fDeltaPhiP(336), // array of histograms of delta z for each track
239 fSignals(336), // array of dedx signals
242 fHisLaser(0), // N dim histogram of laser
243 fHisNclIn(0), //->Number of clusters inner
244 fHisNclOut(0), //->Number of clusters outer
245 fHisNclIO(0), //->Number of cluster inner outer
246 fHisLclIn(0), //->Level arm inner
247 fHisLclOut(0), //->Level arm outer
248 fHisLclIO(0), //->Number of cluster inner outer
249 fHisdEdx(0), //->dEdx histo
250 fHisdZfit(0), //->distance to the mirror after linear fit
253 fHisChi2YIn1(0), //->chi2 y inner - line
254 fHisChi2YOut1(0), //->chi2 y inner - line
255 fHisChi2YIn2(0), //->chi2 y inner - parabola
256 fHisChi2YOut2(0), //->chi2 y inner - parabola
257 fHisChi2YIO1(0), //->chi2 y IO - common
258 fHisChi2ZIn1(0), //->chi2 z inner - line
259 fHisChi2ZOut1(0), //->chi2 z inner - line
260 fHisChi2ZIn2(0), //->chi2 z inner - parabola
261 fHisChi2ZOut2(0), //->chi2 z inner - parabola
262 fHisChi2ZIO1(0), //->chi2 z IO - common
265 fHisPy1vP0(0), //-> delta y P0outer-P0inner - line
266 fHisPy2vP0(0), //-> delta y P0outer-P0inner - parabola
267 fHisPy3vP0(0), //-> delta y P0outer-P0inner - common parabola
268 fHisPy1vP1(0), //-> delta ky P1outer-P1inner - line
269 fHisPy2vP1(0), //-> delta ky P1outer-P1inner - parabola
270 fHisPy3vP1(0), //-> delta ky P1outer-P1inner - common parabola
271 fHisPy2vP2In(0), //-> Curv P2inner - parabola
272 fHisPy2vP2Out(0), //-> Curv P2outer - parabola
273 fHisPy3vP2IO(0), //-> Curv P2outerinner - common parabola
276 fHisPz1vP0(0), //-> delta z P0outer-P0inner - line
277 fHisPz2vP0(0), //-> delta z P0outer-P0inner - parabola
278 fHisPz3vP0(0), //-> delta z P0outer-P0inner - common parabola
279 fHisPz1vP1(0), //-> delta kz P1outer-P1inner - line
280 fHisPz2vP1(0), //-> delta kz P1outer-P1inner - parabola
281 fHisPz3vP1(0), //-> delta kz P1outer-P1inner - common parabola
282 fHisPz2vP2In(0), //-> Curv P2inner - parabola
283 fHisPz2vP2Out(0), //-> Curv P2outer - parabola
284 fHisPz3vP2IO(0), //-> Curv P2outerinner - common parabola
296 fFitAside(new TVectorD(5)), // drift fit - A side
297 fFitCside(new TVectorD(5)), // drift fit - C- side
298 fFitACside(new TVectorD(6)), // drift fit - AC- side
299 fEdgeXcuts(3), // cuts in local x direction; used in the refit of the laser tracks
300 fEdgeYcuts(3), // cuts in local y direction; used in the refit of the laser tracks
301 fNClCuts(5), // cuts on the number of clusters per tracklet; used in the refit of the laser tracks
302 fNcuts(0), // number of cuts
303 fBeamSectorOuter(336),
304 fBeamSectorInner(336),
305 fBeamOffsetYOuter(336),
306 fBeamSlopeYOuter(336),
307 fBeamOffsetYInner(336),
308 fBeamSlopeYInner(336),
309 fBeamOffsetZOuter(336),
310 fBeamSlopeZOuter(336),
311 fBeamOffsetZInner(336),
312 fBeamSlopeZInner(336),
313 fInverseSlopeZ(kTRUE)
320 fTracksEsdParam.SetOwner(kTRUE);
323 AliTPCcalibLaser::AliTPCcalibLaser(const AliTPCcalibLaser& calibLaser):
324 AliTPCcalibBase(calibLaser),
330 fTracksEsdParam(336),
332 fFullCalib(calibLaser.fFullCalib),
334 fDeltaZ(calibLaser.fDeltaZ), // array of histograms of delta z for each track
335 fDeltaP3(((calibLaser.fDeltaP3))), // array of histograms of delta z for each track
336 fDeltaP4(((calibLaser.fDeltaP4))), // array of histograms of P3 for each track
337 fDeltaPhi(((calibLaser.fDeltaPhi))), // array of histograms of P4 for each track
338 fDeltaPhiP(((calibLaser.fDeltaPhiP))), // array of histograms of delta z for each track
339 fSignals(((calibLaser.fSignals))), // array of dedx signals
342 fHisLaser(0), // N dim histogram of laser
343 fHisNclIn(new TH2F(*(calibLaser.fHisNclIn))), //->Number of clusters inner
344 fHisNclOut(new TH2F(*(calibLaser.fHisNclOut))), //->Number of clusters outer
345 fHisNclIO(new TH2F(*(calibLaser.fHisNclIO))), //->Number of cluster inner outer
346 fHisLclIn(new TH2F(*(calibLaser.fHisLclIn))), //->Level arm inner
347 fHisLclOut(new TH2F(*(calibLaser.fHisLclOut))), //->Level arm outer
348 fHisLclIO(new TH2F(*(calibLaser.fHisLclIO))), //->Number of cluster inner outer
349 fHisdEdx(new TH2F(*(calibLaser.fHisdEdx))), //
350 fHisdZfit(new TH2F(*(calibLaser.fHisdZfit))), //->distance to the mirror after linear fit
353 fHisChi2YIn1(new TH2F(*(calibLaser.fHisChi2YIn1))), //->chi2 y inner - line
354 fHisChi2YOut1(new TH2F(*(calibLaser.fHisChi2YOut1))), //->chi2 y inner - line
355 fHisChi2YIn2(new TH2F(*(calibLaser.fHisChi2YIn2))), //->chi2 y inner - parabola
356 fHisChi2YOut2(new TH2F(*(calibLaser.fHisChi2YOut2))), //->chi2 y inner - parabola
357 fHisChi2YIO1(new TH2F(*(calibLaser.fHisChi2YIO1))), //->chi2 y IO - common
358 fHisChi2ZIn1(new TH2F(*(calibLaser.fHisChi2ZIn1))), //->chi2 z inner - line
359 fHisChi2ZOut1(new TH2F(*(calibLaser.fHisChi2ZOut1))), //->chi2 z inner - line
360 fHisChi2ZIn2(new TH2F(*(calibLaser.fHisChi2ZIn2))), //->chi2 z inner - parabola
361 fHisChi2ZOut2(new TH2F(*(calibLaser.fHisChi2ZOut2))), //->chi2 z inner - parabola
362 fHisChi2ZIO1(new TH2F(*(calibLaser.fHisChi2ZIO1))), //->chi2 z IO - common
365 fHisPy1vP0(new TH2F(*(calibLaser.fHisPy1vP0))), //-> delta y P0outer-P0inner - line
366 fHisPy2vP0(new TH2F(*(calibLaser.fHisPy2vP0))), //-> delta y P0outer-P0inner - parabola
367 fHisPy3vP0(new TH2F(*(calibLaser.fHisPy3vP0))), //-> delta y P0outer-P0inner - common parabola
368 fHisPy1vP1(new TH2F(*(calibLaser.fHisPy1vP1))), //-> delta ky P1outer-P1inner - line
369 fHisPy2vP1(new TH2F(*(calibLaser.fHisPy2vP1))), //-> delta ky P1outer-P1inner - parabola
370 fHisPy3vP1(new TH2F(*(calibLaser.fHisPy3vP1))), //-> delta ky P1outer-P1inner - common parabola
371 fHisPy2vP2In(new TH2F(*(calibLaser.fHisPy2vP2In))), //-> Curv P2inner - parabola
372 fHisPy2vP2Out(new TH2F(*(calibLaser.fHisPy2vP2Out))), //-> Curv P2outer - parabola
373 fHisPy3vP2IO(new TH2F(*(calibLaser.fHisPy3vP2IO))), //-> Curv P2outerinner - common parabola
376 fHisPz1vP0(new TH2F(*(calibLaser.fHisPz1vP0))), //-> delta z P0outer-P0inner - line
377 fHisPz2vP0(new TH2F(*(calibLaser.fHisPz2vP0))), //-> delta z P0outer-P0inner - parabola
378 fHisPz3vP0(new TH2F(*(calibLaser.fHisPz3vP0))), //-> delta z P0outer-P0inner - common parabola
379 fHisPz1vP1(new TH2F(*(calibLaser. fHisPz1vP1))), //-> delta kz P1outer-P1inner - line
380 fHisPz2vP1(new TH2F(*(calibLaser.fHisPz2vP1))), //-> delta kz P1outer-P1inner - parabola
381 fHisPz3vP1(new TH2F(*(calibLaser.fHisPz3vP1))), //-> delta kz P1outer-P1inner - common parabola
382 fHisPz2vP2In(new TH2F(*(calibLaser.fHisPz2vP2In))), //-> Curv P2inner - parabola
383 fHisPz2vP2Out(new TH2F(*(calibLaser. fHisPz2vP2Out))), //-> Curv P2outer - parabola
384 fHisPz3vP2IO(new TH2F(*(calibLaser.fHisPz3vP2IO))), //-> Curv P2outerinner - common parabola
387 fDeltaYres(((calibLaser.fDeltaYres))),
388 fDeltaZres(((calibLaser.fDeltaZres))),
389 fDeltaYres2(((calibLaser.fDeltaYres))),
390 fDeltaZres2(((calibLaser.fDeltaZres))),
391 fDeltaYresAbs(((calibLaser.fDeltaYresAbs))),
392 fDeltaZresAbs(((calibLaser.fDeltaZresAbs))),
393 // fDeltaYres3(((calibLaser.fDeltaYres))),
394 //fDeltaZres3(((calibLaser.fDeltaZres))),
395 fFitAside(new TVectorD(5)), // drift fit - A side
396 fFitCside(new TVectorD(5)), // drift fit - C- side
397 fFitACside(new TVectorD(6)), // drift fit - C- side
398 fEdgeXcuts(3), // cuts in local x direction; used in the refit of the laser tracks
399 fEdgeYcuts(3), // cuts in local y direction; used in the refit of the laser tracks
400 fNClCuts(5), // cuts on the number of clusters per tracklet; used in the refit of the laser tracks
401 fNcuts(0), // number of cuts
402 fBeamSectorOuter(336),
403 fBeamSectorInner(336),
404 fBeamOffsetYOuter(336),
405 fBeamSlopeYOuter(336),
406 fBeamOffsetYInner(336),
407 fBeamSlopeYInner(336),
408 fBeamOffsetZOuter(336),
409 fBeamSlopeZOuter(336),
410 fBeamOffsetZInner(336),
411 fBeamSlopeZInner(336),
412 fInverseSlopeZ(calibLaser.fInverseSlopeZ)
422 AliTPCcalibLaser & AliTPCcalibLaser::operator=(const AliTPCcalibLaser& calibLaser){
424 // assgnment operator
426 if (this != &calibLaser) {
427 new (this) AliTPCcalibLaser(calibLaser);
436 AliTPCcalibLaser::~AliTPCcalibLaser() {
441 delete fHisLaser; //->
442 delete fHisNclIn; //->Number of clusters inner
443 delete fHisNclOut; //->Number of clusters outer
444 delete fHisNclIO; //->Number of cluster inner outer
445 delete fHisLclIn; //->Level arm inner
446 delete fHisLclOut; //->Level arm outer
447 delete fHisLclIO; //->Number of cluster inner outer
452 delete fHisChi2YIn1; //->chi2 y inner - line
453 delete fHisChi2YOut1; //->chi2 y inner - line
454 delete fHisChi2YIn2; //->chi2 y inner - parabola
455 delete fHisChi2YOut2; //->chi2 y inner - parabola
456 delete fHisChi2YIO1; //->chi2 y IO - common
457 delete fHisChi2ZIn1; //->chi2 z inner - line
458 delete fHisChi2ZOut1; //->chi2 z inner - line
459 delete fHisChi2ZIn2; //->chi2 z inner - parabola
460 delete fHisChi2ZOut2; //->chi2 z inner - parabola
461 delete fHisChi2ZIO1; //->chi2 z IO - common
464 delete fHisPy1vP0; //-> delta y P0outer-P0inner - line
465 delete fHisPy2vP0; //-> delta y P0outer-P0inner - parabola
466 delete fHisPy3vP0; //-> delta y P0outer-P0inner - common parabola
467 delete fHisPy1vP1; //-> delta ky P1outer-P1inner - line
468 delete fHisPy2vP1; //-> delta ky P1outer-P1inner - parabola
469 delete fHisPy3vP1; //-> delta ky P1outer-P1inner - common parabola
470 delete fHisPy2vP2In; //-> Curv P2inner - parabola
471 delete fHisPy2vP2Out; //-> Curv P2outer - parabola
472 delete fHisPy3vP2IO; //-> Curv P2outerinner - common parabola
475 delete fHisPz1vP0; //-> delta z P0outer-P0inner - line
476 delete fHisPz2vP0; //-> delta z P0outer-P0inner - parabola
477 delete fHisPz3vP0; //-> delta z P0outer-P0inner - common parabola
478 delete fHisPz1vP1; //-> delta kz P1outer-P1inner - line
479 delete fHisPz2vP1; //-> delta kz P1outer-P1inner - parabola
480 delete fHisPz3vP1; //-> delta kz P1outer-P1inner - common parabola
481 delete fHisPz2vP2In; //-> Curv P2inner - parabola
482 delete fHisPz2vP2Out; //-> Curv P2outer - parabola
483 delete fHisPz3vP2IO; //-> Curv P2outerinner - common parabola
488 fDeltaZ.SetOwner(); //-> array of histograms of delta z for each track
489 fDeltaP3.SetOwner(); //-> array of histograms of P3 for each track
490 fDeltaP4.SetOwner(); //-> array of histograms of P4 for each track
491 fDeltaPhi.SetOwner(); //-> array of histograms of delta z for each track
492 fDeltaPhiP.SetOwner(); //-> array of histograms of delta z for each track
493 fSignals.SetOwner(); //->Array of dedx signals
495 fDeltaZ.Delete(); //-> array of histograms of delta z for each track
496 fDeltaP3.Delete(); //-> array of histograms of P3 for each track
497 fDeltaP4.Delete(); //-> array of histograms of P4 for each track
498 fDeltaPhi.Delete(); //-> array of histograms of delta z for each track
499 fDeltaPhiP.Delete(); //-> array of histograms of delta z for each track
500 fSignals.Delete(); //->Array of dedx signals
502 fDeltaYres.SetOwner();
504 fDeltaZres.SetOwner();
506 fDeltaYres2.SetOwner();
507 fDeltaYres2.Delete();
508 fDeltaZres2.SetOwner();
509 fDeltaZres2.Delete();
511 fDeltaYresAbs.SetOwner();
512 fDeltaYresAbs.Delete();
513 fDeltaZresAbs.SetOwner();
514 fDeltaZresAbs.Delete();
519 void AliTPCcalibLaser::Process(AliESDEvent * event) {
522 // Loop over tracks and call Process function
529 fESDfriend=static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
533 if (fESD->GetNumberOfTracks()<kMinTracks) return; //not enough tracks
534 AliDebug(4,Form("Event number in current file: %d",event->GetEventNumberInFile()));
537 fTracksEsdParam.Delete();
538 for (Int_t id=0; id<336;id++) {
540 fClusterCounter[id]=0;
544 Int_t n=fESD->GetNumberOfTracks();
546 for (Int_t i=0;i<n;++i) {
547 AliESDfriendTrack *friendTrack=fESDfriend->GetTrack(i);
548 if (!friendTrack) continue;
549 AliESDtrack *track=fESD->GetTrack(i);
550 TObject *calibObject=0;
552 for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j)
553 if ((seed=dynamic_cast<AliTPCseed*>(calibObject)))
555 if (track&&seed &&TMath::Abs(track->Pt()) >1 ) {
557 Int_t id = FindMirror(track,seed);
563 if (counter<kMinTracks) return;
566 if (!fFullCalib) return;
567 static Bool_t init=kFALSE;
569 init = kTRUE; // way around for PROOF - to be investigated
573 for (Int_t id=0; id<336; id++){
575 if (!fTracksEsdParam.At(id)) continue;
576 if (fClusterSatur[id]>0.3) continue; // tracks in saturation
578 if ( AcceptLaser(id) && fFitZ[id]<0.5){
586 void AliTPCcalibLaser::MakeDistHisto(Int_t id){
590 // for (Int_t id=0; id<336; id++){
593 if (!fTracksEsdParam.At(id)) return;
594 if (!AcceptLaser(id)) return;
595 Double_t xhis[12]={0,0,0,0,0,0,0,0,0,0,0,0};
598 TH1F * hisdz = (TH1F*)fDeltaZ.At(id);
599 if (!hisdz) MakeFitHistos();
600 hisdz = (TH1F*)fDeltaZ.At(id);
601 TH1F * hisP3 = (TH1F*)fDeltaP3.At(id);
602 TH1F * hisP4 = (TH1F*)fDeltaP4.At(id);
603 TH1F * hisdphi = (TH1F*)fDeltaPhi.At(id);
604 TH1F * hisdphiP = (TH1F*)fDeltaPhiP.At(id);
605 TH1F * hisSignal = (TH1F*)fSignals.At(id);
608 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
609 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
610 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
619 param->GetPxPyPz(pxyz);
621 ltrp->GetPxPyPz(lpxyz);
623 Float_t dz = param->GetZ()-ltrp->GetZ();
624 Float_t dphi = (TMath::ATan2(xyz[1],xyz[0])- TMath::ATan2(lxyz[1],lxyz[0]))*254.;
625 Float_t dphiP = param->GetParameter()[2]-ltrp->GetParameter()[2];
626 if (hisdz) hisdz->Fill(dz);
627 if (hisP3) hisP3->Fill(param->GetParameter()[3]);
628 if (hisP4) hisP4->Fill(param->GetParameter()[4]);
629 if (hisdphi) hisdphi->Fill(dphi);
630 if (hisdphiP) hisdphiP->Fill(dphiP);
631 if (hisSignal) hisSignal->Fill(TMath::Sqrt(TMath::Abs(track->GetTPCsignal())));
633 xhis[0] = ltrp->GetId();
634 xhis[1] = ltrp->GetSide();
635 xhis[2] = ltrp->GetRod();
636 xhis[3] = ltrp->GetBundle();
637 xhis[4] = ltrp->GetBeam();
640 xhis[7] = param->GetParameter()[2]-ltrp->GetParameter()[2]; //dp2
641 xhis[8] = param->GetParameter()[3]-ltrp->GetParameter()[3]; //dp3
642 xhis[9] = param->GetParameter()[4];
643 xhis[10]= track->GetTPCNcls();
644 xhis[11]= TMath::Sqrt(TMath::Abs(track->GetTPCsignal()));
646 fHisLaser->Fill(xhis);
649 void AliTPCcalibLaser::FitDriftV(){
651 // Fit corrections to the drift velocity - linear approximation in the z and global y
652 //The transfromatiom from the drift time to the z position done in AliTPCTracnsform class
657 z = s* (z0 - vd*(t-t0))
661 vd - nominal drift velocity
662 zs - miscalibrated position
664 zs = s*(z0 - vd*(1+vr)*(t-(t0+dt))
665 vr - relative change of the drift velocity
670 zs ~ z - s*vr*(z0-s*z)+s*dzt
671 --------------------------------
672 1. Correction function vr constant:
675 dz = zs-z = -s*vr *(z0-s*z)+s*dzt
676 dzs/dl = dz/dl +s*s*vr*dz/dl
680 const Float_t kZCut = 240; // remove the closest laser beam
681 const Float_t kSaturCut = 0.05; // remove saturated lasers - cut on fraction of saturated
682 const Float_t kDistCut = 3; // distance sigma cut
683 const Float_t kDistCutAbs = 0.25;
684 const Float_t kMinClusters = 60; // minimal amount of the clusters
685 const Float_t kMinSignal = 16; // minimal mean height of the signal
686 const Float_t kChi2Cut = 0.1; // chi2 cut to accept drift fit
687 static TLinearFitter fdriftA(3,"hyp2");
688 static TLinearFitter fdriftC(3,"hyp2");
689 static TLinearFitter fdriftAC(4,"hyp3");
690 TVectorD fitA(3),fitC(3),fitAC(4);
692 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
693 AliTPCParam * tpcparam = calib->GetParameters();
696 for (Int_t id=0; id<336; id++) fFitZ[id]=0;
706 for (Int_t iter=0; iter<3; iter++){
707 fdriftA.ClearPoints();
708 fdriftC.ClearPoints();
709 fdriftAC.ClearPoints();
711 for (Int_t id=0; id<336; id++){
712 if (!fTracksEsdParam.At(id)) continue;
713 if (!AcceptLaser(id)) continue;
714 if ( fClusterSatur[id]>kSaturCut) continue;
715 if ( fClusterCounter[id]<kMinClusters) continue;
716 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
717 if (track->GetTPCsignal()<kMinSignal) continue;
718 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
719 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
726 param->GetPxPyPz(pxyz);
728 ltrp->GetPxPyPz(lpxyz);
729 if (TMath::Abs(lxyz[2])>kZCut) continue;
730 Float_t sz = (ltrp->GetSide()==0) ? TMath::Sqrt(chi2A): TMath::Sqrt(chi2C);
731 if (npointsAC>0) sz =TMath::Sqrt(chi2AC);
732 if (TMath::Abs(fFitZ[id])>sz*kDistCut) continue;
733 if (iter>0 && TMath::Abs(fFitZ[id])>kDistCutAbs) continue;
736 Double_t zlength = tpcparam->GetZLength(0);
737 Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
738 Double_t mdrift = zlength-TMath::Abs(xyz[2]);
739 Double_t xxx[2] = {ldrift,lxyz[1]*ldrift/(zlength*250.)};
740 if (ltrp->GetSide()==0){
741 fdriftA.AddPoint(xxx,mdrift,1);
743 fdriftC.AddPoint(xxx,mdrift,1);
745 Double_t xxx2[3] = {ltrp->GetSide(), ldrift,lxyz[1]*ldrift/(zlength*250.)};
746 fdriftAC.AddPoint(xxx2,mdrift,1);
749 if (fdriftA.GetNpoints()>10){
752 if (iter==0) fdriftA.EvalRobust(0.7);
753 else fdriftA.EvalRobust(0.8);
754 fdriftA.GetParameters(fitA);
755 npointsA= fdriftA.GetNpoints();
756 chi2A = fdriftA.GetChisquare()/fdriftA.GetNpoints();
757 if (chi2A<kChi2Cut ||(*fFitAside)[0]==0 ) {
758 if (fFitAside->GetNoElements()<5) fFitAside->ResizeTo(5);
759 (*fFitAside)[0] = fitA[0];
760 (*fFitAside)[1] = fitA[1];
761 (*fFitAside)[2] = fitA[2];
762 (*fFitAside)[3] = fdriftA.GetNpoints();
763 (*fFitAside)[4] = chi2A;
766 if (fdriftC.GetNpoints()>10){
768 if (iter==0) fdriftC.EvalRobust(0.7);
769 else fdriftC.EvalRobust(0.8);
771 fdriftC.GetParameters(fitC);
772 npointsC= fdriftC.GetNpoints();
773 chi2C = fdriftC.GetChisquare()/fdriftC.GetNpoints();
774 if (chi2C<kChi2Cut||(*fFitCside)[0]==0) {
775 if (fFitCside->GetNoElements()<5) fFitCside->ResizeTo(5);
776 (*fFitCside)[0] = fitC[0];
777 (*fFitCside)[1] = fitC[1];
778 (*fFitCside)[2] = fitC[2];
779 (*fFitCside)[3] = fdriftC.GetNpoints();
780 (*fFitCside)[4] = chi2C;
784 if (fdriftAC.GetNpoints()>10&&fdriftC.GetNpoints()>10&&fdriftA.GetNpoints()>10){
786 if (iter==0) fdriftAC.EvalRobust(0.7);
787 else fdriftAC.EvalRobust(0.8);
789 fdriftAC.GetParameters(fitAC);
790 npointsAC= fdriftAC.GetNpoints();
791 chi2AC = fdriftAC.GetChisquare()/fdriftAC.GetNpoints();
792 if (chi2AC<kChi2Cut||(*fFitACside)[0]==0) (*fFitACside) = fitAC;
795 for (Int_t id=0; id<336; id++){
796 if (!fTracksEsdParam.At(id)) continue;
798 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
799 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
805 param->GetPxPyPz(pxyz);
807 ltrp->GetPxPyPz(lpxyz);
808 Double_t zlength = tpcparam->GetZLength(0);
809 Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
810 Double_t mdrift = zlength-TMath::Abs(xyz[2]);
813 if (ltrp->GetSide()==0){
814 fz = (fitA)[0]+(fitA)[1]*ldrift+(fitA)[2]*lxyz[1]*ldrift/(zlength*250.);
816 fz = (fitC)[0]+(fitC)[1]*ldrift+(fitC)[2]*lxyz[1]*ldrift/(zlength*250.);
819 fz = (fitAC)[0]+(fitAC)[1]*ltrp->GetSide()+(fitAC)[2]*ldrift+(fitAC)[3]*lxyz[1]*ldrift/(zlength*250.);
824 TTreeSRedirector *cstream = GetDebugStreamer();
825 TTimeStamp tstamp(fTime);
826 Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
827 Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
828 Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
829 Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
830 Double_t temp0 = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
831 Double_t temp1 = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
832 TVectorD vecGoofie(20);
833 AliDCSSensorArray* goofieArray = AliTPCcalibDB::Instance()->GetGoofieSensors(fRun);
835 for (Int_t isensor=0; isensor<goofieArray->NumSensors();isensor++){
836 AliDCSSensor *gsensor = goofieArray->GetSensor(isensor);
837 if (gsensor) vecGoofie[isensor]=gsensor->GetValue(tstamp);
841 (*cstream)<<"driftv"<<
842 "run="<<fRun<< // run number
843 "event="<<fEvent<< // event number
844 "time="<<fTime<< // time stamp of event
845 "trigger="<<fTrigger<< // trigger
846 "mag="<<fMagF<< // magnetic field
847 // Environment values
848 "press0="<<valuePressure0<<
849 "press1="<<valuePressure1<<
850 "pt0="<<ptrelative0<<
851 "pt1="<<ptrelative1<<
854 "vecGoofie.="<<&vecGoofie<<
858 "driftA.="<<fFitAside<<
859 "driftC.="<<fFitCside<<
860 "driftAC.="<<fFitACside<<
873 Float_t AliTPCcalibLaser::GetDistance(AliExternalTrackParam *param, AliTPCLaserTrack *ltrp){
875 // get distance between mirror and laser track
886 dist+=TMath::Abs((TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*param->GetX());
889 // apply drift correction if already exist
892 if (ltrp->GetSide()==0){
893 if ((*fFitAside)[1]>0.) dz = ((*fFitAside)[0]+(*fFitAside)[1]*lxyz[2]+(*fFitAside)[2]*lxyz[1])-xyz[2];
895 if ((*fFitCside)[1]>0.) dz = ((*fFitCside)[0]+(*fFitCside)[1]*lxyz[2]+(*fFitCside)[2]*lxyz[1])-xyz[2];
897 if (TMath::Abs(dz)>3*(TMath::Abs(lxyz[2]-xyz[2])+1)) dz= TMath::Abs(lxyz[2]-xyz[2]);
898 dist+=TMath::Abs(dz);
900 // phi dist - divergence on 50 cm
902 dist = TMath::Abs((param->GetParameter()[2]-ltrp->GetParameter()[2])*50);
907 Bool_t AliTPCcalibLaser::AcceptLaser(Int_t id){
912 TCut cutP0("cutP0","abs((atan2(x1,x0)-atan2(lx1,lx0))*254)<1.5");
913 TCut cutP1("cutP1","abs(LTr.fP[1]-Tr.fP[1])<30");
914 TCut cutP2("cutP2","abs(LTr.fP[2]-Tr.fP[2])<0.03");
915 TCut cutP3("cutP3","abs(Tr.fP[3])<0.05");
916 TCut cutP4("cutPt","abs(Tr.fP[4])<0.1");
918 TCut cutA = cutP0+cutP1+cutP2+cutP3+cutP4;
920 AliExternalTrackParam *param =(AliExternalTrackParam*)fTracksEsdParam.At(id);
921 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
922 //AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
927 if (TMath::Abs((TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*254)>1.5) return kFALSE; //cut y- P0
928 if (TMath::Abs(param->GetParameter()[1]-ltrp->GetParameter()[1])>30) return kFALSE; // cutZ -P1
929 if (TMath::Abs(param->GetParameter()[2]-ltrp->GetParameter()[2])>0.03) return kFALSE; // cut -P2
930 if (TMath::Abs(param->GetParameter()[3])>0.05) return kFALSE; // cut Tl -P3
931 if (TMath::Abs(param->GetParameter()[4])>0.1) return kFALSE; // cut Pt -P4
938 Int_t AliTPCcalibLaser::FindMirror(AliESDtrack *track, AliTPCseed *seed){
940 // Find corresponding mirror
941 // add the corresponding tracks
944 Float_t kRadius0 = 252;
945 Float_t kRadius = 253.4;
947 if (!track->GetOuterParam()) return -1;
948 AliExternalTrackParam param(*(track->GetOuterParam()));
949 AliTracker::PropagateTrackTo(¶m,kRadius0,0.10566,3,kTRUE);
950 AliTracker::PropagateTrackTo(¶m,kRadius,0.10566,0.1,kTRUE);
951 AliTPCLaserTrack ltr;
952 AliTPCLaserTrack *ltrp=0x0;
953 // AliTPCLaserTrack *ltrpjw=0x0;
955 Int_t id = AliTPCLaserTrack::IdentifyTrack(¶m);
956 // Int_t idjw = AliTPCLaserTrack::IdentifyTrackJW(¶m);
957 //AliDebug(4,Form("Identified Track: %03d (%03d)",id,idjw));
959 if (id!=-1 && (AliTPCLaserTrack::GetTracks()->UncheckedAt(id)))
960 ltrp=(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
970 Float_t counterSatur=0;
971 for (Int_t irow=158;irow>-1;--irow) {
972 AliTPCclusterMI *c=seed->GetClusterPointer(irow);
974 Double_t pedgeY = c->GetX()*TMath::DegToRad()*(10)-TMath::Abs(c->GetY());
975 Double_t pedgeX = TMath::Min((irow)*0.75, (159.-irow)*1.5);
976 if (pedgeY<3) continue;
977 if (pedgeX<3) continue;
979 if (c->GetMax()>900) counterSatur++;
981 counterSatur/=(countercl+1);
983 if (counterSatur>fClusterSatur[id]) fClusterSatur[id]=counterSatur;
986 Float_t radius=TMath::Abs(ltrp->GetX());
987 AliTracker::PropagateTrackTo(¶m,radius,0.10566,0.01,kTRUE);
988 param.Rotate(ltrp->GetAlpha());
990 if (!fTracksMirror.At(id)) fTracksMirror.AddAt(ltrp,id);
993 // choose closer track
995 AliExternalTrackParam * param0 = (AliExternalTrackParam *)fTracksEsdParam.At(id);
997 Float_t dist0=GetDistance(param0,ltrp);
998 Float_t dist1=GetDistance(¶m,ltrp);
999 if (dist0<dist1) accept=kFALSE;
1003 fClusterCounter[id]=countercl;
1004 fTracksEsdParam.AddAt(param.Clone(),id);
1005 fTracksEsd.AddAt(track,id);
1006 fTracksTPC.AddAt(seed,id);
1013 void AliTPCcalibLaser::DumpLaser(Int_t id) {
1015 // Dump Laser info to the tree
1017 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
1018 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
1019 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
1028 param->GetPxPyPz(pxyz);
1030 ltrp->GetPxPyPz(lpxyz);
1031 Float_t dist3D = GetDistance(param,ltrp);
1032 Float_t dist0 = (TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*param->GetX();
1033 Float_t distphi = (param->GetParameter()[2]-ltrp->GetParameter()[2])*50;
1036 if (fStreamLevel>0){
1037 TTreeSRedirector *cstream = GetDebugStreamer();
1038 Int_t time = fESD->GetTimeStamp();
1039 Bool_t accept = AcceptLaser(id);
1041 (*cstream)<<"Track"<<
1043 "run="<<fRun<< // run number
1044 "event="<<fEvent<< // event number
1045 "time="<<fTime<< // time stamp of event
1046 "trigger="<<fTrigger<< // trigger
1047 "mag="<<fMagF<< // magnetic field
1051 "driftA.="<<fFitAside<<
1052 "driftC.="<<fFitCside<<
1056 "distphi="<<distphi<<
1059 "counter="<<fCounter[id]<<
1060 "clcounter="<<fClusterCounter[id]<<
1061 "satur="<<fClusterSatur[id]<<
1085 void AliTPCcalibLaser::RefitLaserJW(Int_t id){
1087 // Refit the track with different tracklet models:
1088 // 1. Per ROC using the kalman filter, different edge cuts
1089 // 2. Per ROC linear in y and z
1090 // 3. Per ROC quadratic in y and z
1091 // 4. Per track offset for each sector, linear for each sector, common quadratic
1092 // store x, y, z information for all models and the cluster to calculate the residuals
1095 // The clusters which do not fulfill given criteria are skipped
1097 // Cluters removed from fit
1098 // 1. Extended shape > kShapeCut
1099 // 2. In saturation Max > kMax
1100 // 3. Distance to edge < cutEdge
1102 // Clusters not used for the calibration:
1104 // 1. Extended shape > kShapeCut
1105 // 2. In saturation Max > kMax
1108 AliTPCseed *track = (AliTPCseed*)fTracksTPC.At(id);
1109 AliExternalTrackParam *extparam=(AliExternalTrackParam*)fTracksEsdParam.At(id);
1110 AliTPCLaserTrack *ltrp = (AliTPCLaserTrack*)fTracksMirror.At(id);
1112 AliTPCclusterMI dummyCl;
1115 Int_t kMaxTracklets=2;
1116 Float_t kShapeCut = 1.3;
1117 Float_t kRatioCut = 2.;
1119 Float_t kMax = 900.;
1122 //=============================================//
1123 // Linear Fitters for the Different Approaches //
1124 //=============================================//
1125 //linear fit model in y and z; inner - outer sector, combined with offset
1126 static TLinearFitter fy1I(2,"hyp1");
1127 static TLinearFitter fy1O(2,"hyp1");
1128 static TLinearFitter fz1I(2,"hyp1");
1129 static TLinearFitter fz1O(2,"hyp1");
1130 static TLinearFitter fy1IO(3,"hyp2");
1131 static TLinearFitter fz1IO(3,"hyp2");
1132 //quadratic fit model in y and z; inner - sector
1133 static TLinearFitter fy2I(3,"hyp2");
1134 static TLinearFitter fy2O(3,"hyp2");
1135 static TLinearFitter fz2I(3,"hyp2");
1136 static TLinearFitter fz2O(3,"hyp2");
1137 //common quadratic fit for IROC and OROC in y and z
1138 static TLinearFitter fy4(5,"hyp4");
1139 static TLinearFitter fz4(5,"hyp4");
1149 //=============================//
1150 // Loop over all Tracklet Cuts //
1151 //=============================//
1152 for (Int_t icut=0; icut<fNcuts; icut++){
1153 Float_t xinMin = 2500, xinMax=-90;
1154 Float_t xoutMin=2500, xoutMax=-90;
1155 Float_t msigmaYIn=0;
1156 Float_t msigmaYOut=0;
1157 Float_t mqratioIn=0;
1158 Float_t mqratioOut=0;
1161 AliDebug(4,Form("Processing cut %d for track with ID %d",icut,id));
1163 Double_t edgeCutX = fEdgeXcuts[icut];
1164 Double_t edgeCutY = fEdgeYcuts[icut];
1165 Int_t nclCut = (Int_t)fNClCuts[icut];
1166 //=========================//
1167 // Parameters to calculate //
1168 //=========================//
1169 //fit parameter inner, outer tracklet and combined fit
1170 TVectorD vecy1resInner(2),vecz1resInner(2); //pol1 fit parameters inner
1171 TVectorD vecy2resInner(3),vecz2resInner(3); //pol2 fit parameters inner
1173 TVectorD vecy1resOuter(2),vecz1resOuter(2); //pol1 fit parameters outer
1174 TVectorD vecy2resOuter(3),vecz2resOuter(3); //pol2 fit parameters outer
1175 TVectorD vecy4res(5),vecz4res(5);
1176 TVectorD vecy1resIO(3),vecz1resIO(3);
1177 // cluster and track positions for each row - used for residuals
1178 TVectorD vecgX(159); // global X
1179 TVectorD vecgY(159); // global Y
1180 TVectorD vecgZ(159); // global Z
1182 TVectorD vecX(159); // x is the same for all (row center)
1183 TVectorD vecYkalman(159); // y from kalman fit
1184 TVectorD vecZkalman(159); // z from kalman fit
1185 TVectorD vecY1(159); // y from pol1 fit per ROC
1186 TVectorD vecZ1(159); // z from pol1 fit per ROC
1187 TVectorD vecY1IO(159); // y from pol1 fit per ROC
1188 TVectorD vecZ1IO(159); // z from pol1 fit per ROC
1189 TVectorD vecY2(159); // y from pol2 fit per ROC
1190 TVectorD vecZ2(159); // z from pol2 fit per ROC
1191 TVectorD vecY4(159); // y from sector fit
1192 TVectorD vecZ4(159); // z from sector fit
1193 TVectorD vecClY(159); // y cluster position
1194 TVectorD vecClZ(159); // z cluster position
1195 TVectorD vecSec(159); // sector for each row
1196 TVectorD isReject(159); // flag - cluster to be rejected
1198 Double_t chi2I1z=0; // chi2 of pol1 fit in z (inner)
1199 Double_t chi2I1y=0; // chi2 of pol1 fit in y (inner)
1200 Double_t chi2O1z=0; // chi2 of pol1 fit in z (outer)
1201 Double_t chi2O1y=0; // chi2 of pol1 fit in y (outer)
1202 Double_t chi2IO1z=0; // chi2 of pol1 fit in z (outer)
1203 Double_t chi2IO1y=0; // chi2 of pol1 fit in y (outer)
1204 Double_t chi2I2z=0; // chi2 of pol2 fit in z (inner)
1205 Double_t chi2I2y=0; // chi2 of pol2 fit in y (inner)
1206 Double_t chi2O2z=0; // chi2 of pol2 fit in z (outer)
1207 Double_t chi2O2y=0; // chi2 of pol2 fit in y (outer)
1208 Double_t chi2IOz=0; // chi2 of hyp4 fit in z (inner+outer)
1209 Double_t chi2IOy=0; // chi2 of hyp4 fit in y (inner+outer)
1211 Int_t innerSector = -1; // number of inner sector
1212 Int_t outerSector = -1; // number of outer sector
1213 Int_t nclI=0; // number of clusters (inner)
1214 Int_t nclO=0; // number of clusters (outer)
1215 //=================================================//
1216 // Perform the Kalman Fit using the Tracklet Class //
1217 //=================================================//
1218 AliTPCTracklet::SetEdgeCut(edgeCutX,edgeCutY);
1219 TObjArray tracklets=
1220 AliTPCTracklet::CreateTracklets(track,AliTPCTracklet::kKalman,
1221 kFALSE,nclCut,kMaxTracklets);
1222 // tracklet pointers
1223 AliTPCTracklet *trInner = (AliTPCTracklet*)tracklets.At(0);
1224 AliTPCTracklet *trOuter = (AliTPCTracklet*)tracklets.At(1);
1225 AliTPCTracklet *tr=0x0;
1226 AliTPCTracklet dummy;
1227 //continue if we didn't find a tracklet
1228 if ( !trInner && !trOuter ) continue;
1229 //================================================================================//
1230 // Swap Inner and Outer if necessary (inner sector is definde by smaller local x) //
1231 //================================================================================//
1232 if ( trInner && trOuter ){
1233 if ( !trInner->GetInner() || !trOuter->GetInner() ) continue;
1234 if ( trInner->GetInner()->GetX() > trOuter->GetInner()->GetX() ){
1238 AliDebug(5,Form("Swapped Sectors: %02d (%f) <-> %02d (%f)", trOuter->GetSector(), trOuter->GetInner()->GetX(), trInner->GetSector(), trInner->GetInner()->GetX()));
1242 if ( !trInner->GetInner() ) continue;
1244 if ( trInner->GetSector()>35 ){
1249 if ( !trOuter->GetInner() ) continue;
1251 if ( trOuter->GetSector()<36 ){
1257 innerSector = trInner->GetSector();
1258 if ( innerSector>=0 ) AliDebug(5,Form("Found inner Sector %02d at X %.2f", innerSector, trInner->GetInner()->GetX()));
1259 outerSector = trOuter->GetSector();
1260 if ( outerSector>=0 ) AliDebug(5,Form("Found outer Sector %02d at X %.2f", outerSector, trOuter->GetInner()->GetX()));
1262 // array of clusters
1263 TClonesArray arrCl("AliTPCclusterMI",159);
1264 arrCl.ExpandCreateFast(159);
1265 //=======================================//
1266 // fill fitters with cluster information //
1267 //=======================================//
1268 AliDebug(3,"Filing Cluster Information");
1273 for (Int_t irow=158;irow>-1;--irow) {
1274 AliTPCclusterMI *c=track->GetClusterPointer(irow);
1275 AliTPCclusterMI &cl = (AliTPCclusterMI&) (*arrCl[irow]);
1280 Float_t meanY=0, sumY=0;
1281 for (Int_t drow=-1;drow<=1;drow++) {
1282 if (irow+drow<0) continue;
1283 if (irow+drow>158) continue;
1284 AliTPCclusterMI *ccurrent=track->GetClusterPointer(irow);
1285 if (!ccurrent) continue;
1286 Int_t roc = static_cast<Int_t>(ccurrent->GetDetector());
1287 if ( roc!=innerSector && roc!=outerSector ) continue;
1288 if (ccurrent->GetX()<10) continue;
1289 if (ccurrent->GetY()==0) continue;
1290 meanY+=ccurrent->GetY();
1293 if (sumY>0) meanY/=sumY;
1298 Double_t pedgeY = c->GetX()*TMath::Tan(TMath::DegToRad()*(10))-TMath::Abs(meanY);
1299 Double_t pedgeX = TMath::Min((irow)*0.75, (159.-irow)*1.5);
1302 Int_t roc = static_cast<Int_t>(c->GetDetector());
1303 if ( roc!=innerSector && roc!=outerSector ) continue;
1305 //store clusters in clones array
1308 if (c->GetMax()<4) continue; // noise cluster?
1309 if (TMath::Abs(c->GetY())<0.0001) continue; // noise cluster?
1311 vecX[irow] = c->GetX();
1312 vecClY[irow] = c->GetY();
1313 vecClZ[irow] = c->GetZ();
1316 // c->GetGlobalXYZ(gxyz);
1317 // vecgX[irow] = gxyz[0];
1318 // vecgY[irow] = gxyz[1];
1319 // vecgZ[irow] = gxyz[2];
1321 Double_t x = vecX[irow]-133.4; //reference is between IROC and OROC
1322 Double_t y = vecClY[irow];
1323 Double_t z = vecClZ[irow];
1325 Double_t x2[2]={x,x*x}; //linear and parabolic parameters
1326 Double_t x4[4]={0,0,0,0}; //hyp4 parameters
1327 Double_t xIO[2]={0,x}; //common linear + offset IROC-OROC
1328 if ( roc == innerSector ) {
1329 x4[0]=1; //offset inner - outer sector
1330 x4[1]=x; //slope parameter inner sector
1333 x4[2]=x; //slope parameter outer sector
1335 x4[3]=x*x; //common parabolic shape
1336 if (pedgeX < fEdgeXcuts[icut]) continue;
1337 if (pedgeY < fEdgeYcuts[icut]) continue;
1338 if (c->GetMax()>900) continue; // cluster in saturation
1340 if ( roc==innerSector ){
1341 fy1I.AddPoint(x2,y);
1342 fz1I.AddPoint(x2,z);
1343 fy2I.AddPoint(x2,y);
1344 fz2I.AddPoint(x2,z);
1346 if (c->GetX()<xinMin) xinMin=c->GetX();
1347 if (c->GetX()>xinMax) xinMax=c->GetX();
1349 msigmaYIn +=TMath::Sqrt(c->GetSigmaY2());
1350 mqratioIn +=c->GetMax()/c->GetQ();
1353 if ( roc==outerSector ){
1354 fy1O.AddPoint(x2,y);
1355 fz1O.AddPoint(x2,z);
1356 fy2O.AddPoint(x2,y);
1357 fz2O.AddPoint(x2,z);
1359 if (c->GetX()<xoutMin) xoutMin=c->GetX();
1360 if (c->GetX()>xoutMax) xoutMax=c->GetX();
1361 msigmaYOut +=TMath::Sqrt(c->GetSigmaY2());
1362 mqratioOut +=c->GetMax()/c->GetQ();
1367 fy1IO.AddPoint(xIO,y);
1368 fz1IO.AddPoint(xIO,z);
1378 //======================================//
1379 // Evaluate and retrieve fit parameters //
1380 //======================================//
1381 AliDebug(5,Form("Evaluating fits with inner (outer) Sec: %02d (%02d)",innerSector,outerSector));
1383 if ( (innerSector>-1) && (fy1I.GetNpoints()>0) ){
1388 fy1I.GetParameters(vecy1resInner);
1389 fz1I.GetParameters(vecz1resInner);
1390 fy2I.GetParameters(vecy2resInner);
1391 fz2I.GetParameters(vecz2resInner);
1392 chi2I1y=fy1I.GetChisquare()/(fy1I.GetNpoints()-2);
1393 chi2I1z=fz1I.GetChisquare()/(fz1I.GetNpoints()-2);
1394 chi2I2y=fy2I.GetChisquare()/(fy2I.GetNpoints()-3);
1395 chi2I2z=fz2I.GetChisquare()/(fz2I.GetNpoints()-3);
1398 if ( (outerSector>-1) && (fy1O.GetNpoints()>0) ){
1403 fy1O.GetParameters(vecy1resOuter);
1404 fz1O.GetParameters(vecz1resOuter);
1405 fy2O.GetParameters(vecy2resOuter);
1406 fz2O.GetParameters(vecz2resOuter);
1407 chi2O1y=fy1O.GetChisquare()/(fy1O.GetNpoints()-2);
1408 chi2O1z=fz1O.GetChisquare()/(fz1O.GetNpoints()-2);
1409 chi2O2y=fy2O.GetChisquare()/(fy2O.GetNpoints()-3);
1410 chi2O2z=fz2O.GetChisquare()/(fz2O.GetNpoints()-3);
1413 if ( innerSector>0 && outerSector>0 ){
1414 if (fy4.GetNpoints()>0) {
1416 fy4.GetParameters(vecy4res);
1417 chi2IOy=fy4.GetChisquare()/(fy4.GetNpoints()-5);
1419 if (fz4.GetNpoints()>0) {
1421 fz4.GetParameters(vecz4res);
1422 chi2IOz=fz4.GetChisquare()/(fz4.GetNpoints()-5);
1424 if (fy1IO.GetNpoints()>0) {
1426 fy1IO.GetParameters(vecy1resIO);
1427 chi2IO1y=fy1IO.GetChisquare()/(fy1IO.GetNpoints()-3);
1429 if (fz1IO.GetNpoints()>0) {
1431 fz1IO.GetParameters(vecz1resIO);
1432 chi2IO1z=fz1IO.GetChisquare()/(fz1IO.GetNpoints()-3);
1436 fy4.ClearPoints(); fz4.ClearPoints();
1437 fy1I.ClearPoints(); fy1O.ClearPoints();
1438 fz1I.ClearPoints(); fz1O.ClearPoints();
1439 fy2I.ClearPoints(); fy2O.ClearPoints();
1440 fz2I.ClearPoints(); fz2O.ClearPoints();
1441 fy1IO.ClearPoints(); fz1IO.ClearPoints();
1442 //==============================//
1443 // calculate tracklet positions //
1444 //==============================//
1445 AliDebug(4,"Calculate tracklet positions");
1446 for (Int_t irow=158;irow>-1;--irow) {
1448 AliTPCclusterMI *c=track->GetClusterPointer(irow);
1449 if ( vecSec[irow]!=innerSector && vecSec[irow]!=outerSector ) { // no cluster in given sectors
1453 if (!c) { //no cluster
1456 if (c->GetMax()>kMax){ //saturation
1459 if ( vecSec[irow] == outerSector ) { //extended shape
1460 if (c->GetMax()/c->GetQ()> mqratioOut*kRatioCut) isReject[irow]+=8;
1461 if (TMath::Sqrt(c->GetSigmaY2())>msigmaYOut*kShapeCut) isReject[irow]+=16;
1463 if (c->GetMax()/c->GetQ()> mqratioIn*kRatioCut) isReject[irow]+=8;
1464 if (TMath::Sqrt(c->GetSigmaY2())>msigmaYIn*kShapeCut) isReject[irow]+=16;
1470 if ( vecSec[irow]==-1 ) continue; //no cluster info
1471 if ( vecSec[irow]!=innerSector && vecSec[irow]!=outerSector ) continue;
1473 Double_t x=vecX[irow];
1474 Double_t xref=x-133.4;
1476 Double_t yoffInner=0;
1477 Double_t zoffInner=0;
1478 Double_t yoffInner1=0;
1479 Double_t zoffInner1=0;
1480 Double_t yslopeInner=0;
1481 Double_t yslopeOuter=0;
1482 Double_t zslopeInner=0;
1483 Double_t zslopeOuter=0;
1484 //positions of hyperplane fits
1485 if ( vecSec[irow] == outerSector ) {
1487 vecY1[irow]=vecy1resOuter[0]+vecy1resOuter[1]*xref;
1488 vecZ1[irow]=vecz1resOuter[0]+vecz1resOuter[1]*xref;
1489 vecY2[irow]=vecy2resOuter[0]+vecy2resOuter[1]*xref+vecy2resOuter[2]*xref*xref;
1490 vecZ2[irow]=vecz2resOuter[0]+vecz2resOuter[1]*xref+vecz2resOuter[2]*xref*xref;
1491 yslopeOuter=vecy4res[3];
1492 zslopeOuter=vecz4res[3];
1495 vecY1[irow]=vecy1resInner[0]+vecy1resInner[1]*xref;
1496 vecZ1[irow]=vecz1resInner[0]+vecz1resInner[1]*xref;
1497 vecY2[irow]=vecy2resInner[0]+vecy2resInner[1]*xref+vecy2resInner[2]*xref*xref;
1498 vecZ2[irow]=vecz2resInner[0]+vecz2resInner[1]*xref+vecz2resInner[2]*xref*xref;
1499 yoffInner=vecy4res[1];
1500 zoffInner=vecz4res[1];
1501 yoffInner1=vecy1resIO[1];
1502 zoffInner1=vecz1resIO[1];
1503 yslopeInner=vecy4res[2];
1504 zslopeInner=vecz4res[2];
1506 vecY1IO[irow]=vecy1resIO[0]+yoffInner1+vecy1resIO[2]*xref;
1507 vecZ1IO[irow]=vecz1resIO[0]+zoffInner1+vecz1resIO[2]*xref;
1508 vecY4[irow]=vecy4res[0]+yoffInner+yslopeInner*xref+yslopeOuter*xref+vecy4res[4]*xref*xref;
1509 vecZ4[irow]=vecz4res[0]+zoffInner+zslopeInner*xref+zslopeOuter*xref+vecz4res[4]*xref*xref;
1510 //positions of kalman fits
1511 Double_t gxyz[3],xyz[3];
1512 AliExternalTrackParam *param = 0x0;
1514 param=tr->GetInner();
1516 param->GetXYZ(gxyz);
1517 Float_t bz = AliTracker::GetBz(gxyz);
1518 param->GetYAt(x, bz, xyz[1]);
1519 param->GetZAt(x, bz, xyz[2]);
1520 vecYkalman[irow]=xyz[1];
1521 vecZkalman[irow]=xyz[2];
1528 //=====================================================================//
1529 // write results from the different tracklet fits with debug streamers //
1530 //=====================================================================//
1531 if (fStreamLevel>4){
1532 TTreeSRedirector *cstream = GetDebugStreamer();
1534 Float_t dedx = track->GetdEdx();
1535 (*cstream)<<"FitModels"<<
1536 "run="<<fRun<< // run number
1537 "event="<<fEvent<< // event number
1538 "time="<<fTime<< // time stamp of event
1539 "trigger="<<fTrigger<< // trigger
1540 "mag="<<fMagF<< // magnetic field
1543 "edgeCutX=" << edgeCutX <<
1544 "edgeCutY=" << edgeCutY <<
1545 "nclCut=" << nclCut <<
1546 "innerSector="<< innerSector <<
1547 "outerSector="<< outerSector <<
1550 "Tr.=" << extparam <<
1551 "yPol1In.=" << &vecy1resInner <<
1552 "zPol1In.=" << &vecz1resInner <<
1553 "yPol1InOut.="<< &vecy1resIO <<
1554 "zPol1InOut.="<< &vecz1resIO <<
1555 "yPol2In.=" << &vecy2resInner <<
1556 "zPol2In.=" << &vecz2resInner <<
1557 "yPol1Out.=" << &vecy1resOuter <<
1558 "zPol1Out.=" << &vecz1resOuter <<
1559 "yPol2Out.=" << &vecy2resOuter <<
1560 "zPol2Out.=" << &vecz2resOuter <<
1561 "yInOut.=" << &vecy4res <<
1562 "zInOut.=" << &vecz4res <<
1563 "chi2y1In=" << chi2I1y <<
1564 "chi2z1In=" << chi2I1z <<
1565 "chi2y1InOut="<< chi2IO1y <<
1566 "chi2z1InOut="<< chi2IO1z <<
1567 "chi2y1Out=" << chi2O1y <<
1568 "chi2z1Out=" << chi2O1z <<
1569 "chi2y2In=" << chi2I2y <<
1570 "chi2z2In=" << chi2I2z <<
1571 "chi2y2Out=" << chi2O2y <<
1572 "chi2z2Out=" << chi2O2z <<
1573 "chi2yInOut=" << chi2IOy <<
1574 "chi2zInOut=" << chi2IOz <<
1575 "trletIn.=" << trInner <<
1576 "trletOut.=" << trOuter <<
1579 "xinMin=" << xinMin<<
1580 "xinMax=" << xinMax<<
1581 "xoutMin=" << xoutMin<<
1582 "xoutMax=" << xoutMax<<
1583 "msigmaYIn=" <<msigmaYIn<<
1584 "msigmaYOut=" <<msigmaYOut<<
1585 "mqratioIn=" <<mqratioIn<<
1586 "mqratioOut=" << mqratioOut <<
1591 // wirte residuals information
1592 if (fStreamLevel>5){
1593 TTreeSRedirector *cstream = GetDebugStreamer();
1595 Float_t dedx = track->GetdEdx();
1596 (*cstream)<<"Residuals"<<
1597 "run="<<fRun<< // run number
1598 "event="<<fEvent<< // event number
1599 "time="<<fTime<< // time stamp of event
1600 "trigger="<<fTrigger<< // trigger
1601 "mag="<<fMagF<< // magnetic field
1604 "edgeCutX=" << edgeCutX <<
1605 "edgeCutY=" << edgeCutY <<
1606 "nclCut=" << nclCut <<
1608 "Tr.=" << extparam<<
1611 "vX.=" << &vecgX<< // global x
1612 "vY.=" << &vecgY<< // global y
1613 "vZ.=" << &vecgZ<< // global z
1615 "TrYpol1.=" << &vecY1 <<
1616 "TrZpol1.=" << &vecZ1 <<
1617 "TrYpol2.=" << &vecY2 <<
1618 "TrZpol2.=" << &vecZ2 <<
1619 "TrYpol1InOut.="<< &vecY1IO <<
1620 "TrZpol1InOut.="<< &vecZ1IO <<
1621 "TrYInOut.=" << &vecY4 <<
1622 "TrZInOut.=" << &vecZ4 <<
1623 "ClY.=" << &vecClY <<
1624 "ClZ.=" << &vecClZ <<
1625 "isReject.=" << &isReject<<
1626 "sec.=" << &vecSec <<
1629 "xinMin=" << xinMin<<
1630 "xinMax=" << xinMax<<
1631 "xoutMin=" << xoutMin<<
1632 "xoutMax=" << xoutMax<<
1633 "msigmaYIn=" <<msigmaYIn<<
1634 "msigmaYOut=" <<msigmaYOut<<
1635 "mqratioIn=" <<mqratioIn<<
1636 "mqratioOut=" << mqratioOut <<
1637 "yInOut.=" << &vecy4res <<
1638 "zInOut.=" << &vecz4res <<
1640 "chi2y1In=" << chi2I1y << //
1641 "chi2z1In=" << chi2I1z <<
1642 "chi2y1Out=" << chi2O1y <<
1643 "chi2z1Out=" << chi2O1z <<
1644 "chi2y1InOut="<< chi2IO1y <<
1645 "chi2z1InOut="<< chi2IO1z <<
1646 "chi2y2In=" << chi2I2y <<
1647 "chi2z2In=" << chi2I2z <<
1648 "chi2y2Out=" << chi2O2y <<
1649 "chi2z2Out=" << chi2O2z <<
1650 "chi2yInOut=" << chi2IOy <<
1651 "chi2zInOut=" << chi2IOz <<
1653 "yPol1In.=" << &vecy1resInner <<
1654 "zPol1In.=" << &vecz1resInner <<
1655 "yPol2In.=" << &vecy2resInner <<
1656 "zPol2In.=" << &vecz2resInner <<
1657 "yPol1Out.=" << &vecy1resOuter <<
1658 "zPol1Out.=" << &vecz1resOuter <<
1659 "yPol1InOut.="<< &vecy1resIO <<
1660 "zPol1InOut.="<< &vecz1resIO <<
1661 "yPol2Out.=" << &vecy2resOuter <<
1662 "zPol2Out.=" << &vecz2resOuter <<
1668 //==========================//
1669 // Fill Residual Histograms //
1670 //==========================//
1671 if (!fHisNclIn) MakeFitHistos();
1673 TH2F *profy = (TH2F*)fDeltaYres.UncheckedAt(id);
1674 TH2F *profz = (TH2F*)fDeltaZres.UncheckedAt(id);
1675 TH2F *profy2 = (TH2F*)fDeltaYres2.UncheckedAt(id);
1676 TH2F *profz2 = (TH2F*)fDeltaZres2.UncheckedAt(id);
1677 TH2F *profyabs = (TH2F*)fDeltaYresAbs.UncheckedAt(id);
1678 TH2F *profzabs = (TH2F*)fDeltaZresAbs.UncheckedAt(id);
1679 // TH2F *profy3 = (TH2F*)fDeltaYres3.UncheckedAt(id);
1680 //TH2F *profz3 = (TH2F*)fDeltaZres3.UncheckedAt(id);
1682 for (Int_t irow=158;irow>-1;--irow) {
1683 if (vecSec[irow]==-1)continue; // no cluster info
1684 if (isReject[irow]>0.5) continue; //
1685 Double_t ycl = vecClY[irow];
1686 Double_t yfit = vecY1[irow];
1687 Double_t yfit2 = vecY2[irow];
1688 Double_t x = vecX[irow];
1689 Double_t yabsbeam = -1000;
1690 if(vecSec[irow]==outerSector && (outerSector%36)==fBeamSectorOuter[id])
1691 yabsbeam = fBeamSlopeYOuter[id]*x + fBeamOffsetYOuter[id];
1692 else if((innerSector%36)==fBeamSectorInner[id])
1693 yabsbeam = fBeamSlopeYInner[id]*x + fBeamOffsetYInner[id];
1695 // Double_t yfit3 = vecY2[irow];
1696 Double_t zcl = vecClZ[irow];
1697 Double_t zfit = vecZ1[irow];
1698 Double_t zfit2 = vecZ2[irow];
1699 //Double_t zfit3 = vecZ2[irow];
1702 // The expressions for zcorrected has been obtained by
1703 // inverting the fits in the FitDriftV() method (ignoring the
1704 // global y dependence for now):
1706 // 250 - zmeasured = [0] + [1]*(250 - zreal) + .... (yglobal)
1708 // zreal = (zmeasured + [0] - (1-[1])*250.0)/[1]
1711 // 250 + zmeasured = [0] + [1]*(250+zreal) + .... (yglobal)
1713 // zreal = (zmeasured - [0] + (1 - [1])*250.0)/[1]
1715 Double_t dzabs = -1000;
1716 if (ltrp->GetSide()==0){
1717 if ((*fFitAside)[1]>0.) {
1718 // ignore global y dependence for now
1719 Double_t zcorrected = (zcl + (*fFitAside)[0] -
1720 (1.0-(*fFitAside)[1])*250.0)/(*fFitAside)[1];
1721 // zcorrected = zcl;
1722 if(vecSec[irow]==outerSector && (outerSector%36)==fBeamSectorOuter[id])
1723 dzabs = zcorrected -fBeamSlopeZOuter[id]*x -fBeamOffsetZOuter[id];
1724 else if((innerSector%36)==fBeamSectorInner[id])
1725 dzabs = zcorrected -fBeamSlopeZInner[id]*x -fBeamOffsetZInner[id];
1728 if ((*fFitCside)[1]>0.) {
1729 Double_t zcorrected = (zcl - (*fFitCside)[0] +
1730 (1.0-(*fFitCside)[1])*250.0)/(*fFitCside)[1];
1731 // zcorrected = zcl;
1732 if(vecSec[irow]==outerSector && (outerSector%36)==fBeamSectorOuter[id])
1733 dzabs = zcorrected -fBeamSlopeZOuter[id]*x -fBeamOffsetZOuter[id];
1734 else if((innerSector%36)==fBeamSectorInner[id])
1735 dzabs = zcorrected -fBeamSlopeZInner[id]*x -fBeamOffsetZInner[id];
1739 if (TMath::Abs(yfit-ycl)<2&&TMath::Abs(zfit-zcl)<2){
1741 profy->Fill(irow,ycl-yfit);
1742 profy2->Fill(irow,ycl-yfit2);
1744 profyabs->Fill(irow,-0.99);
1746 profyabs->Fill(irow,ycl-yabsbeam);
1748 // profy3->Fill(irow,ycl-yfit3);
1751 profz->Fill(irow,zcl-zfit);
1752 profz2->Fill(irow,zcl-zfit2);
1753 //profz3->Fill(irow,zcl-zfit3);
1755 profzabs->Fill(irow,-0.99);
1757 profzabs->Fill(irow,dzabs);
1763 // Fill laser fit histograms
1765 Float_t dedx = track->GetdEdx();
1766 if (nclI>20&&nclO>20){
1767 fHisNclIn->Fill(id,nclI); //->Number of clusters inner
1768 fHisNclOut->Fill(id,nclO); //->Number of clusters outer
1769 fHisNclIO->Fill(id,nclI+nclO); //->Number of cluster inner outer
1771 fHisLclIn->Fill(id,xinMax-xinMin); //->Level arm inner
1772 fHisLclOut->Fill(id,xoutMax-xoutMin); //->Level arm outer
1773 fHisLclIO->Fill(id,xoutMax-xinMin); //->Number of cluster inner outer
1775 fHisdEdx->Fill(id,TMath::Sqrt(TMath::Abs(dedx)));
1776 fHisdZfit->Fill(id,fFitZ[id]);
1779 fHisChi2YIn1->Fill(id,TMath::Sqrt(chi2I1y)); //->chi2 y inner - line
1780 fHisChi2YOut1->Fill(id,TMath::Sqrt(chi2O1y)); //->chi2 y inner - line
1781 fHisChi2YIn2->Fill(id,TMath::Sqrt(chi2I2y)); //->chi2 y inner - parabola
1782 fHisChi2YOut2->Fill(id,TMath::Sqrt(chi2O2y)); //->chi2 y inner - parabola
1783 fHisChi2YIO1->Fill(id,TMath::Sqrt(chi2IOy)); //->chi2 y IO - common
1786 fHisChi2ZIn1->Fill(id,TMath::Sqrt(chi2I1z)); //->chi2 z inner - line
1787 fHisChi2ZOut1->Fill(id,TMath::Sqrt(chi2O1z)); //->chi2 z inner - line
1788 fHisChi2ZIn2->Fill(id,TMath::Sqrt(chi2O2y)); //->chi2 z inner - parabola
1789 fHisChi2ZOut2->Fill(id,TMath::Sqrt(chi2O2z)); //->chi2 z inner - parabola
1790 fHisChi2ZIO1->Fill(id,TMath::Sqrt(chi2IOz)); //->chi2 z IO - common
1793 fHisPy1vP0->Fill(id,vecy1resOuter[0]-vecy1resInner[0]); //-> delta y P0outer-P0inner - line
1794 fHisPy2vP0->Fill(id,vecy2resOuter[0]-vecy2resInner[0]); //-> delta y P0outer-P0inner - parabola
1795 fHisPy3vP0->Fill(id,vecy4res[1]); //-> delta y P0outer-P0inner - common parabola
1797 fHisPy1vP1->Fill(id,vecy1resOuter[1]-vecy1resInner[1]); //-> delta ky P1outer-P1inner - line
1798 fHisPy2vP1->Fill(id,vecy2resOuter[1]-vecy2resInner[1]); //-> delta ky P1outer-P1inner - parabola
1799 fHisPy3vP1->Fill(id,vecy4res[3]-vecy4res[2]); //-> delta ky P1outer-P1inner - common parabola
1801 fHisPy3vP2IO->Fill(id,vecy4res[4]); //-> Curv P2outerinner - common parabola
1802 fHisPz1vP0->Fill(id,vecz1resOuter[0]-vecz1resInner[0]); //-> delta z P0outer-P0inner - line
1803 fHisPz2vP0->Fill(id,vecz2resOuter[0]-vecz2resInner[0]); //-> delta z P0outer-P0inner - parabola
1804 fHisPz3vP0->Fill(id,vecz4res[1]); //-> delta z P0outer-P0inner - common parabola
1806 fHisPz1vP1->Fill(id,vecz1resOuter[1]-vecz1resInner[1]); //-> delta kz P1outer-P1inner - line
1807 fHisPz2vP1->Fill(id,vecz2resOuter[1]-vecz2resInner[1]); //-> delta kz P1outer-P1inner - parabola
1808 fHisPz3vP1->Fill(id,vecz4res[3]-vecz4res[2]); //-> delta kz P1outer-P1inner - common parabola
1809 fHisPz3vP2IO->Fill(id,vecz4res[4]); //-> Curv P2outerinner - common parabola
1812 fHisPy2vP2In->Fill(id,vecy2resInner[2]); //-> Curv P2inner - parabola
1813 fHisPz2vP2In->Fill(id,vecz2resInner[2]); //-> Curv P2inner - parabola
1817 fHisPz2vP2Out->Fill(id,vecz2resOuter[2]); //-> Curv P2outer - parabola
1818 fHisPy2vP2Out->Fill(id,vecy2resOuter[2]); //-> Curv P2outer - parabola
1826 void AliTPCcalibLaser::DumpMeanInfo(Float_t bfield, Int_t run){
1828 // Dump information about laser beams
1829 // isOK variable indicates usability of the beam
1830 // Beam is not usable if:
1831 // a. No entries in range (krmsCut0)
1832 // b. Big sperad (krmscut1)
1833 // c. RMSto fit sigma bigger then (kmultiCut)
1834 // d. Too big angular spread
1837 const Float_t krmsCut0=0.001;
1838 const Float_t krmsCut1=0.16;
1839 const Float_t kmultiCut=2;
1840 const Float_t kcutP0=0.002;
1842 AliTPCcalibLaser *laser = this;
1843 TTreeSRedirector *pcstream = new TTreeSRedirector("laserMean.root");
1844 TF1 fg("fg","gaus");
1847 for (Int_t id=0; id<336; id++){
1849 TH1F * hisphi = (TH1F*)laser->fDeltaPhi.At(id);
1850 TH1F * hisphiP = (TH1F*)laser->fDeltaPhiP.At(id);
1851 TH1F * hisZ = (TH1F*)laser->fDeltaZ.At(id);
1852 TH1F * hisP3 = (TH1F*)laser->fDeltaP3.At(id);
1853 TH1F * hisP4 = (TH1F*)laser->fDeltaP4.At(id);
1854 TH1F * hisS = (TH1F*)laser->fSignals.At(id);
1855 //if (!hisphi) continue;
1856 Double_t entries = (hisphi==0)? 0: hisphi->GetEntries();
1857 //if (entries<minEntries) continue;
1859 AliTPCLaserTrack *ltrp = (AliTPCLaserTrack*)fTracksMirror.At(id);
1861 AliTPCLaserTrack::LoadTracks();
1862 ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
1864 pcstream->GetFile()->cd();
1865 if (hisphi) hisphi->Write();
1866 if (hisphiP) hisphiP->Write();
1867 if (hisZ) hisZ->Write();
1868 if (hisP3) hisP3->Write();
1869 if (hisP4) hisP4->Write();
1871 Float_t meanphi = hisphi->GetMean();
1872 Float_t rmsphi = hisphi->GetRMS();
1874 Float_t meanphiP = hisphiP->GetMean();
1875 Float_t rmsphiP = hisphiP->GetRMS();
1876 Float_t meanZ = hisZ->GetMean();
1877 Float_t rmsZ = hisZ->GetRMS();
1878 if (hisphi->GetRMS()>hisphi->GetBinWidth(1))
1879 hisphi->Fit(&fg,"","",hisphi->GetMean()-4*hisphi->GetRMS(),hisphi->GetMean()+4*hisphi->GetRMS());
1880 Double_t gphi1 = fg.GetParameter(1);
1881 Double_t gphi2 = fg.GetParameter(2);
1882 if (hisphiP->GetRMS()>0)
1883 hisphiP->Fit(&fg,"","",hisphiP->GetMean()-4*hisphiP->GetRMS(),hisphiP->GetMean()+4*hisphiP->GetRMS());
1884 Double_t gphiP1 = fg.GetParameter(1);
1885 Double_t gphiP2 = fg.GetParameter(2);
1887 if (hisZ->GetRMS()>hisZ->GetBinWidth(1))
1888 hisZ->Fit(&fg,"","");
1889 Double_t gz1 = fg.GetParameter(1);
1890 Double_t gz2 = fg.GetParameter(2);
1892 if (hisP3->GetRMS()>hisP3->GetBinWidth(1))
1893 hisP3->Fit(&fg,"","",hisP3->GetMean()-4*hisP3->GetRMS(),hisP3->GetMean()+4*hisP3->GetRMS());
1894 Double_t gp31 = fg.GetParameter(1);
1895 Double_t gp32 = fg.GetParameter(2);
1897 if (hisP4->GetRMS()>hisP4->GetBinWidth(1))
1898 hisP4->Fit(&fg,"","",hisP4->GetMean()-4*hisP4->GetRMS(),hisP4->GetMean()+4*hisP4->GetRMS());
1899 Double_t gp41 = fg.GetParameter(1);
1900 Double_t gp42 = fg.GetParameter(2);
1902 Float_t meanS=hisS->GetMean();
1907 ltrp->GetPxPyPz(lpxyz);
1909 if (rmsphi<krmsCut0) isOK=kFALSE; // empty in range - not entries inside
1910 if (rmsphi>krmsCut1) isOK=kFALSE; // empty in range - not entries inside
1911 if (rmsphi>krmsCut0) if (gphi2/rmsphi>kmultiCut) isOK=kFALSE; // multi peak structure
1912 if (gphiP2>kcutP0) isOK=kFALSE;
1918 his = fHisNclIn->ProjectionY("aaa",id+1,id+1);
1919 Float_t mnclIn = his->GetMean();
1921 his = fHisNclOut->ProjectionY("aaa",id+1,id+1);
1922 Float_t mnclOut = his->GetMean();
1924 his = fHisNclIO->ProjectionY("aaa",id+1,id+1);
1925 Float_t mnclIO = his->GetMean();
1927 his = fHisLclIn->ProjectionY("aaa",id+1,id+1);
1928 Float_t mLclIn = his->GetMean();
1930 his = fHisLclOut->ProjectionY("aaa",id+1,id+1);
1931 Float_t mLclOut = his->GetMean();
1933 his = fHisLclIO->ProjectionY("aaa",id+1,id+1);
1934 Float_t mLclIO = his->GetMean();
1937 his = fHisdEdx->ProjectionY("aaa",id+1,id+1);
1938 Float_t mdEdx = his->GetMean();
1944 his = fHisChi2YIn1->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - line
1945 Float_t mChi2YIn1= his->GetMean();
1947 his = fHisChi2YOut1->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - line
1948 Float_t mChi2YOut1 = his->GetMean();
1950 his = fHisChi2YIn2->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - parabola
1951 Float_t mChi2YIn2 = his->GetMean();
1953 his = fHisChi2YOut2->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - parabola
1954 Float_t mChi2YOut2 = his->GetMean();
1956 his = fHisChi2YIO1->ProjectionY("aaa",id+1,id+1); //->chi2 y IO - common
1957 Float_t mChi2YIO1 = his->GetMean();
1959 his = fHisChi2ZIn1->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - line
1960 Float_t mChi2ZIn1 = his->GetMean();
1962 his = fHisChi2ZOut1->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - line
1963 Float_t mChi2ZOut1 = his->GetMean();
1965 his = fHisChi2ZIn2->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - parabola
1966 Float_t mChi2ZIn2 = his->GetMean();
1968 his = fHisChi2ZOut2->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - parabola
1969 Float_t mChi2ZOut2 = his->GetMean();
1971 his = fHisChi2ZIO1->ProjectionY("aaa",id+1,id+1); //->chi2 z IO - common
1972 Float_t mChi2ZIO1 = his->GetMean();
1977 his = fHisdZfit->ProjectionY("aaa",id+1,id+1);
1978 Float_t edZfit = his->GetEntries();
1979 Float_t mdZfit = his->GetMean();
1980 Float_t rdZfit = his->GetRMS();
1983 his = fHisPy1vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - line
1984 Float_t ePy1vP0 = his->GetEntries();
1985 Float_t mPy1vP0 = his->GetMean();
1986 Float_t rPy1vP0 = his->GetRMS();
1989 his = fHisPy2vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - parabola
1990 Float_t ePy2vP0 = his->GetEntries();
1991 Float_t mPy2vP0 = his->GetMean();
1992 Float_t rPy2vP0 = his->GetRMS();
1995 his = fHisPy3vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - common parabola
1996 Float_t ePy3vP0 = his->GetEntries();
1997 Float_t mPy3vP0 = his->GetMean();
1998 Float_t rPy3vP0 = his->GetRMS();
2001 his = fHisPy1vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - line
2002 Float_t ePy1vP1 = his->GetEntries();
2003 Float_t mPy1vP1 = his->GetMean();
2004 Float_t rPy1vP1 = his->GetRMS();
2007 his = fHisPy2vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - parabola
2008 Float_t ePy2vP1 = his->GetEntries();
2009 Float_t mPy2vP1 = his->GetMean();
2010 Float_t rPy2vP1 = his->GetRMS();
2013 his = fHisPy3vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - common parabola
2014 Float_t ePy3vP1 = his->GetEntries();
2015 Float_t mPy3vP1 = his->GetMean();
2016 Float_t rPy3vP1 = his->GetRMS();
2019 his = fHisPy2vP2In->ProjectionY("aaa",id+1,id+1); //-> Curv P2inner - parabola
2020 Float_t ePy2vP2In = his->GetEntries();
2021 Float_t mPy2vP2In = his->GetMean();
2022 Float_t rPy2vP2In = his->GetRMS();
2025 his = fHisPy2vP2Out->ProjectionY("aaa",id+1,id+1); //-> Curv P2outer - parabola
2026 Float_t ePy2vP2Out = his->GetEntries();
2027 Float_t mPy2vP2Out = his->GetMean();
2028 Float_t rPy2vP2Out = his->GetRMS();
2031 his = fHisPy3vP2IO->ProjectionY("aaa",id+1,id+1); //-> Curv P2outerinner - common parabola
2032 Float_t ePy3vP2IO = his->GetEntries();
2033 Float_t mPy3vP2IO = his->GetMean();
2034 Float_t rPy3vP2IO = his->GetRMS();
2039 his = fHisPz1vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - line
2040 Float_t ePz1vP0 = his->GetEntries();
2041 Float_t mPz1vP0 = his->GetMean();
2042 Float_t rPz1vP0 = his->GetRMS();
2045 his = fHisPz2vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - parabola
2046 Float_t ePz2vP0 = his->GetEntries();
2047 Float_t mPz2vP0 = his->GetMean();
2048 Float_t rPz2vP0 = his->GetRMS();
2051 his = fHisPz3vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - common parabola
2052 Float_t ePz3vP0 = his->GetEntries();
2053 Float_t mPz3vP0 = his->GetMean();
2054 Float_t rPz3vP0 = his->GetRMS();
2057 his = fHisPz1vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - line
2058 Float_t ePz1vP1 = his->GetEntries();
2059 Float_t mPz1vP1 = his->GetMean();
2060 Float_t rPz1vP1 = his->GetRMS();
2063 his = fHisPz2vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - parabola
2064 Float_t ePz2vP1 = his->GetEntries();
2065 Float_t mPz2vP1 = his->GetMean();
2066 Float_t rPz2vP1 = his->GetRMS();
2069 his = fHisPz3vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - common parabola
2070 Float_t ePz3vP1 = his->GetEntries();
2071 Float_t mPz3vP1 = his->GetMean();
2072 Float_t rPz3vP1 = his->GetRMS();
2075 his = fHisPz2vP2In->ProjectionY("aaa",id+1,id+1); //-> Curv P2inner - parabola
2076 Float_t ePz2vP2In = his->GetEntries();
2077 Float_t mPz2vP2In = his->GetMean();
2078 Float_t rPz2vP2In = his->GetRMS();
2081 his = fHisPz2vP2Out->ProjectionY("aaa",id+1,id+1); //-> Curv P2outer - parabola
2082 Float_t ePz2vP2Out = his->GetEntries();
2083 Float_t mPz2vP2Out = his->GetMean();
2084 Float_t rPz2vP2Out = his->GetRMS();
2087 his = fHisPz3vP2IO->ProjectionY("aaa",id+1,id+1); //-> Curv P2outerinner - common parabola
2088 Float_t ePz3vP2IO = his->GetEntries();
2089 Float_t mPz3vP2IO = his->GetMean();
2090 Float_t rPz3vP2IO = his->GetRMS();
2094 (*pcstream)<<"Mean"<<
2097 "id="<<id<< // track id
2098 "entries="<<entries<< // number of entries
2099 "bz="<<bfield<< // bfield
2100 "LTr.="<<ltrp<< // refernece track
2102 "mnclIn="<<mnclIn<< // mean number of clusters in inner
2103 "mnclOut="<<mnclOut<< // mean number of clusters in outer
2104 "mnclIO="<<mnclIO<< // mean number of clusters in inner+outer
2105 "mLclIn="<<mLclIn<< // mean number of clusters in inner
2106 "mLclOut="<<mLclOut<< // mean number of clusters in outer
2107 "mLclIO="<<mLclIO<< // mean number of clusters in inner+outer
2108 "mdEdx="<<mdEdx<< // mean dEdx
2109 "edZfit="<<edZfit<< // entries z fit
2110 "mdZfit="<<mdZfit<< // mean z fit
2111 "rdZfit="<<rdZfit<< // RMS z fit
2114 "mChi2YIn1="<<mChi2YIn1<< //->chi2 y inner - line
2115 "mChi2YOut1="<<mChi2YOut1<< //->chi2 y inner - line
2116 "mChi2YIn2="<<mChi2YIn2<< //->chi2 y inner - parabola
2117 "mChi2YOut2="<<mChi2YOut2<< //->chi2 y inner - parabola
2118 "mChi2YIO1="<<mChi2YIO1<< //->chi2 y IO - common
2119 "mChi2ZIn1="<<mChi2ZIn1<< //->chi2 z inner - line
2120 "mChi2ZOut1="<<mChi2ZOut1<< //->chi2 z inner - line
2121 "mChi2ZIn2="<<mChi2ZIn2<< //->chi2 z inner - parabola
2122 "mChi2ZOut2="<<mChi2ZOut2<< //->chi2 z inner - parabola
2123 "mChi2ZIO1="<<mChi2ZIO1<< //->chi2 z IO - common
2126 "ePy1vP0="<<ePy1vP0<<
2127 "mPy1vP0="<<mPy1vP0<<
2128 "rPy1vP0="<<rPy1vP0<<
2129 "ePy2vP0="<<ePy2vP0<<
2130 "mPy2vP0="<<mPy2vP0<<
2131 "rPy2vP0="<<rPy2vP0<<
2132 "ePy3vP0="<<ePy3vP0<<
2133 "mPy3vP0="<<mPy3vP0<<
2134 "rPy3vP0="<<rPy3vP0<<
2135 "ePy1vP1="<<ePy1vP1<<
2136 "mPy1vP1="<<mPy1vP1<<
2137 "rPy1vP1="<<rPy1vP1<<
2138 "ePy2vP1="<<ePy2vP1<<
2139 "mPy2vP1="<<mPy2vP1<<
2140 "rPy2vP1="<<rPy2vP1<<
2141 "ePy3vP1="<<ePy3vP1<<
2142 "mPy3vP1="<<mPy3vP1<<
2143 "rPy3vP1="<<rPy3vP1<<
2144 "ePy2vP2In="<<ePy2vP2In<<
2145 "mPy2vP2In="<<mPy2vP2In<<
2146 "rPy2vP2In="<<rPy2vP2In<<
2147 "ePy2vP2Out="<<ePy2vP2Out<<
2148 "mPy2vP2Out="<<mPy2vP2Out<<
2149 "rPy2vP2Out="<<rPy2vP2Out<<
2150 "ePy3vP2IO="<<ePy3vP2IO<<
2151 "mPy3vP2IO="<<mPy3vP2IO<<
2152 "rPy3vP2IO="<<rPy3vP2IO<<
2155 "ePz1vP0="<<ePz1vP0<<
2156 "mPz1vP0="<<mPz1vP0<<
2157 "rPz1vP0="<<rPz1vP0<<
2158 "ePz2vP0="<<ePz2vP0<<
2159 "mPz2vP0="<<mPz2vP0<<
2160 "rPz2vP0="<<rPz2vP0<<
2161 "ePz3vP0="<<ePz3vP0<<
2162 "mPz3vP0="<<mPz3vP0<<
2163 "rPz3vP0="<<rPz3vP0<<
2164 "ePz1vP1="<<ePz1vP1<<
2165 "mPz1vP1="<<mPz1vP1<<
2166 "rPz1vP1="<<rPz1vP1<<
2167 "ePz2vP1="<<ePz2vP1<<
2168 "mPz2vP1="<<mPz2vP1<<
2169 "rPz2vP1="<<rPz2vP1<<
2170 "ePz3vP1="<<ePz3vP1<<
2171 "mPz3vP1="<<mPz3vP1<<
2172 "rPz3vP1="<<rPz3vP1<<
2173 "ePz2vP2In="<<ePz2vP2In<<
2174 "mPz2vP2In="<<mPz2vP2In<<
2175 "rPz2vP2In="<<rPz2vP2In<<
2176 "ePz2vP2Out="<<ePz2vP2Out<<
2177 "mPz2vP2Out="<<mPz2vP2Out<<
2178 "rPz2vP2Out="<<rPz2vP2Out<<
2179 "ePz3vP2IO="<<ePz3vP2IO<<
2180 "mPz3vP2IO="<<mPz3vP2IO<<
2181 "rPz3vP2IO="<<rPz3vP2IO<<
2185 "lx0="<<lxyz[0]<< // reference x
2186 "lx1="<<lxyz[1]<< // reference y
2187 "lx2="<<lxyz[2]<< // refernece z
2188 "lpx0="<<lpxyz[0]<< // reference x
2189 "lpx1="<<lpxyz[1]<< // reference y
2190 "lpx2="<<lpxyz[2]<< // refernece z
2194 "mphi="<<meanphi<< //
2195 "rmsphi="<<rmsphi<< //
2199 "mphiP="<<meanphiP<< //
2200 "rmsphiP="<<rmsphiP<< //
2209 "gp31="<<gp31<< //gaus mean - tgl
2210 "gp32="<<gp32<< //gaus rms -tgl
2211 "gp41="<<gp41<< //gaus mean - P4
2212 "gp42="<<gp42<< //gaus rms - P4
2219 TFile fmean("laserMean.root");
2229 void AliTPCcalibLaser::DumpScanInfo(TTree * chain, const char * cutUser){
2233 TTreeSRedirector *pcstream = new TTreeSRedirector("laserScan.root");
2234 TFile * f = pcstream->GetFile();
2236 f->mkdir("dirphiP");
2238 TF1 fp("p1","pol1");
2243 char grnamefull[1000];
2246 Double_t mphiP[100];
2247 Double_t smphi[100];
2248 Double_t smphiP[100];
2259 for (Int_t id=0; id<336; id++){
2261 sprintf(cut,"fId==%d&&%s",id,cutUser);
2262 Int_t entries = chain->Draw("bz",cut,"goff");
2263 if (entries<3) continue;
2264 AliTPCLaserTrack *ltrp = 0;
2265 if (!AliTPCLaserTrack::GetTracks()) AliTPCLaserTrack::LoadTracks();
2266 ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
2270 ltrp->GetPxPyPz(lpxyz);
2272 chain->Draw("bz",cut,"goff");
2273 memcpy(bz, chain->GetV1(), entries*sizeof(Double_t));
2274 chain->Draw("0.01*abs(bz)+0.02",cut,"goff");
2275 memcpy(sbz, chain->GetV1(), entries*sizeof(Double_t));
2277 chain->Draw("gphi1",cut,"goff");
2278 memcpy(mphi, chain->GetV1(), entries*sizeof(Double_t));
2279 chain->Draw("0.05*abs(mphi)+abs(gphi2)*0.5+0.05",cut,"goff");
2280 memcpy(smphi, chain->GetV1(), entries*sizeof(Double_t));
2282 chain->Draw("gphiP1",cut,"goff");
2283 memcpy(mphiP, chain->GetV1(), entries*sizeof(Double_t));
2284 chain->Draw("0.05*abs(mphiP)+abs(gphiP2)*0.5+0.001",cut,"goff");
2285 memcpy(smphiP, chain->GetV1(), entries*sizeof(Double_t));
2287 chain->Draw("gz1",cut,"goff");
2288 memcpy(mZ, chain->GetV1(), entries*sizeof(Double_t));
2289 chain->Draw("0.01*abs(meanZ)+abs(gz2)*0.5+0.1",cut,"goff");
2290 memcpy(smZ, chain->GetV1(), entries*sizeof(Double_t));
2293 sprintf(grnamefull,"Side_%d_Bundle_%d_Rod_%d_Beam_%d",
2294 ltrp->GetSide(), ltrp->GetBundle(), ltrp->GetRod(), ltrp->GetBeam());
2301 for (Int_t ientry=0; ientry<entries; ientry++){
2302 if (TMath::Abs(bz[ientry])<0.05){
2303 phiB0 = mphi[ientry];
2304 phiPB0 = mphiP[ientry];
2308 TGraphErrors *grphi = new TGraphErrors(entries,bz,mphi,sbz,smphi);
2311 pphi[0] = fp.GetParameter(0); // offset
2312 pphi[1] = fp.GetParameter(1); // slope
2313 pphi[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2314 sprintf(grname,"phi_id%d",id);
2315 grphi->SetName(grname); grphi->SetTitle(grnamefull);
2316 grphi->GetXaxis()->SetTitle("b_{z} (T)");
2317 grphi->GetYaxis()->SetTitle("#Delta r#phi (cm)");
2318 grphi->SetMaximum(1.2);
2319 grphi->SetMinimum(-1.2);
2323 gPad->SaveAs(Form("pic/phi/phi_%s.gif",grnamefull));
2326 TGraphErrors *grphiP = new TGraphErrors(entries,bz,mphiP,sbz,smphiP);
2329 pphiP[0] = fp.GetParameter(0); // offset
2330 pphiP[1] = fp.GetParameter(1); // slope
2331 pphiP[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2332 sprintf(grname,"phiP_id%d",id);
2333 grphiP->SetName(grname); grphiP->SetTitle(grnamefull);
2334 grphiP->GetXaxis()->SetTitle("b_{z} (T)");
2335 grphiP->GetYaxis()->SetTitle("#Delta #phi (rad)");
2336 grphiP->SetMaximum(pphiP[0]+0.005);
2337 grphiP->SetMinimum(pphiP[0]-0.005);
2339 gPad->SaveAs(Form("pic/phiP/phiP_%s.gif",grnamefull));
2344 TGraphErrors *grmZ = new TGraphErrors(entries,bz,mZ,sbz,smZ);
2347 pmZ[0] = fp.GetParameter(0); // offset
2348 pmZ[1] = fp.GetParameter(1); // slope
2349 pmZ[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2350 sprintf(grname,"mZ_id%d",id);
2351 grmZ->SetName(grname); grmZ->SetTitle(grnamefull);
2352 grmZ->GetXaxis()->SetTitle("b_{z} (T)");
2353 grmZ->GetYaxis()->SetTitle("#Delta z (cm)");
2355 gPad->SaveAs(Form("pic/z/z_%s.gif",grnamefull));
2361 for (Int_t ientry=0; ientry<entries; ientry++){
2362 (*pcstream)<<"Mean"<<
2365 "entries="<<entries<<
2367 "lx0="<<lxyz[0]<< // reference x
2368 "lx1="<<lxyz[1]<< // reference y
2369 "lx2="<<lxyz[2]<< // refernece z
2370 "lpx0="<<lpxyz[0]<< // reference x
2371 "lpx1="<<lpxyz[1]<< // reference y
2372 "lpx2="<<lpxyz[2]<< // refernece z
2374 "phiB0="<<phiB0<< // position shift at 0 field
2375 "phiPB0="<<phiPB0<< // angular shift at 0 field
2376 "zB0="<<zB0<< // z shift for 0 field
2378 "gphi1="<<mphi[ientry]<< // mean - from gaus fit
2379 "pphi0="<<pphi[0]<< // offset
2380 "pphi1="<<pphi[1]<< // slope
2381 "pphi2="<<pphi[2]<< // norm chi2
2383 "gphiP1="<<mphiP[ientry]<< // mean - from gaus fit
2384 "pphiP0="<<pphiP[0]<< // offset
2385 "pphiP1="<<pphiP[1]<< // slope
2386 "pphiP2="<<pphiP[2]<< // norm chi2
2388 "gz1="<<mZ[ientry]<<
2389 "pmZ0="<<pmZ[0]<< // offset
2390 "pmZ1="<<pmZ[1]<< // slope
2391 "pmZ2="<<pmZ[2]<< // norm chi2
2401 void AliTPCcalibLaser::Analyze(){
2408 Long64_t AliTPCcalibLaser::Merge(TCollection *li) {
2410 TIterator* iter = li->MakeIterator();
2411 AliTPCcalibLaser* cal = 0;
2412 static Int_t counter0=0;
2413 while ((cal = (AliTPCcalibLaser*)iter->Next())) {
2414 if (!cal->InheritsFrom(AliTPCcalibLaser::Class())) {
2415 // Error("Merge","Attempt to add object of class %s to a %s", cal->ClassName(), this->ClassName());
2418 printf("Marging number %d\n", counter0);
2421 MergeFitHistos(cal);
2426 // TProfile *hp=0x0;
2427 //TProfile *hpm=0x0;
2429 for (Int_t id=0; id<336; id++){
2430 // merge fDeltaZ histograms
2431 hm = (TH1F*)cal->fDeltaZ.At(id);
2432 h = (TH1F*)fDeltaZ.At(id);
2434 h=new TH1F(Form("hisdz%d",id),Form("hisdz%d",id),1000,-10,10);
2436 fDeltaZ.AddAt(h,id);
2439 // merge fP3 histograms
2440 hm = (TH1F*)cal->fDeltaP3.At(id);
2441 h = (TH1F*)fDeltaP3.At(id);
2443 h=new TH1F(Form("hisPar3v%d",id),Form("hisPar3v%d",id),400,-0.06,0.06);
2445 fDeltaP3.AddAt(h,id);
2448 // merge fP4 histograms
2449 hm = (TH1F*)cal->fDeltaP4.At(id);
2450 h = (TH1F*)fDeltaP4.At(id);
2452 h=new TH1F(Form("hisPar4v%d",id),Form("hisPar4v%d",id),200,-0.06,0.06);
2454 fDeltaP4.AddAt(h,id);
2459 // merge fDeltaPhi histograms
2460 hm = (TH1F*)cal->fDeltaPhi.At(id);
2461 h = (TH1F*)fDeltaPhi.At(id);
2463 h= new TH1F(Form("hisdphi%d",id),Form("hisdphi%d",id),1000,-1,1);
2465 fDeltaPhi.AddAt(h,id);
2468 // merge fDeltaPhiP histograms
2469 hm = (TH1F*)cal->fDeltaPhiP.At(id);
2470 h = (TH1F*)fDeltaPhiP.At(id);
2472 h=new TH1F(Form("hisdphiP%d",id),Form("hisdphiP%d",id),1000,-0.01,0.01);
2474 fDeltaPhiP.AddAt(h,id);
2477 // merge fSignals histograms
2478 hm = (TH1F*)cal->fSignals.At(id);
2479 h = (TH1F*)fSignals.At(id);
2481 h=new TH1F(Form("hisSignal%d",id),Form("hisSignal%d",id),100,0,300);
2483 fSignals.AddAt(h,id);
2488 // merge ProfileY histograms -0
2489 h2m = (TH2F*)cal->fDeltaYres.At(id);
2490 h2 = (TH2F*)fDeltaYres.At(id);
2491 if (h2m&&h2) h2->Add(h2m);
2493 h2m = (TH2F*)cal->fDeltaZres.At(id);
2494 h2 = (TH2F*)fDeltaZres.At(id);
2495 if (h2m&&h2) h2->Add(h2m);
2496 // merge ProfileY histograms - 2
2497 h2m = (TH2F*)cal->fDeltaYres2.At(id);
2498 h2 = (TH2F*)fDeltaYres2.At(id);
2499 if (h2m&&h2) h2->Add(h2m);
2501 h2m = (TH2F*)cal->fDeltaZres2.At(id);
2502 h2 = (TH2F*)fDeltaZres2.At(id);
2503 if (h2m&&h2) h2->Add(h2m);
2505 // merge ProfileY histograms - abs
2506 h2m = (TH2F*)cal->fDeltaYresAbs.At(id);
2507 h2 = (TH2F*)fDeltaYresAbs.At(id);
2508 if (h2m&&h2) h2->Add(h2m);
2510 h2m = (TH2F*)cal->fDeltaZresAbs.At(id);
2511 h2 = (TH2F*)fDeltaZresAbs.At(id);
2512 if (h2m&&h2) h2->Add(h2m);
2513 // merge ProfileY histograms - 3
2514 //h2m = (TH2F*)cal->fDeltaYres3.At(id);
2515 //h2 = (TH2F*)fDeltaYres3.At(id);
2516 //if (h2m) h2->Add(h2m);
2518 //h2m = (TH2F*)cal->fDeltaZres3.At(id);
2519 //h2 = (TH2F*)fDeltaZres3.At(id);
2520 //if (h2m) h->Add(h2m);
2528 void AliTPCcalibLaser::MakeFitHistos(){
2530 // Make a fit histograms
2532 // Number of clusters
2534 //TH2F *fHisNclIn; //->Number of clusters inner
2535 //TH2F *fHisNclOut; //->Number of clusters outer
2536 //TH2F *fHisNclIO; //->Number of cluster inner outer
2537 // TH2F *fHisdEdx; //->dEdx histo
2538 fHisNclIn = new TH2F("HisNclIn","HisNclIn",336,0,336,64,10,64);
2539 fHisNclOut = new TH2F("HisNclOut","HisNclOut",336,0,336,100,10,100);
2540 fHisNclIO = new TH2F("HisNclIO","HisNclIO",336,0,336,160,10,160);
2542 fHisLclIn = new TH2F("HisLclIn","HisLclIn",336,0,336,64,10,64);
2543 fHisLclOut = new TH2F("HisLclOut","HisLclOut",336,0,336,100,10,150);
2544 fHisLclIO = new TH2F("HisLclIO","HisLclIO",336,0,336,160,10,160);
2546 fHisdEdx = new TH2F("HisdEdx","HisdEdx",336,0,336,160,1,50);
2547 fHisdZfit = new TH2F("HisdZfit","HisdZfit",336,0,336,300,-0.3,0.3);
2552 // TH2F *fHisChi2YIn1; //->chi2 y inner - line
2553 // TH2F *fHisChi2YOut1; //->chi2 y inner - line
2554 // TH2F *fHisChi2YIn2; //->chi2 y inner - parabola
2555 // TH2F *fHisChi2YOut2; //->chi2 y inner - parabola
2556 // TH2F *fHisChi2YIO1; //->chi2 y IO - common
2557 fHisChi2YIn1 = new TH2F("Chi2YIn1","Chi2YIn1",336,0,336,500,0.001,0.5);
2558 fHisChi2YOut1 = new TH2F("Chi2YOut1","Chi2YOut1",336,0,336,500,0.001,0.5);
2559 fHisChi2YIn2 = new TH2F("Chi2YIn2","Chi2YIn2",336,0,336,500,0.001,0.5);
2560 fHisChi2YOut2 = new TH2F("Chi2YOut2","Chi2YOut2",336,0,336,500,0.001,0.5);
2561 fHisChi2YIO1 = new TH2F("Chi2YIO1","Chi2YIO1",336,0,336,500,0.001,0.5);
2562 // TH2F *fHisChi2ZIn1; //->chi2 z inner - line
2563 // TH2F *fHisChi2ZOut1; //->chi2 z inner - line
2564 // TH2F *fHisChi2ZIn2; //->chi2 z inner - parabola
2565 // TH2F *fHisChi2ZOut2; //->chi2 z inner - parabola
2566 // TH2F *fHisChi2ZIO1; //->chi2 z IO - common
2567 fHisChi2ZIn1 = new TH2F("Chi2ZIn1","Chi2ZIn1",336,0,336,500,0.001,0.5);
2568 fHisChi2ZOut1 = new TH2F("Chi2ZOut1","Chi2ZOut1",336,0,336,500,0.001,0.5);
2569 fHisChi2ZIn2 = new TH2F("Chi2ZIn2","Chi2ZIn2",336,0,336,500,0.001,0.5);
2570 fHisChi2ZOut2 = new TH2F("Chi2ZOut2","Chi2ZOut2",336,0,336,500,0.001,0.5);
2571 fHisChi2ZIO1 = new TH2F("Chi2ZIO1","Chi2ZIO1",336,0,336,500,0.001,0.5);
2576 // TH2F *fHisPy1vP0; //-> delta y P0outer-P0inner - line
2577 // TH2F *fHisPy2vP0; //-> delta y P0outer-P0inner - parabola
2578 // TH2F *fHisPy3vP0; //-> delta y P0outer-P0inner - common parabola
2579 // TH2F *fHisPy1vP1; //-> delta ky P1outer-P1inner - line
2580 // TH2F *fHisPy2vP1; //-> delta ky P1outer-P1inner - parabola
2581 // TH2F *fHisPy3vP1; //-> delta ky P1outer-P1inner - common parabola
2582 // TH2F *fHisPy2vP2In; //-> Curv P2inner - parabola
2583 // TH2F *fHisPy2vP2Out; //-> Curv P2outer - parabola
2584 // TH2F *fHisPy3vP2IO; //-> Curv P2outerinner - common parabola
2585 fHisPy1vP0 = new TH2F("HisPy1vP0", "HisPy1vP0",336,0,336,500,-0.3,0.3);
2586 fHisPy2vP0 = new TH2F("HisPy2vP0", "HisPy2vP0",336,0,336,500,-0.3,0.3);
2587 fHisPy3vP0 = new TH2F("HisPy3vP0", "HisPy3vP0",336,0,336,500,-0.3,0.3);
2588 fHisPy1vP1 = new TH2F("HisPy1vP1", "HisPy1vP1",336,0,336,500,-0.01,0.01);
2589 fHisPy2vP1 = new TH2F("HisPy2vP1", "HisPy2vP1",336,0,336,500,-0.01,0.01);
2590 fHisPy3vP1 = new TH2F("HisPy3vP1", "HisPy3vP1",336,0,336,500,-0.01,0.01);
2591 fHisPy2vP2In = new TH2F("HisPy2vP2In", "HisPy2vP2In",336,0,336,500,-0.0003,0.0003);
2592 fHisPy2vP2Out= new TH2F("HisPy2vP2Out","HisPy2vP2Out",336,0,336,500,-0.0003,0.0003);
2593 fHisPy3vP2IO = new TH2F("HisPy3vP2IO", "HisPy3vP2IO",336,0,336,500,-0.0003,0.0003);
2596 // TH2F *fHisPz1vP0; //-> delta z P0outer-P0inner - line
2597 // TH2F *fHisPz2vP0; //-> delta z P0outer-P0inner - parabola
2598 // TH2F *fHisPz3vP0; //-> delta z P0outer-P0inner - common parabola
2599 // TH2F *fHisPz1vP1; //-> delta kz P1outer-P1inner - line
2600 // TH2F *fHisPz2vP1; //-> delta kz P1outer-P1inner - parabola
2601 // TH2F *fHisPz3vP1; //-> delta kz P1outer-P1inner - common parabola
2602 // TH2F *fHisPz2vP2In; //-> Curv P2inner - parabola
2603 // TH2F *fHisPz2vP2Out; //-> Curv P2outer - parabola
2604 // TH2F *fHisPz3vP2IO; //-> Curv P2outerinner - common parabola
2605 fHisPz1vP0 = new TH2F("HisPz1vP0", "HisPz1vP0",336,0,336,500,-0.3,0.3);
2606 fHisPz2vP0 = new TH2F("HisPz2vP0", "HisPz2vP0",336,0,336,500,-0.3,0.3);
2607 fHisPz3vP0 = new TH2F("HisPz3vP0", "HisPz3vP0",336,0,336,500,-0.3,0.3);
2608 fHisPz1vP1 = new TH2F("HisPz1vP1", "HisPz1vP1",336,0,336,500,-0.01,0.01);
2609 fHisPz2vP1 = new TH2F("HisPz2vP1", "HisPz2vP1",336,0,336,500,-0.01,0.01);
2610 fHisPz3vP1 = new TH2F("HisPz3vP1", "HisPz3vP1",336,0,336,500,-0.01,0.01);
2611 fHisPz2vP2In = new TH2F("HisPz2vP2In", "HisPz2vP2In",336,0,336,500,-0.0003,0.0003);
2612 fHisPz2vP2Out= new TH2F("HisPz2vP2Out","HisPz2vP2Out",336,0,336,500,-0.0002,0.0002);
2613 fHisPz3vP2IO = new TH2F("HisPz3vP2IO", "HisPz3vP2IO",336,0,336,500,-0.0002,0.0002);
2615 fHisNclIn->SetDirectory(0); //->Number of clusters inner
2616 fHisNclOut->SetDirectory(0); //->Number of clusters outer
2617 fHisNclIO->SetDirectory(0); //->Number of cluster inner outer
2618 fHisLclIn->SetDirectory(0); //->Level arm inner
2619 fHisLclOut->SetDirectory(0); //->Level arm outer
2620 fHisLclIO->SetDirectory(0); //->Number of cluster inner outer
2621 fHisdEdx->SetDirectory(0); //->Number of cluster inner outer
2622 fHisdZfit->SetDirectory(0); //->Number of cluster inner outer
2625 fHisChi2YIn1->SetDirectory(0); //->chi2 y inner - line
2626 fHisChi2YOut1->SetDirectory(0); //->chi2 y inner - line
2627 fHisChi2YIn2->SetDirectory(0); //->chi2 y inner - parabola
2628 fHisChi2YOut2->SetDirectory(0); //->chi2 y inner - parabola
2629 fHisChi2YIO1->SetDirectory(0); //->chi2 y IO - common
2630 fHisChi2ZIn1->SetDirectory(0); //->chi2 z inner - line
2631 fHisChi2ZOut1->SetDirectory(0); //->chi2 z inner - line
2632 fHisChi2ZIn2->SetDirectory(0); //->chi2 z inner - parabola
2633 fHisChi2ZOut2->SetDirectory(0); //->chi2 z inner - parabola
2634 fHisChi2ZIO1->SetDirectory(0); //->chi2 z IO - common
2637 fHisPy1vP0->SetDirectory(0); //-> delta y P0outer-P0inner - line
2638 fHisPy2vP0->SetDirectory(0); //-> delta y P0outer-P0inner - parabola
2639 fHisPy3vP0->SetDirectory(0); //-> delta y P0outer-P0inner - common parabola
2640 fHisPy1vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - line
2641 fHisPy2vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - parabola
2642 fHisPy3vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - common parabola
2643 fHisPy2vP2In->SetDirectory(0); //-> Curv P2inner - parabola
2644 fHisPy2vP2Out->SetDirectory(0); //-> Curv P2outer - parabola
2645 fHisPy3vP2IO->SetDirectory(0); //-> Curv P2outerinner - common parabola
2648 fHisPz1vP0->SetDirectory(0); //-> delta z P0outer-P0inner - line
2649 fHisPz2vP0->SetDirectory(0); //-> delta z P0outer-P0inner - parabola
2650 fHisPz3vP0->SetDirectory(0); //-> delta z P0outer-P0inner - common parabola
2651 fHisPz1vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - line
2652 fHisPz2vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - parabola
2653 fHisPz3vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - common parabola
2654 fHisPz2vP2In->SetDirectory(0); //-> Curv P2inner - parabola
2655 fHisPz2vP2Out->SetDirectory(0); //-> Curv P2outer - parabola
2656 fHisPz3vP2IO->SetDirectory(0); //-> Curv P2outerinner - common parabola
2662 for (Int_t id=0; id<336;id++){
2663 TH2F *profy = (TH2F*)fDeltaYres.UncheckedAt(id);
2664 TH2F *profz = (TH2F*)fDeltaZres.UncheckedAt(id);
2665 TH2F *profy2 = (TH2F*)fDeltaYres2.UncheckedAt(id);
2666 TH2F *profz2 = (TH2F*)fDeltaZres2.UncheckedAt(id);
2667 TH2F *profyabs = (TH2F*)fDeltaYresAbs.UncheckedAt(id);
2668 TH2F *profzabs = (TH2F*)fDeltaYresAbs.UncheckedAt(id);
2669 // TH2F *profy3 = (TH2F*)fDeltaYres3.UncheckedAt(id);
2670 //TH2F *profz3 = (TH2F*)fDeltaZres3.UncheckedAt(id);
2672 profy=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d -Linear",id),160,0,160,50,-0.5,0.5);
2673 profy->SetDirectory(0);
2674 fDeltaYres.AddAt(profy,id);
2675 profy2=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d -Parabolic",id),160,0,160,50,-0.5,0.5);
2676 profy2->SetDirectory(0);
2677 fDeltaYres2.AddAt(profy2,id);
2678 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
2679 profyabs->SetDirectory(0);
2680 fDeltaYresAbs.AddAt(profyabs,id);
2681 //profy3=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d- Parabolic2",id),160,0,160,100,-0.5,0.5);
2682 //profy3->SetDirectory(0);
2683 //fDeltaYres3.AddAt(profy3,id);
2686 profz=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d Linear",id),160,0,160,50,-0.5,0.5);
2687 profz->SetDirectory(0);
2688 fDeltaZres.AddAt(profz,id);
2689 profz2=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d - Parabolic",id),160,0,160,50,-0.5,0.5);
2690 profz2->SetDirectory(0);
2691 fDeltaZres2.AddAt(profz2,id);
2692 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
2693 profzabs->SetDirectory(0);
2694 fDeltaZresAbs.AddAt(profzabs,id);
2695 //profz3=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d- Parabolic2",id),160,0,160,100,-0.5,0.5);
2696 //profz3->SetDirectory(0);
2697 //fDeltaZres3.AddAt(profz3,id);
2702 for (Int_t id=0; id<336;id++){
2703 TH1F * hisdz = (TH1F*)fDeltaZ.At(id);
2704 TH1F * hisP3 = (TH1F*)fDeltaP3.At(id);
2705 TH1F * hisP4 = (TH1F*)fDeltaP4.At(id);
2707 TH1F * hisdphi = (TH1F*)fDeltaPhi.At(id);
2708 TH1F * hisdphiP = (TH1F*)fDeltaPhiP.At(id);
2709 TH1F * hisSignal = (TH1F*)fSignals.At(id);
2712 hisdz = new TH1F(Form("hisdz%d",id),Form("hisdz%d",id),1000,-10,10);
2713 hisdz->SetDirectory(0);
2714 fDeltaZ.AddAt(hisdz,id);
2716 hisP3 = new TH1F(Form("hisPar3v%d",id),Form("hisPar3v%d",id),400,-0.06,0.06);
2717 hisP3->SetDirectory(0);
2718 fDeltaP3.AddAt(hisP3,id);
2720 hisP4 = new TH1F(Form("hisPar4v%d",id),Form("hisPar4v%d",id),200,-0.06,0.06);
2721 hisP4->SetDirectory(0);
2722 fDeltaP4.AddAt(hisP4,id);
2725 hisdphi = new TH1F(Form("hisdphi%d",id),Form("hisdphi%d",id),1000,-1,1);
2726 hisdphi->SetDirectory(0);
2727 fDeltaPhi.AddAt(hisdphi,id);
2729 hisdphiP = new TH1F(Form("hisdphiP%d",id),Form("hisdphiP%d",id),1000,-0.01,0.01);
2730 hisdphiP->SetDirectory(0);
2731 fDeltaPhiP.AddAt(hisdphiP,id);
2732 hisSignal = new TH1F(Form("hisSignal%d",id),Form("hisSignal%d",id),100,0,300);
2733 hisSignal->SetDirectory(0);
2734 fSignals.AddAt(hisSignal,id);
2738 SetBeamParameters(fBeamOffsetZOuter, fBeamSlopeZOuter, fBeamSectorOuter,2);
2739 SetBeamParameters(fBeamOffsetZInner, fBeamSlopeZInner, fBeamSectorInner,3);
2740 SetBeamParameters(fBeamOffsetYOuter, fBeamSlopeYOuter, fBeamSectorOuter,0);
2741 SetBeamParameters(fBeamOffsetYInner, fBeamSlopeYInner, fBeamSectorInner,1);
2745 // id side rod bundle beam dP0 dP1 dP2 dP3 dP4 ncl dEdx
2746 Int_t binsLaser[12]= {336, //id
2758 Double_t xminLaser[12]= {0, //id
2770 Double_t xmaxLaser[12]= {336, //id
2783 TString nameLaser[12]= {"id",
2795 TString titleLaser[12]= {"id",
2807 fHisLaser = new THnSparseS("dLaser","#Delta_{Laser}", 12, binsLaser,xminLaser, xmaxLaser);
2808 for (Int_t iaxis=1; iaxis<12; iaxis++){
2809 fHisLaser->GetAxis(iaxis)->SetName(nameLaser[iaxis]);
2810 fHisLaser->GetAxis(iaxis)->SetTitle(titleLaser[iaxis]);
2814 void AliTPCcalibLaser::MergeFitHistos(AliTPCcalibLaser * laser){
2816 // Merge content of histograms
2818 // Only first histogram is checked - all other should be the same
2819 if (fHisLaser &&laser->fHisLaser) fHisLaser->Add(laser->fHisLaser);
2821 if (!laser->fHisNclIn) return; // empty histograms
2822 if (!fHisNclIn) MakeFitHistos();
2824 fHisNclIn->Add(laser->fHisNclIn ); //->Number of clusters inner
2825 fHisNclOut->Add(laser->fHisNclOut ); //->Number of clusters outer
2826 fHisNclIO->Add(laser->fHisNclIO ); //->Number of cluster inner outer
2827 fHisLclIn->Add(laser->fHisLclIn ); //->Level arm inner
2828 fHisLclOut->Add(laser->fHisLclOut ); //->Level arm outer
2829 fHisLclIO->Add(laser->fHisLclIO ); //->Number of cluster inner outer
2830 fHisdEdx->Add(laser->fHisdEdx ); //->dedx
2831 fHisdZfit->Add(laser->fHisdZfit ); //->dedx
2834 fHisChi2YIn1->Add(laser->fHisChi2YIn1 ); //->chi2 y inner - line
2835 fHisChi2YOut1->Add(laser->fHisChi2YOut1 ); //->chi2 y inner - line
2836 fHisChi2YIn2->Add(laser->fHisChi2YIn2 ); //->chi2 y inner - parabola
2837 fHisChi2YOut2->Add(laser->fHisChi2YOut2 ); //->chi2 y inner - parabola
2838 fHisChi2YIO1->Add(laser->fHisChi2YIO1 ); //->chi2 y IO - common
2839 fHisChi2ZIn1->Add(laser->fHisChi2ZIn1 ); //->chi2 z inner - line
2840 fHisChi2ZOut1->Add(laser->fHisChi2ZOut1 ); //->chi2 z inner - line
2841 fHisChi2ZIn2->Add(laser->fHisChi2ZIn2 ); //->chi2 z inner - parabola
2842 fHisChi2ZOut2->Add(laser->fHisChi2ZOut2 ); //->chi2 z inner - parabola
2843 fHisChi2ZIO1->Add(laser->fHisChi2ZIO1 ); //->chi2 z IO - common
2846 fHisPy1vP0->Add(laser->fHisPy1vP0 ); //-> delta y P0outer-P0inner - line
2847 fHisPy2vP0->Add(laser->fHisPy2vP0 ); //-> delta y P0outer-P0inner - parabola
2848 fHisPy3vP0->Add(laser->fHisPy3vP0 ); //-> delta y P0outer-P0inner - common parabola
2849 fHisPy1vP1->Add(laser->fHisPy1vP1 ); //-> delta ky P1outer-P1inner - line
2850 fHisPy2vP1->Add(laser->fHisPy2vP1 ); //-> delta ky P1outer-P1inner - parabola
2851 fHisPy3vP1->Add(laser->fHisPy3vP1 ); //-> delta ky P1outer-P1inner - common parabola
2852 fHisPy2vP2In->Add(laser-> fHisPy2vP2In ); //-> Curv P2inner - parabola
2853 fHisPy2vP2Out->Add(laser->fHisPy2vP2Out ); //-> Curv P2outer - parabola
2854 fHisPy3vP2IO->Add(laser->fHisPy3vP2IO ); //-> Curv P2outerinner - common parabola
2857 fHisPz1vP0->Add(laser->fHisPz1vP0 ); //-> delta z P0outer-P0inner - line
2858 fHisPz2vP0->Add(laser->fHisPz2vP0 ); //-> delta z P0outer-P0inner - parabola
2859 fHisPz3vP0->Add(laser->fHisPz3vP0 ); //-> delta z P0outer-P0inner - common parabola
2860 fHisPz1vP1->Add(laser->fHisPz1vP1 ); //-> delta kz P1outer-P1inner - line
2861 fHisPz2vP1->Add(laser->fHisPz2vP1 ); //-> delta kz P1outer-P1inner - parabola
2862 fHisPz3vP1->Add(laser->fHisPz3vP1 ); //-> delta kz P1outer-P1inner - common parabola
2863 fHisPz2vP2In->Add(laser->fHisPz2vP2In ); //-> Curv P2inner - parabola
2864 fHisPz2vP2Out->Add(laser->fHisPz2vP2Out ); //-> Curv P2outer - parabola
2865 fHisPz3vP2IO->Add(laser->fHisPz3vP2IO ); //-> Curv P2outerinner - common parabola
2878 void AliTPCcalibLaser::DumpFitInfo(TTree * chainFit,Int_t id){
2880 // Dump fit information - collect information from the streamers
2883 TChain * chainFit=0;
2884 TChain * chainTrack=0;
2887 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
2888 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
2889 AliXRDPROOFtoolkit tool;
2890 chainTrack = tool.MakeChain("laser.txt","Track",0,10200);
2891 chainTrack->Lookup();
2892 chainTrack->SetProof(kTRUE);
2893 chainDrift = tool.MakeChain("laser.txt","driftv",0,10200);
2894 chainDrift->Lookup();
2895 chainDrift->SetProof(kTRUE);
2897 chain = tool.MakeChain("laser.txt","Residuals",0,10200);
2899 chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
2901 chainFit->SetProof(kTRUE);
2902 chain->SetProof(kTRUE);
2903 AliTPCLaserTrack::LoadTracks();
2904 //AliTPCcalibLaser::DumpFitInfo(chainFit,0);
2910 TCut cutP3("abs(Tr.fP[3])<0.1");
2911 TCut cutP4("abs(Tr.fP[4])<0.5");
2912 TCut cutPx = cutP3+cutP4;
2913 TCut cutChi2YOut("sqrt(chi2y2Out*dEdx)<5&&chi2y2Out>0");
2914 TCut cutChi2ZOut("sqrt(chi2z2Out*dEdx)<5&&chi2z2Out>0");
2915 TCut cutChi2YIn("sqrt(chi2y2In*dEdx)<5&&chi2y2In>0");
2916 TCut cutChi2ZIn("sqrt(chi2z2In*dEdx)<5&&chi2z2In>0");
2918 TCut cutdEdx("sqrt(dEdx)>3");
2919 TCut cutDY("abs(yPol2In.fElements[2]*nclI*nclI/4.)<3");
2920 TCut cutN("nclO>20&&nclI>20");
2921 TCut cutA = cutChi2YOut+cutChi2ZOut+cutChi2YIn+cutChi2ZIn+cutN+cutdEdx+cutPx+"accept";
2925 TCut cutClY("abs(Cl[].fY-TrYpol2.fElements)<0.15");
2926 TCut cutClZ("abs(Cl[].fZ-TrZpol2.fElements)<0.15");
2927 TCut cutClX("abs(Cl[].fX)>10");
2928 TCut cutE("abs(Cl[].fY/Cl[].fX)<0.14");
2929 TCut cutSY("sqrt(Cl[].fSigmaY2)>0.05");
2930 TCut cutSZ("sqrt(Cl[].fSigmaZ2)>0.05");
2931 TCut cutQ("sqrt(Cl[].fMax)>4");
2932 TCut cutCl=cutClY+cutClZ+cutClX+cutE+cutSY+cutSZ+cutQ;
2936 TH1F * phisAccept = 0;
2938 TProfile * pdEdx = 0;
2946 TProfile * pNclI = 0;
2947 TProfile * pNclO = 0;
2949 TProfile * pchi2YIn =0;
2950 TProfile * pchi2ZIn =0;
2951 TProfile * pchi2YOut =0;
2952 TProfile * pchi2ZOut =0;
2953 TProfile * pchi2YInOut =0;
2954 TProfile * pchi2ZInOut =0;;
2956 chainFit->Draw("LTr.fId>>hisAl(350,0,350)","LTr.fId<350");
2957 phisAl = (TH1F*)gROOT->FindObject("hisAl");
2958 chainFit->Draw("LTr.fId>>hisAccept(350,0,350)","LTr.fId<350"+cutA);
2959 phisAccept = (TH1F*)gROOT->FindObject("hisAccept");
2960 chainFit->Draw("LTr.fId>>hisOut(350,0,350)","LTr.fId<350"+!cutA);
2961 phisOut = (TH1F*)gROOT->FindObject("hisOut");
2963 chainFit->Draw("sqrt(dEdx):LTr.fId>>hdEdx(350,0,350)","","prof");
2964 pdEdx = (TProfile*)gROOT->FindObject("hdEdx");
2967 chainFit->Draw("Tr.fP[0]:LTr.fId>>hP0(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2968 pP0 = (TProfile*)gROOT->FindObject("hP0");
2969 chainFit->Draw("Tr.fP[1]:LTr.fId>>hP1(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2970 pP1 = (TProfile*)gROOT->FindObject("hP1");
2971 chainFit->Draw("Tr.fP[2]:LTr.fId>>hP2(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2972 pP2 = (TProfile*)gROOT->FindObject("hP2");
2973 chainFit->Draw("Tr.fP[3]:LTr.fId>>hP3(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2974 pP3 = (TProfile*)gROOT->FindObject("hP3");
2975 chainFit->Draw("Tr.fP[4]:LTr.fId>>hP4(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2976 pP4 = (TProfile*)gROOT->FindObject("hP4");
2978 chainFit->Draw("nclI:LTr.fId>>hNclI(350,0,350)","","prof");
2979 pNclI = (TProfile*)gROOT->FindObject("hNclI");
2980 chainFit->Draw("nclO:LTr.fId>>hNclO(350,0,350)","","prof");
2981 pNclO = (TProfile*)gROOT->FindObject("hNclO");
2984 chainFit->Draw("sqrt(chi2y2In):LTr.fId>>hChi2YIn(350,0,350)",cutA+"","prof");
2985 pchi2YIn = (TProfile*)gROOT->FindObject("hChi2YIn");
2986 chainFit->Draw("sqrt(chi2y2Out):LTr.fId>>hChi2YOut(350,0,350)",cutA+"","prof");
2987 pchi2YOut = (TProfile*)gROOT->FindObject("hChi2YOut");
2988 chainFit->Draw("sqrt(chi2yInOut):LTr.fId>>hChi2YInOut(350,0,350)",cutA+"","prof");
2989 pchi2YInOut = (TProfile*)gROOT->FindObject("hChi2YInOut");
2990 chainFit->Draw("sqrt(chi2z2In):LTr.fId>>hChi2ZIn(350,0,350)",cutA+"","prof");
2991 pchi2ZIn = (TProfile*)gROOT->FindObject("hChi2ZIn");
2992 chainFit->Draw("sqrt(chi2z2Out):LTr.fId>>hChi2ZOut(350,0,350)",cutA+"","prof");
2993 pchi2ZOut = (TProfile*)gROOT->FindObject("hChi2ZOut");
2994 chainFit->Draw("sqrt(chi2zInOut):LTr.fId>>hChi2ZInOut(350,0,350)",cutA+"","prof");
2995 pchi2ZInOut = (TProfile*)gROOT->FindObject("hChi2ZInOut");
2997 // second derivatives
2999 TH2F * phisPy2In = new TH2F("Py2Inner","Py2Inner",350,0,350,100,-0.001,0.001);
3000 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>Py2Inner",cutA,"");
3001 TH2F * phisPy2Out = new TH2F("Py2Outer","Py2Outer",350,0,350,200,-0.0005,0.0005);
3002 chainFit->Draw("yPol2Out.fElements[2]:LTr.fId>>Py2Outer",cutA,"");
3003 TH2F * phisPy2InOut = new TH2F("Py2InOut","Py2InOut",350,0,350,200,-0.0005,0.0005);
3004 chainFit->Draw("yInOut.fElements[4]:LTr.fId>>Py2InOut",cutA,"");
3006 phisPy2In->FitSlicesY();
3007 TH1D * phisPy2InEntries = (TH1D*)gROOT->FindObject("Py2Inner_0");
3008 TH1D * phisPy2InMean = (TH1D*)gROOT->FindObject("Py2Inner_1");
3009 TH1D * phisPy2InSigma = (TH1D*)gROOT->FindObject("Py2Inner_2");
3011 phisPy2Out->FitSlicesY();
3012 TH1D * phisPy2OutEntries = (TH1D*)gROOT->FindObject("Py2Outer_0");
3013 TH1D * phisPy2OutMean = (TH1D*)gROOT->FindObject("Py2Outer_1");
3014 TH1D * phisPy2OutSigma = (TH1D*)gROOT->FindObject("Py2Outer_2");
3016 phisPy2InOut->FitSlicesY();
3017 TH1D * phisPy2InOutEntries = (TH1D*)gROOT->FindObject("Py2InOut_0");
3018 TH1D * phisPy2InOutMean = (TH1D*)gROOT->FindObject("Py2InOut_1");
3019 TH1D * phisPy2InOutSigma = (TH1D*)gROOT->FindObject("Py2InOut_2");
3021 TH2F * phisPz2In = new TH2F("Pz2Inner","Pz2Inner",350,0,350,100,-0.001,0.001);
3022 chainFit->Draw("zPol2In.fElements[2]:LTr.fId>>Pz2Inner",cutA,"");
3023 TH2F * phisPz2Out = new TH2F("Pz2Outer","Pz2Outer",350,0,350,200,-0.0005,0.0005);
3024 chainFit->Draw("zPol2Out.fElements[2]:LTr.fId>>Pz2Outer",cutA,"");
3025 TH2F * phisPz2InOut = new TH2F("Pz2InOut","Pz2InOut",350,0,350,200,-0.0005,0.0005);
3026 chainFit->Draw("zInOut.fElements[4]:LTr.fId>>Pz2InOut",cutA,"");
3028 phisPz2In->FitSlicesY();
3029 TH1D * phisPz2InEntries = (TH1D*)gROOT->FindObject("Pz2Inner_0");
3030 TH1D * phisPz2InMean = (TH1D*)gROOT->FindObject("Pz2Inner_1");
3031 TH1D * phisPz2InSigma = (TH1D*)gROOT->FindObject("Pz2Inner_2");
3033 phisPz2Out->FitSlicesY();
3034 TH1D * phisPz2OutEntries = (TH1D*)gROOT->FindObject("Pz2Outer_0");
3035 TH1D * phisPz2OutMean = (TH1D*)gROOT->FindObject("Pz2Outer_1");
3036 TH1D * phisPz2OutSigma = (TH1D*)gROOT->FindObject("Pz2Outer_2");
3038 phisPz2InOut->FitSlicesY();
3039 TH1D * phisPz2InOutEntries = (TH1D*)gROOT->FindObject("Pz2InOut_0");
3040 TH1D * phisPz2InOutMean = (TH1D*)gROOT->FindObject("Pz2InOut_1");
3041 TH1D * phisPz2InOutSigma = (TH1D*)gROOT->FindObject("Pz2InOut_2");
3048 TTreeSRedirector *pcstream = new TTreeSRedirector("vscan.root");
3049 for (Int_t ilaser=0; ilaser<336; ilaser++){
3050 Float_t all=phisAl->GetBinContent(ilaser+1);
3051 Float_t accept=phisAccept->GetBinContent(ilaser+1);
3052 Float_t out=phisOut->GetBinContent(ilaser+1);
3053 Float_t sdedx = pdEdx->GetBinContent(ilaser+1);
3054 Float_t mP0 = pP0->GetBinContent(ilaser+1);
3055 Float_t mP1 = pP1->GetBinContent(ilaser+1);
3056 Float_t mP2 = pP2->GetBinContent(ilaser+1);
3057 Float_t mP3 = pP3->GetBinContent(ilaser+1);
3058 Float_t mP4 = pP4->GetBinContent(ilaser+1);
3061 Float_t nclI = pNclI->GetBinContent(ilaser+1);
3062 Float_t nclO = pNclO->GetBinContent(ilaser+1);
3064 Float_t chi2YIn=pchi2YIn->GetBinContent(ilaser+1);
3065 Float_t chi2YOut=pchi2YOut->GetBinContent(ilaser+1);
3066 Float_t chi2YInOut=pchi2YInOut->GetBinContent(ilaser+1);
3067 Float_t chi2ZIn=pchi2ZIn->GetBinContent(ilaser+1);
3068 Float_t chi2ZOut=pchi2ZOut->GetBinContent(ilaser+1);
3069 Float_t chi2ZInOut=pchi2ZInOut->GetBinContent(ilaser+1);
3071 Float_t entriesPy2In = phisPy2InEntries->GetBinContent(ilaser+1);
3072 Float_t meanPy2In = phisPy2InMean->GetBinContent(ilaser+1);
3073 Float_t sigmaPy2In = phisPy2InSigma->GetBinContent(ilaser+1);
3075 Float_t entriesPy2Out = phisPy2OutEntries->GetBinContent(ilaser+1);
3076 Float_t meanPy2Out = phisPy2OutMean->GetBinContent(ilaser+1);
3077 Float_t sigmaPy2Out = phisPy2OutSigma->GetBinContent(ilaser+1);
3079 Float_t entriesPy2InOut = phisPy2InOutEntries->GetBinContent(ilaser+1);
3080 Float_t meanPy2InOut = phisPy2InOutMean->GetBinContent(ilaser+1);
3081 Float_t sigmaPy2InOut = phisPy2InOutSigma->GetBinContent(ilaser+1);
3083 Float_t entriesPz2In = phisPz2InEntries->GetBinContent(ilaser+1);
3084 Float_t meanPz2In = phisPz2InMean->GetBinContent(ilaser+1);
3085 Float_t sigmaPz2In = phisPz2InSigma->GetBinContent(ilaser+1);
3087 Float_t entriesPz2Out = phisPz2OutEntries->GetBinContent(ilaser+1);
3088 Float_t meanPz2Out = phisPz2OutMean->GetBinContent(ilaser+1);
3089 Float_t sigmaPz2Out = phisPz2OutSigma->GetBinContent(ilaser+1);
3091 Float_t entriesPz2InOut = phisPz2InOutEntries->GetBinContent(ilaser+1);
3092 Float_t meanPz2InOut = phisPz2InOutMean->GetBinContent(ilaser+1);
3093 Float_t sigmaPz2InOut = phisPz2InOutSigma->GetBinContent(ilaser+1);
3095 AliTPCLaserTrack* ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(ilaser);
3096 (*pcstream)<<"Scan"<<
3110 "chi2YIn="<<chi2YIn<<
3111 "chi2YOut="<<chi2YOut<<
3112 "chi2YInOut="<<chi2YInOut<<
3113 "chi2ZIn="<<chi2ZIn<<
3114 "chi2ZOut="<<chi2ZOut<<
3115 "chi2ZInOut="<<chi2ZInOut<<
3117 "nPy2In="<<entriesPy2In<<
3118 "mPy2In="<<meanPy2In<<
3119 "sPy2In="<<sigmaPy2In<<
3121 "nPy2Out="<<entriesPy2Out<<
3122 "mPy2Out="<<meanPy2Out<<
3123 "sPy2Out="<<sigmaPy2Out<<
3125 "nPy2InOut="<<entriesPy2InOut<<
3126 "mPy2InOut="<<meanPy2InOut<<
3127 "sPy2InOut="<<sigmaPy2InOut<<
3129 "nPz2In="<<entriesPz2In<<
3130 "mPz2In="<<meanPz2In<<
3131 "sPz2In="<<sigmaPz2In<<
3133 "nPz2Out="<<entriesPz2Out<<
3134 "mPz2Out="<<meanPz2Out<<
3135 "sPz2Out="<<sigmaPz2Out<<
3137 "nPz2InOut="<<entriesPz2InOut<<
3138 "mPz2InOut="<<meanPz2InOut<<
3139 "sPz2InOut="<<sigmaPz2InOut<<
3147 void AliTPCcalibLaser::SetBeamParameters(TVectorD& meanOffset,
3148 TVectorD& meanSlope,
3149 TVectorD& sectorArray,
3152 // This method should ideally go in AliTPCLaser
3153 // option == 0 (pads outer - closest to beam)
3154 // option == 1 (pads inner)
3155 // option == 2 (time outer)
3156 // option == 3 (time inner)
3157 Int_t nFailures = 0;
3159 for(Int_t id = 0; id < 336; id++) {
3161 if (!AliTPCLaserTrack::GetTracks())
3162 AliTPCLaserTrack::LoadTracks();
3163 AliTPCLaserTrack *ltrp =
3164 (AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
3166 AliExternalTrackParam trackParam(*ltrp);
3168 Double_t deltaangle = 10.0; // sector is 1/2 a sector away from mirror
3169 if((option==1 || option==3)&& (ltrp->GetBeam()<=1 || ltrp->GetBeam()>=5))
3170 deltaangle = 30.0; // inner sector is 1 sector further away from mirror
3172 Double_t angle = trackParam.GetAlpha();
3174 angle += 2*TMath::Pi();
3175 if(trackParam.GetSnp()>0) // track points to sector "before"
3176 angle -= deltaangle*TMath::DegToRad();
3177 else // track points to sector "after"
3178 angle += deltaangle*TMath::DegToRad();
3180 Bool_t success = trackParam.Rotate(angle);
3183 // cout << "WARNING: Rotate failed for ID: " << id << endl;
3187 angle *= TMath::RadToDeg();
3189 Int_t sector = TMath::Nint((angle-10.0)/20.0);
3194 if(ltrp->GetSide()==1) // C side
3196 sectorArray[id] = sector;
3198 const Double_t x0 = 0;
3200 Double_t slopey = TMath::Tan(TMath::ASin(trackParam.GetSnp()));
3201 Double_t slopez = trackParam.GetTgl();
3202 // One needs a factor sqrt(1+slopey**2) to take into account the
3203 // longer path length
3204 slopez *= TMath::Sqrt(1.0 + slopey*slopey);
3205 if(fInverseSlopeZ) // wrong sign in database, should be fixed there
3207 // Double_t offsetz = trackParam.GetZ();
3208 Double_t offsety = trackParam.GetY() + slopey*(x0-trackParam.GetX());
3209 Double_t offsetz = trackParam.GetZ() + slopez*(x0-trackParam.GetX());
3210 if(option==2 || option==3) {
3211 meanOffset[id] = offsetz; meanSlope[id] = slopez;
3213 meanOffset[id] = offsety; meanSlope[id] = slopey;
3218 AliWarning(Form("Rotate method failed %d times", nFailures));
3223 TFile f("vscan.root");
3228 chain->Draw("Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","",10000);
3230 chain->Draw("Cl[].fY-TrYpol1.fElements:Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","prof",10000);
3233 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);
3236 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)
3245 // check edge effects
3246 chain->Draw("Cl.fY-TrYpol1.fElements:Cl.fY/Cl.fX",""+cutA+cutCl,"prof",10000)
3248 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fZ>0"+cutA+cutCl+cutE,"prof",100000)
3250 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)
3254 chainFit->Draw("yInOut.fElements[4]:LTr.fP[2]","LTr.fP[1]<0"+cutA,"prof",1000);
3255 chainFit->Draw("yPol2In.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutD,"prof")
3266 dedge = sign(Cl.fY)*(Cl.fX*tan(pi/18)-abs(Cl.fY))
3269 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)
3271 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)
3277 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)
3279 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)
3283 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)
3285 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)
3294 chainFit->Draw("yPol2Out.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutDY,"prof")
3296 chainFit->Draw("yPol2In.fElements[2]*64*64/4.:LTr.fP[2]","nclI>20&<r.fP[1]<0"+cutA+cutDY,"prof")
3300 chainFit->Draw("LTr.fId","nclI>10",100000)
3302 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>his(350,0,350,100,-0.002,0.002)","nclI>20","")
3304 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>hisPy2In0(350,0,350,100,-0.002,0.002)","nclI>20","");
3306 TH2 * phisPy2In = (TH2*) gROOT->FindObject("hisPy2In0")
3316 gSystem->Load("libSTAT.so")
3317 TStatToolkit toolkit;
3323 TCut cutA("entries>2&&pphi2<3&&abs(gphiP1-pphiP0)<0.003&&abs(gz1)<6");
3328 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz++"; //1
3329 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*LTr.fP[2]++"; //2
3330 fstring+="(abs(LTr.fP[1]/250)^1-1)*bz++"; //3
3331 fstring+="(abs(LTr.fP[1]/250)-1)*bz*LTr.fP[2]++"; //4
3333 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*sin(atan2(lx1,lx0))++" //5
3334 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*sin(atan2(lx1,lx0))*LTr.fP[2]++" //6
3335 fstring+="(abs(LTr.fP[1]/250)-1)*bz*sin(atan2(lx1,lx0))++" //7
3336 fstring+="(abs(LTr.fP[1]/250)-1)*bz*sin(atan2(lx1,lx0))*LTr.fP[2]++" //8
3338 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*cos(atan2(lx1,lx0))++" //9
3339 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*cos(atan2(lx1,lx0))*LTr.fP[2]++" //10
3340 fstring+="(abs(LTr.fP[1]/250)-1)*bz*cos(atan2(lx1,lx0))++" //11
3341 fstring+="(abs(LTr.fP[1]/250)-1)*bz*cos(atan2(lx1,lx0))*LTr.fP[2]++" //12
3346 TString *strq0 = toolkit.FitPlane(treeT,"gphi1-pphi0",fstring->Data(), "fSide==1"+cutA, chi2,npoints,fitParam,covMatrix);
3348 treeT->SetAlias("fit",strq0->Data());
3351 TString *strqP = toolkit.FitPlane(treeT,"1000*(gphiP1-pphiP0)",fstring->Data(), "fSide==1"+cutA, chi2,npoints,fitParam,covMatrix);
3353 treeT->SetAlias("fitP",strqP->Data());
3356 TString *strqDrift = toolkit.FitPlane(treeT,"gz1","LTr.fP[1]++(1-2*(fSide==1))++lx1", cutA, chi2,npoints,fitParam,covMatrix);
3357 treeT->SetAlias("fitD",strqDrift->Data());
3360 treeT->Draw("fit:LTr.fP[1]","abs(bz+0.4)<0.05"+cutA,"");
3362 for (Int_t i=0; i<6;i++){
3363 treeT->SetLineColor(i+2);
3364 treeT->SetMarkerSize(1);
3365 treeT->SetMarkerStyle(22+i);
3366 treeT->SetMarkerColor(i+2);
3368 treeT->Draw("fit:LTr.fP[1]",Form("abs(bz+0.4)<0.05&fRod==%d",i)+cutA,"same");
3376 TTree * tree = (TTree*)f.Get("FitModels");
3378 TEventList listLFit0("listLFit0","listLFit0");
3379 TEventList listLFit1("listLFit1","listLFit1");
3380 tree->Draw(">>listLFit0","seed.fdEdx<200&&seed.fdEdx>40");
3381 tree->SetEventList(&listLFit0);
3386 gSystem->Load("libSTAT.so")
3387 TStatToolkit toolkit;
3393 chain->SetAlias("dp","((Cl.fPad-int(Cl.fPad))*pi)");
3394 chain->SetAlias("dt","((Cl.fTimeBin-int(Cl.fTimeBin))*pi)");
3398 fstring+="cos(dp)++";
3399 fstring+="sin(dp)++";
3400 fstring+="cos(dt)++";
3401 fstring+="sin(dt)++";
3403 TString *str = toolkit.FitPlane(chain,"Cl.fZ-TrZInOut.fElements",fstring->Data(), "Cl.fDetector>35", chi2,npoints,fitParam,covMatrix,-1,0,200);
3416 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
3417 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
3418 AliXRDPROOFtoolkit tool;
3419 TChain * chainTrack = tool.MakeChain("laser.txt","Track",0,10200);
3420 chainTrack->Lookup();
3421 chainTrack->SetProof(kTRUE);
3423 TChain * chain = tool.MakeChain("laser.txt","Residuals",0,10200);
3425 TChain * chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
3427 chainFit->SetProof(kTRUE);
3428 chain->SetProof(kTRUE);
3432 TCut cutChi2YOut("sqrt(chi2y2Out*dEdx)<10");
3433 TCut cutChi2ZOut("sqrt(chi2z2Out*dEdx)<10");
3434 TCut cutChi2YIn("sqrt(chi2y2In*dEdx)<10");
3435 TCut cutChi2ZIn("sqrt(chi2z2In*dEdx)<10");
3437 TCut cutdEdx("sqrt(dEdx)<30&&sqrt(dEdx)>3");
3438 TCut cutDY("abs(yPol2In.fElements[2]*nclO*nclO/4.)<3")
3439 TCut cutN("nclO>20&&nclI>20");
3440 TCut cutA = cutChi2YOut+cutChi2ZOut+cutChi2YIn+cutChi2ZIn+cutN+cutdEdx;
3444 TCut cutClY("abs(Cl.fY-TrYpol2.fElements)<0.2");
3445 TCut cutClZ("abs(Cl.fZ-TrZpol2.fElements)<0.4");
3446 TCut cutClX("abs(Cl.fX)>10");
3447 TCut cutE("abs(Cl.fY/Cl.fX)<0.14");
3448 TCut cutCl=cutClY+cutClZ+cutClX;
3451 // check edge effects
3452 chain->Draw("Cl.fY-TrYpol1.fElements:Cl.fY/Cl.fX",""+cutA+cutCl,"prof",10000)
3454 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fZ>0"+cutA+cutCl+cutE,"prof",100000)
3456 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)
3460 chainFit->Draw("yInOut.fElements[4]:LTr.fP[2]","LTr.fP[1]<0"+cutA,"prof",1000);
3461 chainFit->Draw("yPol2In.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutD,"prof")