5a5a1232 |
1 | // $Header$ |
2 | |
3 | //__________________________________________________________________________ |
4 | // ITSDigitsInfo |
5 | // |
6 | // |
7 | |
8 | #include <Reve/TTreeTools.h> |
9 | |
10 | #include "ITSDigitsInfo.h" |
5a5a1232 |
11 | #include <AliITSCalibrationSDD.h> |
12 | #include <AliITSdigit.h> |
13 | #include <AliITSdigitSPD.h> |
14 | |
15 | using namespace Reve; |
16 | using namespace Alieve; |
17 | using namespace std; |
18 | |
19 | ClassImp(ITSDigitsInfo) |
20 | |
21 | /**************************************************************************/ |
22 | |
265ecb21 |
23 | ITSDigitsInfo::ITSDigitsInfo() : |
24 | TObject(), |
d54c094e |
25 | ReferenceCount(), |
265ecb21 |
26 | fSPDmap(), fSDDmap(), fSSDmap(), |
27 | fTree (0), |
28 | fGeom (0), |
29 | fSegSPD(0), fSegSDD(0), fSegSSD(0) |
30 | {} |
5a5a1232 |
31 | |
32 | /**************************************************************************/ |
33 | |
34 | ITSDigitsInfo:: ~ITSDigitsInfo() |
35 | { |
d54c094e |
36 | map<Int_t, TClonesArray*>::iterator j; |
37 | for(j = fSPDmap.begin(); j != fSPDmap.end(); ++j) |
5a5a1232 |
38 | delete j->second; |
d54c094e |
39 | for(j = fSDDmap.begin(); j != fSDDmap.end(); ++j) |
5a5a1232 |
40 | delete j->second; |
d54c094e |
41 | for(j = fSSDmap.begin(); j != fSSDmap.end(); ++j) |
5a5a1232 |
42 | delete j->second; |
d54c094e |
43 | |
5a5a1232 |
44 | delete fSegSPD; delete fSegSDD; delete fSegSSD; |
45 | delete fGeom; |
46 | delete fTree; |
47 | } |
48 | |
49 | /**************************************************************************/ |
50 | |
51 | void ITSDigitsInfo::SetTree(TTree* tree) |
52 | { |
53 | static const Exc_t eH("ITSDigitsInfo::SetTree "); |
54 | |
55 | if(fGeom == 0) { |
56 | fGeom = new AliITSgeom(); |
57 | fGeom->ReadNewFile("$REVESYS/alice-data/ITSgeometry.det"); |
58 | if(fGeom == 0) |
59 | throw(eH + "can not load ITS geometry \n"); |
60 | } |
61 | |
62 | fTree = tree; |
63 | |
64 | SetITSSegmentation(); |
d4b6a94c |
65 | |
5a5a1232 |
66 | // create tables for scaling |
d4b6a94c |
67 | fSPDMinVal = 0; |
68 | fSDDMinVal = 5; |
69 | fSSDMinVal = 2; |
70 | |
71 | fSPDMaxVal = 1; |
72 | fSDDMaxVal = 80; |
73 | fSSDMaxVal = 100; |
74 | |
75 | fSPDMaxOcc = 0.15; |
76 | fSDDMaxOcc = 0.15; |
77 | fSSDMaxOcc = 0.3; |
78 | |
d54c094e |
79 | // lowest scale factor refers to unscaled ITS module |
80 | fSPDScaleX[0] = 1; |
81 | fSPDScaleZ[0] = 1; |
82 | fSDDScaleX[0] = 1; |
83 | fSDDScaleZ[0] = 1; |
84 | fSSDScale [0] = 1; |
d4b6a94c |
85 | |
d54c094e |
86 | // spd lows resolution is in the level of 8x2 readout chips |
5a5a1232 |
87 | Int_t nx = 8; // fSegSPD->Npx()/8; // 32 |
88 | Int_t nz = 6; // fSegSPD->Npz()/2; // 128 |
89 | |
90 | fSPDScaleX[1] = Int_t(nx); |
91 | fSPDScaleZ[1] = Int_t(nz); |
92 | fSPDScaleX[2] = Int_t(nx*2); |
93 | fSPDScaleZ[2] = Int_t(nz*2); |
94 | fSPDScaleX[3] = Int_t(nx*3); |
95 | fSPDScaleZ[3] = Int_t(nz*3); |
96 | fSPDScaleX[4] = Int_t(nx*4); |
97 | fSPDScaleZ[4] = Int_t(nz*4); |
98 | |
5a5a1232 |
99 | fSDDScaleX[1] = 2; |
100 | fSDDScaleZ[1] = 2; |
101 | fSDDScaleX[2] = 8; |
102 | fSDDScaleZ[2] = 8; |
103 | fSDDScaleX[3] = 16; |
104 | fSDDScaleZ[3] = 16; |
105 | fSDDScaleX[4] = 25; |
106 | fSDDScaleZ[4] = 25; |
107 | |
108 | fSSDScale[1] = 3; |
109 | fSSDScale[2] = 9; |
110 | fSSDScale[3] = 20; |
111 | fSSDScale[4] = 30; |
5a5a1232 |
112 | } |
113 | |
114 | /**************************************************************************/ |
115 | |
116 | void ITSDigitsInfo::SetITSSegmentation() |
117 | { |
118 | // SPD |
119 | fSegSPD = new AliITSsegmentationSPD(fGeom); |
120 | //SPD geometry |
121 | Int_t m; |
122 | Float_t fNzSPD=160; |
123 | Float_t fZ1pitchSPD=0.0425; Float_t fZ2pitchSPD=0.0625; |
124 | Float_t fHlSPD=3.48; |
125 | |
126 | fSPDZCoord[0]=fZ1pitchSPD -fHlSPD; |
127 | for (m=1; m<fNzSPD; m++) { |
128 | Double_t dz=fZ1pitchSPD; |
129 | if (m==31 || m==32 || m==63 || m==64 || m==95 || m==96 || |
130 | m==127 || m==128) dz=fZ2pitchSPD; |
131 | fSPDZCoord[m]=fSPDZCoord[m-1]+dz; |
132 | } |
133 | |
134 | for (m=0; m<fNzSPD; m++) { |
135 | Double_t dz=1.*fZ1pitchSPD; |
136 | if (m==31 || m==32 || m==63 || m==64 || m==95 || m==96 || |
137 | m==127 || m==128) dz=1.*fZ2pitchSPD; |
138 | fSPDZCoord[m]-=dz; |
139 | } |
140 | |
141 | // end of SPD geometry |
142 | |
143 | // SDD |
144 | // response replaced by Calibration (March 2006). |
145 | AliITSresponseSDD* resp1 = new AliITSresponseSDD(); |
146 | AliITSCalibrationSDD* cal1 = new AliITSCalibrationSDD; |
147 | cal1->SetResponse(resp1); |
148 | fSegSDD = new AliITSsegmentationSDD(fGeom, cal1); |
149 | |
150 | // SSD |
151 | fSegSSD = new AliITSsegmentationSSD(fGeom); |
152 | } |
153 | |
154 | void ITSDigitsInfo::GetSPDLocalZ(Int_t j, Float_t& z) |
155 | { |
156 | z = fSPDZCoord[j]; |
157 | } |
158 | |
159 | /**************************************************************************/ |
160 | |
161 | TClonesArray* ITSDigitsInfo::GetDigits(Int_t mod, Int_t subdet) |
162 | { |
163 | switch(subdet) { |
6ddaaee3 |
164 | case 0: { |
165 | TClonesArray* digitsSPD = 0; |
166 | map<Int_t, TClonesArray*>::iterator i = fSPDmap.find(mod); |
167 | if(i == fSPDmap.end()) { |
168 | TBranch* br = fTree->GetBranch("ITSDigitsSPD"); |
169 | br->SetAddress(&digitsSPD); |
170 | br->GetEntry(mod); |
171 | fSPDmap[mod] = digitsSPD; |
172 | return digitsSPD; |
173 | } else { |
174 | return i->second; |
175 | } |
176 | break; |
5a5a1232 |
177 | } |
6ddaaee3 |
178 | case 1: { |
179 | TClonesArray* digitsSDD = 0; |
180 | map<Int_t, TClonesArray*>::iterator i = fSDDmap.find(mod); |
181 | if(i == fSDDmap.end()) { |
182 | TBranch* br = fTree->GetBranch("ITSDigitsSDD"); |
183 | br->SetAddress(&digitsSDD); |
184 | br->GetEntry(mod); |
185 | fSDDmap[mod] = digitsSDD; |
186 | return digitsSDD; |
187 | } else { |
188 | return i->second; |
189 | } |
190 | break; |
5a5a1232 |
191 | } |
6ddaaee3 |
192 | case 2: { |
193 | TClonesArray* digitsSSD = 0; |
194 | map<Int_t, TClonesArray*>::iterator i = fSSDmap.find(mod); |
195 | if(i == fSSDmap.end()) { |
196 | TBranch* br = fTree->GetBranch("ITSDigitsSSD"); |
197 | br->SetAddress(&digitsSSD); |
198 | br->GetEntry(mod); |
199 | |
200 | fSSDmap[mod] = digitsSSD; |
201 | return digitsSSD; |
202 | } else { |
203 | return i->second; |
204 | } |
205 | break; |
5a5a1232 |
206 | } |
6ddaaee3 |
207 | default: |
208 | return 0; |
5a5a1232 |
209 | } //end switch |
03ecfe88 |
210 | return 0; |
5a5a1232 |
211 | } |
212 | |
213 | |
214 | /**************************************************************************/ |
215 | |
216 | void ITSDigitsInfo::Print(Option_t* ) const |
217 | { |
218 | printf("*********************************************************\n"); |
219 | printf("SPD module dimension (%f,%f) \n",fSegSPD->Dx()*0.0001, fSegSPD->Dz()*0.0001); |
220 | printf("SPD first,last module:: %d,%d \n", fGeom->GetStartSPD(),fGeom->GetLastSPD() ); |
221 | printf("SPD num cells per module (x::%d,z::%d)\n",fSegSPD->Npx(), fSegSPD->Npz()); |
222 | Int_t iz=0,ix = 0; |
223 | printf("SPD dimesion of (%d,%d) in pixel(%f,%f) \n", ix,iz, fSegSPD->Dpx(ix), fSegSPD->Dpz(iz)); |
224 | iz = 32; |
225 | printf("SPD dimesion of pixel (%d,%d) are (%f,%f) \n", ix,iz, fSegSPD->Dpx(ix)*0.001, fSegSPD->Dpz(iz)*0.001); |
226 | |
227 | printf("*********************************************************\n"); |
228 | printf("SDD module dimension (%f,%f) \n",fSegSDD->Dx()*0.0001, fSegSDD->Dz()*0.0001); |
229 | printf("SDD first,last module:: %d,%d \n", fGeom->GetStartSDD(),fGeom->GetLastSDD() ); |
230 | printf("SDD num cells per module (x::%d,z::%d)\n",fSegSDD->Npx(), fSegSDD->Npz()); |
231 | printf("SDD dimesion of pixel are (%f,%f) \n", fSegSDD->Dpx(1)*0.001,fSegSDD->Dpz(1)*0.001); |
232 | printf("*********************************************************\n"); |
233 | printf("SSD module dimension (%f,%f) \n",fSegSSD->Dx()*0.0001, fSegSSD->Dz()*0.0001); |
234 | printf("SSD first,last module:: %d,%d \n", fGeom->GetStartSSD(),fGeom->GetLastSSD() ); |
235 | printf("SSD strips in module %d \n",fSegSSD->Npx()); |
236 | printf("SSD strip sizes are (%f,%f) \n", fSegSSD->Dpx(1),fSegSSD->Dpz(1)); |
237 | fSegSSD->SetLayer(5); Float_t ap,an; fSegSSD->Angles(ap,an); |
238 | printf("SSD layer 5 stereoP %f stereoN %f angle \n",ap,an); |
239 | fSegSSD->SetLayer(6); fSegSSD->Angles(ap,an); |
240 | printf("SSD layer 6 stereoP %f stereoN %f angle \n",ap,an); |
241 | } |
242 | |
243 | |
244 | /* |
245 | printf("num cells %d,%d scaled %d,%d \n",fSegSPD->Npz(),fSegSPD->Npx(),Nz,Nx); |
246 | printf("%d digits in ITSModule %d\n",ne, module); |
247 | Float_t zn = i*(3.48*2)/Nz - 3.48 ; |
248 | Float_t xo = -fSegSPD->Dx()*0.00005 + fSegSPD->Dpx(0)*od->GetCoord2()*0.0001; |
249 | Float_t xn = -fSegSPD->Dx()*0.00005 + j*0.0001*fSegSPD->Dx()/Nx; |
250 | Float_t dpx = 0.0001*fSegSPD->Dx()/Nx; |
251 | Float_t dpz = 3.48*2/Nz; |
252 | printf("Z::original (%3f) scaled (%3f, %3f) \n", zo, zn-dpz/2, zn+dpz/2); |
253 | printf("X::original (%3f) scaled (%3f, %3f) \n", xo, xn-dpx/2, xn+dpx/2); |
254 | printf("%d,%d maped to %d,%d \n", od->GetCoord1(), od->GetCoord2(), i,j ); |
255 | */ |