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