er  dev
ERNDPoint.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERNDPoint source file -----
3 // -------------------------------------------------------------------------
4 
5 #include "ERNDPoint.h"
6 
7 #include "FairLogger.h"
8 
9 // ----- Default constructor -------------------------------------------
11  : FairMCPoint(),
12  fX_out(0.), fY_out(0.), fZ_out(0.),
13  fPx_out(0.), fPy_out(0.), fPz_out(0.),
14  fStilbenNr(-1)
15 {
16 }
17 // -------------------------------------------------------------------------
18 
19 
20 
21 // ----- Standard constructor ------------------------------------------
22 ERNDPoint::ERNDPoint(Int_t eventID, Int_t trackID,
23  Int_t mot0trackID,
24  Int_t pdg,
25  TVector3 posIn,
26  TVector3 posOut, TVector3 momIn, TVector3 momOut,
27  Double_t tof, Double_t length, Double_t eLoss, Int_t stilbenNr,Float_t lightYield)
28  : FairMCPoint(trackID, -1., posIn, momIn, tof, length, eLoss),
29  fMot0TrackID(mot0trackID),
30  fEventID(eventID),
31  fX_out(posOut.X()), fY_out(posOut.Y()), fZ_out(posOut.Z()),
32  fPx_out(momOut.X()), fPy_out(momOut.Y()), fPz_out(momOut.Z()),
33  fStilbenNr(stilbenNr),fLightYield(lightYield), fPdg(pdg)
34 {
35 }
36 // -------------------------------------------------------------------------
37 
38 
39 
40 // -------------------------------------------------------------------------
42  : FairMCPoint(right),
43  fX_out(right.fX_out), fY_out(right.fY_out), fZ_out(right.fZ_out),
44  fPx_out(right.fPx_out), fPy_out(right.fPy_out), fPz_out(right.fPz_out),
45  fStilbenNr(right.fStilbenNr),fLightYield(right.fLightYield), fPdg(right.fPdg)
46 {
47 }
48 // -------------------------------------------------------------------------
49 
50 
51 
52 // ----- Destructor ----------------------------------------------------
54 {
55 }
56 // -------------------------------------------------------------------------
57 
58 
59 
60 // ----- Public method Print -------------------------------------------
61 void ERNDPoint::Print(const Option_t* opt /* = 0*/) const
62 {
63  LOG(DEBUG2) << " ERNDPoint: track " << fTrackID << " mother track = " << fMot0TrackID << FairLogger::endl;
64  LOG(DEBUG2) << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << FairLogger::end;
65  LOG(DEBUG2) << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") MeV" << FairLogger::end;
66  LOG(DEBUG2) << " Time " << fTime << " ns, Length " << fLength << " cm" << FairLogger::end;
67  LOG(DEBUG2) << " Energy loss " << fELoss << " MeV "<< FairLogger::end;
68 }
69 // -------------------------------------------------------------------------
70 
71 
72 
73 // ----- Point x coordinate from linear extrapolation ------------------
74 Double_t ERNDPoint::GetX(Double_t z) const
75 {
76  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
77  Double_t dz = fZ_out - fZ;
78  return ( fX + (z-fZ) / dz * (fX_out-fX) );
79 }
80 // -------------------------------------------------------------------------
81 
82 
83 
84 // ----- Point y coordinate from linear extrapolation ------------------
85 Double_t ERNDPoint::GetY(Double_t z) const
86 {
87  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
88  Double_t dz = fZ_out - fZ;
89  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
90  return ( fY + (z-fZ) / dz * (fY_out-fY) );
91 }
92 // -------------------------------------------------------------------------
93 
94 
95 
96 // ----- Public method IsUsable ----------------------------------------
97 Bool_t ERNDPoint::IsUsable() const
98 {
99  Double_t dz = fZ_out - fZ;
100  if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
101  return kTRUE;
102 }
103 // -------------------------------------------------------------------------
104 
105 
106 
107 ClassImp(ERNDPoint)
Double_t GetX(Double_t z) const
Definition: ERNDPoint.cxx:74
virtual void Print(const Option_t *opt=0) const
Definition: ERNDPoint.cxx:61
virtual ~ERNDPoint()
Definition: ERNDPoint.cxx:53
Bool_t IsUsable() const
Definition: ERNDPoint.cxx:97