]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSv0.cxx
0c2e8627942a867f38e8806001ffcf8ca317db7c
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
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$
18 Revision 1.9  1999/11/08 07:12:31  fca
19 Minor corrections thanks to I.Hrivnacova
20
21 Revision 1.8  1999/09/29 09:24:23  fca
22 Introduction of the Copyright and cvs Log
23
24 */
25
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"
41 #include "AliMC.h" 
42
43 ClassImp(AliPHOSv0)
44
45 //______________________________________________________________________________
46
47
48 AliPHOSv0::AliPHOSv0()
49 {
50   fIdSens=0;
51 }
52  
53 //______________________________________________________________________________
54
55 AliPHOSv0::AliPHOSv0(const char *name, const char *title)
56           : AliPHOS(name, title)
57 {
58   fIdSens=0;
59 }
60  
61 //___________________________________________
62 void AliPHOSv0::Init()
63 {
64   fIdSens=gMC->VolId("PXTL");
65 }
66
67 //___________________________________________
68 void AliPHOSv0::CreateGeometry()
69 {
70 // *** DEFINITION OF THE -0.25<y<0.25 TILTED GEOMETRY OF THE PHOS *** 
71 // ORIGIN    : NICK VAN EIJNDHOVEN 
72
73     Float_t pphi;
74     Float_t r, dptcb[3], dpair[3], dphos[3], dpucp[3], dpasp[3];
75     Float_t dpxtl[3];
76     Float_t yo;
77     Int_t idrotm[99];
78     Float_t xp1, yp1, xp2, yp2;
79     
80     Int_t *idtmed = fIdtmed->GetArray()-699;
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;
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.;
116     gMC->Gsvolu("PHOS", "BOX ", idtmed[703], dphos, 3);
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.;
122     gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3);
123     gMC->Gspos("PAIR", 1, "PHOS", 0., 0., 0., 0, "ONLY");
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.;
130     gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp, 3);
131     yo = (AIR_Y-UCP_Y)/2.;
132     gMC->Gspos("PUCP", 1, "PAIR", 0., yo, 0., 0, "ONLY");
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.;
138     gMC->Gsvolu("PTCB", "BOX ", idtmed[702], dptcb, 3);
139 // --- Divide PTCB in X and Z directions -- 
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);
144     yo = (FOC_Y-TCB_Y)/2. -(CBS_R-FOC_R);
145     gMC->Gspos("PTCB", 1, "PAIR", 0., yo, 0., 0, "ONLY");
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.;
151     gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3);
152     yo = (TCB_Y-XTL_Y)/2. - PAP_THICK;
153     gMC->Gspos("PXTL", 1, "PCEL", 0., yo, 0., 0, "ONLY");
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.;
160     gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3);
161     yo = (FOC_Y-ASP_Y)/2. - (CBS_R-FOC_R+TCB_Y);
162     gMC->Gspos("PASP", 1, "PAIR", 0., yo, 0., 0, "ONLY");
163
164 // --- Divide in X and Z direction (same way as PTCB) --- 
165     //    gMC->Gsdvn("PCMO", "PCSE", 13, 3);
166     //    gMC->Gsdvn("PCST", "PCMO", 8, 1);
167     //    gMC->Gsdvn("PCCE", "PCST", 8, 3);
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);
177     pphi *= 180/kPI;
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.);
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");
186
187 // --- Set modules seen without tree for drawings --- 
188     gMC->Gsatt("PMOD", "SEEN", -2);
189     gMC->Gsatt("PCMO", "SEEN", -2);
190 }
191  
192 //___________________________________________
193 void AliPHOSv0::CreateMaterials()
194 {
195 // *** DEFINITION OF AVAILABLE PHOS MATERIALS *** 
196 // ORIGIN    : NICK VAN EIJNDHOVEN 
197
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
222     Int_t *idtmed = fIdtmed->GetArray()-699;
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
232     AliMedium(0, "PHOS Xtal    $", 0, 1, ISXFLD, SXMGMX, 10., .1, .1, .1, .1);
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.);
237
238 // --- Generate explicitly delta rays in aluminium parts --- 
239     gMC->Gstpar(idtmed[701], "LOSS", 3.);
240     gMC->Gstpar(idtmed[701], "DRAY", 1.);
241 }
242
243 void AliPHOSv0::StepManager()
244 {
245
246   TClonesArray &lhits = *fHits;
247   TLorentzVector p;
248   Int_t copy, i;
249   Int_t vol[5];
250   Float_t hits[4];
251   if(gMC->CurrentVolID(copy) == fIdSens) {
252     //
253     //We are in the sensitive volume
254     for(i=0;i<4;i++) {
255       gMC->CurrentVolOffID(i+1,copy);
256       vol[4-i]=copy;
257     }
258     gMC->CurrentVolOffID(7,copy);
259     vol[0]=copy;
260     gMC->TrackPosition(p);
261     for(i=0;i<3;++i) hits[i]=p[i];
262     hits[3]=gMC->Edep();
263     new(lhits[fNhits++]) AliPHOShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
264   }
265 }