68 std::sort(
hits.begin(),
hits.end(), [](
const auto &
h1,
const auto &h2){ return h1->getBC() < h2->getBC(); });
69 const int bc_start =
hits.front()->getBC();
70 const int bc_end =
hits.front()->getBC() + 16;
71 ATH_MSG_DEBUG(
"Window Start: " << bc_start <<
" - Window End: " << bc_end);
73 std::vector<std::shared_ptr<MMT_Hit> > hits_now;
74 std::vector< std::pair<int, float> > vmm_same;
75 std::vector< std::pair<int, int> > addc_same;
76 std::vector<int> to_erase;
80 for (
int bc =
hits.front()->getBC(); bc < bc_end; bc++) {
84 for (
unsigned int j = ibc; j <
hits.size(); j++) {
85 if (
hits[j]->getBC() == bc) hits_now.push_back(
hits[j]);
86 else if (
hits[j]->getBC() > bc) {
93 for (
unsigned int ib = 0;
ib < 8;
ib++) {
95 for (
int j = 0; j < n_vmm; j++) {
98 for (
const auto &hit_pointer: hits_now) {
99 if (
static_cast<unsigned int>(hit_pointer->getPlane()) !=
ib)
continue;
100 if (hit_pointer->getVMM() == j){
101 vmm_same.push_back( std::make_pair(
k, hit_pointer->getTime()) );
105 if (vmm_same.size() > 1) {
107 std::sort(vmm_same.begin(), vmm_same.end(), [](
const std::pair<int, float>&
p1,
const std::pair<int, float>&
p2) { return p1.second < p2.second; });
108 for (
auto pair: vmm_same) to_erase.push_back(pair.first);
110 std::sort(to_erase.rbegin(), to_erase.rend());
112 for (
auto l : to_erase) {
113 hits_now.erase(hits_now.begin() +
l);
118 for (
int ia = 0; ia < n_addc; ia++) {
120 for (
unsigned int k = 0;
k < hits_now.size();
k++) {
121 if ((
unsigned int)(hits_now[
k]->getPlane()) !=
ib)
continue;
122 int istrip = (std::abs(hits_now[
k]->getStationEta())-1) * (64*8*10) + hits_now[
k]->getChannel();
123 if (hits_now[
k]->getART() == ia) addc_same.emplace_back(
k, istrip);
126 if (addc_same.size() > 8) {
130 std::sort(addc_same.begin(), addc_same.end(), [](
const std::pair<int, int>&
p1,
const std::pair<int, int>&
p2) { return p1.second < p2.second; });
131 for (
unsigned int it = 8;
it < addc_same.size();
it++) to_erase.push_back(addc_same[
it].first);
134 std::sort(to_erase.rbegin(), to_erase.rend());
135 for (
auto l : to_erase) {
136 hits_now.erase(hits_now.begin() +
l);
142 for (
auto &road : roads) {
143 road->incrementAge(bc_wind);
144 if (!hits_now.empty()) road->addHits(hits_now);
146 if (road->checkCoincidences(bc_wind) && bc >= (bc_start - 1)) {
148 ATH_MSG_DEBUG(
"------------------------------------------------------------------");
150 ATH_MSG_DEBUG(
"Road (x, u, v, count): (" << road->iRoadx() <<
", " << road->iRoadu() <<
", " << road->iRoadv() <<
", " << road->countHits() <<
")");
151 ATH_MSG_DEBUG(
"------------------------------------------------------------------");
153 std::vector<int> bcidVec;
154 for (
const auto &hit: road->getHitVector()) {
155 bcidVec.push_back(hit->getBC());
157 std::sort(bcidVec.begin(), bcidVec.end());
161 int bcidVal=bcidVec[0], bcidCount=1, modeCount=1, bcidMode=bcidVec[0];
162 for (
unsigned int i=1;
i<bcidVec.size();
i++){
163 if (bcidVec[
i] == bcidVal){
167 bcidVal = bcidVec[
i];
169 if (bcidCount > modeCount) {
170 modeCount = bcidCount;
179 slope.
iRoad = road->iRoadx();
180 slope.
iRoadu = road->iRoadu();
181 slope.
iRoadv = road->iRoadv();
182 slope.
uvbkg = road->countUVHits(
true);
183 slope.
xbkg = road->countXHits(
true);
184 slope.
uvmuon = road->countUVHits(
false);
185 slope.
xmuon = road->countXHits(
false);
186 slope.
age = slope.
BC - bc_start;
187 slope.
mxl = road->mxl();
188 slope.
my = road->avgSofX();
189 slope.
uavg = road->avgSofUV(2,4);
190 slope.
vavg = road->avgSofUV(3,5);
191 slope.
mx = (slope.
uavg-slope.
vavg)/(2.*tan_stereo_angle);
196 slope.
side = (slope.
my > 0.) ?
'A' :
'C';
199 slope.
lowRes = road->evaluateLowRes();
201 diamondSlopes.push_back(slope);