]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALv0.cxx
changed eta, phi method; added * operator
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
1 /**************************************************************************
2
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4
5  *                                                                        *
6
7  * Author: The ALICE Off-line Project.                                    *
8
9  * Contributors are mentioned in the code where appropriate.              *
10
11  *                                                                        *
12
13  * Permission to use, copy, modify and distribute this software and its   *
14
15  * documentation strictly for non-commercial purposes is hereby granted   *
16
17  * without fee, provided that the above copyright notice appears in all   *
18
19  * copies and that both the copyright notice and this permission notice   *
20
21  * appear in the supporting documentation. The authors make no claims     *
22
23  * about the suitability of this software for any purpose. It is          *
24
25  * provided "as is" without express or implied warranty.                  *
26
27  **************************************************************************/
28
29
30
31 /* $Id$ */
32
33
34
35 //_________________________________________________________________________
36
37 // Implementation version v0 of EMCAL Manager class 
38
39 // An object of this class does not produce hits nor digits
40
41 // It is the one to use if you do not want to produce outputs in TREEH or TREED
42
43 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx                 
44
45 //*-- Author: Yves Schutz (SUBATECH)
46
47 //*-- and   : Sahal Yacoob (LBL / UCT)
48
49
50
51 // This Version of AliEMCALv0 reduces the number of volumes placed in XEN1 (the envelope) to less than five hundred
52
53 // The Envelope is Placed in Alice, And the Aluminium layer. Mini envelopes (XU) are then placed in XEN1.
54
55 // Each mini envelope contains 2 scintillator, and 2 lead layers, except the last one which contains just one scintillator layer.
56
57 // At the moment I cannot place the 36 and above layers in the mini envelopes so all layers are still placed in XEN1
58
59
60
61
62
63 // --- ROOT system ---
64
65 #include "TPGON.h"
66
67 #include "TTUBS.h"
68
69 #include "TNode.h"
70
71 #include "TRandom.h"
72
73 #include "TGeometry.h"
74
75 //#include "Tstring.h"
76
77
78
79 // --- Standard library ---
80
81
82
83 #include <stdio.h>
84
85 #include <string.h>
86
87 #include <stdlib.h>
88
89 #include <strstream.h>
90
91 #include <iostream.h>
92
93
94
95 // --- AliRoot header files ---
96
97
98
99 #include "AliEMCALv0.h"
100
101 #include "AliEMCALGeometry.h"
102
103 #include "AliConst.h"
104
105 #include "AliRun.h"
106
107 #include "AliMC.h"
108
109
110
111 ClassImp(AliEMCALv0)
112
113
114
115 //______________________________________________________________________
116
117 AliEMCALv0::AliEMCALv0(const char *name, const char *title):
118
119     AliEMCAL(name,title){
120
121     // Standard Constructor
122
123
124
125     if (strcmp(GetTitle(),"") != 0 )
126
127         fGeom =  AliEMCALGeometry::GetInstance(GetTitle(), "") ;
128
129
130
131 }
132
133 //______________________________________________________________________
134
135 void AliEMCALv0::BuildGeometry(){
136
137     // Display Geometry for display.C
138
139
140
141     const Int_t kColorArm1   = kBlue ;
142
143
144
145     // Difine the shape of the Calorimeter 
146
147   
148
149     new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
150
151               fGeom->GetEnvelop(0),     // rmin 
152
153               fGeom->GetEnvelop(1) +30 ,     // rmax
154
155               fGeom->GetEnvelop(2)/2.0, // half length in Z
156
157               fGeom->GetArm1PhiMin(),   // minimun phi angle
158
159               fGeom->GetArm1PhiMax()    // maximun phi angle
160
161         );
162
163     // Place the Node
164
165     TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
166
167     envelop1node->SetLineColor(kColorArm1) ;
168
169     fNodes->Add(envelop1node) ;
170
171 }
172
173 //______________________________________________________________________
174
175 void AliEMCALv0::CreateGeometry(){
176
177     // Create the EMCAL geometry for Geant
178
179     Float_t etamin,etamax;
180
181
182
183     if(!(fGeom->IsInitialized())){
184
185         Error("CreateGeometry","EMCAL Geometry class has not been set up.");
186
187     } // end if
188
189     // Get pointer to the array containing media indices
190
191     Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
192
193
194
195     // Create an Envelope within which to place the Detector 
196
197  
198
199     Float_t envelopA[5];
200
201     envelopA[0] = fGeom->GetEnvelop(0);     // rmin
202
203     envelopA[1] = fGeom->GetEnvelop(1);     // rmax
204
205     envelopA[2] = fGeom->GetEnvelop(2)/2.0; // dz
206
207     envelopA[3] = fGeom->GetArm1PhiMin();   // minimun phi angle
208
209     envelopA[4] = fGeom->GetArm1PhiMax();   // maximun phi angle
210
211
212
213     // create XEN1
214
215     gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
216
217
218
219     Int_t idrotm = 1;
220
221     AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
222
223
224
225     // Position the EMCAL Mother Volume in Alice  
226
227     gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
228
229
230
231     //  
232
233     TString label = "XU0";
234
235
236
237     //rmin Start mini envelopes after the aluminium layer
238
239     envelopA[0] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + 
240
241                   fGeom->GetAlFrontThickness();
242
243     //rmax larger for first two layers (preshower);
244
245     Float_t tseg = fGeom->GetPreSintThick()+fGeom->GetPbRadThick();
246
247     envelopA[1] = envelopA[0] + 2.0*tseg;
248
249     envelopA[2] = fGeom->GetEnvelop(2)/2.0; // dz
250
251     envelopA[3] = fGeom->GetArm1PhiMin();   // minimun phi angle
252
253     envelopA[4] = fGeom->GetArm1PhiMax();   // maximun phi angle
254
255     //filled with air
256
257     gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
258
259     // Place XU0 in to XEN1
260
261     gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY");
262
263
264
265     tseg = fGeom->GetFullSintThick()+fGeom->GetPbRadThick();
266
267     for (int i = 1; i < ((fGeom->GetNLayers()-1)/2) + 1 ; i++ ){
268
269         label = "XU" ;
270
271         label += i ;
272
273         envelopA[0] = envelopA[1]; //rmin
274
275         envelopA[1] = envelopA[0] + 2.0*tseg;  //rmax
276
277          //filled with air
278
279         gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
280
281         gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
282
283     } // end  i
284
285
286
287     // Create the shapes of active material (LEAD/Aluminium/Scintillator)
288
289     // to be placed
290
291     Float_t envelopB[10]; // First Layer of Aluminium
292
293     Float_t envelopC[10]; // Scintillator Layers
294
295     Float_t envelopD[10]; // Lead Layers
296
297     //starting position in Phi
298
299     envelopC[0] = envelopD[0] =  envelopB[0] = fGeom->GetArm1PhiMin();
300
301     // Angular size of the Detector in Phi
302
303     envelopB[1] = fGeom->GetArm1PhiMax() - fGeom->GetArm1PhiMin();
304
305     envelopC[1] = envelopD[1] = envelopB[1];
306
307     // Number of Section in Phi
308
309     envelopC[2] = envelopD[2] = envelopB[2] = fGeom->GetNPhi();
310
311     // each section will be passed 2 z coordinates    
312
313     envelopD[3] = envelopC[3] = envelopB[3] = 2;
314
315     envelopB[4] = fGeom->ZFromEtaR(fGeom->GetEnvelop(0)+fGeom->GetGap2Active(),
316
317                                    fGeom->GetArm1EtaMin());// z co-ordinate 1
318
319     envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin at z1
320
321     envelopB[6] = envelopB[5] + fGeom->GetAlFrontThickness();//rmax at z1
322
323     envelopD[6] = envelopB[6];
324
325     envelopB[7] =fGeom->ZFromEtaR(fGeom->GetEnvelop(0)+fGeom->GetGap2Active(),
326
327                                   fGeom->GetArm1EtaMax()); // z co-ordinate 2
328
329     envelopB[8] = envelopB[5] ; //
330
331     envelopB[9] = envelopB[6] ; // radii are the same.
332
333
334
335     // filled shapes wit hactive material 
336
337     // Define Aluminium volume completely
338
339     gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
340
341     // The polystyrene layers will be defined when placed 
342
343     gMC->Gsvolu("XPST", "PGON", idtmed[1601], 0, 0);
344
345     gMC->Gsvolu("XPBX", "PGON", idtmed[1600], 0, 0);//  as will the lead layers
346
347     //  Dividind eta polystyrene divisions into phi segments.
348
349     gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2);
350
351     // Position Aluminium Layer in the Envelope 
352
353     gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
354
355
356
357     // The loop below places the scintillator in Lead Layers alternately.
358
359     for (int i = 0; i < fGeom->GetNLayers() ; i++ ){
360
361         label = "XU" ;
362
363         label += (int) i/2  ; // we will place two layers (i = one layer) in each mini envelope)        
364
365         envelopC[5] = envelopD[6] ; //rmin
366
367         envelopC[6] = envelopD[6] + ((i > 1)  ? fGeom->GetFullSintThick() : 
368
369                                      fGeom->GetPreSintThick());//rmax larger for first two layers (preshower)
370
371         envelopC[8] = envelopD[6] ; //rmin
372
373         envelopC[9] = envelopD[6] + ((i > 1 ) ? fGeom->GetFullSintThick() :
374
375                                      fGeom->GetPreSintThick());//rmax larger for first two layers (preshower)
376
377         for (int j =0; j < (fGeom->GetNEta()) ; j++){
378
379             etamin = fGeom->GetArm1EtaMin()+
380
381                 (j*fGeom->GetDeltaEta());
382
383             etamax = fGeom->GetArm1EtaMin()+
384
385                 ((j+1)*fGeom->GetDeltaEta());
386
387             envelopC[4] = fGeom->ZFromEtaR(envelopD[6],etamin); //z begin  
388
389             envelopC[7] = fGeom->ZFromEtaR(envelopD[6],etamax);// z end 
390
391             gMC->Gsposp("XPST",1+j+i*(fGeom->GetNEta()), label.Data(), // should be used but there's a weird crash above i = 18, 
392
393                         0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
394
395         } // end for j
396
397         if (i < (fGeom->GetNLayers()-1)){
398
399             envelopD[5] = envelopC[6] ; //rmin
400
401             envelopD[6] = envelopC[6] + fGeom->GetPbRadThick();  //rmax
402
403             envelopD[8] = envelopC[6] ; //rmin
404
405             envelopD[9] = envelopC[6] + fGeom->GetPbRadThick();  //rmax
406
407             for (int j =0; j < (fGeom->GetNEta()) ; j++){
408
409                 etamin = fGeom->GetArm1EtaMin()+
410
411                     (j*fGeom->GetDeltaEta());
412
413                 etamax = fGeom->GetArm1EtaMin()+
414
415                     ((j+1)*fGeom->GetDeltaEta());
416
417                 envelopD[4] = fGeom->ZFromEtaR(envelopC[6],etamin);//z begin  
418
419                 envelopD[7] = fGeom->ZFromEtaR(envelopC[6],etamax);// z end
420
421                 // Position and Define Layer
422
423                 gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNEta()), label.Data(), 
424
425                             0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
426
427             } // end for j
428
429         } // end if i
430
431     }  // for i
432
433 }
434
435 //______________________________________________________________________
436
437 void AliEMCALv0::Init(void){
438
439     // Just prints an information message
440
441     Int_t i;
442
443
444
445     cout << endl;
446
447     for(i=0;i<35;i++) cout <<"*";
448
449     cout << " EMCAL_INIT ";
450
451     for(i=0;i<35;i++) cout << "*";
452
453     cout << endl;
454
455
456
457     // Here the EMCAL initialisation code (if any!)
458
459
460
461     if (fGeom!=0)  
462
463         cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
464
465              << fGeom->GetName() << endl ;
466
467     else
468
469         cout << "AliEMCAL" << Version() << 
470
471             " : EMCAL geometry initialization failed !" << endl ;
472
473     for(i=0;i<80;i++) printf("*");
474
475     cout << endl;
476
477 }
478