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