AliTOFv2FHoles allowed
[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)
b13bbe81 24//*-- and : Sahal Yacoob (LBL / UCT)
2012850d 25
26// --- ROOT system ---
b13bbe81 27#include "TPGON.h"
2012850d 28#include "TTUBS.h"
29#include "TNode.h"
30#include "TRandom.h"
31#include "TGeometry.h"
32
33
34// --- Standard library ---
35
b13bbe81 36#include <stdio.h>
37#include <string.h>
38#include <stdlib.h>
39#include <strstream.h>
40#include <iostream.h>
2012850d 41
42// --- AliRoot header files ---
43
44#include "AliEMCALv0.h"
45#include "AliEMCALGeometry.h"
b13bbe81 46#include "AliConst.h"
2012850d 47#include "AliRun.h"
48#include "AliMC.h"
49
50ClassImp(AliEMCALv0)
51
b13bbe81 52//______________________________________________________________________
2012850d 53AliEMCALv0::AliEMCALv0(const char *name, const char *title):
b13bbe81 54 AliEMCAL(name,title){
55 // Standard Constructor
2012850d 56
b13bbe81 57 if (strcmp(GetTitle(),"") != 0 )
58 fGeom = AliEMCALGeometry::GetInstance(GetTitle(), "") ;
2012850d 59}
b13bbe81 60//______________________________________________________________________
61void AliEMCALv0::BuildGeometry(){
62 // Display Geometry for display.C
2012850d 63
b13bbe81 64 const Int_t kColorArm1 = kBlue ;
91e9918b 65
b13bbe81 66 // make the container of Arm1
2012850d 67
b13bbe81 68 new TTUBS("Envelop1", "Tubs that contains arm 1", "void",
69 fGeom->GetEnvelop(0), // rmin
70 fGeom->GetEnvelop(1) +30 , // 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 // Arm 1 inside alice
76 TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
77 envelop1node->SetLineColor(kColorArm1) ;
78 fNodes->Add(envelop1node) ;
2012850d 79}
b13bbe81 80//______________________________________________________________________
81void AliEMCALv0::CreateGeometry(){
82 // Create the EMCAL geometry for Geant
2012850d 83
b13bbe81 84 AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
2012850d 85
b13bbe81 86 if ( emcaltmp == NULL ) {
87 Warning("CreateGeometry","detector not found!");
88 return;
89 } // end if
90 // Get pointer to the array containing media indices
91 Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
e13bd4f0 92
b13bbe81 93 // Create tube sectors that contains Arm 1 & 2
2012850d 94
b13bbe81 95 Float_t envelopA[5] ;
96 envelopA[0] = fGeom->GetEnvelop(0) ; // rmin
97 envelopA[1] = fGeom->GetEnvelop(1) + 30 ; // rmax
98 envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ; // dz
99 envelopA[3] = fGeom->GetArm1PhiMin() ; // minimun phi angle
100 envelopA[4] = fGeom->GetArm1PhiMax() ; // maximun phi angle
101
102 gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
103
104 // Create a tube sector that contains active material Arm 1 & 2
105
106 Float_t envelopB[10];
107 Float_t envelopC[10];
108 Float_t envelopD[10];
109 envelopC[0] = envelopD[0] = envelopB[0] = fGeom->GetArm1PhiMin();
110 envelopC[1] = envelopD[1] = envelopB[1] = fGeom->GetArm1PhiMax() -
111 fGeom->GetArm1PhiMin();
112 envelopC[2] = envelopD[2] = envelopB[2] = fGeom->GetNPhi() ;
113 envelopD[3] = 2;
114 envelopC[3] = 2;
115 envelopB[3] = 2;
116
117 envelopB[4] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active() + 1.59) /
118 (tan(2*atan(exp(-0.7)))) ;
119 envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin
120 envelopD[6] = envelopB[6] = envelopB[5] + 3.18; //rmax
121 envelopB[7] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active()+ 1.59) /
122 (tan(2*atan(exp(0.7)))) ;
123 envelopB[8] = envelopB[5] ;
124 envelopB[9] = envelopB[6] ;
125
126 // filled with active material (average)
127 gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
128 // filled with active material (Polystyrene)
129 gMC->Gsvolu("XPST", "PGON", idtmed[1601], 0, 0) ;
130 gMC->Gsvolu("XPBX", "PGON", idtmed[1600], 0, 0) ; // filled with Lead
131 gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2) ; // Naming Phi divisions
132
133 Int_t idrotm = 1;
134 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
135
136 // Position ENV1 container in ALIC
137 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
138 // Position ARM1 into ENV1
139 gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "MANY") ;
140
141 for (int i = 0; i < (fGeom->GetNLayers()); i++ ){
142 envelopC[5] = envelopD[6] ; //rmin
143 envelopC[6] = envelopD[6] + ((i > +2) ? 0.5 : 0.6) ; //rmax
144 envelopC[8] = envelopD[6] ; //rmin
145 envelopC[9] = envelopD[6] + ((i > 2 ) ? 0.5 : 0.6) ; //rmax
146 for (int j =0; j < (fGeom->GetNZ()) ; j++){
147 envelopC[4] = envelopD[6]/tan(2*atan(exp(0.7-(j*1.4/
148 (fGeom->GetNZ())))));
149 envelopC[7] = envelopD[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
150 (fGeom->GetNZ())))));
151 gMC->Gsposp("XPST",1+j+i*(fGeom->GetNZ()), "XEN1",
152 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10);
153 } // end for j
154 if (i < (fGeom->GetNLayers()-1)){
155 envelopD[5] = envelopC[6] ; //rmin
156 envelopD[6] = envelopC[6] + 0.5; //rmax
157 envelopD[8] = envelopC[6] ; //rmin
158 envelopD[9] = envelopC[6] + 0.5; //rmax
159 for (int j =0; j < (fGeom->GetNZ()) ; j++){
160 envelopD[4] = envelopC[6]/tan(2*atan(exp(0.7-(j*1.4/
161 (fGeom->GetNZ())))));
162 envelopD[7] = envelopC[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
163 (fGeom->GetNZ())))));
164 gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNZ()), "XEN1",
165 0.0, 0.0, 0.0 , idrotm, "MANY", envelopD, 10) ;
166 } // end for j
167 } // end if i
168 } // for i
2012850d 169}
b13bbe81 170//______________________________________________________________________
171void AliEMCALv0::Init(void){
172 // Just prints an information message
173 Int_t i;
174
175 cout << endl;
176 for(i=0;i<35;i++) cout <<"*";
177 cout << " EMCAL_INIT ";
178 for(i=0;i<35;i++) cout << "*";
179 cout << endl;
180
181 // Here the EMCAL initialisation code (if any!)
182
183 if (fGeom!=0)
184 cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
185 << fGeom->GetName() << endl ;
186 else
187 cout << "AliEMCAL" << Version() <<
188 " : EMCAL geometry initialization failed !" << endl ;
189 for(i=0;i<80;i++) printf("*");
190 cout << endl;
2012850d 191}