CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1GTFinOrBoardWriter Class Reference
Inheritance diagram for L1GTFinOrBoardWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 L1GTFinOrBoardWriter (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void endJob () override
 

Private Attributes

const edm::EDGetTokenT< P2GTAlgoBlockMapalgoBlocksToken_
 
l1t::demo::BoardDataWriter boardDataWriter_
 
const unsigned int channelFinOr_
 
const std::array< unsigned int, 3 > channelsHigh_
 
const std::array< unsigned int, 3 > channelsLow_
 
const std::array< unsigned int, 3 > channelsMid_
 
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
 
std::size_t tmuxCounter_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 30 of file L1GTFinOrBoardWriter.cc.

Constructor & Destructor Documentation

◆ L1GTFinOrBoardWriter()

L1GTFinOrBoardWriter::L1GTFinOrBoardWriter ( const edm::ParameterSet config)
explicit

Definition at line 51 of file L1GTFinOrBoardWriter.cc.

References channelFinOr_, channelsHigh_, channelsLow_, and channelsMid_.

52  : channelsLow_(config.getParameter<std::array<unsigned int, 3>>("channelsLow")),
53  channelsMid_(config.getParameter<std::array<unsigned int, 3>>("channelsMid")),
54  channelsHigh_(config.getParameter<std::array<unsigned int, 3>>("channelsHigh")),
55  channelFinOr_(config.getParameter<unsigned int>("channelFinOr")),
56  algoBlocksToken_(consumes<P2GTAlgoBlockMap>(config.getParameter<edm::InputTag>("algoBlocksTag"))),
57  boardDataWriter_(l1t::demo::parseFileFormat(config.getParameter<std::string>("patternFormat")),
58  config.getParameter<std::string>("outputFilename"),
59  config.getParameter<std::string>("outputFileExtension"),
60  9,
61  2,
62  config.getParameter<unsigned int>("maxLines"),
63  [&]() {
64  l1t::demo::BoardDataWriter::ChannelMap_t channelMap;
65  channelMap.insert({l1t::demo::LinkId{"BeforeBxMaskAndPrescaleLow", channelsLow_[0]},
66  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsLow_[0]}}});
67  channelMap.insert({l1t::demo::LinkId{"BeforePrescaleLow", channelsLow_[1]},
68  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsLow_[1]}}});
69  channelMap.insert({l1t::demo::LinkId{"FinalLow", channelsLow_[2]},
70  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsLow_[2]}}});
71 
72  channelMap.insert({l1t::demo::LinkId{"BeforeBxMaskAndPrescaleMid", channelsMid_[0]},
73  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsMid_[0]}}});
74  channelMap.insert({l1t::demo::LinkId{"BeforePrescaleMid", channelsMid_[1]},
75  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsMid_[1]}}});
76  channelMap.insert({l1t::demo::LinkId{"FinalMid", channelsMid_[2]},
77  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsMid_[2]}}});
78 
79  channelMap.insert({l1t::demo::LinkId{"BeforeBxMaskAndPrescaleHigh", channelsHigh_[0]},
80  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsHigh_[0]}}});
81  channelMap.insert({l1t::demo::LinkId{"BeforePrescaleHigh", channelsHigh_[1]},
82  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsHigh_[1]}}});
83  channelMap.insert({l1t::demo::LinkId{"FinalHigh", channelsHigh_[2]},
84  {l1t::demo::ChannelSpec{2, 0, 0}, {channelsHigh_[2]}}});
85 
86  channelMap.insert({l1t::demo::LinkId{"FinOr", channelFinOr_},
87  {l1t::demo::ChannelSpec{2, 0, 0}, {channelFinOr_}}});
88 
89  return channelMap;
90  }()),
91  linkData_(),
92  tmuxCounter_(0) {}
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
FileFormat parseFileFormat(const std::string &)
Definition: utilities.cc:73
Definition: config.py:1
const std::array< unsigned int, 3 > channelsMid_
const edm::EDGetTokenT< P2GTAlgoBlockMap > algoBlocksToken_
const unsigned int channelFinOr_
const std::array< unsigned int, 3 > channelsHigh_
const std::array< unsigned int, 3 > channelsLow_
l1t::demo::BoardDataWriter boardDataWriter_

Member Function Documentation

◆ analyze()

void L1GTFinOrBoardWriter::analyze ( const edm::Event event,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 94 of file L1GTFinOrBoardWriter.cc.

References l1t::demo::BoardDataWriter::addEvent(), algoBlocksToken_, MillePedeAlignmentAlgorithm_cfi::algoName, boardDataWriter_, channelFinOr_, channelsHigh_, channelsLow_, channelsMid_, heavyIonCSV_trainingSettings::idx, linkData_, and tmuxCounter_.

94  {
95  const P2GTAlgoBlockMap& algoBlocks = event.get(algoBlocksToken_);
96 
97  auto algoBlockIt = algoBlocks.begin();
98 
99  if (tmuxCounter_ == 0) {
100  linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleLow", channelsLow_[0]}] = std::vector<ap_uint<64>>(18, 0);
101  linkData_[l1t::demo::LinkId{"BeforePrescaleLow", channelsLow_[1]}] = std::vector<ap_uint<64>>(18, 0);
102  linkData_[l1t::demo::LinkId{"FinalLow", channelsLow_[2]}] = std::vector<ap_uint<64>>(18, 0);
103  linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleMid", channelsMid_[0]}] = std::vector<ap_uint<64>>(18, 0);
104  linkData_[l1t::demo::LinkId{"BeforePrescaleMid", channelsMid_[1]}] = std::vector<ap_uint<64>>(18, 0);
105  linkData_[l1t::demo::LinkId{"FinalMid", channelsMid_[2]}] = std::vector<ap_uint<64>>(18, 0);
106  linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleHigh", channelsHigh_[0]}] = std::vector<ap_uint<64>>(18, 0);
107  linkData_[l1t::demo::LinkId{"BeforePrescaleHigh", channelsHigh_[1]}] = std::vector<ap_uint<64>>(18, 0);
108  linkData_[l1t::demo::LinkId{"FinalHigh", channelsHigh_[2]}] = std::vector<ap_uint<64>>(18, 0);
109  linkData_[l1t::demo::LinkId{"FinOr", channelFinOr_}] = std::vector<ap_uint<64>>(18, 0);
110  }
111 
112  for (std::size_t word = 0; word < 9; word++) {
113  for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) {
114  auto& [alogName, algoBlock] = *algoBlockIt;
115  linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleLow", channelsLow_[0]}][word + tmuxCounter_ * 9].set(
116  idx, algoBlock.decisionBeforeBxMaskAndPrescale());
117  linkData_[l1t::demo::LinkId{"BeforePrescaleLow", channelsLow_[1]}][word + tmuxCounter_ * 9].set(
118  idx, algoBlock.decisionBeforePrescale());
119  linkData_[l1t::demo::LinkId{"FinalLow", channelsLow_[2]}][word + tmuxCounter_ * 9].set(idx,
120  algoBlock.decisionFinal());
121  }
122  }
123 
124  for (std::size_t word = 0; word < 9; word++) {
125  for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) {
126  auto& [alogName, algoBlock] = *algoBlockIt;
127  linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleMid", channelsMid_[0]}][word + tmuxCounter_ * 9].set(
128  idx, algoBlock.decisionBeforeBxMaskAndPrescale());
129  linkData_[l1t::demo::LinkId{"BeforePrescaleMid", channelsMid_[1]}][word + tmuxCounter_ * 9].set(
130  idx, algoBlock.decisionBeforePrescale());
131  linkData_[l1t::demo::LinkId{"FinalMid", channelsMid_[2]}][word + tmuxCounter_ * 9].set(idx,
132  algoBlock.decisionFinal());
133  }
134  }
135 
136  for (std::size_t word = 0; word < 9; word++) {
137  for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) {
138  auto& [algoName, algoBlock] = *algoBlockIt;
139  linkData_[l1t::demo::LinkId{"BeforeBxMaskAndPrescaleHigh", channelsHigh_[0]}][word + tmuxCounter_ * 9].set(
140  idx, algoBlock.decisionBeforeBxMaskAndPrescale());
141  linkData_[l1t::demo::LinkId{"BeforePrescaleHigh", channelsHigh_[1]}][word + tmuxCounter_ * 9].set(
142  idx, algoBlock.decisionBeforePrescale());
143  linkData_[l1t::demo::LinkId{"FinalHigh", channelsHigh_[2]}][word + tmuxCounter_ * 9].set(
144  idx, algoBlock.decisionFinal());
145  }
146  }
147 
148  bool vetoed = false, vetoedPreview = false;
149  int finOrByTypes = 0, finOrPreviewByTypes = 0;
150  for (auto algoBlockIt = algoBlocks.begin(); algoBlockIt != algoBlocks.end(); algoBlockIt++) {
151  auto& [alogName, algoBlock] = *algoBlockIt;
152  vetoed |= (algoBlock.isVeto() && algoBlock.decisionFinal());
153  vetoedPreview |= (algoBlock.isVeto() && algoBlock.decisionFinalPreview());
154  finOrByTypes |= algoBlock.decisionFinal() ? algoBlock.triggerTypes() : 0;
155  finOrPreviewByTypes |= algoBlock.decisionFinalPreview() ? algoBlock.triggerTypes() : 0;
156  }
157 
158  // Add FinOrTrigger bits per https://gitlab.cern.ch/cms-cactus/phase2/firmware/gt-final-or#output-finor-bits
159  ap_uint<64> finOrBits(0);
160  finOrBits(7, 0) = finOrByTypes;
161  finOrBits(15, 8) = finOrPreviewByTypes;
162  finOrBits(23, 16) = vetoed ? 0 : finOrByTypes;
163  finOrBits(31, 24) = vetoedPreview ? 0 : finOrPreviewByTypes;
164 
165  linkData_[l1t::demo::LinkId{"FinOr", channelFinOr_}][0 + tmuxCounter_ * 9] = finOrBits;
166 
167  if (tmuxCounter_ == 1) {
169  }
170 
171  tmuxCounter_ = (tmuxCounter_ + 1) % 2;
172 }
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
void addEvent(const EventData &data)
std::map< std::string, P2GTAlgoBlock > P2GTAlgoBlockMap
Definition: P2GTAlgoBlock.h:11
const std::array< unsigned int, 3 > channelsMid_
uint64_t word
const edm::EDGetTokenT< P2GTAlgoBlockMap > algoBlocksToken_
const unsigned int channelFinOr_
Class representing information phase-2 ATCA I/O data corresponding to a single event, with logical channel IDs (essentially string-uint pairs, e.g. tracks-0 to tracks-17).
Definition: EventData.h:28
const std::array< unsigned int, 3 > channelsHigh_
const std::array< unsigned int, 3 > channelsLow_
l1t::demo::BoardDataWriter boardDataWriter_

◆ endJob()

void L1GTFinOrBoardWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 174 of file L1GTFinOrBoardWriter.cc.

References l1t::demo::BoardDataWriter::addEvent(), boardDataWriter_, l1t::demo::BoardDataWriter::flush(), linkData_, and tmuxCounter_.

174  {
175  if (tmuxCounter_ == 1) {
177  }
178 
180 }
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
void addEvent(const EventData &data)
Class representing information phase-2 ATCA I/O data corresponding to a single event, with logical channel IDs (essentially string-uint pairs, e.g. tracks-0 to tracks-17).
Definition: EventData.h:28
l1t::demo::BoardDataWriter boardDataWriter_

◆ fillDescriptions()

void L1GTFinOrBoardWriter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 182 of file L1GTFinOrBoardWriter.cc.

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

182  {
184  desc.add<std::string>("outputFilename");
185  desc.add<std::string>("outputFileExtension", "txt");
186  desc.add<edm::InputTag>("algoBlocksTag");
187  desc.add<std::vector<unsigned int>>("channelsLow");
188  desc.add<std::vector<unsigned int>>("channelsMid");
189  desc.add<std::vector<unsigned int>>("channelsHigh");
190  desc.add<unsigned int>("channelFinOr");
191  desc.add<unsigned int>("maxLines", 1024);
192  desc.add<std::string>("patternFormat", "EMPv2");
193 
194  descriptions.addDefault(desc);
195 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ algoBlocksToken_

const edm::EDGetTokenT<P2GTAlgoBlockMap> L1GTFinOrBoardWriter::algoBlocksToken_
private

Definition at line 44 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze().

◆ boardDataWriter_

l1t::demo::BoardDataWriter L1GTFinOrBoardWriter::boardDataWriter_
private

Definition at line 45 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and endJob().

◆ channelFinOr_

const unsigned int L1GTFinOrBoardWriter::channelFinOr_
private

Definition at line 43 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and L1GTFinOrBoardWriter().

◆ channelsHigh_

const std::array<unsigned int, 3> L1GTFinOrBoardWriter::channelsHigh_
private

Definition at line 42 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and L1GTFinOrBoardWriter().

◆ channelsLow_

const std::array<unsigned int, 3> L1GTFinOrBoardWriter::channelsLow_
private

Definition at line 40 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and L1GTFinOrBoardWriter().

◆ channelsMid_

const std::array<unsigned int, 3> L1GTFinOrBoardWriter::channelsMid_
private

Definition at line 41 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and L1GTFinOrBoardWriter().

◆ linkData_

std::map<l1t::demo::LinkId, std::vector<ap_uint<64> > > L1GTFinOrBoardWriter::linkData_
private

Definition at line 47 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and endJob().

◆ tmuxCounter_

std::size_t L1GTFinOrBoardWriter::tmuxCounter_
private

Definition at line 48 of file L1GTFinOrBoardWriter.cc.

Referenced by analyze(), and endJob().