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