]>
Commit | Line | Data |
---|---|---|
451f5018 | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ||
17 | /* $Id: AliITSUv11.cxx */ | |
18 | ||
19 | ||
20 | //======================================================================== | |
21 | // | |
22 | // Geometry for the Upgrade of the Inner Tracking System | |
23 | // | |
24 | // Mario Sitta (sitta@to.infn.it) | |
25 | // | |
26 | //======================================================================== | |
27 | ||
28 | ||
29 | ||
30 | // $Log: AliITSUv11.cxx,v $ | |
31 | ||
32 | #include <TClonesArray.h> | |
33 | #include <TGeoGlobalMagField.h> | |
34 | #include <TGeoManager.h> | |
35 | #include <TGeoMatrix.h> | |
36 | #include <TGeoPhysicalNode.h> | |
37 | #include <TGeoVolume.h> | |
38 | #include <TGeoXtru.h> | |
39 | #include <TLorentzVector.h> | |
40 | #include <TString.h> | |
41 | #include <TVirtualMC.h> | |
42 | ||
43 | #include "AliITSU.h" | |
44 | #include "AliITSUHit.h" | |
45 | #include "AliLog.h" | |
46 | #include "AliMC.h" | |
47 | #include "AliMagF.h" | |
48 | #include "AliRun.h" | |
49 | #include "AliTrackReference.h" | |
50 | #include "AliITSv11Geometry.h" | |
51 | #include "AliITSUv11Layer.h" | |
52 | #include "AliITSv11GeomBeamPipe.h" | |
53 | #include "AliITSUv11.h" | |
54 | #include "AliITSUGeomTGeo.h" | |
55 | #include "AliGeomManager.h" | |
56 | ||
57 | const Double_t AliITSUv11::fgkBeamPipeHalfZLen = 400; | |
58 | ||
59 | ||
60 | ClassImp(AliITSUv11) | |
61 | ||
62 | //______________________________________________________________________ | |
63 | AliITSUv11::AliITSUv11() | |
64 | : fLayTurbo(0) | |
65 | ,fLayRadii(0) | |
66 | ,fLayZLength(0) | |
67 | ,fLaddPerLay(0) | |
68 | ,fModPerLadd(0) | |
69 | ,fLadThick(0) | |
70 | ,fLadWidth(0) | |
71 | ,fLadTilt(0) | |
72 | ,fDetThick(0) | |
73 | ,fDetTypeID(0) | |
74 | ,fBeamPipe(0) | |
75 | ,fBeamPipeRmin(0) | |
76 | ,fBeamPipeRmax(0) | |
77 | ,fBeamPipeZlen(0) | |
78 | ,fUpGeom(0) | |
79 | ,fBPGeom(0) | |
80 | { | |
81 | // Standard default constructor | |
82 | // Inputs: | |
83 | // none. | |
84 | // Outputs: | |
85 | // none. | |
86 | // Return: | |
87 | // none. | |
88 | } | |
89 | ||
90 | //______________________________________________________________________ | |
91 | AliITSUv11::AliITSUv11(const char *title,const Int_t nlay) | |
92 | :AliITSU(title,nlay) | |
93 | ,fLayTurbo(0) | |
94 | ,fLayRadii(0) | |
95 | ,fLayZLength(0) | |
96 | ,fLaddPerLay(0) | |
97 | ,fModPerLadd(0) | |
98 | ,fLadThick(0) | |
99 | ,fLadWidth(0) | |
100 | ,fLadTilt(0) | |
101 | ,fDetThick(0) | |
102 | ,fDetTypeID(0) | |
103 | ,fBeamPipe(0) | |
104 | ,fBeamPipeRmin(0) | |
105 | ,fBeamPipeRmax(0) | |
106 | ,fBeamPipeZlen(0) | |
107 | ,fUpGeom(0) | |
108 | ,fBPGeom(0) | |
109 | { | |
110 | // Standard constructor for the Upgrade geometry. | |
111 | // Inputs: | |
112 | // const char * name Ignored, set to "ITS" | |
113 | // const char * title Arbitrary title | |
114 | // const Int_t nlay Number of layers | |
115 | // | |
116 | fLayerName = new TString[fNLayers]; | |
117 | // | |
02d6eccc | 118 | for (Int_t j=0; j<fNLayers; j++) fLayerName[j].Form("%s%d",AliITSUGeomTGeo::GetITSSensorPattern(),j); // See AliITSUv11Layer |
451f5018 | 119 | // |
120 | fLayTurbo = new Bool_t[fNLayers]; | |
121 | fLayRadii = new Double_t[fNLayers]; | |
122 | fLayZLength = new Double_t[fNLayers]; | |
123 | fLaddPerLay = new Int_t[fNLayers]; | |
124 | fModPerLadd = new Int_t[fNLayers]; | |
125 | fLadThick = new Double_t[fNLayers]; | |
126 | fLadWidth = new Double_t[fNLayers]; | |
127 | fLadTilt = new Double_t[fNLayers]; | |
128 | fDetThick = new Double_t[fNLayers]; | |
129 | fDetTypeID = new UInt_t[fNLayers]; | |
130 | ||
131 | fUpGeom = new AliITSUv11Layer*[fNLayers]; | |
132 | ||
133 | if (fNLayers > 0) { // if not, we'll Fatal-ize in CreateGeometry | |
134 | for (Int_t j=0; j<fNLayers; j++) { | |
135 | fLayRadii[j] = 0.; | |
136 | fLayZLength[j] = 0.; | |
137 | fLaddPerLay[j] = 0; | |
138 | fModPerLadd[j] = 0; | |
139 | fLadWidth[j] = 0.; | |
140 | fDetThick[j] = 0.; | |
141 | fDetTypeID[j] = 0.; | |
142 | fUpGeom[j] = 0; | |
143 | } | |
144 | } | |
145 | } | |
146 | ||
147 | //______________________________________________________________________ | |
148 | AliITSUv11::~AliITSUv11() { | |
149 | // Standard destructor | |
150 | // Inputs: | |
151 | // none. | |
152 | // Outputs: | |
153 | // none. | |
154 | // Return: | |
155 | // none. | |
156 | delete [] fLayTurbo; | |
157 | delete [] fLayRadii; | |
158 | delete [] fLayZLength; | |
159 | delete [] fLaddPerLay; | |
160 | delete [] fModPerLadd; | |
161 | delete [] fLadThick; | |
162 | delete [] fLadWidth; | |
163 | delete [] fLadTilt; | |
164 | delete [] fDetThick; | |
165 | delete [] fDetTypeID; | |
166 | delete [] fUpGeom; | |
167 | ||
168 | } | |
169 | ||
170 | //______________________________________________________________________ | |
171 | void AliITSUv11::SetT2Lmatrix(Int_t uid, Double_t yShift, | |
172 | Bool_t yFlip, Bool_t yRot180) const { | |
173 | ||
174 | // | |
175 | // Creates the TGeo Local to Tracking transformation matrix | |
176 | // and sends it to the corresponding TGeoPNEntry | |
177 | // | |
178 | // This function is used in AddAlignableVolumes() | |
179 | ||
180 | TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(uid); | |
181 | TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig(); | |
182 | ||
183 | Double_t *gtrans = globMatrix->GetTranslation(), rotMatrix[9]; | |
184 | memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t)); | |
185 | Double_t al = TMath::ATan2(rotMatrix[1],rotMatrix[0]); | |
186 | if (yRot180) { | |
187 | al = TMath::ATan2(rotMatrix[1],-rotMatrix[0]); | |
188 | } | |
189 | Double_t xShift = gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al); | |
190 | Double_t zShift = -gtrans[2]; | |
191 | ||
192 | TGeoHMatrix *matLtoT = new TGeoHMatrix; | |
193 | matLtoT->SetDx( xShift ); // translation | |
194 | matLtoT->SetDy( yShift ); | |
195 | matLtoT->SetDz( zShift ); | |
196 | rotMatrix[0]= 0; rotMatrix[1]= 1; rotMatrix[2]= 0; // + rotation | |
197 | rotMatrix[3]= 1; rotMatrix[4]= 0; rotMatrix[5]= 0; | |
198 | rotMatrix[6]= 0; rotMatrix[7]= 0; rotMatrix[8]=-1; | |
199 | if (yFlip) rotMatrix[3] = -1; // flipping in y (for SPD1) | |
200 | if (yFlip) rotMatrix[1] = -1; // flipping in y (for SPD1) | |
201 | ||
202 | if (yRot180) { // rotation of pi around the axis perpendicular to the wafer | |
203 | if (yFlip) matLtoT->SetDx( -xShift ); // flipping in y (for SPD1) | |
204 | matLtoT->SetDy( -yShift ); | |
205 | matLtoT->SetDz( -zShift ); | |
206 | rotMatrix[8]=1; | |
207 | rotMatrix[3] = -1; | |
208 | if (yFlip) rotMatrix[3] = 1; // flipping in y (for SPD1) | |
209 | } | |
210 | ||
211 | TGeoRotation rot; | |
212 | rot.SetMatrix(rotMatrix); | |
213 | matLtoT->MultiplyLeft(&rot); | |
214 | TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse()); | |
215 | delete matLtoT; | |
216 | alignableEntry->SetMatrix(matTtoL); | |
217 | } | |
218 | ||
219 | //______________________________________________________________________ | |
220 | void AliITSUv11::AddAlignableVolumes() const{ | |
221 | // Creates entries for alignable volumes associating the symbolic volume | |
222 | // name with the corresponding volume path. | |
223 | // | |
224 | // Records in the alignable entries the transformation matrices converting | |
225 | // TGeo local coordinates (in the RS of alignable volumes) to the tracking | |
226 | // system | |
227 | // For this, this function has to run before the misalignment because we | |
228 | // are using the ideal positions in the AliITSgeom object. | |
229 | // Inputs: | |
230 | // none. | |
231 | // Outputs: | |
232 | // none. | |
233 | // Return: | |
234 | // none. | |
235 | ||
236 | AliInfo("Add ITS alignable volumes"); | |
237 | ||
238 | if (!gGeoManager) { AliFatal("TGeoManager doesn't exist !"); return; } | |
239 | TString pth,snm; | |
240 | // | |
241 | pth = Form("ALIC_1/%s_2",AliITSUGeomTGeo::GetITSVolPattern()); | |
242 | // RS: to be checked with MS | |
243 | if( !gGeoManager->SetAlignableEntry("ITS",pth.Data()) ) | |
244 | AliFatal(Form("Unable to set alignable entry ! %s :: %s","ITS",pth.Data())); | |
245 | // | |
02d6eccc | 246 | int modNum = 0; |
247 | // | |
451f5018 | 248 | for (int lr=0; lr<fNLayers; lr++) { |
249 | // | |
02d6eccc | 250 | pth = Form("ALIC_1/%s_2/%s%d_1",AliITSUGeomTGeo::GetITSVolPattern(),AliITSUGeomTGeo::GetITSLayerPattern(),lr); |
251 | snm = Form("ITS/%s%d",AliITSUGeomTGeo::GetITSLayerPattern(),lr); | |
451f5018 | 252 | //printf("SetAlignable: %s %s\n",snm.Data(),pth.Data()); |
253 | gGeoManager->SetAlignableEntry(snm.Data(),pth.Data()); | |
451f5018 | 254 | // |
255 | for (int ld=0; ld<fLaddPerLay[lr]; ld++) { | |
256 | // | |
02d6eccc | 257 | TString pthL = Form("%s/%s%d_%d",pth.Data(),AliITSUGeomTGeo::GetITSLadderPattern(),lr,ld); |
258 | TString snmL = Form("%s/%s%d",snm.Data(),AliITSUGeomTGeo::GetITSLadderPattern(),ld); | |
451f5018 | 259 | //printf("SetAlignable: %s %s\n",snmL.Data(),pthL.Data()); |
260 | gGeoManager->SetAlignableEntry(snmL.Data(),pthL.Data()); | |
261 | // | |
262 | for (int md=0; md<fModPerLadd[lr]; md++) { | |
263 | // | |
02d6eccc | 264 | TString pthM = Form("%s/%s%d_%d",pthL.Data(),AliITSUGeomTGeo::GetITSModulePattern(),lr,md); |
265 | TString snmM = Form("%s/%s%d",snmL.Data(),AliITSUGeomTGeo::GetITSModulePattern(),md); | |
451f5018 | 266 | // |
02d6eccc | 267 | // RS: Attention, this is a hack: AliGeomManager cannot accomodate all ITSU modules w/o |
268 | // conflicts with TPC. For this reason we define the UID of the module to be simply its ID | |
269 | // int modUID = AliGeomManager::LayerToVolUID(lr+1,modNum++); // here modNum would be module within the layer | |
270 | int modUID = AliITSUGeomTGeo::ModuleVolUID( modNum++ ); | |
271 | // | |
451f5018 | 272 | gGeoManager->SetAlignableEntry(snmM.Data(),pthM.Data(),modUID); |
273 | // | |
274 | double yshift = -(fUpGeom[lr]->GetSensorThick()-fUpGeom[lr]->GetLadderThick())/2; | |
275 | SetT2Lmatrix(modUID,yshift, kTRUE,kTRUE); // RS: do we need here special matrix, ask MS | |
276 | // | |
277 | } | |
278 | } | |
279 | } | |
280 | // | |
281 | } | |
282 | ||
283 | //______________________________________________________________________ | |
284 | void AliITSUv11::AddBeamPipe(const Double_t rmin, const Double_t rmax, | |
285 | const Double_t halfzlen) { | |
286 | ||
287 | // Define the parameters for the beam pipe | |
288 | if (fBeamPipe) | |
289 | AliWarning("Redefining beam pipe parameters"); | |
290 | ||
291 | if (rmin <= 0) { | |
292 | AliError(Form("Beam pipe min radius (%f) wrong",rmin)); | |
293 | return; | |
294 | } else | |
295 | fBeamPipeRmin = rmin; | |
296 | ||
297 | if (rmax <= 0) { | |
298 | AliError(Form("Beam pipe max radius (%f) wrong",rmax)); | |
299 | return; | |
300 | } else | |
301 | fBeamPipeRmax = rmax; | |
302 | ||
303 | if (halfzlen < 0) { | |
304 | AliError(Form("Beam pipe half Zlength (%f) wrong",halfzlen)); | |
305 | return; | |
306 | } else { | |
307 | if (halfzlen == 0) // Use default value | |
308 | fBeamPipeZlen = fgkBeamPipeHalfZLen; | |
309 | else | |
310 | fBeamPipeZlen = halfzlen; | |
311 | } | |
312 | ||
313 | fBeamPipe = kTRUE; | |
314 | } | |
315 | ||
316 | //______________________________________________________________________ | |
317 | void AliITSUv11::CreateGeometry() { | |
318 | ||
319 | // Create the geometry and insert it in the mother volume ITSV | |
320 | TGeoManager *geoManager = gGeoManager; | |
321 | ||
322 | TGeoVolume *vALIC = geoManager->GetVolume("ALIC"); | |
323 | ||
324 | new TGeoVolumeAssembly(AliITSUGeomTGeo::GetITSVolPattern()); | |
325 | TGeoVolume *vITSV = geoManager->GetVolume(AliITSUGeomTGeo::GetITSVolPattern()); | |
326 | vALIC->AddNode(vITSV, 2, 0); // Copy number is 2 to cheat AliGeoManager::CheckSymNamesLUT | |
327 | ||
328 | // | |
329 | const Int_t kLength=100; | |
330 | Char_t vstrng[kLength] = "xxxRS"; //? | |
331 | vITSV->SetTitle(vstrng); | |
332 | // | |
333 | // Check that we have all needed parameters | |
334 | if (fNLayers <= 0) AliFatal(Form("Wrong number of layers (%d)",fNLayers)); | |
335 | // | |
336 | for (Int_t j=0; j<fNLayers; j++) { | |
337 | if (fLayRadii[j] <= 0) AliFatal(Form("Wrong layer radius for layer %d (%f)",j,fLayRadii[j])); | |
338 | if (fLayZLength[j] <= 0) AliFatal(Form("Wrong layer length for layer %d (%f)",j,fLayZLength[j])); | |
339 | if (fLaddPerLay[j] <= 0) AliFatal(Form("Wrong number of ladders for layer %d (%d)",j,fLaddPerLay[j])); | |
340 | if (fModPerLadd[j] <= 0) AliFatal(Form("Wrong number of modules for layer %d (%d)",j,fModPerLadd[j])); | |
341 | if (fLadThick[j] < 0) AliFatal(Form("Wrong ladder thickness for layer %d (%f)",j,fLadThick[j])); | |
342 | if (fLayTurbo[j] && fLadWidth[j] <= 0) AliFatal(Form("Wrong ladder width for layer %d (%f)",j,fLadWidth[j])); | |
343 | if (fDetThick[j] < 0) AliFatal(Form("Wrong module thickness for layer %d (%f)",j,fDetThick[j])); | |
344 | // | |
345 | if (j > 0) { | |
02d6eccc | 346 | if (fLayRadii[j]<=fLayRadii[j-1]) AliFatal(Form("Layer %d radius (%f) is smaller than layer %d radius (%f)", |
451f5018 | 347 | j,fLayRadii[j],j-1,fLayRadii[j-1])); |
451f5018 | 348 | } // if (j > 0) |
349 | ||
350 | if (fLadThick[j] == 0) AliInfo(Form("Ladder thickness for layer %d not set, using default",j)); | |
351 | if (fDetThick[j] == 0) AliInfo(Form("Module thickness for layer %d not set, using default",j)); | |
352 | ||
353 | } // for (Int_t j=0; j<fNLayers; j++) | |
354 | ||
355 | // Now create the actual geometry | |
356 | for (Int_t j=0; j<fNLayers; j++) { | |
357 | if (fLayTurbo[j]) { | |
358 | fUpGeom[j] = new AliITSUv11Layer(j,kTRUE,kFALSE); | |
359 | fUpGeom[j]->SetLadderWidth(fLadWidth[j]); | |
360 | fUpGeom[j]->SetLadderTilt(fLadTilt[j]); | |
361 | } | |
362 | else fUpGeom[j] = new AliITSUv11Layer(j,kFALSE); | |
363 | // | |
364 | fUpGeom[j]->SetRadius(fLayRadii[j]); | |
365 | fUpGeom[j]->SetZLength(fLayZLength[j]); | |
366 | fUpGeom[j]->SetNLadders(fLaddPerLay[j]); | |
367 | fUpGeom[j]->SetNModules(fModPerLadd[j]); | |
368 | fUpGeom[j]->SetDetType(fDetTypeID[j]); | |
369 | // | |
370 | if (fLadThick[j] != 0) fUpGeom[j]->SetLadderThick(fLadThick[j]); | |
371 | if (fDetThick[j] != 0) fUpGeom[j]->SetSensorThick(fDetThick[j]); | |
372 | fUpGeom[j]->CreateLayer(vITSV); | |
373 | } | |
374 | // | |
375 | // Finally add the beam pipe | |
376 | if (fBeamPipe) { | |
377 | fBPGeom = new AliITSv11GeomBeamPipe(fBeamPipeRmin, fBeamPipeRmax,fBeamPipeZlen, kFALSE); | |
378 | fBPGeom->CreateBeamPipe(vALIC); // We put the BP in the ALIC volume | |
379 | } | |
380 | } | |
381 | ||
382 | //______________________________________________________________________ | |
383 | void AliITSUv11::CreateMaterials() { | |
384 | // Create ITS materials | |
385 | // This function defines the default materials used in the Geant | |
386 | // Monte Carlo simulations for the geometries AliITSv1, AliITSv3, | |
387 | // AliITSv11Hybrid. | |
388 | // In general it is automatically replaced by | |
389 | // the CreateMaterials routine defined in AliITSv?. Should the function | |
390 | // CreateMaterials not exist for the geometry version you are using this | |
391 | // one is used. See the definition found in AliITSv5 or the other routine | |
392 | // for a complete definition. | |
393 | // Inputs: | |
394 | // none. | |
395 | // Outputs: | |
396 | // none. | |
397 | // Return: | |
398 | // none. | |
399 | ||
400 | Int_t ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ(); | |
401 | Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max(); | |
402 | ||
403 | Float_t tmaxfd = 0.1; // 1.0; // Degree | |
404 | Float_t stemax = 1.0; // cm | |
405 | Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1 | |
406 | Float_t epsil = 1.0E-4; // 1.0; // cm | |
407 | Float_t stmin = 0.0; // cm "Default value used" | |
408 | ||
409 | Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree | |
410 | Float_t stemaxSi = 0.0075; // .10000E+01; // cm | |
411 | Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1 | |
412 | Float_t epsilSi = 1.0E-4;// .10000E+01; | |
413 | Float_t stminSi = 0.0; // cm "Default value used" | |
414 | ||
415 | Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree | |
416 | Float_t stemaxAir = .10000E+01; // cm | |
417 | Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1 | |
418 | Float_t epsilAir = 1.0E-4;// .10000E+01; | |
419 | Float_t stminAir = 0.0; // cm "Default value used" | |
420 | ||
421 | // AIR | |
422 | Float_t aAir[4]={12.0107,14.0067,15.9994,39.948}; | |
423 | Float_t zAir[4]={6.,7.,8.,18.}; | |
424 | Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827}; | |
425 | Float_t dAir = 1.20479E-3; | |
426 | ||
427 | ||
428 | AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03); | |
429 | AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi); | |
430 | ||
431 | AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir); | |
432 | AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir); | |
433 | ||
434 | AliMaterial(8,"BERILLIUM$",9.01, 4., 1.848, 35.3, 36.7);// From AliPIPEv3 | |
435 | AliMedium(8,"BERILLIUM$",8,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin); | |
436 | ||
437 | } | |
438 | ||
439 | //______________________________________________________________________ | |
440 | void AliITSUv11::DefineLayer(const Int_t nlay, const Double_t r, | |
441 | const Double_t zlen, const Int_t nladd, | |
442 | const Int_t nmod, const Double_t lthick, | |
443 | const Double_t dthick, const UInt_t dettypeID) | |
444 | { | |
445 | // Sets the layer parameters | |
446 | // Inputs: | |
447 | // nlay layer number | |
448 | // r layer radius | |
449 | // zlen layer length | |
450 | // nladd number of ladders | |
451 | // nmod number of modules per ladder | |
452 | // lthick ladder thickness (if omitted, defaults to 0) | |
453 | // dthick detector thickness (if omitted, defaults to 0) | |
454 | // Outputs: | |
455 | // none. | |
456 | // Return: | |
457 | // none. | |
458 | ||
459 | if (nlay >= fNLayers || nlay < 0) { | |
460 | AliError(Form("Wrong layer number (%d)",nlay)); | |
461 | return; | |
462 | } | |
463 | ||
464 | fLayTurbo[nlay] = kFALSE; | |
465 | fLayRadii[nlay] = r; | |
466 | fLayZLength[nlay] = zlen; | |
467 | fLaddPerLay[nlay] = nladd; | |
468 | fModPerLadd[nlay] = nmod; | |
469 | fLadThick[nlay] = lthick; | |
470 | fDetThick[nlay] = dthick; | |
471 | fDetTypeID[nlay] = dettypeID; | |
472 | ||
473 | } | |
474 | ||
475 | //______________________________________________________________________ | |
476 | void AliITSUv11::DefineLayerTurbo(const Int_t nlay, const Double_t r, | |
477 | const Double_t zlen, const Int_t nladd, | |
478 | const Int_t nmod, const Double_t width, | |
479 | const Double_t tilt, | |
480 | const Double_t lthick, | |
481 | const Double_t dthick, | |
482 | const UInt_t dettypeID) | |
483 | { | |
484 | // Sets the layer parameters for a "turbo" layer | |
485 | // (i.e. a layer whose ladders overlap in phi) | |
486 | // Inputs: | |
487 | // nlay layer number | |
488 | // r layer radius | |
489 | // zlen layer length | |
490 | // nladd number of ladders | |
491 | // nmod number of modules per ladder | |
492 | // width layer width | |
493 | // tilt layer tilt angle (degrees) | |
494 | // lthick ladder thickness (if omitted, defaults to 0) | |
495 | // dthick detector thickness (if omitted, defaults to 0) | |
496 | // Outputs: | |
497 | // none. | |
498 | // Return: | |
499 | // none. | |
500 | ||
501 | if (nlay >= fNLayers || nlay < 0) { | |
502 | AliError(Form("Wrong layer number (%d)",nlay)); | |
503 | return; | |
504 | } | |
505 | ||
506 | fLayTurbo[nlay] = kTRUE; | |
507 | fLayRadii[nlay] = r; | |
508 | fLayZLength[nlay] = zlen; | |
509 | fLaddPerLay[nlay] = nladd; | |
510 | fModPerLadd[nlay] = nmod; | |
511 | fLadThick[nlay] = lthick; | |
512 | fLadWidth[nlay] = width; | |
513 | fLadTilt[nlay] = tilt; | |
514 | fDetThick[nlay] = dthick; | |
515 | fDetTypeID[nlay] = dettypeID; | |
516 | // | |
517 | } | |
518 | ||
519 | //______________________________________________________________________ | |
520 | void AliITSUv11::GetBeamPipeParameters(Double_t &rmin, Double_t &rmax, | |
521 | Double_t &hzlen){ | |
522 | // Gets the beam pipe parameters | |
523 | // Inputs: | |
524 | // none. | |
525 | // Outputs: | |
526 | // rmin min radius | |
527 | // rmax max radius | |
528 | // hzlen half Z length | |
529 | // Return: | |
530 | // none. | |
531 | ||
532 | rmin = fBeamPipeRmin; | |
533 | rmax = fBeamPipeRmax; | |
534 | hzlen = fBeamPipeZlen; | |
535 | ||
536 | } | |
537 | ||
538 | //______________________________________________________________________ | |
539 | void AliITSUv11::GetLayerParameters(const Int_t nlay, | |
540 | Double_t &r, Double_t &zlen, | |
541 | Int_t &nladd, Int_t &nmod, | |
542 | Double_t &width, Double_t &tilt, | |
543 | Double_t <hick, Double_t &dthick){ | |
544 | // Gets the layer parameters | |
545 | // Inputs: | |
546 | // nlay layer number | |
547 | // Outputs: | |
548 | // r layer radius | |
549 | // zlen layer length | |
550 | // nladd number of ladders | |
551 | // nmod number of modules per ladder | |
552 | // width ladder width | |
553 | // tilt ladder tilt angle | |
554 | // lthick ladder thickness | |
555 | // dthick detector thickness | |
556 | // Return: | |
557 | // none. | |
558 | ||
559 | if (nlay >= fNLayers || nlay < 0) { | |
560 | AliError(Form("Wrong layer number (%d)",nlay)); | |
561 | return; | |
562 | } | |
563 | ||
564 | r = fLayRadii[nlay]; | |
565 | zlen = fLayZLength[nlay]; | |
566 | nladd = fLaddPerLay[nlay]; | |
567 | nmod = fModPerLadd[nlay]; | |
568 | width = fLadWidth[nlay]; | |
569 | tilt = fLadTilt[nlay]; | |
570 | lthick = fLadThick[nlay]; | |
571 | dthick = fDetThick[nlay]; | |
572 | } | |
573 | ||
574 | //______________________________________________________________________ | |
575 | void AliITSUv11::Init() | |
576 | { | |
577 | // Initialise the ITS after it has been created. | |
578 | UpdateInternalGeometry(); | |
579 | AliITSU::Init(); | |
02d6eccc | 580 | // |
451f5018 | 581 | } |
582 | ||
583 | //______________________________________________________________________ | |
584 | Bool_t AliITSUv11::IsLayerTurbo(const Int_t nlay) | |
585 | { | |
586 | // Returns true if the layer is a "turbo" layer | |
587 | if ( nlay < 0 || nlay > fNLayers ) { | |
588 | AliError(Form("Wrong layer number %d",nlay)); | |
589 | return kFALSE; | |
590 | } | |
591 | else return fUpGeom[nlay]->IsTurbo(); | |
592 | } | |
593 | ||
594 | //______________________________________________________________________ | |
595 | void AliITSUv11::SetDefaults() | |
596 | { | |
597 | // sets the default segmentation, response, digit and raw cluster classes | |
598 | } | |
599 | ||
600 | //______________________________________________________________________ | |
601 | void AliITSUv11::StepManager() | |
602 | { | |
603 | // Called for every step in the ITS, then calles the AliITSUHit class | |
604 | // creator with the information to be recoreded about that hit. | |
605 | // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the | |
606 | // printing of information to a file which can be used to create a .det | |
607 | // file read in by the routine CreateGeometry(). If set to 0 or any other | |
608 | // value except 1, the default behavior, then no such file is created nor | |
609 | // it the extra variables and the like used in the printing allocated. | |
610 | // Inputs: | |
611 | // none. | |
612 | // Outputs: | |
613 | // none. | |
614 | // Return: | |
615 | // none. | |
616 | if(!(this->IsActive())) return; | |
617 | if(!(gMC->TrackCharge())) return; | |
618 | // | |
619 | Int_t copy, lay = 0; | |
620 | Int_t id = gMC->CurrentVolID(copy); | |
621 | ||
622 | Bool_t notSens = kFALSE; | |
623 | while ((lay<fNLayers) && (notSens = (id!=fIdSens[lay]))) ++lay; | |
624 | //printf("R: %.1f | Lay: %d NotSens: %d\n",positionRS.Pt(), lay, notSens); | |
625 | ||
626 | if (notSens) return; | |
627 | ||
628 | if(gMC->IsTrackExiting()) { | |
629 | AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS); | |
630 | } // if Outer ITS mother Volume | |
631 | ||
632 | static TLorentzVector position, momentum; // Saves on calls to construtors | |
633 | static AliITSUHit hit;// Saves on calls to constructors | |
634 | ||
635 | TClonesArray &lhits = *(Hits()); | |
636 | Int_t cpn0, cpn1, mod, status = 0; | |
637 | // | |
638 | // Track status | |
639 | if(gMC->IsTrackInside()) status += 1; | |
640 | if(gMC->IsTrackEntering()) status += 2; | |
641 | if(gMC->IsTrackExiting()) status += 4; | |
642 | if(gMC->IsTrackOut()) status += 8; | |
643 | if(gMC->IsTrackDisappeared()) status += 16; | |
644 | if(gMC->IsTrackStop()) status += 32; | |
645 | if(gMC->IsTrackAlive()) status += 64; | |
646 | ||
647 | // | |
648 | // retrieve the indices with the volume path | |
649 | // | |
650 | if (lay < 0 || lay >= fNLayers) { | |
651 | AliError(Form("Invalid value: lay=%d. Not an ITS sensitive volume",lay)); | |
652 | return; // not an ITS sensitive volume. | |
653 | } else { | |
654 | copy = 1; | |
655 | gMC->CurrentVolOffID(1,cpn1); | |
656 | gMC->CurrentVolOffID(2,cpn0); | |
657 | } // | |
658 | ||
659 | mod = fGeomTGeo->GetModuleIndex(lay,cpn0,cpn1); | |
660 | //RS2DEL fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,copy); | |
661 | // | |
662 | // Fill hit structure. | |
663 | // | |
664 | hit.SetModule(mod); | |
665 | hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber()); | |
666 | gMC->TrackPosition(position); | |
667 | gMC->TrackMomentum(momentum); | |
668 | hit.SetPosition(position); | |
669 | hit.SetTime(gMC->TrackTime()); | |
670 | hit.SetMomentum(momentum); | |
671 | hit.SetStatus(status); | |
672 | hit.SetEdep(gMC->Edep()); | |
673 | hit.SetShunt(GetIshunt()); | |
674 | if(gMC->IsTrackEntering()){ | |
675 | hit.SetStartPosition(position); | |
676 | hit.SetStartTime(gMC->TrackTime()); | |
677 | hit.SetStartStatus(status); | |
678 | return; // don't save entering hit. | |
679 | } // end if IsEntering | |
680 | // Fill hit structure with this new hit. | |
681 | //Info("StepManager","Calling Copy Constructor"); | |
682 | new(lhits[fNhits++]) AliITSUHit(hit); // Use Copy Construtor. | |
683 | // Save old position... for next hit. | |
684 | hit.SetStartPosition(position); | |
685 | hit.SetStartTime(gMC->TrackTime()); | |
686 | hit.SetStartStatus(status); | |
687 | ||
688 | return; | |
689 | } | |
690 | ||
691 | //______________________________________________________________________ | |
692 | void AliITSUv11::SetLayerDetTypeID(Int_t lr, UInt_t id) | |
693 | { | |
694 | // set det type | |
695 | if (!fDetTypeID || fNLayers<=lr) AliFatal(Form("Number of layers %d, %d is manipulated",fNLayers,lr)); | |
696 | fDetTypeID[lr] = id; | |
697 | } | |
698 | ||
699 | //______________________________________________________________________ | |
700 | Int_t AliITSUv11::GetLayerDetTypeID(Int_t lr) | |
701 | { | |
702 | // set det type | |
703 | if (!fDetTypeID || fNLayers<=lr) AliFatal(Form("Number of layers %d, %d is manipulated",fNLayers,lr)); | |
704 | return fDetTypeID[lr]; | |
705 | } |