]>
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 | **************************************************************************/ |
9 | #include "AliEveTRDData.h" | |
10 | #include "AliEveTRDModuleImp.h" | |
a282bf09 | 11 | |
edf0c4a0 | 12 | #include "AliLog.h" |
13 | #include "AliTRDhit.h" | |
14 | #include "AliTRDcluster.h" | |
a282bf09 | 15 | #include "AliTRDcalibDB.h" |
16 | #include "AliTRDpadPlane.h" | |
17 | #include "AliTRDgeometry.h" | |
14217b5f | 18 | #include "AliTRDdigitsManager.h" |
a282bf09 | 19 | |
a282bf09 | 20 | using namespace std; |
21 | ||
d810d0de | 22 | ClassImp(AliEveTRDHits) |
23 | ClassImp(AliEveTRDDigits) | |
24 | ClassImp(AliEveTRDClusters) | |
a282bf09 | 25 | |
26 | /////////////////////////////////////////////////////////// | |
d810d0de | 27 | ///////////// AliEveTRDDigits ///////////////////// |
a282bf09 | 28 | /////////////////////////////////////////////////////////// |
29 | ||
30 | //________________________________________________________ | |
d810d0de | 31 | AliEveTRDDigits::AliEveTRDDigits(AliEveTRDChamber *p): TEveQuadSet("digits", ""), fParent(p) |
edf0c4a0 | 32 | {} |
a282bf09 | 33 | |
34 | //________________________________________________________ | |
d810d0de | 35 | void AliEveTRDDigits::SetData(AliTRDdigitsManager *digits) |
a282bf09 | 36 | { |
51346b82 | 37 | |
edf0c4a0 | 38 | fData.Allocate(fParent->rowMax, fParent->colMax, fParent->timeMax); |
14217b5f | 39 | // digits->Expand(); |
edf0c4a0 | 40 | for (Int_t row = 0; row < fParent->rowMax; row++) |
41 | for (Int_t col = 0; col < fParent->colMax; col++) | |
42 | for (Int_t time = 0; time < fParent->timeMax; time++) { | |
43 | if(digits->GetDigitAmp(row, col, time, fParent->GetID()) < 0) continue; | |
44 | fData.SetDataUnchecked(row, col, time, digits->GetDigitAmp(row, col, time, fParent->GetID())); | |
a282bf09 | 45 | } |
46 | } | |
47 | ||
48 | //________________________________________________________ | |
d810d0de | 49 | void AliEveTRDDigits::ComputeRepresentation() |
a282bf09 | 50 | { |
84aff7a4 | 51 | // Calculate digits representation according to user settings. The |
52 | // user can set the following parameters: | |
53 | // - digits scale (log/lin) | |
54 | // - digits threshold | |
55 | // - digits apparence (quads/boxes) | |
56 | ||
57 | TEveQuadSet::Reset(TEveQuadSet::kQT_FreeQuad, kTRUE, 64); | |
58 | // MT fBoxes.fBoxes.clear(); | |
51346b82 | 59 | |
84aff7a4 | 60 | Double_t colSize, rowSize, scale; |
61 | Double_t x, y, z; | |
a282bf09 | 62 | |
84aff7a4 | 63 | Int_t charge; |
64 | Float_t t0; | |
65 | Float_t timeBinSize; | |
51346b82 | 66 | |
84aff7a4 | 67 | AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); |
a282bf09 | 68 | Double_t cloc[4][3], cglo[3]; |
84aff7a4 | 69 | Int_t color, dimension; |
70 | fData.Expand(); | |
71 | for (Int_t row = 0; row < fParent->rowMax; row++) { | |
72 | rowSize = .5 * fParent->fPadPlane->GetRowSize(row); | |
73 | z = fParent->fPadPlane->GetRowPos(row) - rowSize; | |
51346b82 | 74 | |
84aff7a4 | 75 | for (Int_t col = 0; col < fParent->colMax; col++) { |
76 | colSize = .5 * fParent->fPadPlane->GetColSize(col); | |
77 | y = fParent->fPadPlane->GetColPos(col) - colSize; | |
78 | t0 = calibration->GetT0(fParent->fDet, col, row); | |
79 | timeBinSize = calibration->GetVdrift(fParent->fDet, col, row)/fParent->samplingFrequency; | |
51346b82 | 80 | |
84aff7a4 | 81 | for (Int_t time = 0; time < fParent->timeMax; time++) { |
82 | charge = fData.GetDataUnchecked(row, col, time); | |
83 | if (charge < fParent->GetDigitsThreshold()) continue; | |
51346b82 | 84 | |
84aff7a4 | 85 | x = fParent->fX0 - (time+0.5-t0)*timeBinSize; |
86 | scale = fParent->GetDigitsLog() ? TMath::Log(float(charge))/TMath::Log(1024.) : charge/1024.; | |
87 | color = 50+int(scale*50.); | |
51346b82 | 88 | |
84aff7a4 | 89 | cloc[0][2] = z - rowSize * scale; |
90 | cloc[0][1] = y - colSize * scale; | |
91 | cloc[0][0] = x; | |
51346b82 | 92 | |
84aff7a4 | 93 | cloc[1][2] = z - rowSize * scale; |
94 | cloc[1][1] = y + colSize * scale; | |
95 | cloc[1][0] = x; | |
51346b82 | 96 | |
84aff7a4 | 97 | cloc[2][2] = z + rowSize * scale; |
98 | cloc[2][1] = y + colSize * scale; | |
99 | cloc[2][0] = x; | |
51346b82 | 100 | |
84aff7a4 | 101 | cloc[3][2] = z + rowSize * scale; |
102 | cloc[3][1] = y - colSize * scale; | |
103 | cloc[3][0] = x; | |
51346b82 | 104 | |
84aff7a4 | 105 | Float_t* p = 0; |
106 | if( fParent->GetDigitsBox()){ | |
107 | // MT fBoxes.fBoxes.push_back(Box()); | |
108 | // MT fBoxes.fBoxes.back().color[0] = (UChar_t)color; | |
109 | // MT fBoxes.fBoxes.back().color[1] = (UChar_t)color; | |
110 | // MT fBoxes.fBoxes.back().color[2] = (UChar_t)color; | |
111 | // MT fBoxes.fBoxes.back().color[3] = (UChar_t)color; | |
112 | // MT p = fBoxes.fBoxes.back().vertices; | |
113 | dimension = 2; | |
114 | } else { | |
115 | AddQuad((Float_t*)0); | |
116 | QuadColor(color); | |
117 | p = ((QFreeQuad_t*) fLastDigit)->fVertices; | |
118 | dimension = 1; | |
119 | } | |
a282bf09 | 120 | |
84aff7a4 | 121 | for(int id=0; id<dimension; id++) |
122 | for (Int_t ic = 0; ic < 4; ic++) { | |
123 | cloc[ic][0] -= .5 * id * timeBinSize; | |
124 | fParent->fGeo->RotateBack(fParent->fDet,cloc[ic],cglo); | |
125 | p[0] = cglo[0]; p[1] = cglo[1]; p[2] = cglo[2]; | |
126 | p+=3; | |
127 | } | |
128 | } // end time loop | |
129 | } // end col loop | |
130 | } // end row loop | |
131 | fData.Compress(1); | |
a282bf09 | 132 | } |
133 | ||
134 | //________________________________________________________ | |
d810d0de | 135 | void AliEveTRDDigits::Paint(Option_t *option) |
a282bf09 | 136 | { |
edf0c4a0 | 137 | if(fParent->GetDigitsBox()) fBoxes.Paint(option); |
84aff7a4 | 138 | else TEveQuadSet::Paint(option); |
a282bf09 | 139 | } |
140 | ||
141 | //________________________________________________________ | |
d810d0de | 142 | void AliEveTRDDigits::Reset() |
a282bf09 | 143 | { |
84aff7a4 | 144 | TEveQuadSet::Reset(TEveQuadSet::kQT_FreeQuad, kTRUE, 64); |
32e219c2 | 145 | // MT fBoxes.fBoxes.clear(); |
a282bf09 | 146 | fData.Reset(); |
147 | } | |
148 | ||
149 | /////////////////////////////////////////////////////////// | |
d810d0de | 150 | ///////////// AliEveTRDHits ///////////////////// |
a282bf09 | 151 | /////////////////////////////////////////////////////////// |
152 | ||
153 | //________________________________________________________ | |
d810d0de | 154 | AliEveTRDHits::AliEveTRDHits(AliEveTRDChamber *p):TEvePointSet("hits", 20), fParent(p) |
edf0c4a0 | 155 | {} |
a282bf09 | 156 | |
edf0c4a0 | 157 | //________________________________________________________ |
d810d0de | 158 | void AliEveTRDHits::PointSelected(Int_t n) |
edf0c4a0 | 159 | { |
160 | fParent->SpawnEditor(); | |
161 | AliTRDhit *h = dynamic_cast<AliTRDhit*>(GetPointId(n)); | |
162 | printf("\nDetector : %d\n", h->GetDetector()); | |
163 | printf("Region of production : %c\n", h->FromAmplification() ? 'A' : 'D'); | |
164 | printf("TR photon : %s\n", h->FromTRphoton() ? "Yes" : "No"); | |
165 | printf("Charge : %d\n", h->GetCharge()); | |
166 | printf("MC track label : %d\n", h->GetTrack()); | |
167 | printf("Time from collision : %f\n", h->GetTime()); | |
a282bf09 | 168 | } |
169 | ||
edf0c4a0 | 170 | |
171 | /////////////////////////////////////////////////////////// | |
d810d0de | 172 | ///////////// AliEveTRDHits ///////////////////// |
edf0c4a0 | 173 | /////////////////////////////////////////////////////////// |
174 | ||
a282bf09 | 175 | //________________________________________________________ |
d810d0de | 176 | AliEveTRDClusters::AliEveTRDClusters(AliEveTRDChamber *p):AliEveTRDHits(p) |
edf0c4a0 | 177 | {} |
178 | ||
179 | //________________________________________________________ | |
d810d0de | 180 | void AliEveTRDClusters::PointSelected(Int_t n) |
edf0c4a0 | 181 | { |
182 | fParent->SpawnEditor(); | |
183 | AliTRDcluster *c = dynamic_cast<AliTRDcluster*>(GetPointId(n)); | |
184 | printf("\nDetector : %d\n", c->GetDetector()); | |
185 | printf("Charge : %f\n", c->GetQ()); | |
186 | printf("Sum S : %4.0f\n", c->GetSumS()); | |
187 | printf("Time bin : %d\n", c->GetLocalTimeBin()); | |
188 | printf("Signals : "); | |
189 | Short_t *cSignals = c->GetSignals(); | |
190 | for(Int_t ipad=0; ipad<7; ipad++) printf("%d ", cSignals[ipad]); printf("\n"); | |
5f97c325 | 191 | printf("Central pad : %d\n", c->GetPadCol()); |
edf0c4a0 | 192 | printf("MC track labels : "); |
193 | for(Int_t itrk=0; itrk<3; itrk++) printf("%d ", c->GetLabel(itrk)); printf("\n"); | |
194 | // Bool_t AliCluster::GetGlobalCov(Float_t* cov) const | |
195 | // Bool_t AliCluster::GetGlobalXYZ(Float_t* xyz) const | |
196 | // Float_t AliCluster::GetSigmaY2() const | |
197 | // Float_t AliCluster::GetSigmaYZ() const | |
198 | // Float_t AliCluster::GetSigmaZ2() const | |
199 | } | |
200 | ||
201 | /////////////////////////////////////////////////////////// | |
d810d0de | 202 | ///////////// AliEveTRDHitsEditor ///////////////////// |
edf0c4a0 | 203 | /////////////////////////////////////////////////////////// |
d810d0de | 204 | AliEveTRDHitsEditor::AliEveTRDHitsEditor(const TGWindow* p, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, width, height, options, back) |
edf0c4a0 | 205 | { |
206 | MakeTitle("TRD Hits"); | |
207 | ||
208 | } | |
209 | ||
d810d0de | 210 | AliEveTRDHitsEditor::~AliEveTRDHitsEditor() |
edf0c4a0 | 211 | {} |
212 | ||
d810d0de | 213 | void AliEveTRDHitsEditor::SetModel(TObject* obj) |
a282bf09 | 214 | { |
d810d0de | 215 | fM = dynamic_cast<AliEveTRDHits*>(obj); |
edf0c4a0 | 216 | |
217 | // Float_t x, y, z; | |
218 | // for(int ihit=0; ihit<fM->GetN(); ihit++){ | |
219 | // fM->GetPoint(ihit, x, y, z); | |
220 | // printf("%3d : x=%6.3f y=%6.3f z=%6.3f\n", ihit, x, y, z); | |
221 | // } | |
a282bf09 | 222 | } |
223 | ||
edf0c4a0 | 224 | /////////////////////////////////////////////////////////// |
d810d0de | 225 | ///////////// AliEveTRDDigitsEditor ///////////////////// |
edf0c4a0 | 226 | /////////////////////////////////////////////////////////// |
d810d0de | 227 | AliEveTRDDigitsEditor::AliEveTRDDigitsEditor(const TGWindow* p, Int_t width, Int_t height, UInt_t options, Pixel_t back) : TGedFrame(p, width, height, options, back) |
edf0c4a0 | 228 | { |
229 | MakeTitle("TRD Digits"); | |
230 | ||
231 | } | |
232 | ||
d810d0de | 233 | AliEveTRDDigitsEditor::~AliEveTRDDigitsEditor() |
edf0c4a0 | 234 | {} |
235 | ||
d810d0de | 236 | void AliEveTRDDigitsEditor::SetModel(TObject* obj) |
edf0c4a0 | 237 | { |
d810d0de | 238 | fM = dynamic_cast<AliEveTRDDigits*>(obj); |
edf0c4a0 | 239 | fM->fParent->SpawnEditor(); |
51346b82 | 240 | |
edf0c4a0 | 241 | // printf("Chamber %d", fM->fParent->GetID()); |
242 | // for (Int_t row = 0; row < fM->fParent->GetRowMax(); row++) | |
243 | // for (Int_t col = 0; col < fM->fParent->GetColMax(); col++) | |
244 | // for (Int_t time = 0; time < fM->fParent->GetTimeMax(); time++) { | |
245 | // printf("\tA(%d %d %d) = %d\n", row, col, time, fM->fData.GetDataUnchecked(row, col, time)); | |
246 | // } | |
247 | } |