68 const int sectorPhi,
const double tanStereoAngle)
const {
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);
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;
84 for (
int bc = hits.front().getBC(); bc < bc_end; bc++) {
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) {
97 for (
unsigned int ib = 0; ib <
kPlanes; ib++) {
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()) );
109 if (vmm_same.size() > 1) {
111 std::ranges::sort(vmm_same, {}, &std::pair<int, float>::second);
112 for (
auto pair: vmm_same) to_erase.push_back(
pair.first);
114 std::sort(to_erase.rbegin(), to_erase.rend());
116 for (
auto l : to_erase) {
117 hits_now.erase(hits_now.begin() + l);
124 for (
unsigned int k = 0; k < hits_now.size(); k++) {
125 if (
static_cast<unsigned int>(hits_now[k]->getPlane()) != ib)
continue;
127 if (hits_now[k]->getART() == ia) addc_same.emplace_back(k, hits_now[k]->getGlobalStrip());
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);
138 std::sort(to_erase.rbegin(), to_erase.rend());
139 for (
auto l : to_erase) {
140 hits_now.erase(hits_now.begin() + l);
146 for (
auto &road : roads) {
148 if (!road.getHitVector().empty()) road.incrementAge(bc_wind);
149 if (!hits_now.empty()) road.addHits(hits_now);
151 if (road.checkCoincidences(bc_wind) && bc >= (bc_start - 1)) {
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(
"------------------------------------------------------------------");
158 std::vector<int> bcidVec;
159 for (
const auto &
hit: road.getHitVector()) {
160 bcidVec.push_back(
hit.getBC());
162 std::ranges::sort(bcidVec);
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){
172 bcidVal = bcidVec[i];
174 if (bcidCount > modeCount) {
175 modeCount = bcidCount;
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);
200 slope.
phi = std::atan(slope.
mx/slope.
my);
202 slope.
lowRes = road.evaluateLowRes();
204 diamondSlopes.push_back(slope);
MMT_Diamond(const int diamXthreshold, const bool uv, const int diamUVthreshold, const int roadSize, const int olapEtaUp, const int olapEtaDown, const int olapStereoUp, const int olapStereoDown)