Removed code for gled-like object editors (obsolete, somewhat decayed); fix effc...
[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
24void ITSDigitsInfo::Init()
25{
26 fTree = 0;
27 fGeom = 0;
28 fSegSPD = 0;
29 fSegSDD = 0;
30 fSegSSD = 0;
31}
32
33/**************************************************************************/
34
35ITSDigitsInfo:: ~ITSDigitsInfo()
36{
37 for(map<Int_t, TClonesArray*>::iterator j=fSPDmap.begin(); j!=fSPDmap.end(); ++j) {
38 delete j->second;
39 }
40 for(map<Int_t, TClonesArray*>::iterator j=fSDDmap.begin(); j!=fSDDmap.end(); ++j) {
41 delete j->second;
42 }
43 for(map<Int_t, TClonesArray*>::iterator j=fSSDmap.begin(); j!=fSSDmap.end(); ++j) {
44 delete j->second;
45 }
46 delete fSegSPD; delete fSegSDD; delete fSegSSD;
47 delete fGeom;
48 delete fTree;
49}
50
51/**************************************************************************/
52
53void ITSDigitsInfo::SetTree(TTree* tree)
54{
55 static const Exc_t eH("ITSDigitsInfo::SetTree ");
56
57 if(fGeom == 0) {
58 fGeom = new AliITSgeom();
59 fGeom->ReadNewFile("$REVESYS/alice-data/ITSgeometry.det");
60 if(fGeom == 0)
61 throw(eH + "can not load ITS geometry \n");
62 }
63
64 fTree = tree;
65
66 SetITSSegmentation();
67
68 // create tables for scaling
69 // lowest scale factor refers unscaled ITS module
70 fSPDScaleX[0]=1;
71 fSPDScaleZ[0]=1;
72 fSDDScaleX[0]=1;
73 fSDDScaleZ[0]=1;
74 fSSDScale[0]=1;
75 // spd lows rsolution is in the level of 8x2 redaut chips
76 Int_t nx = 8; // fSegSPD->Npx()/8; // 32
77 Int_t nz = 6; // fSegSPD->Npz()/2; // 128
78
79 fSPDScaleX[1] = Int_t(nx);
80 fSPDScaleZ[1] = Int_t(nz);
81 fSPDScaleX[2] = Int_t(nx*2);
82 fSPDScaleZ[2] = Int_t(nz*2);
83 fSPDScaleX[3] = Int_t(nx*3);
84 fSPDScaleZ[3] = Int_t(nz*3);
85 fSPDScaleX[4] = Int_t(nx*4);
86 fSPDScaleZ[4] = Int_t(nz*4);
87
88
89 fSDDScaleX[1] = 2;
90 fSDDScaleZ[1] = 2;
91 fSDDScaleX[2] = 8;
92 fSDDScaleZ[2] = 8;
93 fSDDScaleX[3] = 16;
94 fSDDScaleZ[3] = 16;
95 fSDDScaleX[4] = 25;
96 fSDDScaleZ[4] = 25;
97
98 fSSDScale[1] = 3;
99 fSSDScale[2] = 9;
100 fSSDScale[3] = 20;
101 fSSDScale[4] = 30;
102
103
104 // lowest scale factor refers unscaled ITS module
105 fSPDScaleX[0]=1;
106 fSPDScaleZ[0]=1;
107 fSDDScaleX[0]=1;
108 fSDDScaleZ[0]=1;
109 fSSDScale[0]=1;
110}
111
112/**************************************************************************/
113
114void ITSDigitsInfo::SetITSSegmentation()
115{
116 // SPD
117 fSegSPD = new AliITSsegmentationSPD(fGeom);
118 //SPD geometry
119 Int_t m;
120 Float_t fNzSPD=160;
121 Float_t fZ1pitchSPD=0.0425; Float_t fZ2pitchSPD=0.0625;
122 Float_t fHlSPD=3.48;
123
124 fSPDZCoord[0]=fZ1pitchSPD -fHlSPD;
125 for (m=1; m<fNzSPD; m++) {
126 Double_t dz=fZ1pitchSPD;
127 if (m==31 || m==32 || m==63 || m==64 || m==95 || m==96 ||
128 m==127 || m==128) dz=fZ2pitchSPD;
129 fSPDZCoord[m]=fSPDZCoord[m-1]+dz;
130 }
131
132 for (m=0; m<fNzSPD; m++) {
133 Double_t dz=1.*fZ1pitchSPD;
134 if (m==31 || m==32 || m==63 || m==64 || m==95 || m==96 ||
135 m==127 || m==128) dz=1.*fZ2pitchSPD;
136 fSPDZCoord[m]-=dz;
137 }
138
139 // end of SPD geometry
140
141 // SDD
142 // response replaced by Calibration (March 2006).
143 AliITSresponseSDD* resp1 = new AliITSresponseSDD();
144 AliITSCalibrationSDD* cal1 = new AliITSCalibrationSDD;
145 cal1->SetResponse(resp1);
146 fSegSDD = new AliITSsegmentationSDD(fGeom, cal1);
147
148 // SSD
149 fSegSSD = new AliITSsegmentationSSD(fGeom);
150}
151
152void ITSDigitsInfo::GetSPDLocalZ(Int_t j, Float_t& z)
153{
154 z = fSPDZCoord[j];
155}
156
157/**************************************************************************/
158
159TClonesArray* ITSDigitsInfo::GetDigits(Int_t mod, Int_t subdet)
160{
161 switch(subdet) {
162 case 0: {
163 TClonesArray* digitsSPD = 0;
164 map<Int_t, TClonesArray*>::iterator i = fSPDmap.find(mod);
165 if(i == fSPDmap.end()) {
166 fTree->SetBranchAddress("ITSDigitsSPD",&digitsSPD);
167 fTree->GetEntry(mod);
168 fSPDmap[mod] = digitsSPD;
169 return digitsSPD;
170 }
171 else{
172 return i->second;
173 }
174 break;
175 }
176 case 1: {
177 TClonesArray* digitsSDD = 0;
178 map<Int_t, TClonesArray*>::iterator i = fSDDmap.find(mod);
179 if(i == fSDDmap.end()) {
180 fTree->SetBranchAddress("ITSDigitsSDD",&digitsSDD);
181 fTree->GetEntry(mod);
182 fSDDmap[mod] = digitsSDD;
183 return digitsSDD;
184 }
185 else{
186 return i->second;
187 }
188 break;
189 }
190 case 2: {
191 TClonesArray* digitsSSD = 0;
192 map<Int_t, TClonesArray*>::iterator i = fSSDmap.find(mod);
193 if(i == fSSDmap.end()) {
194 fTree->SetBranchAddress("ITSDigitsSSD",&digitsSSD);
195 fTree->GetEntry(mod);
196 fSSDmap[mod] = digitsSSD;
197 return digitsSSD;
198 }
199 else{
200 return i->second;
201 }
202 break;
203 }
204 default:
205 return 0;
206 } //end switch
03ecfe88 207 return 0;
5a5a1232 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*/