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

#include <TriggerProcessor.h>

Collaboration diagram for LVL1MUCTPIPHASE1::TriggerProcessor:

Public Member Functions

 TriggerProcessor ()=default
 
void setMenu (const TrigConf::L1Menu *l1menu)
 
void setTrigTool (LVL1::TrigThresholdDecisionTool &tool)
 
LVL1MUONIF::Lvl1MuCTPIInputPhase1 mergeInputs (const std::vector< const LVL1MUONIF::Lvl1MuCTPIInputPhase1 * > &inputs) const
 
std::string computeMultiplicities (LVL1MUONIF::Lvl1MuCTPIInputPhase1 &mergedInputs, int bcid, MUCTPIResults &results) const
 

Private Attributes

const TrigConf::L1Menum_l1menu {nullptr}
 
LVL1::TrigThresholdDecisionToolm_trigThresholdDecisionTool {nullptr}
 

Detailed Description

Definition at line 27 of file TriggerProcessor.h.

Constructor & Destructor Documentation

◆ TriggerProcessor()

LVL1MUCTPIPHASE1::TriggerProcessor::TriggerProcessor ( )
default

Member Function Documentation

◆ computeMultiplicities()

std::string LVL1MUCTPIPHASE1::TriggerProcessor::computeMultiplicities ( LVL1MUONIF::Lvl1MuCTPIInputPhase1 mergedInputs,
int  bcid,
MUCTPIResults results 
) const

Definition at line 40 of file TriggerProcessor.cxx.

41  {
42  results.ctp_words.clear();
43  results.daq_data.clear();
44 
45  //initialize the vector to hold the threshold multiplicities
46  const std::vector<std::shared_ptr<TrigConf::L1Threshold> > & thresholds = m_l1menu->thresholds("MU");
47  int nThresholds = thresholds.size();
48  std::vector<unsigned int> multiplicities(nThresholds,0);
49 
50 
51  // Barrel + EC + Fwd
52  for (size_t isys=0;isys<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSystems();isys++)
53  {
54  // Sectors per system
56  for (size_t isec=0;isec<LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSector(system);isec++)
57  {
58  // A+C sides
59  for (size_t isub=0;isub<2;isub++)
60  {
61  std::shared_ptr<LVL1MUONIF::Lvl1MuSectorLogicDataPhase1> sectorData = mergedInputs.getSectorLogicDataPtr(isys, isub, isec, bcid);
62  if (!sectorData) continue;
63 
64  const unsigned int& ncand_max = LVL1MUONIF::NCAND[isys];
65  for (unsigned int icand=0;icand<ncand_max;icand++)
66  {
67  int thresh = sectorData->pt(icand);
68  if (thresh == -1) continue; // no candidate
69  int roiID = sectorData->roi(icand);
70  if (roiID < 0) continue;
71 
72  // Build the DAQ word
73  uint32_t daq_word=0;
74 
75  // Some definitions that are different between subsystems
76  uint32_t ROI_MASK=0;
77  uint32_t SECTOR_MASK = 0;
78  uint32_t SUBSYS_MASK = 0x3;
79  uint32_t SUBSYS_ID = 0; // default for barrel
80  if (isys == 0)
81  {
82  ROI_MASK = LVL1::MuCTPIBits::BARREL_ROI_MASK;
83  SECTOR_MASK = LVL1::MuCTPIBits::BARREL_SECTORID_MASK;
84  }
85  else if (isys == 1)
86  {
87  ROI_MASK = LVL1::MuCTPIBits::ENDCAP_ROI_MASK;
88  SECTOR_MASK = LVL1::MuCTPIBits::ENDCAP_SECTORID_MASK;
89  SUBSYS_ID = 2; // not a typo!
90  }
91  else if (isys == 2)
92  {
93  ROI_MASK = LVL1::MuCTPIBits::FORWARD_ROI_MASK;
94  SECTOR_MASK = LVL1::MuCTPIBits::FORWARD_SECTORID_MASK;
95  SUBSYS_ID = 1; // not a typo!
96  }
97 
98  //General formula for each subword:
99  //daq_word |= (subword & LVL1::MuCTPIBits::MASK) << LVL1::MuCTPIBits::SHIFT
100 
101  //ROI word
102  daq_word |= (sectorData->roi(icand) & ROI_MASK) << LVL1::MuCTPIBits::RUN3_ROI_SHIFT;
103 
104  //PT word
105  daq_word |= (thresh & LVL1::MuCTPIBits::RUN3_CAND_PT_MASK) << LVL1::MuCTPIBits::RUN3_CAND_PT_SHIFT;
106 
107  //CANDIDIATE FLAGS
108  if (isys == 0)
109  {
110  daq_word |= (sectorData->ovl(icand) & LVL1::MuCTPIBits::RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_MASK) << LVL1::MuCTPIBits::RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_SHIFT;
111  daq_word |= (sectorData->is2candidates(icand) & LVL1::MuCTPIBits::ROI_OVERFLOW_MASK) << LVL1::MuCTPIBits::RUN3_ROI_OVERFLOW_SHIFT;
112  }
113  else
114  {
115  daq_word |= (sectorData->charge(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_CHARGE_SIGN_SHIFT;
116  daq_word |= (sectorData->bw2or3(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_BW2OR3_SHIFT;
117  daq_word |= (sectorData->innercoin(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_INNERCOIN_SHIFT;
118  daq_word |= (sectorData->goodmf(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_TGC_GOODMF_SHIFT;
119  }
120 
121  //CANDIDATE VETO FLAG
122  daq_word |= (sectorData->veto(icand) & 0x1) << LVL1::MuCTPIBits::RUN3_CAND_VETO_SHIFT;
123 
124  //SECTOR FLAGS
125  daq_word |= (sectorData->is2candidatesInSector() & LVL1::MuCTPIBits::CAND_OVERFLOW_MASK) << LVL1::MuCTPIBits::RUN3_CAND_OVERFLOW_SHIFT;
126 
127  //SECTOR ADDRESS
128  daq_word |= (isub & LVL1::MuCTPIBits::SECTOR_HEMISPHERE_MASK) << LVL1::MuCTPIBits::RUN3_CAND_SECTOR_ADDRESS_SHIFT;
129  daq_word |= (isec & SECTOR_MASK) << LVL1::MuCTPIBits::RUN3_CAND_SECTORID_SHIFT;
130  daq_word |= (SUBSYS_ID & SUBSYS_MASK) << LVL1::MuCTPIBits::RUN3_SUBSYS_ADDRESS_SHIFT;
131 
132 
133  // Add extra bit in front to flag that this is a RUN3 RoI
134  daq_word |= 1u << 31;
135 
136  //find the trigger decisions
137  std::vector<std::pair<std::shared_ptr<TrigConf::L1Threshold>, bool> > decisions = m_trigThresholdDecisionTool->getThresholdDecisions(
138  daq_word, m_l1menu->thresholds("MU"), m_l1menu->thrExtraInfo().MU());
139  results.daq_data.push_back(DAQData(daq_word, decisions));
140 
141  //
142  // Perform multiplicity counting
143  //
144 
145  //if this candidate has been flagged as overlapping, stop here and don't count it in the multiplicity
146  if (sectorData->veto(icand)) continue;
147 
148  //basic check that the size vectors are equal
149  if (decisions.size() != thresholds.size()) return "Threshold vector different size than decision vector";
150 
151  //loop over each muon threshold passed and see if this candidate satisfies it.
152  //if so, increment the multiplicity of this threshold
153  for (unsigned ithresh=0;ithresh<decisions.size();ithresh++)
154  {
155  //check that the pointers are ordered correctly
156  if (decisions[ithresh].first != thresholds[ithresh]) return "Invalid threshold ordering";
157  if (decisions[ithresh].second)
158  {
159  ++multiplicities[ithresh];
160  }
161  }
162  } // N Cand
163  } // N Subsys
164  } // N Sectors
165  } // N Systems
166 
167  //build the CTP words with bitset:
168  //first build the bitset that contains the full word
169  const TrigConf::L1Connector & optConn = m_l1menu->connector("MuCTPiOpt0");
170 
171  std::bitset<256> full_ctp_word = 0;
172  unsigned int lastPos = 0;
173  for (int i=0;i<nThresholds;i++)
174  {
175  if(!optConn.hasLine(thresholds[i]->name())) { // not all thresholds are on the multiplicity output line
176  continue;
177  }
178  auto & triggerline = optConn.triggerLine(thresholds[i]->name());
179  unsigned nbits = triggerline.endbit() - triggerline.startbit() + 1;
180  lastPos = std::max(lastPos,triggerline.endbit()); // keep track of highest bit
181 
182  unsigned int maxMult = pow2.at(nbits)-1; // multiplicity caped at 2**nbits-1
183  std::bitset<256> mult = ( multiplicities[i]>maxMult ? maxMult : multiplicities[i] ); // needs to be a bitset<256> in order to shift it by more than 32
184 
185  full_ctp_word |= (mult << triggerline.startbit());
186  }
187 
188  // now divide up into a vector of 32-bit unsigned ints
189  const std::bitset<256> u32i_mask = 0xffffffff;
190  unsigned n32_ints = lastPos/32 + 1;
191  // if (lastPos % 32 != 0) n32_ints += 1;
192  for (unsigned i=0;i<n32_ints;i++)
193  {
194  unsigned int word = static_cast<unsigned int>((full_ctp_word & u32i_mask).to_ulong());
195  results.ctp_words.push_back(word);
196  full_ctp_word >>= 32;
197  }
198 
199  return "";
200  }

◆ mergeInputs()

LVL1MUONIF::Lvl1MuCTPIInputPhase1 LVL1MUCTPIPHASE1::TriggerProcessor::mergeInputs ( const std::vector< const LVL1MUONIF::Lvl1MuCTPIInputPhase1 * > &  inputs) const

Definition at line 32 of file TriggerProcessor.cxx.

33  {
35  int nrInputs = inputs.size();
36  for (int i=0;i<nrInputs;i++) mergedInputs.merge(*inputs[i]);
37  return mergedInputs;
38  }

◆ setMenu()

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

Definition at line 27 of file TriggerProcessor.cxx.

28  {
29  m_l1menu = l1menu;
30  }

◆ setTrigTool()

void LVL1MUCTPIPHASE1::TriggerProcessor::setTrigTool ( LVL1::TrigThresholdDecisionTool tool)
inline

Definition at line 36 of file TriggerProcessor.h.

Member Data Documentation

◆ m_l1menu

const TrigConf::L1Menu* LVL1MUCTPIPHASE1::TriggerProcessor::m_l1menu {nullptr}
private

Definition at line 44 of file TriggerProcessor.h.

◆ m_trigThresholdDecisionTool

LVL1::TrigThresholdDecisionTool* LVL1MUCTPIPHASE1::TriggerProcessor::m_trigThresholdDecisionTool {nullptr}
private

Definition at line 45 of file TriggerProcessor.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
TrigConf::L1Connector
L1 connectors configuration.
Definition: L1Connector.h:45
LVL1::TrigThresholdDecisionTool::getThresholdDecisions
virtual std::vector< std::pair< std::shared_ptr< TrigConf::L1Threshold >, bool > > getThresholdDecisions(uint32_t dataWord, const EventContext &eventContext) const override
Definition: TrigThresholdDecisionTool.cxx:182
max
#define max(a, b)
Definition: cfImp.cxx:41
LVL1MUONIF::Lvl1MuCTPIInputPhase1::merge
void merge(const Lvl1MuCTPIInputPhase1 &another)
Merge SectorLogic data of another object into this data of a system (Barrel, Endcap or Forward) is no...
Definition: Lvl1MuCTPIInputPhase1.cxx:119
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:35
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::TriggerLine::endbit
unsigned int endbit() const
Definition: L1Connector.h:29
TrigConf::L1Connector::triggerLine
const TrigConf::TriggerLine & triggerLine(const std::string &lineName) const
Definition: L1Connector.cxx:181
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::innercoin
int innercoin(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:56
LVL1MUCTPIPHASE1::TriggerProcessor::m_trigThresholdDecisionTool
LVL1::TrigThresholdDecisionTool * m_trigThresholdDecisionTool
Definition: TriggerProcessor.h:45
TrigConf::L1Menu::thrExtraInfo
const L1ThrExtraInfo & thrExtraInfo() const
Access to extra info for threshold types.
Definition: L1Menu.cxx:307
LVL1MUONIF::Lvl1MuCTPIInputPhase1
Class representing (part of) the input data to the MuCTPI for Phase 1.
Definition: Lvl1MuCTPIInputPhase1.h:33
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::bw2or3
int bw2or3(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:57
LVL1MUONIF::Lvl1MuCTPIInputPhase1::MuonSystem
MuonSystem
Definition: Lvl1MuCTPIInputPhase1.h:47
postInclude.inputs
inputs
Definition: postInclude.SortInput.py:15
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::ovl
int ovl(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:51
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
TrigConf::L1ThrExtraInfo::MU
const L1ThrExtraInfo_MU & MU() const
Definition: L1ThrExtraInfo.cxx:188
lumiFormat.i
int i
Definition: lumiFormat.py:92
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSystems
static size_t numberOfSystems()
Definition: Lvl1MuCTPIInputPhase1.h:142
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfSector
static size_t numberOfSector(MuonSystem system)
Definition: Lvl1MuCTPIInputPhase1.h:143
LVL1MUCTPIPHASE1::TriggerProcessor::m_l1menu
const TrigConf::L1Menu * m_l1menu
Definition: TriggerProcessor.h:44
TrigConf::L1Menu::thresholds
std::vector< std::shared_ptr< TrigConf::L1Threshold > > thresholds() const
Access to list of all L1Thresholds.
Definition: L1Menu.cxx:267
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
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:81
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getSectorLogicDataPtr
std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > getSectorLogicDataPtr(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
Definition: Lvl1MuCTPIInputPhase1.cxx:61
ChainNameParser::multiplicities
std::vector< int > multiplicities(const std::string &chain)
Definition: ChainNameParser.cxx:202
TrigConf::L1Connector::hasLine
bool hasLine(const std::string &lineName) const
Definition: L1Connector.cxx:175
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
python.ami.results
def results
Definition: ami.py:386
TrigConf::L1Menu::connector
const TrigConf::L1Connector & connector(const std::string &connectorName) const
Access to connector by name.
Definition: L1Menu.cxx:335
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::goodmf
int goodmf(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:55
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::pt
int pt(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:52
DeMoScan.first
bool first
Definition: DeMoScan.py:534
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
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::is2candidatesInSector
bool is2candidatesInSector() const
Definition: Lvl1MuSectorLogicDataPhase1.h:47