2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
11 #include "TLinearFitter.h"
12 #include "TEveTrans.h"
14 #include "AliEveTRDData.h"
15 #include "AliEveTRDModuleImp.h"
19 #include "AliTrackPointArray.h"
21 #include "AliTRDhit.h"
22 #include "AliTRDcluster.h"
23 #include "AliTRDseedV1.h"
24 #include "AliTRDtrackV1.h"
25 #include "AliTRDtrackerV1.h"
26 #include "AliTRDpadPlane.h"
27 #include "AliTRDdigitsManager.h"
28 #include "AliTRDdataArrayDigits.h"
29 #include "AliTRDSignalIndex.h"
30 #include "AliTRDgeometry.h"
31 #include "AliTRDtransform.h"
32 #include "AliTRDReconstructor.h"
33 #include "AliTRDrecoParam.h"
35 ClassImp(AliEveTRDHits)
36 ClassImp(AliEveTRDDigits)
37 ClassImp(AliEveTRDClusters)
38 ClassImp(AliEveTRDTracklet)
39 ClassImp(AliEveTRDTrack)
41 ///////////////////////////////////////////////////////////
42 ///////////// AliEveTRDDigits /////////////////////
43 ///////////////////////////////////////////////////////////
45 //______________________________________________________________________________
46 AliEveTRDDigits::AliEveTRDDigits(AliEveTRDChamber *p) :
47 TEveQuadSet("digits", ""), fParent(p), fBoxes(), fData()
52 //______________________________________________________________________________
53 AliEveTRDDigits::~AliEveTRDDigits()
55 // AliInfo(GetTitle());
58 //______________________________________________________________________________
59 void AliEveTRDDigits::ComputeRepresentation()
61 // Calculate digits representation according to user settings. The
62 // user can set the following parameters:
63 // - digits scale (log/lin)
65 // - digits apparence (quads/boxes)
71 TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64);
73 Double_t scale, dy, dz;
75 Int_t nrows = fData.GetNrow(),
76 ncols = fData.GetNcol(),
77 ntbs = fData.GetNtime(),
78 det = fParent->GetID();
79 Float_t threshold = fParent->GetDigitsThreshold();
81 AliTRDtransform transform(det);
82 AliTRDgeometry *geo = fParent->fGeo;
83 AliTRDpadPlane *pp = geo->GetPadPlane(geo->GetLayer(det), geo->GetStack(det));
85 // express position in tracking coordinates
87 for (Int_t ir = 0; ir < nrows; ir++) {
88 dz = pp->GetRowSize(ir);
89 for (Int_t ic = 0; ic < ncols; ic++) {
90 dy = pp->GetColSize(ic);
91 for (Int_t it = 0; it < ntbs; it++) {
92 q = fData.GetDataUnchecked(ir, ic, it);
93 if (q < threshold) continue;
95 Double_t x[6] = {0., 0., Double_t(q), 0., 0., 0.};
96 Int_t roc[3] = {ir, ic, 0};
98 transform.Transform(&x[0], &roc[0], UInt_t(it), out, 0);
100 scale = q < 512 ? q/512. : 1.;
101 color = 50+int(scale*50.);
103 AddQuad(x[1]-.45*dy, x[2]-.5*dz*scale, x[0], .9*dy, dz*scale);
106 QuadId(new TNamed(Form("Charge%d", q), "dummy title"));
112 // rotate to global coordinates
114 TEveTrans& t = RefMainTrans();
115 t.SetRotByAngles((geo->GetSector(det)+.5)*AliTRDgeometry::GetAlpha(), 0.,0.);
118 //______________________________________________________________________________
119 void AliEveTRDDigits::SetData(AliTRDdigitsManager *digits)
123 Int_t det = fParent->GetID();
124 AliTRDdataArrayDigits *data = digits->GetDigits(det);
125 if(!data->HasData()) return;
128 AliTRDSignalIndex *indexes = digits->GetIndexes(det);
129 if(!indexes->IsAllocated()) digits->BuildIndexes(det);
131 if(!fData.HasData()) fData.Allocate(data->GetNrow(), data->GetNcol(), data->GetNtime());
134 Int_t row, col, time, adc;
135 indexes->ResetCounters();
136 while (indexes->NextRCIndex(row, col)){
137 indexes->ResetTbinCounter();
138 while (indexes->NextTbinIndex(time)){
139 if(data->IsPadCorrupted(row, col, time)){
140 // we should mark this position
143 adc = data->GetData(row, col, time);
144 if(adc <= 1) continue;
145 fData.SetDataUnchecked(row, col, time, adc);
146 //fIndex->AddIndexTBin(row,col,time);
147 //printf("\tr[%d] c[%d] t[%d] ADC[%d]\n", row, col, time, adc);
154 //______________________________________________________________________________
155 void AliEveTRDDigits::Paint(Option_t *option)
159 if(fParent->GetDigitsBox()) fBoxes.Paint(option);
160 else TEveQuadSet::Paint(option);
163 //______________________________________________________________________________
164 void AliEveTRDDigits::Reset()
166 // Reset raw and visual data.
168 TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64);
169 // MT fBoxes.fBoxes.clear();
173 ///////////////////////////////////////////////////////////
174 ///////////// AliEveTRDHits /////////////////////
175 ///////////////////////////////////////////////////////////
177 //______________________________________________________________________________
178 AliEveTRDHits::AliEveTRDHits() : TEvePointSet("hits", 20)
186 //______________________________________________________________________________
187 AliEveTRDHits::~AliEveTRDHits()
189 //AliInfo(GetTitle());
192 //______________________________________________________________________________
193 void AliEveTRDHits::PointSelected(Int_t n)
195 // Handle an individual point selection from GL.
197 AliTRDhit *h = dynamic_cast<AliTRDhit*>(GetPointId(n));
198 printf("\nDetector : %d\n", h->GetDetector());
199 printf("Region of production : %c\n", h->FromAmplification() ? 'A' : 'D');
200 printf("TR photon : %s\n", h->FromTRphoton() ? "Yes" : "No");
201 printf("Charge : %d\n", h->GetCharge());
202 printf("MC track label : %d\n", h->GetTrack());
203 printf("Time from collision : %f\n", h->GetTime());
207 ///////////////////////////////////////////////////////////
208 ///////////// AliEveTRDClusters /////////////////////
209 ///////////////////////////////////////////////////////////
211 //______________________________________________________________________________
212 AliEveTRDClusters::AliEveTRDClusters():AliEveTRDHits()
219 SetMarkerColor(kGray);
223 //______________________________________________________________________________
224 void AliEveTRDClusters::PointSelected(Int_t n)
226 // Handle an individual point selection from GL.
228 AliTRDcluster *c = dynamic_cast<AliTRDcluster*>(GetPointId(n));
229 printf("\nDetector : %d\n", c->GetDetector());
230 printf("Charge : %f\n", c->GetQ());
231 printf("Sum S : %4.0f\n", c->GetSumS());
232 printf("Time bin : %d\n", c->GetLocalTimeBin());
233 printf("Signals : ");
234 Short_t *cSignals = c->GetSignals();
235 for(Int_t ipad=0; ipad<7; ipad++) printf("%d ", cSignals[ipad]); printf("\n");
236 printf("Central pad : %d\n", c->GetPadCol());
237 printf("MC track labels : ");
238 for(Int_t itrk=0; itrk<3; itrk++) printf("%d ", c->GetLabel(itrk)); printf("\n");
239 // Bool_t AliCluster::GetGlobalCov(Float_t* cov) const
240 // Bool_t AliCluster::GetGlobalXYZ(Float_t* xyz) const
241 // Float_t AliCluster::GetSigmaY2() const
242 // Float_t AliCluster::GetSigmaYZ() const
243 // Float_t AliCluster::GetSigmaZ2() const
246 ///////////////////////////////////////////////////////////
247 ///////////// AliEveTRDTracklet /////////////////////
248 ///////////////////////////////////////////////////////////
250 //______________________________________________________________________________
251 AliEveTRDTracklet::AliEveTRDTracklet(AliTRDseedV1 *trklt):TEveLine()
260 AliTRDcluster *c = 0x0;
261 AddElement(fClusters = new AliEveTRDClusters());
262 for(Int_t ic=0; ic<35; ic++){
263 if(!(c = trklt->GetClusters(ic))) continue;
264 det = c->GetDetector();
266 Int_t id = fClusters->SetNextPoint(g[0], g[1], g[2]);
267 fClusters->SetPointId(id, new AliTRDcluster(*c));
270 SetTitle(Form("Det[%d] Plane[%d] P[%7.3f]", det, trklt->GetPlane(), trklt->GetMomentum()));
275 Double_t alpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5);
276 Double_t x0 = trklt->GetX0(),
277 y0f = trklt->GetYfit(0),
278 ysf = trklt->GetYfit(1),
279 z0r = trklt->GetZref(0),
280 zsr = trklt->GetZref(1);
281 Double_t xg = x0 * TMath::Cos(alpha) - y0f * TMath::Sin(alpha);
282 Double_t yg = x0 * TMath::Sin(alpha) + y0f * TMath::Cos(alpha);
283 SetPoint(0, xg, yg, z0r);
284 //SetPointId(0, new AliTRDseedV1(*trackletObj));
285 Double_t x1 = x0-3.5,
288 xg = x1 * TMath::Cos(alpha) - y1f * TMath::Sin(alpha);
289 yg = x1 * TMath::Sin(alpha) + y1f * TMath::Cos(alpha);
290 SetPoint(1, xg, yg, z1r);
293 //______________________________________________________________________________
294 void AliEveTRDTracklet::ProcessData()
296 AliTRDseedV1 *tracklet = (AliTRDseedV1*)GetUserData();
300 ///////////////////////////////////////////////////////////
301 ///////////// AliEveTRDTrack /////////////////////
302 ///////////////////////////////////////////////////////////
304 //______________________________________________________________________________
305 AliEveTRDTrack::AliEveTRDTrack(AliTRDtrackV1 *trk) : TEveLine()
312 AliTRDtrackerV1::SetNTimeBins(24);
313 AliTrackPoint points[AliTRDtrackV1::kMAXCLUSTERSPERTRACK];
314 Int_t nc = 0, sec = -1; Float_t alpha = 0.;
315 AliTRDcluster *c = 0x0;
316 AliTRDseedV1 *tracklet = 0x0;
317 for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
318 if(!(tracklet = trk->GetTracklet(il))) continue;
319 if(!tracklet->IsOK()) continue;
320 AddElement(fTracklet[il] = new AliEveTRDTracklet(tracklet));
322 for(Int_t ic=34; ic>=0; ic--){
323 if(!(c = tracklet->GetClusters(ic))) continue;
325 sec = c->GetDetector()/30;
326 alpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5);
328 points[nc].SetXYZ(c->GetX(),0.,0.);
333 AliTRDtrackerV1::FitRiemanTilt(trk, 0x0, kTRUE, nc, points);
334 //AliTRDtrackerV1::FitKalman(trk, 0x0, kFALSE, nc, points);
335 //AliTRDtrackerV1::FitLine(trk, 0x0, kFALSE, nc, points);
338 for(Int_t ip=0; ip<nc; ip++){
339 points[ip].Rotate(-alpha).GetXYZ(global);
340 SetNextPoint(global[0], global[1], global[2]);
343 SetMarkerColor(kGreen);
344 SetLineColor(kGreen);
348 //______________________________________________________________________________
349 void AliEveTRDTrack::ProcessData()
351 AliTRDtrackV1 *track = (AliTRDtrackV1*)GetUserData();
352 AliInfo(Form("Clusters[%d]", track->GetNumberOfClusters()));
355 printf("PIDLQ : "); for(int is=0; is<AliPID::kSPECIES; is++) printf("%s[%5.2f] ", AliPID::ParticleName(is), 1.E2*track->GetPID(is)); printf("\n");