]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDv0.cxx
Some rationalisation of the documentation. In particular pictures are all now in...
[u/mrichter/AliRoot.git] / TRD / AliTRDv0.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Transition Radiation Detector version 0 -- coarse simulation             //
4 //                                                                           //
5 //Begin_Html
6 /*
7 <img src="picts/AliTRDv0Class.gif">
8 */
9 //End_Html
10 //                                                                           //
11 //                                                                           //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include <TMath.h>
15 #include <TRandom.h>
16 #include <TVector.h>
17
18 #include "AliTRDv0.h"
19 #include "AliRun.h"
20 #include "AliMC.h"
21 #include "AliConst.h"
22   
23 ClassImp(AliTRDv0)
24
25 //_____________________________________________________________________________
26 AliTRDv0::AliTRDv0(const char *name, const char *title) 
27          :AliTRD(name, title) 
28 {
29   //
30   // Standard constructor for Transition Radiation Detector version 0
31   //
32   fIdSens1 = fIdSens2 = fIdSens3 = 0;
33 }
34  
35 //_____________________________________________________________________________
36 void AliTRDv0::CreateGeometry()
37 {
38   //
39   // Create the GEANT geometry for the Transition Radiation Detector
40   // --- The coarse geometry of the TRD, that can be used for background 
41   //     studies. This version covers the full azimuth. 
42   // --- Author :  Christoph Blume (GSI) 17/5/99 
43   //
44   // --- Volume names : 
45   //     TRD       --> Mother TRD volume                                     (Al) 
46   //     UTRS      --> Sectors of the sub-detector                           (Al)
47   //     UTRI      --> Inner part of the detector frame                      (Air) 
48   //     UTCI(N,O) --> Frames of the inner, neighbouring and outer chambers  (C) 
49   //     UTII(N,O) --> Inner part of the chambers                            (Air) 
50   //     UTMI(N,O) --> Modules in the chambers                               (Air) 
51   //     UT0I(N,O) --> Radiator seal                                         (G10)
52   //     UT1I(N,O) --> Radiator                                              (CO2)
53   //     UT2I(N,O) --> Polyethylene of radiator                              (PE)
54   //     UT3I(N,O) --> Entrance window                                       (Mylar)
55   //     UT4I(N,O) --> Gas volume (sensitive)                                (Xe/Isobutane)
56   //     UT5I(N,O) --> Pad plane                                             (Cu)
57   //     UT6I(N,O) --> Support structure                                     (G10)
58   //     UT7I(N,O) --> FEE + signal lines                                    (Cu)
59   //     UT8I(N,O) --> Polyethylene of cooling device                        (PE)
60   //     UT9I(N,O) --> Cooling water                                         (Water)
61   //
62   //Begin_Html
63   /*
64     <img src="picts/AliTRDv0.gif">
65   */
66   //End_Html
67   //Begin_Html
68   /*
69     <img src="picts/AliTRDv0Tree.gif">
70   */
71   //End_Html
72
73   Float_t xpos, ypos, zpos, f;
74   Int_t   idmat[2];
75
76   const Int_t nparmo = 10;
77   const Int_t nparfr =  4;
78   const Int_t nparic =  4;
79   const Int_t nparnc =  4;
80   const Int_t nparoc = 11;
81
82   Float_t par_mo[nparmo];
83   Float_t par_fr[nparfr];
84   Float_t par_ic[nparic];
85   Float_t par_nc[nparnc];
86   Float_t par_oc[nparoc];
87
88   Int_t *idtmed = gAlice->Idtmed();
89   
90   AliMC* pMC = AliMC::GetMC();
91
92   //////////////////////////////////////////////////////////////////////////  
93   //     Definition of Volumes 
94   //////////////////////////////////////////////////////////////////////////  
95   
96   // Definition of the mother volume for the TRD (Al) 
97   par_mo[0] =   0.;
98   par_mo[1] = 360.;
99   par_mo[2] = nsect;
100   par_mo[3] = 2.;
101   par_mo[4] = -zmax1;
102   par_mo[5] = rmin;
103   par_mo[6] = rmax;
104   par_mo[7] =  zmax1;
105   par_mo[8] = rmin;
106   par_mo[9] = rmax;
107   pMC->Gsvolu("TRD ", "PGON", idtmed[1301-1], par_mo, nparmo);
108   pMC->Gsdvn("UTRS", "TRD ", nsect, 2);
109
110   // The minimal width of a sector in rphi-direction
111   Float_t widmi = rmin * TMath::Sin(kPI/nsect);
112   // The maximal width of a sector in rphi-direction
113   Float_t widma = rmax * TMath::Sin(kPI/nsect);
114   // The total thickness of the spaceframe (Al + Air)
115   Float_t frame = widmi - (widpl1 / 2);
116
117   // Definition of the inner part of the detector frame (Air) 
118   par_fr[0] = widmi - alframe / 2.;
119   par_fr[1] = widma - alframe / 2.;
120   par_fr[2] = zmax1;
121   par_fr[3] = (rmax - rmin) / 2;
122   pMC->Gsvolu("UTRI", "TRD1", idtmed[1302-1], par_fr, nparfr); 
123
124   // 
125   // The outer chambers
126   //
127
128   // Calculate some shape-parameter
129   Float_t tanzr = (zmax1 - zmax2) / (rmax - rmin);
130   Float_t theoc = -kRaddeg * TMath::ATan(tanzr / 2);
131
132   // The carbon frame (C)
133   par_oc[0]  = (rmax - rmin) / 2;
134   par_oc[1]  = theoc;
135   par_oc[2]  = 90.;
136   par_oc[3]  = (zmax2 - zlenn - zleni/2)   / 2;
137   par_oc[4]  = widmi - frame;
138   par_oc[5]  = widmi - frame;
139   par_oc[6]  = 0.;
140   par_oc[7]  = (zmax1 - zlenn - zleni/2)   / 2;
141   par_oc[8]  = widma - frame;
142   par_oc[9]  = widma - frame;
143   par_oc[10] = 0.;
144   pMC->Gsvolu("UTCO", "TRAP", idtmed[1307-1], par_oc, nparoc);
145
146   // The inner part (Air) 
147   par_oc[3] -= ccframe;
148   par_oc[4] -= ccframe;
149   par_oc[5] -= ccframe; 
150   par_oc[7] -= ccframe;
151   par_oc[8] -= ccframe;
152   par_oc[9] -= ccframe;
153   pMC->Gsvolu("UTIO", "TRAP", idtmed[1302-1], par_oc, nparoc);
154
155   // Definition of the six modules within each chamber 
156   pMC->Gsdvn("UTMO", "UTIO", nmodul, 3);
157
158   // Definition of the layers of each chamber 
159   par_oc[1]  =  theoc;
160   par_oc[2]  =  90.;
161   par_oc[3]  = -1.;
162   par_oc[4]  = -1.;
163   par_oc[5]  = -1.;
164   par_oc[6]  =  0.;
165   par_oc[7]  = -1.;
166   par_oc[8]  = -1.;
167   par_oc[9]  = -1.;
168   par_oc[10] =  0.;
169   // G10 layer (radiator layer)
170   par_oc[0] = sethick / 2;
171   pMC->Gsvolu("UT0O", "TRAP", idtmed[1313-1], par_oc, nparoc);
172   // CO2 layer (radiator)
173   par_oc[0] = rathick / 2;
174   pMC->Gsvolu("UT1O", "TRAP", idtmed[1312-1], par_oc, nparoc);
175   // PE layer (radiator)
176   par_oc[0] = pethick / 2;
177   pMC->Gsvolu("UT2O", "TRAP", idtmed[1303-1], par_oc, nparoc);
178   // Mylar layer (entrance window + HV cathode) 
179   par_oc[0] = mythick / 2;
180   pMC->Gsvolu("UT3O", "TRAP", idtmed[1308-1], par_oc, nparoc);
181   // Xe/Isobutane layer (gasvolume)
182   par_oc[0] = xethick / 2;
183   pMC->Gsvolu("UT4O", "TRAP", idtmed[1309-1], par_oc, nparoc);
184   // Cu layer (pad plane)
185   par_oc[0] = cuthick / 2;
186   pMC->Gsvolu("UT5O", "TRAP", idtmed[1305-1], par_oc, nparoc);
187   // G10 layer (support structure)
188   par_oc[0] = suthick / 2;
189   pMC->Gsvolu("UT6O", "TRAP", idtmed[1313-1], par_oc, nparoc);
190   // Cu layer (FEE + signal lines)
191   par_oc[0] = fethick / 2;
192   pMC->Gsvolu("UT7O", "TRAP", idtmed[1305-1], par_oc, nparoc);
193   // PE layer (cooling devices)
194   par_oc[0] = cothick / 2;
195   pMC->Gsvolu("UT8O", "TRAP", idtmed[1303-1], par_oc, nparoc);
196   // Water layer (cooling)
197   par_oc[0] = wathick / 2;
198   pMC->Gsvolu("UT9O", "TRAP", idtmed[1314-1], par_oc, nparoc);
199
200   //
201   // The neighbouring chambers
202   //
203
204   // The carbon frame (C) 
205   par_nc[0] = widmi - frame;
206   par_nc[1] = widma - frame;
207   par_nc[2] = zlenn / 2;
208   par_nc[3] = (rmax - rmin) / 2;
209   pMC->Gsvolu("UTCN", "TRD1", idtmed[1307-1], par_nc, nparnc);
210
211   // The inner part (Air) 
212   par_nc[0] -= ccframe;
213   par_nc[1] -= ccframe;
214   par_nc[2] -= ccframe;
215   pMC->Gsvolu("UTIN", "TRD1", idtmed[1302-1], par_nc, nparnc);
216
217   // Definition of the six modules within each outer chamber 
218   pMC->Gsdvn("UTMN", "UTIN", nmodul, 3);
219
220   // Definition of the layers of each chamber 
221   par_nc[0] = -1.;
222   par_nc[1] = -1.;
223   par_nc[2] = -1.;
224   // G10 layer (radiator layer)
225   par_nc[3] = sethick / 2;
226   pMC->Gsvolu("UT0N", "TRD1", idtmed[1313-1], par_nc, nparnc);
227   // CO2 layer (radiator)
228   par_nc[3] = rathick / 2;
229   pMC->Gsvolu("UT1N", "TRD1", idtmed[1312-1], par_nc, nparnc);
230   // PE layer (radiator)
231   par_nc[3] = pethick / 2;
232   pMC->Gsvolu("UT2N", "TRD1", idtmed[1303-1], par_nc, nparnc);
233   // Mylar layer (entrance window + HV cathode) 
234   par_nc[3] = mythick / 2;
235   pMC->Gsvolu("UT3N", "TRD1", idtmed[1308-1], par_nc, nparnc);
236   // Xe/Isobutane layer (gasvolume)
237   par_nc[3] = xethick / 2;
238   pMC->Gsvolu("UT4N", "TRD1", idtmed[1309-1], par_nc, nparnc);
239   // Cu layer (pad plane)
240   par_nc[3] = cuthick / 2;
241   pMC->Gsvolu("UT5N", "TRD1", idtmed[1305-1], par_nc, nparnc);
242   // G10 layer (support structure)
243   par_nc[3] = suthick / 2;
244   pMC->Gsvolu("UT6N", "TRD1", idtmed[1313-1], par_nc, nparnc);
245   // Cu layer (FEE + signal lines)
246   par_nc[3] = fethick / 2;
247   pMC->Gsvolu("UT7N", "TRD1", idtmed[1305-1], par_nc, nparnc);
248   // PE layer (cooling devices)
249   par_nc[3] = cothick / 2;
250   pMC->Gsvolu("UT8N", "TRD1", idtmed[1303-1], par_nc, nparnc);
251   // Water layer (cooling)
252   par_nc[3] = wathick / 2;
253   pMC->Gsvolu("UT9N", "TRD1", idtmed[1314-1], par_nc, nparnc);
254
255   //
256   // The inner chamber
257   //
258
259   // The carbon frame (C) 
260   par_ic[0] = widmi - frame;
261   par_ic[1] = widma - frame;
262   par_ic[2] = zleni / 2;
263   par_ic[3] = (rmax - rmin) / 2;
264   pMC->Gsvolu("UTCI", "TRD1", idtmed[1307-1], par_ic, nparic);
265
266   // The inner part (Air) 
267   par_ic[0] -= ccframe;
268   par_ic[1] -= ccframe;
269   par_ic[2] -= ccframe;
270   pMC->Gsvolu("UTII", "TRD1", idtmed[1302-1], par_ic, nparic);
271
272   // Definition of the six modules within each outer chamber 
273   pMC->Gsdvn("UTMI", "UTII", nmodul, 3);
274
275   // Definition of the layers of each inner chamber 
276   par_ic[0] = -1.;
277   par_ic[1] = -1.;
278   par_ic[2] = -1.;
279   // G10 layer (radiator layer)
280   par_ic[3] = sethick / 2;
281   pMC->Gsvolu("UT0I", "TRD1", idtmed[1313-1], par_ic, nparic);
282   // CO2 layer (radiator)
283   par_ic[3] = rathick / 2;
284   pMC->Gsvolu("UT1I", "TRD1", idtmed[1312-1], par_ic, nparic);
285   // PE layer (radiator)
286   par_ic[3] = pethick / 2;
287   pMC->Gsvolu("UT2I", "TRD1", idtmed[1303-1], par_ic, nparic);
288   // Mylar layer (entrance window + HV cathode) 
289   par_ic[3] = mythick / 2;
290   pMC->Gsvolu("UT3I", "TRD1", idtmed[1308-1], par_ic, nparic);
291   // Xe/Isobutane layer (gasvolume)
292   par_ic[3] = xethick / 2;
293   pMC->Gsvolu("UT4I", "TRD1", idtmed[1309-1], par_ic, nparic);
294   // Cu layer (pad plane)
295   par_ic[3] = cuthick / 2;
296   pMC->Gsvolu("UT5I", "TRD1", idtmed[1305-1], par_ic, nparic);
297   // G10 layer (support structure)
298   par_ic[3] = suthick / 2;
299   pMC->Gsvolu("UT6I", "TRD1", idtmed[1313-1], par_ic, nparic);
300   // Cu layer (FEE + signal lines)
301   par_ic[3] = fethick / 2;
302   pMC->Gsvolu("UT7I", "TRD1", idtmed[1305-1], par_ic, nparic);
303   // PE layer (cooling devices)
304   par_ic[3] = cothick / 2;
305   pMC->Gsvolu("UT8I", "TRD1", idtmed[1303-1], par_ic, nparic);
306   // Water layer (cooling)
307   par_ic[3] = wathick / 2;
308   pMC->Gsvolu("UT9I", "TRD1", idtmed[1314-1], par_ic, nparic);
309
310   //////////////////////////////////////////////////////////////////////////  
311   //     Positioning of Volumes   
312   //////////////////////////////////////////////////////////////////////////  
313
314   // The rotation matrices 
315   AliMatrix(idmat[0],  90.,  90., 180.,   0.,  90.,   0.);
316   AliMatrix(idmat[1],  90., 180.,  90., 270.,   0.,   0.);
317
318   // Position of the layers in a TRD module 
319   f = TMath::Tan(theoc * kDegrad);
320   pMC->Gspos("UT9O", 1, "UTMO", 0., f*wazpos, wazpos, 0, "ONLY");
321   pMC->Gspos("UT8O", 1, "UTMO", 0., f*cozpos, cozpos, 0, "ONLY");
322   pMC->Gspos("UT7O", 1, "UTMO", 0., f*fezpos, fezpos, 0, "ONLY");
323   pMC->Gspos("UT6O", 1, "UTMO", 0., f*suzpos, suzpos, 0, "ONLY");
324   pMC->Gspos("UT5O", 1, "UTMO", 0., f*cuzpos, cuzpos, 0, "ONLY");
325   pMC->Gspos("UT4O", 1, "UTMO", 0., f*xezpos, xezpos, 0, "ONLY");
326   pMC->Gspos("UT3O", 1, "UTMO", 0., f*myzpos, myzpos, 0, "ONLY");
327   pMC->Gspos("UT1O", 1, "UTMO", 0., f*razpos, razpos, 0, "ONLY");
328   pMC->Gspos("UT0O", 1, "UTMO", 0., f*sezpos, sezpos, 0, "ONLY");
329   pMC->Gspos("UT2O", 1, "UT1O", 0., f*pezpos, pezpos, 0, "ONLY");
330
331   pMC->Gspos("UT9N", 1, "UTMN", 0.,       0., wazpos, 0, "ONLY");
332   pMC->Gspos("UT8N", 1, "UTMN", 0.,       0., cozpos, 0, "ONLY");
333   pMC->Gspos("UT7N", 1, "UTMN", 0.,       0., fezpos, 0, "ONLY");
334   pMC->Gspos("UT6N", 1, "UTMN", 0.,       0., suzpos, 0, "ONLY");
335   pMC->Gspos("UT5N", 1, "UTMN", 0.,       0., cuzpos, 0, "ONLY");
336   pMC->Gspos("UT4N", 1, "UTMN", 0.,       0., xezpos, 0, "ONLY");
337   pMC->Gspos("UT3N", 1, "UTMN", 0.,       0., myzpos, 0, "ONLY");
338   pMC->Gspos("UT1N", 1, "UTMN", 0.,       0., razpos, 0, "ONLY");
339   pMC->Gspos("UT0N", 1, "UTMN", 0.,       0., sezpos, 0, "ONLY");
340   pMC->Gspos("UT2N", 1, "UT1N", 0.,       0., pezpos, 0, "ONLY");
341
342   pMC->Gspos("UT9I", 1, "UTMI", 0.,       0., wazpos, 0, "ONLY");
343   pMC->Gspos("UT8I", 1, "UTMI", 0.,       0., cozpos, 0, "ONLY");
344   pMC->Gspos("UT7I", 1, "UTMI", 0.,       0., fezpos, 0, "ONLY");
345   pMC->Gspos("UT6I", 1, "UTMI", 0.,       0., suzpos, 0, "ONLY");
346   pMC->Gspos("UT5I", 1, "UTMI", 0.,       0., cuzpos, 0, "ONLY");
347   pMC->Gspos("UT4I", 1, "UTMI", 0.,       0., xezpos, 0, "ONLY");
348   pMC->Gspos("UT3I", 1, "UTMI", 0.,       0., myzpos, 0, "ONLY");
349   pMC->Gspos("UT1I", 1, "UTMI", 0.,       0., razpos, 0, "ONLY");
350   pMC->Gspos("UT0I", 1, "UTMI", 0.,       0., sezpos, 0, "ONLY");
351   pMC->Gspos("UT2I", 1, "UT1I", 0.,       0., pezpos, 0, "ONLY");
352
353   // Position of the inner part of the chambers 
354   xpos = 0.;
355   ypos = 0.;
356   zpos = 0.;
357   pMC->Gspos("UTII", 1, "UTCI", xpos, ypos, zpos, 0, "ONLY");
358   pMC->Gspos("UTIN", 1, "UTCN", xpos, ypos, zpos, 0, "ONLY");
359   pMC->Gspos("UTIO", 1, "UTCO", xpos, ypos, zpos, 0, "ONLY");
360
361   // Position of the chambers in the support frame 
362   xpos = 0.;
363   ypos = ((zmax1 + zmax2) / 2 + zlenn + zleni / 2) / 2;
364   zpos = 0.;
365   pMC->Gspos("UTCO", 1, "UTRI", xpos, ypos, zpos, idmat[1], "ONLY");
366   pMC->Gspos("UTCO", 2, "UTRI", xpos,-ypos, zpos,       0 , "ONLY");
367   xpos = 0.;
368   ypos = (zlenn + zleni) / 2;
369   zpos = 0.;
370   pMC->Gspos("UTCN", 1, "UTRI", xpos, ypos, zpos,       0 , "ONLY");
371   pMC->Gspos("UTCN", 2, "UTRI", xpos,-ypos, zpos,       0 , "ONLY");
372   xpos = 0.;
373   ypos = 0.;
374   zpos = 0.;
375   pMC->Gspos("UTCI", 1, "UTRI", xpos, ypos, zpos,       0 , "ONLY");
376
377   // Position of the inner part of the detector frame
378   xpos = (rmax + rmin) / 2;
379   ypos = 0.;
380   zpos = 0.;
381   pMC->Gspos("UTRI", 1, "UTRS", xpos, ypos, zpos, idmat[0], "ONLY");
382
383   // Position of the TRD mother volume in the ALICE experiment 
384   xpos = 0.;
385   ypos = 0.;
386   zpos = 0.;
387   pMC->Gspos("TRD ", 1, "ALIC", xpos, ypos, zpos,        0, "ONLY");
388
389 }
390
391 //_____________________________________________________________________________
392 void AliTRDv0::DrawModule()
393 {
394
395   //
396   // Draw a shaded view of the Transition Radiation Detector version 0
397   //
398
399   AliMC* pMC = AliMC::GetMC();
400   
401   // Set everything unseen
402   pMC->Gsatt("*", "seen", -1);
403   // 
404   // Set ALIC mother transparent
405   pMC->Gsatt("ALIC","SEEN",0);
406   //
407   // Set the volumes visible
408   pMC->Gsatt("TRD" ,"SEEN",0);
409   pMC->Gsatt("UTRS","SEEN",0);
410   pMC->Gsatt("UTRI","SEEN",0);
411   pMC->Gsatt("UTCO","SEEN",0);
412   pMC->Gsatt("UTIO","SEEN",0);
413   pMC->Gsatt("UTMO","SEEN",0);
414   pMC->Gsatt("UTCN","SEEN",0);
415   pMC->Gsatt("UTIN","SEEN",0);
416   pMC->Gsatt("UTMN","SEEN",0);
417   pMC->Gsatt("UTCI","SEEN",0);
418   pMC->Gsatt("UTII","SEEN",0);
419   pMC->Gsatt("UTMI","SEEN",0);
420   pMC->Gsatt("UT1O","SEEN",1);
421   pMC->Gsatt("UT4O","SEEN",1);
422   pMC->Gsatt("UT1N","SEEN",1);
423   pMC->Gsatt("UT4N","SEEN",1);
424   pMC->Gsatt("UT1I","SEEN",1);
425   pMC->Gsatt("UT4I","SEEN",1);
426   //
427   pMC->Gdopt("hide", "on");
428   pMC->Gdopt("shad", "on");
429   pMC->Gsatt("*", "fill", 7);
430   pMC->SetClipBox(".");
431   pMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
432   pMC->DefaultRange();
433   pMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
434   pMC->Gdhead(1111, "Transition Radiation Detector Version 0");
435   pMC->Gdman(18, 4, "MAN");
436
437 }
438
439 //_____________________________________________________________________________
440 void AliTRDv0::CreateMaterials()
441 {
442   //
443   // Create materials for the Transition Radiation Detector
444   //
445   AliTRD::CreateMaterials();
446 }
447
448 //_____________________________________________________________________________
449 void AliTRDv0::Init() 
450 {
451   //
452   // Initialise Transition Radiation Detector after geometry is built
453   //
454   AliTRD::Init();
455   AliMC* pMC = AliMC::GetMC();
456   //
457   // Retrieve the numeric identifier of the sensitive volumes (gas volume)
458   fIdSens1 = pMC->VolId("UT4I");
459   fIdSens2 = pMC->VolId("UT4N");
460   fIdSens3 = pMC->VolId("UT4O");
461 }
462
463 //_____________________________________________________________________________
464 void AliTRDv0::StepManager()
465 {
466   //
467   // Procedure called at every step in the TRD
468   //
469
470   Int_t         vol[3]; 
471   Int_t         icopy, idSens, icSens; 
472
473   Float_t       hits[4];
474
475   TClonesArray &lhits = *fHits;
476
477   AliMC* pMC = AliMC::GetMC();
478
479   // Use only charged tracks and count them only once per volume
480   if (pMC->TrackCharge() && pMC->TrackExiting()) {
481     
482     // Check on sensitive volume
483     idSens = pMC->CurrentVol(0,icSens);
484     if ((idSens == fIdSens1) || 
485         (idSens == fIdSens2) ||
486         (idSens == fIdSens3)) { 
487       
488       // The sector number
489       pMC->CurrentVolOff(5,0,icopy);
490       vol[0] = icopy;
491       
492       // The chamber number 
493       //   1: outer left
494       //   2: neighbouring left
495       //   3: inner
496       //   4: neighbouring right
497       //   5: outer right
498       pMC->CurrentVolOff(3,0,icopy);
499       if      (idSens == fIdSens3)
500         vol[1] = 4 * icopy - 3; 
501       else if (idSens == fIdSens2)
502         vol[1] = 2 * icopy;
503       else 
504         vol[1] = 3;
505       
506       // The plane number
507       pMC->CurrentVolOff(1,0,icopy);
508       vol[2] = icopy;
509
510       if (fSensSelect) {
511         Int_t addthishit = 1;
512         if ((fSensPlane)   && (vol[2] != fSensPlane  )) addthishit = 0;
513         if ((fSensChamber) && (vol[1] != fSensChamber)) addthishit = 0;
514         if ((fSensSector)  && (vol[0] != fSensSector )) addthishit = 0;
515         if (addthishit) {
516           pMC->TrackPosition(hits);
517           hits[3] = 0;
518           new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
519         }
520       }
521       else {      
522         pMC->TrackPosition(hits);
523         hits[3] = 0;
524         new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
525       }
526
527     }
528
529   }  
530
531 }