]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALv0.cxx
added the vomume EMCA that contains the whole calorimeter
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
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 /* $Id$ */
17
18 //_________________________________________________________________________
19 // Implementation version v0 of EMCAL Manager class 
20 // An object of this class does not produce hits nor digits
21 // It is the one to use if you do not want to produce outputs in TREEH or TREED
22 //                  
23 //*-- Author: Yves Schutz (SUBATECH)
24
25
26 // --- ROOT system ---
27
28 #include "TTUBS.h"
29 #include "TNode.h"
30 #include "TRandom.h"
31 #include "TGeometry.h"
32
33
34 // --- Standard library ---
35
36 #include <iostream.h> 
37
38 // --- AliRoot header files ---
39
40 #include "AliEMCALv0.h"
41 #include "AliEMCALGeometry.h"
42 #include "AliRun.h"
43 #include "AliMC.h"
44
45 ClassImp(AliEMCALv0)
46
47 //____________________________________________________________________________
48 AliEMCALv0::AliEMCALv0(const char *name, const char *title):
49   AliEMCAL(name,title)
50 {
51   // ctor/* $Id$ */
52
53   cout << " $Id$ " << endl ; 
54
55 }
56
57 //____________________________________________________________________________
58 void AliEMCALv0::BuildGeometry()
59 {
60
61   const Int_t kColorEmcal   = kGreen ;
62   const Int_t kColorArm1    = kBlue ;
63   const Int_t kColorArm2    = kBlue ;
64   const Int_t kColorArm1Active   = kRed ;
65   const Int_t kColorArm2Active   = kRed ;
66
67   // make the container of entire calorimeter
68
69   new TTUBS("EMCA", "Tubs that contains the calorimeter", "void", 
70             fGeom->GetEnvelop(0),     // rmin 
71             fGeom->GetEnvelop(1),     // rmax
72             fGeom->GetEnvelop(2)/2.0, // half length in Z
73             0., 
74             360.
75             ) ; 
76
77   // make the container of  Arm1
78   
79   new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
80             fGeom->GetEnvelop(0),     // rmin 
81             fGeom->GetEnvelop(1),     // rmax
82             fGeom->GetEnvelop(2)/2.0, // half length in Z
83             fGeom->GetArm1PhiMin(),   // minimun phi angle
84             fGeom->GetArm1PhiMax()    // maximun phi angle
85             ) ; 
86    // Active material of  Arm1
87  
88   new TTUBS("Arm1", "Active material of  arm 1", "void", 
89             fGeom->GetEnvelop(0) + fGeom->GetGap2Active(),                   // rmin 
90             fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax 
91             fGeom->GetEnvelop(2)/2.0, // half length in Z
92             fGeom->GetArm1PhiMin(),   // minimun phi angle
93             fGeom->GetArm1PhiMax()    // maximun phi angle
94             ) ; 
95   // make the container of  Arm2
96  
97   new TTUBS("Envelop2", "Tubs that contains arm 2", "void", 
98             fGeom->GetEnvelop(0),     // rmin 
99             fGeom->GetEnvelop(1),     // rmax
100             fGeom->GetEnvelop(2)/2.0, // half length in Z
101             fGeom->GetArm2PhiMin(),   // minimun phi angle
102             fGeom->GetArm2PhiMax()    // maximun phi angle
103             ) ;
104            
105   // Active material of  Arm2
106  
107   new TTUBS("Arm2", "Active material of  arm 2", "void", 
108             fGeom->GetEnvelop(0) + fGeom->GetGap2Active(),                   // rmin 
109             fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax 
110             fGeom->GetEnvelop(2)/2.0, // half length in Z
111             fGeom->GetArm2PhiMin(),   // minimun phi angle
112             fGeom->GetArm2PhiMax()    // maximun phi angle
113             ) ;
114
115   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
116   top->cd();
117   
118   // Calorimeter inside alice 
119   TNode * emcanode = new TNode("EMCAL", "EMCAL Envelop", "EMCAL") ;
120   emcanode->SetLineColor(kColorEmcal) ;
121   fNodes->Add(emcanode) ;
122
123   // Arm 1 inside Calorimeter
124   emcanode->cd(); 
125   TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
126   envelop1node->SetLineColor(kColorArm1) ;
127   fNodes->Add(envelop1node) ;
128
129   // Arm 2 inside alice
130   TNode * envelop2node = new TNode("Envelop2", "Arm2 Envelop", "Envelop2") ;
131   envelop2node->SetLineColor(kColorArm2) ;
132   fNodes->Add(envelop2node) ;
133
134   // active material inside Arm 1
135   envelop1node->cd() ; 
136   TNode * arm1node = new TNode("Arm1", "Arm1 with Mat", "Arm1") ;
137   arm1node->SetLineColor(kColorArm1Active) ;
138   fNodes->Add(arm1node) ; 
139
140   // active material inside Arm 2
141   envelop2node->cd() ; 
142   TNode * arm2node = new TNode("Arm2", "Arm2 with Mat", "Arm2") ;
143   arm2node->SetLineColor(kColorArm2Active) ;
144   fNodes->Add(arm2node) ; 
145   
146 }
147
148 //____________________________________________________________________________
149 void AliEMCALv0::CreateGeometry()
150 {
151   // Create the EMCAL geometry for Geant
152
153   AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
154
155   if ( emcaltmp == NULL ) {
156     
157     fprintf(stderr, "EMCAL detector not found!\n") ;
158     return;
159     
160   }
161   // Get pointer to the array containing media indices
162   Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
163
164   // Create the EMCA volume that contains entirely EMCAL
165
166   Float_t envelopA[5] ; 
167   envelopA[0] = fGeom->GetEnvelop(0) ;         // rmin
168   envelopA[1] = fGeom->GetEnvelop(1) ;         // rmax
169   envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ;   // dz
170   envelopA[3] = 0. ;      
171   envelopA[4] = 360.;      
172
173   gMC->Gsvolu("EMCA", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
174
175   // Create tube sectors that contains Arm 1 & 2 
176  
177   envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
178   envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
179
180   gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
181
182   envelopA[3] = fGeom->GetArm2PhiMin() ;       // minimun phi angle
183   envelopA[4] = fGeom->GetArm2PhiMax() ;       // maximun phi angle
184   
185   gMC->Gsvolu("XEN2", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
186
187   // Create a tube sector that contains active material Arm 1 & 2 
188
189   envelopA[0] = fGeom->GetEnvelop(0) +  fGeom->GetGap2Active() ;
190   envelopA[1] = envelopA[0] + fGeom->GetLmat() ;
191   envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
192   envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
193
194   gMC->Gsvolu("XAR1", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
195
196   envelopA[3] = fGeom->GetArm2PhiMin() ;       // minimun phi angle
197   envelopA[4] = fGeom->GetArm2PhiMax() ;       // maximun phi angle
198  
199   gMC->Gsvolu("XAR2", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
200   
201   Int_t idrotm = 1;
202   AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
203
204   // Position Calorimeter in ALICE
205   gMC->Gspos("EMCA", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
206
207   // Position  ENV1 container in EMCA
208   gMC->Gspos("XEN1", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
209   
210   // Position  ARM1  into ENV1
211   gMC->Gspos("XAR1", 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
212
213   // Position  ENV2 container in ALIC  
214   gMC->Gspos("XEN2", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
215
216   // Position  ARM2  into ENV2
217   gMC->Gspos("XAR2", 1, "XEN2", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
218   
219 }
220
221 //____________________________________________________________________________
222 void AliEMCALv0::Init(void)
223 {
224   // Just prints an information message
225   
226   Int_t i;
227
228   printf("\n");
229   for(i=0;i<35;i++) printf("*");
230   printf(" EMCAL_INIT ");
231   for(i=0;i<35;i++) printf("*");
232   printf("\n");
233
234   // Here the EMCAL initialisation code (if any!)
235
236   if (fGeom!=0)  
237     cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for " << fGeom->GetName() << endl ;
238   else
239     cout << "AliEMCAL" << Version() << " : EMCAL geometry initialization failed !" << endl ;   
240   
241   for(i=0;i<80;i++) printf("*");
242   printf("\n");
243   
244 }
245