From Alexandru:
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTRDData.cxx
CommitLineData
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
6983e87a 10#include "TEveTrans.h"
11
d810d0de 12#include "AliEveTRDData.h"
13#include "AliEveTRDModuleImp.h"
a282bf09 14
6983e87a 15#include "AliLog.h"
16
edf0c4a0 17#include "AliTRDhit.h"
18#include "AliTRDcluster.h"
6983e87a 19#include "AliTRDseedV1.h"
20#include "AliTRDtrackV1.h"
a282bf09 21#include "AliTRDpadPlane.h"
22#include "AliTRDgeometry.h"
6983e87a 23#include "AliTRDtransform.h"
14217b5f 24#include "AliTRDdigitsManager.h"
a282bf09 25
d810d0de 26ClassImp(AliEveTRDHits)
27ClassImp(AliEveTRDDigits)
28ClassImp(AliEveTRDClusters)
6983e87a 29ClassImp(AliEveTRDTracklet)
30ClassImp(AliEveTRDTrack)
a282bf09 31
32///////////////////////////////////////////////////////////
fd31e9de 33///////////// AliEveTRDDigits /////////////////////
a282bf09 34///////////////////////////////////////////////////////////
35
fd31e9de 36//______________________________________________________________________________
37AliEveTRDDigits::AliEveTRDDigits(AliEveTRDChamber *p) :
38 TEveQuadSet("digits", ""), fParent(p), fBoxes(), fData()
a15e6d7d 39{
40 // Constructor.
41}
a282bf09 42
fd31e9de 43//______________________________________________________________________________
6983e87a 44AliEveTRDDigits::~AliEveTRDDigits()
a282bf09 45{
6983e87a 46// AliInfo(GetTitle());
a282bf09 47}
48
fd31e9de 49//______________________________________________________________________________
d810d0de 50void AliEveTRDDigits::ComputeRepresentation()
a282bf09 51{
84aff7a4 52 // Calculate digits representation according to user settings. The
53 // user can set the following parameters:
54 // - digits scale (log/lin)
55 // - digits threshold
56 // - digits apparence (quads/boxes)
57
6983e87a 58 TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64);
51346b82 59
6983e87a 60 Double_t scale, dy, dz;
61 Int_t q, color;
62 Int_t nrows = fParent->fNrows,
63 ncols = fParent->fNcols,
64 ntbs = fParent->fNtime,
65 det = fParent->GetID();
66 Float_t threshold = fParent->GetDigitsThreshold();
a282bf09 67
6983e87a 68 AliTRDtransform transform(det);
69 AliTRDgeometry *geo = fParent->fGeo;
70 AliTRDpadPlane *pp = geo->GetPadPlane(geo->GetPlane(det), geo->GetChamber(det));
51346b82 71
6983e87a 72 // express position in tracking coordinates
84aff7a4 73 fData.Expand();
6983e87a 74 for (Int_t ir = 0; ir < nrows; ir++) {
75 dz = pp->GetRowSize(ir);
76 for (Int_t ic = 0; ic < ncols; ic++) {
77 dy = pp->GetColSize(ic);
78 for (Int_t it = 0; it < ntbs; it++) {
79 q = fData.GetDataUnchecked(ir, ic, it);
80 if (q < threshold) continue;
81
82 Double_t x[6] = {0., 0., Double_t(q), 0., 0., 0.};
83 Int_t roc[3] = {ir, ic, 0};
84 Bool_t out = kTRUE;
85 transform.Transform(&x[0], &roc[0], UInt_t(it), out, 0);
86
87 scale = q < 512 ? q/512. : 1.;
88 color = 50+int(scale*50.);
89
90 AddQuad(x[1]-.45*dy, x[2]-.5*dz*scale, x[0], .9*dy, dz*scale);
91 QuadValue(q);
92 QuadColor(Color_t(color));
93 QuadId(new TNamed(Form("Charge%d", q), "dummy title"));
84aff7a4 94 } // end time loop
95 } // end col loop
96 } // end row loop
97 fData.Compress(1);
6983e87a 98
99 // rotate to global coordinates
100 //RefitPlex();
101 TEveTrans& t = RefMainTrans();
102 t.SetRotByAngles((geo->GetSector(det)+.5)*AliTRDgeometry::GetAlpha(), 0.,0.);
a282bf09 103}
104
fd31e9de 105//______________________________________________________________________________
6983e87a 106void AliEveTRDDigits::SetData(AliTRDdigitsManager *digits)
107{
108 // Set data source.
109
110 fData.Allocate(fParent->fNrows, fParent->fNcols, fParent->fNtime);
111 // digits->Expand();
112 for (Int_t row = 0; row < fParent->fNrows; row++)
113 for (Int_t col = 0; col < fParent->fNcols; col++)
114 for (Int_t time = 0; time < fParent->fNtime; time++) {
115 if(digits->GetDigitAmp(row, col, time, fParent->GetID()) < 0) continue;
116 fData.SetDataUnchecked(row, col, time, digits->GetDigitAmp(row, col, time, fParent->GetID()));
117 }
118}
119
120
121//______________________________________________________________________________
d810d0de 122void AliEveTRDDigits::Paint(Option_t *option)
a282bf09 123{
a15e6d7d 124 // Paint the object.
125
fd31e9de 126 if(fParent->GetDigitsBox()) fBoxes.Paint(option);
127 else TEveQuadSet::Paint(option);
a282bf09 128}
129
fd31e9de 130//______________________________________________________________________________
d810d0de 131void AliEveTRDDigits::Reset()
a282bf09 132{
a15e6d7d 133 // Reset raw and visual data.
134
6983e87a 135 TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64);
fd31e9de 136 // MT fBoxes.fBoxes.clear();
137 fData.Reset();
a282bf09 138}
139
140///////////////////////////////////////////////////////////
fd31e9de 141///////////// AliEveTRDHits /////////////////////
a282bf09 142///////////////////////////////////////////////////////////
143
fd31e9de 144//______________________________________________________________________________
145AliEveTRDHits::AliEveTRDHits(AliEveTRDChamber *p) :
146 TEvePointSet("hits", 20), fParent(p)
a15e6d7d 147{
148 // Constructor.
6983e87a 149 SetTitle(Form("Hits for Det %d", p->GetID()));
150}
151
152//______________________________________________________________________________
153AliEveTRDHits::~AliEveTRDHits()
154{
155 //AliInfo(GetTitle());
a15e6d7d 156}
a282bf09 157
fd31e9de 158//______________________________________________________________________________
d810d0de 159void AliEveTRDHits::PointSelected(Int_t n)
edf0c4a0 160{
a15e6d7d 161 // Handle an individual point selection from GL.
162
fd31e9de 163 fParent->SpawnEditor();
164 AliTRDhit *h = dynamic_cast<AliTRDhit*>(GetPointId(n));
165 printf("\nDetector : %d\n", h->GetDetector());
166 printf("Region of production : %c\n", h->FromAmplification() ? 'A' : 'D');
167 printf("TR photon : %s\n", h->FromTRphoton() ? "Yes" : "No");
168 printf("Charge : %d\n", h->GetCharge());
169 printf("MC track label : %d\n", h->GetTrack());
170 printf("Time from collision : %f\n", h->GetTime());
a282bf09 171}
172
edf0c4a0 173
174///////////////////////////////////////////////////////////
6983e87a 175///////////// AliEveTRDClusters /////////////////////
edf0c4a0 176///////////////////////////////////////////////////////////
177
fd31e9de 178//______________________________________________________________________________
d810d0de 179AliEveTRDClusters::AliEveTRDClusters(AliEveTRDChamber *p):AliEveTRDHits(p)
a15e6d7d 180{
181 // Constructor.
6983e87a 182 SetName("clusters");
183 SetTitle(Form("Clusters for Det %d", p->GetID()));
a15e6d7d 184}
edf0c4a0 185
fd31e9de 186//______________________________________________________________________________
d810d0de 187void AliEveTRDClusters::PointSelected(Int_t n)
edf0c4a0 188{
a15e6d7d 189 // Handle an individual point selection from GL.
190
fd31e9de 191 fParent->SpawnEditor();
192 AliTRDcluster *c = dynamic_cast<AliTRDcluster*>(GetPointId(n));
193 printf("\nDetector : %d\n", c->GetDetector());
194 printf("Charge : %f\n", c->GetQ());
195 printf("Sum S : %4.0f\n", c->GetSumS());
196 printf("Time bin : %d\n", c->GetLocalTimeBin());
197 printf("Signals : ");
198 Short_t *cSignals = c->GetSignals();
199 for(Int_t ipad=0; ipad<7; ipad++) printf("%d ", cSignals[ipad]); printf("\n");
200 printf("Central pad : %d\n", c->GetPadCol());
201 printf("MC track labels : ");
202 for(Int_t itrk=0; itrk<3; itrk++) printf("%d ", c->GetLabel(itrk)); printf("\n");
203 // Bool_t AliCluster::GetGlobalCov(Float_t* cov) const
204 // Bool_t AliCluster::GetGlobalXYZ(Float_t* xyz) const
205 // Float_t AliCluster::GetSigmaY2() const
206 // Float_t AliCluster::GetSigmaYZ() const
207 // Float_t AliCluster::GetSigmaZ2() const
edf0c4a0 208}
209
210///////////////////////////////////////////////////////////
6983e87a 211///////////// AliEveTRDTracklet /////////////////////
edf0c4a0 212///////////////////////////////////////////////////////////
edf0c4a0 213
6983e87a 214//______________________________________________________________________________
215AliEveTRDTracklet::AliEveTRDTracklet():TEveLine(), AliTRDseedV1()
a282bf09 216{
6983e87a 217 // Constructor.
218 SetName("tracklet");
219 //SetTitle(Form("Clusters for Det %d", p->GetID()));
a282bf09 220}
221
edf0c4a0 222///////////////////////////////////////////////////////////
6983e87a 223///////////// AliEveTRDTrack /////////////////////
edf0c4a0 224///////////////////////////////////////////////////////////
6983e87a 225
226//______________________________________________________________________________
227AliEveTRDTrack::AliEveTRDTrack():TEveLine(), AliTRDtrackV1()
edf0c4a0 228{
a15e6d7d 229 // Constructor.
6983e87a 230 SetName("track");
231 //SetTitle(Form("Clusters for Det %d", p->GetID()));
edf0c4a0 232}
233