Put the checks on the version in the creator before the geometry is built
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
CommitLineData
4c039060 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/*
17$Log$
f45c4ddb 18Revision 1.8 1999/09/29 09:24:23 fca
19Introduction of the Copyright and cvs Log
20
4c039060 21*/
22
fe4da5cc 23/////////////////////////////////////////////////////////
24// Manager and hits classes for set:PHOS version 0 //
25/////////////////////////////////////////////////////////
26
27// --- ROOT system ---
28#include "TH1.h"
29#include "TRandom.h"
30#include "TFile.h"
31#include "TTree.h"
32#include "TBRIK.h"
33#include "TNode.h"
34
35// --- galice header files ---
36#include "AliPHOSv0.h"
37#include "AliRun.h"
fe4da5cc 38#include "AliMC.h"
39
40ClassImp(AliPHOSv0)
41
42//______________________________________________________________________________
43
44
8c933dd7 45AliPHOSv0::AliPHOSv0()
fe4da5cc 46{
47 fIdSens=0;
48}
49
50//______________________________________________________________________________
51
52AliPHOSv0::AliPHOSv0(const char *name, const char *title)
53 : AliPHOS(name, title)
54{
55 fIdSens=0;
56}
57
58//___________________________________________
59void AliPHOSv0::Init()
60{
cfce8870 61 fIdSens=gMC->VolId("PXTL");
fe4da5cc 62}
63
64//___________________________________________
65void AliPHOSv0::CreateGeometry()
66{
67// *** DEFINITION OF THE -0.25<y<0.25 TILTED GEOMETRY OF THE PHOS ***
68// ORIGIN : NICK VAN EIJNDHOVEN
69
fe4da5cc 70 Float_t pphi;
7f8f914c 71 Float_t r, dptcb[3], dpair[3], dphos[3], dpucp[3], dpasp[3];
fe4da5cc 72 Float_t dpxtl[3];
73 Float_t yo;
74 Int_t idrotm[99];
75 Float_t xp1, yp1, xp2, yp2;
76
ad51aeb0 77 Int_t *idtmed = fIdtmed->GetArray()-699;
fe4da5cc 78
79// --- Dimensions of PbWO4 crystal ---
80 const Float_t XTL_X=2.2;
81 const Float_t XTL_Y=18.;
82 const Float_t XTL_Z=2.2;
83// --- Tyvek wrapper thickness
84 const Float_t PAP_THICK=0.01;
fe4da5cc 85// --- Polystyrene Foam Outer Cover dimensions ---
86 const Float_t FOC_X=214.6;
87 const Float_t FOC_Y=80.;
88 const Float_t FOC_Z=260.;
89// --- Inner AIR volume dimensions ---
90 const Float_t AIR_X=206.;
91 const Float_t AIR_Y=66.;
92 const Float_t AIR_Z=244.;
93// --- Tyvek Crystal Block dimensions ---
94 const Float_t TCB_X=198.;
95 const Float_t TCB_Y=25.;
96 const Float_t TCB_Z=234.;
97// --- Upper Cooling Plate thickness ---
98 const Float_t UCP_Y=0.06;
99// --- Al Support Plate thickness ---
100 const Float_t ASP_Y=10.;
101//--- Distance from IP to Foam Outer Cover top plate (needs to be 447.) ---
102 const Float_t FOC_R=467.;
103//--- Distance from IP to Crystal Block top Surface (needs to be 460.) ---
104 const Float_t CBS_R=480.;
105
106// --- Dimensions of volumes ---
107
108
109// --- Define PHOS box volume, fill with Polystyrene foam ---
110 dphos[0] = FOC_X/2.;
111 dphos[1] = FOC_Y/2.;
112 dphos[2] = FOC_Z/2.;
cfce8870 113 gMC->Gsvolu("PHOS", "BOX ", idtmed[703], dphos, 3);
fe4da5cc 114
115// --- Define air-filled box, place inside PHOS ---
116 dpair[0] = AIR_X/2.;
117 dpair[1] = AIR_Y/2.;
118 dpair[2] = AIR_Z/2.;
cfce8870 119 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3);
120 gMC->Gspos("PAIR", 1, "PHOS", 0., 0., 0., 0, "ONLY");
fe4da5cc 121
122// --- Define Upper Cooling Panel ---
123// --- place it right behind upper foam plate ---
124 dpucp[0] = TCB_X/2.;
125 dpucp[1] = UCP_Y/2.;
126 dpucp[2] = TCB_Z/2.;
cfce8870 127 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp, 3);
fe4da5cc 128 yo = (AIR_Y-UCP_Y)/2.;
cfce8870 129 gMC->Gspos("PUCP", 1, "PAIR", 0., yo, 0., 0, "ONLY");
fe4da5cc 130
131// --- Define Crystal Block, fill with Tyvek, position inside PAIR ---
132 dptcb[0] = TCB_X/2.;
133 dptcb[1] = TCB_Y/2.;
134 dptcb[2] = TCB_Z/2.;
cfce8870 135 gMC->Gsvolu("PTCB", "BOX ", idtmed[702], dptcb, 3);
fe4da5cc 136// --- Divide PTCB in X and Z directions --
cfce8870 137 gMC->Gsdvn("PSEC", "PTCB", 11, 1);
138 gMC->Gsdvn("PMOD", "PSEC", 13, 3);
139 gMC->Gsdvn("PSTR", "PMOD", 8, 1);
140 gMC->Gsdvn("PCEL", "PSTR", 8, 3);
fe4da5cc 141 yo = (FOC_Y-TCB_Y)/2. -(CBS_R-FOC_R);
cfce8870 142 gMC->Gspos("PTCB", 1, "PAIR", 0., yo, 0., 0, "ONLY");
fe4da5cc 143
144// --- Define PbWO4 crystal volume, place inside PCEL ---
145 dpxtl[0] = XTL_X/2.;
146 dpxtl[1] = XTL_Y/2.;
147 dpxtl[2] = XTL_Z/2.;
cfce8870 148 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3);
fe4da5cc 149 yo = (TCB_Y-XTL_Y)/2. - PAP_THICK;
cfce8870 150 gMC->Gspos("PXTL", 1, "PCEL", 0., yo, 0., 0, "ONLY");
fe4da5cc 151
152// --- Define Al Support Plate, position it inside PAIR ---
153// --- right beneath PTCB ---
154 dpasp[0] = AIR_X/2.;
155 dpasp[1] = ASP_Y/2.;
156 dpasp[2] = AIR_Z/2.;
cfce8870 157 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3);
fe4da5cc 158 yo = (FOC_Y-ASP_Y)/2. - (CBS_R-FOC_R+TCB_Y);
cfce8870 159 gMC->Gspos("PASP", 1, "PAIR", 0., yo, 0., 0, "ONLY");
fe4da5cc 160
fe4da5cc 161// --- Divide in X and Z direction (same way as PTCB) ---
f45c4ddb 162 // gMC->Gsdvn("PCMO", "PCSE", 13, 3);
cfce8870 163 gMC->Gsdvn("PCST", "PCMO", 8, 1);
164 gMC->Gsdvn("PCCE", "PCST", 8, 3);
fe4da5cc 165
166// --- Position various PHOS units in ALICE setup ---
167// --- PHOS itself first ---
168 r = FOC_R+FOC_Y/2.;
169 pphi = TMath::ATan(FOC_X/(2.*FOC_R));
170 xp1 = -r * TMath::Sin(pphi * 3.);
171 yp1 = -r * TMath::Cos(pphi * 3.);
172 xp2 = -r * TMath::Sin(pphi);
173 yp2 = -r * TMath::Cos(pphi);
bc9ab547 174 pphi *= 180/kPI;
fe4da5cc 175 AliMatrix(idrotm[0], 90.,-3*pphi, 90., 90-3*pphi, 0., 0.);
176 AliMatrix(idrotm[1], 90., -pphi, 90., 90-pphi, 0., 0.);
177 AliMatrix(idrotm[2], 90., pphi, 90., 90+pphi, 0., 0.);
178 AliMatrix(idrotm[3], 90., 3*pphi, 90., 90+3*pphi, 0., 0.);
cfce8870 179 gMC->Gspos("PHOS", 1, "ALIC", xp1, yp1, 0., idrotm[0], "ONLY");
180 gMC->Gspos("PHOS", 2, "ALIC", xp2, yp2, 0., idrotm[1], "ONLY");
181 gMC->Gspos("PHOS", 3, "ALIC",-xp2, yp2, 0., idrotm[2], "ONLY");
182 gMC->Gspos("PHOS", 4, "ALIC",-xp1, yp1, 0., idrotm[3], "ONLY");
fe4da5cc 183
fe4da5cc 184// --- Set modules seen without tree for drawings ---
cfce8870 185 gMC->Gsatt("PMOD", "SEEN", -2);
186 gMC->Gsatt("PCMO", "SEEN", -2);
fe4da5cc 187}
188
189//___________________________________________
190void AliPHOSv0::CreateMaterials()
191{
192// *** DEFINITION OF AVAILABLE PHOS MATERIALS ***
193// ORIGIN : NICK VAN EIJNDHOVEN
194
fe4da5cc 195 Int_t ISXFLD = gAlice->Field()->Integ();
196 Float_t SXMGMX = gAlice->Field()->Max();
197
198// --- The PbWO4 crystals ---
199 Float_t ax[3] = { 207.19,183.85,16. };
200 Float_t zx[3] = { 82.,74.,8. };
201 Float_t wx[3] = { 1.,1.,4. };
202 Float_t dx = 8.28;
203// --- The polysterene scintillator (CH) ---
204 Float_t ap[2] = { 12.011,1.00794 };
205 Float_t zp[2] = { 6.,1. };
206 Float_t wp[2] = { 1.,1. };
207 Float_t dp = 1.032;
208// --- Tyvek (CnH2n)
209 Float_t at[2] = { 12.011,1.00794 };
210 Float_t zt[2] = { 6.,1. };
211 Float_t wt[2] = { 1.,2. };
212 Float_t dt = .331;
213// --- Polystyrene foam ---
214 Float_t af[2] = { 12.011,1.00794 };
215 Float_t zf[2] = { 6.,1. };
216 Float_t wf[2] = { 1.,1. };
217 Float_t df = .3;
218
ad51aeb0 219 Int_t *idtmed = fIdtmed->GetArray()-699;
fe4da5cc 220
221 AliMixture( 0, "PbWO4$", ax, zx, dx, -3, wx);
222 AliMixture( 1, "Polystyrene$", ap, zp, dp, -2, wp);
223 AliMaterial(2, "Al$", 26.98, 13., 2.7, 8.9, 999.);
224// --- Absorption length^ is ignored ---
225 AliMixture( 3, "Tyvek$", at, zt, dt, -2, wt);
226 AliMixture( 4, "Foam$", af, zf, df, -2, wf);
227 AliMaterial(9, "Air$", 14.61, 7.3, .001205, 30420., 67500);
228
ad51aeb0 229 AliMedium(0, "PHOS Xtal $", 0, 1, ISXFLD, SXMGMX, 10., .1, .1, .1, .1);
ad51aeb0 230 AliMedium(2, "Al parts $", 2, 0, ISXFLD, SXMGMX, 10., .1, .1, .001, .001);
231 AliMedium(3, "Tyvek wrapper$", 3, 0, ISXFLD, SXMGMX, 10., .1, .1, .001, .001);
232 AliMedium(4, "Polyst. foam $", 4, 0, ISXFLD, SXMGMX, 10., .1, .1, .1, .1);
233 AliMedium(99, "Air $", 9, 0, ISXFLD, SXMGMX, 10., 1., .1, .1, 10.);
fe4da5cc 234
235// --- Generate explicitly delta rays in aluminium parts ---
cfce8870 236 gMC->Gstpar(idtmed[701], "LOSS", 3.);
237 gMC->Gstpar(idtmed[701], "DRAY", 1.);
fe4da5cc 238}
239
240void AliPHOSv0::StepManager()
241{
242
fe4da5cc 243 TClonesArray &lhits = *fHits;
0a6d8768 244 TLorentzVector p;
fe4da5cc 245 Int_t copy, i;
246 Int_t vol[5];
247 Float_t hits[4];
0a6d8768 248 if(gMC->CurrentVolID(copy) == fIdSens) {
fe4da5cc 249 //
250 //We are in the sensitive volume
251 for(i=0;i<4;i++) {
0a6d8768 252 gMC->CurrentVolOffID(i+1,copy);
fe4da5cc 253 vol[4-i]=copy;
254 }
0a6d8768 255 gMC->CurrentVolOffID(7,copy);
fe4da5cc 256 vol[0]=copy;
0a6d8768 257 gMC->TrackPosition(p);
258 for(i=0;i<3;++i) hits[i]=p[i];
cfce8870 259 hits[3]=gMC->Edep();
fe4da5cc 260 new(lhits[fNhits++]) AliPHOShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
261 }
262}