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

#include <MTCDetHit.h>

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

Public Member Functions

 MTCDetHit ()
 MTCDetHit (const MTCDetHit &hit)=default
MTCDetHit & operator= (const MTCDetHit &hit)=default
 MTCDetHit (int detID, const std::vector< MTCDetPoint * > &, const std::vector< Float_t > &)
 ~MTCDetHit () override=default
void Print () const
Float_t GetSignal () const
Float_t GetTime () const
Int_t GetChannelID () const
Int_t GetLayer () const
Int_t GetStationType () const
Int_t GetSiPM () const
Int_t GetSiPMChan () const
TVector3 GetChannelCoordinates () const
Float_t GetEnergy () const
void setInvalid ()
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 (MTCDetHit, 6)

Private Attributes

Float_t signals = 0
Float_t time = 0
Float_t Xch = 0.0
Float_t Ych = 0.0
Float_t Zch = 0.0
Bool_t flag {true}
 flag

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 14 of file MTCDetHit.h.

Constructor & Destructor Documentation

◆ MTCDetHit() [1/3]

MTCDetHit::MTCDetHit ( )

Default constructor

Definition at line 52 of file MTCDetHit.cxx.

52: SHiP::DetectorHit() {}

◆ MTCDetHit() [2/3]

MTCDetHit::MTCDetHit ( const MTCDetHit & hit)
default

Copy constructor

◆ MTCDetHit() [3/3]

MTCDetHit::MTCDetHit ( int detID,
const std::vector< MTCDetPoint * > & points,
const std::vector< Float_t > & weights )

Definition at line 56 of file MTCDetHit.cxx.

57 {
58 auto* MTCDet =
59 dynamic_cast<MTCDetector*>(gROOT->GetListOfGlobals()->FindObject("MTC"));
60 if (!MTCDet) {
61 LOG(fatal) << "MTCDetHit: MTCDetector not found";
62 return;
63 }
64
65 fDetectorID = SiPMChan; // Set the detector ID
66 // Determine plane type once
67 const int plane_type = GetStationType();
68
69 Float_t total_light_yield = 0.0f;
70 Float_t earliest_to_A = std::numeric_limits<Float_t>::max();
71 Float_t earliest_to_B = std::numeric_limits<Float_t>::max();
72 const size_t n = points.size();
73 Float_t signal_sum = 0.0f;
74 bool hit_flag = false;
75
76 // Separate handling for scintillating mat (plane_type == 2)
77 if (plane_type == 2) {
78 if (points.empty()) {
79 // No deposits: avoid dividing by n == 0 (NaN coordinates) and seeding
80 // the time from FLT_MAX.
81 flag = false;
82 return;
83 }
84 Float_t x_temp = 0.0, y_temp = 0.0, z_temp = 0.0;
85 for (auto* pt : points) {
86 signal_sum += pt->GetEnergyLoss();
87 // Track earliest arrival time
88 Float_t arrival = pt->GetTime();
89 earliest_to_B = std::min(earliest_to_B, arrival);
90 x_temp += pt->GetX();
91 y_temp += pt->GetY();
92 z_temp += pt->GetZ();
93 }
94 time = gRandom->Gaus(earliest_to_B, time_res);
95 // for scintillating tiles set simulated coordinates so far as the realistic
96 // geometry is not yet done.
97 Xch = x_temp / n;
98 Ych = y_temp / n;
99 Zch = z_temp / n;
100 signals = signal_sum;
101 return;
102 }
103
104 // Fiber hit processing
105 total_light_yield = 0.0f;
106
107 TVector3 sipmA, sipmB;
108 MTCDet->GetSiPMPosition(SiPMChan, sipmA, sipmB);
109 // Define only X and Z coordinates for Sci-Fi.
110 Xch = sipmB.X();
111 Zch = sipmB.Z();
112
113 for (size_t i = 0; i < n; ++i) {
114 auto* pt = points[i];
115 Float_t energy = pt->GetEnergyLoss();
116 Float_t weight = weights[i];
117 Float_t signal = energy * weight;
118
119 // Distance from deposit to SiPM
120 TVector3 impact(pt->GetX(), pt->GetY(), pt->GetZ());
121 const Float_t distance = (sipmB - impact).Mag();
122
123 // Light yield before attenuation
124 Float_t light_yield = signal * 1e6f * 0.16f;
125 light_yield *= light_attenuation(distance);
126 total_light_yield += light_yield;
127
128 // Track earliest arrival time
129 Float_t arrival = pt->GetTime() + distance * inv_signal_speed;
130 earliest_to_A = std::min(earliest_to_A, arrival);
131 }
132
133 // Apply statistical smearing and saturation
134 const Int_t smeared_light_yield = gRandom->Poisson(total_light_yield);
135 const Float_t n_pixels = sipm_saturation(smeared_light_yield);
136 signals = n_pixels_to_qdc(n_pixels);
137
138 // Final hit decision and time
139 hit_flag = (smeared_light_yield > n_photons_min);
140 flag = hit_flag;
141 time = gRandom->Gaus(earliest_to_A, time_res);
142}
Float_t time
Definition MTCDetHit.h:69
Int_t GetStationType() const
Definition MTCDetHit.h:53
Bool_t flag
flag
Definition MTCDetHit.h:71
Float_t signals
Definition MTCDetHit.h:68
Float_t Ych
Definition MTCDetHit.h:70
Float_t Zch
Definition MTCDetHit.h:70
Float_t Xch
Definition MTCDetHit.h:70
Int_t fDetectorID
Detector unique identifier.
Definition DetectorHit.h:40
int i
Definition ShipAna.py:108

◆ ~MTCDetHit()

MTCDetHit::~MTCDetHit ( )
overridedefault

Destructor

Member Function Documentation

◆ ClassDefOverride()

MTCDetHit::ClassDefOverride ( MTCDetHit ,
6  )
private

◆ GetChannelCoordinates()

TVector3 MTCDetHit::GetChannelCoordinates ( ) const
inline

Definition at line 58 of file MTCDetHit.h.

58{ return TVector3(Xch, Ych, Zch); }

◆ GetChannelID()

Int_t MTCDetHit::GetChannelID ( ) const
inline

Definition at line 49 of file MTCDetHit.h.

49{ return fDetectorID; }

◆ GetEnergy()

Float_t MTCDetHit::GetEnergy ( ) const

Definition at line 145 of file MTCDetHit.cxx.

145 {
146 // to be calculated from digis and calibration constants, missing!
147 return signals;
148}

◆ GetLayer()

Int_t MTCDetHit::GetLayer ( ) const
inline

Definition at line 50 of file MTCDetHit.h.

50 {
51 return static_cast<int>(fDetectorID / 1000000) % 100;
52 }

◆ GetSignal()

Float_t MTCDetHit::GetSignal ( ) const
inline

Definition at line 31 of file MTCDetHit.h.

31{ return signals; };

◆ GetSiPM()

Int_t MTCDetHit::GetSiPM ( ) const
inline

Definition at line 56 of file MTCDetHit.h.

56{ return (static_cast<int>(fDetectorID / 1000) % 10); }

◆ GetSiPMChan()

Int_t MTCDetHit::GetSiPMChan ( ) const
inline

Definition at line 57 of file MTCDetHit.h.

57{ return (fDetectorID % 1000); }

◆ GetStationType()

Int_t MTCDetHit::GetStationType ( ) const
inline

Definition at line 53 of file MTCDetHit.h.

53 {
54 return static_cast<int>(fDetectorID / 100000) % 10;
55 }

◆ GetTime()

Float_t MTCDetHit::GetTime ( ) const
inline

Definition at line 32 of file MTCDetHit.h.

32{ return time; };

◆ isValid()

bool MTCDetHit::isValid ( ) const
inline

Definition at line 61 of file MTCDetHit.h.

61{ return flag; }

◆ operator=()

MTCDetHit & MTCDetHit::operator= ( const MTCDetHit & hit)
default

◆ Print() [1/2]

void MTCDetHit::Print ( ) const

Definition at line 151 of file MTCDetHit.cxx.

151 {
152 std::cout << Form(
153 "MTCDetHit: Detector ID %d, Layer %d, Station Type %d, SiPM %d, Channel "
154 "%d, Signal %.2f, Time %.3f \n",
156 signals, time);
157}
Int_t GetSiPMChan() const
Definition MTCDetHit.h:57
Int_t GetSiPM() const
Definition MTCDetHit.h:56
Int_t GetLayer() const
Definition MTCDetHit.h:50

◆ 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{}

◆ setInvalid()

void MTCDetHit::setInvalid ( )
inline

Definition at line 60 of file MTCDetHit.h.

60{ flag = false; }

Member Data Documentation

◆ flag

Bool_t MTCDetHit::flag {true}
private

flag

Definition at line 71 of file MTCDetHit.h.

71{true};

◆ signals

Float_t MTCDetHit::signals = 0
private

Definition at line 68 of file MTCDetHit.h.

◆ time

Float_t MTCDetHit::time = 0
private

Definition at line 69 of file MTCDetHit.h.

◆ Xch

Float_t MTCDetHit::Xch = 0.0
private

Definition at line 70 of file MTCDetHit.h.

◆ Ych

Float_t MTCDetHit::Ych = 0.0
private

Definition at line 70 of file MTCDetHit.h.

◆ Zch

Float_t MTCDetHit::Zch = 0.0
private

Definition at line 70 of file MTCDetHit.h.


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