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