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