FairShip
Loading...
Searching...
No Matches
TimeDetHit Class Reference

#include <TimeDetHit.h>

Inheritance diagram for TimeDetHit:
[legend]
Collaboration diagram for TimeDetHit:
[legend]

Public Member Functions

 TimeDetHit ()
 TimeDetHit (TimeDetPoint *p, Double_t t0)
 ~TimeDetHit () override=default
 TimeDetHit (const TimeDetHit &point)=default
TimeDetHit & operator= (const TimeDetHit &point)=default
Double_t GetX () const
Double_t GetY () const
Double_t GetZ () const
TVector3 GetXYZ () const
TGeoNode * GetNode () const
std::vector< double > GetTime (Double_t x) const
std::vector< double > GetTime () const
std::vector< double > GetMeasurements () const
void SetTDC (Float_t val1, Float_t val2)
void Print () const
void Dist (Float_t x, Float_t &lpos, Float_t &lneg) const
Double_t Resol (Double_t x) const
void setInvalid ()
void setIsValid ()
bool isValid () const
void Print (const Option_t *opt="") const override
Public Member Functions inherited from SHiP::DetectorHit
 DetectorHit ()
 DetectorHit (Int_t detID, Float_t digi)
 ~DetectorHit () override=default
Double_t GetDigi () const
Int_t GetDetectorID () const
void SetDigi (Float_t d)
void SetDetectorID (Int_t detID)
void Print (const Option_t *opt="") const override

Private Member Functions

 ClassDefOverride (TimeDetHit, 4)

Private Attributes

Bool_t flag {true}
 flag
Float_t t_1 {0}
Float_t t_2 {0}
 TDC on both sides.

Static Private Attributes

static constexpr Double_t v_drift = 15.
static constexpr Double_t par [4] = {0.0272814, 109.303, 0, 0.0539487}

Additional Inherited Members

Protected Member Functions inherited from SHiP::DetectorHit
 ClassDefOverride (SHiP::DetectorHit, 1)
Protected Attributes inherited from SHiP::DetectorHit
Float_t fdigi
 digitized detector hit
Int_t fDetectorID
 Detector unique identifier.

Detailed Description

Definition at line 11 of file TimeDetHit.h.

Constructor & Destructor Documentation

◆ TimeDetHit() [1/3]

TimeDetHit::TimeDetHit ( )

Default constructor

Definition at line 23 of file TimeDetHit.cxx.

23: SHiP::DetectorHit() {}

◆ TimeDetHit() [2/3]

TimeDetHit::TimeDetHit ( TimeDetPoint * p,
Double_t t0 )

Constructor from TimeDetHit

Parameters
detIDDetector ID
t_1,t_2TDC on both sides
flagTrue/False, in case of pile up

Definition at line 27 of file TimeDetHit.cxx.

27 : SHiP::DetectorHit() {
28 if (!p) {
29 LOG(error) << "TimeDetHit: null TimeDetPoint pointer";
30 return;
31 }
32 fDetectorID = p->GetDetectorID();
33 Float_t lpos, lneg;
34 Dist(p->GetX(), lpos, lneg);
35 Double_t sigma = Resol(lneg); // in ns
36 t_1 = gRandom->Gaus(0, sigma) + lneg / v_drift + t0 + p->GetTime();
37 sigma = Resol(lpos); // in ns
38 t_2 = gRandom->Gaus(0, sigma) + lpos / v_drift + t0 + p->GetTime();
39}
Int_t fDetectorID
Detector unique identifier.
Definition DetectorHit.h:40
static constexpr Double_t v_drift
Definition TimeDetHit.h:56
Float_t t_1
Definition TimeDetHit.h:60
Double_t Resol(Double_t x) const
void Dist(Float_t x, Float_t &lpos, Float_t &lneg) const
Float_t t_2
TDC on both sides.
Definition TimeDetHit.h:60

◆ ~TimeDetHit()

TimeDetHit::~TimeDetHit ( )
overridedefault

Destructor

◆ TimeDetHit() [3/3]

TimeDetHit::TimeDetHit ( const TimeDetHit & point)
default

Copy constructor

Member Function Documentation

◆ ClassDefOverride()

TimeDetHit::ClassDefOverride ( TimeDetHit ,
4  )
private

◆ Dist()

void TimeDetHit::Dist ( Float_t x,
Float_t & lpos,
Float_t & lneg ) const

Definition at line 76 of file TimeDetHit.cxx.

76 {
77 TGeoNode* node = GetNode();
78 auto shape = dynamic_cast<TGeoBBox*>(node->GetVolume()->GetShape());
79 TVector3 pos = GetXYZ();
80 lpos = TMath::Abs(pos.X() + shape->GetDX() - x);
81 lneg = TMath::Abs(pos.X() - shape->GetDX() - x);
82}
TVector3 GetXYZ() const
TGeoNode * GetNode() const

◆ GetMeasurements()

std::vector< double > TimeDetHit::GetMeasurements ( ) const

Definition at line 73 of file TimeDetHit.cxx.

73{ return {t_1, t_2}; }

◆ GetNode()

TGeoNode * TimeDetHit::GetNode ( ) const

Definition at line 111 of file TimeDetHit.cxx.

111 {
112 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
113 TString path = "/Timing Detector_1/TimeDet_";
114 path += fDetectorID;
115 nav->cd(path);
116 return nav->GetCurrentNode();
117}

◆ GetTime() [1/2]

std::vector< double > TimeDetHit::GetTime ( ) const

Definition at line 56 of file TimeDetHit.cxx.

56 {
57 TGeoBBox* shape =
58 dynamic_cast<TGeoBBox*>(gGeoManager->GetVolume("TimeDet")->GetShape());
59 Double_t t0 = (t_1 + t_2) / 2. - shape->GetDX() / v_drift;
60 Float_t lpos, lneg;
61 lneg = (t_1 - t0) * v_drift;
62 lpos = (t_2 - t0) * v_drift;
63 Float_t r1 = Resol(lneg);
64 Float_t r2 = Resol(lpos);
65 Double_t dt = TMath::Sqrt(r1 * r1 + r2 * r2);
66 return {t0, dt};
67}

◆ GetTime() [2/2]

std::vector< double > TimeDetHit::GetTime ( Double_t x) const

Definition at line 42 of file TimeDetHit.cxx.

42 {
43 // calculate distance to left and right end
44 Float_t lpos, lneg;
45 Dist(x, lpos, lneg);
46 Double_t r = Resol(lneg);
47 Double_t w1 = 1. / (r * r);
48 r = Resol(lpos);
49 Double_t w2 = 1. / (r * r);
50 Double_t dt = 1. / TMath::Sqrt(w1 + w2);
51 Double_t t =
52 ((t_1 - lneg / v_drift) * w1 + (t_2 - lpos / v_drift) * w2) / (w1 + w2);
53 return {t, dt};
54}

◆ GetX()

Double_t TimeDetHit::GetX ( ) const

Accessors

Definition at line 96 of file TimeDetHit.cxx.

96 {
97 TVector3 pos = GetXYZ();
98 return pos.X();
99}

◆ GetXYZ()

TVector3 TimeDetHit::GetXYZ ( ) const

Definition at line 84 of file TimeDetHit.cxx.

84 {
85 TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
86 TGeoNode* node = GetNode();
87 auto shape = dynamic_cast<TGeoBBox*>(node->GetVolume()->GetShape());
88 Double_t origin[3] = {shape->GetOrigin()[0], shape->GetOrigin()[1],
89 shape->GetOrigin()[2]};
90 Double_t master[3] = {0, 0, 0};
91 nav->LocalToMaster(origin, master);
92 TVector3 pos = TVector3(master[0], master[1], master[2]);
93 return pos;
94}
origin(sTree, it)

◆ GetY()

Double_t TimeDetHit::GetY ( ) const

Definition at line 101 of file TimeDetHit.cxx.

101 {
102 TVector3 pos = GetXYZ();
103 return pos.Y();
104}

◆ GetZ()

Double_t TimeDetHit::GetZ ( ) const

Definition at line 106 of file TimeDetHit.cxx.

106 {
107 TVector3 pos = GetXYZ();
108 return pos.Z();
109}

◆ isValid()

bool TimeDetHit::isValid ( ) const
inline

Definition at line 53 of file TimeDetHit.h.

53{ return flag; }
Bool_t flag
flag
Definition TimeDetHit.h:59

◆ operator=()

TimeDetHit & TimeDetHit::operator= ( const TimeDetHit & point)
default

◆ Print() [1/2]

void TimeDetHit::Print ( ) const

Definition at line 120 of file TimeDetHit.cxx.

120 {
121 cout << "-I- TimeDetHit: TimeDet hit " << " in detector " << fDetectorID
122 << endl;
123 cout << " TDC left " << t_1 << " ns TDC right " << t_2 << " ns" << endl;
124}

◆ Print() [2/2]

void SHiP::DetectorHit::Print ( const Option_t * opt = "") const
inlineoverride

Output to screen

Definition at line 36 of file DetectorHit.h.

36{}

◆ Resol()

Double_t TimeDetHit::Resol ( Double_t x) const

Definition at line 69 of file TimeDetHit.cxx.

69 {
70 return par[0] * TMath::Exp((x - par[2]) / par[1]) + par[3];
71}
static constexpr Double_t par[4]
Definition TimeDetHit.h:57

◆ setInvalid()

void TimeDetHit::setInvalid ( )
inline

Definition at line 51 of file TimeDetHit.h.

51{ flag = false; }

◆ setIsValid()

void TimeDetHit::setIsValid ( )
inline

Definition at line 52 of file TimeDetHit.h.

52{ flag = true; }

◆ SetTDC()

void TimeDetHit::SetTDC ( Float_t val1,
Float_t val2 )
inline

Modifier

Definition at line 40 of file TimeDetHit.h.

40 {
41 t_1 = val1;
42 t_2 = val2;
43 }

Member Data Documentation

◆ flag

Bool_t TimeDetHit::flag {true}
private

flag

Definition at line 59 of file TimeDetHit.h.

59{true};

◆ par

Double_t TimeDetHit::par[4] = {0.0272814, 109.303, 0, 0.0539487}
staticconstexprprivate

Definition at line 57 of file TimeDetHit.h.

57{0.0272814, 109.303, 0, 0.0539487};

◆ t_1

Float_t TimeDetHit::t_1 {0}
private

Definition at line 60 of file TimeDetHit.h.

60{0}, t_2{0};

◆ t_2

Float_t TimeDetHit::t_2 {0}
private

TDC on both sides.

Definition at line 60 of file TimeDetHit.h.

60{0}, t_2{0};

◆ v_drift

Double_t TimeDetHit::v_drift = 15.
staticconstexprprivate

Definition at line 56 of file TimeDetHit.h.


The documentation for this class was generated from the following files: