]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
fd31e9de | 9 | |
a4197d2e | 10 | #include "TVector.h" |
11 | #include "TLinearFitter.h" | |
6983e87a | 12 | #include "TEveTrans.h" |
13 | ||
d810d0de | 14 | #include "AliEveTRDData.h" |
15 | #include "AliEveTRDModuleImp.h" | |
a282bf09 | 16 | |
6983e87a | 17 | #include "AliLog.h" |
a4197d2e | 18 | #include "AliPID.h" |
19 | #include "AliTrackPointArray.h" | |
6983e87a | 20 | |
edf0c4a0 | 21 | #include "AliTRDhit.h" |
22 | #include "AliTRDcluster.h" | |
6983e87a | 23 | #include "AliTRDseedV1.h" |
24 | #include "AliTRDtrackV1.h" | |
a4197d2e | 25 | #include "AliTRDtrackerV1.h" |
a282bf09 | 26 | #include "AliTRDpadPlane.h" |
a4197d2e | 27 | #include "AliTRDdigitsManager.h" |
a282bf09 | 28 | #include "AliTRDgeometry.h" |
6983e87a | 29 | #include "AliTRDtransform.h" |
a4197d2e | 30 | #include "AliTRDReconstructor.h" |
31 | #include "AliTRDrecoParam.h" | |
a282bf09 | 32 | |
d810d0de | 33 | ClassImp(AliEveTRDHits) |
34 | ClassImp(AliEveTRDDigits) | |
35 | ClassImp(AliEveTRDClusters) | |
6983e87a | 36 | ClassImp(AliEveTRDTracklet) |
37 | ClassImp(AliEveTRDTrack) | |
a282bf09 | 38 | |
39 | /////////////////////////////////////////////////////////// | |
fd31e9de | 40 | ///////////// AliEveTRDDigits ///////////////////// |
a282bf09 | 41 | /////////////////////////////////////////////////////////// |
42 | ||
fd31e9de | 43 | //______________________________________________________________________________ |
44 | AliEveTRDDigits::AliEveTRDDigits(AliEveTRDChamber *p) : | |
45 | TEveQuadSet("digits", ""), fParent(p), fBoxes(), fData() | |
a15e6d7d | 46 | { |
47 | // Constructor. | |
48 | } | |
a282bf09 | 49 | |
fd31e9de | 50 | //______________________________________________________________________________ |
6983e87a | 51 | AliEveTRDDigits::~AliEveTRDDigits() |
a282bf09 | 52 | { |
6983e87a | 53 | // AliInfo(GetTitle()); |
a282bf09 | 54 | } |
55 | ||
fd31e9de | 56 | //______________________________________________________________________________ |
d810d0de | 57 | void AliEveTRDDigits::ComputeRepresentation() |
a282bf09 | 58 | { |
84aff7a4 | 59 | // Calculate digits representation according to user settings. The |
60 | // user can set the following parameters: | |
61 | // - digits scale (log/lin) | |
62 | // - digits threshold | |
63 | // - digits apparence (quads/boxes) | |
64 | ||
6983e87a | 65 | TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64); |
51346b82 | 66 | |
6983e87a | 67 | Double_t scale, dy, dz; |
68 | Int_t q, color; | |
69 | Int_t nrows = fParent->fNrows, | |
70 | ncols = fParent->fNcols, | |
71 | ntbs = fParent->fNtime, | |
72 | det = fParent->GetID(); | |
73 | Float_t threshold = fParent->GetDigitsThreshold(); | |
a282bf09 | 74 | |
6983e87a | 75 | AliTRDtransform transform(det); |
76 | AliTRDgeometry *geo = fParent->fGeo; | |
7bc3159a | 77 | AliTRDpadPlane *pp = geo->GetPadPlane(geo->GetLayer(det), geo->GetStack(det)); |
51346b82 | 78 | |
6983e87a | 79 | // express position in tracking coordinates |
84aff7a4 | 80 | fData.Expand(); |
6983e87a | 81 | for (Int_t ir = 0; ir < nrows; ir++) { |
82 | dz = pp->GetRowSize(ir); | |
83 | for (Int_t ic = 0; ic < ncols; ic++) { | |
84 | dy = pp->GetColSize(ic); | |
85 | for (Int_t it = 0; it < ntbs; it++) { | |
86 | q = fData.GetDataUnchecked(ir, ic, it); | |
87 | if (q < threshold) continue; | |
88 | ||
89 | Double_t x[6] = {0., 0., Double_t(q), 0., 0., 0.}; | |
90 | Int_t roc[3] = {ir, ic, 0}; | |
91 | Bool_t out = kTRUE; | |
92 | transform.Transform(&x[0], &roc[0], UInt_t(it), out, 0); | |
93 | ||
94 | scale = q < 512 ? q/512. : 1.; | |
95 | color = 50+int(scale*50.); | |
96 | ||
97 | AddQuad(x[1]-.45*dy, x[2]-.5*dz*scale, x[0], .9*dy, dz*scale); | |
98 | QuadValue(q); | |
99 | QuadColor(Color_t(color)); | |
100 | QuadId(new TNamed(Form("Charge%d", q), "dummy title")); | |
84aff7a4 | 101 | } // end time loop |
102 | } // end col loop | |
103 | } // end row loop | |
104 | fData.Compress(1); | |
6983e87a | 105 | |
106 | // rotate to global coordinates | |
107 | //RefitPlex(); | |
108 | TEveTrans& t = RefMainTrans(); | |
109 | t.SetRotByAngles((geo->GetSector(det)+.5)*AliTRDgeometry::GetAlpha(), 0.,0.); | |
a282bf09 | 110 | } |
111 | ||
6983e87a | 112 | //______________________________________________________________________________ |
113 | void AliEveTRDDigits::SetData(AliTRDdigitsManager *digits) | |
114 | { | |
115 | // Set data source. | |
116 | ||
117 | fData.Allocate(fParent->fNrows, fParent->fNcols, fParent->fNtime); | |
118 | // digits->Expand(); | |
119 | for (Int_t row = 0; row < fParent->fNrows; row++) | |
120 | for (Int_t col = 0; col < fParent->fNcols; col++) | |
121 | for (Int_t time = 0; time < fParent->fNtime; time++) { | |
122 | if(digits->GetDigitAmp(row, col, time, fParent->GetID()) < 0) continue; | |
123 | fData.SetDataUnchecked(row, col, time, digits->GetDigitAmp(row, col, time, fParent->GetID())); | |
124 | } | |
125 | } | |
126 | ||
127 | ||
fd31e9de | 128 | //______________________________________________________________________________ |
d810d0de | 129 | void AliEveTRDDigits::Paint(Option_t *option) |
a282bf09 | 130 | { |
a15e6d7d | 131 | // Paint the object. |
132 | ||
fd31e9de | 133 | if(fParent->GetDigitsBox()) fBoxes.Paint(option); |
134 | else TEveQuadSet::Paint(option); | |
a282bf09 | 135 | } |
136 | ||
fd31e9de | 137 | //______________________________________________________________________________ |
d810d0de | 138 | void AliEveTRDDigits::Reset() |
a282bf09 | 139 | { |
a15e6d7d | 140 | // Reset raw and visual data. |
141 | ||
6983e87a | 142 | TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64); |
fd31e9de | 143 | // MT fBoxes.fBoxes.clear(); |
144 | fData.Reset(); | |
a282bf09 | 145 | } |
146 | ||
147 | /////////////////////////////////////////////////////////// | |
fd31e9de | 148 | ///////////// AliEveTRDHits ///////////////////// |
a282bf09 | 149 | /////////////////////////////////////////////////////////// |
150 | ||
fd31e9de | 151 | //______________________________________________________________________________ |
a4197d2e | 152 | AliEveTRDHits::AliEveTRDHits() : TEvePointSet("hits", 20) |
a15e6d7d | 153 | { |
154 | // Constructor. | |
a4197d2e | 155 | SetMarkerSize(.1); |
156 | SetMarkerColor(2); | |
157 | SetOwnIds(kTRUE); | |
6983e87a | 158 | } |
159 | ||
160 | //______________________________________________________________________________ | |
161 | AliEveTRDHits::~AliEveTRDHits() | |
162 | { | |
163 | //AliInfo(GetTitle()); | |
a15e6d7d | 164 | } |
a282bf09 | 165 | |
fd31e9de | 166 | //______________________________________________________________________________ |
d810d0de | 167 | void AliEveTRDHits::PointSelected(Int_t n) |
edf0c4a0 | 168 | { |
a15e6d7d | 169 | // Handle an individual point selection from GL. |
170 | ||
fd31e9de | 171 | AliTRDhit *h = dynamic_cast<AliTRDhit*>(GetPointId(n)); |
172 | printf("\nDetector : %d\n", h->GetDetector()); | |
173 | printf("Region of production : %c\n", h->FromAmplification() ? 'A' : 'D'); | |
174 | printf("TR photon : %s\n", h->FromTRphoton() ? "Yes" : "No"); | |
175 | printf("Charge : %d\n", h->GetCharge()); | |
176 | printf("MC track label : %d\n", h->GetTrack()); | |
177 | printf("Time from collision : %f\n", h->GetTime()); | |
a282bf09 | 178 | } |
179 | ||
edf0c4a0 | 180 | |
181 | /////////////////////////////////////////////////////////// | |
6983e87a | 182 | ///////////// AliEveTRDClusters ///////////////////// |
edf0c4a0 | 183 | /////////////////////////////////////////////////////////// |
184 | ||
fd31e9de | 185 | //______________________________________________________________________________ |
a4197d2e | 186 | AliEveTRDClusters::AliEveTRDClusters():AliEveTRDHits() |
a15e6d7d | 187 | { |
188 | // Constructor. | |
6983e87a | 189 | SetName("clusters"); |
a4197d2e | 190 | |
191 | SetMarkerSize(.2); | |
192 | SetMarkerStyle(24); | |
193 | SetMarkerColor(kGreen); | |
194 | SetOwnIds(kTRUE); | |
a15e6d7d | 195 | } |
edf0c4a0 | 196 | |
fd31e9de | 197 | //______________________________________________________________________________ |
d810d0de | 198 | void AliEveTRDClusters::PointSelected(Int_t n) |
edf0c4a0 | 199 | { |
a15e6d7d | 200 | // Handle an individual point selection from GL. |
201 | ||
fd31e9de | 202 | AliTRDcluster *c = dynamic_cast<AliTRDcluster*>(GetPointId(n)); |
203 | printf("\nDetector : %d\n", c->GetDetector()); | |
204 | printf("Charge : %f\n", c->GetQ()); | |
205 | printf("Sum S : %4.0f\n", c->GetSumS()); | |
206 | printf("Time bin : %d\n", c->GetLocalTimeBin()); | |
207 | printf("Signals : "); | |
208 | Short_t *cSignals = c->GetSignals(); | |
209 | for(Int_t ipad=0; ipad<7; ipad++) printf("%d ", cSignals[ipad]); printf("\n"); | |
210 | printf("Central pad : %d\n", c->GetPadCol()); | |
211 | printf("MC track labels : "); | |
212 | for(Int_t itrk=0; itrk<3; itrk++) printf("%d ", c->GetLabel(itrk)); printf("\n"); | |
213 | // Bool_t AliCluster::GetGlobalCov(Float_t* cov) const | |
214 | // Bool_t AliCluster::GetGlobalXYZ(Float_t* xyz) const | |
215 | // Float_t AliCluster::GetSigmaY2() const | |
216 | // Float_t AliCluster::GetSigmaYZ() const | |
217 | // Float_t AliCluster::GetSigmaZ2() const | |
edf0c4a0 | 218 | } |
219 | ||
220 | /////////////////////////////////////////////////////////// | |
6983e87a | 221 | ///////////// AliEveTRDTracklet ///////////////////// |
edf0c4a0 | 222 | /////////////////////////////////////////////////////////// |
edf0c4a0 | 223 | |
6983e87a | 224 | //______________________________________________________________________________ |
a4197d2e | 225 | AliEveTRDTracklet::AliEveTRDTracklet(AliTRDseedV1 *trklt):TEveLine() |
226 | ,fClusters(0x0) | |
a282bf09 | 227 | { |
6983e87a | 228 | // Constructor. |
229 | SetName("tracklet"); | |
a4197d2e | 230 | |
231 | SetUserData(trklt); | |
232 | Int_t det = -1, sec; | |
233 | Float_t g[3]; | |
234 | AliTRDcluster *c = 0x0; | |
235 | AddElement(fClusters = new AliEveTRDClusters()); | |
236 | for(Int_t ic=0; ic<35; ic++){ | |
237 | if(!(c = trklt->GetClusters(ic))) continue; | |
238 | det = c->GetDetector(); | |
239 | c->GetGlobalXYZ(g); | |
240 | Int_t id = fClusters->SetNextPoint(g[0], g[1], g[2]); | |
241 | fClusters->SetPointId(id, new AliTRDcluster(*c)); | |
242 | } | |
243 | ||
244 | SetTitle(Form("Det[%d] Plane[%d] P[%7.3f]", det, trklt->GetPlane(), trklt->GetMomentum())); | |
245 | SetLineColor(kYellow); | |
246 | //SetOwnIds(kTRUE); | |
247 | ||
248 | sec = det/30; | |
249 | Double_t alpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); | |
250 | Double_t x0 = trklt->GetX0(), | |
251 | y0f = trklt->GetYfit(0), | |
252 | ysf = trklt->GetYfit(1), | |
253 | z0r = trklt->GetZref(0), | |
254 | zsr = trklt->GetZref(1); | |
255 | Double_t xg = x0 * TMath::Cos(alpha) - y0f * TMath::Sin(alpha); | |
256 | Double_t yg = x0 * TMath::Sin(alpha) + y0f * TMath::Cos(alpha); | |
257 | SetPoint(0, xg, yg, z0r); | |
258 | //SetPointId(0, new AliTRDseedV1(*trackletObj)); | |
259 | Double_t x1 = x0-3.5, | |
260 | y1f = y0f - ysf*3.5, | |
261 | z1r = z0r - zsr*3.5; | |
262 | xg = x1 * TMath::Cos(alpha) - y1f * TMath::Sin(alpha); | |
263 | yg = x1 * TMath::Sin(alpha) + y1f * TMath::Cos(alpha); | |
264 | SetPoint(1, xg, yg, z1r); | |
265 | } | |
266 | ||
267 | //______________________________________________________________________________ | |
268 | void AliEveTRDTracklet::ProcessData() | |
269 | { | |
270 | AliTRDseedV1 *tracklet = (AliTRDseedV1*)GetUserData(); | |
271 | tracklet->Print(); | |
a282bf09 | 272 | } |
273 | ||
edf0c4a0 | 274 | /////////////////////////////////////////////////////////// |
6983e87a | 275 | ///////////// AliEveTRDTrack ///////////////////// |
edf0c4a0 | 276 | /////////////////////////////////////////////////////////// |
6983e87a | 277 | |
278 | //______________________________________________________________________________ | |
a4197d2e | 279 | AliEveTRDTrack::AliEveTRDTrack(AliTRDtrackV1 *trk) : TEveLine() |
edf0c4a0 | 280 | { |
a15e6d7d | 281 | // Constructor. |
6983e87a | 282 | SetName("track"); |
a4197d2e | 283 | |
284 | SetUserData(trk); | |
285 | ||
286 | AliTRDtrackerV1::SetNTimeBins(24); | |
287 | AliTrackPoint points[AliTRDtrackV1::kMAXCLUSTERSPERTRACK]; | |
288 | Int_t nc = 0, sec = -1; Float_t alpha = 0.; | |
289 | AliTRDcluster *c = 0x0; | |
290 | AliTRDseedV1 *tracklet = 0x0; | |
7bc3159a | 291 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ |
292 | if(!(tracklet = trk->GetTracklet(il))) continue; | |
a4197d2e | 293 | if(!tracklet->IsOK()) continue; |
7bc3159a | 294 | AddElement(fTracklet[il] = new AliEveTRDTracklet(tracklet)); |
a4197d2e | 295 | |
296 | for(Int_t ic=34; ic>=0; ic--){ | |
297 | if(!(c = tracklet->GetClusters(ic))) continue; | |
298 | if(sec<0){ | |
299 | sec = c->GetDetector()/30; | |
300 | alpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); | |
301 | } | |
302 | points[nc].SetXYZ(c->GetX(),0.,0.); | |
303 | nc++; | |
304 | } | |
305 | } | |
306 | ||
307 | AliTRDtrackerV1::FitRiemanTilt(trk, 0x0, kTRUE, nc, points); | |
308 | //AliTRDtrackerV1::FitKalman(trk, 0x0, kFALSE, nc, points); | |
309 | ||
310 | Float_t global[3]; | |
311 | for(Int_t ip=0; ip<nc; ip++){ | |
312 | points[ip].Rotate(-alpha).GetXYZ(global); | |
313 | SetNextPoint(global[0], global[1], global[2]); | |
314 | } | |
315 | ||
316 | SetMarkerColor(kCyan); | |
317 | SetLineColor(kCyan); | |
318 | SetSmooth(kTRUE); | |
319 | } | |
320 | ||
321 | //______________________________________________________________________________ | |
322 | void AliEveTRDTrack::ProcessData() | |
323 | { | |
324 | AliTRDtrackV1 *track = (AliTRDtrackV1*)GetUserData(); | |
325 | AliInfo(Form("Clusters[%d]", track->GetNumberOfClusters())); | |
326 | ||
327 | AliTRDReconstructor::RecoParam()->SetPIDMethod(0); | |
328 | track->CookPID(); | |
329 | printf("PIDLQ : "); for(int is=0; is<AliPID::kSPECIES; is++) printf("%s[%5.2f] ", AliPID::ParticleName(is), 1.E2*track->GetPID(is)); printf("\n"); | |
330 | ||
331 | AliTRDReconstructor::RecoParam()->SetPIDMethod(1); | |
332 | track->CookPID(); | |
333 | printf("PIDNN : "); for(int is=0; is<AliPID::kSPECIES; is++) printf("%s[%5.2f] ", AliPID::ParticleName(is), 1.E2*track->GetPID(is)); printf("\n"); | |
edf0c4a0 | 334 | } |
335 |