]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTrackReference.cxx
first prototype of interface to storage of run dependent objects, implementation...
[u/mrichter/AliRoot.git] / STEER / AliTrackReference.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 /* $Id$ */
17
18 #include "TLorentzVector.h"
19 #include "TVirtualMC.h"
20
21 #include "AliRun.h"
22 #include "AliTrackReference.h"
23
24 // 
25 // Track Reference object is created every time particle is 
26 // crossing detector bounds. The object is created by Step Manager
27 //
28 // The class stores the following informations:
29 // track label, 
30 // track position: X,Y,X
31 // track momentum px, py, pz
32 // track length and time of fligth: both in cm
33 // status bits from Monte Carlo
34 //
35
36
37 ClassImp(AliTrackReference)
38
39 //_______________________________________________________________________
40  AliTrackReference::AliTrackReference():
41    fTrack(0),
42    fX(0),
43    fY(0),
44    fZ(0),
45    fPx(0),
46    fPy(0),
47    fPz(0),
48    fLength(0)
49 {
50   //
51   // Default constructor
52   // Creates empty object
53
54   for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
55 }
56
57 //_______________________________________________________________________
58 AliTrackReference::AliTrackReference(Int_t label) {
59   //
60   // Create Reference object out of label and
61   // data in TVirtualMC object
62   //
63   // Creates an object and fill all parameters 
64   // from data in VirtualMC
65   //
66   // Sylwester Radomski, (S.Radomski@gsi.de)
67   // GSI, Jan 31, 2003
68   //
69     
70   TLorentzVector vec;
71   
72   fTrack = label;
73   fLength = gMC->TrackLength();
74   fTime = gMC->TrackTime();
75
76   gMC->TrackPosition(vec);
77
78   fX = vec[0];
79   fY = vec[1];
80   fZ = vec[2];
81   
82   gMC->TrackMomentum(vec);
83   
84   fPx = vec[0];
85   fPy = vec[1];
86   fPz = vec[2];
87
88   // Set Up status code 
89   // Copy Bits from virtual MC
90
91   for(Int_t i=0; i<16; i++) ResetBit(BIT(i));
92
93   SetBit(BIT(0), gMC->IsNewTrack());
94   SetBit(BIT(1), gMC->IsTrackAlive());
95   SetBit(BIT(2), gMC->IsTrackDisappeared());
96   SetBit(BIT(3), gMC->IsTrackEntering());
97   SetBit(BIT(4), gMC->IsTrackExiting());
98   SetBit(BIT(5), gMC->IsTrackInside());
99   SetBit(BIT(6), gMC->IsTrackOut());
100   SetBit(BIT(7), gMC->IsTrackStop()); 
101 }
102 //_______________________________________________________________________