BmnRoot
Loading...
Searching...
No Matches
BmnSsdPoint.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- BmnSsdPoint source file -----
3// ----- Created 13.12.2018 by D. Baranov -----
4// -------------------------------------------------------------------------
5
6#include "BmnSsdPoint.h"
7
8#include "FairLogger.h"
9
10#include <sstream>
11
12using std::endl;
13using std::string;
14using std::stringstream;
15
16// ----- Default constructor -------------------------------------------
18 : FairMCPoint(),
19 fX_out(0.),
20 fY_out(0.),
21 fZ_out(0.),
22 fPx_out(0.),
23 fPy_out(0.),
24 fPz_out(0.),
25 fPid(0),
26 fIndex(0),
27 fFlag(0)
28{
29}
30// -------------------------------------------------------------------------
31
32
33
34// ----- Standard constructor ------------------------------------------
35BmnSsdPoint::BmnSsdPoint(Int_t trackID, Int_t detID, TVector3 posIn,
36 TVector3 posOut, TVector3 momIn, TVector3 momOut,
37 Double_t tof, Double_t length, Double_t eLoss,
38 Int_t pid, Int_t eventId, Int_t index, Short_t flag)
39 : FairMCPoint(trackID, detID, posIn, momIn, tof, length, eLoss, eventId),
40 fX_out(posOut.X()),
41 fY_out(posOut.Y()),
42 fZ_out(posOut.Z()),
43 fPx_out(momOut.Px()),
44 fPy_out(momOut.Py()),
45 fPz_out(momOut.Pz()),
46 fPid(pid),
47 fIndex(index),
48 fFlag(flag)
49{
50 SetLink(FairLink(kMCTrack, trackID));
51}
52// -------------------------------------------------------------------------
53
54
55
56// ----- Destructor ----------------------------------------------------
58// -------------------------------------------------------------------------
59
60
61
62// ----- Copy constructor with event and epoch time --------------------
63BmnSsdPoint::BmnSsdPoint(const BmnSsdPoint& point, Int_t eventId,
64 Double_t eventTime, Double_t epochTime)
65 : FairMCPoint(point),
66 fX_out(point.fX_out),
67 fY_out(point.fY_out),
68 fZ_out(point.fZ_out),
69 fPx_out(point.fPx_out),
70 fPy_out(point.fPy_out),
71 fPz_out(point.fPz_out),
72 fPid(point.fPid),
73 fIndex(point.fIndex),
74 fFlag(point.fFlag)
75
76{
77 // *this = point;
78 if ( eventId > 0 ) fEventId = eventId;
79 fTime = point.GetTime() + eventTime - epochTime;
80}
81// -------------------------------------------------------------------------
82
83
84
85// ----- Point x coordinate from linear extrapolation ------------------
86Double_t BmnSsdPoint::GetX(Double_t z) const {
87 if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fX_out+fX)/2.;
88 Double_t dz = fZ_out - fZ;
89 return ( fX + (z-fZ) / dz * (fX_out-fX) );
90}
91// -------------------------------------------------------------------------
92
93
94
95// ----- Point y coordinate from linear extrapolation ------------------
96Double_t BmnSsdPoint::GetY(Double_t z) const {
97 if ( (fZ_out-z)*(fZ-z) >= 0. ) return (fY_out+fY)/2.;
98 Double_t dz = fZ_out - fZ;
99 // if ( TMath::Abs(dz) < 1.e-3 ) return (fY_out+fY)/2.;
100 return ( fY + (z-fZ) / dz * (fY_out-fY) );
101}
102// -------------------------------------------------------------------------
103
104
105
106// ----- Public method IsUsable ----------------------------------------
107Bool_t BmnSsdPoint::IsUsable() const {
108 Double_t dz = fZ_out - fZ;
109 if ( TMath::Abs(dz) < 1.e-4 ) return kFALSE;
110 return kTRUE;
111}
112// -------------------------------------------------------------------------
113
114
115
116// ----- String output -------------------------------------------------
118{
119 stringstream ss;
120 ss << "SsdPoint: track ID " << fTrackID << ", detector ID "
121 << fDetectorID << endl;
122 ss << " IN Position (" << fX << ", " << fY
123 << ", " << fZ << ") cm" << endl;
124 ss << " OUT Position (" << fX_out << ", " << fY_out
125 << ", " << fZ_out << ") cm" << endl;
126 ss << " Momentum (" << fPx << ", " << fPy << ", " << fPz
127 << ") GeV" << endl;
128 ss << " Time " << fTime << " ns, Length " << fLength
129 << " cm, Energy loss " << fELoss*1.0e06 << " keV" << endl;
130 return ss.str();
131}
132// -------------------------------------------------------------------------
@ kMCTrack
Bool_t IsUsable() const
Double_t GetY(Double_t z) const
std::string ToString() const
Double32_t fZ_out
virtual ~BmnSsdPoint()
Double32_t fX_out
Double32_t fY_out
Double_t GetX(Double_t z) const