]>
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" | |
7 | ||
8 | using namespace Reve; | |
9 | using namespace Alieve; | |
10 | using namespace std; | |
11 | ||
12 | ClassImp(TRDDigits) | |
13 | ClassImp(TRDHits) | |
14 | ||
15 | /////////////////////////////////////////////////////////// | |
16 | ///////////// TRDDigits ///////////////////// | |
17 | /////////////////////////////////////////////////////////// | |
18 | ||
19 | //________________________________________________________ | |
20 | TRDDigits::TRDDigits(TRDChamber *p): QuadSet("digits", ""), RenderElement() | |
21 | { | |
22 | fChamber = p; | |
23 | ||
24 | kLog = kFALSE; | |
25 | kBox = kFALSE; | |
26 | fThreshold = 10; | |
27 | } | |
28 | ||
29 | //________________________________________________________ | |
30 | void TRDDigits::SetData(AliTRDdataArrayI *digits) | |
31 | { | |
32 | ||
33 | fData.Allocate(fChamber->rowMax, fChamber->colMax, fChamber->timeMax); | |
34 | digits->Expand(); | |
35 | for (Int_t row = 0; row < fChamber->rowMax; row++) | |
36 | for (Int_t col = 0; col < fChamber->colMax; col++) | |
37 | for (Int_t time = 0; time < fChamber->timeMax; time++) { | |
38 | // if(digits->GetDataUnchecked(row, col, time) > 20) printf("%d %d %d %d\n", row, col, time, digits->GetDataUnchecked(row, col, time)); | |
39 | fData.SetDataUnchecked(row, col, time, digits->GetDataUnchecked(row, col, time)); | |
40 | } | |
41 | } | |
42 | ||
43 | //________________________________________________________ | |
44 | void 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(); | |
66 | for (Int_t row = 0; row < fChamber->rowMax; row++) { | |
67 | rowSize = .5 * fChamber->fPadPlane->GetRowSize(row); | |
68 | z = fChamber->fPadPlane->GetRowPos(row) - rowSize; | |
69 | ||
70 | for (Int_t col = 0; col < fChamber->colMax; col++) { | |
71 | colSize = .5 * fChamber->fPadPlane->GetColSize(col); | |
72 | y = fChamber->fPadPlane->GetColPos(col) - colSize; | |
73 | t0 = calibration->GetT0(fChamber->fDet, col, row); | |
74 | timeBinSize = calibration->GetVdrift(fChamber->fDet, col, row)/fChamber->samplingFrequency; | |
75 | ||
76 | for (Int_t time = 0; time < fChamber->timeMax; time++) { | |
77 | charge = fData.GetDataUnchecked(row, col, time); | |
78 | if (charge < fThreshold) continue; | |
79 | ||
80 | x = fChamber->fX0 - (time+0.5-t0)*timeBinSize; | |
81 | scale = kLog ? TMath::Log(float(charge))/TMath::Log(1024.) : charge/1024.; | |
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; | |
101 | if(kBox){ | |
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; | |
119 | fChamber->fGeo->RotateBack(fChamber->fDet,cloc[ic],cglo); | |
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 | //________________________________________________________ | |
130 | void TRDDigits::Paint(Option_t *option) | |
131 | { | |
132 | if(kBox) fBoxes.Paint(option); | |
133 | else QuadSet::Paint(option); | |
134 | } | |
135 | ||
136 | //________________________________________________________ | |
137 | void TRDDigits::Reset() | |
138 | { | |
139 | fQuads.clear(); | |
140 | fBoxes.fBoxes.clear(); | |
141 | fData.Reset(); | |
142 | } | |
143 | ||
144 | /////////////////////////////////////////////////////////// | |
145 | ///////////// TRDHits ///////////////////// | |
146 | /////////////////////////////////////////////////////////// | |
147 | ||
148 | //________________________________________________________ | |
149 | TRDHits::TRDHits(const Text_t* name, Int_t n_points):PointSet(name, n_points) | |
150 | { | |
151 | ||
152 | } | |
153 | ||
154 | //________________________________________________________ | |
155 | void TRDHits::PointSelected(Int_t n) | |
156 | { | |
157 | printf("void TRDHits::PointSelected(%d)\n", n); | |
158 | // printf("Detector %d\n", ((TRDChamber*)GetPointId(n))->GetDetector()); | |
159 | } | |
160 |