SND@LHC Software
Loading...
Searching...
No Matches
snd::analysis_tools::USPlane Class Reference

#include <sndUSPlane.h>

Collaboration diagram for snd::analysis_tools::USPlane:

Classes

struct  rl_pair
 
struct  sl_pair
 
struct  USHit
 

Public Member Functions

 USPlane (std::vector< MuFilterHit * > snd_hits, Configuration configuration, MuFilter *muon_filter_geometry, int station)
 
const sl_pair< int > GetNHits () const
 
const int GetStation () const
 
const sl_pair< double > GetTotQdc () const
 
const sl_pair< double > GetTotEnergy () const
 
const rl_pair< double > GetSideQdc () const
 
const rl_pair< double > GetBarQdc (int bar_to_compute) const
 
const sl_pair< int > GetBarNHits (int bar_to_compute) const
 
const std::vector< USHitGetHits () const
 
double HasShower () const
 
void FindCentroid ()
 
ROOT::Math::XYZPoint GetCentroid () const
 
ROOT::Math::XYZPoint GetCentroidError () const
 
void TimeFilter (double min_timestamp, double max_timestamp)
 

Private Attributes

std::vector< USHithits_
 
Configuration configuration_
 
ROOT::Math::XYZPoint centroid_
 
ROOT::Math::XYZPoint centroid_error_
 
int station_
 

Detailed Description

Definition at line 13 of file sndUSPlane.h.

Constructor & Destructor Documentation

◆ USPlane()

snd::analysis_tools::USPlane::USPlane ( std::vector< MuFilterHit * >  snd_hits,
Configuration  configuration,
MuFilter muon_filter_geometry,
int  station 
)

Definition at line 12 of file sndUSPlane.cxx.

12 : configuration_(configuration), centroid_(std::nan(""), std::nan(""), std::nan("")), centroid_error_(std::nan(""), std::nan(""),std::nan("")), station_(station)
13{
14 for ( auto mu_hit : snd_hits)
15 {
16 for (int i{0}; i < 16; ++i)
17 {
18 if (mu_hit->isMasked(i) || mu_hit->GetSignal(i) < -990.) continue;
19 USHit hit;
20 hit.bar = static_cast<int>(mu_hit->GetDetectorID() % 1000);
21 hit.channel_index = 16 * hit.bar + i;
22 hit.timestamp = mu_hit->GetTime(i);
23 hit.qdc = mu_hit->GetSignal(i);
24 hit.is_large = !mu_hit->isShort(i);
25
26 TVector3 A, B;
27 int detectorID = mu_hit->GetDetectorID();
28 muon_filter_geometry->GetPosition(detectorID, A, B);
29 hit.is_right = i > 7 ? true : false;
30 hit.x = hit.is_right ? B.X() : A.X();
31 hit.y = A.Y();
32 hit.z = A.Z();
33 hits_.push_back(hit);
34 }
35 }
36}
void GetPosition(Int_t id, TVector3 &vLeft, TVector3 &vRight)
Definition MuFilter.cxx:639
ROOT::Math::XYZPoint centroid_
Definition sndUSPlane.h:70
std::vector< USHit > hits_
Definition sndUSPlane.h:68
ROOT::Math::XYZPoint centroid_error_
Definition sndUSPlane.h:71
int i
Definition ShipAna.py:86

Member Function Documentation

◆ FindCentroid()

void snd::analysis_tools::USPlane::FindCentroid ( )

Definition at line 38 of file sndUSPlane.cxx.

39{
40 // min number of hit in the plane to attempt to find a centroid
41 if (static_cast<int>(hits_.size()) < configuration_.us_min_n_hits_for_centroid)
42 {
43 // std::cout<<"Not enough hits in US plane " << station_ <<" to find centroid\n";
44 return;
45 }
46
47 double total_qdc = GetTotQdc().large;
48 if (total_qdc > 0.0)
49 {
50 for (const auto &hit : hits_)
51 {
52 // weigthed sum
53 double weighted_sum_x{0.0}, weighted_sum_y{0.0}, weighted_sum_z{0.0};
54 double total_qdc_positive{0.0};
55
56 if (hit.qdc > 0.0)
57 {
58 weighted_sum_x += hit.x * hit.qdc;
59 weighted_sum_y += hit.y * hit.qdc;
60 weighted_sum_z += hit.z * hit.qdc;
61 total_qdc_positive += hit.qdc;
62 }
63
64 double x = weighted_sum_x / total_qdc_positive;
65 double y = weighted_sum_y / total_qdc_positive;
66 double z = weighted_sum_z / total_qdc_positive;
67 centroid_.SetXYZ(x, y, z);
68 }
69 }
71}
const sl_pair< double > GetTotQdc() const

◆ GetBarNHits()

const snd::analysis_tools::USPlane::sl_pair< int > snd::analysis_tools::USPlane::GetBarNHits ( int  bar_to_compute) const

Definition at line 135 of file sndUSPlane.cxx.

136{
137 sl_pair<int> bar_hit{0, 0};
138 for (const auto &hit : hits_)
139 {
140 if (hit.bar != bar_to_compute)
141 continue;
142 else
143 {
144 if (hit.is_large)
145
146 bar_hit.large++;
147 else
148 bar_hit.small++;
149
150 }
151 }
152 return bar_hit;
153}

◆ GetBarQdc()

const snd::analysis_tools::USPlane::rl_pair< double > snd::analysis_tools::USPlane::GetBarQdc ( int  bar_to_compute) const

Definition at line 114 of file sndUSPlane.cxx.

115{
116 rl_pair<double> bar_qdc{0.0, 0.0};
117 for (const auto &hit : hits_)
118 {
119 if (hit.bar != bar_to_compute)
120 continue;
121 else
122 {
123 if (hit.is_large)
124 {
125 if (hit.is_right)
126 bar_qdc.right += hit.qdc;
127 else
128 bar_qdc.left += hit.qdc;
129 }
130 }
131 }
132 return bar_qdc;
133}

◆ GetCentroid()

ROOT::Math::XYZPoint snd::analysis_tools::USPlane::GetCentroid ( ) const
inline

Definition at line 62 of file sndUSPlane.h.

62{ return centroid_; };

◆ GetCentroidError()

ROOT::Math::XYZPoint snd::analysis_tools::USPlane::GetCentroidError ( ) const
inline

Definition at line 63 of file sndUSPlane.h.

63{ return centroid_error_; };

◆ GetHits()

const std::vector< USHit > snd::analysis_tools::USPlane::GetHits ( ) const
inline

Definition at line 58 of file sndUSPlane.h.

58{ return hits_; };

◆ GetNHits()

const snd::analysis_tools::USPlane::sl_pair< int > snd::analysis_tools::USPlane::GetNHits ( ) const

Definition at line 163 of file sndUSPlane.cxx.

164{
165 sl_pair<int> counts{0, 0};
166 counts.large = std::count_if(hits_.begin(), hits_.end(), [](auto &hit)
167 { return hit.is_large; });
168 counts.small = static_cast<int>(hits_.size()) - counts.large;
169
170 return counts;
171}

◆ GetSideQdc()

const snd::analysis_tools::USPlane::rl_pair< double > snd::analysis_tools::USPlane::GetSideQdc ( ) const

Definition at line 98 of file sndUSPlane.cxx.

99{
100 rl_pair<double> side_qdc{0.0, 0.0};
101 for (const auto &hit : hits_)
102 {
103 if (hit.is_large)
104 {
105 if (hit.is_right)
106 side_qdc.right += hit.qdc;
107 else
108 side_qdc.left += hit.qdc;
109 }
110 }
111 return side_qdc;
112}

◆ GetStation()

const int snd::analysis_tools::USPlane::GetStation ( ) const
inline

Definition at line 51 of file sndUSPlane.h.

51{ return station_; };

◆ GetTotEnergy()

const snd::analysis_tools::USPlane::sl_pair< double > snd::analysis_tools::USPlane::GetTotEnergy ( ) const

Definition at line 86 of file sndUSPlane.cxx.

87{
88 sl_pair<double> tot_energy{0.0, 0.0};
89 sl_pair<double> tot_qdc = GetTotQdc();
90
91 tot_energy.large = tot_qdc.large *configuration_.us_qdc_to_gev;
92 tot_energy.small = tot_qdc.small *configuration_.us_qdc_to_gev;
93
94 return tot_energy;
95}

◆ GetTotQdc()

const snd::analysis_tools::USPlane::sl_pair< double > snd::analysis_tools::USPlane::GetTotQdc ( ) const

Definition at line 73 of file sndUSPlane.cxx.

74{
75 sl_pair<double> totQdc{0.0, 0.0};
76 for (const auto &hit : hits_)
77 {
78 if (hit.is_large)
79 totQdc.large += hit.qdc;
80 else
81 totQdc.small += hit.qdc;
82 }
83 return totQdc;
84}

◆ HasShower()

double snd::analysis_tools::USPlane::HasShower ( ) const
inline

Definition at line 59 of file sndUSPlane.h.

59{ return static_cast<int>(hits_.size()) >= configuration_.us_min_n_hits_for_centroid; };

◆ TimeFilter()

void snd::analysis_tools::USPlane::TimeFilter ( double  min_timestamp,
double  max_timestamp 
)

Definition at line 155 of file sndUSPlane.cxx.

156{
157 hits_.erase(std::remove_if(hits_.begin(), hits_.end(),
158 [&](auto &hit)
159 { return hit.timestamp < min_timestamp || hit.timestamp > max_timestamp; }),
160 hits_.end());
161}

Member Data Documentation

◆ centroid_

ROOT::Math::XYZPoint snd::analysis_tools::USPlane::centroid_
private

Definition at line 70 of file sndUSPlane.h.

◆ centroid_error_

ROOT::Math::XYZPoint snd::analysis_tools::USPlane::centroid_error_
private

Definition at line 71 of file sndUSPlane.h.

◆ configuration_

Configuration snd::analysis_tools::USPlane::configuration_
private

Definition at line 69 of file sndUSPlane.h.

◆ hits_

std::vector<USHit> snd::analysis_tools::USPlane::hits_
private

Definition at line 68 of file sndUSPlane.h.

◆ station_

int snd::analysis_tools::USPlane::station_
private

Definition at line 72 of file sndUSPlane.h.


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