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-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 **************************************************************************/
17 ////////////////////////////////////////////////////////////////////////////
19 // TRD tracker systematic //
23 // Alexandru Bercuci <A.Bercuci@gsi.de> //
25 ////////////////////////////////////////////////////////////////////////////
32 #include "TObjArray.h"
33 #include "THnSparse.h"
38 #include "AliTRDcluster.h"
39 #include "AliTRDseedV1.h"
40 #include "AliTRDtrackV1.h"
41 #include "AliTRDtrackerV1.h"
42 #include "AliTRDtransform.h"
44 #include "AliTRDcheckTRK.h"
46 ClassImp(AliTRDcheckTRK)
48 Bool_t AliTRDcheckTRK::fgKalmanUpdate = kTRUE;
49 Bool_t AliTRDcheckTRK::fgClRecalibrate = kFALSE;
50 Float_t AliTRDcheckTRK::fgKalmanStep = 2.;
51 Float_t AliTRDcheckTRK::fgCalib[540][2];
52 //__________________________________________________________________________
53 AliTRDcheckTRK::AliTRDcheckTRK()
56 // Default constructor
57 SetNameTitle("TRDtrackerSys", "TRD Tracker Systematic");
58 memset(AliTRDcheckTRK::fgCalib, 0, 540*2*sizeof(Float_t));
61 //__________________________________________________________________________
62 AliTRDcheckTRK::AliTRDcheckTRK(char* name)
63 : AliTRDresolution(name, kFALSE)
66 SetTitle("TRD Tracker Systematic");
67 memset(AliTRDcheckTRK::fgCalib, 0, 540*2*sizeof(Float_t));
71 //__________________________________________________________________________
72 AliTRDcheckTRK::~AliTRDcheckTRK()
77 //__________________________________________________________________________
78 Int_t AliTRDcheckTRK::GetSpeciesByMass(Float_t m)
80 // Find particle index by mass
87 for(Int_t is(0); is<AliPID::kSPECIES; is++) if(TMath::Abs(m-AliPID::ParticleMass(is))<1.e-4) return is;
93 //__________________________________________________________________________
94 TH1* AliTRDcheckTRK::PlotTrack(const AliTRDtrackV1 *track)
98 if(track) fkTrack = track;
100 AliDebug(4, "No Track defined.");
103 // make a local copy of current track
104 AliTRDtrackV1 lt(*fkTrack);
105 if(!PropagateKalman(lt)) return NULL;
113 //___________________________________________________
114 Bool_t AliTRDcheckTRK::PropagateKalman(AliTRDtrackV1 &t)
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
122 // printf("PropagateKalman()\n");
123 Int_t ntracklets(t.GetNumberOfTracklets());
125 printf("E - AliTRDcheckTRK::PropagateKalman :: No tracklets attached to track.\n");
129 AliTRDseedV1 *tr(NULL);
130 AliExternalTrackParam *ref(NULL);
131 if(!(ref = t.GetTrackIn())){
132 printf("E - AliTRDcheckTRK::PropagateKalman :: Track did not entered TRD fiducial volume.\n");
135 if(ref->Pt()<1.e-3){printf("small refpt\n"); return kFALSE;}
138 // Initialize TRD track to the reference
140 tt.Set(ref->GetX(), ref->GetAlpha(), ref->GetParameter(), ref->GetCovariance());
141 tt.SetMass(t.GetMass());
142 tt.SetTrackIn();tt.SetTrackOut(t.GetTrackOut());
144 for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
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);
150 AliTRDcluster *c(NULL);
151 Float_t exb, vd, t0, s2, dl, dt; tr->GetCalibParam(exb, vd, t0, s2, dl, dt);
152 tr->ResetClusterIter(kFALSE);
153 while((c = tr->PrevCluster())){
154 if(!trans.Transform(c/*, GetCalib(det)*/)){
155 printf("W - AliTRDcheckTRK::PropagateKalman :: Transform() failed for Det[%03d]\n", det);
159 if(!tr->FitRobust()) printf("W - AliTRDcheckTRK::PropagateKalman :: FitRobust() failed for Det[%03d]\n", det);
161 if(!AliTRDtrackerV1::PropagateToX(tt, tr->GetX0(), fgKalmanStep)) continue;
164 Double_t x(tr->GetX0()),
165 p[2] = { tr->GetYfit(0), tr->GetZfit(0)},
167 tr->GetCovAt(x, covTrklt);
168 if(!((AliExternalTrackParam&)tt).Update(p, covTrklt)) continue;
170 tt.SetTracklet(tr, 0);
171 tt.SetNumberOfClusters();
172 tt.UpdateChi2(((AliExternalTrackParam)tt).GetPredictedChi2(p, covTrklt));
177 new(&t) AliTRDtrackV1(tt);