]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFv0.cxx
Introduction of the Copyright and cvs Log
[u/mrichter/AliRoot.git] / TOF / AliTOFv0.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 */
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //                                                                           //
22 //  Time Of Flight: as for version 1 but not sensitive                       //
23 //  This class contains the functions for version 0 of the Time Of Flight    //
24 //  detector.                                                                //
25 //                                                                           //
26 //Begin_Html
27 /*
28 <img src="picts/AliTOFv0Class.gif">
29 */
30 //End_Html
31 //                                                                           //
32 ///////////////////////////////////////////////////////////////////////////////
33
34 #include "AliTOFv0.h"
35 #include "AliRun.h"
36 #include "AliConst.h"
37  
38 ClassImp(AliTOFv0)
39  
40 //_____________________________________________________________________________
41 AliTOFv0::AliTOFv0()
42 {
43   //
44   // Default constructor
45   //
46 }
47  
48 //_____________________________________________________________________________
49 AliTOFv0::AliTOFv0(const char *name, const char *title)
50        : AliTOF(name,title)
51 {
52   //
53   // Standard constructor
54   //
55 }
56  
57 //_____________________________________________________________________________
58 void AliTOFv0::CreateGeometry()
59 {
60   //
61   // Create geometry for Time Of Flight version 0
62   //
63   //Begin_Html
64   /*
65     <img src="picts/AliTOFv0.gif">
66   */
67   //End_Html
68   //
69   //
70   // Create common geometry
71   //
72   AliTOF::CreateGeometry();
73 }
74  
75 //_____________________________________________________________________________
76 void AliTOFv0::TOFpc(Float_t xm, Float_t ym, Float_t zm0,
77                      Float_t zm1, Float_t zm2)
78 {
79   //
80   // Definition of the Time Of Fligh Resistive Plate Chambers
81   // xm, ym, zm - sizes of TOF modules (large)
82   
83   Float_t  ycoor;
84   Float_t zazor, xp, yp, zp;
85   Float_t par[10];
86   
87   Int_t *idtmed = fIdtmed->GetArray()-499;
88   
89   // gap in RPC chamber 
90   zazor = .03;
91   // Sizes of RPC chamber 
92   xp = 3.0; //small pixel
93 //xp = 3.9; //large pixel 
94   yp = 12.3*0.05; // 5% X0 of glass 
95   zp = 3.0; //small pixel
96 //zp = 4.1; //large pixel
97   // Large not sensitive volumes with CO2 
98   par[0] = xm/2;
99   par[1] = ym/2;
100   par[2] = zm0/2;
101   gMC->Gsvolu("FBT1", "BOX ", idtmed[506], par, 3); // CO2
102   gMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
103   gMC->Gsdvn("FDT1", "FBT1", 2, 3); // 2 large modules along Z
104   par[2] = zm1 / 2;
105   gMC->Gsvolu("FBT2", "BOX ", idtmed[506], par, 3); // CO2
106   gMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY");
107   gMC->Gsdvn("FDT2", "FBT2", 2, 3); // 2 (PHOS) modules along Z
108   par[2] = zm2 / 2;
109   gMC->Gsvolu("FBT3", "BOX ", idtmed[506], par, 3); // CO2
110   gMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY");
111   gMC->Gsdvn("FDT3", "FBT3", 1, 3); // 1 (RICH) module along Z
112   //
113   //  subtraction of dead boundaries in X=2 cm and Z=7/2 cm 
114   par[0] = par[0]-2.;
115   Int_t nz0, nz1, nz2, nx; //- numbers of pixels
116   nx = Int_t (par[0]*2/xp);
117   cout <<"************************* TOF geometry **************************"<<endl;
118   cout<< "nx = "<< nx << " x size = "<< par[0]*2/nx << endl;
119   par[1] = -1;
120   par[2] = (zm0 / 2.)/2.; //this is half size of module after division by 2
121   par[2]=par[2]-7/2.;
122   nz0 = Int_t (par[2]*2/zp);
123 cout<< "nz0 = "<< nz0 << " z0 size = "<< par[2]*2/nz0 << endl;
124   gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
125   gMC->Gspos("FLT1", 0, "FDT1", 0., 0., 0., 0, "ONLY");
126   par[2] = (zm1 / 2.)/2.; //this is half size of module after division by 2
127   par[2]=par[2]-7/2.;
128   nz1 = Int_t (par[2]*2/zp);
129 cout<< "nz1 = "<< nz1 << " z1 size = "<< par[2]*2/nz1 << endl;
130   gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
131   gMC->Gspos("FLT2", 0, "FDT2", 0., 0., 0., 0, "ONLY");
132   par[2] = (zm2 / 2.); //this is half size of module after division by 1
133   par[2]=par[2]-7/2.;
134   nz2 = Int_t (par[2]*2/zp);
135 cout<< "nz2 = "<< nz2 << " z2 size = "<< par[2]*2/nz2 << endl;
136   gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
137   gMC->Gspos("FLT3", 0, "FDT3", 0., 0., 0., 0, "ONLY");
138   //
139 ////////// Layers before detector ////////////////////
140 // Mylar layer in front 0.5mm thick at the beginning
141   par[0] = -1;
142   par[1] = 0.05 / 2;
143   par[2] = -1;
144   ycoor = -ym/2 + par[1];
145   gMC->Gsvolu("FMY1", "BOX ", idtmed[511], par, 3); // Mylar
146   gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
147   gMC->Gsvolu("FMY2", "BOX ", idtmed[511], par, 3); // Mylar
148   gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
149   gMC->Gsvolu("FMY3", "BOX ", idtmed[511], par, 3); // Mylar
150   gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
151 // Honeycomb layer (1cm of special!!! polyethilene)
152   ycoor = ycoor + par[1];
153   par[0] = -1;
154   par[1] = 1. / 2;
155   par[2] = -1;
156   ycoor = ycoor + par[1];
157   gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
158   gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
159   gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
160   gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
161   gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
162   gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
163   //
164 ///////////////// Detector itself //////////////////////
165   par[0] = -1;
166   par[1] = yp/2; // 5 %X0 thick of glass  
167   par[2] = -1;
168   ycoor = -ym/2 + 2;
169   gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
170   gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
171   gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
172   gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
173   gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
174   gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
175   //
176   gMC->Gsdvn("FLZ1", "FLD1", nz0, 3); //pixel size xp=zp=3
177   gMC->Gsdvn("FLZ2", "FLD2", nz1, 3); 
178   gMC->Gsdvn("FLZ3", "FLD3", nz2, 3); 
179   gMC->Gsdvn("FLX1", "FLZ1", nx, 1); 
180   gMC->Gsdvn("FLX2", "FLZ2", nx, 1); 
181   gMC->Gsdvn("FLX3", "FLZ3", nx, 1); 
182   // RPC pixel itself 
183   par[0] = -1;//xp/2;
184   par[1] = -1;//yp/2; // 5 %X0 thick of glass  
185   par[2] = -1;//zp/2;
186   gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
187   gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
188   gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
189   gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
190   // Freon gas sencitive volume
191   par[0] = -1;
192   par[1] = zazor/2;
193   par[2] = -1;
194   gMC->Gsvolu("FPG0", "BOX ", idtmed[513], par, 3);// Freon 
195   gMC->Gspos("FPG0", 0, "FPA0", 0., 0., 0., 0, "ONLY");
196   //
197 ////////// Layers after detector ////////////////////
198   // Honeycomb layer after (3cm)
199   par[0] = -1;
200   par[1] = 1.2 / 2.;
201   par[2] = -1;
202   ycoor = -ym/2 + 6. - par[1];
203   gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
204   gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
205   gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
206   gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
207   gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
208   gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
209   // Electronics (Cu) after
210   par[0] = -1;
211   par[1] = 1.43*0.05 / 2.; // 5% of X0
212   par[2] = -1;
213   ycoor = -ym/2 + 6.+par[1];
214   gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
215   gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
216   gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
217   gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
218   gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
219   gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
220  // Cooling water after
221   ycoor = ycoor+par[1];
222   par[0] = -1;
223   par[1] = 36.1*0.02 / 2.; // 2% of X0
224   par[2] = -1;
225   ycoor = ycoor+par[1];
226   gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
227   gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
228   gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
229   gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
230   gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
231   gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
232   //back plate honycomb (2cm)
233   par[0] = -1;
234   par[1] = 2 / 2.;
235   par[2] = -1;
236   ycoor = ym/2 - par[1];
237   gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
238   gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
239   gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
240   gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
241   gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
242   gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
243 }
244
245 //_____________________________________________________________________________
246 void AliTOFv0::DrawModule()
247 {
248   //
249   // Draw a shaded view of the Time Of Flight version 0
250   //
251   // Set everything unseen
252   gMC->Gsatt("*", "seen", -1);
253   // 
254   // Set ALIC mother transparent
255   gMC->Gsatt("ALIC","SEEN",0);
256   //
257   // Set the volumes visible
258   gMC->Gsatt("ALIC","SEEN",0);
259   gMC->Gsatt("FBAR","SEEN",1);
260   gMC->Gsatt("FTO1","SEEN",1);
261   gMC->Gsatt("FTO2","SEEN",1);
262   gMC->Gsatt("FTO3","SEEN",1);
263   gMC->Gsatt("FBT1","SEEN",1);
264   gMC->Gsatt("FBT2","SEEN",1);
265   gMC->Gsatt("FBT3","SEEN",1);
266   gMC->Gsatt("FDT1","SEEN",1);
267   gMC->Gsatt("FDT2","SEEN",1);
268   gMC->Gsatt("FDT3","SEEN",1);
269   gMC->Gsatt("FLT1","SEEN",1);
270   gMC->Gsatt("FLT2","SEEN",1);
271   gMC->Gsatt("FLT3","SEEN",1);
272   //
273   gMC->Gdopt("hide", "on");
274   gMC->Gdopt("shad", "on");
275   gMC->Gsatt("*", "fill", 7);
276   gMC->SetClipBox(".");
277   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
278   gMC->DefaultRange();
279   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
280   gMC->Gdhead(1111, "Time Of Flight");
281   gMC->Gdman(18, 4, "MAN");
282   gMC->Gdopt("hide","off");
283 }
284
285 //_____________________________________________________________________________
286 void AliTOFv0::CreateMaterials()
287 {
288   //
289   // Define materials for the Time Of Flight
290   //
291   AliTOF::CreateMaterials();
292 }
293  
294 //_____________________________________________________________________________
295 void AliTOFv0::Init()
296 {
297   //
298   // Initialise the detector after the geometry has been defined
299   //
300   AliTOF::Init();
301   fIdFTO2=gMC->VolId("FTO2");
302   fIdFTO3=gMC->VolId("FTO3");
303   fIdFLT1=gMC->VolId("FLT1");
304   fIdFLT2=gMC->VolId("FLT2");
305   fIdFLT3=gMC->VolId("FLT3");
306 }
307  
308 //_____________________________________________________________________________
309 void AliTOFv0::StepManager()
310 {
311   //
312   // Procedure called at each step in the Time Of Flight
313   //
314   TLorentzVector mom, pos;
315   Float_t hits[8];
316   Int_t vol[3];
317   Int_t copy, id, i;
318   Int_t *idtmed = fIdtmed->GetArray()-499;
319   if(gMC->GetMedium()==idtmed[514-1] && 
320      gMC->IsTrackEntering() && gMC->TrackCharge()
321      && gMC->CurrentVolID(copy)==fIdSens) {
322     TClonesArray &lhits = *fHits;
323     //
324     // Record only charged tracks at entrance
325     gMC->CurrentVolOffID(1,copy);
326     vol[2]=copy;
327     gMC->CurrentVolOffID(3,copy);
328     vol[1]=copy;
329     id=gMC->CurrentVolOffID(8,copy);
330     vol[0]=copy;
331     if(id==fIdFTO3) {
332       vol[0]+=22;
333       id=gMC->CurrentVolOffID(5,copy);
334       if(id==fIdFLT3) vol[1]+=6;
335     } else if (id==fIdFTO2) {
336       vol[0]+=20;
337       id=gMC->CurrentVolOffID(5,copy);
338       if(id==fIdFLT2) vol[1]+=8;
339     } else {
340       id=gMC->CurrentVolOffID(5,copy);
341       if(id==fIdFLT1) vol[1]+=14;
342     }
343     gMC->TrackPosition(pos);
344     gMC->TrackMomentum(mom);
345     //
346     Double_t ptot=mom.Rho();
347     Double_t norm=1/ptot;
348     for(i=0;i<3;++i) {
349       hits[i]=pos[i];
350       hits[i+3]=mom[i]*norm;
351     }
352     hits[6]=ptot;
353     hits[7]=pos[3];
354     new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
355   }
356 }