flistTreeFrame attribute added; fCanvasWindow removed
[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{
7e4107a9 51 // ctor/* $Id$ */
52
53 cout << " $Id$ " << endl ;
2012850d 54
55}
56
57//____________________________________________________________________________
58void AliEMCALv0::BuildGeometry()
59{
60
91e9918b 61 const Int_t kColorEmcal = kGreen ;
62 const Int_t kColorArm1 = kBlue ;
63 const Int_t kColorArm2 = kBlue ;
2012850d 64 const Int_t kColorArm1Active = kRed ;
65 const Int_t kColorArm2Active = kRed ;
66
91e9918b 67 // make the container of entire calorimeter
68
152bf70f 69 new TTUBS("EMCAL", "Tubs that contains the calorimeter", "void",
91e9918b 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
2012850d 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
e13bd4f0 84 fGeom->GetArm1PhiMax() // maximun phi angle
2012850d 85 ) ;
86 // Active material of Arm1
87
88 new TTUBS("Arm1", "Active material of arm 1", "void",
e13bd4f0 89 fGeom->GetEnvelop(0) + fGeom->GetGap2Active(), // rmin
90 fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax
7e4107a9 91 fGeom->GetEnvelop(2)/2.0, // half length in Z
2012850d 92 fGeom->GetArm1PhiMin(), // minimun phi angle
e13bd4f0 93 fGeom->GetArm1PhiMax() // maximun phi angle
2012850d 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
e13bd4f0 102 fGeom->GetArm2PhiMax() // maximun phi angle
2012850d 103 ) ;
104
105 // Active material of Arm2
106
107 new TTUBS("Arm2", "Active material of arm 2", "void",
e13bd4f0 108 fGeom->GetEnvelop(0) + fGeom->GetGap2Active(), // rmin
109 fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + fGeom->GetLmat(),// rmax
7e4107a9 110 fGeom->GetEnvelop(2)/2.0, // half length in Z
2012850d 111 fGeom->GetArm2PhiMin(), // minimun phi angle
e13bd4f0 112 fGeom->GetArm2PhiMax() // maximun phi angle
2012850d 113 ) ;
114
115 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
116 top->cd();
117
91e9918b 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();
e13bd4f0 125 TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
2012850d 126 envelop1node->SetLineColor(kColorArm1) ;
127 fNodes->Add(envelop1node) ;
128
129 // Arm 2 inside alice
e13bd4f0 130 TNode * envelop2node = new TNode("Envelop2", "Arm2 Envelop", "Envelop2") ;
2012850d 131 envelop2node->SetLineColor(kColorArm2) ;
132 fNodes->Add(envelop2node) ;
133
134 // active material inside Arm 1
135 envelop1node->cd() ;
e13bd4f0 136 TNode * arm1node = new TNode("Arm1", "Arm1 with Mat", "Arm1") ;
2012850d 137 arm1node->SetLineColor(kColorArm1Active) ;
138 fNodes->Add(arm1node) ;
139
140 // active material inside Arm 2
141 envelop2node->cd() ;
e13bd4f0 142 TNode * arm2node = new TNode("Arm2", "Arm2 with Mat", "Arm2") ;
2012850d 143 arm2node->SetLineColor(kColorArm2Active) ;
144 fNodes->Add(arm2node) ;
145
146}
147
2012850d 148//____________________________________________________________________________
149void 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
91e9918b 164 // Create the EMCA volume that contains entirely EMCAL
2012850d 165
2012850d 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
91e9918b 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
2012850d 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
e13bd4f0 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
2012850d 186
e13bd4f0 187 // Create a tube sector that contains active material Arm 1 & 2
2012850d 188
e13bd4f0 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)
2012850d 195
2012850d 196 envelopA[3] = fGeom->GetArm2PhiMin() ; // minimun phi angle
197 envelopA[4] = fGeom->GetArm2PhiMax() ; // maximun phi angle
2012850d 198
2012850d 199 gMC->Gsvolu("XAR2", "TUBS ", idtmed[1601], envelopA, 5) ; // filled with active material (average)
200
e13bd4f0 201 Int_t idrotm = 1;
2012850d 202 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
203
91e9918b 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") ;
2012850d 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
91e9918b 214 gMC->Gspos("XEN2", 1, "EMCA", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
2012850d 215
216 // Position ARM2 into ENV2
217 gMC->Gspos("XAR2", 1, "XEN2", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
218
219}
220
221//____________________________________________________________________________
222void 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