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"
125 ClassImp(AliTPCcalibLaser)
127 AliTPCcalibLaser::AliTPCcalibLaser():
133 fTracksEsdParam(336),
143 fHisNclIn(0), //->Number of clusters inner
144 fHisNclOut(0), //->Number of clusters outer
145 fHisNclIO(0), //->Number of cluster inner outer
146 fHisLclIn(0), //->Level arm inner
147 fHisLclOut(0), //->Level arm outer
148 fHisLclIO(0), //->Number of cluster inner outer
149 fHisdEdx(0), //->dEdx histo
150 fHisdZfit(0), //->distance to the mirror after linear fit
153 fHisChi2YIn1(0), //->chi2 y inner - line
154 fHisChi2YOut1(0), //->chi2 y inner - line
155 fHisChi2YIn2(0), //->chi2 y inner - parabola
156 fHisChi2YOut2(0), //->chi2 y inner - parabola
157 fHisChi2YIO1(0), //->chi2 y IO - common
158 fHisChi2ZIn1(0), //->chi2 z inner - line
159 fHisChi2ZOut1(0), //->chi2 z inner - line
160 fHisChi2ZIn2(0), //->chi2 z inner - parabola
161 fHisChi2ZOut2(0), //->chi2 z inner - parabola
162 fHisChi2ZIO1(0), //->chi2 z IO - common
165 fHisPy1vP0(0), //-> delta y P0outer-P0inner - line
166 fHisPy2vP0(0), //-> delta y P0outer-P0inner - parabola
167 fHisPy3vP0(0), //-> delta y P0outer-P0inner - common parabola
168 fHisPy1vP1(0), //-> delta ky P1outer-P1inner - line
169 fHisPy2vP1(0), //-> delta ky P1outer-P1inner - parabola
170 fHisPy3vP1(0), //-> delta ky P1outer-P1inner - common parabola
171 fHisPy2vP2In(0), //-> Curv P2inner - parabola
172 fHisPy2vP2Out(0), //-> Curv P2outer - parabola
173 fHisPy3vP2IO(0), //-> Curv P2outerinner - common parabola
176 fHisPz1vP0(0), //-> delta z P0outer-P0inner - line
177 fHisPz2vP0(0), //-> delta z P0outer-P0inner - parabola
178 fHisPz3vP0(0), //-> delta z P0outer-P0inner - common parabola
179 fHisPz1vP1(0), //-> delta kz P1outer-P1inner - line
180 fHisPz2vP1(0), //-> delta kz P1outer-P1inner - parabola
181 fHisPz3vP1(0), //-> delta kz P1outer-P1inner - common parabola
182 fHisPz2vP2In(0), //-> Curv P2inner - parabola
183 fHisPz2vP2Out(0), //-> Curv P2outer - parabola
184 fHisPz3vP2IO(0), //-> Curv P2outerinner - common parabola
186 fDeltaYres(336), //->2D histo of residuals
187 fDeltaZres(336), //->2D histo fo residuals
188 fDeltaYres2(336), //->2D histo of residuals
189 fDeltaZres2(336), //->2D histo fo residuals
190 //fDeltaYres3(336), //->2D histo of residuals
191 //fDeltaZres3(336), //->2D histo fo residuals
192 fFitAside(new TVectorD(3)),
193 fFitCside(new TVectorD(3)),
194 fFitACside(new TVectorD(4)),
203 fTracksEsdParam.SetOwner(kTRUE);
206 AliTPCcalibLaser::AliTPCcalibLaser(const Text_t *name, const Text_t *title, Bool_t full):
212 fTracksEsdParam(336),
216 fDeltaZ(336), // array of histograms of delta z for each track
217 fDeltaP3(336), // array of histograms of delta z for each track
218 fDeltaP4(336), // array of histograms of P3 for each track
219 fDeltaPhi(336), // array of histograms of P4 for each track
220 fDeltaPhiP(336), // array of histograms of delta z for each track
221 fSignals(336), // array of dedx signals
224 fHisNclIn(0), //->Number of clusters inner
225 fHisNclOut(0), //->Number of clusters outer
226 fHisNclIO(0), //->Number of cluster inner outer
227 fHisLclIn(0), //->Level arm inner
228 fHisLclOut(0), //->Level arm outer
229 fHisLclIO(0), //->Number of cluster inner outer
230 fHisdEdx(0), //->dEdx histo
231 fHisdZfit(0), //->distance to the mirror after linear fit
234 fHisChi2YIn1(0), //->chi2 y inner - line
235 fHisChi2YOut1(0), //->chi2 y inner - line
236 fHisChi2YIn2(0), //->chi2 y inner - parabola
237 fHisChi2YOut2(0), //->chi2 y inner - parabola
238 fHisChi2YIO1(0), //->chi2 y IO - common
239 fHisChi2ZIn1(0), //->chi2 z inner - line
240 fHisChi2ZOut1(0), //->chi2 z inner - line
241 fHisChi2ZIn2(0), //->chi2 z inner - parabola
242 fHisChi2ZOut2(0), //->chi2 z inner - parabola
243 fHisChi2ZIO1(0), //->chi2 z IO - common
246 fHisPy1vP0(0), //-> delta y P0outer-P0inner - line
247 fHisPy2vP0(0), //-> delta y P0outer-P0inner - parabola
248 fHisPy3vP0(0), //-> delta y P0outer-P0inner - common parabola
249 fHisPy1vP1(0), //-> delta ky P1outer-P1inner - line
250 fHisPy2vP1(0), //-> delta ky P1outer-P1inner - parabola
251 fHisPy3vP1(0), //-> delta ky P1outer-P1inner - common parabola
252 fHisPy2vP2In(0), //-> Curv P2inner - parabola
253 fHisPy2vP2Out(0), //-> Curv P2outer - parabola
254 fHisPy3vP2IO(0), //-> Curv P2outerinner - common parabola
257 fHisPz1vP0(0), //-> delta z P0outer-P0inner - line
258 fHisPz2vP0(0), //-> delta z P0outer-P0inner - parabola
259 fHisPz3vP0(0), //-> delta z P0outer-P0inner - common parabola
260 fHisPz1vP1(0), //-> delta kz P1outer-P1inner - line
261 fHisPz2vP1(0), //-> delta kz P1outer-P1inner - parabola
262 fHisPz3vP1(0), //-> delta kz P1outer-P1inner - common parabola
263 fHisPz2vP2In(0), //-> Curv P2inner - parabola
264 fHisPz2vP2Out(0), //-> Curv P2outer - parabola
265 fHisPz3vP2IO(0), //-> Curv P2outerinner - common parabola
275 fFitAside(new TVectorD(3)), // drift fit - A side
276 fFitCside(new TVectorD(3)), // drift fit - C- side
277 fFitACside(new TVectorD(4)), // drift fit - AC- side
278 fEdgeXcuts(3), // cuts in local x direction; used in the refit of the laser tracks
279 fEdgeYcuts(3), // cuts in local y direction; used in the refit of the laser tracks
280 fNClCuts(5), // cuts on the number of clusters per tracklet; used in the refit of the laser tracks
281 fNcuts(0) // number of cuts
288 fTracksEsdParam.SetOwner(kTRUE);
291 AliTPCcalibLaser::AliTPCcalibLaser(const AliTPCcalibLaser& calibLaser):
292 AliTPCcalibBase(calibLaser),
297 fTracksEsdParam(336),
299 fFullCalib(calibLaser.fFullCalib),
301 fDeltaZ(calibLaser.fDeltaZ), // array of histograms of delta z for each track
302 fDeltaP3(((calibLaser.fDeltaP3))), // array of histograms of delta z for each track
303 fDeltaP4(((calibLaser.fDeltaP4))), // array of histograms of P3 for each track
304 fDeltaPhi(((calibLaser.fDeltaPhi))), // array of histograms of P4 for each track
305 fDeltaPhiP(((calibLaser.fDeltaPhiP))), // array of histograms of delta z for each track
306 fSignals(((calibLaser.fSignals))), // array of dedx signals
309 fHisNclIn(new TH2F(*(calibLaser.fHisNclIn))), //->Number of clusters inner
310 fHisNclOut(new TH2F(*(calibLaser.fHisNclOut))), //->Number of clusters outer
311 fHisNclIO(new TH2F(*(calibLaser.fHisNclIO))), //->Number of cluster inner outer
312 fHisLclIn(new TH2F(*(calibLaser.fHisLclIn))), //->Level arm inner
313 fHisLclOut(new TH2F(*(calibLaser.fHisLclOut))), //->Level arm outer
314 fHisLclIO(new TH2F(*(calibLaser.fHisLclIO))), //->Number of cluster inner outer
315 fHisdEdx(new TH2F(*(calibLaser.fHisdEdx))), //
316 fHisdZfit(new TH2F(*(calibLaser.fHisdZfit))), //->distance to the mirror after linear fit
319 fHisChi2YIn1(new TH2F(*(calibLaser.fHisChi2YIn1))), //->chi2 y inner - line
320 fHisChi2YOut1(new TH2F(*(calibLaser.fHisChi2YOut1))), //->chi2 y inner - line
321 fHisChi2YIn2(new TH2F(*(calibLaser.fHisChi2YIn2))), //->chi2 y inner - parabola
322 fHisChi2YOut2(new TH2F(*(calibLaser.fHisChi2YOut2))), //->chi2 y inner - parabola
323 fHisChi2YIO1(new TH2F(*(calibLaser.fHisChi2YIO1))), //->chi2 y IO - common
324 fHisChi2ZIn1(new TH2F(*(calibLaser.fHisChi2ZIn1))), //->chi2 z inner - line
325 fHisChi2ZOut1(new TH2F(*(calibLaser.fHisChi2ZOut1))), //->chi2 z inner - line
326 fHisChi2ZIn2(new TH2F(*(calibLaser.fHisChi2ZIn2))), //->chi2 z inner - parabola
327 fHisChi2ZOut2(new TH2F(*(calibLaser.fHisChi2ZOut2))), //->chi2 z inner - parabola
328 fHisChi2ZIO1(new TH2F(*(calibLaser.fHisChi2ZIO1))), //->chi2 z IO - common
331 fHisPy1vP0(new TH2F(*(calibLaser.fHisPy1vP0))), //-> delta y P0outer-P0inner - line
332 fHisPy2vP0(new TH2F(*(calibLaser.fHisPy2vP0))), //-> delta y P0outer-P0inner - parabola
333 fHisPy3vP0(new TH2F(*(calibLaser.fHisPy3vP0))), //-> delta y P0outer-P0inner - common parabola
334 fHisPy1vP1(new TH2F(*(calibLaser.fHisPy1vP1))), //-> delta ky P1outer-P1inner - line
335 fHisPy2vP1(new TH2F(*(calibLaser.fHisPy2vP1))), //-> delta ky P1outer-P1inner - parabola
336 fHisPy3vP1(new TH2F(*(calibLaser.fHisPy3vP1))), //-> delta ky P1outer-P1inner - common parabola
337 fHisPy2vP2In(new TH2F(*(calibLaser.fHisPy2vP2In))), //-> Curv P2inner - parabola
338 fHisPy2vP2Out(new TH2F(*(calibLaser.fHisPy2vP2Out))), //-> Curv P2outer - parabola
339 fHisPy3vP2IO(new TH2F(*(calibLaser.fHisPy3vP2IO))), //-> Curv P2outerinner - common parabola
342 fHisPz1vP0(new TH2F(*(calibLaser.fHisPz1vP0))), //-> delta z P0outer-P0inner - line
343 fHisPz2vP0(new TH2F(*(calibLaser.fHisPz2vP0))), //-> delta z P0outer-P0inner - parabola
344 fHisPz3vP0(new TH2F(*(calibLaser.fHisPz3vP0))), //-> delta z P0outer-P0inner - common parabola
345 fHisPz1vP1(new TH2F(*(calibLaser. fHisPz1vP1))), //-> delta kz P1outer-P1inner - line
346 fHisPz2vP1(new TH2F(*(calibLaser.fHisPz2vP1))), //-> delta kz P1outer-P1inner - parabola
347 fHisPz3vP1(new TH2F(*(calibLaser.fHisPz3vP1))), //-> delta kz P1outer-P1inner - common parabola
348 fHisPz2vP2In(new TH2F(*(calibLaser.fHisPz2vP2In))), //-> Curv P2inner - parabola
349 fHisPz2vP2Out(new TH2F(*(calibLaser. fHisPz2vP2Out))), //-> Curv P2outer - parabola
350 fHisPz3vP2IO(new TH2F(*(calibLaser.fHisPz3vP2IO))), //-> Curv P2outerinner - common parabola
353 fDeltaYres(((calibLaser.fDeltaYres))),
354 fDeltaZres(((calibLaser.fDeltaZres))),
355 fDeltaYres2(((calibLaser.fDeltaYres))),
356 fDeltaZres2(((calibLaser.fDeltaZres))),
357 // fDeltaYres3(((calibLaser.fDeltaYres))),
358 //fDeltaZres3(((calibLaser.fDeltaZres))),
359 fFitAside(new TVectorD(3)), // drift fit - A side
360 fFitCside(new TVectorD(3)), // drift fit - C- side
361 fFitACside(new TVectorD(4)), // drift fit - C- side
362 fEdgeXcuts(3), // cuts in local x direction; used in the refit of the laser tracks
363 fEdgeYcuts(3), // cuts in local y direction; used in the refit of the laser tracks
364 fNClCuts(5), // cuts on the number of clusters per tracklet; used in the refit of the laser tracks
365 fNcuts(0) // number of cuts
374 AliTPCcalibLaser & AliTPCcalibLaser::operator=(const AliTPCcalibLaser& calibLaser){
376 // assgnment operator
378 if (this != &calibLaser) {
379 new (this) AliTPCcalibLaser(calibLaser);
388 AliTPCcalibLaser::~AliTPCcalibLaser() {
393 delete fHisNclIn; //->Number of clusters inner
394 delete fHisNclOut; //->Number of clusters outer
395 delete fHisNclIO; //->Number of cluster inner outer
396 delete fHisLclIn; //->Level arm inner
397 delete fHisLclOut; //->Level arm outer
398 delete fHisLclIO; //->Number of cluster inner outer
403 delete fHisChi2YIn1; //->chi2 y inner - line
404 delete fHisChi2YOut1; //->chi2 y inner - line
405 delete fHisChi2YIn2; //->chi2 y inner - parabola
406 delete fHisChi2YOut2; //->chi2 y inner - parabola
407 delete fHisChi2YIO1; //->chi2 y IO - common
408 delete fHisChi2ZIn1; //->chi2 z inner - line
409 delete fHisChi2ZOut1; //->chi2 z inner - line
410 delete fHisChi2ZIn2; //->chi2 z inner - parabola
411 delete fHisChi2ZOut2; //->chi2 z inner - parabola
412 delete fHisChi2ZIO1; //->chi2 z IO - common
415 delete fHisPy1vP0; //-> delta y P0outer-P0inner - line
416 delete fHisPy2vP0; //-> delta y P0outer-P0inner - parabola
417 delete fHisPy3vP0; //-> delta y P0outer-P0inner - common parabola
418 delete fHisPy1vP1; //-> delta ky P1outer-P1inner - line
419 delete fHisPy2vP1; //-> delta ky P1outer-P1inner - parabola
420 delete fHisPy3vP1; //-> delta ky P1outer-P1inner - common parabola
421 delete fHisPy2vP2In; //-> Curv P2inner - parabola
422 delete fHisPy2vP2Out; //-> Curv P2outer - parabola
423 delete fHisPy3vP2IO; //-> Curv P2outerinner - common parabola
426 delete fHisPz1vP0; //-> delta z P0outer-P0inner - line
427 delete fHisPz2vP0; //-> delta z P0outer-P0inner - parabola
428 delete fHisPz3vP0; //-> delta z P0outer-P0inner - common parabola
429 delete fHisPz1vP1; //-> delta kz P1outer-P1inner - line
430 delete fHisPz2vP1; //-> delta kz P1outer-P1inner - parabola
431 delete fHisPz3vP1; //-> delta kz P1outer-P1inner - common parabola
432 delete fHisPz2vP2In; //-> Curv P2inner - parabola
433 delete fHisPz2vP2Out; //-> Curv P2outer - parabola
434 delete fHisPz3vP2IO; //-> Curv P2outerinner - common parabola
440 void AliTPCcalibLaser::Process(AliESDEvent * event) {
443 // Loop over tracks and call Process function
450 fESDfriend=static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
454 if (fESD->GetNumberOfTracks()<kMinTracks) return; //not enough tracks
455 AliDebug(4,Form("Event number in current file: %d",event->GetEventNumberInFile()));
458 fTracksEsdParam.Delete();
459 for (Int_t id=0; id<336;id++) {
461 fClusterCounter[id]=0;
464 static Bool_t init=kFALSE;
466 init = kTRUE; // way around for PROOF - to be investigated
470 Int_t n=fESD->GetNumberOfTracks();
472 for (Int_t i=0;i<n;++i) {
473 AliESDfriendTrack *friendTrack=fESDfriend->GetTrack(i);
474 AliESDtrack *track=fESD->GetTrack(i);
475 TObject *calibObject=0;
477 for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j)
478 if ((seed=dynamic_cast<AliTPCseed*>(calibObject)))
481 Int_t id = FindMirror(track,seed);
486 if (counter<kMinTracks) return;
489 if (!fFullCalib) return;
491 for (Int_t id=0; id<336; id++){
493 if (!fTracksEsdParam.At(id)) continue;
494 if (fClusterSatur[id]>0.3) continue; // tracks in saturation
496 if ( AcceptLaser(id) && fFitZ[id]<0.5){
504 void AliTPCcalibLaser::MakeDistHisto(Int_t id){
508 // for (Int_t id=0; id<336; id++){
511 if (!fTracksEsdParam.At(id)) return;
512 if (!AcceptLaser(id)) return;
515 TH1F * hisdz = (TH1F*)fDeltaZ.At(id);
516 if (!hisdz) MakeFitHistos();
517 hisdz = (TH1F*)fDeltaZ.At(id);
518 TH1F * hisP3 = (TH1F*)fDeltaP3.At(id);
519 TH1F * hisP4 = (TH1F*)fDeltaP4.At(id);
520 TH1F * hisdphi = (TH1F*)fDeltaPhi.At(id);
521 TH1F * hisdphiP = (TH1F*)fDeltaPhiP.At(id);
522 TH1F * hisSignal = (TH1F*)fSignals.At(id);
525 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
526 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
527 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
536 param->GetPxPyPz(pxyz);
538 ltrp->GetPxPyPz(lpxyz);
540 Float_t dz = param->GetZ()-ltrp->GetZ();
541 Float_t dphi = (TMath::ATan2(xyz[1],xyz[0])- TMath::ATan2(lxyz[1],lxyz[0]))*254.;
542 Float_t dphiP = param->GetParameter()[2]-ltrp->GetParameter()[2];
543 if (hisdz) hisdz->Fill(dz);
544 if (hisP3) hisP3->Fill(param->GetParameter()[3]);
545 if (hisP4) hisP4->Fill(param->GetParameter()[4]);
546 if (hisdphi) hisdphi->Fill(dphi);
547 if (hisdphiP) hisdphiP->Fill(dphiP);
548 if (hisSignal) hisSignal->Fill(TMath::Sqrt(TMath::Abs(track->GetTPCsignal())));
552 void AliTPCcalibLaser::FitDriftV(){
554 // Fit corrections to the drift velocity - linear approximation in the z and global y
555 //The transfromatiom from the drift time to the z position done in AliTPCTracnsform class
560 z = s* (z0 - vd*(t-t0))
564 vd - nominal drift velocity
565 zs - miscalibrated position
567 zs = s*(z0 - vd*(1+vr)*(t-(t0+dt))
568 vr - relative change of the drift velocity
573 zs ~ z - s*vr*(z0-s*z)+s*dzt
574 --------------------------------
575 1. Correction function vr constant:
578 dz = zs-z = -s*vr *(z0-s*z)+s*dzt
579 dzs/dl = dz/dl +s*s*vr*dz/dl
583 const Float_t kZCut = 240; // remove the closest laser beam
584 const Float_t kSaturCut = 0.05; // remove saturated lasers - cut on fraction of saturated
585 const Float_t kDistCut = 3; // distance sigma cut
586 const Float_t kDistCutAbs = 0.25;
587 const Float_t kMinClusters = 60; // minimal amount of the clusters
588 const Float_t kMinSignal = 16; // minimal mean height of the signal
589 const Float_t kChi2Cut = 0.1; // chi2 cut to accept drift fit
590 static TLinearFitter fdriftA(3,"hyp2");
591 static TLinearFitter fdriftC(3,"hyp2");
592 static TLinearFitter fdriftAC(4,"hyp3");
593 TVectorD fitA(3),fitC(3),fitAC(4);
595 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
596 AliTPCParam * tpcparam = calib->GetParameters();
599 for (Int_t id=0; id<336; id++) fFitZ[id]=0;
609 for (Int_t iter=0; iter<3; iter++){
610 fdriftA.ClearPoints();
611 fdriftC.ClearPoints();
612 fdriftAC.ClearPoints();
614 for (Int_t id=0; id<336; id++){
615 if (!fTracksEsdParam.At(id)) continue;
616 if (!AcceptLaser(id)) continue;
617 if ( fClusterSatur[id]>kSaturCut) continue;
618 if ( fClusterCounter[id]<kMinClusters) continue;
619 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
620 if (track->GetTPCsignal()<kMinSignal) continue;
621 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
622 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
629 param->GetPxPyPz(pxyz);
631 ltrp->GetPxPyPz(lpxyz);
632 if (TMath::Abs(lxyz[2])>kZCut) continue;
633 Float_t sz = (ltrp->GetSide()==0) ? TMath::Sqrt(chi2A): TMath::Sqrt(chi2C);
634 if (npointsAC>0) sz =TMath::Sqrt(chi2AC);
635 if (TMath::Abs(fFitZ[id])>sz*kDistCut) continue;
636 if (iter>0 && TMath::Abs(fFitZ[id])>kDistCutAbs) continue;
639 Double_t zlength = tpcparam->GetZLength(0);
640 Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
641 Double_t mdrift = zlength-TMath::Abs(xyz[2]);
642 Double_t xxx[2] = {ldrift,lxyz[1]*ldrift/(zlength*250.)};
643 if (ltrp->GetSide()==0){
644 fdriftA.AddPoint(xxx,mdrift,1);
646 fdriftC.AddPoint(xxx,mdrift,1);
648 Double_t xxx2[3] = {ltrp->GetSide(), ldrift,lxyz[1]*ldrift/(zlength*250.)};
649 fdriftAC.AddPoint(xxx2,mdrift,1);
652 if (fdriftA.GetNpoints()>10){
655 if (iter==0) fdriftA.EvalRobust(0.7);
656 else fdriftA.EvalRobust(0.8);
657 fdriftA.GetParameters(fitA);
658 npointsA= fdriftA.GetNpoints();
659 chi2A = fdriftA.GetChisquare()/fdriftA.GetNpoints();
660 if (chi2A<kChi2Cut ||(*fFitAside)[0]==0 ) (*fFitAside) = fitA;
662 if (fdriftC.GetNpoints()>10){
664 if (iter==0) fdriftC.EvalRobust(0.7);
665 else fdriftC.EvalRobust(0.8);
667 fdriftC.GetParameters(fitC);
668 npointsC= fdriftC.GetNpoints();
669 chi2C = fdriftC.GetChisquare()/fdriftC.GetNpoints();
670 if (chi2C<kChi2Cut||(*fFitCside)[0]==0) (*fFitCside) = fitC;
673 if (fdriftAC.GetNpoints()>10&&fdriftC.GetNpoints()>10&&fdriftA.GetNpoints()>10){
675 if (iter==0) fdriftAC.EvalRobust(0.7);
676 else fdriftAC.EvalRobust(0.8);
678 fdriftAC.GetParameters(fitAC);
679 npointsAC= fdriftAC.GetNpoints();
680 chi2AC = fdriftAC.GetChisquare()/fdriftAC.GetNpoints();
681 if (chi2AC<kChi2Cut||(*fFitACside)[0]==0) (*fFitACside) = fitAC;
684 for (Int_t id=0; id<336; id++){
685 if (!fTracksEsdParam.At(id)) continue;
687 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
688 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
694 param->GetPxPyPz(pxyz);
696 ltrp->GetPxPyPz(lpxyz);
697 Double_t zlength = tpcparam->GetZLength(0);
698 Double_t ldrift = zlength-TMath::Abs(lxyz[2]);
699 Double_t mdrift = zlength-TMath::Abs(xyz[2]);
702 if (ltrp->GetSide()==0){
703 fz = (fitA)[0]+(fitA)[1]*ldrift+(fitA)[2]*lxyz[1]*ldrift/(zlength*250.);
705 fz = (fitC)[0]+(fitC)[1]*ldrift+(fitC)[2]*lxyz[1]*ldrift/(zlength*250.);
708 fz = (fitAC)[0]+(fitAC)[1]*ltrp->GetSide()+(fitAC)[2]*ldrift+(fitAC)[3]*lxyz[1]*ldrift/(zlength*250.);
713 TTreeSRedirector *cstream = GetDebugStreamer();
714 TTimeStamp tstamp(fTime);
715 Float_t valuePressure0 = AliTPCcalibDB::GetPressure(tstamp,fRun,0);
716 Float_t valuePressure1 = AliTPCcalibDB::GetPressure(tstamp,fRun,1);
717 Double_t ptrelative0 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,0);
718 Double_t ptrelative1 = AliTPCcalibDB::GetPTRelative(tstamp,fRun,1);
719 Double_t temp0 = AliTPCcalibDB::GetTemperature(tstamp,fRun,0);
720 Double_t temp1 = AliTPCcalibDB::GetTemperature(tstamp,fRun,1);
723 (*cstream)<<"driftv"<<
724 "run="<<fRun<< // run number
725 "event="<<fEvent<< // event number
726 "time="<<fTime<< // time stamp of event
727 "trigger="<<fTrigger<< // trigger
728 "mag="<<fMagF<< // magnetic field
729 // Environment values
730 "press0="<<valuePressure0<<
731 "press1="<<valuePressure1<<
732 "pt0="<<ptrelative0<<
733 "pt1="<<ptrelative1<<
739 "driftA.="<<fFitAside<<
740 "driftC.="<<fFitCside<<
741 "driftAC.="<<fFitACside<<
754 Float_t AliTPCcalibLaser::GetDistance(AliExternalTrackParam *param, AliTPCLaserTrack *ltrp){
756 // get distance between mirror and laser track
767 dist+=TMath::Abs((TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*param->GetX());
770 // apply drift correction if already exist
773 if (ltrp->GetSide()==0){
774 if ((*fFitAside)[1]>0.) dz = ((*fFitAside)[0]+(*fFitAside)[1]*lxyz[2]+(*fFitAside)[2]*lxyz[1])-xyz[2];
776 if ((*fFitCside)[1]>0.) dz = ((*fFitCside)[0]+(*fFitCside)[1]*lxyz[2]+(*fFitCside)[2]*lxyz[1])-xyz[2];
778 if (TMath::Abs(dz)>3*(TMath::Abs(lxyz[2]-xyz[2])+1)) dz= TMath::Abs(lxyz[2]-xyz[2]);
779 dist+=TMath::Abs(dz);
781 // phi dist - divergence on 50 cm
783 dist = TMath::Abs((param->GetParameter()[2]-ltrp->GetParameter()[2])*50);
788 Bool_t AliTPCcalibLaser::AcceptLaser(Int_t id){
793 TCut cutP0("cutP0","abs((atan2(x1,x0)-atan2(lx1,lx0))*254)<1.5");
794 TCut cutP1("cutP1","abs(LTr.fP[1]-Tr.fP[1])<30");
795 TCut cutP2("cutP2","abs(LTr.fP[2]-Tr.fP[2])<0.03");
796 TCut cutP3("cutP3","abs(Tr.fP[3])<0.05");
797 TCut cutP4("cutPt","abs(Tr.fP[4])<0.1");
799 TCut cutA = cutP0+cutP1+cutP2+cutP3+cutP4;
801 AliExternalTrackParam *param =(AliExternalTrackParam*)fTracksEsdParam.At(id);
802 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
803 //AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
808 if (TMath::Abs((TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*254)>1.5) return kFALSE; //cut y- P0
809 if (TMath::Abs(param->GetParameter()[1]-ltrp->GetParameter()[1])>30) return kFALSE; // cutZ -P1
810 if (TMath::Abs(param->GetParameter()[2]-ltrp->GetParameter()[2])>0.03) return kFALSE; // cut -P2
811 if (TMath::Abs(param->GetParameter()[3])>0.05) return kFALSE; // cut Tl -P3
812 if (TMath::Abs(param->GetParameter()[4])>0.1) return kFALSE; // cut Pt -P4
819 Int_t AliTPCcalibLaser::FindMirror(AliESDtrack *track, AliTPCseed *seed){
821 // Find corresponding mirror
822 // add the corresponding tracks
825 Float_t kRadius0 = 252;
826 Float_t kRadius = 253.4;
828 if (!track->GetOuterParam()) return -1;
829 AliExternalTrackParam param(*(track->GetOuterParam()));
830 AliTracker::PropagateTrackTo(¶m,kRadius0,0.10566,3,kTRUE);
831 AliTracker::PropagateTrackTo(¶m,kRadius,0.10566,0.1,kTRUE);
832 AliTPCLaserTrack ltr;
833 AliTPCLaserTrack *ltrp=0x0;
834 // AliTPCLaserTrack *ltrpjw=0x0;
836 Int_t id = AliTPCLaserTrack::IdentifyTrack(¶m);
837 // Int_t idjw = AliTPCLaserTrack::IdentifyTrackJW(¶m);
838 //AliDebug(4,Form("Identified Track: %03d (%03d)",id,idjw));
840 if (id!=-1 && (AliTPCLaserTrack::GetTracks()->UncheckedAt(id)))
841 ltrp=(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
851 Float_t counterSatur=0;
852 for (Int_t irow=158;irow>-1;--irow) {
853 AliTPCclusterMI *c=seed->GetClusterPointer(irow);
855 Double_t pedgeY = c->GetX()*TMath::DegToRad()*(10)-TMath::Abs(c->GetY());
856 Double_t pedgeX = TMath::Min((irow)*0.75, (159.-irow)*1.5);
857 if (pedgeY<3) continue;
858 if (pedgeX<3) continue;
860 if (c->GetMax()>900) counterSatur++;
862 counterSatur/=(countercl+1);
864 if (counterSatur>fClusterSatur[id]) fClusterSatur[id]=counterSatur;
867 Float_t radius=TMath::Abs(ltrp->GetX());
868 AliTracker::PropagateTrackTo(¶m,radius,0.10566,0.01,kTRUE);
870 if (!fTracksMirror.At(id)) fTracksMirror.AddAt(ltrp,id);
873 // choose closer track
875 AliExternalTrackParam * param0 = (AliExternalTrackParam *)fTracksEsdParam.At(id);
877 Float_t dist0=GetDistance(param0,ltrp);
878 Float_t dist1=GetDistance(¶m,ltrp);
879 if (dist0<dist1) accept=kFALSE;
883 fClusterCounter[id]=countercl;
884 fTracksEsdParam.AddAt(param.Clone(),id);
885 fTracksEsd.AddAt(track,id);
886 fTracksTPC.AddAt(seed,id);
893 void AliTPCcalibLaser::DumpLaser(Int_t id) {
895 // Dump Laser info to the tree
897 AliESDtrack *track = (AliESDtrack*)fTracksEsd.At(id);
898 AliExternalTrackParam *param=(AliExternalTrackParam*)fTracksEsdParam.At(id);
899 AliTPCLaserTrack *ltrp = ( AliTPCLaserTrack*)fTracksMirror.At(id);
908 param->GetPxPyPz(pxyz);
910 ltrp->GetPxPyPz(lpxyz);
911 Float_t dist3D = GetDistance(param,ltrp);
912 Float_t dist0 = (TMath::ATan2(xyz[1],xyz[0])-TMath::ATan2(lxyz[1],lxyz[0]))*param->GetX();
913 Float_t distphi = (param->GetParameter()[2]-ltrp->GetParameter()[2])*50;
917 TTreeSRedirector *cstream = GetDebugStreamer();
918 Int_t time = fESD->GetTimeStamp();
919 Bool_t accept = AcceptLaser(id);
921 (*cstream)<<"Track"<<
923 "run="<<fRun<< // run number
924 "event="<<fEvent<< // event number
925 "time="<<fTime<< // time stamp of event
926 "trigger="<<fTrigger<< // trigger
927 "mag="<<fMagF<< // magnetic field
931 "driftA.="<<fFitAside<<
932 "driftC.="<<fFitCside<<
936 "distphi="<<distphi<<
939 "counter="<<fCounter[id]<<
940 "clcounter="<<fClusterCounter[id]<<
941 "satur="<<fClusterSatur[id]<<
965 void AliTPCcalibLaser::RefitLaserJW(Int_t id){
967 // Refit the track with different tracklet models:
968 // 1. Per ROC using the kalman filter, different edge cuts
969 // 2. Per ROC linear in y and z
970 // 3. Per ROC quadratic in y and z
971 // 4. Per track offset for each sector, linear for each sector, common quadratic
972 // store x, y, z information for all models and the cluster to calculate the residuals
975 // The clusters which do not fulfill given criteria are skipped
977 // Cluters removed from fit
978 // 1. Extended shape > kShapeCut
979 // 2. In saturation Max > kMax
980 // 3. Distance to edge < cutEdge
982 // Clusters not used for the calibration:
984 // 1. Extended shape > kShapeCut
985 // 2. In saturation Max > kMax
988 AliTPCseed *track = (AliTPCseed*)fTracksTPC.At(id);
989 AliExternalTrackParam *extparam=(AliExternalTrackParam*)fTracksEsdParam.At(id);
990 AliTPCLaserTrack *ltrp = (AliTPCLaserTrack*)fTracksMirror.At(id);
992 AliTPCclusterMI dummyCl;
995 Int_t kMaxTracklets=2;
996 Float_t kShapeCut = 1.3;
997 Float_t kRatioCut = 2.;
1002 //=============================================//
1003 // Linear Fitters for the Different Approaches //
1004 //=============================================//
1005 //linear fit model in y and z; inner - outer sector
1006 static TLinearFitter fy1I(2,"hyp1");
1007 static TLinearFitter fy1O(2,"hyp1");
1008 static TLinearFitter fz1I(2,"hyp1");
1009 static TLinearFitter fz1O(2,"hyp1");
1010 //quadratic fit model in y and z; inner - sector
1011 static TLinearFitter fy2I(3,"hyp2");
1012 static TLinearFitter fy2O(3,"hyp2");
1013 static TLinearFitter fz2I(3,"hyp2");
1014 static TLinearFitter fz2O(3,"hyp2");
1015 //common quadratic fit for IROC and OROC in y and z
1016 static TLinearFitter fy4(5,"hyp4");
1017 static TLinearFitter fz4(5,"hyp4");
1027 //=============================//
1028 // Loop over all Tracklet Cuts //
1029 //=============================//
1030 for (Int_t icut=0; icut<fNcuts; icut++){
1031 Float_t xinMin = 2500, xinMax=-90;
1032 Float_t xoutMin=2500, xoutMax=-90;
1033 Float_t msigmaYIn=0;
1034 Float_t msigmaYOut=0;
1035 Float_t mqratioIn=0;
1036 Float_t mqratioOut=0;
1039 AliDebug(4,Form("Processing cut %d for track with ID %d",icut,id));
1041 Double_t edgeCutX = fEdgeXcuts[icut];
1042 Double_t edgeCutY = fEdgeYcuts[icut];
1043 Int_t nclCut = (Int_t)fNClCuts[icut];
1044 //=========================//
1045 // Parameters to calculate //
1046 //=========================//
1047 //fit parameter inner, outer tracklet and combined fit
1048 TVectorD vecy1resInner(2),vecz1resInner(2); //pol1 fit parameters inner
1049 TVectorD vecy2resInner(3),vecz2resInner(3); //pol2 fit parameters inner
1051 TVectorD vecy1resOuter(2),vecz1resOuter(2); //pol1 fit parameters outer
1052 TVectorD vecy2resOuter(3),vecz2resOuter(3); //pol2 fit parameters outer
1053 TVectorD vecy4res(5),vecz4res(5);
1054 // cluster and track positions for each row - used for residuals
1055 TVectorD vecgX(159); // global X
1056 TVectorD vecgY(159); // global Y
1057 TVectorD vecgZ(159); // global Z
1059 TVectorD vecX(159); // x is the same for all (row center)
1060 TVectorD vecYkalman(159); // y from kalman fit
1061 TVectorD vecZkalman(159); // z from kalman fit
1062 TVectorD vecY1(159); // y from pol1 fit per ROC
1063 TVectorD vecZ1(159); // z from pol1 fit per ROC
1064 TVectorD vecY2(159); // y from pol2 fit per ROC
1065 TVectorD vecZ2(159); // z from pol2 fit per ROC
1066 TVectorD vecY4(159); // y from sector fit
1067 TVectorD vecZ4(159); // z from sector fit
1068 TVectorD vecClY(159); // y cluster position
1069 TVectorD vecClZ(159); // z cluster position
1070 TVectorD vecSec(159); // sector for each row
1071 TVectorD isReject(159); // flag - cluster to be rejected
1073 Double_t chi2I1z=0; // chi2 of pol1 fit in z (inner)
1074 Double_t chi2I1y=0; // chi2 of pol1 fit in y (inner)
1075 Double_t chi2O1z=0; // chi2 of pol1 fit in z (outer)
1076 Double_t chi2O1y=0; // chi2 of pol1 fit in y (outer)
1077 Double_t chi2I2z=0; // chi2 of pol2 fit in z (inner)
1078 Double_t chi2I2y=0; // chi2 of pol2 fit in y (inner)
1079 Double_t chi2O2z=0; // chi2 of pol2 fit in z (outer)
1080 Double_t chi2O2y=0; // chi2 of pol2 fit in y (outer)
1081 Double_t chi2IOz=0; // chi2 of hyp4 fit in z (inner+outer)
1082 Double_t chi2IOy=0; // chi2 of hyp4 fit in y (inner+outer)
1084 Int_t innerSector = -1; // number of inner sector
1085 Int_t outerSector = -1; // number of outer sector
1086 Int_t nclI=0; // number of clusters (inner)
1087 Int_t nclO=0; // number of clusters (outer)
1088 //=================================================//
1089 // Perform the Kalman Fit using the Tracklet Class //
1090 //=================================================//
1091 AliTPCTracklet::SetEdgeCut(edgeCutX,edgeCutY);
1092 TObjArray tracklets=
1093 AliTPCTracklet::CreateTracklets(track,AliTPCTracklet::kKalman,
1094 kFALSE,nclCut,kMaxTracklets);
1095 // tracklet pointers
1096 AliTPCTracklet *trInner = (AliTPCTracklet*)tracklets.At(0);
1097 AliTPCTracklet *trOuter = (AliTPCTracklet*)tracklets.At(1);
1098 AliTPCTracklet *tr=0x0;
1099 AliTPCTracklet dummy;
1100 //continue if we didn't find a tracklet
1101 if ( !trInner && !trOuter ) continue;
1102 //================================================================================//
1103 // Swap Inner and Outer if necessary (inner sector is definde by smaller local x) //
1104 //================================================================================//
1105 if ( trInner && trOuter ){
1106 if ( !trInner->GetInner() || !trOuter->GetInner() ) continue;
1107 if ( trInner->GetInner()->GetX() > trOuter->GetInner()->GetX() ){
1111 AliDebug(5,Form("Swapped Sectors: %02d (%f) <-> %02d (%f)", trOuter->GetSector(), trOuter->GetInner()->GetX(), trInner->GetSector(), trInner->GetInner()->GetX()));
1115 if ( !trInner->GetInner() ) continue;
1117 if ( trInner->GetSector()>35 ){
1122 if ( !trOuter->GetInner() ) continue;
1124 if ( trOuter->GetSector()<36 ){
1130 innerSector = trInner->GetSector();
1131 if ( innerSector>=0 ) AliDebug(5,Form("Found inner Sector %02d at X %.2f", innerSector, trInner->GetInner()->GetX()));
1132 outerSector = trOuter->GetSector();
1133 if ( outerSector>=0 ) AliDebug(5,Form("Found outer Sector %02d at X %.2f", outerSector, trOuter->GetInner()->GetX()));
1135 // array of clusters
1136 TClonesArray arrCl("AliTPCclusterMI",159);
1137 arrCl.ExpandCreateFast(159);
1138 //=======================================//
1139 // fill fitters with cluster information //
1140 //=======================================//
1141 AliDebug(3,"Filing Cluster Information");
1146 for (Int_t irow=158;irow>-1;--irow) {
1147 AliTPCclusterMI *c=track->GetClusterPointer(irow);
1148 AliTPCclusterMI &cl = (AliTPCclusterMI&) (*arrCl[irow]);
1153 Float_t meanY=0, sumY=0;
1154 for (Int_t drow=-1;drow<=1;drow++) {
1155 if (irow+drow<0) continue;
1156 if (irow+drow>158) continue;
1157 AliTPCclusterMI *ccurrent=track->GetClusterPointer(irow);
1158 if (!ccurrent) continue;
1159 Int_t roc = static_cast<Int_t>(ccurrent->GetDetector());
1160 if ( roc!=innerSector && roc!=outerSector ) continue;
1161 if (ccurrent->GetX()<10) continue;
1162 if (ccurrent->GetY()==0) continue;
1163 meanY+=ccurrent->GetY();
1166 if (sumY>0) meanY/=sumY;
1171 Double_t pedgeY = c->GetX()*TMath::Tan(TMath::DegToRad()*(10))-TMath::Abs(meanY);
1172 Double_t pedgeX = TMath::Min((irow)*0.75, (159.-irow)*1.5);
1175 Int_t roc = static_cast<Int_t>(c->GetDetector());
1176 if ( roc!=innerSector && roc!=outerSector ) continue;
1178 //store clusters in clones array
1181 if (c->GetMax()<4) continue; // noise cluster?
1182 if (TMath::Abs(c->GetY())<0.0001) continue; // noise cluster?
1184 vecX[irow] = c->GetX();
1185 vecClY[irow] = c->GetY();
1186 vecClZ[irow] = c->GetZ();
1189 c->GetGlobalXYZ(gxyz);
1190 vecgX[irow] = gxyz[0];
1191 vecgY[irow] = gxyz[1];
1192 vecgZ[irow] = gxyz[2];
1194 Double_t x = vecX[irow]-133.4; //reference is between IROC and OROC
1195 Double_t y = vecClY[irow];
1196 Double_t z = vecClZ[irow];
1198 Double_t x2[2]={x,x*x}; //linear and parabolic parameters
1199 Double_t x4[4]={0,0,0,0}; //hyp4 parameters
1200 if ( roc == innerSector ) {
1201 x4[0]=1; //offset inner - outer sector
1202 x4[1]=x; //slope parameter inner sector
1204 x4[2]=x; //slope parameter outer sector
1206 x4[3]=x*x; //common parabolic shape
1207 if (pedgeX < fEdgeXcuts[icut]) continue;
1208 if (pedgeY < fEdgeYcuts[icut]) continue;
1209 if (c->GetMax()>900) continue; // cluster in saturation
1211 if ( roc==innerSector ){
1212 fy1I.AddPoint(x2,y);
1213 fz1I.AddPoint(x2,z);
1214 fy2I.AddPoint(x2,y);
1215 fz2I.AddPoint(x2,z);
1217 if (c->GetX()<xinMin) xinMin=c->GetX();
1218 if (c->GetX()>xinMax) xinMax=c->GetX();
1220 msigmaYIn +=TMath::Sqrt(c->GetSigmaY2());
1221 mqratioIn +=c->GetMax()/c->GetQ();
1224 if ( roc==outerSector ){
1225 fy1O.AddPoint(x2,y);
1226 fz1O.AddPoint(x2,z);
1227 fy2O.AddPoint(x2,y);
1228 fz2O.AddPoint(x2,z);
1230 if (c->GetX()<xoutMin) xoutMin=c->GetX();
1231 if (c->GetX()>xoutMax) xoutMax=c->GetX();
1232 msigmaYOut +=TMath::Sqrt(c->GetSigmaY2());
1233 mqratioOut +=c->GetMax()/c->GetQ();
1247 //======================================//
1248 // Evaluate and retrieve fit parameters //
1249 //======================================//
1250 AliDebug(5,Form("Evaluating fits with inner (outer) Sec: %02d (%02d)",innerSector,outerSector));
1252 if ( (innerSector>-1) && (fy1I.GetNpoints()>0) ){
1257 fy1I.GetParameters(vecy1resInner);
1258 fz1I.GetParameters(vecz1resInner);
1259 fy2I.GetParameters(vecy2resInner);
1260 fz2I.GetParameters(vecz2resInner);
1261 chi2I1y=fy1I.GetChisquare()/(fy1I.GetNpoints()-2);
1262 chi2I1z=fz1I.GetChisquare()/(fz1I.GetNpoints()-2);
1263 chi2I2y=fy2I.GetChisquare()/(fy2I.GetNpoints()-3);
1264 chi2I2z=fz2I.GetChisquare()/(fz2I.GetNpoints()-3);
1267 if ( (outerSector>-1) && (fy1O.GetNpoints()>0) ){
1272 fy1O.GetParameters(vecy1resOuter);
1273 fz1O.GetParameters(vecz1resOuter);
1274 fy2O.GetParameters(vecy2resOuter);
1275 fz2O.GetParameters(vecz2resOuter);
1276 chi2O1y=fy1O.GetChisquare()/(fy1O.GetNpoints()-2);
1277 chi2O1z=fz1O.GetChisquare()/(fz1O.GetNpoints()-2);
1278 chi2O2y=fy2O.GetChisquare()/(fy2O.GetNpoints()-3);
1279 chi2O2z=fz2O.GetChisquare()/(fz2O.GetNpoints()-3);
1282 if ( innerSector>0 && outerSector>0 ){
1283 if (fy4.GetNpoints()>0) {
1285 fy4.GetParameters(vecy4res);
1286 chi2IOy=fy4.GetChisquare()/(fy4.GetNpoints()-5);
1288 if (fz4.GetNpoints()>0) {
1290 fz4.GetParameters(vecz4res);
1291 chi2IOz=fz4.GetChisquare()/(fz4.GetNpoints()-5);
1295 fy4.ClearPoints(); fz4.ClearPoints();
1296 fy1I.ClearPoints(); fy1O.ClearPoints();
1297 fz1I.ClearPoints(); fz1O.ClearPoints();
1298 fy2I.ClearPoints(); fy2O.ClearPoints();
1299 fz2I.ClearPoints(); fz2O.ClearPoints();
1300 //==============================//
1301 // calculate tracklet positions //
1302 //==============================//
1303 AliDebug(4,"Calculate tracklet positions");
1304 for (Int_t irow=158;irow>-1;--irow) {
1306 AliTPCclusterMI *c=track->GetClusterPointer(irow);
1307 if ( vecSec[irow]!=innerSector && vecSec[irow]!=outerSector ) { // no cluster in given sectors
1311 if (!c) { //no cluster
1314 if (c->GetMax()>kMax){ //saturation
1317 if ( vecSec[irow] == outerSector ) { //extended shape
1318 if (c->GetMax()/c->GetQ()> mqratioOut*kRatioCut) isReject[irow]+=8;
1319 if (TMath::Sqrt(c->GetSigmaY2())>msigmaYOut*kShapeCut) isReject[irow]+=16;
1321 if (c->GetMax()/c->GetQ()> mqratioIn*kRatioCut) isReject[irow]+=8;
1322 if (TMath::Sqrt(c->GetSigmaY2())>msigmaYIn*kShapeCut) isReject[irow]+=16;
1328 if ( vecSec[irow]==-1 ) continue; //no cluster info
1329 if ( vecSec[irow]!=innerSector && vecSec[irow]!=outerSector ) continue;
1331 Double_t x=vecX[irow];
1332 Double_t xref=x-133.4;
1334 Double_t yoffInner=0;
1335 Double_t zoffInner=0;
1336 Double_t yslopeInner=0;
1337 Double_t yslopeOuter=0;
1338 Double_t zslopeInner=0;
1339 Double_t zslopeOuter=0;
1340 //positions of hyperplane fits
1341 if ( vecSec[irow] == outerSector ) {
1343 vecY1[irow]=vecy1resOuter[0]+vecy1resOuter[1]*xref;
1344 vecZ1[irow]=vecz1resOuter[0]+vecz1resOuter[1]*xref;
1345 vecY2[irow]=vecy2resOuter[0]+vecy2resOuter[1]*xref+vecy2resOuter[2]*xref*xref;
1346 vecZ2[irow]=vecz2resOuter[0]+vecz2resOuter[1]*xref+vecz2resOuter[2]*xref*xref;
1347 yslopeOuter=vecy4res[3];
1348 zslopeOuter=vecz4res[3];
1351 vecY1[irow]=vecy1resInner[0]+vecy1resInner[1]*xref;
1352 vecZ1[irow]=vecz1resInner[0]+vecz1resInner[1]*xref;
1353 vecY2[irow]=vecy2resInner[0]+vecy2resInner[1]*xref+vecy2resInner[2]*xref*xref;
1354 vecZ2[irow]=vecz2resInner[0]+vecz2resInner[1]*xref+vecz2resInner[2]*xref*xref;
1355 yoffInner=vecy4res[1];
1356 zoffInner=vecz4res[1];
1357 yslopeInner=vecy4res[2];
1358 zslopeInner=vecz4res[2];
1360 vecY4[irow]=vecy4res[0]+yoffInner+yslopeInner*xref+yslopeOuter*xref+vecy4res[4]*xref*xref;
1361 vecZ4[irow]=vecz4res[0]+zoffInner+zslopeInner*xref+zslopeOuter*xref+vecz4res[4]*xref*xref;
1362 //positions of kalman fits
1363 Double_t gxyz[3],xyz[3];
1364 AliExternalTrackParam *param = 0x0;
1366 param=tr->GetInner();
1368 param->GetXYZ(gxyz);
1369 Float_t bz = AliTracker::GetBz(gxyz);
1370 param->GetYAt(x, bz, xyz[1]);
1371 param->GetZAt(x, bz, xyz[2]);
1372 vecYkalman[irow]=xyz[1];
1373 vecZkalman[irow]=xyz[2];
1380 //=====================================================================//
1381 // write results from the different tracklet fits with debug streamers //
1382 //=====================================================================//
1383 if (fStreamLevel>4){
1384 TTreeSRedirector *cstream = GetDebugStreamer();
1386 Float_t dedx = track->GetdEdx();
1387 (*cstream)<<"FitModels"<<
1388 "run="<<fRun<< // run number
1389 "event="<<fEvent<< // event number
1390 "time="<<fTime<< // time stamp of event
1391 "trigger="<<fTrigger<< // trigger
1392 "mag="<<fMagF<< // magnetic field
1395 "edgeCutX=" << edgeCutX <<
1396 "edgeCutY=" << edgeCutY <<
1397 "nclCut=" << nclCut <<
1398 "innerSector="<< innerSector <<
1399 "outerSector="<< outerSector <<
1402 "Tr.=" << extparam <<
1403 "yPol1In.=" << &vecy1resInner <<
1404 "zPol1In.=" << &vecz1resInner <<
1405 "yPol2In.=" << &vecy2resInner <<
1406 "zPol2In.=" << &vecz2resInner <<
1407 "yPol1Out.=" << &vecy1resOuter <<
1408 "zPol1Out.=" << &vecz1resOuter <<
1409 "yPol2Out.=" << &vecy2resOuter <<
1410 "zPol2Out.=" << &vecz2resOuter <<
1411 "yInOut.=" << &vecy4res <<
1412 "zInOut.=" << &vecz4res <<
1413 "chi2y1In=" << chi2I1y <<
1414 "chi2z1In=" << chi2I1z <<
1415 "chi2y1Out=" << chi2O1y <<
1416 "chi2z1Out=" << chi2O1z <<
1417 "chi2y2In=" << chi2I2y <<
1418 "chi2z2In=" << chi2I2z <<
1419 "chi2y2Out=" << chi2O2y <<
1420 "chi2z2Out=" << chi2O2z <<
1421 "chi2yInOut=" << chi2IOy <<
1422 "chi2zInOut=" << chi2IOz <<
1423 "trletIn.=" << trInner <<
1424 "trletOut.=" << trOuter <<
1427 "xinMin=" << xinMin<<
1428 "xinMax=" << xinMax<<
1429 "xoutMin=" << xoutMin<<
1430 "xoutMax=" << xoutMax<<
1431 "msigmaYIn=" <<msigmaYIn<<
1432 "msigmaYOut=" <<msigmaYOut<<
1433 "mqratioIn=" <<mqratioIn<<
1434 "mqratioOut=" << mqratioOut <<
1439 // wirte residuals information
1440 if (fStreamLevel>5){
1441 TTreeSRedirector *cstream = GetDebugStreamer();
1443 Float_t dedx = track->GetdEdx();
1444 (*cstream)<<"Residuals"<<
1445 "run="<<fRun<< // run number
1446 "event="<<fEvent<< // event number
1447 "time="<<fTime<< // time stamp of event
1448 "trigger="<<fTrigger<< // trigger
1449 "mag="<<fMagF<< // magnetic field
1452 "edgeCutX=" << edgeCutX <<
1453 "edgeCutY=" << edgeCutY <<
1454 "nclCut=" << nclCut <<
1456 "Tr.=" << extparam<<
1459 "vX.=" << &vecgX<< // global x
1460 "vY.=" << &vecgY<< // global y
1461 "vZ.=" << &vecgZ<< // global z
1463 "TrYpol1.=" << &vecY1 <<
1464 "TrZpol1.=" << &vecZ1 <<
1465 "TrYpol2.=" << &vecY2 <<
1466 "TrZpol2.=" << &vecZ2 <<
1467 "TrYInOut.=" << &vecY4 <<
1468 "TrZInOut.=" << &vecZ4 <<
1469 "ClY.=" << &vecClY <<
1470 "ClZ.=" << &vecClZ <<
1471 "isReject.=" << &isReject<<
1472 "sec.=" << &vecSec <<
1475 "xinMin=" << xinMin<<
1476 "xinMax=" << xinMax<<
1477 "xoutMin=" << xoutMin<<
1478 "xoutMax=" << xoutMax<<
1479 "msigmaYIn=" <<msigmaYIn<<
1480 "msigmaYOut=" <<msigmaYOut<<
1481 "mqratioIn=" <<mqratioIn<<
1482 "mqratioOut=" << mqratioOut <<
1483 "yInOut.=" << &vecy4res <<
1484 "zInOut.=" << &vecz4res <<
1486 "chi2y1In=" << chi2I1y << //
1487 "chi2z1In=" << chi2I1z <<
1488 "chi2y1Out=" << chi2O1y <<
1489 "chi2z1Out=" << chi2O1z <<
1490 "chi2y2In=" << chi2I2y <<
1491 "chi2z2In=" << chi2I2z <<
1492 "chi2y2Out=" << chi2O2y <<
1493 "chi2z2Out=" << chi2O2z <<
1494 "chi2yInOut=" << chi2IOy <<
1495 "chi2zInOut=" << chi2IOz <<
1497 "yPol1In.=" << &vecy1resInner <<
1498 "zPol1In.=" << &vecz1resInner <<
1499 "yPol2In.=" << &vecy2resInner <<
1500 "zPol2In.=" << &vecz2resInner <<
1501 "yPol1Out.=" << &vecy1resOuter <<
1502 "zPol1Out.=" << &vecz1resOuter <<
1503 "yPol2Out.=" << &vecy2resOuter <<
1504 "zPol2Out.=" << &vecz2resOuter <<
1510 //==========================//
1511 // Fill Residual Histograms //
1512 //==========================//
1513 if (!fHisNclIn) MakeFitHistos();
1515 TH2F *profy = (TH2F*)fDeltaYres.UncheckedAt(id);
1516 TH2F *profz = (TH2F*)fDeltaZres.UncheckedAt(id);
1517 TH2F *profy2 = (TH2F*)fDeltaYres2.UncheckedAt(id);
1518 TH2F *profz2 = (TH2F*)fDeltaZres2.UncheckedAt(id);
1519 // TH2F *profy3 = (TH2F*)fDeltaYres3.UncheckedAt(id);
1520 //TH2F *profz3 = (TH2F*)fDeltaZres3.UncheckedAt(id);
1522 for (Int_t irow=158;irow>-1;--irow) {
1523 if (vecSec[irow]==-1)continue; // no cluster info
1524 if (isReject[irow]>0.5) continue; //
1525 //Double_t x = vecX[irow];
1526 Double_t ycl = vecClY[irow];
1527 Double_t yfit = vecY1[irow];
1528 Double_t yfit2 = vecY2[irow];
1529 // Double_t yfit3 = vecY2[irow];
1530 Double_t zcl = vecClZ[irow];
1531 Double_t zfit = vecZ1[irow];
1532 Double_t zfit2 = vecZ2[irow];
1533 //Double_t zfit3 = vecZ2[irow];
1535 if (TMath::Abs(yfit-ycl)<2&&TMath::Abs(zfit-zcl)<2){
1537 profy->Fill(irow,ycl-yfit);
1538 profy2->Fill(irow,ycl-yfit2);
1539 // profy3->Fill(irow,ycl-yfit3);
1542 profz->Fill(irow,zcl-zfit);
1543 profz2->Fill(irow,zcl-zfit2);
1544 //profz3->Fill(irow,zcl-zfit3);
1550 // Fill laser fit histograms
1552 Float_t dedx = track->GetdEdx();
1553 if (nclI>20&&nclO>20){
1554 fHisNclIn->Fill(id,nclI); //->Number of clusters inner
1555 fHisNclOut->Fill(id,nclO); //->Number of clusters outer
1556 fHisNclIO->Fill(id,nclI+nclO); //->Number of cluster inner outer
1558 fHisLclIn->Fill(id,xinMax-xinMin); //->Level arm inner
1559 fHisLclOut->Fill(id,xoutMax-xoutMin); //->Level arm outer
1560 fHisLclIO->Fill(id,xoutMax-xinMin); //->Number of cluster inner outer
1562 fHisdEdx->Fill(id,TMath::Sqrt(TMath::Abs(dedx)));
1563 fHisdZfit->Fill(id,fFitZ[id]);
1566 fHisChi2YIn1->Fill(id,TMath::Sqrt(chi2I1y)); //->chi2 y inner - line
1567 fHisChi2YOut1->Fill(id,TMath::Sqrt(chi2O1y)); //->chi2 y inner - line
1568 fHisChi2YIn2->Fill(id,TMath::Sqrt(chi2I2y)); //->chi2 y inner - parabola
1569 fHisChi2YOut2->Fill(id,TMath::Sqrt(chi2O2y)); //->chi2 y inner - parabola
1570 fHisChi2YIO1->Fill(id,TMath::Sqrt(chi2IOy)); //->chi2 y IO - common
1573 fHisChi2ZIn1->Fill(id,TMath::Sqrt(chi2I1z)); //->chi2 z inner - line
1574 fHisChi2ZOut1->Fill(id,TMath::Sqrt(chi2O1z)); //->chi2 z inner - line
1575 fHisChi2ZIn2->Fill(id,TMath::Sqrt(chi2O2y)); //->chi2 z inner - parabola
1576 fHisChi2ZOut2->Fill(id,TMath::Sqrt(chi2O2z)); //->chi2 z inner - parabola
1577 fHisChi2ZIO1->Fill(id,TMath::Sqrt(chi2IOz)); //->chi2 z IO - common
1580 fHisPy1vP0->Fill(id,vecy1resOuter[0]-vecy1resInner[0]); //-> delta y P0outer-P0inner - line
1581 fHisPy2vP0->Fill(id,vecy2resOuter[0]-vecy2resInner[0]); //-> delta y P0outer-P0inner - parabola
1582 fHisPy3vP0->Fill(id,vecy4res[1]); //-> delta y P0outer-P0inner - common parabola
1584 fHisPy1vP1->Fill(id,vecy1resOuter[1]-vecy1resInner[1]); //-> delta ky P1outer-P1inner - line
1585 fHisPy2vP1->Fill(id,vecy2resOuter[1]-vecy2resInner[1]); //-> delta ky P1outer-P1inner - parabola
1586 fHisPy3vP1->Fill(id,vecy4res[3]-vecy4res[2]); //-> delta ky P1outer-P1inner - common parabola
1588 fHisPy3vP2IO->Fill(id,vecy4res[4]); //-> Curv P2outerinner - common parabola
1589 fHisPz1vP0->Fill(id,vecz1resOuter[0]-vecz1resInner[0]); //-> delta z P0outer-P0inner - line
1590 fHisPz2vP0->Fill(id,vecz2resOuter[0]-vecz2resInner[0]); //-> delta z P0outer-P0inner - parabola
1591 fHisPz3vP0->Fill(id,vecz4res[1]); //-> delta z P0outer-P0inner - common parabola
1593 fHisPz1vP1->Fill(id,vecz1resOuter[1]-vecz1resInner[1]); //-> delta kz P1outer-P1inner - line
1594 fHisPz2vP1->Fill(id,vecz2resOuter[1]-vecz2resInner[1]); //-> delta kz P1outer-P1inner - parabola
1595 fHisPz3vP1->Fill(id,vecz4res[3]-vecz4res[2]); //-> delta kz P1outer-P1inner - common parabola
1596 fHisPz3vP2IO->Fill(id,vecz4res[4]); //-> Curv P2outerinner - common parabola
1599 fHisPy2vP2In->Fill(id,vecy2resInner[2]); //-> Curv P2inner - parabola
1600 fHisPz2vP2In->Fill(id,vecz2resInner[2]); //-> Curv P2inner - parabola
1604 fHisPz2vP2Out->Fill(id,vecz2resOuter[2]); //-> Curv P2outer - parabola
1605 fHisPy2vP2Out->Fill(id,vecy2resOuter[2]); //-> Curv P2outer - parabola
1613 void AliTPCcalibLaser::DumpMeanInfo(Float_t bfield, Int_t run){
1615 // Dump information about laser beams
1616 // isOK variable indicates usability of the beam
1617 // Beam is not usable if:
1618 // a. No entries in range (krmsCut0)
1619 // b. Big sperad (krmscut1)
1620 // c. RMSto fit sigma bigger then (kmultiCut)
1621 // d. Too big angular spread
1624 const Float_t krmsCut0=0.001;
1625 const Float_t krmsCut1=0.16;
1626 const Float_t kmultiCut=2;
1627 const Float_t kcutP0=0.002;
1629 AliTPCcalibLaser *laser = this;
1630 TTreeSRedirector *pcstream = new TTreeSRedirector("laserMean.root");
1631 TF1 fg("fg","gaus");
1634 for (Int_t id=0; id<336; id++){
1636 TH1F * hisphi = (TH1F*)laser->fDeltaPhi.At(id);
1637 TH1F * hisphiP = (TH1F*)laser->fDeltaPhiP.At(id);
1638 TH1F * hisZ = (TH1F*)laser->fDeltaZ.At(id);
1639 TH1F * hisP3 = (TH1F*)laser->fDeltaP3.At(id);
1640 TH1F * hisP4 = (TH1F*)laser->fDeltaP4.At(id);
1641 TH1F * hisS = (TH1F*)laser->fSignals.At(id);
1642 //if (!hisphi) continue;
1643 Double_t entries = (hisphi==0)? 0: hisphi->GetEntries();
1644 //if (entries<minEntries) continue;
1646 AliTPCLaserTrack *ltrp = (AliTPCLaserTrack*)fTracksMirror.At(id);
1648 AliTPCLaserTrack::LoadTracks();
1649 ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
1651 pcstream->GetFile()->cd();
1652 if (hisphi) hisphi->Write();
1653 if (hisphiP) hisphiP->Write();
1654 if (hisZ) hisZ->Write();
1655 if (hisP3) hisP3->Write();
1656 if (hisP4) hisP4->Write();
1658 Float_t meanphi = hisphi->GetMean();
1659 Float_t rmsphi = hisphi->GetRMS();
1661 Float_t meanphiP = hisphiP->GetMean();
1662 Float_t rmsphiP = hisphiP->GetRMS();
1663 Float_t meanZ = hisZ->GetMean();
1664 Float_t rmsZ = hisZ->GetRMS();
1665 hisphi->Fit(&fg,"","",hisphi->GetMean()-4*hisphi->GetRMS(),hisphi->GetMean()+4*hisphi->GetRMS());
1666 Double_t gphi1 = fg.GetParameter(1);
1667 Double_t gphi2 = fg.GetParameter(2);
1668 hisphiP->Fit(&fg,"","",hisphiP->GetMean()-4*hisphiP->GetRMS(),hisphiP->GetMean()+4*hisphiP->GetRMS());
1669 Double_t gphiP1 = fg.GetParameter(1);
1670 Double_t gphiP2 = fg.GetParameter(2);
1672 hisZ->Fit(&fg,"","",hisZ->GetMean()-4*hisZ->GetRMS(),hisZ->GetMean()+4*hisZ->GetRMS());
1673 Double_t gz1 = fg.GetParameter(1);
1674 Double_t gz2 = fg.GetParameter(2);
1676 hisP3->Fit(&fg,"","",hisP3->GetMean()-4*hisP3->GetRMS(),hisP3->GetMean()+4*hisP3->GetRMS());
1677 Double_t gp31 = fg.GetParameter(1);
1678 Double_t gp32 = fg.GetParameter(2);
1680 hisP4->Fit(&fg,"","",hisP4->GetMean()-4*hisP4->GetRMS(),hisP4->GetMean()+4*hisP4->GetRMS());
1681 Double_t gp41 = fg.GetParameter(1);
1682 Double_t gp42 = fg.GetParameter(2);
1684 Float_t meanS=hisS->GetMean();
1689 ltrp->GetPxPyPz(lpxyz);
1691 if (rmsphi<krmsCut0) isOK=kFALSE; // empty in range - not entries inside
1692 if (rmsphi>krmsCut1) isOK=kFALSE; // empty in range - not entries inside
1693 if (rmsphi>krmsCut0) if (gphi2/rmsphi>kmultiCut) isOK=kFALSE; // multi peak structure
1694 if (gphiP2>kcutP0) isOK=kFALSE;
1700 his = fHisNclIn->ProjectionY("aaa",id+1,id+1);
1701 Float_t mnclIn = his->GetMean();
1703 his = fHisNclOut->ProjectionY("aaa",id+1,id+1);
1704 Float_t mnclOut = his->GetMean();
1706 his = fHisNclIO->ProjectionY("aaa",id+1,id+1);
1707 Float_t mnclIO = his->GetMean();
1709 his = fHisLclIn->ProjectionY("aaa",id+1,id+1);
1710 Float_t mLclIn = his->GetMean();
1712 his = fHisLclOut->ProjectionY("aaa",id+1,id+1);
1713 Float_t mLclOut = his->GetMean();
1715 his = fHisLclIO->ProjectionY("aaa",id+1,id+1);
1716 Float_t mLclIO = his->GetMean();
1719 his = fHisdEdx->ProjectionY("aaa",id+1,id+1);
1720 Float_t mdEdx = his->GetMean();
1726 his = fHisChi2YIn1->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - line
1727 Float_t mChi2YIn1= his->GetMean();
1729 his = fHisChi2YOut1->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - line
1730 Float_t mChi2YOut1 = his->GetMean();
1732 his = fHisChi2YIn2->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - parabola
1733 Float_t mChi2YIn2 = his->GetMean();
1735 his = fHisChi2YOut2->ProjectionY("aaa",id+1,id+1); //->chi2 y inner - parabola
1736 Float_t mChi2YOut2 = his->GetMean();
1738 his = fHisChi2YIO1->ProjectionY("aaa",id+1,id+1); //->chi2 y IO - common
1739 Float_t mChi2YIO1 = his->GetMean();
1741 his = fHisChi2ZIn1->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - line
1742 Float_t mChi2ZIn1 = his->GetMean();
1744 his = fHisChi2ZOut1->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - line
1745 Float_t mChi2ZOut1 = his->GetMean();
1747 his = fHisChi2ZIn2->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - parabola
1748 Float_t mChi2ZIn2 = his->GetMean();
1750 his = fHisChi2ZOut2->ProjectionY("aaa",id+1,id+1); //->chi2 z inner - parabola
1751 Float_t mChi2ZOut2 = his->GetMean();
1753 his = fHisChi2ZIO1->ProjectionY("aaa",id+1,id+1); //->chi2 z IO - common
1754 Float_t mChi2ZIO1 = his->GetMean();
1759 his = fHisdZfit->ProjectionY("aaa",id+1,id+1);
1760 Float_t edZfit = his->GetEntries();
1761 Float_t mdZfit = his->GetMean();
1762 Float_t rdZfit = his->GetRMS();
1765 his = fHisPy1vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - line
1766 Float_t ePy1vP0 = his->GetEntries();
1767 Float_t mPy1vP0 = his->GetMean();
1768 Float_t rPy1vP0 = his->GetRMS();
1771 his = fHisPy2vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - parabola
1772 Float_t ePy2vP0 = his->GetEntries();
1773 Float_t mPy2vP0 = his->GetMean();
1774 Float_t rPy2vP0 = his->GetRMS();
1777 his = fHisPy3vP0->ProjectionY("aaa",id+1,id+1); //-> delta y P0outer-P0inner - common parabola
1778 Float_t ePy3vP0 = his->GetEntries();
1779 Float_t mPy3vP0 = his->GetMean();
1780 Float_t rPy3vP0 = his->GetRMS();
1783 his = fHisPy1vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - line
1784 Float_t ePy1vP1 = his->GetEntries();
1785 Float_t mPy1vP1 = his->GetMean();
1786 Float_t rPy1vP1 = his->GetRMS();
1789 his = fHisPy2vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - parabola
1790 Float_t ePy2vP1 = his->GetEntries();
1791 Float_t mPy2vP1 = his->GetMean();
1792 Float_t rPy2vP1 = his->GetRMS();
1795 his = fHisPy3vP1->ProjectionY("aaa",id+1,id+1); //-> delta ky P1outer-P1inner - common parabola
1796 Float_t ePy3vP1 = his->GetEntries();
1797 Float_t mPy3vP1 = his->GetMean();
1798 Float_t rPy3vP1 = his->GetRMS();
1801 his = fHisPy2vP2In->ProjectionY("aaa",id+1,id+1); //-> Curv P2inner - parabola
1802 Float_t ePy2vP2In = his->GetEntries();
1803 Float_t mPy2vP2In = his->GetMean();
1804 Float_t rPy2vP2In = his->GetRMS();
1807 his = fHisPy2vP2Out->ProjectionY("aaa",id+1,id+1); //-> Curv P2outer - parabola
1808 Float_t ePy2vP2Out = his->GetEntries();
1809 Float_t mPy2vP2Out = his->GetMean();
1810 Float_t rPy2vP2Out = his->GetRMS();
1813 his = fHisPy3vP2IO->ProjectionY("aaa",id+1,id+1); //-> Curv P2outerinner - common parabola
1814 Float_t ePy3vP2IO = his->GetEntries();
1815 Float_t mPy3vP2IO = his->GetMean();
1816 Float_t rPy3vP2IO = his->GetRMS();
1821 his = fHisPz1vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - line
1822 Float_t ePz1vP0 = his->GetEntries();
1823 Float_t mPz1vP0 = his->GetMean();
1824 Float_t rPz1vP0 = his->GetRMS();
1827 his = fHisPz2vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - parabola
1828 Float_t ePz2vP0 = his->GetEntries();
1829 Float_t mPz2vP0 = his->GetMean();
1830 Float_t rPz2vP0 = his->GetRMS();
1833 his = fHisPz3vP0->ProjectionY("aaa",id+1,id+1); //-> delta z P0outer-P0inner - common parabola
1834 Float_t ePz3vP0 = his->GetEntries();
1835 Float_t mPz3vP0 = his->GetMean();
1836 Float_t rPz3vP0 = his->GetRMS();
1839 his = fHisPz1vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - line
1840 Float_t ePz1vP1 = his->GetEntries();
1841 Float_t mPz1vP1 = his->GetMean();
1842 Float_t rPz1vP1 = his->GetRMS();
1845 his = fHisPz2vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - parabola
1846 Float_t ePz2vP1 = his->GetEntries();
1847 Float_t mPz2vP1 = his->GetMean();
1848 Float_t rPz2vP1 = his->GetRMS();
1851 his = fHisPz3vP1->ProjectionY("aaa",id+1,id+1); //-> delta kz P1outer-P1inner - common parabola
1852 Float_t ePz3vP1 = his->GetEntries();
1853 Float_t mPz3vP1 = his->GetMean();
1854 Float_t rPz3vP1 = his->GetRMS();
1857 his = fHisPz2vP2In->ProjectionY("aaa",id+1,id+1); //-> Curv P2inner - parabola
1858 Float_t ePz2vP2In = his->GetEntries();
1859 Float_t mPz2vP2In = his->GetMean();
1860 Float_t rPz2vP2In = his->GetRMS();
1863 his = fHisPz2vP2Out->ProjectionY("aaa",id+1,id+1); //-> Curv P2outer - parabola
1864 Float_t ePz2vP2Out = his->GetEntries();
1865 Float_t mPz2vP2Out = his->GetMean();
1866 Float_t rPz2vP2Out = his->GetRMS();
1869 his = fHisPz3vP2IO->ProjectionY("aaa",id+1,id+1); //-> Curv P2outerinner - common parabola
1870 Float_t ePz3vP2IO = his->GetEntries();
1871 Float_t mPz3vP2IO = his->GetMean();
1872 Float_t rPz3vP2IO = his->GetRMS();
1876 (*pcstream)<<"Mean"<<
1879 "id="<<id<< // track id
1880 "entries="<<entries<< // number of entries
1881 "bz="<<bfield<< // bfield
1882 "LTr.="<<ltrp<< // refernece track
1884 "mnclIn="<<mnclIn<< // mean number of clusters in inner
1885 "mnclOut="<<mnclOut<< // mean number of clusters in outer
1886 "mnclIO="<<mnclIO<< // mean number of clusters in inner+outer
1887 "mLclIn="<<mLclIn<< // mean number of clusters in inner
1888 "mLclOut="<<mLclOut<< // mean number of clusters in outer
1889 "mLclIO="<<mLclIO<< // mean number of clusters in inner+outer
1890 "mdEdx="<<mdEdx<< // mean dEdx
1891 "edZfit="<<edZfit<< // entries z fit
1892 "mdZfit="<<mdZfit<< // mean z fit
1893 "rdZfit="<<rdZfit<< // RMS z fit
1896 "mChi2YIn1="<<mChi2YIn1<< //->chi2 y inner - line
1897 "mChi2YOut1="<<mChi2YOut1<< //->chi2 y inner - line
1898 "mChi2YIn2="<<mChi2YIn2<< //->chi2 y inner - parabola
1899 "mChi2YOut2="<<mChi2YOut2<< //->chi2 y inner - parabola
1900 "mChi2YIO1="<<mChi2YIO1<< //->chi2 y IO - common
1901 "mChi2ZIn1="<<mChi2ZIn1<< //->chi2 z inner - line
1902 "mChi2ZOut1="<<mChi2ZOut1<< //->chi2 z inner - line
1903 "mChi2ZIn2="<<mChi2ZIn2<< //->chi2 z inner - parabola
1904 "mChi2ZOut2="<<mChi2ZOut2<< //->chi2 z inner - parabola
1905 "mChi2ZIO1="<<mChi2ZIO1<< //->chi2 z IO - common
1908 "ePy1vP0="<<ePy1vP0<<
1909 "mPy1vP0="<<mPy1vP0<<
1910 "rPy1vP0="<<rPy1vP0<<
1911 "ePy2vP0="<<ePy2vP0<<
1912 "mPy2vP0="<<mPy2vP0<<
1913 "rPy2vP0="<<rPy2vP0<<
1914 "ePy3vP0="<<ePy3vP0<<
1915 "mPy3vP0="<<mPy3vP0<<
1916 "rPy3vP0="<<rPy3vP0<<
1917 "ePy1vP1="<<ePy1vP1<<
1918 "mPy1vP1="<<mPy1vP1<<
1919 "rPy1vP1="<<rPy1vP1<<
1920 "ePy2vP1="<<ePy2vP1<<
1921 "mPy2vP1="<<mPy2vP1<<
1922 "rPy2vP1="<<rPy2vP1<<
1923 "ePy3vP1="<<ePy3vP1<<
1924 "mPy3vP1="<<mPy3vP1<<
1925 "rPy3vP1="<<rPy3vP1<<
1926 "ePy2vP2In="<<ePy2vP2In<<
1927 "mPy2vP2In="<<mPy2vP2In<<
1928 "rPy2vP2In="<<rPy2vP2In<<
1929 "ePy2vP2Out="<<ePy2vP2Out<<
1930 "mPy2vP2Out="<<mPy2vP2Out<<
1931 "rPy2vP2Out="<<rPy2vP2Out<<
1932 "ePy3vP2IO="<<ePy3vP2IO<<
1933 "mPy3vP2IO="<<mPy3vP2IO<<
1934 "rPy3vP2IO="<<rPy3vP2IO<<
1937 "ePz1vP0="<<ePz1vP0<<
1938 "mPz1vP0="<<mPz1vP0<<
1939 "rPz1vP0="<<rPz1vP0<<
1940 "ePz2vP0="<<ePz2vP0<<
1941 "mPz2vP0="<<mPz2vP0<<
1942 "rPz2vP0="<<rPz2vP0<<
1943 "ePz3vP0="<<ePz3vP0<<
1944 "mPz3vP0="<<mPz3vP0<<
1945 "rPz3vP0="<<rPz3vP0<<
1946 "ePz1vP1="<<ePz1vP1<<
1947 "mPz1vP1="<<mPz1vP1<<
1948 "rPz1vP1="<<rPz1vP1<<
1949 "ePz2vP1="<<ePz2vP1<<
1950 "mPz2vP1="<<mPz2vP1<<
1951 "rPz2vP1="<<rPz2vP1<<
1952 "ePz3vP1="<<ePz3vP1<<
1953 "mPz3vP1="<<mPz3vP1<<
1954 "rPz3vP1="<<rPz3vP1<<
1955 "ePz2vP2In="<<ePz2vP2In<<
1956 "mPz2vP2In="<<mPz2vP2In<<
1957 "rPz2vP2In="<<rPz2vP2In<<
1958 "ePz2vP2Out="<<ePz2vP2Out<<
1959 "mPz2vP2Out="<<mPz2vP2Out<<
1960 "rPz2vP2Out="<<rPz2vP2Out<<
1961 "ePz3vP2IO="<<ePz3vP2IO<<
1962 "mPz3vP2IO="<<mPz3vP2IO<<
1963 "rPz3vP2IO="<<rPz3vP2IO<<
1967 "lx0="<<lxyz[0]<< // reference x
1968 "lx1="<<lxyz[1]<< // reference y
1969 "lx2="<<lxyz[2]<< // refernece z
1970 "lpx0="<<lpxyz[0]<< // reference x
1971 "lpx1="<<lpxyz[1]<< // reference y
1972 "lpx2="<<lpxyz[2]<< // refernece z
1976 "mphi="<<meanphi<< //
1977 "rmsphi="<<rmsphi<< //
1981 "mphiP="<<meanphiP<< //
1982 "rmsphiP="<<rmsphiP<< //
1991 "gp31="<<gp31<< //gaus mean - tgl
1992 "gp32="<<gp32<< //gaus rms -tgl
1993 "gp41="<<gp41<< //gaus mean - P4
1994 "gp42="<<gp42<< //gaus rms - P4
2001 TFile fmean("laserMean.root");
2011 void AliTPCcalibLaser::DumpScanInfo(TTree * chain){
2015 TTreeSRedirector *pcstream = new TTreeSRedirector("laserScan.root");
2016 TFile * f = pcstream->GetFile();
2018 f->mkdir("dirphiP");
2020 TF1 fp("p1","pol1");
2025 char grnamefull[1000];
2028 Double_t mphiP[100];
2029 Double_t smphi[100];
2030 Double_t smphiP[100];
2040 for (Int_t id=0; id<336; id++){
2042 sprintf(cut,"isOK&&fId==%d",id);
2043 Int_t entries = chain->Draw("bz",cut,"goff");
2044 if (entries<3) continue;
2045 AliTPCLaserTrack *ltrp = 0;
2046 if (!AliTPCLaserTrack::GetTracks()) AliTPCLaserTrack::LoadTracks();
2047 ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(id);
2051 ltrp->GetPxPyPz(lpxyz);
2053 chain->Draw("bz",cut,"goff");
2054 memcpy(bz, chain->GetV1(), entries*sizeof(Double_t));
2055 chain->Draw("0.01*abs(bz)+0.02",cut,"goff");
2056 memcpy(sbz, chain->GetV1(), entries*sizeof(Double_t));
2058 chain->Draw("gphi1",cut,"goff");
2059 memcpy(mphi, chain->GetV1(), entries*sizeof(Double_t));
2060 chain->Draw("0.05*abs(mphi)+gphi2",cut,"goff");
2061 memcpy(smphi, chain->GetV1(), entries*sizeof(Double_t));
2063 chain->Draw("gphiP1",cut,"goff");
2064 memcpy(mphiP, chain->GetV1(), entries*sizeof(Double_t));
2065 chain->Draw("0.05*abs(mphiP)+gphiP2",cut,"goff");
2066 memcpy(smphiP, chain->GetV1(), entries*sizeof(Double_t));
2068 chain->Draw("gz1",cut,"goff");
2069 memcpy(mZ, chain->GetV1(), entries*sizeof(Double_t));
2070 chain->Draw("0.01*abs(meanZ)+gz2",cut,"goff");
2071 memcpy(smZ, chain->GetV1(), entries*sizeof(Double_t));
2074 sprintf(grnamefull,"Side_%d_Bundle_%d_Rod_%d_Beam_%d",
2075 ltrp->GetSide(), ltrp->GetBundle(), ltrp->GetRod(), ltrp->GetBeam());
2079 TGraphErrors *grphi = new TGraphErrors(entries,bz,mphi,sbz,smphi);
2082 pphi[0] = fp.GetParameter(0); // offset
2083 pphi[1] = fp.GetParameter(1); // slope
2084 pphi[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2085 sprintf(grname,"phi_id%d",id);
2086 grphi->SetName(grname); grphi->SetTitle(grnamefull);
2087 grphi->GetXaxis()->SetTitle("b_{z} (T)");
2088 grphi->GetYaxis()->SetTitle("#Delta r#phi (cm)");
2089 grphi->SetMaximum(1.2);
2090 grphi->SetMinimum(-1.2);
2094 gPad->SaveAs(Form("pic/phi/phi_%s.gif",grnamefull));
2097 TGraphErrors *grphiP = new TGraphErrors(entries,bz,mphiP,sbz,smphiP);
2100 pphiP[0] = fp.GetParameter(0); // offset
2101 pphiP[1] = fp.GetParameter(1); // slope
2102 pphiP[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2103 sprintf(grname,"phiP_id%d",id);
2104 grphiP->SetName(grname); grphiP->SetTitle(grnamefull);
2105 grphiP->GetXaxis()->SetTitle("b_{z} (T)");
2106 grphiP->GetYaxis()->SetTitle("#Delta #phi (rad)");
2107 grphiP->SetMaximum(pphiP[0]+0.005);
2108 grphiP->SetMinimum(pphiP[0]-0.005);
2110 gPad->SaveAs(Form("pic/phiP/phiP_%s.gif",grnamefull));
2115 TGraphErrors *grmZ = new TGraphErrors(entries,bz,mZ,sbz,smZ);
2118 pmZ[0] = fp.GetParameter(0); // offset
2119 pmZ[1] = fp.GetParameter(1); // slope
2120 pmZ[2] = TMath::Sqrt(fp.GetChisquare()/(entries-2.)); // normalized chi2
2121 sprintf(grname,"mZ_id%d",id);
2122 grmZ->SetName(grname); grmZ->SetTitle(grnamefull);
2123 grmZ->GetXaxis()->SetTitle("b_{z} (T)");
2124 grmZ->GetYaxis()->SetTitle("#Delta z (cm)");
2126 gPad->SaveAs(Form("pic/z/z_%s.gif",grnamefull));
2130 for (Int_t ientry=0; ientry<entries; ientry++){
2131 (*pcstream)<<"Mean"<<
2134 "entries="<<entries<<
2136 "lx0="<<lxyz[0]<< // reference x
2137 "lx1="<<lxyz[1]<< // reference y
2138 "lx2="<<lxyz[2]<< // refernece z
2139 "lpx0="<<lpxyz[0]<< // reference x
2140 "lpx1="<<lpxyz[1]<< // reference y
2141 "lpx2="<<lpxyz[2]<< // refernece z
2143 "gphi1="<<mphi[ientry]<< // mean - from gaus fit
2144 "pphi0="<<pphi[0]<< // offset
2145 "pphi1="<<pphi[1]<< // mean
2146 "pphi2="<<pphi[2]<< // norm chi2
2148 "gphiP1="<<mphiP[ientry]<< // mean - from gaus fit
2149 "pphiP0="<<pphiP[0]<< // offset
2150 "pphiP1="<<pphiP[1]<< // mean
2151 "pphiP2="<<pphiP[2]<< // norm chi2
2153 "gz1="<<mZ[ientry]<<
2154 "pmZ0="<<pmZ[0]<< // offset
2155 "pmZ1="<<pmZ[1]<< // mean
2156 "pmZ2="<<pmZ[2]<< // norm chi2
2166 void AliTPCcalibLaser::Analyze(){
2173 Long64_t AliTPCcalibLaser::Merge(TCollection *li) {
2175 TIterator* iter = li->MakeIterator();
2176 AliTPCcalibLaser* cal = 0;
2177 static Int_t counter0=0;
2178 while ((cal = (AliTPCcalibLaser*)iter->Next())) {
2179 if (!cal->InheritsFrom(AliTPCcalibLaser::Class())) {
2180 Error("Merge","Attempt to add object of class %s to a %s", cal->ClassName(), this->ClassName());
2183 printf("Marging number %d\n", counter0);
2186 MergeFitHistos(cal);
2191 // TProfile *hp=0x0;
2192 //TProfile *hpm=0x0;
2194 for (Int_t id=0; id<336; id++){
2195 // merge fDeltaZ histograms
2196 hm = (TH1F*)cal->fDeltaZ.At(id);
2197 h = (TH1F*)fDeltaZ.At(id);
2199 h=new TH1F(Form("hisdz%d",id),Form("hisdz%d",id),1000,-10,10);
2201 fDeltaZ.AddAt(h,id);
2204 // merge fP3 histograms
2205 hm = (TH1F*)cal->fDeltaP3.At(id);
2206 h = (TH1F*)fDeltaP3.At(id);
2208 h=new TH1F(Form("hisPar3v%d",id),Form("hisPar3v%d",id),400,-0.06,0.06);
2210 fDeltaP3.AddAt(h,id);
2213 // merge fP4 histograms
2214 hm = (TH1F*)cal->fDeltaP4.At(id);
2215 h = (TH1F*)fDeltaP4.At(id);
2217 h=new TH1F(Form("hisPar4v%d",id),Form("hisPar4v%d",id),200,-0.06,0.06);
2219 fDeltaP4.AddAt(h,id);
2224 // merge fDeltaPhi histograms
2225 hm = (TH1F*)cal->fDeltaPhi.At(id);
2226 h = (TH1F*)fDeltaPhi.At(id);
2228 h= new TH1F(Form("hisdphi%d",id),Form("hisdphi%d",id),1000,-1,1);
2230 fDeltaPhi.AddAt(h,id);
2233 // merge fDeltaPhiP histograms
2234 hm = (TH1F*)cal->fDeltaPhiP.At(id);
2235 h = (TH1F*)fDeltaPhiP.At(id);
2237 h=new TH1F(Form("hisdphiP%d",id),Form("hisdphiP%d",id),1000,-0.01,0.01);
2239 fDeltaPhiP.AddAt(h,id);
2242 // merge fSignals histograms
2243 hm = (TH1F*)cal->fSignals.At(id);
2244 h = (TH1F*)fSignals.At(id);
2246 h=new TH1F(Form("hisSignal%d",id),Form("hisSignal%d",id),100,0,300);
2248 fSignals.AddAt(h,id);
2253 // merge ProfileY histograms -0
2254 h2m = (TH2F*)cal->fDeltaYres.At(id);
2255 h2 = (TH2F*)fDeltaYres.At(id);
2256 if (h2m) h2->Add(h2m);
2258 h2m = (TH2F*)cal->fDeltaZres.At(id);
2259 h2 = (TH2F*)fDeltaZres.At(id);
2260 if (h2m) h->Add(h2m);
2261 // merge ProfileY histograms - 2
2262 h2m = (TH2F*)cal->fDeltaYres2.At(id);
2263 h2 = (TH2F*)fDeltaYres2.At(id);
2264 if (h2m) h2->Add(h2m);
2266 h2m = (TH2F*)cal->fDeltaZres2.At(id);
2267 h2 = (TH2F*)fDeltaZres2.At(id);
2268 if (h2m) h->Add(h2m);
2269 // merge ProfileY histograms - 3
2270 //h2m = (TH2F*)cal->fDeltaYres3.At(id);
2271 //h2 = (TH2F*)fDeltaYres3.At(id);
2272 //if (h2m) h2->Add(h2m);
2274 //h2m = (TH2F*)cal->fDeltaZres3.At(id);
2275 //h2 = (TH2F*)fDeltaZres3.At(id);
2276 //if (h2m) h->Add(h2m);
2284 void AliTPCcalibLaser::MakeFitHistos(){
2286 // Make a fit histograms
2288 // Number of clusters
2290 //TH2F *fHisNclIn; //->Number of clusters inner
2291 //TH2F *fHisNclOut; //->Number of clusters outer
2292 //TH2F *fHisNclIO; //->Number of cluster inner outer
2293 // TH2F *fHisdEdx; //->dEdx histo
2294 fHisNclIn = new TH2F("HisNclIn","HisNclIn",336,0,336,64,10,64);
2295 fHisNclOut = new TH2F("HisNclOut","HisNclOut",336,0,336,100,10,100);
2296 fHisNclIO = new TH2F("HisNclIO","HisNclIO",336,0,336,160,10,160);
2298 fHisLclIn = new TH2F("HisLclIn","HisLclIn",336,0,336,64,10,64);
2299 fHisLclOut = new TH2F("HisLclOut","HisLclOut",336,0,336,100,10,150);
2300 fHisLclIO = new TH2F("HisLclIO","HisLclIO",336,0,336,160,10,160);
2302 fHisdEdx = new TH2F("HisdEdx","HisdEdx",336,0,336,160,1,50);
2303 fHisdZfit = new TH2F("HisdZfit","HisdZfit",336,0,336,300,-0.3,0.3);
2308 // TH2F *fHisChi2YIn1; //->chi2 y inner - line
2309 // TH2F *fHisChi2YOut1; //->chi2 y inner - line
2310 // TH2F *fHisChi2YIn2; //->chi2 y inner - parabola
2311 // TH2F *fHisChi2YOut2; //->chi2 y inner - parabola
2312 // TH2F *fHisChi2YIO1; //->chi2 y IO - common
2313 fHisChi2YIn1 = new TH2F("Chi2YIn1","Chi2YIn1",336,0,336,500,0.001,0.5);
2314 fHisChi2YOut1 = new TH2F("Chi2YOut1","Chi2YOut1",336,0,336,500,0.001,0.5);
2315 fHisChi2YIn2 = new TH2F("Chi2YIn2","Chi2YIn2",336,0,336,500,0.001,0.5);
2316 fHisChi2YOut2 = new TH2F("Chi2YOut2","Chi2YOut2",336,0,336,500,0.001,0.5);
2317 fHisChi2YIO1 = new TH2F("Chi2YIO1","Chi2YIO1",336,0,336,500,0.001,0.5);
2318 // TH2F *fHisChi2ZIn1; //->chi2 z inner - line
2319 // TH2F *fHisChi2ZOut1; //->chi2 z inner - line
2320 // TH2F *fHisChi2ZIn2; //->chi2 z inner - parabola
2321 // TH2F *fHisChi2ZOut2; //->chi2 z inner - parabola
2322 // TH2F *fHisChi2ZIO1; //->chi2 z IO - common
2323 fHisChi2ZIn1 = new TH2F("Chi2ZIn1","Chi2ZIn1",336,0,336,500,0.001,0.5);
2324 fHisChi2ZOut1 = new TH2F("Chi2ZOut1","Chi2ZOut1",336,0,336,500,0.001,0.5);
2325 fHisChi2ZIn2 = new TH2F("Chi2ZIn2","Chi2ZIn2",336,0,336,500,0.001,0.5);
2326 fHisChi2ZOut2 = new TH2F("Chi2ZOut2","Chi2ZOut2",336,0,336,500,0.001,0.5);
2327 fHisChi2ZIO1 = new TH2F("Chi2ZIO1","Chi2ZIO1",336,0,336,500,0.001,0.5);
2332 // TH2F *fHisPy1vP0; //-> delta y P0outer-P0inner - line
2333 // TH2F *fHisPy2vP0; //-> delta y P0outer-P0inner - parabola
2334 // TH2F *fHisPy3vP0; //-> delta y P0outer-P0inner - common parabola
2335 // TH2F *fHisPy1vP1; //-> delta ky P1outer-P1inner - line
2336 // TH2F *fHisPy2vP1; //-> delta ky P1outer-P1inner - parabola
2337 // TH2F *fHisPy3vP1; //-> delta ky P1outer-P1inner - common parabola
2338 // TH2F *fHisPy2vP2In; //-> Curv P2inner - parabola
2339 // TH2F *fHisPy2vP2Out; //-> Curv P2outer - parabola
2340 // TH2F *fHisPy3vP2IO; //-> Curv P2outerinner - common parabola
2341 fHisPy1vP0 = new TH2F("HisPy1vP0", "HisPy1vP0",336,0,336,500,-0.3,0.3);
2342 fHisPy2vP0 = new TH2F("HisPy2vP0", "HisPy2vP0",336,0,336,500,-0.3,0.3);
2343 fHisPy3vP0 = new TH2F("HisPy3vP0", "HisPy3vP0",336,0,336,500,-0.3,0.3);
2344 fHisPy1vP1 = new TH2F("HisPy1vP1", "HisPy1vP1",336,0,336,500,-0.01,0.01);
2345 fHisPy2vP1 = new TH2F("HisPy2vP1", "HisPy2vP1",336,0,336,500,-0.01,0.01);
2346 fHisPy3vP1 = new TH2F("HisPy3vP1", "HisPy3vP1",336,0,336,500,-0.01,0.01);
2347 fHisPy2vP2In = new TH2F("HisPy2vP2In", "HisPy2vP2In",336,0,336,500,-0.0003,0.0003);
2348 fHisPy2vP2Out= new TH2F("HisPy2vP2Out","HisPy2vP2Out",336,0,336,500,-0.0003,0.0003);
2349 fHisPy3vP2IO = new TH2F("HisPy3vP2IO", "HisPy3vP2IO",336,0,336,500,-0.0003,0.0003);
2352 // TH2F *fHisPz1vP0; //-> delta z P0outer-P0inner - line
2353 // TH2F *fHisPz2vP0; //-> delta z P0outer-P0inner - parabola
2354 // TH2F *fHisPz3vP0; //-> delta z P0outer-P0inner - common parabola
2355 // TH2F *fHisPz1vP1; //-> delta kz P1outer-P1inner - line
2356 // TH2F *fHisPz2vP1; //-> delta kz P1outer-P1inner - parabola
2357 // TH2F *fHisPz3vP1; //-> delta kz P1outer-P1inner - common parabola
2358 // TH2F *fHisPz2vP2In; //-> Curv P2inner - parabola
2359 // TH2F *fHisPz2vP2Out; //-> Curv P2outer - parabola
2360 // TH2F *fHisPz3vP2IO; //-> Curv P2outerinner - common parabola
2361 fHisPz1vP0 = new TH2F("HisPz1vP0", "HisPz1vP0",336,0,336,500,-0.3,0.3);
2362 fHisPz2vP0 = new TH2F("HisPz2vP0", "HisPz2vP0",336,0,336,500,-0.3,0.3);
2363 fHisPz3vP0 = new TH2F("HisPz3vP0", "HisPz3vP0",336,0,336,500,-0.3,0.3);
2364 fHisPz1vP1 = new TH2F("HisPz1vP1", "HisPz1vP1",336,0,336,500,-0.01,0.01);
2365 fHisPz2vP1 = new TH2F("HisPz2vP1", "HisPz2vP1",336,0,336,500,-0.01,0.01);
2366 fHisPz3vP1 = new TH2F("HisPz3vP1", "HisPz3vP1",336,0,336,500,-0.01,0.01);
2367 fHisPz2vP2In = new TH2F("HisPz2vP2In", "HisPz2vP2In",336,0,336,500,-0.0003,0.0003);
2368 fHisPz2vP2Out= new TH2F("HisPz2vP2Out","HisPz2vP2Out",336,0,336,500,-0.0002,0.0002);
2369 fHisPz3vP2IO = new TH2F("HisPz3vP2IO", "HisPz3vP2IO",336,0,336,500,-0.0002,0.0002);
2371 fHisNclIn->SetDirectory(0); //->Number of clusters inner
2372 fHisNclOut->SetDirectory(0); //->Number of clusters outer
2373 fHisNclIO->SetDirectory(0); //->Number of cluster inner outer
2374 fHisLclIn->SetDirectory(0); //->Level arm inner
2375 fHisLclOut->SetDirectory(0); //->Level arm outer
2376 fHisLclIO->SetDirectory(0); //->Number of cluster inner outer
2377 fHisdEdx->SetDirectory(0); //->Number of cluster inner outer
2378 fHisdZfit->SetDirectory(0); //->Number of cluster inner outer
2381 fHisChi2YIn1->SetDirectory(0); //->chi2 y inner - line
2382 fHisChi2YOut1->SetDirectory(0); //->chi2 y inner - line
2383 fHisChi2YIn2->SetDirectory(0); //->chi2 y inner - parabola
2384 fHisChi2YOut2->SetDirectory(0); //->chi2 y inner - parabola
2385 fHisChi2YIO1->SetDirectory(0); //->chi2 y IO - common
2386 fHisChi2ZIn1->SetDirectory(0); //->chi2 z inner - line
2387 fHisChi2ZOut1->SetDirectory(0); //->chi2 z inner - line
2388 fHisChi2ZIn2->SetDirectory(0); //->chi2 z inner - parabola
2389 fHisChi2ZOut2->SetDirectory(0); //->chi2 z inner - parabola
2390 fHisChi2ZIO1->SetDirectory(0); //->chi2 z IO - common
2393 fHisPy1vP0->SetDirectory(0); //-> delta y P0outer-P0inner - line
2394 fHisPy2vP0->SetDirectory(0); //-> delta y P0outer-P0inner - parabola
2395 fHisPy3vP0->SetDirectory(0); //-> delta y P0outer-P0inner - common parabola
2396 fHisPy1vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - line
2397 fHisPy2vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - parabola
2398 fHisPy3vP1->SetDirectory(0); //-> delta ky P1outer-P1inner - common parabola
2399 fHisPy2vP2In->SetDirectory(0); //-> Curv P2inner - parabola
2400 fHisPy2vP2Out->SetDirectory(0); //-> Curv P2outer - parabola
2401 fHisPy3vP2IO->SetDirectory(0); //-> Curv P2outerinner - common parabola
2404 fHisPz1vP0->SetDirectory(0); //-> delta z P0outer-P0inner - line
2405 fHisPz2vP0->SetDirectory(0); //-> delta z P0outer-P0inner - parabola
2406 fHisPz3vP0->SetDirectory(0); //-> delta z P0outer-P0inner - common parabola
2407 fHisPz1vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - line
2408 fHisPz2vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - parabola
2409 fHisPz3vP1->SetDirectory(0); //-> delta kz P1outer-P1inner - common parabola
2410 fHisPz2vP2In->SetDirectory(0); //-> Curv P2inner - parabola
2411 fHisPz2vP2Out->SetDirectory(0); //-> Curv P2outer - parabola
2412 fHisPz3vP2IO->SetDirectory(0); //-> Curv P2outerinner - common parabola
2418 for (Int_t id=0; id<336;id++){
2419 TH2F *profy = (TH2F*)fDeltaYres.UncheckedAt(id);
2420 TH2F *profz = (TH2F*)fDeltaZres.UncheckedAt(id);
2421 TH2F *profy2 = (TH2F*)fDeltaYres2.UncheckedAt(id);
2422 TH2F *profz2 = (TH2F*)fDeltaZres2.UncheckedAt(id);
2423 // TH2F *profy3 = (TH2F*)fDeltaYres3.UncheckedAt(id);
2424 //TH2F *profz3 = (TH2F*)fDeltaZres3.UncheckedAt(id);
2426 profy=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d -Linear",id),160,0,160,50,-0.5,0.5);
2427 profy->SetDirectory(0);
2428 fDeltaYres.AddAt(profy,id);
2429 profy2=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d -Parabolic",id),160,0,160,50,-0.5,0.5);
2430 profy2->SetDirectory(0);
2431 fDeltaYres2.AddAt(profy2,id);
2432 //profy3=new TH2F(Form("pry%03d",id),Form("Y Residuals for Laser Beam %03d- Parabolic2",id),160,0,160,100,-0.5,0.5);
2433 //profy3->SetDirectory(0);
2434 //fDeltaYres3.AddAt(profy3,id);
2437 profz=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d Linear",id),160,0,160,50,-0.5,0.5);
2438 profz->SetDirectory(0);
2439 fDeltaZres.AddAt(profz,id);
2440 profz2=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d - Parabolic",id),160,0,160,50,-0.5,0.5);
2441 profz2->SetDirectory(0);
2442 fDeltaZres2.AddAt(profz2,id);
2443 //profz3=new TH2F(Form("prz%03d",id),Form("Z Residuals for Laser Beam %03d- Parabolic2",id),160,0,160,100,-0.5,0.5);
2444 //profz3->SetDirectory(0);
2445 //fDeltaZres3.AddAt(profz3,id);
2450 for (Int_t id=0; id<336;id++){
2451 TH1F * hisdz = (TH1F*)fDeltaZ.At(id);
2452 TH1F * hisP3 = (TH1F*)fDeltaP3.At(id);
2453 TH1F * hisP4 = (TH1F*)fDeltaP4.At(id);
2455 TH1F * hisdphi = (TH1F*)fDeltaPhi.At(id);
2456 TH1F * hisdphiP = (TH1F*)fDeltaPhiP.At(id);
2457 TH1F * hisSignal = (TH1F*)fSignals.At(id);
2460 hisdz = new TH1F(Form("hisdz%d",id),Form("hisdz%d",id),1000,-10,10);
2461 hisdz->SetDirectory(0);
2462 fDeltaZ.AddAt(hisdz,id);
2464 hisP3 = new TH1F(Form("hisPar3v%d",id),Form("hisPar3v%d",id),400,-0.06,0.06);
2465 hisP3->SetDirectory(0);
2466 fDeltaP3.AddAt(hisP3,id);
2468 hisP4 = new TH1F(Form("hisPar4v%d",id),Form("hisPar4v%d",id),200,-0.06,0.06);
2469 hisP4->SetDirectory(0);
2470 fDeltaP4.AddAt(hisP4,id);
2473 hisdphi = new TH1F(Form("hisdphi%d",id),Form("hisdphi%d",id),1000,-1,1);
2474 hisdphi->SetDirectory(0);
2475 fDeltaPhi.AddAt(hisdphi,id);
2477 hisdphiP = new TH1F(Form("hisdphiP%d",id),Form("hisdphiP%d",id),1000,-0.01,0.01);
2478 hisdphiP->SetDirectory(0);
2479 fDeltaPhiP.AddAt(hisdphiP,id);
2480 hisSignal = new TH1F(Form("hisSignal%d",id),Form("hisSignal%d",id),100,0,300);
2481 hisSignal->SetDirectory(0);
2482 fSignals.AddAt(hisSignal,id);
2487 void AliTPCcalibLaser::MergeFitHistos(AliTPCcalibLaser * laser){
2489 // Merge content of histograms
2491 // Only first histogram is checked - all other should be the same
2492 if (!laser->fHisNclIn) return; // empty histograms
2493 if (!fHisNclIn) MakeFitHistos();
2496 fHisNclIn->Add(laser->fHisNclIn ); //->Number of clusters inner
2497 fHisNclOut->Add(laser->fHisNclOut ); //->Number of clusters outer
2498 fHisNclIO->Add(laser->fHisNclIO ); //->Number of cluster inner outer
2499 fHisLclIn->Add(laser->fHisLclIn ); //->Level arm inner
2500 fHisLclOut->Add(laser->fHisLclOut ); //->Level arm outer
2501 fHisLclIO->Add(laser->fHisLclIO ); //->Number of cluster inner outer
2502 fHisdEdx->Add(laser->fHisdEdx ); //->dedx
2503 fHisdZfit->Add(laser->fHisdZfit ); //->dedx
2506 fHisChi2YIn1->Add(laser->fHisChi2YIn1 ); //->chi2 y inner - line
2507 fHisChi2YOut1->Add(laser->fHisChi2YOut1 ); //->chi2 y inner - line
2508 fHisChi2YIn2->Add(laser->fHisChi2YIn2 ); //->chi2 y inner - parabola
2509 fHisChi2YOut2->Add(laser->fHisChi2YOut2 ); //->chi2 y inner - parabola
2510 fHisChi2YIO1->Add(laser->fHisChi2YIO1 ); //->chi2 y IO - common
2511 fHisChi2ZIn1->Add(laser->fHisChi2ZIn1 ); //->chi2 z inner - line
2512 fHisChi2ZOut1->Add(laser->fHisChi2ZOut1 ); //->chi2 z inner - line
2513 fHisChi2ZIn2->Add(laser->fHisChi2ZIn2 ); //->chi2 z inner - parabola
2514 fHisChi2ZOut2->Add(laser->fHisChi2ZOut2 ); //->chi2 z inner - parabola
2515 fHisChi2ZIO1->Add(laser->fHisChi2ZIO1 ); //->chi2 z IO - common
2518 fHisPy1vP0->Add(laser->fHisPy1vP0 ); //-> delta y P0outer-P0inner - line
2519 fHisPy2vP0->Add(laser->fHisPy2vP0 ); //-> delta y P0outer-P0inner - parabola
2520 fHisPy3vP0->Add(laser->fHisPy3vP0 ); //-> delta y P0outer-P0inner - common parabola
2521 fHisPy1vP1->Add(laser->fHisPy1vP1 ); //-> delta ky P1outer-P1inner - line
2522 fHisPy2vP1->Add(laser->fHisPy2vP1 ); //-> delta ky P1outer-P1inner - parabola
2523 fHisPy3vP1->Add(laser->fHisPy3vP1 ); //-> delta ky P1outer-P1inner - common parabola
2524 fHisPy2vP2In->Add(laser-> fHisPy2vP2In ); //-> Curv P2inner - parabola
2525 fHisPy2vP2Out->Add(laser->fHisPy2vP2Out ); //-> Curv P2outer - parabola
2526 fHisPy3vP2IO->Add(laser->fHisPy3vP2IO ); //-> Curv P2outerinner - common parabola
2529 fHisPz1vP0->Add(laser->fHisPz1vP0 ); //-> delta z P0outer-P0inner - line
2530 fHisPz2vP0->Add(laser->fHisPz2vP0 ); //-> delta z P0outer-P0inner - parabola
2531 fHisPz3vP0->Add(laser->fHisPz3vP0 ); //-> delta z P0outer-P0inner - common parabola
2532 fHisPz1vP1->Add(laser->fHisPz1vP1 ); //-> delta kz P1outer-P1inner - line
2533 fHisPz2vP1->Add(laser->fHisPz2vP1 ); //-> delta kz P1outer-P1inner - parabola
2534 fHisPz3vP1->Add(laser->fHisPz3vP1 ); //-> delta kz P1outer-P1inner - common parabola
2535 fHisPz2vP2In->Add(laser->fHisPz2vP2In ); //-> Curv P2inner - parabola
2536 fHisPz2vP2Out->Add(laser->fHisPz2vP2Out ); //-> Curv P2outer - parabola
2537 fHisPz3vP2IO->Add(laser->fHisPz3vP2IO ); //-> Curv P2outerinner - common parabola
2550 void AliTPCcalibLaser::DumpFitInfo(TTree * chainFit,Int_t id){
2552 // Dump fit information - collect information from the streamers
2555 TChain * chainFit=0;
2556 TChain * chainTrack=0;
2559 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
2560 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+");
2561 AliXRDPROOFtoolkit tool;
2562 chainTrack = tool.MakeChain("laser.txt","Track",0,10200);
2563 chainTrack->Lookup();
2564 chainTrack->SetProof(kTRUE);
2565 chainDrift = tool.MakeChain("laser.txt","driftv",0,10200);
2566 chainDrift->Lookup();
2567 chainDrift->SetProof(kTRUE);
2569 chain = tool.MakeChain("laser.txt","Residuals",0,10200);
2571 chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
2573 chainFit->SetProof(kTRUE);
2574 chain->SetProof(kTRUE);
2575 AliTPCLaserTrack::LoadTracks();
2576 //AliTPCcalibLaser::DumpFitInfo(chainFit,0);
2582 TCut cutP3("abs(Tr.fP[3])<0.1");
2583 TCut cutP4("abs(Tr.fP[4])<0.5");
2584 TCut cutPx = cutP3+cutP4;
2585 TCut cutChi2YOut("sqrt(chi2y2Out*dEdx)<5&&chi2y2Out>0");
2586 TCut cutChi2ZOut("sqrt(chi2z2Out*dEdx)<5&&chi2z2Out>0");
2587 TCut cutChi2YIn("sqrt(chi2y2In*dEdx)<5&&chi2y2In>0");
2588 TCut cutChi2ZIn("sqrt(chi2z2In*dEdx)<5&&chi2z2In>0");
2590 TCut cutdEdx("sqrt(dEdx)>3");
2591 TCut cutDY("abs(yPol2In.fElements[2]*nclI*nclI/4.)<3");
2592 TCut cutN("nclO>20&&nclI>20");
2593 TCut cutA = cutChi2YOut+cutChi2ZOut+cutChi2YIn+cutChi2ZIn+cutN+cutdEdx+cutPx+"accept";
2597 TCut cutClY("abs(Cl[].fY-TrYpol2.fElements)<0.15");
2598 TCut cutClZ("abs(Cl[].fZ-TrZpol2.fElements)<0.15");
2599 TCut cutClX("abs(Cl[].fX)>10");
2600 TCut cutE("abs(Cl[].fY/Cl[].fX)<0.14");
2601 TCut cutSY("sqrt(Cl[].fSigmaY2)>0.05");
2602 TCut cutSZ("sqrt(Cl[].fSigmaZ2)>0.05");
2603 TCut cutQ("sqrt(Cl[].fMax)>4");
2604 TCut cutCl=cutClY+cutClZ+cutClX+cutE+cutSY+cutSZ+cutQ;
2608 TH1F * phisAccept = 0;
2610 TProfile * pdEdx = 0;
2618 TProfile * pNclI = 0;
2619 TProfile * pNclO = 0;
2621 TProfile * pchi2YIn =0;
2622 TProfile * pchi2ZIn =0;
2623 TProfile * pchi2YOut =0;
2624 TProfile * pchi2ZOut =0;
2625 TProfile * pchi2YInOut =0;
2626 TProfile * pchi2ZInOut =0;;
2628 chainFit->Draw("LTr.fId>>hisAl(350,0,350)","LTr.fId<350");
2629 phisAl = (TH1F*)gROOT->FindObject("hisAl");
2630 chainFit->Draw("LTr.fId>>hisAccept(350,0,350)","LTr.fId<350"+cutA);
2631 phisAccept = (TH1F*)gROOT->FindObject("hisAccept");
2632 chainFit->Draw("LTr.fId>>hisOut(350,0,350)","LTr.fId<350"+!cutA);
2633 phisOut = (TH1F*)gROOT->FindObject("hisOut");
2635 chainFit->Draw("sqrt(dEdx):LTr.fId>>hdEdx(350,0,350)","","prof");
2636 pdEdx = (TProfile*)gROOT->FindObject("hdEdx");
2639 chainFit->Draw("Tr.fP[0]:LTr.fId>>hP0(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2640 pP0 = (TProfile*)gROOT->FindObject("hP0");
2641 chainFit->Draw("Tr.fP[1]:LTr.fId>>hP1(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2642 pP1 = (TProfile*)gROOT->FindObject("hP1");
2643 chainFit->Draw("Tr.fP[2]:LTr.fId>>hP2(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2644 pP2 = (TProfile*)gROOT->FindObject("hP2");
2645 chainFit->Draw("Tr.fP[3]:LTr.fId>>hP3(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2646 pP3 = (TProfile*)gROOT->FindObject("hP3");
2647 chainFit->Draw("Tr.fP[4]:LTr.fId>>hP4(350,0,350)","Tr.fP[4]/sqrt(Tr.fC[14])<20"+cutA,"prof");
2648 pP4 = (TProfile*)gROOT->FindObject("hP4");
2650 chainFit->Draw("nclI:LTr.fId>>hNclI(350,0,350)","","prof");
2651 pNclI = (TProfile*)gROOT->FindObject("hNclI");
2652 chainFit->Draw("nclO:LTr.fId>>hNclO(350,0,350)","","prof");
2653 pNclO = (TProfile*)gROOT->FindObject("hNclO");
2656 chainFit->Draw("sqrt(chi2y2In):LTr.fId>>hChi2YIn(350,0,350)",cutA+"","prof");
2657 pchi2YIn = (TProfile*)gROOT->FindObject("hChi2YIn");
2658 chainFit->Draw("sqrt(chi2y2Out):LTr.fId>>hChi2YOut(350,0,350)",cutA+"","prof");
2659 pchi2YOut = (TProfile*)gROOT->FindObject("hChi2YOut");
2660 chainFit->Draw("sqrt(chi2yInOut):LTr.fId>>hChi2YInOut(350,0,350)",cutA+"","prof");
2661 pchi2YInOut = (TProfile*)gROOT->FindObject("hChi2YInOut");
2662 chainFit->Draw("sqrt(chi2z2In):LTr.fId>>hChi2ZIn(350,0,350)",cutA+"","prof");
2663 pchi2ZIn = (TProfile*)gROOT->FindObject("hChi2ZIn");
2664 chainFit->Draw("sqrt(chi2z2Out):LTr.fId>>hChi2ZOut(350,0,350)",cutA+"","prof");
2665 pchi2ZOut = (TProfile*)gROOT->FindObject("hChi2ZOut");
2666 chainFit->Draw("sqrt(chi2zInOut):LTr.fId>>hChi2ZInOut(350,0,350)",cutA+"","prof");
2667 pchi2ZInOut = (TProfile*)gROOT->FindObject("hChi2ZInOut");
2669 // second derivatives
2671 TH2F * phisPy2In = new TH2F("Py2Inner","Py2Inner",350,0,350,100,-0.001,0.001);
2672 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>Py2Inner",cutA,"");
2673 TH2F * phisPy2Out = new TH2F("Py2Outer","Py2Outer",350,0,350,200,-0.0005,0.0005);
2674 chainFit->Draw("yPol2Out.fElements[2]:LTr.fId>>Py2Outer",cutA,"");
2675 TH2F * phisPy2InOut = new TH2F("Py2InOut","Py2InOut",350,0,350,200,-0.0005,0.0005);
2676 chainFit->Draw("yInOut.fElements[4]:LTr.fId>>Py2InOut",cutA,"");
2678 phisPy2In->FitSlicesY();
2679 TH1D * phisPy2InEntries = (TH1D*)gROOT->FindObject("Py2Inner_0");
2680 TH1D * phisPy2InMean = (TH1D*)gROOT->FindObject("Py2Inner_1");
2681 TH1D * phisPy2InSigma = (TH1D*)gROOT->FindObject("Py2Inner_2");
2683 phisPy2Out->FitSlicesY();
2684 TH1D * phisPy2OutEntries = (TH1D*)gROOT->FindObject("Py2Outer_0");
2685 TH1D * phisPy2OutMean = (TH1D*)gROOT->FindObject("Py2Outer_1");
2686 TH1D * phisPy2OutSigma = (TH1D*)gROOT->FindObject("Py2Outer_2");
2688 phisPy2InOut->FitSlicesY();
2689 TH1D * phisPy2InOutEntries = (TH1D*)gROOT->FindObject("Py2InOut_0");
2690 TH1D * phisPy2InOutMean = (TH1D*)gROOT->FindObject("Py2InOut_1");
2691 TH1D * phisPy2InOutSigma = (TH1D*)gROOT->FindObject("Py2InOut_2");
2693 TH2F * phisPz2In = new TH2F("Pz2Inner","Pz2Inner",350,0,350,100,-0.001,0.001);
2694 chainFit->Draw("zPol2In.fElements[2]:LTr.fId>>Pz2Inner",cutA,"");
2695 TH2F * phisPz2Out = new TH2F("Pz2Outer","Pz2Outer",350,0,350,200,-0.0005,0.0005);
2696 chainFit->Draw("zPol2Out.fElements[2]:LTr.fId>>Pz2Outer",cutA,"");
2697 TH2F * phisPz2InOut = new TH2F("Pz2InOut","Pz2InOut",350,0,350,200,-0.0005,0.0005);
2698 chainFit->Draw("zInOut.fElements[4]:LTr.fId>>Pz2InOut",cutA,"");
2700 phisPz2In->FitSlicesY();
2701 TH1D * phisPz2InEntries = (TH1D*)gROOT->FindObject("Pz2Inner_0");
2702 TH1D * phisPz2InMean = (TH1D*)gROOT->FindObject("Pz2Inner_1");
2703 TH1D * phisPz2InSigma = (TH1D*)gROOT->FindObject("Pz2Inner_2");
2705 phisPz2Out->FitSlicesY();
2706 TH1D * phisPz2OutEntries = (TH1D*)gROOT->FindObject("Pz2Outer_0");
2707 TH1D * phisPz2OutMean = (TH1D*)gROOT->FindObject("Pz2Outer_1");
2708 TH1D * phisPz2OutSigma = (TH1D*)gROOT->FindObject("Pz2Outer_2");
2710 phisPz2InOut->FitSlicesY();
2711 TH1D * phisPz2InOutEntries = (TH1D*)gROOT->FindObject("Pz2InOut_0");
2712 TH1D * phisPz2InOutMean = (TH1D*)gROOT->FindObject("Pz2InOut_1");
2713 TH1D * phisPz2InOutSigma = (TH1D*)gROOT->FindObject("Pz2InOut_2");
2720 TTreeSRedirector *pcstream = new TTreeSRedirector("vscan.root");
2721 for (Int_t ilaser=0; ilaser<336; ilaser++){
2722 Float_t all=phisAl->GetBinContent(ilaser+1);
2723 Float_t accept=phisAccept->GetBinContent(ilaser+1);
2724 Float_t out=phisOut->GetBinContent(ilaser+1);
2725 Float_t sdedx = pdEdx->GetBinContent(ilaser+1);
2726 Float_t mP0 = pP0->GetBinContent(ilaser+1);
2727 Float_t mP1 = pP1->GetBinContent(ilaser+1);
2728 Float_t mP2 = pP2->GetBinContent(ilaser+1);
2729 Float_t mP3 = pP3->GetBinContent(ilaser+1);
2730 Float_t mP4 = pP4->GetBinContent(ilaser+1);
2733 Float_t nclI = pNclI->GetBinContent(ilaser+1);
2734 Float_t nclO = pNclO->GetBinContent(ilaser+1);
2736 Float_t chi2YIn=pchi2YIn->GetBinContent(ilaser+1);
2737 Float_t chi2YOut=pchi2YOut->GetBinContent(ilaser+1);
2738 Float_t chi2YInOut=pchi2YInOut->GetBinContent(ilaser+1);
2739 Float_t chi2ZIn=pchi2ZIn->GetBinContent(ilaser+1);
2740 Float_t chi2ZOut=pchi2ZOut->GetBinContent(ilaser+1);
2741 Float_t chi2ZInOut=pchi2ZInOut->GetBinContent(ilaser+1);
2743 Float_t entriesPy2In = phisPy2InEntries->GetBinContent(ilaser+1);
2744 Float_t meanPy2In = phisPy2InMean->GetBinContent(ilaser+1);
2745 Float_t sigmaPy2In = phisPy2InSigma->GetBinContent(ilaser+1);
2747 Float_t entriesPy2Out = phisPy2OutEntries->GetBinContent(ilaser+1);
2748 Float_t meanPy2Out = phisPy2OutMean->GetBinContent(ilaser+1);
2749 Float_t sigmaPy2Out = phisPy2OutSigma->GetBinContent(ilaser+1);
2751 Float_t entriesPy2InOut = phisPy2InOutEntries->GetBinContent(ilaser+1);
2752 Float_t meanPy2InOut = phisPy2InOutMean->GetBinContent(ilaser+1);
2753 Float_t sigmaPy2InOut = phisPy2InOutSigma->GetBinContent(ilaser+1);
2755 Float_t entriesPz2In = phisPz2InEntries->GetBinContent(ilaser+1);
2756 Float_t meanPz2In = phisPz2InMean->GetBinContent(ilaser+1);
2757 Float_t sigmaPz2In = phisPz2InSigma->GetBinContent(ilaser+1);
2759 Float_t entriesPz2Out = phisPz2OutEntries->GetBinContent(ilaser+1);
2760 Float_t meanPz2Out = phisPz2OutMean->GetBinContent(ilaser+1);
2761 Float_t sigmaPz2Out = phisPz2OutSigma->GetBinContent(ilaser+1);
2763 Float_t entriesPz2InOut = phisPz2InOutEntries->GetBinContent(ilaser+1);
2764 Float_t meanPz2InOut = phisPz2InOutMean->GetBinContent(ilaser+1);
2765 Float_t sigmaPz2InOut = phisPz2InOutSigma->GetBinContent(ilaser+1);
2767 AliTPCLaserTrack* ltrp =(AliTPCLaserTrack*)AliTPCLaserTrack::GetTracks()->UncheckedAt(ilaser);
2768 (*pcstream)<<"Scan"<<
2782 "chi2YIn="<<chi2YIn<<
2783 "chi2YOut="<<chi2YOut<<
2784 "chi2YInOut="<<chi2YInOut<<
2785 "chi2ZIn="<<chi2ZIn<<
2786 "chi2ZOut="<<chi2ZOut<<
2787 "chi2ZInOut="<<chi2ZInOut<<
2789 "nPy2In="<<entriesPy2In<<
2790 "mPy2In="<<meanPy2In<<
2791 "sPy2In="<<sigmaPy2In<<
2793 "nPy2Out="<<entriesPy2Out<<
2794 "mPy2Out="<<meanPy2Out<<
2795 "sPy2Out="<<sigmaPy2Out<<
2797 "nPy2InOut="<<entriesPy2InOut<<
2798 "mPy2InOut="<<meanPy2InOut<<
2799 "sPy2InOut="<<sigmaPy2InOut<<
2801 "nPz2In="<<entriesPz2In<<
2802 "mPz2In="<<meanPz2In<<
2803 "sPz2In="<<sigmaPz2In<<
2805 "nPz2Out="<<entriesPz2Out<<
2806 "mPz2Out="<<meanPz2Out<<
2807 "sPz2Out="<<sigmaPz2Out<<
2809 "nPz2InOut="<<entriesPz2InOut<<
2810 "mPz2InOut="<<meanPz2InOut<<
2811 "sPz2InOut="<<sigmaPz2InOut<<
2818 TFile f("vscan.root");
2823 chain->Draw("Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","",10000);
2825 chain->Draw("Cl[].fY-TrYpol1.fElements:Cl[].fPad-int(Cl[].fPad)",cutA+cutCl+"Cl[].fZ>0&&Cl[].fPad>1","prof",10000);
2828 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);
2831 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)
2840 // check edge effects
2841 chain->Draw("Cl.fY-TrYpol1.fElements:Cl.fY/Cl.fX",""+cutA+cutCl,"prof",10000)
2843 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fZ>0"+cutA+cutCl+cutE,"prof",100000)
2845 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)
2849 chainFit->Draw("yInOut.fElements[4]:LTr.fP[2]","LTr.fP[1]<0"+cutA,"prof",1000);
2850 chainFit->Draw("yPol2In.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutD,"prof")
2861 dedge = sign(Cl.fY)*(Cl.fX*tan(pi/18)-abs(Cl.fY))
2864 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)
2866 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)
2872 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)
2874 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)
2878 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)
2880 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)
2889 chainFit->Draw("yPol2Out.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutDY,"prof")
2891 chainFit->Draw("yPol2In.fElements[2]*64*64/4.:LTr.fP[2]","nclI>20&<r.fP[1]<0"+cutA+cutDY,"prof")
2895 chainFit->Draw("LTr.fId","nclI>10",100000)
2897 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>his(350,0,350,100,-0.002,0.002)","nclI>20","")
2899 chainFit->Draw("yPol2In.fElements[2]:LTr.fId>>hisPy2In0(350,0,350,100,-0.002,0.002)","nclI>20","");
2901 TH2 * phisPy2In = (TH2*) gROOT->FindObject("hisPy2In0")
2913 gSystem->Load("libSTAT.so")
2914 TStatToolkit toolkit;
2920 TCut cutA("entries>2&&pphi2<3&&abs(gphiP1-pphiP0)<0.003&&abs(gz1)<6");
2925 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz++"; //1
2926 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*LTr.fP[2]++"; //2
2927 fstring+="(abs(LTr.fP[1]/250)^1-1)*bz++"; //3
2928 fstring+="(abs(LTr.fP[1]/250)-1)*bz*LTr.fP[2]++"; //4
2930 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*sin(atan2(lx1,lx0))++" //5
2931 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*sin(atan2(lx1,lx0))*LTr.fP[2]++" //6
2932 fstring+="(abs(LTr.fP[1]/250)-1)*bz*sin(atan2(lx1,lx0))++" //7
2933 fstring+="(abs(LTr.fP[1]/250)-1)*bz*sin(atan2(lx1,lx0))*LTr.fP[2]++" //8
2935 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*cos(atan2(lx1,lx0))++" //9
2936 fstring+="(abs(LTr.fP[1]/250)^3-1)*bz*cos(atan2(lx1,lx0))*LTr.fP[2]++" //10
2937 fstring+="(abs(LTr.fP[1]/250)-1)*bz*cos(atan2(lx1,lx0))++" //11
2938 fstring+="(abs(LTr.fP[1]/250)-1)*bz*cos(atan2(lx1,lx0))*LTr.fP[2]++" //12
2943 TString *strq0 = toolkit.FitPlane(treeT,"gphi1-pphi0",fstring->Data(), "fSide==1"+cutA, chi2,npoints,fitParam,covMatrix);
2945 treeT->SetAlias("fit",strq0->Data());
2948 TString *strqP = toolkit.FitPlane(treeT,"1000*(gphiP1-pphiP0)",fstring->Data(), "fSide==1"+cutA, chi2,npoints,fitParam,covMatrix);
2950 treeT->SetAlias("fitP",strqP->Data());
2953 TString *strqDrift = toolkit.FitPlane(treeT,"gz1","LTr.fP[1]++(1-2*(fSide==1))++lx1", cutA, chi2,npoints,fitParam,covMatrix);
2954 treeT->SetAlias("fitD",strqDrift->Data());
2957 treeT->Draw("fit:LTr.fP[1]","abs(bz+0.4)<0.05"+cutA,"");
2959 for (Int_t i=0; i<6;i++){
2960 treeT->SetLineColor(i+2);
2961 treeT->SetMarkerSize(1);
2962 treeT->SetMarkerStyle(22+i);
2963 treeT->SetMarkerColor(i+2);
2965 treeT->Draw("fit:LTr.fP[1]",Form("abs(bz+0.4)<0.05&fRod==%d",i)+cutA,"same");
2973 TTree * tree = (TTree*)f.Get("FitModels");
2975 TEventList listLFit0("listLFit0","listLFit0");
2976 TEventList listLFit1("listLFit1","listLFit1");
2977 tree->Draw(">>listLFit0","seed.fdEdx<200&&seed.fdEdx>40");
2978 tree->SetEventList(&listLFit0);
2983 gSystem->Load("libSTAT.so")
2984 TStatToolkit toolkit;
2990 chain->SetAlias("dp","((Cl.fPad-int(Cl.fPad))*pi)");
2991 chain->SetAlias("dt","((Cl.fTimeBin-int(Cl.fTimeBin))*pi)");
2995 fstring+="cos(dp)++";
2996 fstring+="sin(dp)++";
2997 fstring+="cos(dt)++";
2998 fstring+="sin(dt)++";
3000 TString *str = toolkit.FitPlane(chain,"Cl.fZ-TrZInOut.fElements",fstring->Data(), "Cl.fDetector>35", chi2,npoints,fitParam,covMatrix,-1,0,200);
3013 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
3014 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
3015 AliXRDPROOFtoolkit tool;
3016 TChain * chainTrack = tool.MakeChain("laser.txt","Track",0,10200);
3017 chainTrack->Lookup();
3018 chainTrack->SetProof(kTRUE);
3020 TChain * chain = tool.MakeChain("laser.txt","Residuals",0,10200);
3022 TChain * chainFit = tool.MakeChain("laser.txt","FitModels",0,10200);
3024 chainFit->SetProof(kTRUE);
3025 chain->SetProof(kTRUE);
3029 TCut cutChi2YOut("sqrt(chi2y2Out*dEdx)<10");
3030 TCut cutChi2ZOut("sqrt(chi2z2Out*dEdx)<10");
3031 TCut cutChi2YIn("sqrt(chi2y2In*dEdx)<10");
3032 TCut cutChi2ZIn("sqrt(chi2z2In*dEdx)<10");
3034 TCut cutdEdx("sqrt(dEdx)<30&&sqrt(dEdx)>3");
3035 TCut cutDY("abs(yPol2In.fElements[2]*nclO*nclO/4.)<3")
3036 TCut cutN("nclO>20&&nclI>20");
3037 TCut cutA = cutChi2YOut+cutChi2ZOut+cutChi2YIn+cutChi2ZIn+cutN+cutdEdx;
3041 TCut cutClY("abs(Cl.fY-TrYpol2.fElements)<0.2");
3042 TCut cutClZ("abs(Cl.fZ-TrZpol2.fElements)<0.4");
3043 TCut cutClX("abs(Cl.fX)>10");
3044 TCut cutE("abs(Cl.fY/Cl.fX)<0.14");
3045 TCut cutCl=cutClY+cutClZ+cutClX;
3048 // check edge effects
3049 chain->Draw("Cl.fY-TrYpol1.fElements:Cl.fY/Cl.fX",""+cutA+cutCl,"prof",10000)
3051 chain->Draw("Cl.fY-TrYpol2.fElements:Cl.fPad-int(Cl.fPad)","Cl.fZ>0"+cutA+cutCl+cutE,"prof",100000)
3053 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)
3057 chainFit->Draw("yInOut.fElements[4]:LTr.fP[2]","LTr.fP[1]<0"+cutA,"prof",1000);
3058 chainFit->Draw("yPol2In.fElements[2]*90*90/4.:LTr.fP[2]","nclO>40&<r.fP[1]<0"+cutA+cutD,"prof")