er  dev
ERNeuRadPoint.cxx
1 // -------------------------------------------------------------------------
2 // ----- ERNeuRadPoint source file -----
3 // -------------------------------------------------------------------------
4 
5 #include <cmath>
6 
7 #include "ERNeuRadPoint.h"
8 #include "FairLogger.h"
9 
10 #include <iostream>
11 
12 // ----- Default constructor -------------------------------------------
14  : FairMCPoint(),
15  fX_out(0.), fY_out(0.), fZ_out(0.),
16  fPx_out(0.), fPy_out(0.), fPz_out(0.)
17 {
18 }
19 // -------------------------------------------------------------------------
20 
21 // ----- Standard constructor ------------------------------------------
22 ERNeuRadPoint::ERNeuRadPoint(Int_t eventID, Int_t trackID,
23  Int_t mot0trackID,
24  Int_t fiberNb, Int_t pixelNb, Int_t moduleNb,
25  Double_t mass,
26  TVector3 posIn, TVector3 posInLoc,
27  TVector3 posOut, TVector3 momIn, TVector3 momOut,
28  Double_t timeIn, Double_t timeOut, Double_t trackLength,
29  Double_t eLoss, Double_t lightYield, Int_t pid, Double_t charge)
30  : FairMCPoint(trackID, -1., posIn, momIn, timeIn, 0., eLoss),
31  fEventID(eventID),
32  fFiberNb(fiberNb), fPixelNb(pixelNb),fModuleNb(moduleNb),
33  fXlocal(posInLoc.X()),fYlocal(posInLoc.Y()), fZlocal(posInLoc.Z()),
34  fX_out(posOut.X()), fY_out(posOut.Y()), fZ_out(posOut.Z()),
35  fPx_out(momOut.X()), fPy_out(momOut.Y()), fPz_out(momOut.Z()),
36  fLightYield(lightYield), fPID(pid), fCharge(charge),fTimeIn(timeIn), fTimeOut(timeOut),
37  fTrackLength(trackLength)
38 {
39 }
40 // -------------------------------------------------------------------------
41 
42 // -------------------------------------------------------------------------
44  : FairMCPoint(right),
45  fFiberNb(right.fFiberNb),fPixelNb(right.fPixelNb),fModuleNb(right.fModuleNb),
46  fX_out(right.fX_out), fY_out(right.fY_out), fZ_out(right.fZ_out),
47  fPx_out(right.fPx_out), fPy_out(right.fPy_out), fPz_out(right.fPz_out),
48  fLightYield(right.fLightYield), fPID(right.fPID), fCharge(right.fCharge),
49  fTimeIn(right.fTimeIn),fTimeOut(right.fTimeOut), fTrackLength(right.fTrackLength)
50 {
51 }
52 // -------------------------------------------------------------------------
53 
54 // ----- Destructor ----------------------------------------------------
56 {
57 }
58 // -------------------------------------------------------------------------
59 
60 // ----- Public method Print -------------------------------------------
61 void ERNeuRadPoint::Print(const Option_t* opt /* = 0*/) const
62 {
63  LOG(INFO) << "-I- ERNeuRadPoint: track " << fTrackID << " mother track = " << fMot0TrackID << FairLogger::endl;
64  LOG(INFO) << " Position (" << fX << ", " << fY << ", " << fZ << ") cm" << FairLogger::endl;
65  LOG(INFO) << " Momentum (" << fPx << ", " << fPy << ", " << fPz << ") GeV" << FairLogger::endl;
66  LOG(INFO) << " Time " << fTime << " ns, Length " << fLength << " cm" << FairLogger::endl;
67  LOG(INFO) << " Energy loss " << fELoss << " keV, Light yield " << fLightYield << " MeV "<< FairLogger::endl;
68  LOG(INFO) << " Fiber number " << fFiberNb << " Pixel number " << fPixelNb << " Module number " << fModuleNb << FairLogger::endl;
69 }
70 // -------------------------------------------------------------------------
71 
72 // ----- Point x coordinate from linear extrapolation ------------------
73 Double_t ERNeuRadPoint::GetX(Double_t z) const
74 {
75  // cout << fZ << " " << z << " " << fZ_out << endl;
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 // ----- Point y coordinate from linear extrapolation ------------------
83 Double_t ERNeuRadPoint::GetY(Double_t z) const
84 {
85  if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
86  Double_t dz = fZ_out - fZ;
87  // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
88  return ( fY + (z-fZ) / dz * (fY_out-fY) );
89 }
90 // -------------------------------------------------------------------------
91 
92 // ----- Public method IsUsable ----------------------------------------
94 {
95  Double_t dz = fZ_out - fZ;
96  if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
97  return kTRUE;
98 }
99 // -------------------------------------------------------------------------
100 
101 //-------------------------------------------------------------------------
102 Double_t ERNeuRadPoint::GetPIn() const {
103  return sqrt(fPx*fPx + fPy*fPy + fPz*fPz);
104 }
105 //-------------------------------------------------------------------------
106 
107 //-------------------------------------------------------------------------
108 Double_t ERNeuRadPoint::GetPOut() const {
109  return sqrt(fPx_out*fPx_out + fPy_out*fPy_out + fPz_out*fPz_out);
110 }
111 //-------------------------------------------------------------------------
112 Double_t ERNeuRadPoint::GetP(Double_t pointLen) const {
113  return GetPIn() + (GetPOut() - GetPIn())*pointLen/GetLength();
114 }
115 //-------------------------------------------------------------------------
116 Double_t ERNeuRadPoint::GetTime(Double_t pointLen) const {
117  return fTime + (fTimeOut - fTime)*pointLen/GetLength();
118 }
119 //-------------------------------------------------------------------------
120 Double_t ERNeuRadPoint::GetLength() const {
121  return sqrt((fX_out-fX)*(fX_out-fX) + (fY_out-fY)*(fY_out-fY) + (fZ_out-fZ)*(fZ_out-fZ) );
122 }
123 //-------------------------------------------------------------------------
124 
125 ClassImp(ERNeuRadPoint)
Bool_t IsUsable() const
virtual void Print(const Option_t *opt=0) const
virtual ~ERNeuRadPoint()
Double_t GetX(Double_t z) const
The data class for storing pieces of charged tracks in sensitive volumes in NeuRad.
Definition: ERNeuRadPoint.h:22