]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFv5.cxx
238fec0f3cf2bfcf362f9aa0ba4bd0207c22e687
[u/mrichter/AliRoot.git] / TOF / AliTOFv5.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.1  1999/10/15 15:35:20  fca
19 New version for frame1099 with and without holes
20
21 */
22
23 ///////////////////////////////////////////////////////////////////////////////
24 //                                                                           //
25 //  Time Of Flight: design of C.Williams                FCA                  //
26 //  This class contains the functions for version 1 of the Time Of Flight    //
27 //  detector.                                                                //
28 //
29 //  VERSION WITH 5 MODULES AND FLAT PLATES 
30 //  
31 //   WITH HOLES FOR PHOS AND HMPID 
32 //   INSIDE A FULL COVERAGE SPACE FRAME
33 //
34 //
35 //   Authors:
36 //
37 //   Alessio Seganti
38 //   Domenico Vicinanza
39 //
40 //   University of Salerno - Italy
41 //
42 //
43 //Begin_Html
44 /*
45 <img src="picts/AliTOFv5Class.gif">
46 */
47 //End_Html
48 //                                                                           //
49 ///////////////////////////////////////////////////////////////////////////////
50
51 #include "AliTOFv5.h"
52 #include "AliRun.h"
53 #include "AliConst.h"
54  
55 ClassImp(AliTOFv5)
56  
57 //_____________________________________________________________________________
58 AliTOFv5::AliTOFv5()
59 {
60   //
61   // Default constructor
62   //
63 }
64  
65 //_____________________________________________________________________________
66 AliTOFv5::AliTOFv5(const char *name, const char *title)
67        : AliTOF(name,title)
68 {
69   //
70   // Standard constructor
71   //
72 }
73  
74 //_____________________________________________________________________________
75 void AliTOFv5::CreateGeometry()
76 {
77   //
78   // Create geometry for Time Of Flight version 0
79   //
80   //Begin_Html
81   /*
82     <img src="picts/AliTOFv5.gif">
83   */
84   //End_Html
85   //
86   // Creates common geometry
87   //
88   AliTOF::CreateGeometry();
89 }
90  
91 //_____________________________________________________________________________
92 void AliTOFv5::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
93                      Float_t zlen2, Float_t zlen3, Float_t ztof0)
94 {
95   //
96   // Definition of the Time Of Fligh Resistive Plate Chambers
97   // xFLT, yFLT, zFLT - sizes of TOF modules (large)
98   
99   Float_t  ycoor;
100   Float_t par[10];
101   Int_t idrotm[100];
102   
103   Float_t yFREON, xp, yp, zp;
104   
105   Int_t *idtmed = fIdtmed->GetArray()-499;
106
107
108   par[0] =  xtof / 2.;
109   par[1] =  ytof / 2.;
110   par[2] = zlen1 / 2.;
111   gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
112   par[2] = zlen2 / 2.;
113   gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
114   par[2] = zlen3 / 2.;
115   gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
116
117
118 // Position of modules
119   Float_t zcor1 = ztof0 - zlen1/2;
120   Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
121   Float_t zcor3 = 0.;
122
123    AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
124    AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
125    gMC->Gspos("FTO1", 1, "BTO1", 0,  zcor1, 0, idrotm[0], "ONLY");
126    gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
127    gMC->Gspos("FTO1", 1, "BTO2", 0,  zcor1, 0, idrotm[0], "ONLY");
128    gMC->Gspos("FTO1", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
129    gMC->Gspos("FTO1", 1, "BTO3", 0,  zcor1, 0, idrotm[0], "ONLY");
130    gMC->Gspos("FTO1", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
131
132    gMC->Gspos("FTO2", 1, "BTO1", 0,  zcor2, 0, idrotm[0], "ONLY");
133    gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
134    gMC->Gspos("FTO2", 1, "BTO2", 0,  zcor2, 0, idrotm[0], "ONLY");
135    gMC->Gspos("FTO2", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
136
137    gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3,  0, idrotm[0], "ONLY");
138
139 // Subtraction the distance to TOF module boundaries 
140
141   Float_t db = 7.;
142   Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
143
144
145   xFLT = xtof -(.5 +.5)*2;
146   yFLT = ytof;
147   zFLT1 = zlen1 - db;
148   zFLT2 = zlen2 - db;
149   zFLT3 = zlen3 - db;
150
151   
152 // fron gaps in MRPC chamber 
153   yFREON = .11; //cm
154
155 // Sizes of MRPC pads
156
157   xp = 3.0; 
158   yp = 12.3*0.05; // 5% X0 of glass 
159   zp = 3.0;
160
161 //  Subtraction of dead boundaries in X=2 cm and Z=7/2 cm 
162
163 cout <<"************************* TOF geometry **************************"<<endl;
164
165   Int_t nz1, nz2, nz3, nx; //- numbers of pixels
166   nx = Int_t (xFLT/xp);
167
168   printf("Number of pixel along x axis = %i",nx);
169
170   par[0] = xFLT/2;
171   par[1] = yFLT/2;
172   par[2] = (zFLT1 / 2.);
173   nz1 = Int_t (par[2]*2/zp);
174   gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
175   gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
176   printf("Number of pixel along z axis (module 1) = %i",nz1);
177
178   par[2] = (zFLT2 / 2.);
179   nz2 = Int_t (par[2]*2/zp);
180   gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
181   gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
182   printf("Number of pixel along z axis (module 2) = %i",nz2);
183
184   par[2] = (zFLT3 / 2.); 
185   nz3 = Int_t (par[2]*2/zp);
186   gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
187   gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
188   printf("Number of pixel along z axis (module 3) = %i",nz3);
189
190 ////////// Layers before detector ////////////////////
191
192 // Alluminium layer in front 1.0 mm thick at the beginning
193   par[0] = -1;
194   par[1] = 0.1;
195   par[2] = -1;
196   ycoor = -yFLT/2 + par[1];
197   gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
198   gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
199   gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
200   gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
201   gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium 
202   gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
203
204 // Honeycomb layer (1cm of special polyethilene)
205   ycoor = ycoor + par[1];
206   par[0] = -1;
207   par[1] = 1. / 2;
208   par[2] = -1;
209   ycoor = ycoor + par[1];
210   gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
211   gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
212   gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
213   gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
214   gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
215   gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
216
217 ///////////////// Detector itself //////////////////////
218
219   const Float_t SpaceBefore=2.;
220
221   par[0] = -1;
222   par[1] = yp/2; // 5 %X0 thick of glass  
223   par[2] = -1;
224   ycoor = -yFLT/2 + SpaceBefore;
225   gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
226   gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
227   gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
228   gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
229   gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
230   gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
231
232   gMC->Gsdvn("FLZ1", "FLD1", nz1, 3); //pixel size xp=zp=3
233   gMC->Gsdvn("FLZ2", "FLD2", nz2, 3); 
234   gMC->Gsdvn("FLZ3", "FLD3", nz3, 3); 
235   gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
236   gMC->Gsdvn("FLX2", "FLZ2", nx, 1); 
237   gMC->Gsdvn("FLX3", "FLZ3", nx, 1); 
238
239 // MRPC pixel itself 
240   par[0] = -1;//xp/2;
241   par[1] = -1;//yp/2; // 5 %X0 thick of glass  
242   par[2] = -1;//zp/2;
243   gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
244   gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
245   gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
246   gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
247
248 // Freon gas sencitive vol.ume
249   par[0] = -1;
250   par[1] = yFREON/2;
251   par[2] = -1;
252   gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);// Freon 
253   gMC->Gspos("FPAD", 0, "FPA0", 0., 0., 0., 0, "ONLY");
254
255 ////////// Layers after detector ////////////////////
256
257   const Float_t SpaceAfter=6.;
258
259 // Honeycomb layer after (3cm)
260   par[0] = -1;
261   par[1] = 0.6;
262   par[2] = -1;
263   ycoor = -yFLT/2 + SpaceAfter - par[1];
264   gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
265   gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
266   gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
267   gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
268   gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
269   gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
270
271 // Electronics (Cu) after
272   par[0] = -1;
273   par[1] = 1.43*0.05 / 2.; // 5% of X0
274   par[2] = -1;
275   ycoor = -yFLT/2 + SpaceAfter +par[1];
276   gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
277   gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
278   gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
279   gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
280   gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
281   gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
282
283 // Cooling water after
284   ycoor = ycoor+par[1];
285   par[0] = -1;
286   par[1] = 36.1*0.02 / 2.; // 2% of X0
287   par[2] = -1;
288   ycoor = ycoor+par[1];
289   gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
290   gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
291   gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
292   gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
293   gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
294   gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
295
296 //back plate honycomb (2cm)
297   par[0] = -1;
298   par[1] = 2 / 2.;
299   par[2] = -1;
300   ycoor = yFLT/2 - par[1];
301   gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
302   gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
303   gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
304   gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
305   gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
306   gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");}
307
308 //_____________________________________________________________________________
309 void AliTOFv5::DrawModule()
310 {
311   //
312   // Draw a shaded view of the Time Of Flight version 1
313   //
314   // Set everything unseen
315   gMC->Gsatt("*", "seen", -1);
316   // 
317   // Set ALIC mother transparent
318   gMC->Gsatt("ALIC","SEEN",0);
319   //
320   // Set the volumes visible
321   gMC->Gsatt("ALIC","SEEN",0);
322   gMC->Gsatt("FBAR","SEEN",1);
323   gMC->Gsatt("FTO1","SEEN",1);
324   gMC->Gsatt("FTO2","SEEN",1);
325   gMC->Gsatt("FTO3","SEEN",1);
326   gMC->Gsatt("FBT1","SEEN",1);
327   gMC->Gsatt("FBT2","SEEN",1);
328   gMC->Gsatt("FBT3","SEEN",1);
329   gMC->Gsatt("FDT1","SEEN",1);
330   gMC->Gsatt("FDT2","SEEN",1);
331   gMC->Gsatt("FDT3","SEEN",1);
332   gMC->Gsatt("FLT1","SEEN",1);
333   gMC->Gsatt("FLT2","SEEN",1);
334   gMC->Gsatt("FLT3","SEEN",1);
335   gMC->Gsatt("FPL1","SEEN",1);
336   gMC->Gsatt("FPL2","SEEN",1);
337   gMC->Gsatt("FPL3","SEEN",1);
338   gMC->Gsatt("FLD1","SEEN",1);
339   gMC->Gsatt("FLD2","SEEN",1);
340   gMC->Gsatt("FLD3","SEEN",1);
341   gMC->Gsatt("FLZ1","SEEN",1);
342   gMC->Gsatt("FLZ2","SEEN",1);
343   gMC->Gsatt("FLZ3","SEEN",1);
344   gMC->Gsatt("FLX1","SEEN",1);
345   gMC->Gsatt("FLX2","SEEN",1);
346   gMC->Gsatt("FLX3","SEEN",1);
347   gMC->Gsatt("FPA0","SEEN",1);
348   //
349   gMC->Gdopt("hide", "on");
350   gMC->Gdopt("shad", "on");
351   gMC->Gsatt("*", "fill", 7);
352   gMC->SetClipBox(".");
353   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
354   gMC->DefaultRange();
355   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
356   gMC->Gdhead(1111, "Time Of Flight");
357   gMC->Gdman(18, 4, "MAN");
358   gMC->Gdopt("hide","off");
359 }
360
361 //_____________________________________________________________________________
362 void AliTOFv5::CreateMaterials()
363 {
364   //
365   // Define materials for the Time Of Flight
366   //
367   AliTOF::CreateMaterials();
368 }
369  
370 //_____________________________________________________________________________
371 void AliTOFv5::Init()
372 {
373   //
374   // Initialise the detector after the geometry has been defined
375   //
376   AliTOF::Init();
377   fIdFTO2=gMC->VolId("FTO2");
378   fIdFTO3=gMC->VolId("FTO3");
379   fIdFLT1=gMC->VolId("FLT1");
380   fIdFLT2=gMC->VolId("FLT2");
381   fIdFLT3=gMC->VolId("FLT3");
382 }
383  
384 //_____________________________________________________________________________
385 void AliTOFv5::StepManager()
386 {
387   //
388   // Procedure called at each step in the Time Of Flight
389   //
390   TLorentzVector mom, pos;
391   Float_t hits[8];
392   Int_t vol[3];
393   Int_t copy, id, i;
394   Int_t *idtmed = fIdtmed->GetArray()-499;
395   if(gMC->GetMedium()==idtmed[514-1] && 
396      gMC->IsTrackEntering() && gMC->TrackCharge()
397      && gMC->CurrentVolID(copy)==fIdSens) {
398     TClonesArray &lhits = *fHits;
399     //
400     // Record only charged tracks at entrance
401     gMC->CurrentVolOffID(1,copy);
402     vol[2]=copy;
403     gMC->CurrentVolOffID(3,copy);
404     vol[1]=copy;
405     id=gMC->CurrentVolOffID(8,copy);
406     vol[0]=copy;
407     if(id==fIdFTO3) {
408       vol[0]+=22;
409       id=gMC->CurrentVolOffID(5,copy);
410       if(id==fIdFLT3) vol[1]+=6;
411     } else if (id==fIdFTO2) {
412       vol[0]+=20;
413       id=gMC->CurrentVolOffID(5,copy);
414       if(id==fIdFLT2) vol[1]+=8;
415     } else {
416       id=gMC->CurrentVolOffID(5,copy);
417       if(id==fIdFLT1) vol[1]+=14;
418     }
419     gMC->TrackPosition(pos);
420     gMC->TrackMomentum(mom);
421     //
422     Double_t ptot=mom.Rho();
423     Double_t norm=1/ptot;
424     for(i=0;i<3;++i) {
425       hits[i]=pos[i];
426       hits[i+3]=mom[i]*norm;
427     }
428     hits[6]=ptot;
429     hits[7]=pos[3];
430     new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
431   }
432 }
433