]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/ITSDigitsInfo.cxx
Check ownership of quad-ids in Reset().
[u/mrichter/AliRoot.git] / EVE / Alieve / ITSDigitsInfo.cxx
CommitLineData
5a5a1232 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
265ecb21 24ITSDigitsInfo::ITSDigitsInfo() :
25 TObject(),
d54c094e 26 ReferenceCount(),
265ecb21 27 fSPDmap(), fSDDmap(), fSSDmap(),
28 fTree (0),
29 fGeom (0),
30 fSegSPD(0), fSegSDD(0), fSegSSD(0)
31{}
5a5a1232 32
33/**************************************************************************/
34
35ITSDigitsInfo:: ~ITSDigitsInfo()
36{
d54c094e 37 map<Int_t, TClonesArray*>::iterator j;
38 for(j = fSPDmap.begin(); j != fSPDmap.end(); ++j)
5a5a1232 39 delete j->second;
d54c094e 40 for(j = fSDDmap.begin(); j != fSDDmap.end(); ++j)
5a5a1232 41 delete j->second;
d54c094e 42 for(j = fSSDmap.begin(); j != fSSDmap.end(); ++j)
5a5a1232 43 delete j->second;
d54c094e 44
5a5a1232 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
d54c094e 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
5a5a1232 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
d54c094e 104 fSPDScaleX[0] = 1;
105 fSPDScaleZ[0] = 1;
106 fSDDScaleX[0] = 1;
107 fSDDScaleZ[0] = 1;
108 fSSDScale [0] = 1;
5a5a1232 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 fTree->SetBranchAddress("ITSDigitsSPD",&digitsSPD);
166 fTree->GetEntry(mod);
167 fSPDmap[mod] = digitsSPD;
168 return digitsSPD;
d54c094e 169 } else {
5a5a1232 170 return i->second;
171 }
172 break;
173 }
174 case 1: {
175 TClonesArray* digitsSDD = 0;
176 map<Int_t, TClonesArray*>::iterator i = fSDDmap.find(mod);
177 if(i == fSDDmap.end()) {
178 fTree->SetBranchAddress("ITSDigitsSDD",&digitsSDD);
179 fTree->GetEntry(mod);
180 fSDDmap[mod] = digitsSDD;
181 return digitsSDD;
d54c094e 182 } else {
5a5a1232 183 return i->second;
184 }
185 break;
186 }
187 case 2: {
188 TClonesArray* digitsSSD = 0;
189 map<Int_t, TClonesArray*>::iterator i = fSSDmap.find(mod);
190 if(i == fSSDmap.end()) {
191 fTree->SetBranchAddress("ITSDigitsSSD",&digitsSSD);
192 fTree->GetEntry(mod);
193 fSSDmap[mod] = digitsSSD;
194 return digitsSSD;
d54c094e 195 } else {
5a5a1232 196 return i->second;
197 }
198 break;
199 }
200 default:
201 return 0;
202 } //end switch
03ecfe88 203 return 0;
5a5a1232 204}
205
206
207/**************************************************************************/
208
209void ITSDigitsInfo::Print(Option_t* ) const
210{
211 printf("*********************************************************\n");
212 printf("SPD module dimension (%f,%f) \n",fSegSPD->Dx()*0.0001, fSegSPD->Dz()*0.0001);
213 printf("SPD first,last module:: %d,%d \n", fGeom->GetStartSPD(),fGeom->GetLastSPD() );
214 printf("SPD num cells per module (x::%d,z::%d)\n",fSegSPD->Npx(), fSegSPD->Npz());
215 Int_t iz=0,ix = 0;
216 printf("SPD dimesion of (%d,%d) in pixel(%f,%f) \n", ix,iz, fSegSPD->Dpx(ix), fSegSPD->Dpz(iz));
217 iz = 32;
218 printf("SPD dimesion of pixel (%d,%d) are (%f,%f) \n", ix,iz, fSegSPD->Dpx(ix)*0.001, fSegSPD->Dpz(iz)*0.001);
219
220 printf("*********************************************************\n");
221 printf("SDD module dimension (%f,%f) \n",fSegSDD->Dx()*0.0001, fSegSDD->Dz()*0.0001);
222 printf("SDD first,last module:: %d,%d \n", fGeom->GetStartSDD(),fGeom->GetLastSDD() );
223 printf("SDD num cells per module (x::%d,z::%d)\n",fSegSDD->Npx(), fSegSDD->Npz());
224 printf("SDD dimesion of pixel are (%f,%f) \n", fSegSDD->Dpx(1)*0.001,fSegSDD->Dpz(1)*0.001);
225 printf("*********************************************************\n");
226 printf("SSD module dimension (%f,%f) \n",fSegSSD->Dx()*0.0001, fSegSSD->Dz()*0.0001);
227 printf("SSD first,last module:: %d,%d \n", fGeom->GetStartSSD(),fGeom->GetLastSSD() );
228 printf("SSD strips in module %d \n",fSegSSD->Npx());
229 printf("SSD strip sizes are (%f,%f) \n", fSegSSD->Dpx(1),fSegSSD->Dpz(1));
230 fSegSSD->SetLayer(5); Float_t ap,an; fSegSSD->Angles(ap,an);
231 printf("SSD layer 5 stereoP %f stereoN %f angle \n",ap,an);
232 fSegSSD->SetLayer(6); fSegSSD->Angles(ap,an);
233 printf("SSD layer 6 stereoP %f stereoN %f angle \n",ap,an);
234}
235
236
237/*
238 printf("num cells %d,%d scaled %d,%d \n",fSegSPD->Npz(),fSegSPD->Npx(),Nz,Nx);
239 printf("%d digits in ITSModule %d\n",ne, module);
240 Float_t zn = i*(3.48*2)/Nz - 3.48 ;
241 Float_t xo = -fSegSPD->Dx()*0.00005 + fSegSPD->Dpx(0)*od->GetCoord2()*0.0001;
242 Float_t xn = -fSegSPD->Dx()*0.00005 + j*0.0001*fSegSPD->Dx()/Nx;
243 Float_t dpx = 0.0001*fSegSPD->Dx()/Nx;
244 Float_t dpz = 3.48*2/Nz;
245 printf("Z::original (%3f) scaled (%3f, %3f) \n", zo, zn-dpz/2, zn+dpz/2);
246 printf("X::original (%3f) scaled (%3f, %3f) \n", xo, xn-dpx/2, xn+dpx/2);
247 printf("%d,%d maped to %d,%d \n", od->GetCoord1(), od->GetCoord2(), i,j );
248*/