CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
tmtt::MuxHToutputs Class Reference

#include <MuxHToutputs.h>

Public Types

enum  MuxAlgoName { MuxAlgoName::None = 0, MuxAlgoName::mBinPerLink = 1 }
 

Public Member Functions

void exec (Array2D< std::unique_ptr< HTrphi >> &mHtRphis) const
 
 MuxHToutputs (const Settings *settings)
 
unsigned int numLinksPerNonant () const
 

Private Member Functions

unsigned int linkID (unsigned int iSecInNon, unsigned int iEtaReg, unsigned int mBinRange) const
 
unsigned int muxFactor () const
 
void sanityCheck ()
 

Private Attributes

bool busySectorKill_
 
std::vector< unsigned int > busySectorMbinRanges_
 
unsigned int busySectorNumStubs_
 
bool busySectorUseMbinRanges_
 
MuxAlgoName muxOutputsHT_
 
unsigned int numEtaRegions_
 
unsigned int numPhiNonants_
 
unsigned int numPhiSecPerNon_
 
unsigned int numPhiSectors_
 
const Settingssettings_
 

Detailed Description

Definition at line 27 of file MuxHToutputs.h.

Member Enumeration Documentation

◆ MuxAlgoName

Enumerator
None 
mBinPerLink 

Definition at line 29 of file MuxHToutputs.h.

29 { None = 0, mBinPerLink = 1 };

Constructor & Destructor Documentation

◆ MuxHToutputs()

tmtt::MuxHToutputs::MuxHToutputs ( const Settings settings)

Definition at line 19 of file MuxHToutputs.cc.

References busySectorUseMbinRanges_, Exception, numLinksPerNonant(), numPhiNonants_, numPhiSectors_, sanityCheck(), submitPVValidationJobs::t, and runonSM::text.

20  : settings_(settings),
21  muxOutputsHT_(static_cast<MuxAlgoName>(settings_->muxOutputsHT())),
26  busySectorKill_(settings_->busySectorKill()), // Kill excess tracks flowing out of HT?
27  busySectorNumStubs_(settings_->busySectorNumStubs()), // Max. num. of stubs that can be sent within TM period
29  settings_->busySectorMbinRanges()), // Individual m bin (=q/Pt) ranges to be output to opto-links.
30  busySectorUseMbinRanges_(not busySectorMbinRanges_.empty()) // m bin ranges option disabled if vector empty.
31  {
32  // Implemented MUX algorithm relies on same number of sectors per nonant.
33  if (numPhiSectors_ % numPhiNonants_ != 0)
34  throw cms::Exception("BadConfig")
35  << "MuxHToutputs: Number of phi sectors is not a multiple of number of nonants!";
36 
38  throw cms::Exception("BadConfig") << "MuxHToutputs: The implemented MUX algorithm requires you to be using the "
39  "busySectorMbinRanges cfg option!";
40 
41  // Check that the MUX algorithm implemented in linkID() is not obviously wrong.
42  this->sanityCheck();
43 
44  std::stringstream text;
45  text << "=== The R-PHI HT output is multiplexed onto " << this->numLinksPerNonant()
46  << " pairs of opto-links per nonant.";
47  static std::once_flag printOnce;
48  std::call_once(
49  printOnce, [](string t) { PrintL1trk() << t; }, text.str());
50  }
unsigned int numEtaRegions_
Definition: MuxHToutputs.h:66
unsigned int numPhiNonants() const
Definition: Settings.h:109
const std::vector< unsigned int > & busySectorMbinRanges() const
Definition: Settings.h:178
unsigned int busySectorNumStubs_
Definition: MuxHToutputs.h:68
unsigned int numEtaRegions() const
Definition: Settings.h:125
std::vector< unsigned int > busySectorMbinRanges_
Definition: MuxHToutputs.h:69
unsigned int numLinksPerNonant() const
Definition: MuxHToutputs.h:42
unsigned int busySectorNumStubs() const
Definition: Settings.h:176
unsigned int numPhiNonants_
Definition: MuxHToutputs.h:63
bool busySectorUseMbinRanges_
Definition: MuxHToutputs.h:70
unsigned int numPhiSecPerNon_
Definition: MuxHToutputs.h:65
unsigned int muxOutputsHT() const
Definition: Settings.h:189
bool busySectorKill() const
Definition: Settings.h:175
unsigned int numPhiSectors_
Definition: MuxHToutputs.h:64
unsigned int numPhiSectors() const
Definition: Settings.h:110
const Settings * settings_
Definition: MuxHToutputs.h:59
MuxAlgoName muxOutputsHT_
Definition: MuxHToutputs.h:62

Member Function Documentation

◆ exec()

void tmtt::MuxHToutputs::exec ( Array2D< std::unique_ptr< HTrphi >> &  mHtRphis) const

Definition at line 57 of file MuxHToutputs.cc.

References busySectorKill_, busySectorNumStubs_, tmtt::HTrphi::getMbinRange(), runTheMatrix::keep, MainPageGenerator::link, linkID(), numEtaRegions_, numLinksPerNonant(), numPhiNonants_, numPhiSecPerNon_, tmtt::L1track2D::numStubs(), tmtt::HTbase::replaceTrackCands2D(), tmtt::L1track2D::setOptoLinkID(), tmtt::HTbase::trackCands2D(), and tracks.

Referenced by tmtt::TMTrackProducer::produce().

57  {
58  // As this loops over sectors in order of increasing sector number, this MUX algorithm always transmits tracks
59  // from the lowest sector numbers on each link first. So the highest sector numbers are more likely to be
60  // truncated by the TM period. The algorithm assumes that two or more m-bin ranges from the same sector will never
61  // be transmitted down the same link, as if this happens, it does not predict the order in which they will be
62  // transmitted.
63 
64  for (unsigned int iPhiNon = 0; iPhiNon < numPhiNonants_; iPhiNon++) {
65  vector<unsigned int> numStubsPerLink(this->numLinksPerNonant(), 0);
66 
67  for (unsigned int iSecInNon = 0; iSecInNon < numPhiSecPerNon_; iSecInNon++) {
68  unsigned int iPhiSec = iPhiNon * numPhiSecPerNon_ + iSecInNon;
69 
70  for (unsigned int iEtaReg = 0; iEtaReg < numEtaRegions_; iEtaReg++) {
71  HTrphi* htRphi = mHtRphis(iPhiSec, iEtaReg).get(); // Get a mutable version of the r-phi HT.
72 
73  list<L1track2D> keptTracks;
74  const list<L1track2D>& tracks = htRphi->trackCands2D();
75 
76  for (const L1track2D& trk : tracks) {
77  L1track2D trkTmp = trk;
78  unsigned int nStubs = trkTmp.numStubs(); // #stubs on this track.
79  unsigned int mBinRange = htRphi->getMbinRange(trkTmp); // Which m bin range is this track in?
80  // Get the output optical link corresponding to this sector & m-bin range.
81  unsigned int link = this->linkID(iSecInNon, iEtaReg, mBinRange);
82  // Make a note of opto-link number inside track object.
83  trkTmp.setOptoLinkID(link);
84 
85  numStubsPerLink[link] += nStubs;
86  // Check if this track can be output within the time-multiplexed period.
87  bool keep = ((not busySectorKill_) || (numStubsPerLink[link] <= busySectorNumStubs_));
88  // FIX: with 2 GeV threshold, this causes significant truncation.
89  // Consider using one output link for each phi sector in nonant
90  if (keep)
91  keptTracks.push_back(trkTmp);
92  }
93 
94  // Replace the collection of 2D tracks in the r-phi HT with the subset of them surviving the TM cut.
95  htRphi->replaceTrackCands2D(keptTracks);
96  }
97  }
98  }
99  }
unsigned int numEtaRegions_
Definition: MuxHToutputs.h:66
unsigned int busySectorNumStubs_
Definition: MuxHToutputs.h:68
unsigned int numLinksPerNonant() const
Definition: MuxHToutputs.h:42
unsigned int numPhiNonants_
Definition: MuxHToutputs.h:63
unsigned int numPhiSecPerNon_
Definition: MuxHToutputs.h:65
auto const & tracks
cannot be loose
unsigned int linkID(unsigned int iSecInNon, unsigned int iEtaReg, unsigned int mBinRange) const

◆ linkID()

unsigned int tmtt::MuxHToutputs::linkID ( unsigned int  iSecInNon,
unsigned int  iEtaReg,
unsigned int  mBinRange 
) const
private

Definition at line 114 of file MuxHToutputs.cc.

References Exception, MainPageGenerator::link, mBinPerLink, muxOutputsHT_, and numLinksPerNonant().

Referenced by exec(), and sanityCheck().

114  {
115  unsigned int link;
116 
118  //--- This is the Sept. 2019 Mux for the transverse HT readout organised by m-bin. (Each m bin in entire nonant goes to a different link).
119 
120  link = 0;
121  link += mBinRange;
122 
123  } else {
124  throw cms::Exception("BadConfig") << "MuxHToutputs: Unknown MuxOutputsHT configuration option!";
125  }
126 
127  if (link >= this->numLinksPerNonant())
128  throw cms::Exception("LogicError") << "MuxHToutputs: Calculated link ID exceeded expected number of links! "
129  << link << " " << this->numLinksPerNonant();
130  return link;
131  }
unsigned int numLinksPerNonant() const
Definition: MuxHToutputs.h:42
MuxAlgoName muxOutputsHT_
Definition: MuxHToutputs.h:62

◆ muxFactor()

unsigned int tmtt::MuxHToutputs::muxFactor ( ) const
private

Definition at line 103 of file MuxHToutputs.cc.

References Exception, mBinPerLink, muxOutputsHT_, numEtaRegions_, and numPhiSecPerNon_.

Referenced by numLinksPerNonant(), and sanityCheck().

103  {
106  } else {
107  throw cms::Exception("BadConfig") << "MuxHToutputs: Unknown MuxOutputsHT configuration option!";
108  }
109  }
unsigned int numEtaRegions_
Definition: MuxHToutputs.h:66
unsigned int numPhiSecPerNon_
Definition: MuxHToutputs.h:65
MuxAlgoName muxOutputsHT_
Definition: MuxHToutputs.h:62

◆ numLinksPerNonant()

unsigned int tmtt::MuxHToutputs::numLinksPerNonant ( ) const
inline

Definition at line 42 of file MuxHToutputs.h.

References busySectorMbinRanges_, tmtt::Settings::miniHTstage(), muxFactor(), numEtaRegions_, numPhiSecPerNon_, and settings_.

Referenced by exec(), linkID(), MuxHToutputs(), and sanityCheck().

42  {
43  unsigned int iCorr = (settings_->miniHTstage()) ? 1 : 0;
44  return numPhiSecPerNon_ * numEtaRegions_ * (busySectorMbinRanges_.size() - iCorr) / this->muxFactor();
45  }
bool miniHTstage() const
Definition: Settings.h:149
unsigned int numEtaRegions_
Definition: MuxHToutputs.h:66
std::vector< unsigned int > busySectorMbinRanges_
Definition: MuxHToutputs.h:69
unsigned int numPhiSecPerNon_
Definition: MuxHToutputs.h:65
unsigned int muxFactor() const
const Settings * settings_
Definition: MuxHToutputs.h:59

◆ sanityCheck()

void tmtt::MuxHToutputs::sanityCheck ( )
private

Definition at line 135 of file MuxHToutputs.cc.

References busySectorMbinRanges_, Exception, MainPageGenerator::link, linkID(), tmtt::Settings::miniHTstage(), muxFactor(), numEtaRegions_, numLinksPerNonant(), numPhiSecPerNon_, and settings_.

Referenced by MuxHToutputs().

135  {
136  if (numPhiSecPerNon_ * numEtaRegions_ % this->muxFactor() != 0)
137  throw cms::Exception("LogicError")
138  << "MuxHToutputs: Number of sectors per phi nonant is not a multiple of muxFactor().";
139 
140  vector<unsigned int> nObsElementsPerLink(this->numLinksPerNonant(), 0);
141  for (unsigned int iSecInNon = 0; iSecInNon < numPhiSecPerNon_; iSecInNon++) {
142  for (unsigned int iEtaReg = 0; iEtaReg < numEtaRegions_; iEtaReg++) {
143  unsigned int iCorr = (settings_->miniHTstage()) ? 1 : 0;
144  for (unsigned int mBinRange = 0; mBinRange < busySectorMbinRanges_.size() - iCorr; mBinRange++) {
145  unsigned int link = this->linkID(iSecInNon, iEtaReg, mBinRange);
146  nObsElementsPerLink[link] += 1;
147  }
148  }
149  }
150  }
bool miniHTstage() const
Definition: Settings.h:149
unsigned int numEtaRegions_
Definition: MuxHToutputs.h:66
std::vector< unsigned int > busySectorMbinRanges_
Definition: MuxHToutputs.h:69
unsigned int numLinksPerNonant() const
Definition: MuxHToutputs.h:42
unsigned int numPhiSecPerNon_
Definition: MuxHToutputs.h:65
unsigned int muxFactor() const
unsigned int linkID(unsigned int iSecInNon, unsigned int iEtaReg, unsigned int mBinRange) const
const Settings * settings_
Definition: MuxHToutputs.h:59

Member Data Documentation

◆ busySectorKill_

bool tmtt::MuxHToutputs::busySectorKill_
private

Definition at line 67 of file MuxHToutputs.h.

Referenced by exec().

◆ busySectorMbinRanges_

std::vector<unsigned int> tmtt::MuxHToutputs::busySectorMbinRanges_
private

Definition at line 69 of file MuxHToutputs.h.

Referenced by numLinksPerNonant(), and sanityCheck().

◆ busySectorNumStubs_

unsigned int tmtt::MuxHToutputs::busySectorNumStubs_
private

Definition at line 68 of file MuxHToutputs.h.

Referenced by exec().

◆ busySectorUseMbinRanges_

bool tmtt::MuxHToutputs::busySectorUseMbinRanges_
private

Definition at line 70 of file MuxHToutputs.h.

Referenced by MuxHToutputs().

◆ muxOutputsHT_

MuxAlgoName tmtt::MuxHToutputs::muxOutputsHT_
private

Definition at line 62 of file MuxHToutputs.h.

Referenced by linkID(), and muxFactor().

◆ numEtaRegions_

unsigned int tmtt::MuxHToutputs::numEtaRegions_
private

Definition at line 66 of file MuxHToutputs.h.

Referenced by exec(), muxFactor(), numLinksPerNonant(), and sanityCheck().

◆ numPhiNonants_

unsigned int tmtt::MuxHToutputs::numPhiNonants_
private

Definition at line 63 of file MuxHToutputs.h.

Referenced by exec(), and MuxHToutputs().

◆ numPhiSecPerNon_

unsigned int tmtt::MuxHToutputs::numPhiSecPerNon_
private

Definition at line 65 of file MuxHToutputs.h.

Referenced by exec(), muxFactor(), numLinksPerNonant(), and sanityCheck().

◆ numPhiSectors_

unsigned int tmtt::MuxHToutputs::numPhiSectors_
private

Definition at line 64 of file MuxHToutputs.h.

Referenced by MuxHToutputs().

◆ settings_

const Settings* tmtt::MuxHToutputs::settings_
private

Definition at line 59 of file MuxHToutputs.h.

Referenced by numLinksPerNonant(), and sanityCheck().