68 {
69
70
71 std::ranges::sort(hits, [](
const MMT_Hit& h1,
const MMT_Hit& h2){
return h1.getBC() <
h2.getBC(); });
72 const int bc_start =
hits.front().getBC();
73 const int bc_end =
hits.front().getBC() + 16;
74 ATH_MSG_DEBUG(
"Window Start: " << bc_start <<
" - Window End: " << bc_end);
75
76
77 std::vector<const MMT_Hit*> hits_now;
78 std::vector< std::pair<int, float> > vmm_same;
79 std::vector< std::pair<int, int> > addc_same;
80 std::vector<int> to_erase;
81
82
83 unsigned int ibc = 0;
84 for (
int bc =
hits.front().getBC(); bc < bc_end; bc++) {
85
86 hits_now.clear();
87
88 for (
unsigned int j = ibc;
j <
hits.size();
j++) {
89 if (hits[j].getBC() == bc) hits_now.push_back(&hits[j]);
90 else if (hits[j].getBC() > bc) {
92 break;
93 }
94 }
95
96
98
100 vmm_same.clear();
102 for (const auto &hit_pointer: hits_now) {
103 if (static_cast<unsigned int>(hit_pointer->getPlane()) != ib) continue;
104 if (hit_pointer->getVMM() == j){
105 vmm_same.push_back( std::make_pair(k, hit_pointer->getTime()) );
106 }
108 }
109 if (vmm_same.size() > 1) {
110 to_erase.clear();
111 std::ranges::sort(vmm_same, {}, &std::pair<int, float>::second);
112 for (auto pair: vmm_same) to_erase.push_back(pair.first);
113
114 std::sort(to_erase.rbegin(), to_erase.rend());
115 to_erase.pop_back();
116 for (auto l : to_erase) {
117 hits_now.erase(hits_now.begin() + l);
118 }
119 }
120 }
121
123 addc_same.clear();
124 for (
unsigned int k = 0;
k < hits_now.size();
k++) {
125 if (static_cast<unsigned int>(hits_now[k]->getPlane()) != ib) continue;
126
127 if (hits_now[k]->getART() == ia) addc_same.emplace_back(k, hits_now[k]->getGlobalStrip());
128 }
129
131
132 to_erase.clear();
133
134 std::ranges::sort(addc_same, {}, &std::pair<int, int>::second);
135 for (
unsigned int it =
kMaxHitsPerART;
it < addc_same.size();
it++) to_erase.push_back(addc_same[it].first);
136
137
138 std::sort(to_erase.rbegin(), to_erase.rend());
139 for (auto l : to_erase) {
140 hits_now.erase(hits_now.begin() + l);
141 }
142 }
143 }
144 }
145
146 for (auto &road : roads) {
147
148 if (!road.getHitVector().empty()) road.incrementAge(bc_wind);
149 if (!hits_now.empty()) road.addHits(hits_now);
150
151 if (road.checkCoincidences(bc_wind) && bc >= (bc_start - 1)) {
152
153 ATH_MSG_DEBUG(
"------------------------------------------------------------------");
155 ATH_MSG_DEBUG(
"Road (x, u, v, count): (" << road.iRoadx() <<
", " << road.iRoadu() <<
", " << road.iRoadv() <<
", " << road.countHits() <<
")");
156 ATH_MSG_DEBUG(
"------------------------------------------------------------------");
157
158 std::vector<int> bcidVec;
159 for (
const auto &
hit: road.getHitVector()) {
160 bcidVec.push_back(
hit.getBC());
161 }
162 std::ranges::sort(bcidVec);
163
164
165
166 int bcidVal=bcidVec[0], bcidCount=1, modeCount=1, bcidMode=bcidVec[0];
167 for (
unsigned int i=1;
i<bcidVec.size();
i++){
168 if (bcidVec[i] == bcidVal){
169 bcidCount++;
170 } else {
171 bcidCount = 1;
172 bcidVal = bcidVec[
i];
173 }
174 if (bcidCount > modeCount) {
175 modeCount = bcidCount;
176 bcidMode = bcidVal;
177 }
178 }
179
180 slope_t slope;
183 slope.
iRoad = road.iRoadx();
184 slope.
iRoadu = road.iRoadu();
185 slope.
iRoadv = road.iRoadv();
186 slope.
xCount = road.countXHits();
187 slope.
uCount = road.countUHits();
188 slope.
age = slope.
BC - bc_start;
189 slope.
mxl = road.mxl();
193 slope.
mx = (slope.
uavg-slope.
vavg)/(2.*tanStereoAngle);
194 const double theta = std::atan(std::hypot(slope.
mx, slope.
my));
196 slope.
eta = Acts::AngleHelpers::etaFromTheta(slope.
theta);
199
200 slope.
phi = std::atan(slope.
mx/slope.
my);
202 slope.
lowRes = road.evaluateLowRes();
203
204 diamondSlopes.push_back(slope);
205 }
206 }
207 }
208}
Scalar theta() const
theta method
#define ATH_MSG_DEBUG(x,...)
double phiShift(const int n, const double phi, const SideType side) const
SideType
Detector side. The value is the sign of z, so that it can be used as a sign (e.g. Acts::copySign).
constexpr int kMaxHitsPerART
Hits that one ART ASIC can forward per bunch crossing.
constexpr int kARTsPerLayer
ART ASICs of one sector layer (2 ADDC cards x 2 ART ASICs).
constexpr int kVMMsPerLayer
VMMs of one sector layer (128).
constexpr int kPlanes
Planes of the MM octuplet (2 multilayers x 4 gas gaps).
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.