]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITShit.cxx
Transition to NewIO
[u/mrichter/AliRoot.git] / ITS / AliITShit.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.21  2002/12/03 09:03:06  hristov
19 Changes needed on Itanium (F.Carminati)
20
21 Revision 1.20  2002/10/22 14:45:42  alibrary
22 Introducing Riostream.h
23
24 Revision 1.19  2002/10/14 14:57:00  hristov
25 Merging the VirtualMC branch to the main development branch (HEAD)
26
27 Revision 1.13.6.3  2002/08/28 15:06:50  alibrary
28 Updating to v3-09-01
29
30 Revision 1.18  2002/08/07 18:37:53  nilsen
31 Removed endl from print function. should be supplied by user as wanted.
32
33 Revision 1.17  2002/06/20 09:10:14  hristov
34 Data member ft0 initialized
35
36 Revision 1.16  2002/06/19 21:12:37  nilsen
37 Fixed bug with non-zero-ed new data members in constructors. Thanks Jiri
38 for finding it and pointing it out.
39
40 Revision 1.15  2002/06/12 18:59:47  nilsen
41 Added Starting track location to hit class and related changes to modules.
42 This is at present still fully backwards compatible since starting hits
43 are still written to the file. When aliroot v4.0 will be released, this
44 backwards compatiblity will be broken by removing the enterence hit, and making
45 the nessesary changes to module at that time.
46
47 Revision 1.14  2002/05/19 18:17:03  hristov
48 Changes needed by ICC/IFC compiler (Intel)
49
50 Revision 1.13  2002/03/09 18:35:35  nilsen
51 Added functions to print out Hit data members.
52
53 Revision 1.12  2002/03/08 16:05:05  nilsen
54 Standeard io streamers added to make debugging et al. easier.
55
56 Revision 1.11  2001/01/30 09:23:13  hristov
57 Streamers removed (R.Brun)
58
59 Revision 1.10  2001/01/26 20:01:19  hristov
60 Major upgrade of AliRoot code
61
62 Revision 1.9  2000/10/02 16:32:51  barbera
63 Automatic streamer used and forward declarations added
64
65 Revision 1.3.4.7  2000/10/02 15:54:49  barbera
66 Automatic streamer used and forward declarations added
67
68 Revision 1.8  2000/09/22 12:35:21  nilsen
69 Traps placed incase it is used without a properly initilized AliITSgeom class.
70
71 Revision 1.7  2000/07/10 16:07:18  fca
72 Release version of ITS code
73
74 Revision 1.3.4.2  2000/03/04 23:43:57  nilsen
75 Fixed up the comments/documentation.
76
77 Revision 1.3.4.1  2000/01/12 19:03:32  nilsen
78 This is the version of the files after the merging done in December 1999.
79 See the ReadMe110100.txt file for details
80
81 Revision 1.3  1999/09/29 09:24:20  fca
82 Introduction of the Copyright and cvs Log
83
84 */
85
86 #include <Riostream.h>
87
88 #include <TMath.h>
89 #include <TRandom.h>
90 #include <TVector.h>
91 #include <TGeometry.h>
92 #include <TNode.h>
93 #include <TTUBE.h>
94 #include "TParticle.h"
95
96 #include "AliRun.h"
97 #include "AliITS.h"
98 #include "AliITSgeom.h"
99 #include "AliITShit.h"
100
101
102 ClassImp(AliITShit)
103 ////////////////////////////////////////////////////////////////////////
104 // Version: 0
105 // Written by Rene Brun, Federico Carminati, and Roberto Barbera
106 //
107 // Version: 1
108 // Modified and documented by Bjorn S. Nilsen
109 // July 11 1999
110 //
111 // AliITShit is the hit class for the ITS. Hits are the information
112 // that comes from a Monte Carlo at each step as a particle mass through
113 // sensitive detector elements as particles are transported through a
114 // detector.
115 //
116 //Begin_Html
117 /*
118 <img src="picts/ITS/AliITShit_Class_Diagram.gif">
119 </pre>
120 <br clear=left>
121 <font size=+2 color=red>
122 <p>This show the relasionships between the ITS hit class and the rest of Aliroot.
123 </font>
124 <pre>
125 */
126 //End_Html
127 ////////////////////////////////////////////////////////////////////////
128 // Inline Member functions:
129 //
130 // AliITShit()
131 //     The default creator of the AliITShit class.
132 //
133 // ~AliITShit()
134 //     The default destructor of the AliITShit class.
135 //
136 // int GetTrack()
137 //     See AliHit for a full description. Returns the track number fTrack
138 // for this hit.
139 //
140 // SetTrack(int track)
141 //     See AliHit for a full description. Sets the track number fTrack
142 // for this hit.
143 //
144 // Int_t GetTrackStatus()
145 //     Returns the value of the track status flag fStatus. This flag
146 // indicates the track status at the time of creating this hit. It is
147 // made up of the following 8 status bits from highest order to lowest
148 // order bits
149 // 0           :  IsTrackAlive():    IsTrackStop():IsTrackDisappeared():
150 // IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside()     .
151 // See AliMC for a description of these functions. If the function is
152 // true then the bit is set to one, otherwise it is zero.
153 //
154 // Bool_t StatusInside()
155 //     Returns kTRUE if the particle producing this hit is still inside
156 // the present volume. Returns kFalse if this particle will be in another
157 // volume. {bit IsTrackInside is set or not}
158 //
159 // Bool_t StatusEntering()
160 //     Returns kTRUE if the particle producing this hit is has just enterd
161 // the present volume. Returns kFalse otherwise.  {bit IsTrackEntering is
162 // set or not}
163 //
164 // Bool_t StatusExiting()
165 //     Returns kTRUE if the particle producing this hit is will exit
166 // the present volume. Returns kFalse otherwise. {bit IsTrackExiting is set
167 // or not}
168 //
169 // Bool_t StatusOut()
170 //     Returns kTRUE if the particle producing this hit is goint exit the
171 // simulation. Returns kFalse otherwise. {bit IsTrackOut is set or not}
172 //
173 // Bool_t StatusDisappeared()
174 //     Returns kTRUE if the particle producing this hit is going to "disappear"
175 // for example it has interacted producing some other particles. Returns
176 //  kFalse otherwise. {bit IsTrackOut is set or not}
177 //
178 // Bool_t StatusStop()
179 //     Returns kTRUE if the particle producing this hit is has dropped below
180 // its energy cut off producing some other particles. Returns kFalse otherwise.
181 // {bit IsTrackOut is set or not}
182 //
183 // Bool_t StatuAlives()
184 //     Returns kTRUE if the particle producing this hit is going to continue
185 // to be transported. Returns kFalse otherwise. {bit IsTrackOut is set or not}
186 //
187 // Int_t GetLayer()
188 //     Returns the layer number, fLayer, for this hit.
189 //
190 // Int_t GetLadder()
191 //     Returns the ladder number, fLadder, for this hit.
192 //
193 // Int_t GetDetector()
194 //     Returns the detector number, fDet, for this hit.
195 //
196 // GetDetectorID(Int_t &layer, Int_t &ladder, Int_t &detector)
197 //     Returns the layer, ladder, and detector numbers, fLayer fLadder fDet,
198 // in one call.
199 //
200 // Float_t GetIonization()
201 //     Returns the energy lost, fDestep, by the particle creating this hit,
202 // in the units defined by the Monte Carlo.
203 //
204 // GetPositionG(Float_t &x, Float_t &y, Float_t &z)
205 //     Returns the global position, fX fY fZ, of this hit, in the units
206 // define by the Monte Carlo.
207 //
208 // GetPositionG(Double_t &x, Double_t &y, Double_t &z)
209 //     Returns the global position, fX fY fZ, of this hit, in the units
210 // define by the Monte Carlo.
211 //
212 // GetPositionG(Float_t &x, Float_t &y, Float_t &z, Float_t &tof)
213 //     Returns the global position and time of flight, fX fY fZ fTof, of
214 // this hit, in the units define by the Monte Carlo.
215 //
216 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
217 //     Returns the global position and time of flight, fX fY fZ fTof, of
218 // this hit, in the units define by the Monte Carlo.
219 //
220 // GetPositionL(Double_t &x,Double_t &y,Double_t &z)
221 //     Returns the local position, fX fY fZ, of this hit in the coordiante
222 // of this module, in the units define by the Monte Carlo.
223 //
224 // GetPositionG(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
225 //     Returns the local position and time of flight, fX fY fZ fTof, of
226 // this hit in the coordinates of this module, in the units define by the
227 //  Monte Carlo.
228 //
229 // Float_t GetXG()
230 //     Returns the global x position in the units defined by the Monte Carlo.
231 //
232 // Float_t GetYG()
233 //     Returns the global y position in the units defined by the Monte Carlo.
234 //
235 // Float_t GetYG()
236 //     Returns the global z position in the units defined by the Monte Carlo.
237 //
238 // Float_t GetTOF()
239 //     Returns the time of flight, fTof, of this hit, in the units defined
240 // by the Monte Carlo.
241 //
242 // GetMomentumG(Float_t &px, Float_t &py, Float_t &pz)
243 //     Returns the global momentum, fPx fPy fPz, of the particle that made
244 // this hit, in the units define by the Monte Carlo.
245 //
246 // GetMomentumG(Double_t &px,Double_t &py,Double_t &pz)
247 //     Returns the global momentum, fPx fPy fPz, of the particle that made
248 // this hit, in the units define by the Monte Carlo.
249 //
250 // GetMomentumL(Double_t &px,Double_t &py,Double_t &pz)
251 //     Returns the momentum, fPx fPy fPz in coordinate appropreate for this
252 // specific module, in the units define by the Monte Carlo.
253 //
254 // Float_t GetPXG()
255 //     Returns the global X momentum in the units defined by the Monte Carlo.
256 //
257 // Float_t GetPYG()
258 //     Returns the global Y momentum in the units defined by the Monte Carlo.
259 //
260 // Float_t GetPZG()
261 //     Returns the global Z momentum in the units defined by the Monte Carlo.
262 //
263 ////////////////////////////////////////////////////////////////////////
264 //_____________________________________________________________________________
265 AliITShit::AliITShit():AliHit(){
266     // Default Constructor
267     // Zero data member just to be safe.
268     // Intputs:
269     //    none.
270     // Outputs:
271     //    none.
272     // Return:
273     //    A default created AliITShit class.
274
275     fStatus = 0; // Track Status
276     fLayer  = 0;  // Layer number
277     fLadder = 0; // Ladder number
278     fDet    = 0;    // Detector number  
279     fPx     = 0.0;     // PX of particle at the point of the hit
280     fPy     = 0.0;     // PY of particle at the point of the hit
281     fPz     = 0.0;     // PZ of particle at the point of the hit
282     fDestep = 0.0; // Energy deposited in the current step
283     fTof    = 0.0;    // Time of flight at the point of the hit
284     fStatus0 = 0; // zero status bit by default.
285     fx0     = 0.0;     // Starting point of this step
286     fy0     = 0.0;     // Starting point of this step
287     fz0     = 0.0;     // Starting point of this step
288     ft0     = 0.0;     // Starting point of this step
289 }
290 AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
291                      Float_t tof,TLorentzVector &x,TLorentzVector &x0,
292                      TLorentzVector &p) : AliHit(shunt, track){
293 ////////////////////////////////////////////////////////////////////////
294 // Create ITS hit
295 //     The creator of the AliITShit class. The variables shunt and
296 // track are passed to the creator of the AliHit class. See the AliHit
297 // class for a full description. In the units of the Monte Carlo
298 ////////////////////////////////////////////////////////////////////////
299     // Intputs:
300     //    Int_t shunt   See AliHit
301     //    Int_t track   Track number, see AliHit
302     //    Int_t *vol     Array of integer hit data,
303     //                     vol[0] Layer where the hit is, 1-6 typicaly
304     //                     vol[1] Ladder where the hit is.
305     //                     vol[2] Detector number where the hit is
306     //                     vol[3] Set of status bits
307     //                     vol[4] Set of status bits at start
308     // Outputs:
309     //    none.
310     // Return:
311     //    A default created AliITShit class.
312
313     fLayer      = vol[0];  // Layer number
314     fLadder     = vol[2];  // Ladder number
315     fDet        = vol[1];  // Detector number
316     fStatus     = vol[3];  // Track status flags
317     fStatus0    = vol[4];  // Track status flag for start position.
318     fX          = x.X();   // Track X global position
319     fY          = x.Y();   // Track Y global position
320     fZ          = x.Z();   // Track Z global position
321     fPx         = p.Px();  // Track X Momentum
322     fPy         = p.Py();  // Track Y Momentum
323     fPz         = p.Pz();  // Track Z Momentum
324     fDestep     = edep;    // Track dE/dx for this step
325     fTof        = tof   ;  // Track Time of Flight for this step
326     fx0         = x0.X();  // Track X global position
327     fy0         = x0.Y();  // Track Y global position
328     fz0         = x0.Z();  // Track Z global position
329     ft0         = x0.T();     // Starting point of this step
330 }
331 //______________________________________________________________________
332 AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
333     AliHit(shunt, track){
334 ////////////////////////////////////////////////////////////////////////
335 // Create ITS hit
336 //     The creator of the AliITShit class. The variables shunt and
337 // track are passed to the creator of the AliHit class. See the AliHit
338 // class for a full description. the integer array *vol contains, in order,
339 // fLayer = vol[0], fDet = vol[1], fLadder = vol[2], fStatus = vol[3].
340 // The array *hits contains, in order, fX = hits[0], fY = hits[1],
341 // fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
342 // fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
343 ////////////////////////////////////////////////////////////////////////
344     // Intputs:
345     //    Int_t shunt   See AliHit
346     //    Int_t track   Track number, see AliHit
347     //    Int_t *vol     Array of integer hit data,
348     //                     vol[0] Layer where the hit is, 1-6 typicaly
349     //                     vol[1] Ladder where the hit is.
350     //                     vol[2] Detector number where the hit is
351     //                     vol[3] Set of status bits
352     //    Float_t *hits   Array of hit information
353     //                     hits[0] X global position of this hit
354     //                     hits[1] Y global position of this hit
355     //                     hits[2] Z global position of this hit
356     //                     hits[3] Px global position of this hit
357     //                     hits[4] Py global position of this hit
358     //                     hits[5] Pz global position of this hit
359     //                     hits[6] Energy deposited by this step
360     //                     hits[7] Time of flight of this particle at this step
361     // Outputs:
362     //    none.
363     // Return:
364     //    A standard created AliITShit class.
365   fLayer      = vol[0];   // Layer number
366   fLadder     = vol[2];   // Ladder number
367   fDet        = vol[1];   // Detector number
368   fStatus     = vol[3];   // Track status flags
369   fX          = hits[0];  // Track X global position
370   fY          = hits[1];  // Track Y global position
371   fZ          = hits[2];  // Track Z global position
372   fPx         = hits[3];  // Track X Momentum
373   fPy         = hits[4];  // Track Y Momentum
374   fPz         = hits[5];  // Track Z Momentum
375   fDestep     = hits[6];  // Track dE/dx for this step
376   fTof        = hits[7];  // Track Time of Flight for this step
377   fStatus0 = 0;// Track Status of Starting point
378   fx0 = 0.0;     // Starting point of this step
379   fy0 = 0.0;     // Starting point of this step
380   fz0 = 0.0;     // Starting point of this step
381   ft0 = 0.0;     // Starting point of this step
382 }
383 //______________________________________________________________________
384 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
385 ////////////////////////////////////////////////////////////////////////
386 //     Returns the position of this hit in the local coordinates of this
387 // module, and in the units of the Monte Carlo.
388 ////////////////////////////////////////////////////////////////////////
389     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
390     Float_t g[3],l[3];
391
392     g[0] = fX;
393     g[1] = fY;
394     g[2] = fZ;
395     if(gm) {
396       gm->GtoL(fLayer,fLadder,fDet,g,l);
397       x = l[0];
398       y = l[1];
399       z = l[2];
400     } else {
401       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
402       // AliITSv7 - SDD case
403       x=fX;
404       y=fY;
405       z=fZ;
406     }
407     return;
408 }
409 //______________________________________________________________________
410 void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof){
411 ////////////////////////////////////////////////////////////////////////
412 //     Returns the position and time of flight of this hit in the local
413 // coordinates of this module, and in the units of the Monte Carlo.
414 ////////////////////////////////////////////////////////////////////////
415     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
416     Float_t g[3],l[3];
417
418     g[0] = fX;
419     g[1] = fY;
420     g[2] = fZ;
421     if(gm) {
422       gm->GtoL(fLayer,fLadder,fDet,g,l);
423       x = l[0];
424       y = l[1];
425       z = l[2];
426     } else {
427       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
428       // AliITSv7 - SDD case
429       x=fX;
430       y=fY;
431       z=fZ;
432     }
433     tof = fTof;
434     return;
435 }
436 //______________________________________________________________________
437 void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
438                               Double_t &tof){
439 ////////////////////////////////////////////////////////////////////////
440 //     Returns the initial position and time of flight of this hit in the local
441 // coordinates of this module, and in the units of the Monte Carlo.
442 ////////////////////////////////////////////////////////////////////////
443     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
444     Float_t g[3],l[3];
445
446     g[0] = fx0;
447     g[1] = fy0;
448     g[2] = fz0;
449     if(gm) {
450       gm->GtoL(fLayer,fLadder,fDet,g,l);
451       x = l[0];
452       y = l[1];
453       z = l[2];
454     } else {
455       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
456       // AliITSv7 - SDD case
457       x=fx0;
458       y=fy0;
459       z=fz0;
460     }
461     tof = ft0;
462     return;
463 }
464 //______________________________________________________________________
465 Float_t AliITShit::GetXL(){
466 ////////////////////////////////////////////////////////////////////////
467 //     Returns the x position of this hit in the local coordinates of this
468 // module, and in the units of the Monte Carlo.
469 ////////////////////////////////////////////////////////////////////////
470     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
471     Float_t g[3],l[3];
472
473     g[0] = fX;
474     g[1] = fY;
475     g[2] = fZ;
476     if(gm) {
477       gm->GtoL(fLayer,fLadder,fDet,g,l);
478       return l[0];
479     } else {
480       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
481       return fX;
482     }
483 }
484 //______________________________________________________________________
485 Float_t AliITShit::GetYL(){
486 ////////////////////////////////////////////////////////////////////////
487 //     Returns the y position of this hit in the local coordinates of this
488 // module, and in the units of the Monte Carlo.
489 ////////////////////////////////////////////////////////////////////////
490     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
491     Float_t g[3],l[3];
492
493     g[0] = fX;
494     g[1] = fY;
495     g[2] = fZ;
496     if (gm) {
497       gm->GtoL(fLayer,fLadder,fDet,g,l);
498       return l[1];
499     } else {
500       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
501       return fZ;
502     }
503 }
504 //______________________________________________________________________
505 Float_t AliITShit::GetZL(){
506 ////////////////////////////////////////////////////////////////////////
507 //     Returns the z position of this hit in the local coordinates of this
508 // module, and in the units of the Monte Carlo.
509 ////////////////////////////////////////////////////////////////////////
510     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
511     Float_t g[3],l[3];
512
513     g[0] = fX;
514     g[1] = fY;
515     g[2] = fZ;
516     if(gm) {
517       gm->GtoL(fLayer,fLadder,fDet,g,l);
518       return l[2];
519     } else {
520       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
521       return fY;
522     }
523 }
524 //______________________________________________________________________
525 void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
526 ////////////////////////////////////////////////////////////////////////
527 //     Returns the momentum of this hit in the local coordinates of this
528 // module, and in the units of the Monte Carlo.
529 ////////////////////////////////////////////////////////////////////////
530     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
531     Float_t g[3],l[3];
532
533     g[0] = fPx;
534     g[1] = fPy;
535     g[2] = fPz;
536     if (gm) {
537       gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
538       px = l[0];
539       py = l[1];
540       pz = l[2];
541     } else {
542       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
543       px=fPx;
544       py=fPy;
545       pz=fPz;
546     }
547     return;
548 }
549 //______________________________________________________________________
550 Float_t AliITShit::GetPXL(){
551 ////////////////////////////////////////////////////////////////////////
552 //     Returns the X momentum of this hit in the local coordinates of this
553 // module, and in the units of the Monte Carlo.
554 ////////////////////////////////////////////////////////////////////////
555     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
556     Float_t g[3],l[3];
557
558     g[0] = fPx;
559     g[1] = fPy;
560     g[2] = fPz;
561     if (gm) {
562       gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
563       return l[0];
564     } else {
565       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
566       return fPx;
567     }
568 }
569 //______________________________________________________________________
570 Float_t AliITShit::GetPYL(){
571 ////////////////////////////////////////////////////////////////////////
572 //     Returns the Y momentum of this hit in the local coordinates of this
573 // module, and in the units of the Monte Carlo.
574 ////////////////////////////////////////////////////////////////////////
575     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
576     Float_t g[3],l[3];
577
578     g[0] = fPx;
579     g[1] = fPy;
580     g[2] = fPz;
581     if (gm) {
582       gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
583       return l[1];
584     } else {
585       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
586       return fPy;
587     }
588
589 }
590 //______________________________________________________________________
591 Float_t AliITShit::GetPZL(){
592 ////////////////////////////////////////////////////////////////////////
593 //     Returns the Z momentum of this hit in the local coordinates of this
594 // module, and in the units of the Monte Carlo.
595 ////////////////////////////////////////////////////////////////////////
596     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
597     Float_t g[3],l[3];
598
599     g[0] = fPx;
600     g[1] = fPy;
601     g[2] = fPz;
602     if (gm) {
603       gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
604       return l[2];
605     } else {
606       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
607       return fPz;
608     }
609
610 }
611 //___________________________________________________________________________;
612 Int_t AliITShit::GetModule(){
613 ////////////////////////////////////////////////////////////////////////
614 //     Returns the module index number of the module where this hit was in.
615 ////////////////////////////////////////////////////////////////////////
616     AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
617
618     if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
619     else {
620       Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
621       return 0;
622     }
623 }
624 //______________________________________________________________________
625 TParticle * AliITShit::GetParticle(){
626 ////////////////////////////////////////////////////////////////////////
627 //     Returns the pointer to the TParticle for the particle that created
628 // this hit. From the TParticle all kinds of information about this 
629 // particle can be found. See the TParticle class.
630 ////////////////////////////////////////////////////////////////////////
631     return gAlice->Particle(GetTrack());
632 }  
633 //----------------------------------------------------------------------
634 void AliITShit::Print(ostream *os){
635 ////////////////////////////////////////////////////////////////////////
636 // Standard output format for this class.
637 ////////////////////////////////////////////////////////////////////////
638 #if defined __GNUC__
639 #if __GNUC__ > 2
640     ios::fmtflags fmt;
641 #else
642     Int_t fmt;
643 #endif
644 #else
645 #if defined __ICC || defined __ECC
646     ios::fmtflags fmt;
647 #else
648     Int_t fmt;
649 #endif
650 #endif
651  
652     fmt = os->setf(ios::scientific);  // set scientific floating point output
653     *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
654     fmt = os->setf(ios::hex); // set hex for fStatus only.
655     *os << fStatus << " ";
656     fmt = os->setf(ios::dec); // every thing else decimel.
657     *os << fLayer << " " << fLadder << " " << fDet << " ";;
658     *os << fPx << " " << fPy << " " << fPz << " ";
659     *os << fDestep << " " << fTof;
660     *os << " " << fx0 << " " << fy0 << " " << fz0;
661 //    *os << " " << endl;
662     os->flags(fmt); // reset back to old formating.
663     return;
664 }
665 //----------------------------------------------------------------------
666 void AliITShit::Read(istream *is){
667 ////////////////////////////////////////////////////////////////////////
668 // Standard input format for this class.
669 ////////////////////////////////////////////////////////////////////////
670  
671
672     *is >> fTrack >> fX >> fY >> fZ;
673     *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
674            fDestep >> fTof;
675     *is >> fx0 >> fy0 >> fz0;
676     return;
677 }
678 //----------------------------------------------------------------------
679 ostream &operator<<(ostream &os,AliITShit &p){
680 ////////////////////////////////////////////////////////////////////////
681 // Standard output streaming function.
682 ////////////////////////////////////////////////////////////////////////
683  
684     p.Print(&os);
685     return os;
686 }
687 //----------------------------------------------------------------------
688 istream &operator>>(istream &is,AliITShit &r){
689 ////////////////////////////////////////////////////////////////////////
690 // Standard input streaming function.
691 ////////////////////////////////////////////////////////////////////////
692  
693     r.Read(&is);
694     return is;
695 }
696 //----------------------------------------------------------------------