]>
Commit | Line | Data |
---|---|---|
023ae34b | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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$ | |
18 | */ | |
6b0f3880 | 19 | //////////////////////////////////////////////////////////////// |
20 | // This class initializes the class AliITSgeom | |
21 | // The initialization is done starting from | |
22 | // a geometry coded by means of the ROOT geometrical modeler | |
23 | // This initialization can be used both for simulation and reconstruction | |
24 | /////////////////////////////////////////////////////////////// | |
25 | ||
023ae34b | 26 | #include <TArrayD.h> |
27 | #include <TArrayF.h> | |
28 | #include <TStopwatch.h> | |
023ae34b | 29 | #include <TGeoManager.h> |
268f57b1 | 30 | #include <TGeoMatrix.h> |
023ae34b | 31 | #include <TGeoVolume.h> |
32 | #include <TGeoShape.h> | |
33 | #include <TGeoBBox.h> | |
34 | #include <TGeoTrd1.h> | |
35 | #include <TGeoTrd2.h> | |
36 | #include <TGeoArb8.h> | |
37 | #include <TGeoTube.h> | |
38 | #include <TGeoCone.h> | |
39 | #include <TGeoSphere.h> | |
40 | #include <TGeoPara.h> | |
41 | #include <TGeoPgon.h> | |
42 | #include <TGeoPcon.h> | |
43 | #include <TGeoEltu.h> | |
44 | #include <TGeoHype.h> | |
3010c308 | 45 | #include <TMath.h> |
023ae34b | 46 | |
6def2bd2 | 47 | #include "AliLog.h" |
48 | #include "AliITSgeomSPD.h" | |
49 | #include "AliITSgeomSDD.h" | |
50 | #include "AliITSgeomSSD.h" | |
51 | #include "AliITSsegmentationSPD.h" | |
52 | #include "AliITSsegmentationSDD.h" | |
53 | #include "AliITSsegmentationSSD.h" | |
023ae34b | 54 | #include "AliITSInitGeometry.h" |
012f0f4c | 55 | #include <TDatime.h> |
023ae34b | 56 | |
57 | ClassImp(AliITSInitGeometry) | |
108bd0fe | 58 | |
dbfc6ce6 | 59 | const Bool_t AliITSInitGeometry::fgkOldSPDbarrel = kFALSE; |
108bd0fe | 60 | const Bool_t AliITSInitGeometry::fgkOldSDDbarrel = kFALSE; |
bf210566 | 61 | const Bool_t AliITSInitGeometry::fgkOldSSDbarrel = kFALSE; |
7d6c23de | 62 | const Bool_t AliITSInitGeometry::fgkOldSDDcone = kFALSE; |
3a299c65 | 63 | const Bool_t AliITSInitGeometry::fgkOldSSDcone = kFALSE; |
b0c0f648 | 64 | const Bool_t AliITSInitGeometry::fgkOldSPDshield = kFALSE; |
108bd0fe | 65 | const Bool_t AliITSInitGeometry::fgkOldSDDshield = kTRUE; |
66 | const Bool_t AliITSInitGeometry::fgkOldSSDshield = kTRUE; | |
cc8a4c78 | 67 | const Bool_t AliITSInitGeometry::fgkOldServices = kFALSE; |
108bd0fe | 68 | const Bool_t AliITSInitGeometry::fgkOldSupports = kTRUE; |
023ae34b | 69 | //______________________________________________________________________ |
70 | AliITSInitGeometry::AliITSInitGeometry(): | |
012f0f4c | 71 | TObject(), // Base Class |
72 | fName(0), // Geometry name | |
73 | fMinorVersion(-1), // Minor version number/type | |
74 | fMajorVersion(kvDefault), // Major versin number | |
75 | fTiming(kFALSE), // Flag to start inilization timing | |
76 | fSegGeom(kFALSE), // Flag to switch between the old use of | |
77 | // AliITSgeomS?D class, or AliITSsegmentation | |
78 | // class in fShape of AliITSgeom class. | |
79 | fDecode(kFALSE), // Flag for new/old decoding | |
80 | fDebug(0){ // Debug flag | |
023ae34b | 81 | // Default Creator |
82 | // Inputs: | |
83 | // none. | |
84 | // Outputs: | |
85 | // none. | |
86 | // Return: | |
87 | // A default inilized AliITSInitGeometry object | |
012f0f4c | 88 | |
89 | fName = "Undefined"; | |
023ae34b | 90 | } |
91 | //______________________________________________________________________ | |
012f0f4c | 92 | AliITSInitGeometry::AliITSInitGeometry(AliITSVersion_t version, |
93 | Int_t minorversion): | |
94 | TObject(), // Base Class | |
95 | fName(0), // Geometry name | |
96 | fMinorVersion(minorversion), // Minor version number/type | |
97 | fMajorVersion(version), // Major versin number | |
98 | fTiming(kFALSE), // Flag to start inilization timing | |
99 | fSegGeom(kFALSE), // Flag to switch between the old use of | |
100 | // AliITSgeomS?D class, or AliITSsegmentation | |
101 | // class in fShape of AliITSgeom class. | |
102 | fDecode(kFALSE), // Flag for new/old decoding | |
103 | fDebug(0){ // Debug flag | |
023ae34b | 104 | // Default Creator |
105 | // Inputs: | |
106 | // none. | |
107 | // Outputs: | |
108 | // none. | |
109 | // Return: | |
110 | // A default inilized AliITSInitGeometry object | |
108bd0fe | 111 | |
012f0f4c | 112 | if(version == kvPPRasymmFMD && (fMinorVersion==1|| fMinorVersion==2)){ |
113 | fName="AliITSvPPRasymmFMD"; | |
114 | }else if(version == kv11Hybrid){ | |
115 | fName="AliITSv11Hybrid"; | |
116 | }else { | |
117 | AliFatal(Form("Undefined geometry: fMajorVersion=%d, " | |
118 | "fMinorVersion= %d",(Int_t)fMajorVersion,fMinorVersion)); | |
119 | fName = "Undefined"; | |
108bd0fe | 120 | } // end if |
023ae34b | 121 | return; |
122 | } | |
123 | //______________________________________________________________________ | |
124 | AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(){ | |
125 | // Creates and Initilizes the geometry transformation class AliITSgeom | |
126 | // to values appropreate to this specific geometry. Now that | |
127 | // the segmentation is part of AliITSgeom, the detector | |
128 | // segmentations are also defined here. | |
129 | // Inputs: | |
130 | // none. | |
131 | // Outputs: | |
132 | // none. | |
133 | // Return: | |
134 | // A pointer to a new properly inilized AliITSgeom class. If | |
135 | // pointer = 0 then failed to init. | |
136 | ||
012f0f4c | 137 | |
138 | AliITSVersion_t version = kvDefault; | |
139 | Int_t minor = 0; | |
140 | TDatime datetime; | |
141 | TGeoVolume *itsV = gGeoManager->GetVolume("ITSV"); | |
142 | if(!itsV){ | |
143 | Error("CreateAliITSgeom","Can't find ITS volume ITSV, aborting"); | |
144 | return 0; | |
145 | }// end if | |
146 | const Char_t *title = itsV->GetTitle(); | |
147 | if(!ReadVersionString(title,(Int_t)strlen(title),version,minor, | |
148 | datetime)) | |
149 | Warning("UpdateInternalGeometry","Can't read title=%s\n",title); | |
150 | SetTiming(kFALSE); | |
151 | SetSegGeom(kFALSE); | |
152 | SetDecoding(kFALSE); | |
153 | AliITSgeom *geom = CreateAliITSgeom(version,minor); | |
154 | AliDebug(1,"AliITSgeom object has been initialized from TGeo\n"); | |
155 | return geom; | |
156 | } | |
157 | //______________________________________________________________________ | |
158 | AliITSgeom* AliITSInitGeometry::CreateAliITSgeom(Int_t major,Int_t minor){ | |
159 | // Creates and Initilizes the geometry transformation class AliITSgeom | |
160 | // to values appropreate to this specific geometry. Now that | |
161 | // the segmentation is part of AliITSgeom, the detector | |
162 | // segmentations are also defined here. | |
163 | // Inputs: | |
164 | // Int_t major major version, see AliITSVersion_t | |
165 | // Int_t minor minor version | |
166 | // Outputs: | |
167 | // none. | |
168 | // Return: | |
169 | // A pointer to a new properly inilized AliITSgeom class. If | |
170 | // pointer = 0 then failed to init. | |
171 | ||
172 | switch(major){ | |
173 | case kvtest: | |
174 | SetGeometryName("AliITSvtest"); | |
175 | SetVersion(kvtest,minor); | |
176 | break; | |
177 | case kvSPD02: | |
178 | SetGeometryName("AliITSvSPD02"); | |
179 | SetVersion(kvSPD02,minor); | |
180 | break; | |
181 | case kvSDD03: | |
182 | SetGeometryName("AliITSvSDD03"); | |
183 | SetVersion(kvSDD03,minor); | |
184 | break; | |
185 | case kvSSD03: | |
186 | SetGeometryName("AliITSvSSD03"); | |
187 | SetVersion(kvSSD03,minor); | |
188 | break; | |
189 | case kvITS04: | |
190 | SetGeometryName("AliITSvBeamTest03"); | |
191 | SetVersion(kvITS04,minor); | |
192 | break; | |
193 | case kvPPRcourseasymm: | |
194 | SetGeometryName("AliITSvPPRcourseasymm"); | |
195 | SetVersion(kvPPRcourseasymm,minor); | |
196 | break; | |
197 | case kvPPRasymmFMD: | |
198 | SetGeometryName("AliITSvPPRasymmFMD"); | |
199 | SetVersion(kvPPRasymmFMD,minor); | |
200 | break; | |
201 | case kv11: | |
202 | SetGeometryName("AliITSv11"); | |
203 | SetVersion(kv11,minor); | |
204 | break; | |
205 | case kv11Hybrid: | |
206 | SetGeometryName("AliITSv11Hybrid"); | |
207 | SetVersion(kv11Hybrid,minor); | |
208 | break; | |
209 | case kvDefault: | |
210 | default: | |
211 | SetGeometryName("Undefined"); | |
212 | SetVersion(kvDefault,minor); | |
213 | break; | |
214 | } // end switch | |
023ae34b | 215 | AliITSgeom *geom = new AliITSgeom(); |
216 | if(!InitAliITSgeom(geom)){ // Error initilization failed | |
217 | delete geom; | |
218 | geom = 0; | |
219 | } // end if | |
220 | return geom; | |
221 | } | |
222 | //______________________________________________________________________ | |
223 | Bool_t AliITSInitGeometry::InitAliITSgeom(AliITSgeom *geom){ | |
6def2bd2 | 224 | // Initilizes the geometry transformation class AliITSgeom |
225 | // to values appropreate to this specific geometry. Now that | |
226 | // the segmentation is part of AliITSgeom, the detector | |
227 | // segmentations are also defined here. | |
228 | // Inputs: | |
229 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
230 | // Outputs: | |
231 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
232 | // Return: | |
233 | // none. | |
023ae34b | 234 | |
012f0f4c | 235 | if(!gGeoManager){ |
236 | AliFatal("The geometry manager has not been initialized (e.g. " | |
237 | "TGeoManager::Import(\"geometry.root\")should be " | |
238 | "called in advance) - exit forced"); | |
239 | return kFALSE; | |
240 | } // end if | |
241 | switch(fMajorVersion) { | |
242 | case kvtest: { | |
243 | if(GetMinorVersion()==1) return InitAliITSgeomPPRasymmFMD(geom); | |
244 | else if(GetMinorVersion()==2) return InitAliITSgeomtest2(geom); | |
245 | } break; // end case | |
246 | case kvSPD02: { | |
247 | return InitAliITSgeomSPD02(geom); | |
248 | } break; // end case | |
249 | case kvSDD03: { | |
250 | return InitAliITSgeomSDD03(geom); | |
251 | } break; // end case | |
252 | case kvSSD03: { | |
253 | return InitAliITSgeomSSD03(geom); | |
254 | } break; // end case | |
255 | case kvITS04: { | |
256 | return InitAliITSgeomITS04(geom); | |
257 | } break; // end case | |
258 | case kvPPRasymmFMD: { | |
259 | return InitAliITSgeomPPRasymmFMD(geom); | |
260 | } break; // end case | |
261 | case kvPPRcourseasymm: { | |
262 | return kTRUE; // No sensitive detectors in course geometry | |
263 | } break; // end case | |
264 | case kv11Hybrid: { | |
265 | return InitAliITSgeomV11Hybrid(geom); | |
266 | } break; // end case | |
267 | case kv11: { | |
268 | return InitAliITSgeomV11(geom); | |
269 | } break; // end case | |
270 | case kvDefault: default: { | |
271 | AliFatal("Undefined geometry"); | |
272 | return kFALSE; | |
273 | } break; // end case | |
274 | } // end switch | |
6def2bd2 | 275 | return kFALSE; |
012f0f4c | 276 | } |
277 | //______________________________________________________________________ | |
278 | void AliITSInitGeometry::TransposeTGeoHMatrix(TGeoHMatrix *m)const{ | |
279 | // Transpose the rotation matrix part of a TGeoHMatrix. This | |
280 | // is needed because TGeo stores the transpose of the rotation | |
281 | // matrix as compared to what AliITSgeomMatrix uses (and Geant3). | |
282 | // Inputs: | |
283 | // TGeoHMatrix *m The matrix to be transposed | |
284 | // Outputs: | |
285 | // TGEoHMatrix *m The transposed matrix | |
286 | // Return: | |
287 | // none. | |
288 | Int_t i; | |
289 | Double_t r[9]; | |
290 | ||
291 | if(m==0) return; // no matrix to transpose. | |
292 | for(i=0;i<9;i += 4) r[i] = m->GetRotationMatrix()[i]; // diagonals | |
293 | r[1] = m->GetRotationMatrix()[3]; | |
294 | r[2] = m->GetRotationMatrix()[6]; | |
295 | r[3] = m->GetRotationMatrix()[1]; | |
296 | r[5] = m->GetRotationMatrix()[7]; | |
297 | r[6] = m->GetRotationMatrix()[2]; | |
298 | r[7] = m->GetRotationMatrix()[5]; | |
299 | m->SetRotation(r); | |
300 | return; | |
301 | } | |
302 | //______________________________________________________________________ | |
303 | Bool_t AliITSInitGeometry::InitAliITSgeomtest2(AliITSgeom *geom){ | |
304 | // Initilizes the geometry transformation class AliITSgeom | |
305 | // to values appropreate to this specific geometry. Now that | |
306 | // the segmentation is part of AliITSgeom, the detector | |
307 | // segmentations are also defined here. | |
308 | // Inputs: | |
309 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
310 | // Outputs: | |
311 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
312 | // Return: | |
313 | // none. | |
314 | // const Double_t kcm2micron = 1.0E4; | |
315 | const Int_t kItype=0; // Type of transormation defined 0=> Geant | |
316 | const Int_t klayers = 6; // number of layers in the ITS | |
317 | const Int_t kladders[klayers] = {1,1,1,1,1,1}; // Number of ladders | |
318 | const Int_t kdetectors[klayers] = {1,1,1,1,1,1};// number of detector/lad | |
319 | const AliITSDetector kIdet[6] = {kSPD,kSPD,kSDD,kSDD,kSSD,kSSD}; | |
320 | const TString kNames[klayers] = { | |
321 | "/ALIC_1/ITSV_1/ITSspd1_1/ITS1_1", // lay=1 | |
322 | "/ALIC_1/ITSV_1/ITSspd2_1/ITS2_1", // lay=2 | |
323 | "/ALIC_1/ITSV_1/ITSsdd1_1/ITS3_1", // lay=3 | |
324 | "/ALIC_1/ITSV_1/ITSsdd2_1/ITS4_1", // lay=4 | |
325 | "/ALIC_1/ITSV_1/ITSssd1_1/ITS5_1", // lay=5 | |
326 | "/ALIC_1/ITSV_1/ITSssd2_1/ITS6_1"};// Lay=6 | |
327 | Int_t mod,nmods=0,lay,lad,det,cpn0,cpn1,cpn2; | |
328 | Double_t tran[3]={0.0,0.0,0.0},rot[10]={9*0.0,1.0}; | |
329 | TArrayD shapePar; | |
330 | TString shapeName; | |
331 | TGeoHMatrix matrix; | |
332 | Bool_t initSeg[3]={kFALSE,kFALSE,kFALSE}; | |
333 | TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch(); | |
334 | ||
335 | if(fTiming) time->Start(); | |
336 | for(mod=0;mod<klayers;mod++) nmods += kladders[mod]*kdetectors[mod]; | |
337 | geom->Init(kItype,klayers,kladders,kdetectors,nmods); | |
338 | for(mod=0;mod<nmods;mod++){ | |
339 | DecodeDetectorLayers(mod,lay,lad,det); // Write | |
340 | geom->CreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot); | |
341 | RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det. | |
342 | geom->GetGeomMatrix(mod)->SetPath(kNames[lay-1]); | |
343 | GetTransformation(kNames[lay-1].Data(),matrix); | |
344 | geom->SetTrans(mod,matrix.GetTranslation()); | |
345 | TransposeTGeoHMatrix(&matrix); // Transpose TGeo's rotation matrixes | |
346 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); | |
347 | if(initSeg[kIdet[lay-1]]) continue; | |
348 | GetShape(kNames[lay-1],shapeName,shapePar); | |
349 | if(shapeName.CompareTo("BOX")){ | |
350 | Error("InitITSgeom2","Geometry changed without proper code update" | |
351 | "or error in reading geometry. Shape is not BOX shape is %s", | |
352 | shapeName.Data()); | |
353 | return kFALSE; | |
354 | } // end if | |
355 | InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom); | |
356 | } // end for module | |
357 | if(fTiming){ | |
358 | time->Stop(); | |
359 | time->Print(); | |
360 | delete time; | |
361 | } // end if | |
362 | return kTRUE; | |
363 | } | |
364 | //______________________________________________________________________ | |
365 | Bool_t AliITSInitGeometry::InitAliITSgeomSPD02(AliITSgeom *geom){ | |
366 | // Initilizes the geometry transformation class AliITSgeom | |
367 | // to values appropreate to this specific geometry. Now that | |
368 | // the segmentation is part of AliITSgeom, the detector | |
369 | // segmentations are also defined here. | |
370 | // Inputs: | |
371 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
372 | // Outputs: | |
373 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
374 | // Return: | |
375 | // none. | |
376 | const Int_t kltypess=2; | |
377 | const Int_t knlayers=5; | |
378 | const TString knames[kltypess]= | |
379 | {"ALIC_1/ITSV_1/ITEL_%d/IMB0_1/IMBS_1",//lay=1,2,4,5 | |
380 | "ALIC_1/ITSV_1/IDET_%d/ITS0_1/ITST_1"};// lay=3 | |
381 | const Int_t kitsGeomTreeCopys[2]={4,1}; | |
382 | const Int_t knlad[knlayers]={knlayers*1},kndet[knlayers]={knlayers*1}; | |
383 | TString path,shapeName; | |
384 | TGeoHMatrix matrix; | |
385 | TArrayD shapePar; | |
386 | TArrayF shapeParF; | |
387 | Double_t trans[3]={3*0.0},rot[10]={10*0.0}; | |
388 | Int_t npar=3,mod,i,j,lay,lad,det,cpy; | |
389 | Float_t par[20]; | |
390 | TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch(); | |
391 | ||
392 | par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48; | |
393 | mod=5;; | |
394 | geom->Init(0,knlayers,knlad,kndet,mod); | |
395 | ||
396 | if(fTiming) time->Start(); | |
397 | for(i=0;i<kltypess;i++)for(cpy=1;cpy<=kitsGeomTreeCopys[i];cpy++){ | |
398 | path.Form(knames[i].Data(),cpy); | |
399 | GetTransformation(path.Data(),matrix); | |
400 | GetShape(path.Data(),shapeName,shapePar); | |
401 | shapeParF.Set(shapePar.GetSize()); | |
402 | for(j=0;j<shapePar.GetSize();j++) shapeParF[j]=shapePar[j]; | |
403 | lay = cpy; | |
404 | if(i==0&&cpy>2) lay=cpy+1; | |
405 | if(i==1) lay=3; | |
406 | DecodeDetector(mod,kitsGeomTreeCopys[i],1,cpy,0); | |
407 | DecodeDetectorLayers(mod,lay,lad,det); | |
408 | geom->CreateMatrix(mod,lay,lad,det,kSPD,trans,rot); | |
409 | geom->SetTrans(mod,matrix.GetTranslation()); | |
410 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); | |
411 | geom->GetGeomMatrix(mod)->SetPath(path.Data()); | |
412 | if(!(geom->IsShapeDefined((Int_t)kSPD))) | |
413 | geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par)); | |
414 | } // end for i,cpy/ | |
415 | if(fTiming){ | |
416 | time->Stop(); | |
417 | time->Print(); | |
418 | delete time; | |
419 | } // end if | |
420 | return kTRUE; | |
421 | } | |
422 | //______________________________________________________________________ | |
423 | Bool_t AliITSInitGeometry::InitAliITSgeomSDD03(AliITSgeom *geom){ | |
424 | // Initilizes the geometry transformation class AliITSgeom | |
425 | // to values appropreate to this specific geometry. Now that | |
426 | // the segmentation is part of AliITSgeom, the detector | |
427 | // segmentations are also defined here. | |
428 | // Inputs: | |
429 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
430 | // Outputs: | |
431 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
432 | // Return: | |
433 | // none | |
434 | const Int_t knlayers=12; | |
435 | // const Int_t kndeep=6; | |
436 | const Int_t kltypess=2; | |
437 | const AliITSDetector kidet[knlayers]={kSSD,kSDD}; | |
438 | const TString knames[kltypess]={ | |
439 | "/ALIC_1/ITSV_1/ITEL_%d/ITAI_1/IMB0_1/IMBS_1", | |
440 | "/ALIC_1/ITSV_1/IDET_%d/IDAI_1/ITS0_1/ITST_1"}; | |
441 | const Int_t kitsGeomTreeCopys[kltypess]={10,2}; | |
442 | const Int_t knp=384; | |
443 | const Float_t kpitch=50.E-4;/*cm*/ | |
444 | Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1]; | |
445 | Int_t nlad[knlayers]={knlayers*1}; | |
446 | Int_t ndet[knlayers]={knlayers*1}; | |
447 | Int_t mod=knlayers,lay=0,lad=0,det=0,i,j,cp0; | |
448 | TString path,shapeName; | |
449 | TGeoHMatrix matrix; | |
450 | Double_t trans[3]={3*0.0},rot[10]={10*0.0}; | |
451 | TArrayD shapePar; | |
452 | TArrayF shapeParF; | |
453 | Bool_t isShapeDefined[kltypess]={kltypess*kFALSE}; | |
454 | ||
455 | geom->Init(0,knlayers,nlad,ndet,mod); | |
456 | p[0]=-box[0]; | |
457 | n[0]=box[0]; | |
458 | // Fill in anode and cathode strip locations (lower edge) | |
459 | for(i=1;i<knp;i++){ | |
460 | p[i] =p[i-1]+kpitch; | |
461 | n[i] =n[i-1]-kpitch; | |
462 | } // end for i | |
463 | p[knp]=box[0]; | |
464 | n[knp]=-box[0]; | |
465 | for(i=0;i<kltypess;i++)for(cp0=1;cp0<=kitsGeomTreeCopys[i];cp0++){ | |
466 | DecodeDetector(mod,kitsGeomTreeCopys[i],cp0,1,2); | |
467 | DecodeDetectorLayers(mod,lay,lad,det); | |
468 | path.Form(knames[i].Data(),cp0); | |
469 | GetTransformation(path.Data(),matrix); | |
470 | GetShape(path.Data(),shapeName,shapePar); | |
471 | shapeParF.Set(shapePar.GetSize()); | |
472 | for(j=0;j<shapePar.GetSize();j++)shapeParF[j]=shapePar[j]; | |
473 | geom->CreateMatrix(mod,lay,lad,det,kidet[i],trans,rot); | |
474 | geom->SetTrans(mod,matrix.GetTranslation()); | |
475 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); | |
476 | geom->GetGeomMatrix(mod)->SetPath(path.Data()); | |
477 | switch (kidet[i]){ | |
478 | case kSDD: if(!(geom->IsShapeDefined((Int_t)kSDD))){ | |
479 | geom->ReSetShape(kSDD,new AliITSgeomSDD256(shapeParF.GetSize(), | |
480 | shapeParF.GetArray())); | |
481 | isShapeDefined[i]=kTRUE; | |
482 | } break; | |
483 | case kSSD:if(!(geom->IsShapeDefined((Int_t)kSSD))){ | |
484 | geom->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0, | |
485 | knp+1,p,knp+1,n)); | |
486 | isShapeDefined[i]=kTRUE; | |
487 | } break; | |
488 | default:{} break; | |
489 | } // end switch | |
490 | } // end for i,cp0 | |
491 | ||
492 | return kTRUE; | |
493 | } | |
494 | //______________________________________________________________________ | |
495 | Bool_t AliITSInitGeometry::InitAliITSgeomSSD03(AliITSgeom *geom){ | |
496 | // Initilizes the geometry transformation class AliITSgeom | |
497 | // to values appropreate to this specific geometry. Now that | |
498 | // the segmentation is part of AliITSgeom, the detector | |
499 | // segmentations are also defined here. | |
500 | // Inputs: | |
501 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
502 | // Outputs: | |
503 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
504 | // Return: | |
505 | // none. | |
506 | const Int_t knlayers=5; | |
507 | // const Int_t kndeep=6; | |
508 | const Int_t kltypess=3; | |
509 | const AliITSDetector kIdet[knlayers]={kND,kSSD,kND}; | |
510 | const TString knames[kltypess]={ | |
511 | "/ALIC_1/ITSV_1/ITSA_%d/ITSS_1", | |
512 | "/ALIC_1/ITSV_1/IGAR_%d/IAIR_1/ITST_1", | |
513 | "/ALIC_1/ITSV_1/IFRA_%d/IFRS_1"}; | |
514 | const Int_t kitsGeomTreeCopys[kltypess]={3,1,1}; | |
515 | const Int_t kitsGeomDetTypes[kltypess]={1,2,3}; | |
516 | const Int_t knp=384; | |
517 | const Float_t kpitch=50.E-4;//cm | |
518 | Bool_t initSeg[3]={kFALSE, kFALSE, kFALSE}; | |
519 | Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1]; | |
520 | Int_t nlad[knlayers]={knlayers*1}; | |
521 | Int_t ndet[knlayers]={knlayers*1}; | |
522 | Int_t mod=knlayers,lay=0,lad=0,det=0,i,j,cp0; | |
523 | TString path,shapeName; | |
524 | TGeoHMatrix matrix; | |
525 | Double_t trans[3]={3*0.0},rot[10]={10*0.0}; | |
526 | TArrayD shapePar; | |
527 | TArrayF shapeParF; | |
528 | Bool_t isShapeDefined[kltypess]={kltypess*kFALSE}; | |
529 | ||
530 | geom->Init(0,knlayers,nlad,ndet,mod); | |
531 | p[0]=-box[0]; | |
532 | n[0]=box[0]; | |
533 | // Fill in anode and cathode strip locations (lower edge) | |
534 | for(i=1;i<knp;i++){ | |
535 | p[i] =p[i-1]+kpitch; | |
536 | n[i] =n[i-1]-kpitch; | |
537 | } // end for i | |
538 | p[knp]=box[0]; | |
539 | n[knp]=-box[0]; | |
540 | for(i=0;i<kltypess;i++)for(cp0=1;cp0<=kitsGeomTreeCopys[i];cp0++){ | |
541 | DecodeDetector(mod,kitsGeomDetTypes[i],cp0,1,0); | |
542 | DecodeDetectorLayers(mod,lay,lad,det); | |
543 | path.Form(knames[i].Data(),cp0); | |
544 | GetTransformation(path.Data(),matrix); | |
545 | GetShape(path.Data(),shapeName,shapePar); | |
546 | shapeParF.Set(shapePar.GetSize()); | |
547 | for(j=0;j<shapePar.GetSize();j++)shapeParF[j]=shapePar[j]; | |
548 | geom->CreateMatrix(mod,lay,lad,det,kIdet[i],trans,rot); | |
549 | geom->SetTrans(mod,matrix.GetTranslation()); | |
550 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); | |
551 | geom->GetGeomMatrix(mod)->SetPath(path.Data()); | |
552 | switch (kIdet[i]){ | |
553 | case kSSD:if(!(geom->IsShapeDefined((Int_t)kSSD))){ | |
554 | InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom); | |
555 | isShapeDefined[i]=kTRUE; | |
556 | } break; | |
557 | default:{} break; | |
558 | } // end switch | |
559 | } // end for i,cp0 | |
560 | ||
561 | return kTRUE; | |
562 | } | |
563 | //______________________________________________________________________ | |
f736d235 | 564 | Bool_t AliITSInitGeometry::InitAliITSgeomITS04(AliITSgeom *geom) const{ |
012f0f4c | 565 | // Initilizes the geometry transformation class AliITSgeom |
566 | // to values appropreate to this specific geometry. Now that | |
567 | // the segmentation is part of AliITSgeom, the detector | |
568 | // segmentations are also defined here. | |
569 | // Inputs: | |
570 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
571 | // Outputs: | |
572 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
573 | // Return: | |
574 | // none. | |
575 | ||
576 | // We can not use AliITSvBeamTestITS04::fgk... data members because | |
577 | // AliITSInitGeometry is part of the base library while AliITSvBeamTestITS04 | |
578 | // is part of the simulation library. This would introduce a dependance | |
579 | // between the 2 libraries | |
580 | ||
108bd0fe | 581 | |
012f0f4c | 582 | const Int_t knlayers = 6; |
583 | Int_t nlad[knlayers], ndet[knlayers]; | |
584 | ||
585 | nlad[0] = 1; ndet[0] = 2; | |
586 | nlad[1] = 1; ndet[1] = 2; | |
587 | nlad[2] = 1; ndet[2] = 1; | |
588 | nlad[3] = 1; ndet[3] = 1; | |
589 | nlad[4] = 1; ndet[4] = 2; | |
590 | nlad[5] = 1; ndet[5] = 2; | |
108bd0fe | 591 | |
012f0f4c | 592 | Int_t nModTot = 10; |
593 | geom->Init(0,knlayers,nlad,ndet,nModTot); | |
108bd0fe | 594 | |
012f0f4c | 595 | /* |
596 | //=== Set default shapes | |
597 | const Float_t kDxyzSPD[] = {AliITSvBeamTestITS04::fgkSPDwidthSens/2, | |
598 | AliITSvBeamTestITS04::fgkSPDthickSens/2, | |
599 | AliITSvBeamTestITS04::fgkSPDlengthSens/2}; | |
600 | if(!(geom->IsShapeDefined(kSPD))) | |
601 | geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(3,(Float_t *)kDxyzSPD)); | |
602 | ||
603 | const Float_t kDxyzSDD[] = {AliITSvBeamTestITS04::fgkSDDwidthSens/2., | |
604 | AliITSvBeamTestITS04::fgkSDDthickSens/2., | |
605 | AliITSvBeamTestITS04::fgkSDDlengthSens/2.}; | |
606 | if(!(geom->IsShapeDefined(kSDD))) | |
607 | geom->ReSetShape(kSDD, new AliITSgeomSDD256(3,(Float_t *)kDxyzSDD)); | |
608 | ||
609 | const Float_t kDxyzSSD[] = {AliITSvBeamTestITS04::fgkSSDlengthSens/2, | |
610 | AliITSvBeamTestITS04::fgkSSDthickSens/2, | |
611 | AliITSvBeamTestITS04::fgkSSDwidthSens/2}; | |
612 | if(!(geom->IsShapeDefined(kSSD))) | |
613 | geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(3,(Float_t *)kDxyzSSD)); | |
614 | ||
615 | // Creating the matrices in AliITSgeom for each sensitive volume | |
616 | // (like in AliITSv11GeometrySDD) mln | |
617 | // Here, each layer is one detector | |
618 | ||
619 | char layerName[30]; | |
620 | Int_t startMod = 0,mod; | |
621 | TGeoVolume *itsmotherVolume = gGeoManager->GetVolume("ITSV"); | |
622 | // SPD | |
623 | for (Int_t i=0; i<4;i++) { | |
624 | sprintf(layerName, "ITSspdWafer_%i",i+1); | |
625 | TGeoNode *layNode = itsmotherVolume->GetNode(layerName); | |
626 | if (layNode) { | |
627 | TGeoHMatrix layMatrix(*layNode->GetMatrix()); | |
628 | Double_t *trans = layMatrix.GetTranslation(); | |
629 | Double_t *r = layMatrix.GetRotationMatrix(); | |
630 | Double_t rot[10] = {r[0],r[1],r[2], | |
631 | r[3],r[4],r[5], | |
632 | r[6],r[7],r[8], 1.0}; | |
633 | Int_t iDet = 1; | |
634 | Int_t iLad = 1; | |
635 | Int_t iLay = 1; | |
636 | DecodeDetector(mod,layNode->GetNumber(),i+1,0,0); | |
637 | DecodeDetectorLayers(mod,iLay,iLad,iDet); | |
638 | geom->CreateMatrix(startMod,iLay,iLad,iDet,kSPD,trans,rot); | |
639 | startMod++; | |
640 | }; | |
641 | }; | |
642 | ||
643 | // SDD | |
644 | for (Int_t i=0; i<2;i++) { | |
645 | sprintf(layerName, "ITSsddWafer_%i",i+4+1); | |
646 | TGeoNode *layNode = itsmotherVolume->GetNode(layerName); | |
647 | if (layNode) { | |
648 | TGeoHMatrix layMatrix(*layNode->GetMatrix()); | |
649 | Double_t *trans = layMatrix.GetTranslation(); | |
650 | Double_t *r = layMatrix.GetRotationMatrix(); | |
651 | Double_t rot[10] = {r[0],r[1],r[2], | |
652 | r[3],r[4],r[5], | |
653 | r[6],r[7],r[8], 1.0}; | |
654 | Int_t iDet = 1; | |
655 | Int_t iLad = 1; | |
656 | Int_t iLay = 1; | |
657 | DecodeDetector(mod,layNode->GetNumber(),i+1,0,0); | |
658 | DecodeDetectorLayers(mod,iLay,iLad,iDet); | |
659 | geom->CreateMatrix(startMod,iLay,iLad,iDet,kSDD,trans,rot); | |
660 | startMod++; | |
661 | }; | |
662 | }; | |
663 | ||
664 | // SSD | |
665 | for (Int_t i=0; i<4;i++) { | |
666 | sprintf(layerName, "ITSssdWafer_%i",i+4+2+1); | |
667 | TGeoNode *layNode = itsmotherVolume->GetNode(layerName); | |
668 | if (layNode) { | |
669 | TGeoHMatrix layMatrix(*layNode->GetMatrix()); | |
670 | Double_t *trans = layMatrix.GetTranslation(); | |
671 | Double_t *r = layMatrix.GetRotationMatrix(); | |
672 | Double_t rot[10] = {r[0],r[1],r[2], | |
673 | r[3],r[4],r[5], | |
674 | r[6],r[7],r[8], 1.0}; | |
675 | Int_t iDet = 1; | |
676 | Int_t iLad = 1; | |
677 | Int_t iLay = 5; | |
678 | DecodeDetector(mod,layNode->GetNumber(),i+1,0,0); | |
679 | DecodeDetectorLayers(mod,iLay,iLad,iDet); | |
680 | geom->CreateMatrix(startMod,iLay,iLad,iDet,kSSD,trans,rot); | |
681 | startMod++; | |
682 | }; | |
683 | }; | |
108bd0fe | 684 | |
012f0f4c | 685 | return kTRUE; |
686 | */ | |
023ae34b | 687 | return kFALSE; |
688 | } | |
689 | //______________________________________________________________________ | |
690 | Bool_t AliITSInitGeometry::InitAliITSgeomPPRasymmFMD(AliITSgeom *geom){ | |
691 | // Initilizes the geometry transformation class AliITSgeom | |
692 | // to values appropreate to this specific geometry. Now that | |
693 | // the segmentation is part of AliITSgeom, the detector | |
694 | // segmentations are also defined here. | |
695 | // Inputs: | |
696 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
697 | // Outputs: | |
698 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
699 | // Return: | |
700 | // none. | |
701 | // const Double_t kcm2micron = 1.0E4; | |
702 | const Int_t kItype=0; // Type of transormation defined 0=> Geant | |
703 | const Int_t klayers = 6; // number of layers in the ITS | |
704 | const Int_t kladders[klayers] = {20,40,14,22,34,38}; // Number of ladders | |
705 | const Int_t kdetectors[klayers] = {4,4,6,8,22,25};// number of detector/lad | |
6b0f3880 | 706 | const AliITSDetector kIdet[6] = {kSPD,kSPD,kSDD,kSDD,kSSD,kSSD}; |
707 | const TString kPathbase = "/ALIC_1/ITSV_1/ITSD_1/"; | |
708 | const TString kNames[2][klayers] = { | |
023ae34b | 709 | {"%sIT12_1/I12A_%d/I10A_%d/I103_%d/I101_1/ITS1_1", // lay=1 |
710 | "%sIT12_1/I12A_%d/I20A_%d/I1D3_%d/I1D1_1/ITS2_1", // lay=2 | |
711 | "%sIT34_1/I004_%d/I302_%d/ITS3_%d/", // lay=3 | |
712 | "%sIT34_1/I005_%d/I402_%d/ITS4_%d/", // lay=4 | |
713 | "%sIT56_1/I565_%d/I562_%d/ITS5_%d/", // lay=5 | |
714 | "%sIT56_1/I569_%d/I566_%d/ITS6_%d/"},// lay=6 | |
8f8273a4 | 715 | // {"%sIT12_1/I12B_%d/I10B_%d/I107_%d/I101_1/ITS1_1", // lay=1 |
716 | // "%sIT12_1/I12B_%d/I20B_%d/I1D7_%d/I1D1_1/ITS2_1", // lay=2 | |
54c9a3d9 | 717 | {"%sIT12_1/I12B_%d/I10B_%d/L1H-STAVE%d_1/I107_%d/I101_1/ITS1_1",//lay=1 |
718 | "%sIT12_1/I12B_%d/I20B_%d/L2H-STAVE%d_1/I1D7_%d/I1D1_1/ITS2_1",//lay=2 | |
023ae34b | 719 | "%sIT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3 |
720 | "%sIT34_1/I005_%d/I402_%d/ITS4_%d", // lay=4 | |
721 | "%sIT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5 | |
722 | "%sIT56_1/I569_%d/I566_%d/ITS6_%d"}};// Lay=6 | |
723 | /* | |
724 | Int_t itsGeomTreeCopys[knlayers][3]= {{10, 2, 4},// lay=1 | |
725 | {10, 4, 4},// lay=2 | |
726 | {14, 6, 1},// lay=3 | |
727 | {22, 8, 1},// lay=4 | |
728 | {34,22, 1},// lay=5 | |
729 | {38,25, 1}};//lay=6 | |
730 | */ | |
8f8273a4 | 731 | Int_t mod,nmods=0,lay,lad,det,cpn0,cpn1,cpn2, cpnHS; |
023ae34b | 732 | Double_t tran[3]={0.0,0.0,0.0},rot[10]={9*0.0,1.0}; |
733 | TArrayD shapePar; | |
734 | TString path,shapeName; | |
012f0f4c | 735 | TGeoHMatrix matrix; |
023ae34b | 736 | Bool_t initSeg[3]={kFALSE,kFALSE,kFALSE}; |
24e270ad | 737 | TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch(); |
023ae34b | 738 | |
739 | if(fTiming) time->Start(); | |
740 | for(mod=0;mod<klayers;mod++) nmods += kladders[mod]*kdetectors[mod]; | |
741 | geom->Init(kItype,klayers,kladders,kdetectors,nmods); | |
742 | for(mod=0;mod<nmods;mod++){ | |
743 | DecodeDetectorLayers(mod,lay,lad,det); // Write | |
6b0f3880 | 744 | geom->CreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot); |
023ae34b | 745 | RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det. |
8f8273a4 | 746 | |
54c9a3d9 | 747 | if (kIdet[lay-1]==kSPD) { // we need 1 more copy number because |
748 | // of the half-stave | |
8f8273a4 | 749 | if (det<3) cpnHS = 0; else cpnHS = 1; |
750 | path.Form(kNames[fMinorVersion-1][lay-1].Data(),kPathbase.Data(), | |
751 | cpn0,cpn1,cpnHS,cpn2); | |
752 | } else { | |
753 | path.Form(kNames[fMinorVersion-1][lay-1].Data(),kPathbase.Data(), | |
754 | cpn0,cpn1,cpn2); | |
755 | }; | |
756 | // path.Form(kNames[fMinorVersion-1][lay-1].Data(), | |
757 | // kPathbase.Data(),cpn0,cpn1,cpn2); | |
758 | ||
023ae34b | 759 | geom->GetGeomMatrix(mod)->SetPath(path); |
012f0f4c | 760 | GetTransformation(path.Data(),matrix); |
761 | geom->SetTrans(mod,matrix.GetTranslation()); | |
762 | TransposeTGeoHMatrix(&matrix); //Transpose TGeo's rotation matrixes | |
763 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); | |
6b0f3880 | 764 | if(initSeg[kIdet[lay-1]]) continue; |
023ae34b | 765 | GetShape(path,shapeName,shapePar); |
766 | if(shapeName.CompareTo("BOX")){ | |
012f0f4c | 767 | Error("InitITSgeomPPRasymmFMD", |
768 | "Geometry changed without proper code update or error " | |
769 | "in reading geometry. Shape is not BOX. Shape is %s", | |
770 | shapeName.Data()); | |
771 | return kFALSE; | |
023ae34b | 772 | } // end if |
6b0f3880 | 773 | InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom); |
023ae34b | 774 | } // end for module |
775 | if(fTiming){ | |
776 | time->Stop(); | |
777 | time->Print(); | |
778 | delete time; | |
779 | } // end if | |
780 | return kTRUE; | |
781 | } | |
108bd0fe | 782 | //______________________________________________________________________ |
783 | Bool_t AliITSInitGeometry::InitAliITSgeomV11Hybrid(AliITSgeom *geom){ | |
784 | // Initilizes the geometry transformation class AliITSgeom | |
785 | // to values appropreate to this specific geometry. Now that | |
786 | // the segmentation is part of AliITSgeom, the detector | |
787 | // segmentations are also defined here. | |
788 | // Inputs: | |
789 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
790 | // Outputs: | |
791 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
792 | // Return: | |
793 | // none. | |
794 | ||
795 | const Int_t kItype = 0; // Type of transformation defined 0=> Geant | |
796 | const Int_t klayers = 6; // number of layers in the ITS | |
797 | const Int_t kladders[klayers] = {20,40,14,22,34,38}; // Number of ladders | |
798 | const Int_t kdetectors[klayers] = {4,4,6,8,22,25};// number of detector/lad | |
799 | const AliITSDetector kIdet[6] = {kSPD,kSPD,kSDD,kSDD,kSSD,kSSD}; | |
800 | const TString kPathbase = "/ALIC_1/ITSV_1/"; | |
8f8273a4 | 801 | |
802 | char *pathSPDsens1, *pathSPDsens2; | |
803 | if (SPDIsTGeoNative()) { | |
54c9a3d9 | 804 | pathSPDsens1="%sITSSPD_1/ITSSPDCarbonFiberSectorV_%d/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay1-Stave_%d/ITSSPDhalf-Stave%d_1/ITSSPDlay1-Ladder_%d/ITSSPDlay1-sensor_1"; |
805 | pathSPDsens2="%sITSSPD_1/ITSSPDCarbonFiberSectorV_%d/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay2-Stave_%d/ITSSPDhalf-Stave%d_1/ITSSPDlay2-Ladder_%d/ITSSPDlay2-sensor_1"; | |
8f8273a4 | 806 | } else{ |
807 | pathSPDsens1 = "%sITSD_1/IT12_1/I12B_%d/I10B_%d/L1H-STAVE%d_1/I107_%d/I101_1/ITS1_1"; | |
808 | pathSPDsens2 = "%sITSD_1/IT12_1/I12B_%d/I20B_%d/L2H-STAVE%d_1/I1D7_%d/I1D1_1/ITS2_1"; | |
809 | } | |
810 | ||
108bd0fe | 811 | char *pathSDDsens1, *pathSDDsens2; |
812 | if (SDDIsTGeoNative()) { | |
813 | pathSDDsens1 = "%sITSsddLayer3_1/ITSsddLadd_%d/ITSsddSensor3_%d/ITSsddWafer3_%d/ITSsddSensitivL3_1"; | |
814 | pathSDDsens2 = "%sITSsddLayer4_1/ITSsddLadd_%d/ITSsddSensor4_%d/ITSsddWafer4_%d/ITSsddSensitivL4_1"; | |
815 | } else{ | |
816 | pathSDDsens1 = "%sITSD_1/IT34_1/I004_%d/I302_%d/ITS3_%d"; | |
817 | pathSDDsens2 = "%sITSD_1/IT34_1/I005_%d/I402_%d/ITS4_%d"; | |
818 | } | |
bf210566 | 819 | |
820 | char *pathSSDsens1, *pathSSDsens2; | |
821 | if (SSDIsTGeoNative()) { | |
ef9451a3 | 822 | pathSSDsens1 = "%sITSssdLayer5_1/ITSssdLay5Ladd_%d/ITSssdSensor5_%d/ITSssdSensitivL5_1"; |
823 | pathSSDsens2 = "%sITSssdLayer6_1/ITSssdLay6Ladd_%d/ITSssdSensor6_%d/ITSssdSensitivL6_1"; | |
bf210566 | 824 | } else{ |
825 | pathSSDsens1 = "%sITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d"; | |
826 | pathSSDsens2 = "%sITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d"; | |
827 | } | |
828 | ||
108bd0fe | 829 | const TString kNames[klayers] = { |
8f8273a4 | 830 | pathSPDsens1, // lay=1 |
831 | pathSPDsens2, // lay=2 | |
108bd0fe | 832 | pathSDDsens1, // lay=3 |
833 | pathSDDsens2, // lay=4 | |
bf210566 | 834 | pathSSDsens1, // lay=5 |
835 | pathSSDsens2};// Lay=6 | |
108bd0fe | 836 | |
8f8273a4 | 837 | Int_t mod,nmods=0, lay, lad, det, cpn0, cpn1, cpn2, cpnHS=1; |
108bd0fe | 838 | Double_t tran[3]={0.,0.,0.}, rot[10]={9*0.0,1.0}; |
839 | TArrayD shapePar; | |
840 | TString path, shapeName; | |
841 | TGeoHMatrix matrix; | |
842 | Bool_t initSeg[3]={kFALSE, kFALSE, kFALSE}; | |
843 | TStopwatch *time = 0x0; | |
844 | if(fTiming) time = new TStopwatch(); | |
845 | ||
846 | if(fTiming) time->Start(); | |
847 | for(mod=0;mod<klayers;mod++) nmods += kladders[mod]*kdetectors[mod]; | |
848 | geom->Init(kItype,klayers,kladders,kdetectors,nmods); | |
849 | ||
8f8273a4 | 850 | for(mod=0; mod<nmods; mod++) { |
108bd0fe | 851 | |
8f8273a4 | 852 | DecodeDetectorLayers(mod,lay,lad,det); |
108bd0fe | 853 | geom->CreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot); |
8f8273a4 | 854 | RecodeDetectorv11Hybrid(mod,cpn0,cpn1,cpn2); |
855 | ||
856 | // if (SPDIsTGeoNative()) | |
857 | // if (kIdet[lay-1]==kSPD) { | |
858 | // cpn0 = lad-1; | |
859 | // cpn1 = det-1; | |
860 | // cpn2 = 1; | |
861 | // } | |
862 | // if (SDDIsTGeoNative()) | |
863 | // if (kIdet[lay-1]==kSDD) { | |
864 | // cpn0 = lad-1; | |
865 | // cpn1 = det-1; | |
866 | // cpn2 = 1; | |
867 | // } | |
868 | // if (SSDIsTGeoNative()) | |
869 | // if (kIdet[lay-1]==kSSD) { | |
870 | // cpn0 = lad-1; | |
871 | // cpn1 = det-1; | |
872 | // cpn2 = 1; | |
873 | // } | |
874 | ||
875 | if (kIdet[lay-1]==kSPD) { // we need 1 more copy number because of the half-stave | |
876 | if (det<3) cpnHS = 0; else cpnHS = 1; | |
877 | path.Form(kNames[lay-1].Data(),kPathbase.Data(),cpn0,cpn1,cpnHS,cpn2); | |
878 | } else { | |
879 | path.Form(kNames[lay-1].Data(),kPathbase.Data(),cpn0,cpn1,cpn2); | |
880 | }; | |
108bd0fe | 881 | |
108bd0fe | 882 | geom->GetGeomMatrix(mod)->SetPath(path); |
883 | GetTransformation(path.Data(),matrix); | |
884 | geom->SetTrans(mod,matrix.GetTranslation()); | |
012f0f4c | 885 | TransposeTGeoHMatrix(&matrix); //Transpose TGeo's rotation matrixes |
108bd0fe | 886 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); |
887 | if(initSeg[kIdet[lay-1]]) continue; | |
888 | GetShape(path,shapeName,shapePar); | |
889 | if(shapeName.CompareTo("BOX")){ | |
890 | Error("InitITSgeom","Geometry changed without proper code update" | |
891 | "or error in reading geometry. Shape is not BOX."); | |
892 | return kFALSE; | |
893 | } // end if | |
894 | InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom); | |
895 | } // end for module | |
896 | ||
897 | if(fTiming){ | |
898 | time->Stop(); | |
899 | time->Print(); | |
900 | delete time; | |
901 | } // end if | |
902 | return kTRUE; | |
903 | } | |
108bd0fe | 904 | //______________________________________________________________________ |
905 | Bool_t AliITSInitGeometry::InitAliITSgeomV11(AliITSgeom *geom){ | |
906 | // Initilizes the geometry transformation class AliITSgeom | |
907 | // Now that the segmentation is part of AliITSgeom, the detector | |
908 | // segmentations are also defined here. | |
909 | // | |
910 | // Inputs: | |
911 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
912 | // Outputs: | |
913 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
914 | // LG | |
915 | ||
916 | ||
917 | const Int_t kItype=0; // Type of transormation defined 0=> Geant | |
918 | const Int_t klayers = 6; // number of layers in the ITS | |
919 | const Int_t kladders[klayers] = {20,40,14,22,34,38}; // Number of ladders | |
920 | const Int_t kdetectors[klayers] = {4,4,6,8,22,25};// number of detector/lad | |
921 | const AliITSDetector kIdet[6] = {kSPD,kSPD,kSDD,kSDD,kSSD,kSSD}; | |
922 | ||
923 | const TString kPathbase = "/ALIC_1/ITSV_1/"; | |
924 | const TString kNames[klayers] = | |
925 | {"AliITSInitGeometry:spd missing", // lay=1 | |
926 | "AliITSInitGeometry:spd missing", // lay=2 | |
927 | "%sITSsddLayer3_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_1/ITSsddSensitiv_1", // lay=3 | |
928 | "%sITSsddLayer4_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_1/ITSsddSensitiv_1", // lay=4 | |
929 | "AliITSInitGeometry:ssd missing", // lay=5 | |
930 | "AliITSInitGeometry:ssd missing"};// lay=6 | |
931 | ||
932 | Int_t mod,nmods=0,lay,lad,det,cpn0,cpn1,cpn2; | |
933 | Double_t tran[3]={0.0,0.0,0.0},rot[10]={9*0.0,1.0}; | |
934 | TArrayD shapePar; | |
935 | TString path,shapeName; | |
936 | TGeoHMatrix matrix; | |
937 | Bool_t initSeg[3]={kFALSE,kFALSE,kFALSE}; | |
938 | TStopwatch *time = 0x0;if(fTiming) time=new TStopwatch(); | |
939 | ||
940 | if(fTiming) time->Start(); | |
941 | for(mod=0;mod<klayers;mod++) nmods += kladders[mod]*kdetectors[mod]; | |
942 | ||
943 | geom->Init(kItype,klayers,kladders,kdetectors,nmods); | |
944 | for(mod=0;mod<nmods;mod++) { | |
945 | ||
946 | DecodeDetectorLayers(mod,lay,lad,det); // Write | |
947 | geom->CreateMatrix(mod,lay,lad,det,kIdet[lay-1],tran,rot); | |
948 | RecodeDetector(mod,cpn0,cpn1,cpn2); // Write reusing lay,lad,det. | |
949 | path.Form(kNames[lay-1].Data(), | |
950 | kPathbase.Data(),cpn0,cpn1,cpn2); | |
951 | geom->GetGeomMatrix(mod)->SetPath(path); | |
952 | if (GetTransformation(path.Data(),matrix)) { | |
953 | geom->SetTrans(mod,matrix.GetTranslation()); | |
012f0f4c | 954 | TransposeTGeoHMatrix(&matrix); //Transpose TGeo's rotation matrixes |
108bd0fe | 955 | geom->SetRotMatrix(mod,matrix.GetRotationMatrix()); |
956 | } | |
957 | ||
958 | if(initSeg[kIdet[lay-1]]) continue; | |
959 | GetShape(path,shapeName,shapePar); | |
960 | if(shapeName.CompareTo("BOX")){ | |
961 | Error("InitAliITSgeomV11","Geometry changed without proper code update" | |
962 | "or error in reading geometry. Shape is not BOX."); | |
963 | return kFALSE; | |
964 | } // end if | |
965 | InitGeomShapePPRasymmFMD(kIdet[lay-1],initSeg,shapePar,geom); | |
966 | ||
967 | } // end for module | |
968 | ||
969 | if(fTiming){ | |
970 | time->Stop(); | |
971 | time->Print(); | |
972 | delete time; | |
973 | } // end if | |
974 | return kTRUE; | |
975 | } | |
976 | ||
023ae34b | 977 | //______________________________________________________________________ |
978 | Bool_t AliITSInitGeometry::InitGeomShapePPRasymmFMD(AliITSDetector idet, | |
979 | Bool_t *initSeg, | |
980 | TArrayD &shapePar, | |
981 | AliITSgeom *geom){ | |
982 | // Initilizes the geometry segmentation class AliITSgeomS?D, or | |
983 | // AliITSsegmentationS?D depending on the vaule of fSegGeom, | |
984 | // to values appropreate to this specific geometry. Now that | |
985 | // the segmentation is part of AliITSgeom, the detector | |
986 | // segmentations are also defined here. | |
987 | // Inputs: | |
988 | // Int_t lay The layer number/name. | |
989 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
990 | // Outputs: | |
991 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
992 | // Return: | |
993 | // none. | |
994 | // const Double_t kcm2micron = 1.0E4; | |
995 | const Double_t kmicron2cm = 1.0E-4; | |
996 | Int_t i; | |
997 | TArrayF shapeParF; | |
998 | ||
999 | shapeParF.Set(shapePar.GetSize()); | |
1000 | for(i=0;i<shapePar.GetSize();i++) shapeParF[i]=shapePar[i]; | |
1001 | switch (idet){ | |
1002 | case kSPD:{ | |
1003 | initSeg[idet] = kTRUE; | |
1004 | AliITSgeomSPD *geomSPD = new AliITSgeomSPD425Short(); | |
1005 | Float_t bx[256],bz[280]; | |
54c9a3d9 | 1006 | for(i=000;i<256;i++) bx[i] = 50.0*kmicron2cm;//in x all are 50 microns. |
1007 | for(i=000;i<160;i++) bz[i] =425.0*kmicron2cm; // most are 425 microns | |
023ae34b | 1008 | // except below |
1009 | for(i=160;i<280;i++) bz[i] = 0.0*kmicron2cm; // Outside of detector. | |
1010 | bz[ 31] = bz[ 32] = 625.0*kmicron2cm; // first chip boundry | |
1011 | bz[ 63] = bz[ 64] = 625.0*kmicron2cm; // first chip boundry | |
1012 | bz[ 95] = bz[ 96] = 625.0*kmicron2cm; // first chip boundry | |
1013 | bz[127] = bz[128] = 625.0*kmicron2cm; // first chip boundry | |
54c9a3d9 | 1014 | bz[160] = 425.0*kmicron2cm;// Set so that there is no zero |
1015 | // pixel size for fNz. | |
023ae34b | 1016 | geomSPD->ReSetBins(shapeParF[1],256,bx,160,bz); |
1017 | geom->ReSetShape(idet,geomSPD); | |
1018 | }break; | |
1019 | case kSDD:{ | |
1020 | initSeg[idet] = kTRUE; | |
1021 | AliITSgeomSDD *geomSDD = new AliITSgeomSDD256(shapeParF.GetSize(), | |
1022 | shapeParF.GetArray()); | |
1023 | geom->ReSetShape(idet,geomSDD); | |
1024 | }break; | |
1025 | case kSSD:{ | |
1026 | initSeg[idet] = kTRUE; | |
1027 | AliITSgeomSSD *geomSSD = new AliITSgeomSSD275and75( | |
1028 | shapeParF.GetSize(),shapeParF.GetArray()); | |
1029 | geom->ReSetShape(idet,geomSSD); | |
1030 | }break; | |
1031 | default:{// Others, Note no kSDDp or kSSDp in this geometry. | |
1032 | geom->ReSetShape(idet,0); | |
1033 | Info("InitGeomShapePPRasymmFMD", | |
1034 | "default Dx=%f Dy=%f Dz=%f default=%d", | |
1035 | shapePar[0],shapePar[1],shapePar[2],idet); | |
1036 | }break; | |
1037 | } // end switch | |
1038 | return kTRUE; | |
1039 | } | |
1040 | //______________________________________________________________________ | |
1041 | Bool_t AliITSInitGeometry::InitSegmentationPPRasymmFMD(AliITSDetector idet, | |
1042 | Bool_t *initSeg, | |
1043 | TArrayD &shapePar, | |
1044 | AliITSgeom *geom){ | |
1045 | // Initilizes the geometry segmentation class AliITSgeomS?D, or | |
1046 | // AliITSsegmentationS?D depending on the vaule of fSegGeom, | |
1047 | // to values appropreate to this specific geometry. Now that | |
1048 | // the segmentation is part of AliITSgeom, the detector | |
1049 | // segmentations are also defined here. | |
1050 | // Inputs: | |
1051 | // Int_t lay The layer number/name. | |
1052 | // AliITSgeom *geom A pointer to the AliITSgeom class | |
1053 | // Outputs: | |
1054 | // AliITSgeom *geom This pointer recreated and properly inilized. | |
1055 | // Return: | |
1056 | // none. | |
1057 | const Double_t kcm2micron = 1.0E4; | |
1058 | Int_t i; | |
1059 | ||
1060 | switch (idet){ | |
1061 | case kSPD:{ | |
1062 | initSeg[idet] = kTRUE; | |
1063 | AliITSsegmentationSPD *segSPD = new AliITSsegmentationSPD(); | |
1064 | segSPD->SetDetSize(2.*shapePar[0]*kcm2micron, // X | |
1065 | 2.*shapePar[2]*kcm2micron, // Z | |
1066 | 2.*shapePar[1]*kcm2micron);// Y Microns | |
1067 | segSPD->SetNPads(256,160);// Number of Bins in x and z | |
1068 | Float_t bx[256],bz[280]; | |
1069 | for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns. | |
1070 | for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns | |
1071 | // except below | |
1072 | for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector. | |
1073 | bz[ 31] = bz[ 32] = 625.0; // first chip boundry | |
1074 | bz[ 63] = bz[ 64] = 625.0; // first chip boundry | |
1075 | bz[ 95] = bz[ 96] = 625.0; // first chip boundry | |
1076 | bz[127] = bz[128] = 625.0; // first chip boundry | |
1077 | bz[160] = 425.0;// Set so that there is no zero pixel size for fNz. | |
1078 | segSPD->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now. | |
1079 | geom->ReSetShape(idet,segSPD); | |
1080 | }break; | |
1081 | case kSDD:{ | |
1082 | initSeg[idet] = kTRUE; | |
1083 | AliITSsegmentationSDD *segSDD = new AliITSsegmentationSDD(); | |
1084 | segSDD->SetDetSize(shapePar[0]*kcm2micron, // X | |
1085 | 2.*shapePar[2]*kcm2micron, // Z | |
1086 | 2.*shapePar[1]*kcm2micron);// Y Microns | |
1087 | segSDD->SetNPads(256,256);// Anodes, Samples | |
1088 | geom->ReSetShape(idet,segSDD); | |
1089 | }break; | |
1090 | case kSSD:{ | |
1091 | initSeg[idet] = kTRUE; | |
1092 | AliITSsegmentationSSD *segSSD = new AliITSsegmentationSSD(); | |
1093 | segSSD->SetDetSize(2.*shapePar[0]*kcm2micron, // X | |
1094 | 2.*shapePar[2]*kcm2micron, // Z | |
1095 | 2.*shapePar[1]*kcm2micron);// Y Microns. | |
1096 | segSSD->SetPadSize(95.,0.); // strip x pitch in microns | |
1097 | segSSD->SetNPads(768,2); // number of strips on each side, sides. | |
1098 | segSSD->SetAngles(0.0075,0.0275); // strip angels rad P and N side. | |
1099 | segSSD->SetAnglesLay5(0.0075,0.0275);//strip angels rad P and N | |
1100 | segSSD->SetAnglesLay6(0.0275,0.0075);//strip angels rad P and N | |
1101 | geom->ReSetShape(idet,segSSD); | |
1102 | }break; | |
1103 | default:{// Others, Note no kSDDp or kSSDp in this geometry. | |
1104 | geom->ReSetShape(idet,0); | |
1105 | Info("InitSegmentationPPRasymmFMD", | |
1106 | "default segmentation Dx=%f Dy=%f Dz=%f default=%d", | |
1107 | shapePar[0],shapePar[1],shapePar[2],idet); | |
1108 | }break; | |
1109 | } // end switch | |
1110 | return kTRUE; | |
1111 | } | |
1112 | //______________________________________________________________________ | |
1113 | Bool_t AliITSInitGeometry::GetTransformation(const TString &volumePath, | |
1114 | TGeoHMatrix &mat){ | |
1115 | // Returns the Transformation matrix between the volume specified | |
1116 | // by the path volumePath and the Top or mater volume. The format | |
1117 | // of the path volumePath is as follows (assuming ALIC is the Top volume) | |
1118 | // "/ALIC_1/DDIP_1/S05I_2/S05H_1/S05G_3". Here ALIC is the top most | |
1119 | // or master volume which has only 1 instance of. Of all of the daughter | |
1120 | // volumes of ALICE, DDIP volume copy #1 is indicated. Similarly for | |
1121 | // the daughter volume of DDIP is S05I copy #2 and so on. | |
1122 | // Inputs: | |
1123 | // TString& volumePath The volume path to the specific volume | |
1124 | // for which you want the matrix. Volume name | |
1125 | // hierarchy is separated by "/" while the | |
1126 | // copy number is appended using a "_". | |
1127 | // Outputs: | |
1128 | // TGeoHMatrix &mat A matrix with its values set to those | |
1129 | // appropriate to the Local to Master transformation | |
1130 | // Return: | |
1131 | // A logical value if kFALSE then an error occurred and no change to | |
1132 | // mat was made. | |
1133 | ||
1134 | // We have to preserve the modeler state | |
1135 | ||
1136 | // Preserve the modeler state. | |
1137 | gGeoManager->PushPath(); | |
1138 | if (!gGeoManager->cd(volumePath.Data())) { | |
108bd0fe | 1139 | gGeoManager->PopPath(); |
1140 | Error("GetTransformation","Error in cd-ing to ",volumePath.Data()); | |
1141 | return kFALSE; | |
023ae34b | 1142 | } // end if !gGeoManager |
1143 | mat = *gGeoManager->GetCurrentMatrix(); | |
1144 | // Retstore the modeler state. | |
1145 | gGeoManager->PopPath(); | |
1146 | return kTRUE; | |
1147 | } | |
1148 | //______________________________________________________________________ | |
1149 | Bool_t AliITSInitGeometry::GetShape(const TString &volumePath, | |
1150 | TString &shapeType,TArrayD &par){ | |
1151 | // Returns the shape and its parameters for the volume specified | |
1152 | // by volumeName. | |
1153 | // Inputs: | |
1154 | // TString& volumeName The volume name | |
1155 | // Outputs: | |
1156 | // TString &shapeType Shape type | |
1157 | // TArrayD &par A TArrayD of parameters with all of the | |
1158 | // parameters of the specified shape. | |
1159 | // Return: | |
1160 | // A logical indicating whether there was an error in getting this | |
1161 | // information | |
1162 | Int_t npar; | |
1163 | gGeoManager->PushPath(); | |
1164 | if (!gGeoManager->cd(volumePath.Data())) { | |
1165 | gGeoManager->PopPath(); | |
1166 | return kFALSE; | |
1167 | } | |
1168 | TGeoVolume * vol = gGeoManager->GetCurrentVolume(); | |
1169 | gGeoManager->PopPath(); | |
1170 | if (!vol) return kFALSE; | |
1171 | TGeoShape *shape = vol->GetShape(); | |
6b0f3880 | 1172 | TClass *classType = shape->IsA(); |
1173 | if (classType==TGeoBBox::Class()) { | |
023ae34b | 1174 | shapeType = "BOX"; |
1175 | npar = 3; | |
1176 | par.Set(npar); | |
1177 | TGeoBBox *box = (TGeoBBox*)shape; | |
1178 | par.AddAt(box->GetDX(),0); | |
1179 | par.AddAt(box->GetDY(),1); | |
1180 | par.AddAt(box->GetDZ(),2); | |
1181 | return kTRUE; | |
012f0f4c | 1182 | } // end if |
6b0f3880 | 1183 | if (classType==TGeoTrd1::Class()) { |
023ae34b | 1184 | shapeType = "TRD1"; |
1185 | npar = 4; | |
1186 | par.Set(npar); | |
1187 | TGeoTrd1 *trd1 = (TGeoTrd1*)shape; | |
1188 | par.AddAt(trd1->GetDx1(),0); | |
1189 | par.AddAt(trd1->GetDx2(),1); | |
1190 | par.AddAt(trd1->GetDy(), 2); | |
1191 | par.AddAt(trd1->GetDz(), 3); | |
1192 | return kTRUE; | |
012f0f4c | 1193 | } // end if |
6b0f3880 | 1194 | if (classType==TGeoTrd2::Class()) { |
023ae34b | 1195 | shapeType = "TRD2"; |
1196 | npar = 5; | |
1197 | par.Set(npar); | |
1198 | TGeoTrd2 *trd2 = (TGeoTrd2*)shape; | |
1199 | par.AddAt(trd2->GetDx1(),0); | |
1200 | par.AddAt(trd2->GetDx2(),1); | |
1201 | par.AddAt(trd2->GetDy1(),2); | |
1202 | par.AddAt(trd2->GetDy2(),3); | |
1203 | par.AddAt(trd2->GetDz(), 4); | |
1204 | return kTRUE; | |
012f0f4c | 1205 | } // end if |
6b0f3880 | 1206 | if (classType==TGeoTrap::Class()) { |
023ae34b | 1207 | shapeType = "TRAP"; |
1208 | npar = 11; | |
1209 | par.Set(npar); | |
1210 | TGeoTrap *trap = (TGeoTrap*)shape; | |
1211 | Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad()); | |
1212 | par.AddAt(trap->GetDz(),0); | |
1213 | par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1); | |
1214 | par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2); | |
1215 | par.AddAt(trap->GetH1(),3); | |
1216 | par.AddAt(trap->GetBl1(),4); | |
1217 | par.AddAt(trap->GetTl1(),5); | |
1218 | par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6); | |
1219 | par.AddAt(trap->GetH2(),7); | |
1220 | par.AddAt(trap->GetBl2(),8); | |
1221 | par.AddAt(trap->GetTl2(),9); | |
1222 | par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10); | |
1223 | return kTRUE; | |
012f0f4c | 1224 | } // end if |
6b0f3880 | 1225 | if (classType==TGeoTube::Class()) { |
023ae34b | 1226 | shapeType = "TUBE"; |
1227 | npar = 3; | |
1228 | par.Set(npar); | |
1229 | TGeoTube *tube = (TGeoTube*)shape; | |
1230 | par.AddAt(tube->GetRmin(),0); | |
1231 | par.AddAt(tube->GetRmax(),1); | |
1232 | par.AddAt(tube->GetDz(),2); | |
1233 | return kTRUE; | |
012f0f4c | 1234 | } // end if |
6b0f3880 | 1235 | if (classType==TGeoTubeSeg::Class()) { |
023ae34b | 1236 | shapeType = "TUBS"; |
1237 | npar = 5; | |
1238 | par.Set(npar); | |
1239 | TGeoTubeSeg *tubs = (TGeoTubeSeg*)shape; | |
1240 | par.AddAt(tubs->GetRmin(),0); | |
1241 | par.AddAt(tubs->GetRmax(),1); | |
1242 | par.AddAt(tubs->GetDz(),2); | |
1243 | par.AddAt(tubs->GetPhi1(),3); | |
1244 | par.AddAt(tubs->GetPhi2(),4); | |
1245 | return kTRUE; | |
012f0f4c | 1246 | } // end if |
6b0f3880 | 1247 | if (classType==TGeoCone::Class()) { |
023ae34b | 1248 | shapeType = "CONE"; |
1249 | npar = 5; | |
1250 | par.Set(npar); | |
1251 | TGeoCone *cone = (TGeoCone*)shape; | |
1252 | par.AddAt(cone->GetDz(),0); | |
1253 | par.AddAt(cone->GetRmin1(),1); | |
1254 | par.AddAt(cone->GetRmax1(),2); | |
1255 | par.AddAt(cone->GetRmin2(),3); | |
1256 | par.AddAt(cone->GetRmax2(),4); | |
1257 | return kTRUE; | |
012f0f4c | 1258 | } // end if |
6b0f3880 | 1259 | if (classType==TGeoConeSeg::Class()) { |
023ae34b | 1260 | shapeType = "CONS"; |
1261 | npar = 7; | |
1262 | par.Set(npar); | |
1263 | TGeoConeSeg *cons = (TGeoConeSeg*)shape; | |
1264 | par.AddAt(cons->GetDz(),0); | |
1265 | par.AddAt(cons->GetRmin1(),1); | |
1266 | par.AddAt(cons->GetRmax1(),2); | |
1267 | par.AddAt(cons->GetRmin2(),3); | |
1268 | par.AddAt(cons->GetRmax2(),4); | |
1269 | par.AddAt(cons->GetPhi1(),5); | |
1270 | par.AddAt(cons->GetPhi2(),6); | |
1271 | return kTRUE; | |
012f0f4c | 1272 | } // end if |
6b0f3880 | 1273 | if (classType==TGeoSphere::Class()) { |
023ae34b | 1274 | shapeType = "SPHE"; |
1275 | npar = 6; | |
1276 | par.Set(npar); | |
1277 | ||
1278 | TGeoSphere *sphe = (TGeoSphere*)shape; | |
1279 | par.AddAt(sphe->GetRmin(),0); | |
1280 | par.AddAt(sphe->GetRmax(),1); | |
1281 | par.AddAt(sphe->GetTheta1(),2); | |
1282 | par.AddAt(sphe->GetTheta2(),3); | |
1283 | par.AddAt(sphe->GetPhi1(),4); | |
1284 | par.AddAt(sphe->GetPhi2(),5); | |
1285 | return kTRUE; | |
012f0f4c | 1286 | } // end if |
6b0f3880 | 1287 | if (classType==TGeoPara::Class()) { |
023ae34b | 1288 | shapeType = "PARA"; |
1289 | npar = 6; | |
1290 | par.Set(npar); | |
1291 | TGeoPara *para = (TGeoPara*)shape; | |
1292 | par.AddAt(para->GetX(),0); | |
1293 | par.AddAt(para->GetY(),1); | |
1294 | par.AddAt(para->GetZ(),2); | |
1295 | par.AddAt(para->GetTxy(),3); | |
1296 | par.AddAt(para->GetTxz(),4); | |
1297 | par.AddAt(para->GetTyz(),5); | |
1298 | return kTRUE; | |
012f0f4c | 1299 | } // end if |
6b0f3880 | 1300 | if (classType==TGeoPgon::Class()) { |
023ae34b | 1301 | shapeType = "PGON"; |
1302 | TGeoPgon *pgon = (TGeoPgon*)shape; | |
1303 | Int_t nz = pgon->GetNz(); | |
1304 | const Double_t *rmin = pgon->GetRmin(); | |
1305 | const Double_t *rmax = pgon->GetRmax(); | |
1306 | const Double_t *z = pgon->GetZ(); | |
1307 | npar = 4 + 3*nz; | |
1308 | par.Set(npar); | |
1309 | par.AddAt(pgon->GetPhi1(),0); | |
1310 | par.AddAt(pgon->GetDphi(),1); | |
1311 | par.AddAt(pgon->GetNedges(),2); | |
1312 | par.AddAt(pgon->GetNz(),3); | |
1313 | for (Int_t i=0; i<nz; i++) { | |
1314 | par.AddAt(z[i], 4+3*i); | |
1315 | par.AddAt(rmin[i], 4+3*i+1); | |
1316 | par.AddAt(rmax[i], 4+3*i+2); | |
1317 | } | |
1318 | return kTRUE; | |
012f0f4c | 1319 | } // end if |
6b0f3880 | 1320 | if (classType==TGeoPcon::Class()) { |
023ae34b | 1321 | shapeType = "PCON"; |
1322 | TGeoPcon *pcon = (TGeoPcon*)shape; | |
1323 | Int_t nz = pcon->GetNz(); | |
1324 | const Double_t *rmin = pcon->GetRmin(); | |
1325 | const Double_t *rmax = pcon->GetRmax(); | |
1326 | const Double_t *z = pcon->GetZ(); | |
1327 | npar = 3 + 3*nz; | |
1328 | par.Set(npar); | |
1329 | par.AddAt(pcon->GetPhi1(),0); | |
1330 | par.AddAt(pcon->GetDphi(),1); | |
1331 | par.AddAt(pcon->GetNz(),2); | |
1332 | for (Int_t i=0; i<nz; i++) { | |
1333 | par.AddAt(z[i], 3+3*i); | |
1334 | ||
1335 | par.AddAt(rmin[i], 3+3*i+1); | |
1336 | par.AddAt(rmax[i], 3+3*i+2); | |
1337 | } | |
1338 | return kTRUE; | |
012f0f4c | 1339 | } // end if |
6b0f3880 | 1340 | if (classType==TGeoEltu::Class()) { |
023ae34b | 1341 | shapeType = "ELTU"; |
1342 | npar = 3; | |
1343 | par.Set(npar); | |
1344 | TGeoEltu *eltu = (TGeoEltu*)shape; | |
1345 | par.AddAt(eltu->GetA(),0); | |
1346 | par.AddAt(eltu->GetB(),1); | |
1347 | par.AddAt(eltu->GetDz(),2); | |
1348 | return kTRUE; | |
012f0f4c | 1349 | } // end if |
6b0f3880 | 1350 | if (classType==TGeoHype::Class()) { |
023ae34b | 1351 | shapeType = "HYPE"; |
1352 | npar = 5; | |
1353 | par.Set(npar); | |
1354 | TGeoHype *hype = (TGeoHype*)shape; | |
1355 | par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kTRUE)),0); | |
1356 | par.AddAt(TMath::Sqrt(hype->RadiusHypeSq(0.,kFALSE)),1); | |
1357 | par.AddAt(hype->GetDZ(),2); | |
1358 | par.AddAt(hype->GetStIn(),3); | |
1359 | par.AddAt(hype->GetStOut(),4); | |
1360 | return kTRUE; | |
012f0f4c | 1361 | } // end if |
6b0f3880 | 1362 | if (classType==TGeoGtra::Class()) { |
023ae34b | 1363 | shapeType = "GTRA"; |
1364 | npar = 12; | |
1365 | par.Set(npar); | |
1366 | TGeoGtra *trap = (TGeoGtra*)shape; | |
1367 | Double_t tth = TMath::Tan(trap->GetTheta()*TMath::DegToRad()); | |
1368 | par.AddAt(trap->GetDz(),0); | |
1369 | par.AddAt(tth*TMath::Cos(trap->GetPhi()*TMath::DegToRad()),1); | |
1370 | par.AddAt(tth*TMath::Sin(trap->GetPhi()*TMath::DegToRad()),2); | |
1371 | par.AddAt(trap->GetH1(),3); | |
1372 | par.AddAt(trap->GetBl1(),4); | |
1373 | par.AddAt(trap->GetTl1(),5); | |
1374 | par.AddAt(TMath::Tan(trap->GetAlpha1()*TMath::DegToRad()),6); | |
1375 | par.AddAt(trap->GetH2(),7); | |
1376 | par.AddAt(trap->GetBl2(),8); | |
1377 | par.AddAt(trap->GetTl2(),9); | |
1378 | par.AddAt(TMath::Tan(trap->GetAlpha2()*TMath::DegToRad()),10); | |
1379 | par.AddAt(trap->GetTwistAngle(),11); | |
1380 | return kTRUE; | |
012f0f4c | 1381 | } // end if |
6b0f3880 | 1382 | if (classType==TGeoCtub::Class()) { |
023ae34b | 1383 | shapeType = "CTUB"; |
1384 | npar = 11; | |
1385 | par.Set(npar); | |
1386 | TGeoCtub *ctub = (TGeoCtub*)shape; | |
1387 | const Double_t *lx = ctub->GetNlow(); | |
1388 | const Double_t *tx = ctub->GetNhigh(); | |
1389 | par.AddAt(ctub->GetRmin(),0); | |
1390 | par.AddAt(ctub->GetRmax(),1); | |
1391 | par.AddAt(ctub->GetDz(),2); | |
1392 | par.AddAt(ctub->GetPhi1(),3); | |
1393 | par.AddAt(ctub->GetPhi2(),4); | |
1394 | par.AddAt(lx[0],5); | |
1395 | par.AddAt(lx[1],6); | |
1396 | par.AddAt(lx[2],7); | |
1397 | par.AddAt(tx[0],8); | |
1398 | par.AddAt(tx[1],9); | |
1399 | par.AddAt(tx[2],10); | |
1400 | return kTRUE; | |
012f0f4c | 1401 | } // end if |
023ae34b | 1402 | Error("GetShape","Getting shape parameters for shape %s not implemented", |
1403 | shape->ClassName()); | |
012f0f4c | 1404 | shapeType = "Unknown"; |
023ae34b | 1405 | return kFALSE; |
1406 | } | |
1407 | //______________________________________________________________________ | |
012f0f4c | 1408 | void AliITSInitGeometry::DecodeDetector( |
1409 | Int_t &mod,Int_t layer,Int_t cpn0,Int_t cpn1,Int_t cpn2) const { | |
023ae34b | 1410 | // decode geometry into detector module number. There are two decoding |
1411 | // Scheams. Old which does not follow the ALICE coordinate system | |
1412 | // requirements, and New which dose. | |
1413 | // Inputs: | |
1414 | // Int_t layer The ITS layer | |
1415 | // Int_t cpn0 The lowest copy number | |
1416 | // Int_t cpn1 The middle copy number | |
1417 | // Int_t cpn2 the highest copy number | |
1418 | // Output: | |
1419 | // Int_t &mod The module number assoicated with this set | |
1420 | // of copy numbers. | |
1421 | // Return: | |
1422 | // none. | |
023ae34b | 1423 | |
012f0f4c | 1424 | // This is a FIXED switch yard function. I (Bjorn Nilsen) Don't |
1425 | // like them but I see not better way for the moment. | |
1426 | switch (fMajorVersion){ | |
1427 | case kvtest:{ | |
1428 | if(GetMinorVersion()==1) | |
1429 | return DecodeDetectorvPPRasymmFMD(mod,layer,cpn0,cpn1,cpn2); | |
1430 | else if(GetMinorVersion()==2) | |
1431 | return DecodeDetectorvtest2(mod,layer,cpn0,cpn1,cpn2); | |
1432 | Warning("DecodeDetector", | |
1433 | "Geometry is kvtest minor version=%d is not defined", | |
1434 | GetMinorVersion()); | |
1435 | }break; | |
1436 | case kvDefault:{ | |
1437 | Error("DecodeDetector","Major version = kvDefault, not supported"); | |
1438 | }break; | |
1439 | case kvSPD02:{ | |
1440 | return DecodeDetectorvSPD02(mod,layer,cpn0,cpn1,cpn2); | |
1441 | }break; | |
1442 | case kvSDD03:{ | |
1443 | return DecodeDetectorvSDD03(mod,layer,cpn0,cpn1,cpn2); | |
1444 | }break; | |
1445 | case kvSSD03:{ | |
1446 | return DecodeDetectorvSSD03(mod,layer,cpn0,cpn1,cpn2); | |
1447 | }break; | |
1448 | case kvITS04:{ | |
1449 | return DecodeDetectorvITS04(mod,layer,cpn0,cpn1,cpn2); | |
1450 | }break; | |
1451 | case kvPPRcourseasymm:{ | |
1452 | return DecodeDetectorvPPRcourseasymm(mod,layer,cpn0,cpn1,cpn2); | |
1453 | }break; | |
1454 | case kvPPRasymmFMD:{ | |
1455 | return DecodeDetectorvPPRasymmFMD(mod,layer,cpn0,cpn1,cpn2); | |
1456 | }break; | |
1457 | case kv11:{ | |
1458 | return DecodeDetectorv11(mod,layer,cpn0,cpn1,cpn2); | |
1459 | }break; | |
1460 | case kv11Hybrid:{ | |
1461 | return DecodeDetectorv11Hybrid(mod,layer,cpn0,cpn1,cpn2); | |
1462 | }break; | |
1463 | default:{ | |
1464 | Error("DecodeDetector","Major version = %d, not supported", | |
1465 | (Int_t)fMajorVersion); | |
1466 | return; | |
1467 | }break; | |
1468 | } // end switch | |
1469 | return; | |
1470 | } | |
1471 | //______________________________________________________________________ | |
1472 | void AliITSInitGeometry::RecodeDetector(Int_t mod,Int_t &cpn0, | |
1473 | Int_t &cpn1,Int_t &cpn2){ | |
1474 | // decode geometry into detector module number. There are two decoding | |
1475 | // Scheams. Old which does not follow the ALICE coordinate system | |
1476 | // requirements, and New which dose. | |
1477 | // Inputs: | |
1478 | // Int_t mod The module number assoicated with this set | |
1479 | // of copy numbers. | |
1480 | // Output: | |
1481 | // Int_t cpn0 The lowest copy number | |
1482 | // Int_t cpn1 The middle copy number | |
1483 | // Int_t cpn2 the highest copy number | |
1484 | // Return: | |
1485 | // none. | |
1486 | ||
1487 | // This is a FIXED switch yard function. I (Bjorn Nilsen) Don't | |
1488 | // like them but I see not better way for the moment. | |
1489 | switch (fMajorVersion){ | |
1490 | case kvtest:{ | |
1491 | if(GetMinorVersion()==1) | |
1492 | return RecodeDetectorvPPRasymmFMD(mod,cpn0,cpn1,cpn2); | |
1493 | else if(GetMinorVersion()==2) | |
1494 | return RecodeDetectorvtest2(mod,cpn0,cpn1,cpn2); | |
1495 | Warning("RecodeDetector", | |
1496 | "Geometry is kvtest minor version=%d is not defined", | |
1497 | GetMinorVersion()); | |
1498 | return; | |
1499 | }break; | |
1500 | case kvDefault:{ | |
1501 | Error("RecodeDetector","Major version = kvDefault, not supported"); | |
1502 | return; | |
1503 | }break; | |
1504 | case kvSPD02:{ | |
1505 | return RecodeDetectorvSPD02(mod,cpn0,cpn1,cpn2); | |
1506 | }break; | |
1507 | case kvSDD03:{ | |
1508 | return RecodeDetectorvSDD03(mod,cpn0,cpn1,cpn2); | |
1509 | }break; | |
1510 | case kvSSD03:{ | |
1511 | return RecodeDetectorvSSD03(mod,cpn0,cpn1,cpn2); | |
1512 | }break; | |
1513 | case kvITS04:{ | |
1514 | return RecodeDetectorvITS04(mod,cpn0,cpn1,cpn2); | |
1515 | }break; | |
1516 | case kvPPRcourseasymm:{ | |
1517 | return RecodeDetectorvPPRcourseasymm(mod,cpn0,cpn1,cpn2); | |
1518 | }break; | |
1519 | case kvPPRasymmFMD:{ | |
1520 | return RecodeDetectorvPPRasymmFMD(mod,cpn0,cpn1,cpn2); | |
1521 | }break; | |
1522 | case kv11:{ | |
1523 | return RecodeDetectorv11(mod,cpn0,cpn1,cpn2); | |
1524 | }break; | |
1525 | case kv11Hybrid:{ | |
1526 | return RecodeDetectorv11Hybrid(mod,cpn0,cpn1,cpn2); | |
1527 | }break; | |
1528 | default:{ | |
1529 | Error("RecodeDetector","Major version = %d, not supported", | |
1530 | (Int_t)fMajorVersion); | |
1531 | return; | |
1532 | }break; | |
1533 | } // end switch | |
1534 | return; | |
1535 | } | |
1536 | //______________________________________________________________________ | |
1537 | void AliITSInitGeometry::DecodeDetectorLayers(Int_t mod,Int_t &layer, | |
1538 | Int_t &lad,Int_t &det){ | |
1539 | // decode geometry into detector module number. There are two decoding | |
1540 | // Scheams. Old which does not follow the ALICE coordinate system | |
1541 | // requirements, and New which dose. Note, this use of layer ladder | |
1542 | // and detector numbers are strictly for internal use of this | |
1543 | // specific code. They do not represent the "standard" layer ladder | |
1544 | // or detector numbering except in a very old and obsoleate sence. | |
1545 | // Inputs: | |
1546 | // Int_t mod The module number assoicated with this set | |
1547 | // of copy numbers. | |
1548 | // Output: | |
1549 | // Int_t lay The layer number | |
1550 | // Int_t lad The ladder number | |
1551 | // Int_t det the dettector number | |
1552 | // Return: | |
1553 | // none. | |
1554 | ||
1555 | // This is a FIXED switch yard function. I (Bjorn Nilsen) Don't | |
1556 | // like them but I see not better way for the moment. | |
8f8273a4 | 1557 | switch (fMajorVersion) { |
012f0f4c | 1558 | case kvtest:{ |
1559 | if(GetMinorVersion()==1) | |
1560 | return DecodeDetectorLayersvPPRasymmFMD(mod,layer,lad,det); | |
1561 | else if(GetMinorVersion()==2) | |
1562 | return DecodeDetectorLayersvtest2(mod,layer,lad,det); | |
1563 | Warning("DecodeDetectorLayers", | |
1564 | "Geometry is kvtest minor version=%d is not defined", | |
1565 | GetMinorVersion()); | |
1566 | return; | |
8f8273a4 | 1567 | } break; |
012f0f4c | 1568 | case kvDefault:{ |
1569 | Error("DecodeDetectorLayers", | |
1570 | "Major version = kvDefault, not supported"); | |
1571 | return; | |
1572 | }break; | |
1573 | case kvSPD02:{ | |
1574 | return DecodeDetectorLayersvSPD02(mod,layer,lad,det); | |
1575 | }break; | |
1576 | case kvSDD03:{ | |
1577 | return DecodeDetectorLayersvSDD03(mod,layer,lad,det); | |
1578 | }break; | |
1579 | case kvSSD03:{ | |
1580 | return DecodeDetectorLayersvSSD03(mod,layer,lad,det); | |
1581 | }break; | |
1582 | case kvITS04:{ | |
1583 | return DecodeDetectorLayersvITS04(mod,layer,lad,det); | |
1584 | }break; | |
1585 | case kvPPRcourseasymm:{ | |
1586 | return DecodeDetectorLayersvPPRcourseasymm(mod,layer,lad,det); | |
1587 | }break; | |
1588 | case kvPPRasymmFMD:{ | |
1589 | return DecodeDetectorLayersvPPRasymmFMD(mod,layer,lad,det); | |
1590 | }break; | |
1591 | case kv11:{ | |
1592 | return DecodeDetectorLayersv11(mod,layer,lad,det); | |
1593 | }break; | |
1594 | case kv11Hybrid:{ | |
1595 | return DecodeDetectorLayersv11Hybrid(mod,layer,lad,det); | |
1596 | }break; | |
1597 | default:{ | |
1598 | Error("DecodeDetectorLayers","Major version = %d, not supported", | |
1599 | (Int_t)fMajorVersion); | |
1600 | return; | |
1601 | }break; | |
1602 | } // end switch | |
1603 | return; | |
1604 | } | |
1605 | //______________________________________________________________________ | |
1606 | void AliITSInitGeometry::DecodeDetectorvSPD02( | |
1607 | Int_t &mod,Int_t ncpn,Int_t cpy0,Int_t cpy1,Int_t cpy2) const { | |
1608 | // decode geometry into detector module number | |
1609 | // Inputs: | |
1610 | // Int_t ncpn The Number of copies of this volume | |
1611 | // Int_t cpy0 The lowest copy number | |
1612 | // Int_t cpy1 The middle copy number | |
1613 | // Int_t cpy2 the highest copy number | |
1614 | // Output: | |
1615 | // Int_t &mod The module number assoicated with this set | |
1616 | // of copy numbers. | |
1617 | // Return: | |
1618 | // none. | |
1619 | ||
1620 | // detector = ladder = 1 | |
1621 | if(ncpn==4 && cpy1>2) mod = cpy1; // layer = 1,2 | |
1622 | else mod = cpy1-1; // layer = 4,5 | |
1623 | if(ncpn==1) mod = 2; // layer=3 | |
1624 | cpy0 = cpy2; | |
1625 | return; | |
1626 | } | |
1627 | //______________________________________________________________________ | |
1628 | void AliITSInitGeometry::RecodeDetectorvSPD02(Int_t mod,Int_t &cpn0, | |
f736d235 | 1629 | Int_t &cpn1,Int_t &cpn2) const { |
012f0f4c | 1630 | // decode geometry into detector module number. There are two decoding |
1631 | // Scheams. Old which does not follow the ALICE coordinate system | |
1632 | // requirements, and New which dose. | |
1633 | // Inputs: | |
1634 | // Int_t mod The module number assoicated with this set | |
1635 | // of copy numbers. | |
1636 | // Output: | |
1637 | // Int_t cpn0 The lowest copy number | |
1638 | // Int_t cpn1 The middle copy number | |
1639 | // Int_t cpn2 the highest copy number | |
1640 | // Return: | |
1641 | // none. | |
1642 | ||
1643 | cpn2 = 0; | |
1644 | if(mod==2){ | |
1645 | cpn0 = 1; | |
1646 | cpn1 = 1; | |
1647 | return; | |
1648 | } else if(mod<2){ | |
1649 | cpn0 = 1; | |
1650 | cpn1 = mod+1; | |
1651 | }else{ | |
1652 | cpn0 = 1; | |
1653 | cpn1 = mod; | |
1654 | } // end if | |
1655 | return; | |
1656 | } | |
1657 | //______________________________________________________________________ | |
1658 | void AliITSInitGeometry::DecodeDetectorLayersvSPD02(Int_t mod,Int_t &lay, | |
f736d235 | 1659 | Int_t &lad,Int_t &det) const{ |
012f0f4c | 1660 | // decode geometry into detector module number. There are two decoding |
1661 | // Scheams. Old which does not follow the ALICE coordinate system | |
1662 | // requirements, and New which dose. Note, this use of layer ladder | |
1663 | // and detector numbers are strictly for internal use of this | |
1664 | // specific code. They do not represent the "standard" layer ladder | |
1665 | // or detector numbering except in a very old and obsoleate sence. | |
1666 | // Inputs: | |
1667 | // Int_t mod The module number assoicated with this set | |
1668 | // of copy numbers. | |
1669 | // Output: | |
1670 | // Int_t lay The layer number | |
1671 | // Int_t lad The ladder number | |
1672 | // Int_t det the dettector number | |
1673 | // Return: | |
1674 | // none. | |
1675 | ||
1676 | lay = mod+1; | |
1677 | lad = det = 1; | |
1678 | return; | |
1679 | } | |
1680 | //______________________________________________________________________ | |
1681 | void AliITSInitGeometry::DecodeDetectorvSDD03( | |
1682 | Int_t &mod,Int_t ncpys,Int_t cpy0,Int_t cpy1,Int_t cpy2) const { | |
1683 | // decode geometry into detector module number. There are two decoding | |
1684 | // Scheams. Old which does not follow the ALICE coordinate system | |
1685 | // requirements, and New which dose. | |
1686 | // Inputs: | |
1687 | // Int_t ncpys The number of posible copies cpn1 | |
1688 | // Int_t cpy0 The lowest copy number | |
1689 | // Int_t cpy1 The middle copy number | |
1690 | // Int_t cpy2 the highest copy number | |
1691 | // Output: | |
1692 | // Int_t &mod The module number assoicated with this set | |
1693 | // of copy numbers. | |
1694 | // Return: | |
1695 | // none. | |
1696 | ||
1697 | if(ncpys==10){ // ITEL detectors | |
1698 | if(cpy1>4) mod = cpy1+1; | |
1699 | else mod = cpy1-1; | |
1700 | }else{ // IDET detectors | |
1701 | if(cpy1==1) mod = 4; | |
1702 | else mod = 5; | |
1703 | } // end if | |
1704 | cpy0=cpy2; | |
1705 | return; | |
1706 | } | |
1707 | //______________________________________________________________________ | |
1708 | void AliITSInitGeometry::RecodeDetectorvSDD03(Int_t mod,Int_t &cpn0, | |
f736d235 | 1709 | Int_t &cpn1,Int_t &cpn2) const{ |
012f0f4c | 1710 | // decode geometry into detector module number. There are two decoding |
1711 | // Scheams. Old which does not follow the ALICE coordinate system | |
1712 | // requirements, and New which dose. | |
1713 | // Inputs: | |
1714 | // Int_t mod The module number assoicated with this set | |
1715 | // of copy numbers. | |
1716 | // Output: | |
1717 | // Int_t cpn0 The lowest copy number | |
1718 | // Int_t cpn1 The middle copy number | |
1719 | // Int_t cpn2 the highest copy number | |
1720 | // Return: | |
1721 | // none. | |
1722 | ||
1723 | cpn0 = 1; | |
1724 | cpn2 = 0; | |
1725 | if(mod<4) cpn1 = mod+1; | |
1726 | else if(mod==4||mod==5) cpn1 = mod-3; | |
1727 | else cpn1 = mod-1; | |
1728 | return; | |
1729 | } | |
1730 | //______________________________________________________________________ | |
1731 | void AliITSInitGeometry::DecodeDetectorLayersvSDD03(Int_t mod,Int_t &lay, | |
f736d235 | 1732 | Int_t &lad,Int_t &det) const{ |
012f0f4c | 1733 | // decode geometry into detector module number. There are two decoding |
1734 | // Scheams. Old which does not follow the ALICE coordinate system | |
1735 | // requirements, and New which dose. Note, this use of layer ladder | |
1736 | // and detector numbers are strictly for internal use of this | |
1737 | // specific code. They do not represent the "standard" layer ladder | |
1738 | // or detector numbering except in a very old and obsoleate sence. | |
1739 | // Inputs: | |
1740 | // Int_t mod The module number assoicated with this set | |
1741 | // of copy numbers. | |
1742 | // Output: | |
1743 | // Int_t lay The layer number | |
1744 | // Int_t lad The ladder number | |
1745 | // Int_t det the dettector number | |
1746 | // Return: | |
1747 | // none. | |
1748 | ||
1749 | lad = det = 1; | |
1750 | lay = mod+1; | |
1751 | return; | |
1752 | } | |
1753 | //______________________________________________________________________ | |
1754 | void AliITSInitGeometry::DecodeDetectorvSSD03( | |
1755 | Int_t &mod,Int_t dtype,Int_t cpn0,Int_t cpn1,Int_t cpn2) const { | |
1756 | // decode geometry into detector module number. There are two decoding | |
1757 | // Scheams. Old which does not follow the ALICE coordinate system | |
1758 | // requirements, and New which dose. | |
1759 | // Inputs: | |
1760 | // Int_t dtype The detector type 1=ITSA 2=IGAR 3=IFRA | |
1761 | // Int_t cpn0 The lowest copy number | |
1762 | // Int_t cpn1 The middle copy number | |
1763 | // Int_t cpn2 the highest copy number | |
1764 | // Output: | |
1765 | // Int_t &mod The module number assoicated with this set | |
1766 | // of copy numbers. | |
1767 | // Return: | |
1768 | // none. | |
1769 | ||
1770 | if(dtype==2){mod=2; return;} | |
1771 | if(dtype==3){mod=3; return;} | |
1772 | mod = cpn0-1; | |
1773 | if(cpn0==3) mod = 4; | |
1774 | cpn1=cpn2; | |
1775 | return; | |
1776 | } | |
1777 | //______________________________________________________________________ | |
1778 | void AliITSInitGeometry::RecodeDetectorvSSD03(Int_t mod,Int_t &cpn0, | |
f736d235 | 1779 | Int_t &cpn1,Int_t &cpn2) const { |
012f0f4c | 1780 | // decode geometry into detector module number. There are two decoding |
1781 | // Scheams. Old which does not follow the ALICE coordinate system | |
1782 | // requirements, and New which dose. | |
1783 | // Inputs: | |
1784 | // Int_t mod The module number assoicated with this set | |
1785 | // of copy numbers. | |
1786 | // Output: | |
1787 | // Int_t cpn0 The lowest copy number | |
1788 | // Int_t cpn1 The middle copy number | |
1789 | // Int_t cpn2 the highest copy number | |
1790 | // Return: | |
1791 | // none. | |
1792 | ||
1793 | cpn1=1; | |
1794 | cpn2=0; | |
1795 | if(mod<2) cpn0=mod+1; | |
1796 | else if (mod==2||mod==3) cpn0=1; | |
1797 | else cpn0 = 3; | |
1798 | return; | |
1799 | } | |
1800 | //______________________________________________________________________ | |
1801 | void AliITSInitGeometry::DecodeDetectorLayersvSSD03(Int_t mod,Int_t &lay, | |
f736d235 | 1802 | Int_t &lad,Int_t &det) const { |
012f0f4c | 1803 | // decode geometry into detector module number. There are two decoding |
1804 | // Scheams. Old which does not follow the ALICE coordinate system | |
1805 | // requirements, and New which dose. Note, this use of layer ladder | |
1806 | // and detector numbers are strictly for internal use of this | |
1807 | // specific code. They do not represent the "standard" layer ladder | |
1808 | // or detector numbering except in a very old and obsoleate sence. | |
1809 | // Inputs: | |
1810 | // Int_t mod The module number assoicated with this set | |
1811 | // of copy numbers. | |
1812 | // Output: | |
1813 | // Int_t lay The layer number | |
1814 | // Int_t lad The ladder number | |
1815 | // Int_t det the dettector number | |
1816 | // Return: | |
1817 | // none. | |
1818 | ||
1819 | lad = det = 1; | |
1820 | lay = mod+1; | |
1821 | return; | |
1822 | } | |
1823 | //______________________________________________________________________ | |
1824 | void AliITSInitGeometry::DecodeDetectorvITS04( | |
1825 | Int_t &mod,Int_t dtype,Int_t cpn0,Int_t cpn1,Int_t cpn2) const { | |
1826 | // decode geometry into detector module number. There are two decoding | |
1827 | // Scheams. Old which does not follow the ALICE coordinate system | |
1828 | // requirements, and New which dose. | |
1829 | // Inputs: | |
1830 | // Int_t dtype The detector type 1=ITSA 2=IGAR 3=IFRA | |
1831 | // Int_t cpn0 The lowest copy number | |
1832 | // Int_t cpn1 The middle copy number | |
1833 | // Int_t cpn2 the highest copy number | |
1834 | // Output: | |
1835 | // Int_t &mod The module number assoicated with this set | |
1836 | // of copy numbers. | |
1837 | // Return: | |
1838 | // none. | |
1839 | ||
1840 | mod = dtype-1; | |
1841 | cpn0 = cpn1 = cpn2; | |
1842 | return; | |
1843 | } | |
1844 | //______________________________________________________________________ | |
1845 | void AliITSInitGeometry::RecodeDetectorvITS04(Int_t mod,Int_t &cpn0, | |
f736d235 | 1846 | Int_t &cpn1,Int_t &cpn2) const { |
012f0f4c | 1847 | // decode geometry into detector module number. There are two decoding |
1848 | // Scheams. Old which does not follow the ALICE coordinate system | |
1849 | // requirements, and New which dose. | |
1850 | // Inputs: | |
1851 | // Int_t mod The module number assoicated with this set | |
1852 | // of copy numbers. | |
1853 | // Output: | |
1854 | // Int_t cpn0 The lowest copy number | |
1855 | // Int_t cpn1 The middle copy number | |
1856 | // Int_t cpn2 the highest copy number | |
1857 | // Return: | |
1858 | // none. | |
1859 | ||
1860 | cpn1 = cpn2 = 0; | |
1861 | switch(mod){ | |
1862 | case 0:case 1:case 2:case 3:{ | |
1863 | cpn0 = mod+1; | |
1864 | }break; | |
1865 | case 4: case 5:{ | |
1866 | cpn0 = mod-3; | |
1867 | }break; | |
1868 | case 6:case 7:case 8:case 9:{ | |
1869 | cpn0 = mod-5; | |
1870 | } break; | |
1871 | default: | |
1872 | cpn0 = 0; | |
1873 | break; | |
1874 | }// end switch | |
1875 | return; | |
1876 | } | |
1877 | //______________________________________________________________________ | |
1878 | void AliITSInitGeometry::DecodeDetectorLayersvITS04(Int_t mod,Int_t &lay, | |
f736d235 | 1879 | Int_t &lad,Int_t &det) const{ |
012f0f4c | 1880 | // decode geometry into detector module number. There are two decoding |
1881 | // Scheams. Old which does not follow the ALICE coordinate system | |
1882 | // requirements, and New which dose. Note, this use of layer ladder | |
1883 | // and detector numbers are strictly for internal use of this | |
1884 | // specific code. They do not represent the "standard" layer ladder | |
1885 | // or detector numbering except in a very old and obsoleate sence. | |
1886 | // Inputs: | |
1887 | // Int_t mod The module number assoicated with this set | |
1888 | // of copy numbers. | |
1889 | // Output: | |
1890 | // Int_t lay The layer number | |
1891 | // Int_t lad The ladder number | |
1892 | // Int_t det the dettector number | |
1893 | // Return: | |
1894 | // none. | |
1895 | ||
1896 | lad = 1; | |
1897 | switch(mod){ | |
1898 | case 0:case 1:case 2:case 3:{ | |
1899 | lay = mod/2 +1; | |
1900 | det = mod%2 +1; | |
1901 | }break; | |
1902 | case 4: case 5:{ | |
1903 | lay = mod -1; | |
1904 | }break; | |
1905 | case 6:case 7:case 8:case 9:{ | |
1906 | lay = mod/2 +2; | |
1907 | det = mod%2 +1; | |
1908 | }break; | |
1909 | default: | |
1910 | lay = 0; | |
1911 | det = 0; | |
1912 | break; | |
1913 | } // end switch | |
1914 | return; | |
1915 | } | |
1916 | //______________________________________________________________________ | |
54c9a3d9 | 1917 | void AliITSInitGeometry::DecodeDetectorvPPRasymmFMD(Int_t &mod,Int_t layer, |
1918 | Int_t cpn0,Int_t cpn1,Int_t cpn2) const { | |
012f0f4c | 1919 | // decode geometry into detector module number. There are two decoding |
1920 | // Scheams. Old which does not follow the ALICE coordinate system | |
1921 | // requirements, and New which dose. | |
1922 | // Inputs: | |
1923 | // Int_t layer The ITS layer | |
1924 | // Int_t cpn0 The lowest copy number | |
1925 | // Int_t cpn1 The middle copy number | |
1926 | // Int_t cpn2 the highest copy number | |
1927 | // Output: | |
1928 | // Int_t &mod The module number assoicated with this set | |
1929 | // of copy numbers. | |
1930 | // Return: | |
1931 | // none. | |
1932 | const Int_t kDetPerLadderSPD[2]={2,4}; | |
1933 | const Int_t kDetPerLadder[6]={4,4,6,8,22,25}; | |
1934 | const Int_t kLadPerLayer[6]={20,40,14,22,34,38}; | |
1935 | Int_t lay=-1,lad=-1,det=-1,i; | |
1936 | ||
1937 | if(fDecode){ // New decoding scheam | |
1938 | switch (layer){ | |
1939 | case 1:{ | |
1940 | lay = layer; | |
1941 | det = 5-cpn2; | |
1942 | if(cpn0==4&&cpn1==1) lad=1; | |
1943 | else if(cpn0==4&&cpn1==2) lad=20; | |
1944 | else if(cpn0<4){ | |
1945 | lad = 8-cpn1-kDetPerLadderSPD[layer-1]*(cpn0-1); | |
1946 | }else{ // cpn0>4 | |
1947 | lad = 28-cpn1-kDetPerLadderSPD[layer-1]*(cpn0-1); | |
1948 | } // end if | |
1949 | } break; | |
1950 | case 2:{ | |
1951 | lay = layer; | |
1952 | det = 5-cpn2; | |
1953 | if(cpn0==4&&cpn1==1) lad=1; | |
1954 | else if(cpn0<4){ | |
1955 | lad = 14-cpn1-kDetPerLadderSPD[layer-1]*(cpn0-1); | |
1956 | }else{ // cpn0>4 | |
1957 | lad = 54-cpn1-kDetPerLadderSPD[layer-1]*(cpn0-1); | |
1958 | } // end if | |
1959 | } break; | |
1960 | case 3:{ | |
1961 | lay = layer; | |
1962 | if(cpn0<5) lad = 5-cpn0; | |
1963 | else lad = 19-cpn0; | |
1964 | det = 7-cpn1; | |
1965 | } break; | |
1966 | case 4:{ | |
1967 | lay = layer; | |
1968 | if(cpn0<7) lad = 7-cpn0; | |
1969 | else lad = 29-cpn0; | |
1970 | det = 9-cpn1; | |
1971 | } break; | |
1972 | case 5:{ | |
1973 | lay = layer; | |
1974 | if(cpn0<10) lad = 10-cpn0; | |
1975 | else lad = 44-cpn0; | |
1976 | det = 23-cpn1; | |
1977 | } break; | |
1978 | case 6:{ | |
1979 | lay = layer; | |
1980 | if(cpn0<9) lad = 9-cpn0; | |
1981 | else lad = 47-cpn0; | |
1982 | det = 26-cpn1; | |
1983 | } break; | |
1984 | } // end switch | |
023ae34b | 1985 | mod = 0; |
6b0f3880 | 1986 | for(i=0;i<layer-1;i++) mod += kLadPerLayer[i]*kDetPerLadder[i]; |
1987 | mod += kDetPerLadder[layer-1]*(lad-1)+det-1;// module start at zero. | |
023ae34b | 1988 | return; |
1989 | } // end if | |
1990 | // Old decoding scheam | |
1991 | switch(layer){ | |
1992 | case 1: case 2:{ | |
1993 | lay = layer; | |
6b0f3880 | 1994 | lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1); |
023ae34b | 1995 | det = cpn2; |
1996 | }break; | |
1997 | case 3: case 4:{ | |
1998 | lay = layer; | |
1999 | lad = cpn0; | |
2000 | det = cpn1; | |
2001 | }break; | |
2002 | case 5: case 6:{ | |
2003 | lay = layer; | |
2004 | lad = cpn0; | |
2005 | det = cpn1; | |
2006 | }break; | |
2007 | default:{ | |
2008 | }break; | |
2009 | } // end switch | |
2010 | mod = 0; | |
6b0f3880 | 2011 | for(i=0;i<layer-1;i++) mod += kLadPerLayer[i]*kDetPerLadder[i]; |
2012 | mod += kDetPerLadder[layer-1]*(lad-1)+det-1;// module start at zero. | |
023ae34b | 2013 | return; |
2014 | } | |
2015 | //______________________________________________________________________ | |
012f0f4c | 2016 | void AliITSInitGeometry::RecodeDetectorvPPRasymmFMD(Int_t mod,Int_t &cpn0, |
023ae34b | 2017 | Int_t &cpn1,Int_t &cpn2){ |
2018 | // decode geometry into detector module number. There are two decoding | |
2019 | // Scheams. Old which does not follow the ALICE coordinate system | |
2020 | // requirements, and New which dose. | |
2021 | // Inputs: | |
2022 | // Int_t mod The module number assoicated with this set | |
2023 | // of copy numbers. | |
2024 | // Output: | |
2025 | // Int_t cpn0 The lowest copy number | |
2026 | // Int_t cpn1 The middle copy number | |
2027 | // Int_t cpn2 the highest copy number | |
2028 | // Return: | |
2029 | // none. | |
6b0f3880 | 2030 | const Int_t kITSgeoTreeCopys[6][3]= {{10, 2, 4},// lay=1 |
023ae34b | 2031 | {10, 4, 4},// lay=2 |
2032 | {14, 6, 1},// lay=3 | |
2033 | {22, 8, 1},// lay=4 | |
2034 | {34,22, 1},// lay=5 | |
2035 | {38,25, 1}};//lay=6 | |
6b0f3880 | 2036 | const Int_t kDetPerLadderSPD[2]={2,4}; |
2037 | // const Int_t kDetPerLadder[6]={4,4,6,8,22,25}; | |
2038 | // const Int_t kLadPerLayer[6]={20,40,14,22,34,38}; | |
023ae34b | 2039 | Int_t lay,lad,det; |
2040 | ||
2041 | cpn0 = cpn1 = cpn2 = 0; | |
2042 | DecodeDetectorLayers(mod,lay,lad,det); | |
2043 | if(fDecode){ // New decoding scheam | |
2044 | switch (lay){ | |
2045 | case 1:{ | |
2046 | cpn2 = 5-det; // Detector 1-4 | |
6b0f3880 | 2047 | cpn1 = 1+(lad-1)%kDetPerLadderSPD[lay-1]; |
2048 | cpn0 = 5-(lad+kDetPerLadderSPD[lay-1])/kDetPerLadderSPD[lay-1]; | |
2049 | if(mod>27) cpn0 = 15-(lad+kDetPerLadderSPD[lay-1])/ | |
2050 | kDetPerLadderSPD[lay-1]; | |
023ae34b | 2051 | } break; |
2052 | case 2:{ | |
2053 | cpn2 = 5-det; // Detector 1-4 | |
6b0f3880 | 2054 | cpn1 = 4-(lad+2)%kDetPerLadderSPD[lay-1]; |
2055 | cpn0 = 1+(14-cpn1-lad)/kDetPerLadderSPD[lay-1]; | |
2056 | if(mod>131) cpn0 = 1+(54-lad-cpn1)/kDetPerLadderSPD[lay-1]; | |
023ae34b | 2057 | } break; |
2058 | case 3:{ | |
2059 | cpn2 = 1; | |
2060 | if(lad<5) cpn0 = 5-lad; | |
2061 | else cpn0 = 19-lad; | |
2062 | cpn1 = 7-det; | |
2063 | } break; | |
2064 | case 4:{ | |
2065 | cpn2 = 1; | |
2066 | if(lad<7) cpn0 = 7-lad; | |
2067 | else cpn0 = 29-lad; | |
2068 | cpn1 = 9-det; | |
2069 | } break; | |
2070 | case 5:{ | |
2071 | cpn2 = 1; | |
2072 | if(lad<10) cpn0 = 10-lad; | |
2073 | else cpn0 = 44-lad; | |
2074 | cpn1 = 23-det; | |
2075 | } break; | |
2076 | case 6:{ | |
2077 | cpn2 = 1; | |
2078 | if(lad<9) cpn0 = 9-lad; | |
2079 | else cpn0 = 47-lad; | |
2080 | cpn1 = 26-det; | |
2081 | } break; | |
2082 | default:{ | |
2083 | Error("RecodeDetector","New: mod=%d lay=%d not 1-6."); | |
2084 | return; | |
2085 | } break; | |
2086 | } // end switch | |
2087 | if(cpn0<1||cpn1<1||cpn2<1|| | |
6b0f3880 | 2088 | cpn0>kITSgeoTreeCopys[lay-1][0]|| |
2089 | cpn1>kITSgeoTreeCopys[lay-1][1]|| | |
2090 | cpn2>kITSgeoTreeCopys[lay-1][2]) | |
023ae34b | 2091 | Error("RecodeDetector", |
2092 | "cpn0=%d cpn1=%d cpn2=%d mod=%d lay=%d lad=%d det=%d", | |
2093 | cpn0,cpn1,cpn2,mod,lay,lad,det); | |
2094 | return; | |
2095 | } // end if | |
2096 | // Old encoding | |
2097 | switch (lay){ | |
2098 | case 1: case 2:{ | |
2099 | cpn2 = det; // Detector 1-4 | |
6b0f3880 | 2100 | cpn0 = (lad+kDetPerLadderSPD[lay-1]-1)/kDetPerLadderSPD[lay-1]; |
2101 | cpn1 = (lad+kDetPerLadderSPD[lay-1]-1)%kDetPerLadderSPD[lay-1] + 1; | |
023ae34b | 2102 | } break; |
2103 | case 3: case 4: case 5 : case 6:{ | |
2104 | cpn2 = 1; | |
2105 | cpn1 = det; | |
2106 | cpn0 = lad; | |
2107 | } break; | |
2108 | default:{ | |
2109 | Error("RecodeDetector","Old: mod=%d lay=%d not 1-6."); | |
2110 | return; | |
2111 | } break; | |
2112 | } // end switch | |
2113 | if(cpn0<1||cpn1<1||cpn2<1|| | |
6b0f3880 | 2114 | cpn0>kITSgeoTreeCopys[lay-1][0]|| |
2115 | cpn1>kITSgeoTreeCopys[lay-1][1]|| | |
2116 | cpn2>kITSgeoTreeCopys[lay-1][2]) | |
023ae34b | 2117 | Error("RecodeDetector", |
2118 | "cpn0=%d cpn1=%d cpn2=%d mod=%d lay=%d lad=%d det=%d", | |
2119 | cpn0,cpn1,cpn2,mod,lay,lad,det); | |
2120 | return; | |
2121 | } | |
2122 | //______________________________________________________________________ | |
012f0f4c | 2123 | void AliITSInitGeometry::DecodeDetectorLayersvPPRasymmFMD(Int_t mod,Int_t &lay, |
023ae34b | 2124 | Int_t &lad,Int_t &det){ |
2125 | // decode geometry into detector module number. There are two decoding | |
2126 | // Scheams. Old which does not follow the ALICE coordinate system | |
2127 | // requirements, and New which dose. Note, this use of layer ladder | |
2128 | // and detector numbers are strictly for internal use of this | |
2129 | // specific code. They do not represent the "standard" layer ladder | |
2130 | // or detector numbering except in a very old and obsoleate sence. | |
2131 | // Inputs: | |
2132 | // Int_t mod The module number assoicated with this set | |
2133 | // of copy numbers. | |
2134 | // Output: | |
2135 | // Int_t lay The layer number | |
2136 | // Int_t lad The ladder number | |
2137 | // Int_t det the dettector number | |
2138 | // Return: | |
2139 | // none. | |
6b0f3880 | 2140 | // const Int_t kDetPerLadderSPD[2]={2,4}; |
2141 | const Int_t kDetPerLadder[6]={4,4,6,8,22,25}; | |
2142 | const Int_t kLadPerLayer[6]={20,40,14,22,34,38}; | |
023ae34b | 2143 | Int_t mod2; |
2144 | ||
2145 | det = 0; | |
2146 | lad = 0; | |
2147 | lay = 0; | |
2148 | mod2 = 0; | |
2149 | do{ | |
6b0f3880 | 2150 | mod2 += kLadPerLayer[lay]*kDetPerLadder[lay]; |
023ae34b | 2151 | lay++; |
2152 | }while(mod2<=mod); // end while | |
2153 | if(lay>6||lay<1) Error("DecodeDetectorLayers","0<lay=%d>6",lay); | |
6b0f3880 | 2154 | mod2 -= kLadPerLayer[lay-1]*kDetPerLadder[lay-1]; |
023ae34b | 2155 | do{ |
2156 | lad++; | |
6b0f3880 | 2157 | mod2 += kDetPerLadder[lay-1]; |
023ae34b | 2158 | }while(mod2<=mod); // end while |
012f0f4c | 2159 | if(lad>kLadPerLayer[lay-1]||lad<1) Error("DecodeDetectorLayers", |
2160 | "lad=%d>kLadPerLayer[lay-1=%d]=%d mod=%d mod2=%d",lad,lay-1, | |
2161 | kLadPerLayer[lay-1],mod,mod2); | |
2162 | mod2 -= kDetPerLadder[lay-1]; | |
2163 | det = mod-mod2+1; | |
2164 | if(det>kDetPerLadder[lay-1]||det<1) Error("DecodeDetectorLayers", | |
2165 | "det=%d>detPerLayer[lay-1=%d]=%d mod=%d mod2=%d lad=%d",det, | |
2166 | lay-1,kDetPerLadder[lay-1],mod,mod2,lad); | |
2167 | return; | |
2168 | } | |
2169 | //______________________________________________________________________ | |
54c9a3d9 | 2170 | void AliITSInitGeometry::DecodeDetectorv11Hybrid(Int_t &mod,Int_t layer, |
2171 | Int_t cpn0,Int_t cpn1,Int_t cpn2) const { | |
012f0f4c | 2172 | // decode geometry into detector module number |
2173 | // Inputs: | |
2174 | // Int_t layer The ITS layer | |
2175 | // Int_t cpn0 The lowest copy number | |
2176 | // Int_t cpn1 The middle copy number | |
2177 | // Int_t cpn2 the highest copy number | |
2178 | // Output: | |
2179 | // Int_t &mod The module number assoicated with this set | |
2180 | // of copy numbers. | |
2181 | // Return: | |
2182 | // none. | |
75473741 | 2183 | const Int_t kDetPerLadderSPD[2]={2,4}; |
2184 | const Int_t kDetPerLadder[6]={4,4,6,8,22,25}; | |
2185 | const Int_t kLadPerLayer[6]={20,40,14,22,34,38}; | |
8f8273a4 | 2186 | Int_t lad=-1,det=-1; |
75473741 | 2187 | |
2188 | switch(layer) { | |
2189 | case 1: case 2:{ | |
8f8273a4 | 2190 | if (SPDIsTGeoNative()) { |
35bc3392 | 2191 | lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1); |
2192 | det = cpn2; | |
8f8273a4 | 2193 | } else { |
2194 | lad = cpn1+kDetPerLadderSPD[layer-1]*(cpn0-1); | |
2195 | det = cpn2; | |
2196 | } | |
75473741 | 2197 | } break; |
2198 | case 3: case 4:{ | |
2199 | if (SDDIsTGeoNative()) { | |
2200 | lad = cpn0+1; | |
2201 | det = cpn1+1; | |
2202 | } else { | |
2203 | lad = cpn0; | |
2204 | det = cpn1; | |
2205 | } | |
2206 | } break; | |
2207 | case 5: case 6:{ | |
bf210566 | 2208 | if (SSDIsTGeoNative()) { |
2209 | lad = cpn0+1; | |
2210 | det = cpn1+1; | |
2211 | } else { | |
2212 | lad = cpn0; | |
2213 | det = cpn1; | |
2214 | } | |
75473741 | 2215 | } break; |
2216 | default:{ | |
2217 | } break; | |
2218 | } // end switch | |
2219 | mod = 0; | |
8f8273a4 | 2220 | for(Int_t i=0;i<layer-1;i++) mod += kLadPerLayer[i]*kDetPerLadder[i]; |
75473741 | 2221 | mod += kDetPerLadder[layer-1]*(lad-1)+det-1;// module start at zero. |
2222 | return; | |
012f0f4c | 2223 | } |
8f8273a4 | 2224 | |
2225 | /* | |
012f0f4c | 2226 | //______________________________________________________________________ |
2227 | void AliITSInitGeometry::RecodeDetectorv11Hybrid(Int_t mod,Int_t &cpn0, | |
2228 | Int_t &cpn1,Int_t &cpn2) { | |
2229 | // decode geometry into detector module number. There are two decoding | |
2230 | // Scheams. Old which does not follow the ALICE coordinate system | |
2231 | // requirements, and New which dose. | |
2232 | // Inputs: | |
2233 | // Int_t mod The module number assoicated with this set | |
2234 | // of copy numbers. | |
2235 | // Output: | |
2236 | // Int_t cpn0 The lowest copy number | |
2237 | // Int_t cpn1 The middle copy number | |
2238 | // Int_t cpn2 the highest copy number | |
2239 | // Return: | |
2240 | // none. | |
2241 | const Int_t kITSgeoTreeCopys[6][3]= {{10, 2, 4},// lay=1 | |
2242 | {10, 4, 4},// lay=2 | |
2243 | {14, 6, 1},// lay=3 | |
2244 | {22, 8, 1},// lay=4 | |
2245 | {34,22, 1},// lay=5 | |
2246 | {38,25, 1}};//lay=6 | |
2247 | const Int_t kDetPerLadderSPD[2]={2,4}; | |
012f0f4c | 2248 | Int_t lay,lad,det; |
2249 | ||
2250 | cpn0 = cpn1 = cpn2 = 0; | |
8f8273a4 | 2251 | DecodeDetectorLayersv11Hybrid(mod,lay,lad,det); |
012f0f4c | 2252 | // Old encoding |
2253 | switch (lay){ | |
2254 | case 1: case 2:{ | |
2255 | cpn2 = det; // Detector 1-4 | |
2256 | cpn0 = (lad+kDetPerLadderSPD[lay-1]-1)/kDetPerLadderSPD[lay-1]; | |
2257 | cpn1 = (lad+kDetPerLadderSPD[lay-1]-1)%kDetPerLadderSPD[lay-1] + 1; | |
2258 | } break; | |
2259 | case 3: case 4: case 5 : case 6:{ | |
2260 | cpn2 = 1; | |
2261 | cpn1 = det; | |
2262 | cpn0 = lad; | |
2263 | } break; | |
2264 | default:{ | |
2265 | Error("RecodeDetector","Old: mod=%d lay=%d not 1-6."); | |
2266 | return; | |
2267 | } break; | |
2268 | } // end switch | |
2269 | if(cpn0<1||cpn1<1||cpn2<1|| | |
2270 | cpn0>kITSgeoTreeCopys[lay-1][0]|| | |
2271 | cpn1>kITSgeoTreeCopys[lay-1][1]|| | |
2272 | cpn2>kITSgeoTreeCopys[lay-1][2]) | |
2273 | Error("RecodeDetector", | |
2274 | "cpn0=%d cpn1=%d cpn2=%d mod=%d lay=%d lad=%d det=%d", | |
2275 | cpn0,cpn1,cpn2,mod,lay,lad,det); | |
2276 | return; | |
2277 | } | |
8f8273a4 | 2278 | */ |
2279 | ||
012f0f4c | 2280 | |
8f8273a4 | 2281 | //______________________________________________________________________ |
2282 | void AliITSInitGeometry::RecodeDetectorv11Hybrid(Int_t mod,Int_t &cpn0, | |
2283 | Int_t &cpn1,Int_t &cpn2) { | |
2284 | // decode geometry into detector module number. There are two decoding | |
2285 | // Scheams. Old which does not follow the ALICE coordinate system | |
2286 | // requirements, and New which does. | |
012f0f4c | 2287 | // Inputs: |
2288 | // Int_t mod The module number assoicated with this set | |
2289 | // of copy numbers. | |
2290 | // Output: | |
8f8273a4 | 2291 | // Int_t cpn0 The lowest copy number (SPD sector or SDD/SSD ladder) |
2292 | // Int_t cpn1 The middle copy number (SPD stave or SDD/SSD module) | |
2293 | // Int_t cpn2 the highest copy number (SPD ladder or 1 for SDD/SSD) | |
012f0f4c | 2294 | // Return: |
2295 | // none. | |
54c9a3d9 | 2296 | const Int_t kDetPerLadderSPD[2]={2,4}; |
2297 | Int_t lay,lad,det; | |
012f0f4c | 2298 | |
54c9a3d9 | 2299 | DecodeDetectorLayersv11Hybrid(mod,lay,lad,det); |
2300 | if (lay<3) { // SPD | |
2301 | cpn2 = det; // Detector 1-4 | |
2302 | cpn0 = (lad+kDetPerLadderSPD[lay-1]-1)/kDetPerLadderSPD[lay-1]; | |
2303 | cpn1 = (lad+kDetPerLadderSPD[lay-1]-1)%kDetPerLadderSPD[lay-1] + 1; | |
2304 | //if (SPDIsTGeoNative()) { | |
2305 | // cpn2--; | |
2306 | // cpn1--; | |
2307 | //} | |
2308 | } else { // SDD and SSD | |
2309 | cpn2 = 1; | |
2310 | cpn1 = det; | |
2311 | cpn0 = lad; | |
2312 | if (lay<5) { // SDD | |
2313 | if (SDDIsTGeoNative()) { | |
2314 | cpn1--; | |
2315 | cpn0--; | |
2316 | } // end if SDDIsTGeoNative() | |
2317 | } else { //SSD | |
2318 | if (SSDIsTGeoNative()) { | |
2319 | cpn1--; | |
2320 | cpn0--; | |
2321 | }// end if SSDIsTGeoNative() | |
2322 | } // end if Lay<5/else | |
2323 | } // end if lay<3/else | |
2324 | /*printf("AliITSInitGeometry::RecodeDetectorv11Hybrid:" | |
2325 | "mod=%d lay=%d lad=%d det=%d cpn0=%d cpn1=%d cpn2=%d\n", | |
2326 | mod,lay,lad,det,cpn0,cpn1,cpn2);*/ | |
8f8273a4 | 2327 | } |
8f8273a4 | 2328 | // //______________________________________________________________________ |
2329 | // void AliITSInitGeometry::DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay, | |
2330 | // Int_t &lad,Int_t &det) { | |
2331 | ||
2332 | // // decode module number into detector indices for v11Hybrid | |
2333 | // // Inputs: | |
2334 | // // Int_t mod The module number associated with this set | |
2335 | // // of copy numbers. | |
2336 | // // Output: | |
2337 | // // Int_t lay The layer number | |
2338 | // // Int_t lad The ladder number | |
2339 | // // Int_t det the dettector number | |
2340 | // // Return: | |
2341 | // // none. | |
2342 | ||
2343 | // const Int_t kDetPerLadder[6]={4,4,6,8,22,25}; | |
2344 | // const Int_t kLadPerLayer[6]={20,40,14,22,34,38}; | |
2345 | // Int_t mod2 = 0; | |
2346 | // det = 0; | |
2347 | // lad = 0; | |
2348 | // lay = 0; | |
2349 | ||
2350 | // do{ | |
2351 | // mod2 += kLadPerLayer[lay]*kDetPerLadder[lay]; | |
2352 | // lay++; | |
2353 | // } while(mod2<=mod); // end while | |
2354 | // if(lay>6||lay<1) Error("DecodeDetectorLayers","0<lay=%d>6",lay); | |
2355 | // mod2 -= kLadPerLayer[lay-1]*kDetPerLadder[lay-1]; | |
2356 | // do{ | |
2357 | // lad++; | |
2358 | // mod2 += kDetPerLadder[lay-1]; | |
2359 | // } while(mod2<=mod); // end while | |
2360 | // if(lad>kLadPerLayer[lay-1]||lad<1) Error("DecodeDetectorLayers", | |
2361 | // "lad=%d>kLadPerLayer[lay-1=%d]=%d mod=%d mod2=%d",lad,lay-1, | |
2362 | // kLadPerLayer[lay-1],mod,mod2); | |
2363 | // mod2 -= kDetPerLadder[lay-1]; | |
2364 | // det = mod-mod2+1; | |
2365 | // if(det>kDetPerLadder[lay-1]||det<1) Error("DecodeDetectorLayers", | |
2366 | // "det=%d>detPerLayer[lay-1=%d]=%d mod=%d mod2=%d lad=%d",det, | |
2367 | // lay-1,kDetPerLadder[lay-1],mod,mod2,lad); | |
2368 | // return; | |
2369 | // } | |
2370 | ||
2371 | //______________________________________________________________________ | |
2372 | void AliITSInitGeometry::DecodeDetectorLayersv11Hybrid(Int_t mod,Int_t &lay, | |
2373 | Int_t &lad,Int_t &det) { | |
2374 | ||
2375 | // decode module number into detector indices for v11Hybrid | |
2376 | // mod starts from 0 | |
2377 | // lay, lad, det start from 1 | |
2378 | ||
2379 | // Inputs: | |
2380 | // Int_t mod The module number associated with this set | |
2381 | // of copy numbers. | |
2382 | // Output: | |
2383 | // Int_t lay The layer number | |
2384 | // Int_t lad The ladder number | |
2385 | // Int_t det the dettector number | |
2386 | ||
2387 | const Int_t kDetPerLadder[6] = {4,4,6,8,22,25}; | |
2388 | const Int_t kLadPerLayer[6] = {20,40,14,22,34,38}; | |
2389 | ||
2390 | Int_t mod2 = 0; | |
2391 | lay = 0; | |
2392 | ||
2393 | do { | |
2394 | mod2 += kLadPerLayer[lay]*kDetPerLadder[lay]; | |
2395 | lay++; | |
2396 | } while(mod2<=mod); // end while | |
2397 | if(lay>6) Error("DecodeDetectorLayers","lay=%d>6",lay); | |
2398 | ||
2399 | mod2 = kLadPerLayer[lay-1]*kDetPerLadder[lay-1] - mod2+mod; | |
2400 | lad = mod2/kDetPerLadder[lay-1]; | |
2401 | ||
2402 | if(lad>=kLadPerLayer[lay-1]||lad<0) Error("DecodeDetectorLayers", | |
54c9a3d9 | 2403 | "lad=%d not in the correct range",lad); |
8f8273a4 | 2404 | det = (mod2 - lad*kDetPerLadder[lay-1])+1; |
2405 | if(det>kDetPerLadder[lay-1]||det<1) Error("DecodeDetectorLayers", | |
54c9a3d9 | 2406 | "det=%d not in the correct range",det); |
8f8273a4 | 2407 | lad++; |
023ae34b | 2408 | } |
2409 | ||
012f0f4c | 2410 | //______________________________________________________________________ |
2411 | Bool_t AliITSInitGeometry::WriteVersionString(Char_t *str,Int_t length, | |
2412 | AliITSVersion_t maj,Int_t min, | |
2413 | const Char_t *cvsDate,const Char_t *cvsRevision)const{ | |
2414 | // fills the string str with the major and minor version number | |
2415 | // Inputs: | |
2416 | // Char_t *str The character string to hold the major | |
2417 | // and minor version numbers in | |
2418 | // Int_t length The maximum number of characters which | |
2419 | // can be accomidated by this string. | |
2420 | // str[length-1] must exist and will be set to zero | |
2421 | // AliITSVersion_t maj The major number | |
2422 | // Int_t min The minor number | |
2423 | // Char_t *cvsDate The date string from cvs | |
2424 | // Char_t *cvsRevision The Revision string from cvs | |
2425 | // Outputs: | |
2426 | // Char_t *str The character string holding the major and minor | |
2427 | // version numbers. str[length-1] must exist | |
2428 | // and will be set to zero | |
2429 | // Return: | |
2430 | // kTRUE if no errors | |
c1caadda | 2431 | Char_t cvslikedate[30]; |
012f0f4c | 2432 | Int_t i,n,cvsDateLength,cvsRevisionLength; |
2433 | ||
2434 | cvsDateLength = (Int_t)strlen(cvsDate); | |
54c9a3d9 | 2435 | if(cvsDateLength>30){ // svn string, make a cvs like string |
c1caadda | 2436 | i=0;n=0; |
2437 | do{ | |
2438 | cvslikedate[i] = cvsDate[i]; | |
e0d5d6f7 | 2439 | if(cvsDate[i]=='+' || cvsDate[i++]=='-'){ |
c1caadda | 2440 | n++; // count number of - |
2441 | cvslikedate[i-1] = '/'; // replace -'s by /'s. | |
2442 | } // end if | |
2443 | } while(n<3&&i<30); // once additonal - of time zone reach exit | |
2444 | cvslikedate[i-1] = '$'; // put $ at end then zero. | |
2445 | for(;i<30;i++) cvslikedate[i]=0;// i starts wher do loop left off. | |
2446 | }else{ | |
2447 | for(i=0;i<cvsDateLength&&i<30;i++) cvslikedate[i]=cvsDate[i]; | |
2448 | }// end if | |
2449 | cvsDateLength = (Int_t)strlen(cvslikedate); | |
012f0f4c | 2450 | cvsRevisionLength = (Int_t)strlen(cvsRevision); |
2451 | i = (Int_t)maj; | |
2452 | n = 50+(Int_t)(TMath::Log10(TMath::Abs((Double_t)i)))+1+ | |
2453 | (Int_t)(TMath::Log10(TMath::Abs((Double_t)min)))+1 | |
2454 | +cvsDateLength-6+cvsRevisionLength-10; | |
2455 | if(GetDebug()>1) printf("AliITSInitGeometry::WriteVersionString:" | |
2456 | "length=%d major=%d minor=%d cvsDate=%s[%d] " | |
c1caadda | 2457 | "cvsRevision=%s[%d] n=%d\n",length,i,min,cvslikedate, |
012f0f4c | 2458 | cvsDateLength,cvsRevision,cvsRevisionLength,n); |
2459 | if(i<0) n++; | |
2460 | if(min<0) n++; | |
2461 | if(length<n){// not enough space to write in output string. | |
2462 | Warning("WriteVersionString","Output string not long enough " | |
2463 | "lenght=%d must be at least %d long\n",length,n); | |
2464 | return kFALSE; | |
2465 | } // end if length<n | |
2466 | char *cvsrevision = new char[cvsRevisionLength-10]; | |
2467 | char *cvsdate = new char[cvsDateLength-6]; | |
2468 | for(i=0;i<cvsRevisionLength-10;i++) | |
2469 | if(10+i<cvsRevisionLength-1) | |
2470 | cvsrevision[i] = cvsRevision[10+i]; else cvsrevision[i] = 0; | |
2471 | for(i=0;i<cvsDateLength-6;i++) if(6+i<cvsDateLength-1) | |
c1caadda | 2472 | cvsdate[i] = cvslikedate[6+i]; else cvsdate[i] = 0; |
012f0f4c | 2473 | for(i=0;i<length;i++) str[i] = 0; // zero it out for now. |
2474 | i = (Int_t)maj; | |
2475 | sprintf(str,"Major Version= %d Minor Version= %d Revision: %s Date: %s", | |
2476 | i,min,cvsrevision,cvsdate); | |
b2e5530c | 2477 | /* this gives compilation warnings on some compilers: descriptor zu |
012f0f4c | 2478 | if(GetDebug()>1)printf("AliITSInitGeometry::WriteVersionString: " |
b2e5530c | 2479 | "n=%d str=%s revision[%zu] date[%zu]\n", |
012f0f4c | 2480 | n,str,strlen(cvsrevision),strlen(cvsdate)); |
b2e5530c | 2481 | */ |
012f0f4c | 2482 | delete[] cvsrevision; |
2483 | delete[] cvsdate; | |
2484 | return kTRUE; | |
2485 | } | |
2486 | //______________________________________________________________________ | |
2487 | Bool_t AliITSInitGeometry::ReadVersionString(const Char_t *str,Int_t length, | |
2488 | AliITSVersion_t &maj,Int_t &min, | |
2489 | TDatime &dt)const{ | |
2490 | // fills the string str with the major and minor version number | |
2491 | // Inputs: | |
2492 | // Char_t *str The character string to holding the major and minor | |
2493 | // version numbers in | |
2494 | // Int_t length The maximum number of characters which can be | |
2495 | // accomidated by this string. str[length-1] must exist | |
2496 | // Outputs: | |
2497 | // Char_t *str The character string holding the major and minor | |
2498 | // version numbers unchanged. str[length-1] must exist. | |
2499 | // AliITSVersion_t maj The major number | |
2500 | // Int_t min The minor number | |
2501 | // TDatime dt The date and time of the cvs commit | |
2502 | // Return: | |
2503 | // kTRUE if no errors | |
2504 | Bool_t ok; | |
2505 | Char_t cvsRevision[10],cvsDate[11],cvsTime[9]; | |
2506 | Int_t i,m,n=strlen(str),year,month,day,hours,minuits,seconds; | |
2507 | ||
2508 | if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString:" | |
2509 | "str=%s length=%d\n", | |
2510 | str,length); | |
2511 | if(n<35) return kFALSE; // not enough space for numbers | |
2512 | m = sscanf(str,"Major Version= %d Minor Version= %d Revision: %s " | |
2513 | "Date: %s %s",&i,&min,cvsRevision,cvsDate,cvsTime); | |
2514 | ok = m==5; | |
2515 | if(!ok) return !ok; | |
2516 | m = sscanf(cvsDate,"%d/%d/%d",&year,&month,&day); | |
2517 | ok = m==3; | |
2518 | if(!ok) return !ok; | |
2519 | m = sscanf(cvsTime,"%d:%d:%d",&hours,&minuits,&seconds); | |
2520 | ok = m==3; | |
2521 | if(!ok) return !ok; | |
2522 | dt.Set(year,month,day,hours,minuits,seconds); | |
c1caadda | 2523 | if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString: i=%d " |
2524 | "min=%d cvsRevision=%s cvsDate=%s cvsTime=%s m=%d\n", | |
012f0f4c | 2525 | i,min,cvsRevision,cvsDate,cvsTime,m); |
2526 | if(GetDebug()>1)printf("AliITSInitGeometry::ReadVersionString: year=%d" | |
2527 | " month=%d day=%d hours=%d minuits=%d seconds=%d\n", | |
2528 | year,month,day,hours,minuits,seconds); | |
2529 | switch (i){ | |
2530 | case kvITS04:{ | |
2531 | maj = kvITS04; | |
2532 | } break; | |
2533 | case kvSPD02:{ | |
2534 | maj = kvSPD02; | |
2535 | } break; | |
2536 | case kvSDD03:{ | |
2537 | maj = kvSDD03; | |
2538 | } break; | |
2539 | case kvSSD03:{ | |
2540 | maj = kvSSD03; | |
2541 | } break; | |
2542 | case kvPPRasymmFMD:{ | |
2543 | maj = kvPPRasymmFMD; | |
2544 | } break; | |
2545 | case kv11:{ | |
2546 | maj = kv11; | |
2547 | } break; | |
2548 | case kv11Hybrid:{ | |
2549 | maj = kv11Hybrid; | |
2550 | } break; | |
2551 | default:{ | |
2552 | maj = kvDefault; | |
2553 | } break; | |
2554 | } // end switch | |
2555 | return ok; | |
2556 | } |