Skip to content
Snippets Groups Projects
Commit 48b14e0a authored by Tim Martin's avatar Tim Martin
Browse files

Merge branch 'MMGtrig' into '24.0'

adding VMM ART selection for MMG trigger

See merge request !71026
parents 47d57390 02bb955b
No related branches found
No related tags found
3 merge requests!712602024-05-09: merge of 24.0 into main,!71259Draft: 2024-05-09: merge of 24.0 into main,!71026adding VMM ART selection for MMG trigger
......@@ -131,6 +131,7 @@ void MMT_Diamond::findDiamonds(const unsigned int iterator, const int event) {
std::vector< std::pair<int, int> > addc_same = {};
std::vector<int> to_erase = {};
int n_addc = 4;
int n_vmm = 128;
// each road makes independent triggers, evaluated on each BC
for (int bc = m_diamonds[iterator].ev_hits.front()->getBC(); bc < bc_end; bc++) {
......@@ -145,13 +146,38 @@ void MMT_Diamond::findDiamonds(const unsigned int iterator, const int event) {
}
}
// Implement ADDC-like filter
// Simulate harware filters: ART hits + ADDC filter
for (unsigned int ib = 0; ib < 8; ib++) { //loop on plane from 0 to 7
// VMM-ART-hit filter
for (int j = 0; j < n_vmm; j++) {
vmm_same.clear();
unsigned int k = 0;
for (auto hit_pointer: hits_now) {
if (static_cast<unsigned int>(hit_pointer->getPlane()) != ib) continue;
if (hit_pointer->getVMM() == j){
vmm_same.push_back( std::make_pair(k, hit_pointer->getTime()) );
}
k++;
}
if (vmm_same.size() > 1) {
to_erase.clear();
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; });
for (auto pair: vmm_same) to_erase.push_back(pair.first);
// reverse and erase
std::sort(to_erase.rbegin(), to_erase.rend());
to_erase.pop_back(); //removes the hit with the earliest time
for (auto l : to_erase) {
hits_now.erase(hits_now.begin() + l);
}
}
}
// ADDC-like filter
for (int ia = 0; ia < n_addc; ia++) { // From 0 to 3 (local index of the ART ASIC in the layer)
addc_same.clear();
for (unsigned int k = 0; k < hits_now.size(); k++) {
if ((unsigned int)(hits_now[k]->getPlane()) != ib) continue;
if (hits_now[k]->getART() == ia) addc_same.push_back( std::make_pair(k, hits_now[k]->getChannel()) );
int istrip = (std::abs(hits_now[k]->getStationEta())-1) * (64*8*10) + hits_now[k]->getChannel(); //needed the global strip index on the sector layer (getChannel returns chamber's local strip index)
if (hits_now[k]->getART() == ia) addc_same.emplace_back(k, istrip);
}
if (addc_same.size() > 8) {
......@@ -242,7 +268,7 @@ void MMT_Diamond::findDiamonds(const unsigned int iterator, const int event) {
}
double MMT_Diamond::phiShift(const int n, const double phi, const char side) const {
double Phi = (side == 'A') ? phi : -phi;
double Phi = (side == 'A') ? -phi : phi;
double shift = (n > 8) ? (16-n)*M_PI/8. : n*M_PI/8.;
if (n < 8) return (Phi + shift);
else if (n == 8) return (Phi + ((Phi > 0.) ? -1. : 1.)*shift);
......
......@@ -45,9 +45,10 @@ MMT_Hit::MMT_Hit(const hitData_entry &entry, const MuonGM::MuonDetectorManager*
if(m_strip > 8191 || m_strip<0){
m_strip = 0;
}
int istrip = (std::abs(m_station_eta)-1) * (64*8*10) + m_strip; //here needed the absolute index of the strip on the sector layer (m_strip is only up to 5119)
// region represent the index of the mmfe8 in the plane
int region = int(float(m_strip)/(64*8));
int region = int(float(istrip)/(64*8));
// map of mmfe8s layer,radius(MMFE8 index on sector)
unsigned int mmfe8s[8][16];
// loop on layers
......@@ -61,6 +62,9 @@ MMT_Hit::MMT_Hit(const hitData_entry &entry, const MuonGM::MuonDetectorManager*
}
}
}
// re-assigning as seems not to work with new stand-alone run with RecoTf from HITS samples
m_MMFE_VMM = region; // index of the MMFE8 board on the layer
m_VMM_chip = int(1. *istrip /64.); // index of the VMM chip on the layer
// art asic id
if(!int(m_plane/2.)%2){
if (mmfe8s[m_plane][region]==1){ //Right
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment