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

#include <MTCDetHit.h>

Inheritance diagram for MTCDetHit:
Collaboration diagram for MTCDetHit:

Public Member Functions

 MTCDetHit ()
 
 MTCDetHit (const MTCDetHit &hit)=default
 
MTCDetHitoperator= (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
 
- 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

 ClassDef (MTCDetHit, 6)
 

Private Attributes

Float_t signals = 0
 
Float_t time
 
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.

◆ 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 Float_t x_temp = 0.0, y_temp = 0.0, z_temp = 0.0;
79 for (auto* pt : points) {
80 signal_sum += pt->GetEnergyLoss();
81 // Track earliest arrival time
82 Float_t arrival = pt->GetTime();
83 earliest_to_B = std::min(earliest_to_B, arrival);
84 x_temp += pt->GetX();
85 y_temp += pt->GetY();
86 z_temp += pt->GetZ();
87 }
88 time = gRandom->Gaus(earliest_to_B, time_res);
89 // for scintillating tiles set simulated coordinates so far as the realistic
90 // geometry is not yet done.
91 Xch = x_temp / n;
92 Ych = y_temp / n;
93 Zch = z_temp / n;
94 signals = signal_sum;
95 return;
96 }
97
98 // Fiber hit processing
99 total_light_yield = 0.0f;
100
101 TVector3 sipmA, sipmB;
102 MTCDet->GetSiPMPosition(SiPMChan, sipmA, sipmB);
103 // Define only X and Z coordinates for Sci-Fi.
104 Xch = sipmB.X();
105 Zch = sipmB.Z();
106
107 for (size_t i = 0; i < n; ++i) {
108 auto* pt = points[i];
109 Float_t energy = pt->GetEnergyLoss();
110 Float_t weight = weights[i];
111 Float_t signal = energy * weight;
112
113 // Distance from deposit to SiPM
114 TVector3 impact(pt->GetX(), pt->GetY(), pt->GetZ());
115 const Float_t distance = (sipmB - impact).Mag();
116
117 // Light yield before attenuation
118 Float_t light_yield = signal * 1e6f * 0.16f;
119 light_yield *= light_attenuation(distance);
120 total_light_yield += light_yield;
121
122 // Track earliest arrival time
123 Float_t arrival = pt->GetTime() + distance * inv_signal_speed;
124 earliest_to_A = std::min(earliest_to_A, arrival);
125 }
126
127 // Apply statistical smearing and saturation
128 const Int_t smeared_light_yield = gRandom->Poisson(total_light_yield);
129 const Float_t n_pixels = sipm_saturation(smeared_light_yield);
130 signals = n_pixels_to_qdc(n_pixels);
131
132 // Final hit decision and time
133 hit_flag = (smeared_light_yield > n_photons_min);
134 flag = hit_flag;
135 time = gRandom->Gaus(earliest_to_A, time_res);
136}
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:97
ROOT pt
Definition: makeDecay.py:125
ROOT signal
Definition: runPythia8.py:106

◆ ~MTCDetHit()

MTCDetHit::~MTCDetHit ( )
overridedefault

Destructor

Member Function Documentation

◆ ClassDef()

MTCDetHit::ClassDef ( MTCDetHit  ,
 
)
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 139 of file MTCDetHit.cxx.

139 {
140 // to be calculated from digis and calibration constants, missing!
141 return signals;
142}

◆ 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()

void MTCDetHit::Print ( ) const

Definition at line 145 of file MTCDetHit.cxx.

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

◆ 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.

◆ signals

Float_t MTCDetHit::signals = 0
private

Definition at line 68 of file MTCDetHit.h.

◆ time

Float_t MTCDetHit::time
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: