]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | $Log$ | |
e2afb3b6 | 18 | Revision 1.18 2001/12/19 14:46:26 morsch |
19 | Add possibility to disable StepManager() for each module separately. | |
20 | ||
3f754d83 | 21 | Revision 1.17 2001/08/29 14:28:33 morsch |
22 | Use visibility flags -1 and 3 instead of 0 and 1. | |
23 | ||
5bef1017 | 24 | Revision 1.16 2001/05/16 14:57:22 alibrary |
25 | New files for folders and Stack | |
26 | ||
9e1a0ddb | 27 | Revision 1.15 2001/03/20 06:36:28 alibrary |
28 | 100 parameters now allowed for geant shapes | |
29 | ||
d43b40e2 | 30 | Revision 1.14 2001/01/26 19:58:48 hristov |
31 | Major upgrade of AliRoot code | |
32 | ||
2ab0c725 | 33 | Revision 1.13 2000/11/30 07:12:49 alibrary |
34 | Introducing new Rndm and QA classes | |
35 | ||
65fb704d | 36 | Revision 1.12 2000/10/02 21:28:14 fca |
37 | Removal of useless dependecies via forward declarations | |
38 | ||
94de3818 | 39 | Revision 1.11 2000/07/12 08:56:25 fca |
40 | Coding convention correction and warning removal | |
41 | ||
8918e700 | 42 | Revision 1.10 2000/07/11 18:24:59 fca |
43 | Coding convention corrections + few minor bug fixes | |
44 | ||
aee8290b | 45 | Revision 1.9 2000/05/16 08:45:08 fca |
46 | Correct dtor, thanks to J.Belikov | |
47 | ||
bf9b027f | 48 | Revision 1.8 2000/02/23 16:25:22 fca |
49 | AliVMC and AliGeant3 classes introduced | |
50 | ReadEuclid moved from AliRun to AliModule | |
51 | ||
b13db077 | 52 | Revision 1.7 1999/09/29 09:24:29 fca |
53 | Introduction of the Copyright and cvs Log | |
54 | ||
4c039060 | 55 | */ |
56 | ||
8494b010 | 57 | /////////////////////////////////////////////////////////////////////////////// |
58 | // // | |
59 | // Base class for ALICE modules. Both sensitive modules (Modules) and // | |
60 | // non-sensitive ones are described by this base class. This class // | |
61 | // supports the hit and digit trees produced by the simulation and also // | |
62 | // the objects produced by the reconstruction. // | |
63 | // // | |
64 | // This class is also responsible for building the geometry of the // | |
65 | // Modules. // | |
66 | // // | |
67 | //Begin_Html | |
68 | /* | |
1439f98e | 69 | <img src="picts/AliModuleClass.gif"> |
8494b010 | 70 | */ |
71 | //End_Html | |
72 | // // | |
73 | /////////////////////////////////////////////////////////////////////////////// | |
94de3818 | 74 | #include <TNode.h> |
94de3818 | 75 | #include "TSystem.h" |
76 | ||
8494b010 | 77 | #include "AliModule.h" |
78 | #include "AliRun.h" | |
94de3818 | 79 | #include "AliMagF.h" |
80 | #include "AliMC.h" | |
9e1a0ddb | 81 | #include "AliConfig.h" |
8494b010 | 82 | |
83 | ClassImp(AliModule) | |
84 | ||
e2afb3b6 | 85 | //_______________________________________________________________________ |
86 | AliModule::AliModule(): | |
87 | fEuclidMaterial(""), | |
88 | fEuclidGeometry(""), | |
89 | fIdtmed(0), | |
90 | fIdmate(0), | |
91 | fLoMedium(0), | |
92 | fHiMedium(0), | |
93 | fActive(0), | |
94 | fHistograms(0), | |
95 | fNodes(0), | |
96 | fDebug(0), | |
97 | fEnable(1) | |
8494b010 | 98 | { |
99 | // | |
100 | // Default constructor for the AliModule class | |
101 | // | |
8494b010 | 102 | } |
103 | ||
e2afb3b6 | 104 | //_______________________________________________________________________ |
105 | AliModule::AliModule(const char* name,const char *title): | |
106 | TNamed(name,title), | |
107 | fEuclidMaterial(""), | |
108 | fEuclidGeometry(""), | |
109 | fIdtmed(new TArrayI(100)), | |
110 | fIdmate(new TArrayI(100)), | |
111 | fLoMedium(65536), | |
112 | fHiMedium(0), | |
113 | fActive(0), | |
114 | fHistograms(new TList()), | |
115 | fNodes(new TList()), | |
116 | fDebug(0), | |
117 | fEnable(1) | |
8494b010 | 118 | { |
119 | // | |
120 | // Normal constructor invoked by all Modules. | |
121 | // Create the list for Module specific histograms | |
122 | // Add this Module to the global list of Modules in Run. | |
123 | // | |
8494b010 | 124 | // Get the Module numeric ID |
125 | Int_t id = gAlice->GetModuleID(name); | |
02ca2762 | 126 | if (id>=0) { |
127 | // Module already added ! | |
128 | Warning("Ctor","Module: %s already present at %d\n",name,id); | |
8494b010 | 129 | return; |
130 | } | |
131 | // | |
132 | // Add this Module to the list of Modules | |
02ca2762 | 133 | gAlice->Modules()->Add(this); |
8494b010 | 134 | // |
135 | // | |
136 | SetMarkerColor(3); | |
137 | // | |
e2afb3b6 | 138 | // Clear space for tracking media and material indexes |
139 | ||
8494b010 | 140 | for(Int_t i=0;i<100;i++) (*fIdmate)[i]=(*fIdtmed)[i]=0; |
9e1a0ddb | 141 | |
142 | AliConfig::Instance()->Add(this); | |
143 | ||
65fb704d | 144 | SetDebug(gAlice->GetDebug()); |
8494b010 | 145 | } |
146 | ||
e2afb3b6 | 147 | //_______________________________________________________________________ |
148 | AliModule::AliModule(const AliModule &mod): | |
149 | TNamed(mod), | |
150 | TAttLine(mod), | |
151 | TAttMarker(mod), | |
152 | AliRndm(mod), | |
153 | fEuclidMaterial(""), | |
154 | fEuclidGeometry(""), | |
155 | fIdtmed(0), | |
156 | fIdmate(0), | |
157 | fLoMedium(0), | |
158 | fHiMedium(0), | |
159 | fActive(0), | |
160 | fHistograms(0), | |
161 | fNodes(0), | |
162 | fDebug(0), | |
163 | fEnable(0) | |
aee8290b | 164 | { |
165 | // | |
166 | // Copy constructor | |
167 | // | |
8918e700 | 168 | mod.Copy(*this); |
aee8290b | 169 | } |
170 | ||
e2afb3b6 | 171 | //_______________________________________________________________________ |
8494b010 | 172 | AliModule::~AliModule() |
173 | { | |
174 | // | |
175 | // Destructor | |
176 | // | |
e2afb3b6 | 177 | |
8494b010 | 178 | // Delete ROOT geometry |
bf9b027f | 179 | if(fNodes) { |
180 | fNodes->Clear(); | |
181 | delete fNodes; | |
182 | } | |
8494b010 | 183 | // |
184 | // Delete TArray objects | |
185 | delete fIdtmed; | |
186 | delete fIdmate; | |
187 | } | |
188 | ||
e2afb3b6 | 189 | //_______________________________________________________________________ |
8918e700 | 190 | void AliModule::Copy(AliModule & /* mod */) const |
aee8290b | 191 | { |
192 | // | |
193 | // Copy *this onto mod, not implemented for AliModule | |
194 | // | |
195 | Fatal("Copy","Not implemented!\n"); | |
196 | } | |
197 | ||
e2afb3b6 | 198 | //_______________________________________________________________________ |
8494b010 | 199 | void AliModule::Disable() |
200 | { | |
201 | // | |
202 | // Disable Module on viewer | |
203 | // | |
204 | fActive = kFALSE; | |
205 | TIter next(fNodes); | |
206 | TNode *node; | |
207 | // | |
208 | // Loop through geometry to disable all | |
209 | // nodes for this Module | |
e2afb3b6 | 210 | while((node = dynamic_cast<TNode*>(next()))) { |
5bef1017 | 211 | node->SetVisibility(-1); |
8494b010 | 212 | } |
213 | } | |
214 | ||
e2afb3b6 | 215 | //_______________________________________________________________________ |
8494b010 | 216 | Int_t AliModule::DistancetoPrimitive(Int_t, Int_t) |
217 | { | |
218 | // | |
219 | // Return distance from mouse pointer to object | |
220 | // Dummy routine for the moment | |
221 | // | |
222 | return 9999; | |
223 | } | |
224 | ||
e2afb3b6 | 225 | //_______________________________________________________________________ |
8494b010 | 226 | void AliModule::Enable() |
227 | { | |
228 | // | |
229 | // Enable Module on the viewver | |
230 | // | |
231 | fActive = kTRUE; | |
232 | TIter next(fNodes); | |
233 | TNode *node; | |
234 | // | |
235 | // Loop through geometry to enable all | |
236 | // nodes for this Module | |
e2afb3b6 | 237 | while((node = dynamic_cast<TNode*>(next()))) { |
5bef1017 | 238 | node->SetVisibility(3); |
8494b010 | 239 | } |
240 | } | |
241 | ||
e2afb3b6 | 242 | //_______________________________________________________________________ |
8494b010 | 243 | void AliModule::AliMaterial(Int_t imat, const char* name, Float_t a, |
e2afb3b6 | 244 | Float_t z, Float_t dens, Float_t radl, |
245 | Float_t absl, Float_t *buf, Int_t nwbuf) const | |
8494b010 | 246 | { |
247 | // | |
248 | // Store the parameters for a material | |
249 | // | |
250 | // imat the material index will be stored in (*fIdmate)[imat] | |
251 | // name material name | |
252 | // a atomic mass | |
253 | // z atomic number | |
254 | // dens density | |
255 | // radl radiation length | |
256 | // absl absorbtion length | |
257 | // buf adress of an array user words | |
258 | // nwbuf number of user words | |
259 | // | |
260 | Int_t kmat; | |
cfce8870 | 261 | gMC->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf); |
8494b010 | 262 | (*fIdmate)[imat]=kmat; |
263 | } | |
264 | ||
e2afb3b6 | 265 | //_______________________________________________________________________ |
0afa509f | 266 | void AliModule::AliGetMaterial(Int_t imat, char* name, Float_t &a, |
e2afb3b6 | 267 | Float_t &z, Float_t &dens, Float_t &radl, |
268 | Float_t &absl) | |
0afa509f | 269 | { |
270 | // | |
271 | // Store the parameters for a material | |
272 | // | |
273 | // imat the material index will be stored in (*fIdmate)[imat] | |
274 | // name material name | |
275 | // a atomic mass | |
276 | // z atomic number | |
277 | // dens density | |
278 | // radl radiation length | |
279 | // absl absorbtion length | |
280 | // buf adress of an array user words | |
281 | // nwbuf number of user words | |
282 | // | |
283 | ||
284 | Float_t buf[10]; | |
285 | Int_t nwbuf, kmat; | |
286 | kmat=(*fIdmate)[imat]; | |
287 | gMC->Gfmate(kmat, name, a, z, dens, radl, absl, buf, nwbuf); | |
288 | } | |
289 | ||
8494b010 | 290 | |
e2afb3b6 | 291 | //_______________________________________________________________________ |
8494b010 | 292 | void AliModule::AliMixture(Int_t imat, const char *name, Float_t *a, |
e2afb3b6 | 293 | Float_t *z, Float_t dens, Int_t nlmat, |
294 | Float_t *wmat) const | |
8494b010 | 295 | { |
296 | // | |
297 | // Defines mixture or compound imat as composed by | |
298 | // nlmat materials defined by arrays a, z and wmat | |
299 | // | |
300 | // If nlmat > 0 wmat contains the proportion by | |
301 | // weights of each basic material in the mixture | |
302 | // | |
303 | // If nlmat < 0 wmat contains the number of atoms | |
304 | // of eack kind in the molecule of the compound | |
305 | // In this case, wmat is changed on output to the relative weigths. | |
306 | // | |
307 | // imat the material index will be stored in (*fIdmate)[imat] | |
308 | // name material name | |
309 | // a array of atomic masses | |
310 | // z array of atomic numbers | |
311 | // dens density | |
312 | // nlmat number of components | |
313 | // wmat array of concentrations | |
314 | // | |
315 | Int_t kmat; | |
cfce8870 | 316 | gMC->Mixture(kmat, name, a, z, dens, nlmat, wmat); |
8494b010 | 317 | (*fIdmate)[imat]=kmat; |
318 | } | |
319 | ||
e2afb3b6 | 320 | //_______________________________________________________________________ |
8494b010 | 321 | void AliModule::AliMedium(Int_t numed, const char *name, Int_t nmat, |
e2afb3b6 | 322 | Int_t isvol, Int_t ifield, Float_t fieldm, |
323 | Float_t tmaxfd, Float_t stemax, Float_t deemax, | |
324 | Float_t epsil, Float_t stmin, Float_t *ubuf, | |
325 | Int_t nbuf) const | |
8494b010 | 326 | { |
327 | // | |
328 | // Store the parameters of a tracking medium | |
329 | // | |
b13db077 | 330 | // numed the medium number is stored into (*fIdtmed)[numed] |
8494b010 | 331 | // name medium name |
332 | // nmat the material number is stored into (*fIdmate)[nmat] | |
333 | // isvol sensitive volume if isvol!=0 | |
334 | // ifield magnetic field flag (see below) | |
335 | // fieldm maximum magnetic field | |
336 | // tmaxfd maximum deflection angle due to magnetic field | |
337 | // stemax maximum step allowed | |
338 | // deemax maximum fractional energy loss in one step | |
339 | // epsil tracking precision in cm | |
340 | // stmin minimum step due to continuous processes | |
341 | // | |
342 | // ifield = 0 no magnetic field | |
343 | // = -1 user decision in guswim | |
344 | // = 1 tracking performed with Runge Kutta | |
345 | // = 2 tracking performed with helix | |
346 | // = 3 constant magnetic field along z | |
347 | // | |
348 | Int_t kmed; | |
cfce8870 | 349 | gMC->Medium(kmed,name, (*fIdmate)[nmat], isvol, ifield, fieldm, |
8494b010 | 350 | tmaxfd, stemax, deemax, epsil, stmin, ubuf, nbuf); |
ad51aeb0 | 351 | (*fIdtmed)[numed]=kmed; |
8494b010 | 352 | } |
353 | ||
e2afb3b6 | 354 | //_______________________________________________________________________ |
8494b010 | 355 | void AliModule::AliMatrix(Int_t &nmat, Float_t theta1, Float_t phi1, |
e2afb3b6 | 356 | Float_t theta2, Float_t phi2, Float_t theta3, |
357 | Float_t phi3) const | |
8494b010 | 358 | { |
359 | // | |
360 | // Define a rotation matrix. Angles are in degrees. | |
361 | // | |
362 | // nmat on output contains the number assigned to the rotation matrix | |
363 | // theta1 polar angle for axis I | |
364 | // phi1 azimuthal angle for axis I | |
365 | // theta2 polar angle for axis II | |
366 | // phi2 azimuthal angle for axis II | |
367 | // theta3 polar angle for axis III | |
368 | // phi3 azimuthal angle for axis III | |
369 | // | |
cfce8870 | 370 | gMC->Matrix(nmat, theta1, phi1, theta2, phi2, theta3, phi3); |
8494b010 | 371 | } |
372 | ||
e2afb3b6 | 373 | //_______________________________________________________________________ |
65fb704d | 374 | Float_t AliModule::ZMin() const |
375 | { | |
376 | return -500; | |
377 | } | |
378 | ||
e2afb3b6 | 379 | //_______________________________________________________________________ |
65fb704d | 380 | Float_t AliModule::ZMax() const |
381 | { | |
382 | return 500; | |
383 | } | |
384 | ||
e2afb3b6 | 385 | //_______________________________________________________________________ |
8494b010 | 386 | void AliModule::SetEuclidFile(char* material, char* geometry) |
387 | { | |
388 | // | |
389 | // Sets the name of the Euclid file | |
390 | // | |
391 | fEuclidMaterial=material; | |
392 | if(geometry) { | |
393 | fEuclidGeometry=geometry; | |
394 | } else { | |
395 | char* name = new char[strlen(material)]; | |
396 | strcpy(name,material); | |
397 | strcpy(&name[strlen(name)-4],".euc"); | |
398 | fEuclidGeometry=name; | |
399 | delete [] name; | |
400 | } | |
401 | } | |
402 | ||
e2afb3b6 | 403 | //_______________________________________________________________________ |
b13db077 | 404 | void AliModule::ReadEuclid(const char* filnam, char* topvol) |
405 | { | |
406 | // | |
407 | // read in the geometry of the detector in euclid file format | |
408 | // | |
409 | // id_det : the detector identification (2=its,...) | |
410 | // topvol : return parameter describing the name of the top | |
411 | // volume of geometry. | |
412 | // | |
413 | // author : m. maire | |
414 | // | |
415 | // 28.07.98 | |
416 | // several changes have been made by miroslav helbich | |
417 | // subroutine is rewrited to follow the new established way of memory | |
418 | // booking for tracking medias and rotation matrices. | |
419 | // all used tracking media have to be defined first, for this you can use | |
420 | // subroutine greutmed. | |
421 | // top volume is searched as only volume not positioned into another | |
422 | // | |
423 | ||
424 | Int_t i, nvol, iret, itmed, irot, numed, npar, ndiv, iaxe; | |
425 | Int_t ndvmx, nr, flag; | |
426 | char key[5], card[77], natmed[21]; | |
427 | char name[5], mother[5], shape[5], konly[5], volst[7000][5]; | |
428 | char *filtmp; | |
d43b40e2 | 429 | Float_t par[100]; |
b13db077 | 430 | Float_t teta1, phi1, teta2, phi2, teta3, phi3, orig, step; |
431 | Float_t xo, yo, zo; | |
aee8290b | 432 | const Int_t kMaxRot=5000; |
433 | Int_t idrot[kMaxRot],istop[7000]; | |
b13db077 | 434 | FILE *lun; |
435 | // | |
436 | // *** The input filnam name will be with extension '.euc' | |
437 | filtmp=gSystem->ExpandPathName(filnam); | |
438 | lun=fopen(filtmp,"r"); | |
439 | delete [] filtmp; | |
440 | if(!lun) { | |
441 | Error("ReadEuclid","Could not open file %s\n",filnam); | |
442 | return; | |
443 | } | |
444 | //* --- definition of rotation matrix 0 --- | |
445 | TArrayI &idtmed = *fIdtmed; | |
aee8290b | 446 | for(i=1; i<kMaxRot; ++i) idrot[i]=-99; |
b13db077 | 447 | idrot[0]=0; |
448 | nvol=0; | |
449 | L10: | |
450 | for(i=0;i<77;i++) card[i]=0; | |
451 | iret=fscanf(lun,"%77[^\n]",card); | |
452 | if(iret<=0) goto L20; | |
453 | fscanf(lun,"%*c"); | |
454 | //* | |
455 | strncpy(key,card,4); | |
456 | key[4]='\0'; | |
457 | if (!strcmp(key,"TMED")) { | |
458 | sscanf(&card[5],"%d '%[^']'",&itmed,natmed); | |
459 | if( itmed<0 || itmed>=100 ) { | |
460 | Error("ReadEuclid","TMED illegal medium number %d for %s\n",itmed,natmed); | |
461 | exit(1); | |
462 | } | |
463 | //Pad the string with blanks | |
464 | i=-1; | |
465 | while(natmed[++i]); | |
466 | while(i<20) natmed[i++]=' '; | |
467 | natmed[i]='\0'; | |
468 | // | |
469 | if( idtmed[itmed]<=0 ) { | |
470 | Error("ReadEuclid","TMED undefined medium number %d for %s\n",itmed,natmed); | |
471 | exit(1); | |
472 | } | |
473 | gMC->Gckmat(idtmed[itmed],natmed); | |
474 | //* | |
475 | } else if (!strcmp(key,"ROTM")) { | |
476 | sscanf(&card[4],"%d %f %f %f %f %f %f",&irot,&teta1,&phi1,&teta2,&phi2,&teta3,&phi3); | |
aee8290b | 477 | if( irot<=0 || irot>=kMaxRot ) { |
b13db077 | 478 | Error("ReadEuclid","ROTM rotation matrix number %d illegal\n",irot); |
479 | exit(1); | |
480 | } | |
481 | AliMatrix(idrot[irot],teta1,phi1,teta2,phi2,teta3,phi3); | |
482 | //* | |
483 | } else if (!strcmp(key,"VOLU")) { | |
484 | sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, shape, &numed, &npar); | |
485 | if (npar>0) { | |
486 | for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]); | |
487 | fscanf(lun,"%*c"); | |
488 | } | |
489 | gMC->Gsvolu( name, shape, idtmed[numed], par, npar); | |
490 | //* save the defined volumes | |
491 | strcpy(volst[++nvol],name); | |
492 | istop[nvol]=1; | |
493 | //* | |
494 | } else if (!strcmp(key,"DIVN")) { | |
495 | sscanf(&card[5],"'%[^']' '%[^']' %d %d", name, mother, &ndiv, &iaxe); | |
496 | gMC->Gsdvn ( name, mother, ndiv, iaxe ); | |
497 | //* | |
498 | } else if (!strcmp(key,"DVN2")) { | |
499 | sscanf(&card[5],"'%[^']' '%[^']' %d %d %f %d",name, mother, &ndiv, &iaxe, &orig, &numed); | |
500 | gMC->Gsdvn2( name, mother, ndiv, iaxe, orig,idtmed[numed]); | |
501 | //* | |
502 | } else if (!strcmp(key,"DIVT")) { | |
503 | sscanf(&card[5],"'%[^']' '%[^']' %f %d %d %d", name, mother, &step, &iaxe, &numed, &ndvmx); | |
504 | gMC->Gsdvt ( name, mother, step, iaxe, idtmed[numed], ndvmx); | |
505 | //* | |
506 | } else if (!strcmp(key,"DVT2")) { | |
507 | sscanf(&card[5],"'%[^']' '%[^']' %f %d %f %d %d", name, mother, &step, &iaxe, &orig, &numed, &ndvmx); | |
508 | gMC->Gsdvt2 ( name, mother, step, iaxe, orig, idtmed[numed], ndvmx ); | |
509 | //* | |
510 | } else if (!strcmp(key,"POSI")) { | |
511 | sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']'", name, &nr, mother, &xo, &yo, &zo, &irot, konly); | |
aee8290b | 512 | if( irot<0 || irot>=kMaxRot ) { |
b13db077 | 513 | Error("ReadEuclid","POSI %s#%d rotation matrix number %d illegal\n",name,nr,irot); |
514 | exit(1); | |
515 | } | |
516 | if( idrot[irot] == -99) { | |
517 | Error("ReadEuclid","POSI %s#%d undefined matrix number %d\n",name,nr,irot); | |
518 | exit(1); | |
519 | } | |
520 | //*** volume name cannot be the top volume | |
521 | for(i=1;i<=nvol;i++) { | |
522 | if (!strcmp(volst[i],name)) istop[i]=0; | |
523 | } | |
524 | //* | |
525 | gMC->Gspos ( name, nr, mother, xo, yo, zo, idrot[irot], konly ); | |
526 | //* | |
527 | } else if (!strcmp(key,"POSP")) { | |
528 | sscanf(&card[5],"'%[^']' %d '%[^']' %f %f %f %d '%[^']' %d", name, &nr, mother, &xo, &yo, &zo, &irot, konly, &npar); | |
aee8290b | 529 | if( irot<0 || irot>=kMaxRot ) { |
b13db077 | 530 | Error("ReadEuclid","POSP %s#%d rotation matrix number %d illegal\n",name,nr,irot); |
531 | exit(1); | |
532 | } | |
533 | if( idrot[irot] == -99) { | |
534 | Error("ReadEuclid","POSP %s#%d undefined matrix number %d\n",name,nr,irot); | |
535 | exit(1); | |
536 | } | |
537 | if (npar > 0) { | |
538 | for(i=0;i<npar;i++) fscanf(lun,"%f",&par[i]); | |
539 | fscanf(lun,"%*c"); | |
540 | } | |
541 | //*** volume name cannot be the top volume | |
542 | for(i=1;i<=nvol;i++) { | |
543 | if (!strcmp(volst[i],name)) istop[i]=0; | |
544 | } | |
545 | //* | |
546 | gMC->Gsposp ( name, nr, mother, xo,yo,zo, idrot[irot], konly, par, npar); | |
547 | } | |
548 | //* | |
549 | if (strcmp(key,"END")) goto L10; | |
550 | //* find top volume in the geometry | |
551 | flag=0; | |
552 | for(i=1;i<=nvol;i++) { | |
553 | if (istop[i] && flag) { | |
554 | Warning("ReadEuclid"," %s is another possible top volume\n",volst[i]); | |
555 | } | |
556 | if (istop[i] && !flag) { | |
557 | strcpy(topvol,volst[i]); | |
9e1a0ddb | 558 | if(fDebug) printf("%s::ReadEuclid: volume %s taken as a top volume\n",ClassName(),topvol); |
b13db077 | 559 | flag=1; |
560 | } | |
561 | } | |
562 | if (!flag) { | |
563 | Warning("ReadEuclid","top volume not found\n"); | |
564 | } | |
565 | fclose (lun); | |
566 | //* | |
567 | //* commented out only for the not cernlib version | |
9e1a0ddb | 568 | if(fDebug) printf("%s::ReadEuclid: file: %s is now read in\n",ClassName(),filnam); |
b13db077 | 569 | // |
570 | return; | |
571 | //* | |
572 | L20: | |
573 | Error("ReadEuclid","reading error or premature end of file\n"); | |
574 | } | |
575 | ||
e2afb3b6 | 576 | //_______________________________________________________________________ |
b13db077 | 577 | void AliModule::ReadEuclidMedia(const char* filnam) |
578 | { | |
579 | // | |
580 | // read in the materials and tracking media for the detector | |
581 | // in euclid file format | |
582 | // | |
583 | // filnam: name of the input file | |
584 | // id_det: id_det is the detector identification (2=its,...) | |
585 | // | |
586 | // author : miroslav helbich | |
587 | // | |
588 | Float_t sxmgmx = gAlice->Field()->Max(); | |
589 | Int_t isxfld = gAlice->Field()->Integ(); | |
590 | Int_t end, i, iret, itmed; | |
591 | char key[5], card[130], natmed[21], namate[21]; | |
592 | Float_t ubuf[50]; | |
593 | char* filtmp; | |
594 | FILE *lun; | |
595 | Int_t imate; | |
596 | Int_t nwbuf, isvol, ifield, nmat; | |
597 | Float_t a, z, dens, radl, absl, fieldm, tmaxfd, stemax, deemax, epsil, stmin; | |
598 | // | |
599 | end=strlen(filnam); | |
600 | for(i=0;i<end;i++) if(filnam[i]=='.') { | |
601 | end=i; | |
602 | break; | |
603 | } | |
604 | // | |
605 | // *** The input filnam name will be with extension '.euc' | |
9e1a0ddb | 606 | if(fDebug) printf("%s::ReadEuclid: The file name is %s\n",ClassName(),filnam); //Debug |
b13db077 | 607 | filtmp=gSystem->ExpandPathName(filnam); |
608 | lun=fopen(filtmp,"r"); | |
609 | delete [] filtmp; | |
610 | if(!lun) { | |
611 | Warning("ReadEuclidMedia","Could not open file %s\n",filnam); | |
612 | return; | |
613 | } | |
614 | // | |
615 | // Retrieve Mag Field parameters | |
aee8290b | 616 | Int_t globField=gAlice->Field()->Integ(); |
617 | Float_t globMaxField=gAlice->Field()->Max(); | |
b13db077 | 618 | // TArrayI &idtmed = *fIdtmed; |
619 | // | |
620 | L10: | |
621 | for(i=0;i<130;i++) card[i]=0; | |
622 | iret=fscanf(lun,"%4s %[^\n]",key,card); | |
623 | if(iret<=0) goto L20; | |
624 | fscanf(lun,"%*c"); | |
625 | //* | |
626 | //* read material | |
627 | if (!strcmp(key,"MATE")) { | |
628 | sscanf(card,"%d '%[^']' %f %f %f %f %f %d",&imate,namate,&a,&z,&dens,&radl,&absl,&nwbuf); | |
629 | if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]); | |
630 | //Pad the string with blanks | |
631 | i=-1; | |
632 | while(namate[++i]); | |
633 | while(i<20) namate[i++]=' '; | |
634 | namate[i]='\0'; | |
635 | // | |
636 | AliMaterial(imate,namate,a,z,dens,radl,absl,ubuf,nwbuf); | |
637 | //* read tracking medium | |
638 | } else if (!strcmp(key,"TMED")) { | |
639 | sscanf(card,"%d '%[^']' %d %d %d %f %f %f %f %f %f %d", | |
640 | &itmed,natmed,&nmat,&isvol,&ifield,&fieldm,&tmaxfd, | |
641 | &stemax,&deemax,&epsil,&stmin,&nwbuf); | |
642 | if (nwbuf>0) for(i=0;i<nwbuf;i++) fscanf(lun,"%f",&ubuf[i]); | |
643 | if (ifield<0) ifield=isxfld; | |
644 | if (fieldm<0) fieldm=sxmgmx; | |
645 | //Pad the string with blanks | |
646 | i=-1; | |
647 | while(natmed[++i]); | |
648 | while(i<20) natmed[i++]=' '; | |
649 | natmed[i]='\0'; | |
650 | // | |
aee8290b | 651 | AliMedium(itmed,natmed,nmat,isvol,globField,globMaxField,tmaxfd, |
b13db077 | 652 | stemax,deemax,epsil,stmin,ubuf,nwbuf); |
653 | // (*fImedia)[idtmed[itmed]-1]=id_det; | |
654 | //* | |
655 | } | |
656 | //* | |
657 | if (strcmp(key,"END")) goto L10; | |
658 | fclose (lun); | |
659 | //* | |
660 | //* commented out only for the not cernlib version | |
9e1a0ddb | 661 | if(fDebug) printf("%s::ReadEuclidMedia: file %s is now read in\n", |
662 | ClassName(),filnam); | |
b13db077 | 663 | //* |
664 | return; | |
665 | //* | |
666 | L20: | |
667 | Warning("ReadEuclidMedia","reading error or premature end of file\n"); | |
668 | } | |
669 | ||
8494b010 | 670 |