]>
Commit | Line | Data |
---|---|---|
a282bf09 | 1 | #include "TRDData.h" |
2 | #include "TRDModuleImp.h" | |
3 | ||
4 | #include "AliTRDcalibDB.h" | |
5 | #include "AliTRDpadPlane.h" | |
6 | #include "AliTRDgeometry.h" | |
14217b5f | 7 | #include "AliTRDdigitsManager.h" |
a282bf09 | 8 | |
9 | using namespace Reve; | |
10 | using namespace Alieve; | |
11 | using namespace std; | |
12 | ||
13 | ClassImp(TRDDigits) | |
14 | ClassImp(TRDHits) | |
15 | ||
16 | /////////////////////////////////////////////////////////// | |
17 | ///////////// TRDDigits ///////////////////// | |
18 | /////////////////////////////////////////////////////////// | |
19 | ||
20 | //________________________________________________________ | |
bb299a96 | 21 | TRDDigits::TRDDigits(TRDChamber *p): OldQuadSet("digits", ""), RenderElement() |
a282bf09 | 22 | { |
23 | fChamber = p; | |
a282bf09 | 24 | } |
25 | ||
26 | //________________________________________________________ | |
14217b5f | 27 | void TRDDigits::SetData(AliTRDdigitsManager *digits) |
a282bf09 | 28 | { |
29 | ||
30 | fData.Allocate(fChamber->rowMax, fChamber->colMax, fChamber->timeMax); | |
14217b5f | 31 | // digits->Expand(); |
a282bf09 | 32 | for (Int_t row = 0; row < fChamber->rowMax; row++) |
33 | for (Int_t col = 0; col < fChamber->colMax; col++) | |
34 | for (Int_t time = 0; time < fChamber->timeMax; time++) { | |
14217b5f | 35 | if(digits->GetDigitAmp(row, col, time, fChamber->GetID()) < 0) continue; |
36 | fData.SetDataUnchecked(row, col, time, digits->GetDigitAmp(row, col, time, fChamber->GetID())); | |
a282bf09 | 37 | } |
38 | } | |
39 | ||
40 | //________________________________________________________ | |
41 | void TRDDigits::ComputeRepresentation() | |
42 | { | |
43 | // Calculate digits representation according to user settings. The | |
44 | // user can set the following parameters: | |
45 | // - digits scale (log/lin) | |
46 | // - digits threshold | |
47 | // - digits apparence (quads/boxes) | |
48 | ||
49 | fQuads.clear(); | |
50 | fBoxes.fBoxes.clear(); | |
51 | ||
52 | Double_t colSize, rowSize, scale; | |
53 | Double_t x, y, z; | |
54 | ||
55 | Int_t charge; | |
56 | Float_t t0; | |
57 | Float_t timeBinSize; | |
58 | ||
59 | AliTRDcalibDB* calibration = AliTRDcalibDB::Instance(); | |
60 | Double_t cloc[4][3], cglo[3]; | |
61 | Int_t color, dimension; | |
62 | fData.Expand(); | |
63 | for (Int_t row = 0; row < fChamber->rowMax; row++) { | |
64 | rowSize = .5 * fChamber->fPadPlane->GetRowSize(row); | |
65 | z = fChamber->fPadPlane->GetRowPos(row) - rowSize; | |
66 | ||
67 | for (Int_t col = 0; col < fChamber->colMax; col++) { | |
68 | colSize = .5 * fChamber->fPadPlane->GetColSize(col); | |
69 | y = fChamber->fPadPlane->GetColPos(col) - colSize; | |
70 | t0 = calibration->GetT0(fChamber->fDet, col, row); | |
71 | timeBinSize = calibration->GetVdrift(fChamber->fDet, col, row)/fChamber->samplingFrequency; | |
72 | ||
73 | for (Int_t time = 0; time < fChamber->timeMax; time++) { | |
74 | charge = fData.GetDataUnchecked(row, col, time); | |
14217b5f | 75 | if (charge < fChamber->GetDigitsThreshold()) continue; |
a282bf09 | 76 | |
77 | x = fChamber->fX0 - (time+0.5-t0)*timeBinSize; | |
14217b5f | 78 | scale = fChamber->GetDigitsLog() ? TMath::Log(float(charge))/TMath::Log(1024.) : charge/1024.; |
a282bf09 | 79 | color = 50+int(scale*50.); |
80 | ||
81 | cloc[0][2] = z - rowSize * scale; | |
82 | cloc[0][1] = y - colSize * scale; | |
83 | cloc[0][0] = x; | |
84 | ||
85 | cloc[1][2] = z - rowSize * scale; | |
86 | cloc[1][1] = y + colSize * scale; | |
87 | cloc[1][0] = x; | |
88 | ||
89 | cloc[2][2] = z + rowSize * scale; | |
90 | cloc[2][1] = y + colSize * scale; | |
91 | cloc[2][0] = x; | |
92 | ||
93 | cloc[3][2] = z + rowSize * scale; | |
94 | cloc[3][1] = y - colSize * scale; | |
95 | cloc[3][0] = x; | |
96 | ||
97 | Float_t* p; | |
14217b5f | 98 | if( fChamber->GetDigitsBox()){ |
a282bf09 | 99 | fBoxes.fBoxes.push_back(Reve::Box()); |
100 | fBoxes.fBoxes.back().color[0] = (UChar_t)color; | |
101 | fBoxes.fBoxes.back().color[1] = (UChar_t)color; | |
102 | fBoxes.fBoxes.back().color[2] = (UChar_t)color; | |
103 | fBoxes.fBoxes.back().color[3] = (UChar_t)color; | |
104 | p = fBoxes.fBoxes.back().vertices; | |
105 | dimension = 2; | |
106 | } else { | |
107 | fQuads.push_back(Reve::Quad()); | |
108 | fQuads.back().ColorFromIdx(color); | |
109 | p = fQuads.back().vertices; | |
110 | dimension = 1; | |
111 | } | |
112 | ||
113 | for(int id=0; id<dimension; id++) | |
114 | for (Int_t ic = 0; ic < 4; ic++) { | |
115 | cloc[ic][0] -= .5 * id * timeBinSize; | |
116 | fChamber->fGeo->RotateBack(fChamber->fDet,cloc[ic],cglo); | |
117 | p[0] = cglo[0]; p[1] = cglo[1]; p[2] = cglo[2]; | |
118 | p+=3; | |
119 | } | |
120 | } // end time loop | |
121 | } // end col loop | |
122 | } // end row loop | |
123 | fData.Compress(1); | |
124 | } | |
125 | ||
126 | //________________________________________________________ | |
127 | void TRDDigits::Paint(Option_t *option) | |
128 | { | |
14217b5f | 129 | if(fChamber->GetDigitsBox()) fBoxes.Paint(option); |
bb299a96 | 130 | else OldQuadSet::Paint(option); |
a282bf09 | 131 | } |
132 | ||
133 | //________________________________________________________ | |
134 | void TRDDigits::Reset() | |
135 | { | |
136 | fQuads.clear(); | |
137 | fBoxes.fBoxes.clear(); | |
138 | fData.Reset(); | |
139 | } | |
140 | ||
141 | /////////////////////////////////////////////////////////// | |
142 | ///////////// TRDHits ///////////////////// | |
143 | /////////////////////////////////////////////////////////// | |
144 | ||
145 | //________________________________________________________ | |
146 | TRDHits::TRDHits(const Text_t* name, Int_t n_points):PointSet(name, n_points) | |
147 | { | |
148 | ||
149 | } | |
150 | ||
151 | //________________________________________________________ | |
152 | void TRDHits::PointSelected(Int_t n) | |
153 | { | |
154 | printf("void TRDHits::PointSelected(%d)\n", n); | |
155 | // printf("Detector %d\n", ((TRDChamber*)GetPointId(n))->GetDetector()); | |
156 | } | |
157 |