ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LVL1MUCTPIPHASE1::MuonSectorProcessor Class Reference

#include <MuonSectorProcessor.h>

Collaboration diagram for LVL1MUCTPIPHASE1::MuonSectorProcessor:

Public Member Functions

 MuonSectorProcessor (bool side)
 
 ~MuonSectorProcessor ()
 
 MuonSectorProcessor (MuonSectorProcessor &&o) noexcept
 
 MuonSectorProcessor (const MuonSectorProcessor &)=delete
 
void setMenu (const TrigConf::L1Menu *l1menu)
 
void setL1TopoLUT (const L1TopoLUT *l1topoLUT)
 
void configureOverlapRemoval (const std::string &lutFile)
 
bool configurePtEncoding ()
 
void runOverlapRemoval (LVL1MUONIF::Lvl1MuCTPIInputPhase1 *inputs, int bcid) const
 
std::string makeL1TopoData (LVL1MUONIF::Lvl1MuCTPIInputPhase1 *inputs, int bcid, LVL1::MuCTPIL1Topo &l1topoData) const
 
bool getSide () const
 

Private Attributes

std::unique_ptr< OverlapHelperm_overlapHelper
 
const TrigConf::L1Menum_l1menu = nullptr
 
const L1TopoLUTm_l1topoLUT = nullptr
 
bool m_side = false
 
std::vector< std::map< int, int > > m_ptEncoding
 

Detailed Description

Definition at line 36 of file MuonSectorProcessor.h.

Constructor & Destructor Documentation

◆ MuonSectorProcessor() [1/3]

LVL1MUCTPIPHASE1::MuonSectorProcessor::MuonSectorProcessor ( bool  side)

Definition at line 186 of file MuonSectorProcessor.cxx.

187  :
188  m_overlapHelper(std::make_unique<OverlapHelper>()),
189  m_l1menu(nullptr),
190  m_l1topoLUT(nullptr),
191  m_side(side)
192  {
193  }

◆ ~MuonSectorProcessor()

LVL1MUCTPIPHASE1::MuonSectorProcessor::~MuonSectorProcessor ( )

Definition at line 195 of file MuonSectorProcessor.cxx.

196  {
197  }

◆ MuonSectorProcessor() [2/3]

LVL1MUCTPIPHASE1::MuonSectorProcessor::MuonSectorProcessor ( MuonSectorProcessor &&  o)
noexcept

Definition at line 199 of file MuonSectorProcessor.cxx.

200  : m_overlapHelper(std::move(o.m_overlapHelper)) {}

◆ MuonSectorProcessor() [3/3]

LVL1MUCTPIPHASE1::MuonSectorProcessor::MuonSectorProcessor ( const MuonSectorProcessor )
delete

Member Function Documentation

◆ configureOverlapRemoval()

void LVL1MUCTPIPHASE1::MuonSectorProcessor::configureOverlapRemoval ( const std::string &  lutFile)

Definition at line 207 of file MuonSectorProcessor.cxx.

208  {
209  m_overlapHelper->configure(lutFile);
210  }

◆ configurePtEncoding()

bool LVL1MUCTPIPHASE1::MuonSectorProcessor::configurePtEncoding ( )

Definition at line 212 of file MuonSectorProcessor.cxx.

213  {
214  if (!m_l1menu) return false;
215 
216  m_ptEncoding.clear();
217  m_ptEncoding = std::vector<std::map<int, int> >(3, std::map<int, int>());
218 
219  //build the map between index and pt threshold.
220  //the index is the 3- or 4-bit pt word, and has a different
221  //pt threshold meaning depending on the subsystem.
222  //the value part of the map is the pt value for the 3 subsystems,
223  //and the key is the index for an arbitrary subsystem.
224  //not all indices will be covered by all subsystems since
225  //barrel only has 3 bits, so initialize the value tuple with -1
226  const auto & exMU = &m_l1menu->thrExtraInfo().MU();
227  auto rpcPtValues = exMU->knownRpcPtValues();
228  auto tgcPtValues = exMU->knownTgcPtValues();
229  for ( unsigned i=0; i<rpcPtValues.size(); i++){
230  m_ptEncoding[0][i] = exMU->ptForRpcIdx(i);
231  }
232  for ( unsigned i=0; i<tgcPtValues.size(); i++){
233  m_ptEncoding[1][i] = exMU->ptForTgcIdx(i);
234  m_ptEncoding[2][i] = exMU->ptForTgcIdx(i);
235  }
236 
237  return true;
238  }

◆ getSide()

bool LVL1MUCTPIPHASE1::MuonSectorProcessor::getSide ( ) const
inline

Definition at line 54 of file MuonSectorProcessor.h.

54 { return m_side; };

◆ makeL1TopoData()

std::string LVL1MUCTPIPHASE1::MuonSectorProcessor::makeL1TopoData ( LVL1MUONIF::Lvl1MuCTPIInputPhase1 inputs,
int  bcid,
LVL1::MuCTPIL1Topo l1topoData 
) const

Definition at line 310 of file MuonSectorProcessor.cxx.

312  {
313  // Barrel + EC + Fwd
314  for (unsigned short isys=0;isys<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSystems();isys++)
315  {
316  // Sectors per system
318  for (unsigned short isec=0;isec<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSector(system);isec++)
319  {
320  // A+C sides
321  for (unsigned short isub=0;isub<2;isub++)
322  {
323  if (isub != (unsigned short)(m_side)) continue;
324  std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1> sectorData = inputs->getSectorLogicDataPtr(isys, isub, isec, bcid);
325  if (!sectorData) continue;
326 
327  //build the sector name
328  std::stringstream sectorName;
329  if (isys == 0) sectorName<<"B";
330  else if (isys == 1) sectorName<<"E";
331  else if (isys == 2) sectorName<<"F";
332 
334  if (isys == 0)
335  {
336  int sectorNumber=isec;
337  if (side == LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideC()) sectorNumber += 32;
338  if (sectorNumber < 10) sectorName << "0";
339  sectorName << sectorNumber;
340  }
341  else
342  {
343  if (side == LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideA()) sectorName << "A";
344  else sectorName << "C";
345  if (isec < 10) sectorName << "0";
346  sectorName << isec;
347  }
348 
349 
350  for (unsigned int icand=0;icand<LVL1MUONIF::NCAND[isys];icand++)
351  {
352  //find the eta/phi
353  int roiID = sectorData->roi(icand);
354  if (roiID < 0) continue;
355  int ptword = sectorData->pt(icand);
356  if (ptword < 0) continue;
357 
358  // the following doesn't quite follow the correct nomenclature, should be (side, isub, isec, roiID) thus there was a typo chain in L399+ using isub instead of the correct isys
359  // see: https://gitlab.cern.ch/atlas/athena/-/blob/master/Trigger/TrigT1/TrigT1MuctpiPhase1/src/L1TopoLUT.cxx#L161
360  L1TopoCoordinates coord = m_l1topoLUT->getCoordinates(isub, isys, isec, roiID);
361 
362  //check for invalid decoding
363  if (coord == L1TopoCoordinates())
364  {
365  std::stringstream err;
366  err << "Couldn't decode L1Topo coordinates: Side = " << isub << ", subsystem = " << isys << ", sector = " << isec << ", roi = " << roiID;
367  return err.str();
368  }
369 
370  int ptValue = 0;
371  auto enc = m_ptEncoding[isys].find(ptword);
372  if (enc == m_ptEncoding[isys].end())
373  {
374  auto last_enc = m_ptEncoding[isys].rbegin();
375  if (last_enc != m_ptEncoding[isys].rend() && ptword > last_enc->first)
376  {
377  ptValue = m_ptEncoding[isys].rbegin()->second;
378  }
379  else
380  {
381  std::stringstream err;
382  err << "Pt threshold not found in L1Topo encoding. Thr: " << ptword << ", subsys: " << isys;
383  return err.str();
384  }
385  }
386  else ptValue=enc->second;
387 
388  if (ptValue < 0)
389  {
390  std::stringstream err;
391  err << "Default value returned for pt encoding. Thr: " << ptword << ", isys: " << isys;
392  return err.str();
393  }
394 
395 
396  // no longer needed, but keep for backwards compatibility
397  int etacode=0;
398  int phicode = 0;
399  unsigned int mioctID = 0;
400  unsigned int ptCode=0;
401 
403  cand.setCandidateData(sectorName.str(),
404  roiID,
405  bcid,
406  (unsigned int)ptword,
407  ptCode, //removed Run3
408  (unsigned int)ptValue,
409  coord.eta,
410  coord.phi,
411  etacode, //removed Run3
412  phicode, //removed Run3
413  coord.eta_min,
414  coord.eta_max,
415  coord.phi_min,
416  coord.phi_max,
417  mioctID, //removed Run3
418  coord.ieta,
419  coord.iphi);
420 
421  if (isys == 0) cand.setRPCFlags(sectorData->is2candidates(icand),
422  sectorData->ovl(icand));
423  else cand.setTGCFlags(sectorData->bw2or3(icand),
424  sectorData->innercoin(icand),
425  sectorData->goodmf(icand),
426  sectorData->charge(icand));
427 
428 
429  l1topoData.addCandidate(cand);
430  }
431  }
432  }
433  }
434  return "";
435  }

◆ runOverlapRemoval()

void LVL1MUCTPIPHASE1::MuonSectorProcessor::runOverlapRemoval ( LVL1MUONIF::Lvl1MuCTPIInputPhase1 inputs,
int  bcid 
) const

Definition at line 241 of file MuonSectorProcessor.cxx.

242  {
243  std::map<std::string,std::vector<std::pair<std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1>, unsigned> > > buckets;
244 
245  for (size_t isys=0;isys<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSystems();isys++)
246  {
247  // Sectors per system
249  for (size_t isec=0;isec<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSector(system);isec++)
250  {
251  // A+C sides
252  for (size_t isub=0;isub<2;isub++)
253  {
254  if (isub != size_t(m_side)) continue;
255 
256  //get a pointer to this since we'll need to modify the 'veto' flag of the SL data
257  std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1> sectorData = inputs->getSectorLogicDataPtr(isys, isub, isec, bcid);
258  if (!sectorData) continue;
259 
260  for (unsigned int icand=0;icand<LVL1MUONIF::NCAND[isys];icand++)
261  {
262  //build the sector name
263  std::string sectorName="";
264  if (isys == 0) sectorName="B";
265  else if (isys == 1) sectorName="E";
266  else if (isys == 2) sectorName="F";
267 
268  int roiID = sectorData->roi(icand);
269  if (roiID < 0) continue;
270  int ptword = sectorData->pt(icand);
271  if (ptword < 0) continue;
272 
273  // initializing veto flag for the latter removal step
274  sectorData->veto(icand,0);
275 
276  for(auto rr : m_overlapHelper->relevant_regions(m_side,sectorName,roiID,isec))
277  {
278  // for the barrel-barrel overlap removal, only the muons having the phi-overlap flag are considered
279  if( std::count(rr.begin(),rr.end(),'B') == 2 && isys == 0 && sectorData->ovl(icand) == 0 )continue;
280  buckets[rr].push_back(std::make_pair(sectorData, icand));
281  }
282  }
283  }
284  }
285  }
286 
287  for(auto candidate_vector : buckets){ // loop over candidates in OL region pair
288 
289  // sorting (to be tuned)
290  unsigned i_notRemove = 0;
291  int ptMax = 0;
292  for (unsigned i=0;i<candidate_vector.second.size();i++){
293  if( candidate_vector.second[i].first->veto(candidate_vector.second[i].second)==1 ) continue; // skipping already-flagged candidate
294  int pt = candidate_vector.second[i].first->pt(candidate_vector.second[i].second);
295  if(pt > ptMax){
296  ptMax = pt;
297  i_notRemove = i;
298  }
299  }
300 
301  //for each candidate except the highest pt, mark them for removal
302  for (unsigned i=0;i<candidate_vector.second.size();i++)
303  {
304  if( candidate_vector.second[i].first->veto(candidate_vector.second[i].second)==1 ) continue; // skipping already-flagged candidate
305  candidate_vector.second[i].first->veto(candidate_vector.second[i].second, (i==i_notRemove)?0:1 );
306  }
307  }
308  }

◆ setL1TopoLUT()

void LVL1MUCTPIPHASE1::MuonSectorProcessor::setL1TopoLUT ( const L1TopoLUT l1topoLUT)
inline

Definition at line 47 of file MuonSectorProcessor.h.

47 {m_l1topoLUT=l1topoLUT;}

◆ setMenu()

void LVL1MUCTPIPHASE1::MuonSectorProcessor::setMenu ( const TrigConf::L1Menu l1menu)

Definition at line 202 of file MuonSectorProcessor.cxx.

203  {
204  m_l1menu = l1menu;
205  }

Member Data Documentation

◆ m_l1menu

const TrigConf::L1Menu* LVL1MUCTPIPHASE1::MuonSectorProcessor::m_l1menu = nullptr
private

Definition at line 59 of file MuonSectorProcessor.h.

◆ m_l1topoLUT

const L1TopoLUT* LVL1MUCTPIPHASE1::MuonSectorProcessor::m_l1topoLUT = nullptr
private

Definition at line 60 of file MuonSectorProcessor.h.

◆ m_overlapHelper

std::unique_ptr<OverlapHelper> LVL1MUCTPIPHASE1::MuonSectorProcessor::m_overlapHelper
private

Definition at line 58 of file MuonSectorProcessor.h.

◆ m_ptEncoding

std::vector<std::map<int, int> > LVL1MUCTPIPHASE1::MuonSectorProcessor::m_ptEncoding
private

Definition at line 64 of file MuonSectorProcessor.h.

◆ m_side

bool LVL1MUCTPIPHASE1::MuonSectorProcessor::m_side = false
private

Definition at line 61 of file MuonSectorProcessor.h.


The documentation for this class was generated from the following files:
LVL1::MuCTPIL1TopoCandidate::setRPCFlags
void setRPCFlags(bool is2cand, bool phiOvl)
Definition: MuCTPIL1TopoCandidate.cxx:61
LVL1::MuCTPIL1TopoCandidate::setCandidateData
void setCandidateData(const std::string &sectorName, unsigned int roiID, unsigned int bcid, unsigned int ptThresholdID, unsigned int ptL1TopoCode, unsigned int ptValue, float eta, float phi, unsigned int etacode, unsigned int phicode, float etamin, float etamax, float phimin, float phimax, unsigned int mioctID, int ieta, int iphi)
Definition: MuCTPIL1TopoCandidate.cxx:17
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::innercoin
int innercoin(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:56
LVL1::MuCTPIL1TopoCandidate::setTGCFlags
void setTGCFlags(bool bw2or3, bool innerCoin, bool goodMF, int charge)
Definition: MuCTPIL1TopoCandidate.cxx:53
TrigConf::L1Menu::thrExtraInfo
const L1ThrExtraInfo & thrExtraInfo() const
Access to extra info for threshold types.
Definition: L1Menu.cxx:307
LVL1MUCTPIPHASE1::MuonSectorProcessor::m_overlapHelper
std::unique_ptr< OverlapHelper > m_overlapHelper
Definition: MuonSectorProcessor.h:54
test_pyathena.pt
pt
Definition: test_pyathena.py:11
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::bw2or3
int bw2or3(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:57
LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSystem
MuonSystem
Definition: Lvl1MuCTPIInputPhase1.h:48
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::ovl
int ovl(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:51
LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSubSystem
MuonSubSystem
Definition: Lvl1MuCTPIInputPhase1.h:49
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TrigConf::L1ThrExtraInfo::MU
const L1ThrExtraInfo_MU & MU() const
Definition: L1ThrExtraInfo.cxx:188
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1MUCTPIPHASE1::L1TopoLUT::getCoordinates
L1TopoCoordinates getCoordinates(const unsigned short &side, const unsigned short &subsystem, const unsigned short &sectorID, const unsigned short &roi) const
Definition: L1TopoLUT.cxx:218
LVL1MUCTPIPHASE1::MuonSectorProcessor::m_l1menu
const TrigConf::L1Menu * m_l1menu
Definition: MuonSectorProcessor.h:59
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSystems
static size_t numberOfSystems()
Definition: Lvl1MuCTPIInputPhase1.h:143
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideA
static size_t idSideA()
Definition: Lvl1MuCTPIInputPhase1.h:141
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSector
static size_t numberOfSector(MuonSystem system)
Definition: Lvl1MuCTPIInputPhase1.h:144
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::charge
int charge(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:53
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::veto
int veto(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:58
LVL1MUCTPIPHASE1::MuonSectorProcessor::m_ptEncoding
std::vector< std::map< int, int > > m_ptEncoding
Definition: MuonSectorProcessor.h:64
LVL1::MuCTPIL1TopoCandidate
MuCTPI input class to the L1Topo simulation.
Definition: MuCTPIL1TopoCandidate.h:23
LVL1MUCTPIPHASE1::MuonSectorProcessor::m_side
bool m_side
Definition: MuonSectorProcessor.h:61
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::goodmf
int goodmf(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:55
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
LVL1::MuCTPIL1Topo::addCandidate
void addCandidate(const MuCTPIL1TopoCandidate &candidate)
Definition: MuCTPIL1Topo.cxx:51
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::pt
int pt(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:52
LVL1MUCTPIPHASE1::MuonSectorProcessor::m_l1topoLUT
const L1TopoLUT * m_l1topoLUT
Definition: MuonSectorProcessor.h:60
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideC
static size_t idSideC()
Definition: Lvl1MuCTPIInputPhase1.h:142
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::is2candidates
bool is2candidates(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:54
python.XMLReader.l1menu
l1menu
Definition: XMLReader.py:73
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::roi
int roi(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:50
rr
const boost::regex rr(r_r)