]>
Commit | Line | Data |
---|---|---|
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" | |
3ceb45ae | 34 | |
35 | #include "AliLog.h" | |
36 | ||
37 | #include "AliTRDcluster.h" | |
38 | #include "AliTRDseedV1.h" | |
566c3d46 | 39 | #include "AliTRDtrackletOflHelper.h" |
3ceb45ae | 40 | #include "AliTRDtrackV1.h" |
41 | #include "AliTRDtrackerV1.h" | |
42 | #include "AliTRDtransform.h" | |
43 | ||
44 | #include "AliTRDcheckTRK.h" | |
45 | ||
46 | ClassImp(AliTRDcheckTRK) | |
47 | ||
48 | Bool_t AliTRDcheckTRK::fgKalmanUpdate = kTRUE; | |
49 | Bool_t AliTRDcheckTRK::fgClRecalibrate = kFALSE; | |
50 | Float_t AliTRDcheckTRK::fgKalmanStep = 2.; | |
51 | //__________________________________________________________________________ | |
52 | AliTRDcheckTRK::AliTRDcheckTRK() | |
3ed01fbe | 53 | : AliTRDresolution() |
3ceb45ae | 54 | { |
55 | // Default constructor | |
56 | SetNameTitle("TRDtrackerSys", "TRD Tracker Systematic"); | |
3ceb45ae | 57 | } |
58 | ||
59 | //__________________________________________________________________________ | |
60 | AliTRDcheckTRK::AliTRDcheckTRK(char* name) | |
3ed01fbe | 61 | : AliTRDresolution(name, kFALSE) |
3ceb45ae | 62 | { |
63 | // User constructor | |
3ed01fbe | 64 | SetTitle("TRD Tracker Systematic"); |
566c3d46 | 65 | MakePtCalib(); |
3ceb45ae | 66 | InitFunctorList(); |
3ceb45ae | 67 | } |
68 | ||
69 | //__________________________________________________________________________ | |
70 | AliTRDcheckTRK::~AliTRDcheckTRK() | |
71 | { | |
72 | // Destructor | |
73 | } | |
74 | ||
566c3d46 | 75 | |
3ceb45ae | 76 | //__________________________________________________________________________ |
566c3d46 | 77 | TObjArray* AliTRDcheckTRK::Histos() |
3ceb45ae | 78 | { |
566c3d46 | 79 | // Build extra calibration plots |
80 | if(!(fContainer = AliTRDresolution::Histos())) return NULL; | |
81 | //fContainer->Expand(AliTRDresolution::kNclasses+1); | |
82 | ||
83 | THnSparse *H(NULL); | |
84 | if(!(H = (THnSparseI*)gROOT->FindObject("Roads"))){ | |
85 | const Char_t *title[kNdim] = {"layer", "charge", fgkTitle[kPt], fgkTitle[kYrez], fgkTitle[kPrez], "#sigma^{*}/<#sigma_{y}> [a.u.]", "n_{cl}"}; | |
86 | const Int_t nbins[kNdim] = {AliTRDgeometry::kNlayer, 2, kNptBins, fgkNbins[kYrez], fgkNbins[kPrez], kNSigmaBins, kNclusters}; | |
87 | const Double_t min[kNdim] = {-0.5, -0.5, -0.5, -1., -5., 0., 8.5}, | |
88 | max[kNdim] = {AliTRDgeometry::kNlayer-0.5, 1.5, kNptBins-0.5, 1., 5., 5., min[6]+kNclusters}; | |
89 | TString st("Tracking Roads Calib;"); | |
90 | // define minimum info to be saved in non debug mode | |
91 | for(Int_t idim(0); idim<kNdim; idim++){ st += title[idim]; st+=";";} | |
92 | H = new THnSparseI("Roads", st.Data(), kNdim, nbins, min, max); | |
93 | } else H->Reset(); | |
94 | fContainer->AddAt(H, fContainer->GetEntries()/*AliTRDresolution::kNclasses*/); | |
95 | return fContainer; | |
3ceb45ae | 96 | } |
97 | ||
3ceb45ae | 98 | //__________________________________________________________________________ |
3ed01fbe | 99 | TH1* AliTRDcheckTRK::PlotTrack(const AliTRDtrackV1 *track) |
3ceb45ae | 100 | { |
101 | // comment needed | |
102 | ||
103 | if(track) fkTrack = track; | |
104 | if(!fkTrack){ | |
105 | AliDebug(4, "No Track defined."); | |
106 | return NULL; | |
107 | } | |
3ed01fbe | 108 | // make a local copy of current track |
109 | AliTRDtrackV1 lt(*fkTrack); | |
35983729 | 110 | if(!PropagateKalman(lt, fkESD->GetTPCoutParam())) return NULL; |
3ed01fbe | 111 | PlotCluster(<); |
112 | PlotTracklet(<); | |
113 | PlotTrackIn(<); | |
566c3d46 | 114 | DoRoads(<); |
3ceb45ae | 115 | return NULL; |
116 | } | |
117 | ||
566c3d46 | 118 | //________________________________________________________ |
119 | void AliTRDcheckTRK::MakePtCalib(Float_t pt0, Float_t dpt) | |
120 | { | |
121 | // Build pt segments | |
122 | for(Int_t j(0); j<=kNptBins; j++){ | |
123 | pt0+=(TMath::Exp(j*j*dpt)-1.); | |
124 | fPtBinCalib[j]=pt0; | |
125 | } | |
126 | } | |
127 | ||
128 | //__________________________________________________________________________ | |
129 | Int_t AliTRDcheckTRK::GetPtBinCalib(Float_t pt) | |
130 | { | |
131 | // Find pt bin according to local pt segmentation | |
132 | Int_t ipt(-1); | |
133 | while(ipt<kNptBins){ | |
134 | if(pt<fPtBinCalib[ipt+1]) break; | |
135 | ipt++; | |
136 | } | |
137 | return ipt; | |
138 | } | |
139 | ||
140 | ||
141 | //__________________________________________________________________________ | |
142 | TH1* AliTRDcheckTRK::DoRoads(const AliTRDtrackV1 *track) | |
143 | { | |
144 | // comment needed | |
145 | if(track) fkTrack = track; | |
146 | if(!fkTrack){ | |
147 | AliDebug(4, "No Track defined."); | |
148 | return NULL; | |
149 | } | |
150 | if(TMath::Abs(fkESD->GetTOFbc())>1){ | |
151 | AliDebug(4, Form("Track with BC_index[%d] not used.", fkESD->GetTOFbc())); | |
152 | return NULL; | |
153 | } | |
154 | THnSparse *H(NULL); | |
155 | if(!fContainer || !(H = (THnSparse*)fContainer->At(3))){ | |
156 | AliWarning("No output container defined."); | |
157 | return NULL; | |
158 | } | |
159 | // return NULL; | |
160 | Double_t val[kNdim]; | |
161 | AliTRDseedV1 *fTracklet(NULL); | |
162 | AliTRDtrackletOflHelper helper; TObjArray cl(AliTRDseedV1::kNclusters); cl.SetOwner(kFALSE); | |
163 | for(Int_t il(0); il<AliTRDgeometry::kNlayer; il++){ | |
164 | if(!(fTracklet = fkTrack->GetTracklet(il))) continue; | |
165 | if(!fTracklet->IsOK() || !fTracklet->IsChmbGood()) continue; | |
166 | Int_t ipt(GetPtBinCalib(fTracklet->GetPt())); | |
167 | if(ipt<0) continue; | |
168 | val[0] = il; | |
169 | val[1] = fkTrack->Charge()<0?0:1; | |
170 | val[2] = ipt; | |
171 | Double_t dyt(fTracklet->GetYfit(0) - fTracklet->GetYref(0)), | |
172 | dzt(fTracklet->GetZfit(0) - fTracklet->GetZref(0)), | |
173 | dydx(fTracklet->GetYfit(1)), | |
174 | tilt(fTracklet->GetTilt()); | |
175 | // correct for tilt rotation | |
176 | val[3] = dyt - dzt*tilt; | |
177 | dydx+= tilt*fTracklet->GetZref(1); | |
178 | val[4] = TMath::ATan((dydx - fTracklet->GetYref(1))/(1.+ fTracklet->GetYref(1)*dydx)) * TMath::RadToDeg(); | |
179 | fTracklet->ResetClusterIter(kTRUE); AliTRDcluster *c(NULL); | |
180 | while((c = fTracklet->NextCluster())) cl.AddLast(c); | |
181 | helper.Init(AliTRDtransform::Geometry().GetPadPlane(fTracklet->GetDetector()), &cl); | |
182 | Double_t r, y, s; helper.GetRMS(r, y, s, fTracklet->GetX0()); | |
183 | val[5] = s/helper.GetSyMean(); | |
184 | val[6] = fTracklet->GetN(); | |
185 | H->Fill(val); | |
186 | } | |
187 | return NULL; | |
188 | } | |
3ceb45ae | 189 | |
190 | //___________________________________________________ | |
35983729 | 191 | Bool_t AliTRDcheckTRK::PropagateKalman(AliTRDtrackV1 &t, AliExternalTrackParam *ref) |
3ceb45ae | 192 | { |
3ed01fbe | 193 | // Propagate Back Kalman from the TPC input parameter to the last tracklet attached to track. |
194 | // On the propagation recalibration of clusters, tracklet refit and material budget are recalculated (on demand) | |
195 | // On output the track is updated with the new info | |
3ceb45ae | 196 | // |
3ed01fbe | 197 | // A.Bercuci@gsi.de |
3ceb45ae | 198 | |
3ed01fbe | 199 | // printf("PropagateKalman()\n"); |
200 | Int_t ntracklets(t.GetNumberOfTracklets()); | |
201 | if(!ntracklets){ | |
202 | printf("E - AliTRDcheckTRK::PropagateKalman :: No tracklets attached to track.\n"); | |
203 | return kFALSE; | |
204 | } | |
3ceb45ae | 205 | |
206 | AliTRDseedV1 *tr(NULL); | |
35983729 | 207 | AliExternalTrackParam *trdin(NULL); |
208 | if(!(trdin = t.GetTrackIn())){ | |
3ed01fbe | 209 | printf("E - AliTRDcheckTRK::PropagateKalman :: Track did not entered TRD fiducial volume.\n"); |
943761d3 | 210 | return kFALSE; |
3ceb45ae | 211 | } |
35983729 | 212 | if(!ref){ |
213 | printf("E - AliTRDcheckTRK::PropagateKalman :: Missing TPC out param.\n"); | |
214 | return kFALSE; | |
215 | } | |
216 | if(ref->Pt()<1.e-3) return kFALSE; | |
3ed01fbe | 217 | |
3ceb45ae | 218 | |
219 | // Initialize TRD track to the reference | |
220 | AliTRDtrackV1 tt; | |
221 | tt.Set(ref->GetX(), ref->GetAlpha(), ref->GetParameter(), ref->GetCovariance()); | |
3ed01fbe | 222 | tt.SetMass(t.GetMass()); |
35983729 | 223 | tt.SetTrackOut(t.GetTrackOut()); |
3ceb45ae | 224 | |
3ceb45ae | 225 | for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){ |
3ed01fbe | 226 | if(!(tr = t.GetTracklet(ily))) continue; |
227 | Int_t det(tr->GetDetector()); | |
35983729 | 228 | //Float_t *calib = GetCalib(det); |
229 | if(fgClRecalibrate/* && calib[0]>0.*/){ | |
3ed01fbe | 230 | AliTRDtransform trans(det); |
3ceb45ae | 231 | AliTRDcluster *c(NULL); |
3ed01fbe | 232 | Float_t exb, vd, t0, s2, dl, dt; tr->GetCalibParam(exb, vd, t0, s2, dl, dt); |
3ceb45ae | 233 | tr->ResetClusterIter(kFALSE); |
3ed01fbe | 234 | while((c = tr->PrevCluster())){ |
235 | if(!trans.Transform(c/*, GetCalib(det)*/)){ | |
236 | printf("W - AliTRDcheckTRK::PropagateKalman :: Transform() failed for Det[%03d]\n", det); | |
237 | break; | |
238 | } | |
239 | } | |
240 | if(!tr->FitRobust()) printf("W - AliTRDcheckTRK::PropagateKalman :: FitRobust() failed for Det[%03d]\n", det); | |
3ceb45ae | 241 | } |
242 | if(!AliTRDtrackerV1::PropagateToX(tt, tr->GetX0(), fgKalmanStep)) continue; | |
35983729 | 243 | if(!tt.GetTrackIn()) tt.SetTrackIn(); |
3ed01fbe | 244 | tr->Update(&tt); |
3ceb45ae | 245 | if(fgKalmanUpdate){ |
246 | Double_t x(tr->GetX0()), | |
247 | p[2] = { tr->GetYfit(0), tr->GetZfit(0)}, | |
248 | covTrklt[3]; | |
249 | tr->GetCovAt(x, covTrklt); | |
250 | if(!((AliExternalTrackParam&)tt).Update(p, covTrklt)) continue; | |
3ed01fbe | 251 | //tr->Update(&tt); |
252 | tt.SetTracklet(tr, 0); | |
253 | tt.SetNumberOfClusters(); | |
254 | tt.UpdateChi2(((AliExternalTrackParam)tt).GetPredictedChi2(p, covTrklt)); | |
3ceb45ae | 255 | } |
3ceb45ae | 256 | } |
3ed01fbe | 257 | //tt.Print("a"); |
258 | t.~AliTRDtrackV1(); | |
259 | new(&t) AliTRDtrackV1(tt); | |
3ceb45ae | 260 | return kTRUE; |
261 | } | |
262 | ||
263 |