3 //__________________________________________________________________________
10 #include <Reve/TTreeTools.h>
11 #include <Reve/ZTrans.h>
13 #include "ITSDigitsInfo.h"
14 #include <AliITSCalibrationSDD.h>
15 #include <AliITSdigit.h>
16 #include <AliITSdigitSPD.h>
20 using namespace Alieve;
24 ClassImp(ITSModuleSelection)
26 ITSModuleSelection::ITSModuleSelection():
30 fMaxPhi(2*TMath::Pi()),
32 fMaxTheta(2*TMath::Pi())
36 ClassImp(ITSDigitsInfo)
38 /**************************************************************************/
40 ITSDigitsInfo::ITSDigitsInfo() :
43 fSPDmap(), fSDDmap(), fSSDmap(),
46 fSegSPD(0), fSegSDD(0), fSegSSD(0)
49 /**************************************************************************/
51 ITSDigitsInfo:: ~ITSDigitsInfo()
53 map<Int_t, TClonesArray*>::iterator j;
54 for(j = fSPDmap.begin(); j != fSPDmap.end(); ++j)
56 for(j = fSDDmap.begin(); j != fSDDmap.end(); ++j)
58 for(j = fSSDmap.begin(); j != fSSDmap.end(); ++j)
61 delete fSegSPD; delete fSegSDD; delete fSegSSD;
66 /**************************************************************************/
68 void ITSDigitsInfo::SetTree(TTree* tree)
70 static const Exc_t eH("ITSDigitsInfo::SetTree ");
73 fGeom = new AliITSgeom();
74 fGeom->ReadNewFile("$REVESYS/alice-data/ITSgeometry.det");
76 throw(eH + "can not load ITS geometry \n");
83 // create tables for scaling
96 // lowest scale factor refers to unscaled ITS module
103 // spd lows resolution is in the level of 8x2 readout chips
104 Int_t nx = 8; // fSegSPD->Npx()/8; // 32
105 Int_t nz = 6; // fSegSPD->Npz()/2; // 128
107 fSPDScaleX[1] = Int_t(nx);
108 fSPDScaleZ[1] = Int_t(nz);
109 fSPDScaleX[2] = Int_t(nx*2);
110 fSPDScaleZ[2] = Int_t(nz*2);
111 fSPDScaleX[3] = Int_t(nx*3);
112 fSPDScaleZ[3] = Int_t(nz*3);
113 fSPDScaleX[4] = Int_t(nx*4);
114 fSPDScaleZ[4] = Int_t(nz*4);
131 /**************************************************************************/
133 void ITSDigitsInfo::SetITSSegmentation()
136 fSegSPD = new AliITSsegmentationSPD(fGeom);
140 Float_t fZ1pitchSPD=0.0425; Float_t fZ2pitchSPD=0.0625;
143 fSPDZCoord[0]=fZ1pitchSPD -fHlSPD;
144 for (m=1; m<fNzSPD; m++) {
145 Double_t dz=fZ1pitchSPD;
146 if (m==31 || m==32 || m==63 || m==64 || m==95 || m==96 ||
147 m==127 || m==128) dz=fZ2pitchSPD;
148 fSPDZCoord[m]=fSPDZCoord[m-1]+dz;
151 for (m=0; m<fNzSPD; m++) {
152 Double_t dz=1.*fZ1pitchSPD;
153 if (m==31 || m==32 || m==63 || m==64 || m==95 || m==96 ||
154 m==127 || m==128) dz=1.*fZ2pitchSPD;
158 // end of SPD geometry
161 // response replaced by Calibration (March 2006).
162 AliITSresponseSDD* resp1 = new AliITSresponseSDD();
163 AliITSCalibrationSDD* cal1 = new AliITSCalibrationSDD;
164 cal1->SetResponse(resp1);
165 fSegSDD = new AliITSsegmentationSDD(fGeom, cal1);
168 fSegSSD = new AliITSsegmentationSSD(fGeom);
171 void ITSDigitsInfo::GetSPDLocalZ(Int_t j, Float_t& z)
176 /**************************************************************************/
178 TClonesArray* ITSDigitsInfo::GetDigits(Int_t mod, Int_t subdet)
182 TClonesArray* digitsSPD = 0;
183 map<Int_t, TClonesArray*>::iterator i = fSPDmap.find(mod);
184 if(i == fSPDmap.end()) {
185 TBranch* br = fTree->GetBranch("ITSDigitsSPD");
186 br->SetAddress(&digitsSPD);
188 fSPDmap[mod] = digitsSPD;
196 TClonesArray* digitsSDD = 0;
197 map<Int_t, TClonesArray*>::iterator i = fSDDmap.find(mod);
198 if(i == fSDDmap.end()) {
199 TBranch* br = fTree->GetBranch("ITSDigitsSDD");
200 br->SetAddress(&digitsSDD);
202 fSDDmap[mod] = digitsSDD;
210 TClonesArray* digitsSSD = 0;
211 map<Int_t, TClonesArray*>::iterator i = fSSDmap.find(mod);
212 if(i == fSSDmap.end()) {
213 TBranch* br = fTree->GetBranch("ITSDigitsSSD");
214 br->SetAddress(&digitsSSD);
217 fSSDmap[mod] = digitsSSD;
230 /**************************************************************************/
231 void ITSDigitsInfo::GetModuleIDs(ITSModuleSelection* sel, std::vector<UInt_t>& ids)
234 Int_t idx0 = 0, idx1 = 0;
239 idx1 = fGeom->GetLastSPD();
242 idx0 = fGeom->GetLastSPD();
243 idx1 = fGeom->GetLastSDD();
246 idx0 = fGeom->GetLastSDD();
247 idx1 = fGeom->GetLastSSD();
251 idx1 = fGeom->GetLastSSD();
258 for(Int_t id = idx0; id<idx1; id++){
259 fGeom->GetModuleId(id, lay, lad, det);
260 if(sel->fLayer==lay || sel->fLayer==-1)
262 // check data from matrix
264 fGeom->GetRotMatrix(id, x);
265 mx.SetBaseVec(1, x[0], x[3], x[6]);
266 mx.SetBaseVec(2, x[1], x[4], x[7]);
267 mx.SetBaseVec(3, x[2], x[5], x[8]);
268 fGeom->GetTrans(id, x);
271 if(v.Phi()<sel->fMaxPhi && v.Phi()>sel->fMinPhi &&
272 v.Theta()<sel->fMaxTheta && v.Theta()>sel->fMinTheta )
278 /**************************************************************************/
280 void ITSDigitsInfo::Print(Option_t* ) const
282 printf("*********************************************************\n");
283 printf("SPD module dimension (%f,%f) \n",fSegSPD->Dx()*0.0001, fSegSPD->Dz()*0.0001);
284 printf("SPD first,last module:: %d,%d \n", fGeom->GetStartSPD(),fGeom->GetLastSPD() );
285 printf("SPD num cells per module (x::%d,z::%d)\n",fSegSPD->Npx(), fSegSPD->Npz());
287 printf("SPD dimesion of (%d,%d) in pixel(%f,%f) \n", ix,iz, fSegSPD->Dpx(ix), fSegSPD->Dpz(iz));
289 printf("SPD dimesion of pixel (%d,%d) are (%f,%f) \n", ix,iz, fSegSPD->Dpx(ix)*0.001, fSegSPD->Dpz(iz)*0.001);
291 printf("*********************************************************\n");
292 printf("SDD module dimension (%f,%f) \n",fSegSDD->Dx()*0.0001, fSegSDD->Dz()*0.0001);
293 printf("SDD first,last module:: %d,%d \n", fGeom->GetStartSDD(),fGeom->GetLastSDD() );
294 printf("SDD num cells per module (x::%d,z::%d)\n",fSegSDD->Npx(), fSegSDD->Npz());
295 printf("SDD dimesion of pixel are (%f,%f) \n", fSegSDD->Dpx(1)*0.001,fSegSDD->Dpz(1)*0.001);
296 printf("*********************************************************\n");
297 printf("SSD module dimension (%f,%f) \n",fSegSSD->Dx()*0.0001, fSegSSD->Dz()*0.0001);
298 printf("SSD first,last module:: %d,%d \n", fGeom->GetStartSSD(),fGeom->GetLastSSD() );
299 printf("SSD strips in module %d \n",fSegSSD->Npx());
300 printf("SSD strip sizes are (%f,%f) \n", fSegSSD->Dpx(1),fSegSSD->Dpz(1));
301 fSegSSD->SetLayer(5); Float_t ap,an; fSegSSD->Angles(ap,an);
302 printf("SSD layer 5 stereoP %f stereoN %f angle \n",ap,an);
303 fSegSSD->SetLayer(6); fSegSSD->Angles(ap,an);
304 printf("SSD layer 6 stereoP %f stereoN %f angle \n",ap,an);
309 printf("num cells %d,%d scaled %d,%d \n",fSegSPD->Npz(),fSegSPD->Npx(),Nz,Nx);
310 printf("%d digits in ITSModule %d\n",ne, module);
311 Float_t zn = i*(3.48*2)/Nz - 3.48 ;
312 Float_t xo = -fSegSPD->Dx()*0.00005 + fSegSPD->Dpx(0)*od->GetCoord2()*0.0001;
313 Float_t xn = -fSegSPD->Dx()*0.00005 + j*0.0001*fSegSPD->Dx()/Nx;
314 Float_t dpx = 0.0001*fSegSPD->Dx()/Nx;
315 Float_t dpz = 3.48*2/Nz;
316 printf("Z::original (%3f) scaled (%3f, %3f) \n", zo, zn-dpz/2, zn+dpz/2);
317 printf("X::original (%3f) scaled (%3f, %3f) \n", xo, xn-dpx/2, xn+dpx/2);
318 printf("%d,%d maped to %d,%d \n", od->GetCoord1(), od->GetCoord2(), i,j );