]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALv0.cxx
modification of geometry
[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
52
53 }
54
55 //____________________________________________________________________________
56 void AliEMCALv0::BuildGeometry()
57 {
58
59   const Int_t kColorArm1   = kBlue ;
60   const Int_t kColorArm2   = kBlue ;
61   const Int_t kColorArm1Active   = kRed ;
62   const Int_t kColorArm2Active   = kRed ;
63
64   // make the container of  Arm1
65   
66   new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
67             fGeom->GetEnvelop(0),     // rmin 
68             fGeom->GetEnvelop(1),     // rmax
69             fGeom->GetEnvelop(2)/2.0, // half length in Z
70             fGeom->GetArm1PhiMin(),   // minimun phi angle
71             fGeom->GetArm1PhiMax()    // maximun phi angle
72             ) ; 
73    // Active material of  Arm1
74  
75   new TTUBS("Arm1", "Active material of  arm 1", "void", 
76             fGeom->GetEnvelop(0) + fGeom->GetGap2Active(),                   // rmin 
77             fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax 
78             fGeom->GetLmat()/2.0,     // half length in Z
79             fGeom->GetArm1PhiMin(),   // minimun phi angle
80             fGeom->GetArm1PhiMax()    // maximun phi angle
81             ) ; 
82   // make the container of  Arm2
83  
84   new TTUBS("Envelop2", "Tubs that contains arm 2", "void", 
85             fGeom->GetEnvelop(0),     // rmin 
86             fGeom->GetEnvelop(1),     // rmax
87             fGeom->GetEnvelop(2)/2.0, // half length in Z
88             fGeom->GetArm2PhiMin(),   // minimun phi angle
89             fGeom->GetArm2PhiMax()    // maximun phi angle
90             ) ;
91            
92   // Active material of  Arm2
93  
94   new TTUBS("Arm2", "Active material of  arm 2", "void", 
95             fGeom->GetEnvelop(0) + fGeom->GetGap2Active(),                   // rmin 
96             fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax 
97             fGeom->GetLmat()/2.0,     // half length in Z          
98             fGeom->GetArm2PhiMin(),   // minimun phi angle
99             fGeom->GetArm2PhiMax()    // maximun phi angle
100             ) ;
101
102   TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
103   top->cd();
104   
105   // Arm 1 inside alice
106   TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
107   envelop1node->SetLineColor(kColorArm1) ;
108   fNodes->Add(envelop1node) ;
109
110   // Arm 2 inside alice
111   TNode * envelop2node = new TNode("Envelop2", "Arm2 Envelop", "Envelop2") ;
112   envelop2node->SetLineColor(kColorArm2) ;
113   fNodes->Add(envelop2node) ;
114
115   // active material inside Arm 1
116   envelop1node->cd() ; 
117   TNode * arm1node = new TNode("Arm1", "Arm1 with Mat", "Arm1") ;
118   arm1node->SetLineColor(kColorArm1Active) ;
119   fNodes->Add(arm1node) ; 
120
121   // active material inside Arm 2
122   envelop2node->cd() ; 
123   TNode * arm2node = new TNode("Arm2", "Arm2 with Mat", "Arm2") ;
124   arm2node->SetLineColor(kColorArm2Active) ;
125   fNodes->Add(arm2node) ; 
126   
127 }
128
129 //____________________________________________________________________________
130 void AliEMCALv0::CreateGeometry()
131 {
132   // Create the EMCAL geometry for Geant
133
134   AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
135
136   if ( emcaltmp == NULL ) {
137     
138     fprintf(stderr, "EMCAL detector not found!\n") ;
139     return;
140     
141   }
142   // Get pointer to the array containing media indices
143   Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
144
145
146   // Create tube sectors that contains Arm 1 & 2 
147  
148   Float_t envelopA[5] ; 
149   envelopA[0] = fGeom->GetEnvelop(0) ;         // rmin
150   envelopA[1] = fGeom->GetEnvelop(1) ;         // rmax
151   envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ;   // dz
152   envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
153   envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
154
155   gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
156
157   envelopA[3] = fGeom->GetArm2PhiMin() ;       // minimun phi angle
158   envelopA[4] = fGeom->GetArm2PhiMax() ;       // maximun phi angle
159   
160   gMC->Gsvolu("XEN2", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
161
162   // Create a tube sector that contains active material Arm 1 & 2 
163
164   envelopA[0] = fGeom->GetEnvelop(0) +  fGeom->GetGap2Active() ;
165   envelopA[1] = envelopA[0] + fGeom->GetLmat() ;
166   envelopA[3] = fGeom->GetArm1PhiMin() ;       // minimun phi angle
167   envelopA[4] = fGeom->GetArm1PhiMax() ;       // maximun phi angle
168
169   gMC->Gsvolu("XAR1", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
170
171   envelopA[3] = fGeom->GetArm2PhiMin() ;       // minimun phi angle
172   envelopA[4] = fGeom->GetArm2PhiMax() ;       // maximun phi angle
173  
174   gMC->Gsvolu("XAR2", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
175   
176   Int_t idrotm = 1;
177   AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
178
179   // Position  ENV1 container in ALIC
180   gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
181   
182   // Position  ARM1  into ENV1
183   gMC->Gspos("XAR1", 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
184
185   // Position  ENV2 container in ALIC  
186   gMC->Gspos("XEN2", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
187
188   // Position  ARM2  into ENV2
189   gMC->Gspos("XAR2", 1, "XEN2", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
190   
191 }
192
193 //____________________________________________________________________________
194 void AliEMCALv0::Init(void)
195 {
196   // Just prints an information message
197   
198   Int_t i;
199
200   printf("\n");
201   for(i=0;i<35;i++) printf("*");
202   printf(" EMCAL_INIT ");
203   for(i=0;i<35;i++) printf("*");
204   printf("\n");
205
206   // Here the EMCAL initialisation code (if any!)
207
208   if (fGeom!=0)  
209     cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for " << fGeom->GetName() << endl ;
210   else
211     cout << "AliEMCAL" << Version() << " : EMCAL geometry initialization failed !" << endl ;   
212   
213   for(i=0;i<80;i++) printf("*");
214   printf("\n");
215   
216 }
217