introducing the US EM calorimeter
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
CommitLineData
2012850d 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
45ClassImp(AliEMCALv0)
46
47//____________________________________________________________________________
48AliEMCALv0::AliEMCALv0(const char *name, const char *title):
49 AliEMCAL(name,title)
50{
51 // ctor
52
53}
54
55//____________________________________________________________________________
56void 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), // rmin
77 fGeom->GetEnvelop(1), // 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), // rmin
96 fGeom->GetEnvelop(1), // 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("Arm1 Envelop", "Arm1 Envelop", "Envelop1") ;
107 envelop1node->SetLineColor(kColorArm1) ;
108 fNodes->Add(envelop1node) ;
109
110 // Arm 2 inside alice
111 TNode * envelop2node = new TNode("Arm2 Envelop", "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 Mat", "Arm1 Mat", "Arm1Mat") ;
118 arm1node->SetLineColor(kColorArm1Active) ;
119 fNodes->Add(arm1node) ;
120
121 // active material inside Arm 2
122 envelop2node->cd() ;
123 TNode * arm2node = new TNode("Arm2 Mat", "Arm2 Mat", "Arm2Mat") ;
124 arm2node->SetLineColor(kColorArm2Active) ;
125 fNodes->Add(arm2node) ;
126
127}
128
129
130//____________________________________________________________________________
131void AliEMCALv0::CreateGeometry()
132{
133 // Create the EMCAL geometry for Geant
134
135 AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
136
137 if ( emcaltmp == NULL ) {
138
139 fprintf(stderr, "EMCAL detector not found!\n") ;
140 return;
141
142 }
143 // Get pointer to the array containing media indices
144 Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
145
146
147 // Create a tube sector that contains Arm 1
148
149 Float_t envelopA[5] ;
150 envelopA[0] = fGeom->GetEnvelop(0) ; // rmin
151 envelopA[1] = fGeom->GetEnvelop(1) ; // rmax
152 envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ; // dz
153 envelopA[3] = fGeom->GetArm1PhiMin() ; // minimun phi angle
154 envelopA[4] = fGeom->GetArm1PhiMax() ; // maximun phi angle
155
156 gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
157
158 // Create a tube sector that contains active material Arm 1
159
160 envelopA[2] = fGeom->GetLmat() / 2.0 ; // dz
161
162 gMC->Gsvolu("XAR1", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
163
164
165 // Create a tube sector that contains Arm 2
166
167 envelopA[3] = fGeom->GetArm2PhiMin() ; // minimun phi angle
168 envelopA[4] = fGeom->GetArm2PhiMax() ; // maximun phi angle
169
170 gMC->Gsvolu("XEN2", "TUBS ", idtmed[1599], envelopA, 5) ; // filled with air
171
172 // Create a tube sector that contains active material Arm 1
173
174 envelopA[2] = fGeom->GetLmat() / 2.0 ; // dz
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//____________________________________________________________________________
196void 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