]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSv0.cxx
ba8bc397347bbbb2ac043ab730f0473a3307b6e6
[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   AliMC* pMC = AliMC::GetMC();
40   
41   fIdSens=pMC->VolId("PXTL");
42 }
43
44 //___________________________________________
45 void AliPHOSv0::CreateGeometry()
46 {
47 // *** DEFINITION OF THE -0.25<y<0.25 TILTED GEOMETRY OF THE PHOS *** 
48 // ORIGIN    : NICK VAN EIJNDHOVEN 
49
50   AliMC* pMC = AliMC::GetMC();
51   
52     Float_t pphi;
53     Float_t r, dptcb[3], dpair[3], dphos[3], dpucp[3], dpasp[3], dpcpv[3];
54     Float_t dpxtl[3];
55     Float_t yo;
56     Int_t idrotm[99];
57     Float_t xp1, yp1, xp2, yp2;
58     
59     Int_t *idtmed = gAlice->Idtmed();
60
61 // --- Dimensions of PbWO4 crystal --- 
62       const Float_t XTL_X=2.2;
63       const Float_t XTL_Y=18.;
64       const Float_t XTL_Z=2.2;
65 // --- Tyvek wrapper thickness 
66       const Float_t PAP_THICK=0.01;
67 // --- CPV thickness --- 
68       const Float_t CPV_Y=0.5;
69 // --- Polystyrene Foam Outer Cover dimensions --- 
70       const Float_t FOC_X=214.6;
71       const Float_t FOC_Y=80.;
72       const Float_t FOC_Z=260.;
73 // --- Inner AIR volume dimensions --- 
74       const Float_t AIR_X=206.;
75       const Float_t AIR_Y=66.;
76       const Float_t AIR_Z=244.;
77 // --- Tyvek Crystal Block dimensions --- 
78       const Float_t TCB_X=198.;
79       const Float_t TCB_Y=25.;
80       const Float_t TCB_Z=234.;
81 // --- Upper Cooling Plate thickness --- 
82       const Float_t UCP_Y=0.06;
83 // --- Al Support Plate thickness --- 
84       const Float_t ASP_Y=10.;
85 //--- Distance from IP to Foam Outer Cover top plate (needs to be 447.) ---
86       const Float_t FOC_R=467.;
87 //--- Distance from IP to Crystal Block top Surface (needs to be 460.) ---
88       const Float_t CBS_R=480.;
89
90 // --- Dimensions of volumes --- 
91
92
93 // --- Define PHOS box volume, fill with Polystyrene foam --- 
94     dphos[0] = FOC_X/2.;
95     dphos[1] = FOC_Y/2.;
96     dphos[2] = FOC_Z/2.;
97     pMC->Gsvolu("PHOS", "BOX ", idtmed[703], dphos, 3);
98
99 // --- Define air-filled box, place inside PHOS --- 
100     dpair[0] = AIR_X/2.;
101     dpair[1] = AIR_Y/2.;
102     dpair[2] = AIR_Z/2.;
103     pMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3);
104     pMC->Gspos("PAIR", 1, "PHOS", 0., 0., 0., 0, "ONLY");
105
106 // --- Define Upper Cooling Panel --- 
107 // --- place it right behind upper foam plate --- 
108     dpucp[0] = TCB_X/2.;
109     dpucp[1] = UCP_Y/2.;
110     dpucp[2] = TCB_Z/2.;
111     pMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp, 3);
112     yo = (AIR_Y-UCP_Y)/2.;
113     pMC->Gspos("PUCP", 1, "PAIR", 0., yo, 0., 0, "ONLY");
114
115 // --- Define Crystal Block, fill with Tyvek, position inside PAIR --- 
116     dptcb[0] = TCB_X/2.;
117     dptcb[1] = TCB_Y/2.;
118     dptcb[2] = TCB_Z/2.;
119     pMC->Gsvolu("PTCB", "BOX ", idtmed[702], dptcb, 3);
120 // --- Divide PTCB in X and Z directions -- 
121     pMC->Gsdvn("PSEC", "PTCB", 11, 1);
122     pMC->Gsdvn("PMOD", "PSEC", 13, 3);
123     pMC->Gsdvn("PSTR", "PMOD", 8, 1);
124     pMC->Gsdvn("PCEL", "PSTR", 8, 3);
125     yo = (FOC_Y-TCB_Y)/2. -(CBS_R-FOC_R);
126     pMC->Gspos("PTCB", 1, "PAIR", 0., yo, 0., 0, "ONLY");
127
128 // --- Define PbWO4 crystal volume, place inside PCEL --- 
129     dpxtl[0] = XTL_X/2.;
130     dpxtl[1] = XTL_Y/2.;
131     dpxtl[2] = XTL_Z/2.;
132     pMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3);
133     yo = (TCB_Y-XTL_Y)/2. - PAP_THICK;
134     pMC->Gspos("PXTL", 1, "PCEL", 0., yo, 0., 0, "ONLY");
135
136 // --- Define Al Support Plate, position it inside PAIR --- 
137 // --- right beneath PTCB --- 
138     dpasp[0] = AIR_X/2.;
139     dpasp[1] = ASP_Y/2.;
140     dpasp[2] = AIR_Z/2.;
141     pMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3);
142     yo = (FOC_Y-ASP_Y)/2. - (CBS_R-FOC_R+TCB_Y);
143     pMC->Gspos("PASP", 1, "PAIR", 0., yo, 0., 0, "ONLY");
144
145 // --- Define CPV volume, DON'T PLACE IT YET --- 
146     dpcpv[0] = TCB_X/2.;
147     dpcpv[1] = CPV_Y/2.;
148     dpcpv[2] = TCB_Z/2.;
149     pMC->Gsvolu("PCPV", "BOX ", idtmed[700], dpcpv, 3);
150 // --- Divide in X and Z direction (same way as PTCB) --- 
151     pMC->Gsdvn("PCSE", "PCPV", 11, 1);
152     pMC->Gsdvn("PCMO", "PCSE", 13, 3);
153     pMC->Gsdvn("PCST", "PCMO", 8, 1);
154     pMC->Gsdvn("PCCE", "PCST", 8, 3);
155
156 // --- Position various PHOS units in ALICE setup --- 
157 // --- PHOS itself first --- 
158     r     = FOC_R+FOC_Y/2.;
159     pphi  = TMath::ATan(FOC_X/(2.*FOC_R));
160     xp1   = -r * TMath::Sin(pphi * 3.);
161     yp1   = -r * TMath::Cos(pphi * 3.);
162     xp2   = -r * TMath::Sin(pphi);
163     yp2   = -r * TMath::Cos(pphi);
164     pphi *= 180/kPI;
165     AliMatrix(idrotm[0], 90.,-3*pphi, 90., 90-3*pphi, 0., 0.);
166     AliMatrix(idrotm[1], 90.,  -pphi, 90., 90-pphi,   0., 0.);
167     AliMatrix(idrotm[2], 90.,   pphi, 90., 90+pphi,   0., 0.);
168     AliMatrix(idrotm[3], 90., 3*pphi, 90., 90+3*pphi, 0., 0.);
169     pMC->Gspos("PHOS", 1, "ALIC", xp1, yp1, 0., idrotm[0], "ONLY");
170     pMC->Gspos("PHOS", 2, "ALIC", xp2, yp2, 0., idrotm[1], "ONLY");
171     pMC->Gspos("PHOS", 3, "ALIC",-xp2, yp2, 0., idrotm[2], "ONLY");
172     pMC->Gspos("PHOS", 4, "ALIC",-xp1, yp1, 0., idrotm[3], "ONLY");
173
174 // --- Now position PCPV so that its plates are right on top of --- 
175 // --- corresponding PHOS supermodules (previously called cradles) --- 
176     r    = FOC_R-CPV_Y/2.;
177     pphi = TMath::ATan(FOC_X/(2.*FOC_R));
178     xp1  = -r * TMath::Sin(pphi * 3.);
179     yp1  = -r * TMath::Cos(pphi * 3.);
180     xp2  = -r * TMath::Sin(pphi);
181     yp2  = -r * TMath::Cos(pphi);
182     pMC->Gspos("PCPV", 1, "ALIC", xp1, yp1, 0., idrotm[0], "ONLY");
183     pMC->Gspos("PCPV", 2, "ALIC", xp2, yp2, 0., idrotm[1], "ONLY");
184     pMC->Gspos("PCPV", 3, "ALIC",-xp2, yp2, 0., idrotm[2], "ONLY");
185     pMC->Gspos("PCPV", 4, "ALIC",-xp1, yp1, 0., idrotm[3], "ONLY");
186
187 // --- Set modules seen without tree for drawings --- 
188     pMC->Gsatt("PMOD", "SEEN", -2);
189     pMC->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   AliMC* pMC = AliMC::GetMC();
199   
200     Int_t   ISXFLD = gAlice->Field()->Integ();
201     Float_t SXMGMX = gAlice->Field()->Max();
202     
203 // --- The PbWO4 crystals --- 
204     Float_t ax[3] = { 207.19,183.85,16. };
205     Float_t zx[3] = { 82.,74.,8. };
206     Float_t wx[3] = { 1.,1.,4. };
207     Float_t dx    = 8.28;
208 // --- The polysterene scintillator (CH) --- 
209     Float_t ap[2] = { 12.011,1.00794 };
210     Float_t zp[2] = { 6.,1. };
211     Float_t wp[2] = { 1.,1. };
212     Float_t dp    = 1.032;
213 // --- Tyvek (CnH2n) 
214     Float_t at[2] = { 12.011,1.00794 };
215     Float_t zt[2] = { 6.,1. };
216     Float_t wt[2] = { 1.,2. };
217     Float_t dt    = .331;
218 // --- Polystyrene foam --- 
219     Float_t af[2] = { 12.011,1.00794 };
220     Float_t zf[2] = { 6.,1. };
221     Float_t wf[2] = { 1.,1. };
222     Float_t df    = .3;
223
224     Int_t *idtmed = gAlice->Idtmed();
225     
226     AliMixture( 0, "PbWO4$",       ax, zx, dx, -3, wx);
227     AliMixture( 1, "Polystyrene$", ap, zp, dp, -2, wp);
228     AliMaterial(2, "Al$",          26.98, 13., 2.7, 8.9, 999.);
229 // ---                                Absorption length^ is ignored --- 
230     AliMixture( 3, "Tyvek$", at, zt, dt, -2, wt);
231     AliMixture( 4, "Foam$",  af, zf, df, -2, wf);
232     AliMaterial(9, "Air$", 14.61, 7.3, .001205, 30420., 67500);
233
234     AliMedium(700, "PHOS Xtal    $", 0, 1, ISXFLD, SXMGMX, 10., .1, .1, .1, .1);
235     AliMedium(701, "CPV scint.   $", 1, 1, ISXFLD, SXMGMX, 10., .1, .1, .1, .1);
236     AliMedium(702, "Al parts     $", 2, 0, ISXFLD, SXMGMX, 10., .1, .1, .001, .001);
237     AliMedium(703, "Tyvek wrapper$", 3, 0, ISXFLD, SXMGMX, 10., .1, .1, .001, .001);
238     AliMedium(704, "Polyst. foam $", 4, 0, ISXFLD, SXMGMX, 10., .1, .1, .1, .1);
239     AliMedium(799, "Air          $", 9, 0, ISXFLD, SXMGMX, 10., 1., .1, .1, 10.);
240
241 // --- Generate explicitly delta rays in aluminium parts --- 
242     pMC->Gstpar(idtmed[701], "LOSS", 3.);
243     pMC->Gstpar(idtmed[701], "DRAY", 1.);
244 }
245
246 void AliPHOSv0::StepManager()
247 {
248
249   AliMC* pMC = AliMC::GetMC();
250   
251   TClonesArray &lhits = *fHits;
252   Int_t copy, i;
253   Int_t vol[5];
254   Float_t hits[4];
255   if(pMC->CurrentVol(0,copy) == fIdSens) {
256     //
257     //We are in the sensitive volume
258     for(i=0;i<4;i++) {
259       pMC->CurrentVolOff(i+1,0,copy);
260       vol[4-i]=copy;
261     }
262     pMC->CurrentVolOff(7,0,copy);
263     vol[0]=copy;
264     pMC->TrackPosition(hits);
265     hits[3]=pMC->Edep();
266     new(lhits[fNhits++]) AliPHOShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
267   }
268 }