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