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