]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDcheckTRK.cxx
using AliCDBConnect task in test train of TRD
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDcheckTRK.cxx
CommitLineData
3ceb45ae 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercialf purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16
17////////////////////////////////////////////////////////////////////////////
18// //
19// TRD tracker systematic //
20//
21//
22// Authors: //
23// Alexandru Bercuci <A.Bercuci@gsi.de> //
24// //
25////////////////////////////////////////////////////////////////////////////
26
27#include "TROOT.h"
28#include "TAxis.h"
29#include "TH1.h"
30#include "TH2.h"
31#include "TH3.h"
32#include "TObjArray.h"
33#include "THnSparse.h"
34#include <TVectorT.h>
35
36#include "AliLog.h"
37
38#include "AliTRDcluster.h"
39#include "AliTRDseedV1.h"
40#include "AliTRDtrackV1.h"
41#include "AliTRDtrackerV1.h"
42#include "AliTRDtransform.h"
43
44#include "AliTRDcheckTRK.h"
45
46ClassImp(AliTRDcheckTRK)
47
48Bool_t AliTRDcheckTRK::fgKalmanUpdate = kTRUE;
49Bool_t AliTRDcheckTRK::fgClRecalibrate = kFALSE;
50Float_t AliTRDcheckTRK::fgKalmanStep = 2.;
3ed01fbe 51Float_t AliTRDcheckTRK::fgCalib[540][2];
3ceb45ae 52//__________________________________________________________________________
53AliTRDcheckTRK::AliTRDcheckTRK()
3ed01fbe 54 : AliTRDresolution()
3ceb45ae 55{
56// Default constructor
57 SetNameTitle("TRDtrackerSys", "TRD Tracker Systematic");
3ed01fbe 58 memset(AliTRDcheckTRK::fgCalib, 0, 540*2*sizeof(Float_t));
3ceb45ae 59}
60
61//__________________________________________________________________________
62AliTRDcheckTRK::AliTRDcheckTRK(char* name)
3ed01fbe 63 : AliTRDresolution(name, kFALSE)
3ceb45ae 64{
65// User constructor
3ed01fbe 66 SetTitle("TRD Tracker Systematic");
67 memset(AliTRDcheckTRK::fgCalib, 0, 540*2*sizeof(Float_t));
3ceb45ae 68 InitFunctorList();
3ceb45ae 69}
70
71//__________________________________________________________________________
72AliTRDcheckTRK::~AliTRDcheckTRK()
73{
74// Destructor
75}
76
3ceb45ae 77//__________________________________________________________________________
78Int_t AliTRDcheckTRK::GetSpeciesByMass(Float_t m)
79{
80// Find particle index by mass
81// 0 electron
82// 1 muon
83// 2 pion
84// 3 kaon
85// 4 proton
86
87 for(Int_t is(0); is<AliPID::kSPECIES; is++) if(TMath::Abs(m-AliPID::ParticleMass(is))<1.e-4) return is;
88 return -1;
89}
90
91
3ceb45ae 92
93//__________________________________________________________________________
3ed01fbe 94TH1* AliTRDcheckTRK::PlotTrack(const AliTRDtrackV1 *track)
3ceb45ae 95{
96// comment needed
97
98 if(track) fkTrack = track;
99 if(!fkTrack){
100 AliDebug(4, "No Track defined.");
101 return NULL;
102 }
3ed01fbe 103 // make a local copy of current track
104 AliTRDtrackV1 lt(*fkTrack);
105 if(!PropagateKalman(lt)) return NULL;
106 PlotCluster(&lt);
107 PlotTracklet(&lt);
108 PlotTrackIn(&lt);
3ceb45ae 109 return NULL;
110}
111
112
113//___________________________________________________
3ed01fbe 114Bool_t AliTRDcheckTRK::PropagateKalman(AliTRDtrackV1 &t)
3ceb45ae 115{
3ed01fbe 116// Propagate Back Kalman from the TPC input parameter to the last tracklet attached to track.
117// On the propagation recalibration of clusters, tracklet refit and material budget are recalculated (on demand)
118// On output the track is updated with the new info
3ceb45ae 119//
3ed01fbe 120// A.Bercuci@gsi.de
3ceb45ae 121
3ed01fbe 122// printf("PropagateKalman()\n");
123 Int_t ntracklets(t.GetNumberOfTracklets());
124 if(!ntracklets){
125 printf("E - AliTRDcheckTRK::PropagateKalman :: No tracklets attached to track.\n");
126 return kFALSE;
127 }
3ceb45ae 128
129 AliTRDseedV1 *tr(NULL);
3ed01fbe 130 AliExternalTrackParam *ref(NULL);
131 if(!(ref = t.GetTrackIn())){
132 printf("E - AliTRDcheckTRK::PropagateKalman :: Track did not entered TRD fiducial volume.\n");
943761d3 133 return kFALSE;
3ceb45ae 134 }
3ed01fbe 135 if(ref->Pt()<1.e-3){printf("small refpt\n"); return kFALSE;}
136
3ceb45ae 137
138 // Initialize TRD track to the reference
139 AliTRDtrackV1 tt;
140 tt.Set(ref->GetX(), ref->GetAlpha(), ref->GetParameter(), ref->GetCovariance());
3ed01fbe 141 tt.SetMass(t.GetMass());
142 tt.SetTrackIn();tt.SetTrackOut(t.GetTrackOut());
3ceb45ae 143
3ceb45ae 144 for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
3ed01fbe 145 if(!(tr = t.GetTracklet(ily))) continue;
146 Int_t det(tr->GetDetector());
147 Float_t *calib = GetCalib(det);
148 if(fgClRecalibrate && calib[0]>0.){
149 AliTRDtransform trans(det);
3ceb45ae 150 AliTRDcluster *c(NULL);
3ed01fbe 151 Float_t exb, vd, t0, s2, dl, dt; tr->GetCalibParam(exb, vd, t0, s2, dl, dt);
3ceb45ae 152 tr->ResetClusterIter(kFALSE);
3ed01fbe 153 while((c = tr->PrevCluster())){
154 if(!trans.Transform(c/*, GetCalib(det)*/)){
155 printf("W - AliTRDcheckTRK::PropagateKalman :: Transform() failed for Det[%03d]\n", det);
156 break;
157 }
158 }
159 if(!tr->FitRobust()) printf("W - AliTRDcheckTRK::PropagateKalman :: FitRobust() failed for Det[%03d]\n", det);
3ceb45ae 160 }
161 if(!AliTRDtrackerV1::PropagateToX(tt, tr->GetX0(), fgKalmanStep)) continue;
3ed01fbe 162 tr->Update(&tt);
3ceb45ae 163 if(fgKalmanUpdate){
164 Double_t x(tr->GetX0()),
165 p[2] = { tr->GetYfit(0), tr->GetZfit(0)},
166 covTrklt[3];
167 tr->GetCovAt(x, covTrklt);
168 if(!((AliExternalTrackParam&)tt).Update(p, covTrklt)) continue;
3ed01fbe 169 //tr->Update(&tt);
170 tt.SetTracklet(tr, 0);
171 tt.SetNumberOfClusters();
172 tt.UpdateChi2(((AliExternalTrackParam)tt).GetPredictedChi2(p, covTrklt));
3ceb45ae 173 }
3ceb45ae 174 }
3ed01fbe 175 //tt.Print("a");
176 t.~AliTRDtrackV1();
177 new(&t) AliTRDtrackV1(tt);
3ceb45ae 178 return kTRUE;
179}
180
181