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