This update is a step in the continuous development of EMCAL.
[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
ffa6d63b 22// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
2012850d 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(), "") ;
61e0abb5 59
2012850d 60}
b13bbe81 61//______________________________________________________________________
62void AliEMCALv0::BuildGeometry(){
63 // Display Geometry for display.C
2012850d 64
b13bbe81 65 const Int_t kColorArm1 = kBlue ;
91e9918b 66
ffa6d63b 67 // Difine the shape of the Calorimeter
2012850d 68
b13bbe81 69 new TTUBS("Envelop1", "Tubs that contains arm 1", "void",
70 fGeom->GetEnvelop(0), // rmin
71 fGeom->GetEnvelop(1) +30 , // rmax
72 fGeom->GetEnvelop(2)/2.0, // half length in Z
73 fGeom->GetArm1PhiMin(), // minimun phi angle
74 fGeom->GetArm1PhiMax() // maximun phi angle
75 );
ffa6d63b 76 // Place the Node
b13bbe81 77 TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1") ;
78 envelop1node->SetLineColor(kColorArm1) ;
79 fNodes->Add(envelop1node) ;
2012850d 80}
b13bbe81 81//______________________________________________________________________
82void AliEMCALv0::CreateGeometry(){
83 // Create the EMCAL geometry for Geant
2012850d 84
b13bbe81 85 AliEMCALv0 *emcaltmp = (AliEMCALv0*)gAlice->GetModule("EMCAL") ;
2012850d 86
b13bbe81 87 if ( emcaltmp == NULL ) {
88 Warning("CreateGeometry","detector not found!");
89 return;
90 } // end if
91 // Get pointer to the array containing media indices
92 Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
e13bd4f0 93
ffa6d63b 94 // Create an Envelope within which to place the Detector
2012850d 95
b13bbe81 96 Float_t envelopA[5] ;
97 envelopA[0] = fGeom->GetEnvelop(0) ; // rmin
98 envelopA[1] = fGeom->GetEnvelop(1) + 30 ; // rmax
99 envelopA[2] = fGeom->GetEnvelop(2) / 2.0 ; // dz
100 envelopA[3] = fGeom->GetArm1PhiMin() ; // minimun phi angle
101 envelopA[4] = fGeom->GetArm1PhiMax() ; // maximun phi angle
102
103 gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
104
ffa6d63b 105 // Create the shapes of active material (LEAD/Aluminium/Scintillator) to be placed
b13bbe81 106
ffa6d63b 107 Float_t envelopB[10]; // First Layer of Aluminium
108 Float_t envelopC[10]; // Scintillator Layers
109 Float_t envelopD[10]; // Lead Layers
110
111 envelopC[0] = envelopD[0] = envelopB[0] = fGeom->GetArm1PhiMin(); //starting position in Phi
112 envelopC[1] = envelopD[1] = envelopB[1] = fGeom->GetArm1PhiMax() - // Angular size of the Detector in Phi
b13bbe81 113 fGeom->GetArm1PhiMin();
ffa6d63b 114 envelopC[2] = envelopD[2] = envelopB[2] = fGeom->GetNPhi() ; // Number of Section in Phi
115 envelopD[3] = envelopC[3] = envelopB[3] = 2; // each section will be passed 2 z coordinates
b13bbe81 116
61e0abb5 117 envelopB[4] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active()) /
ffa6d63b 118 (tan(2*atan(exp(0.7)))) ; // z co-ordinate 1
119 envelopB[5] = fGeom->GetEnvelop(0) + fGeom->GetGap2Active(); //rmin at z1
120 envelopD[6] = envelopB[6] = envelopB[5] + 3.18; //rmax at z1
61e0abb5 121 envelopB[7] = (fGeom->GetEnvelop(0) + fGeom->GetGap2Active()) /
ffa6d63b 122 (tan(2*atan(exp(-0.7)))) ; // z co-ordinate 2
123 envelopB[8] = envelopB[5] ; //
124 envelopB[9] = envelopB[6] ; // radii are the same.
125
126 // filled shapes wit hactive material
127 gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10); // Define Aluminium volume completely
128 gMC->Gsvolu("XPST", "PGON", idtmed[1601], 0, 0) ; // The polystyrene layers will be defined when placed
129 gMC->Gsvolu("XPBX", "PGON", idtmed[1600], 0, 0) ; // as will the lead layers
130 gMC->Gsdvn("XPHI", "XPST", fGeom->GetNPhi(), 2) ; // Dividind eta polystyrene divisions into phi segments.
61e0abb5 131
b13bbe81 132 Int_t idrotm = 1;
133 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
134
ffa6d63b 135 // Position the Envelope in Alice
61e0abb5 136 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "MANY") ;
ffa6d63b 137 // Position Aluminium Layer in the Envelope
61e0abb5 138 gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
b13bbe81 139
ffa6d63b 140// The loop below places the scintillator in Lead Layers alternately.
141
b13bbe81 142 for (int i = 0; i < (fGeom->GetNLayers()); i++ ){
143 envelopC[5] = envelopD[6] ; //rmin
ffa6d63b 144 envelopC[6] = envelopD[6] + ((i > +2) ? 0.5 : 0.6) ; //rmax larger for first two layers (preshower)
b13bbe81 145 envelopC[8] = envelopD[6] ; //rmin
ffa6d63b 146 envelopC[9] = envelopD[6] + ((i > 2 ) ? 0.5 : 0.6) ; //rmax larger for first two layers (preshower)
b13bbe81 147 for (int j =0; j < (fGeom->GetNZ()) ; j++){
148 envelopC[4] = envelopD[6]/tan(2*atan(exp(0.7-(j*1.4/
ffa6d63b 149 (fGeom->GetNZ()))))); //z begin
b13bbe81 150 envelopC[7] = envelopD[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
ffa6d63b 151 (fGeom->GetNZ()))))); // z end
152 gMC->Gsposp("XPST",1+j+i*(fGeom->GetNZ()), "XEN1",
153 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
b13bbe81 154 } // end for j
155 if (i < (fGeom->GetNLayers()-1)){
156 envelopD[5] = envelopC[6] ; //rmin
157 envelopD[6] = envelopC[6] + 0.5; //rmax
158 envelopD[8] = envelopC[6] ; //rmin
159 envelopD[9] = envelopC[6] + 0.5; //rmax
160 for (int j =0; j < (fGeom->GetNZ()) ; j++){
161 envelopD[4] = envelopC[6]/tan(2*atan(exp(0.7-(j*1.4/
ffa6d63b 162 (fGeom->GetNZ()))))); // z begin
b13bbe81 163 envelopD[7] = envelopC[6]/tan(2*atan(exp(0.7-((j+1)*1.4/
ffa6d63b 164 (fGeom->GetNZ()))))); // z end
b13bbe81 165 gMC->Gsposp("XPBX",1+ j+i*(fGeom->GetNZ()), "XEN1",
ffa6d63b 166 0.0, 0.0, 0.0 , idrotm, "MANY", envelopD, 10) ; // Position and Define Layer
b13bbe81 167 } // end for j
168 } // end if i
61e0abb5 169 } // for i
2012850d 170}
b13bbe81 171//______________________________________________________________________
172void AliEMCALv0::Init(void){
173 // Just prints an information message
174 Int_t i;
175
176 cout << endl;
177 for(i=0;i<35;i++) cout <<"*";
178 cout << " EMCAL_INIT ";
179 for(i=0;i<35;i++) cout << "*";
180 cout << endl;
181
182 // Here the EMCAL initialisation code (if any!)
183
184 if (fGeom!=0)
185 cout << "AliEMCAL" << Version() << " : EMCAL geometry intialized for "
186 << fGeom->GetName() << endl ;
187 else
188 cout << "AliEMCAL" << Version() <<
189 " : EMCAL geometry initialization failed !" << endl ;
190 for(i=0;i<80;i++) printf("*");
191 cout << endl;
2012850d 192}