CMS 3D CMS Logo

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

Public Member Functions

 L1GTAlgoBoardWriter (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 std::array< unsigned long long, 9 > algoBitMask_
 
const edm::EDGetTokenT< P2GTAlgoBlockMapalgoBlocksToken_
 
l1t::demo::BoardDataWriter boardDataWriter_
 
const std::array< unsigned int, 2 > channels_
 
unsigned int eventCounter_
 
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
 
unsigned int maxEvents_
 
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 32 of file L1GTAlgoBoardWriter.cc.

Constructor & Destructor Documentation

◆ L1GTAlgoBoardWriter()

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

Definition at line 66 of file L1GTAlgoBoardWriter.cc.

References ewkTauDQM_cfi::channels.

67  : eventCounter_(0),
68  maxEvents_(config.getUntrackedParameter<unsigned int>("maxEvents")),
69  channels_(
70  convert<unsigned int, 2>(config.getUntrackedParameter<std::vector<unsigned int>>("channels"), "channels")),
71  algoBitMask_(convert<unsigned long long, 9>(
72  config.getUntrackedParameter<std::vector<unsigned long long>>("algoBitMask"), "algoBitMask")),
73  algoBlocksToken_(consumes<P2GTAlgoBlockMap>(config.getUntrackedParameter<edm::InputTag>("algoBlocksTag"))),
75  l1t::demo::parseFileFormat(config.getUntrackedParameter<std::string>("patternFormat")),
76  config.getUntrackedParameter<std::string>("filename"),
77  config.getUntrackedParameter<std::string>("fileExtension"),
78  9,
79  2,
80  config.getUntrackedParameter<unsigned int>("maxFrames"),
81  [](const std::array<unsigned int, 2>& channels) {
82  l1t::demo::BoardDataWriter::ChannelMap_t channelMap;
83  for (unsigned int channel : channels) {
84  channelMap.insert({l1t::demo::LinkId{"Algos", channel}, {l1t::demo::ChannelSpec{2, 0, 0}, {channel}}});
85  }
86  return channelMap;
87  }(channels_)),
88  linkData_(),
89  tmuxCounter_(0) {}
const std::array< unsigned long long, 9 > algoBitMask_
const edm::EDGetTokenT< P2GTAlgoBlockMap > algoBlocksToken_
FileFormat parseFileFormat(const std::string &)
Definition: utilities.cc:73
Definition: config.py:1
const std::array< unsigned int, 2 > channels_
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
l1t::demo::BoardDataWriter boardDataWriter_

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 91 of file L1GTAlgoBoardWriter.cc.

References l1t::demo::BoardDataWriter::addEvent(), algoBitMask_, algoBlocksToken_, MillePedeAlignmentAlgorithm_cfi::algoName, boardDataWriter_, channels_, eventCounter_, l1t::demo::BoardDataWriter::flush(), heavyIonCSV_trainingSettings::idx, linkData_, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, maxEvents_, and tmuxCounter_.

91  {
92  const P2GTAlgoBlockMap& algoBlocks = event.get(algoBlocksToken_);
93 
94  auto algoBlockIt = algoBlocks.begin();
95  auto algoMaskIt = algoBitMask_.begin();
96 
97  for (unsigned int channel : channels_) {
98  if (tmuxCounter_ == 0) {
99  linkData_[{"Algos", channel}] = std::vector<ap_uint<64>>(18, 0);
100  }
101 
102  for (std::size_t word = 0; word < 9; word++) {
103  ap_uint<64> mask = algoMaskIt != algoBitMask_.end() ? *algoMaskIt++ : ~static_cast<unsigned long long>(0);
104 
105  for (std::size_t idx = 0; idx < 64 && algoBlockIt != algoBlocks.end(); idx++, algoBlockIt++) {
106  auto& [algoName, algoBlock] = *algoBlockIt;
107  linkData_[{"Algos", channel}][word + tmuxCounter_ * 9].set(
108  idx, algoBlock.decisionBeforeBxMaskAndPrescale() && mask.bit(idx));
109  }
110  }
111  }
112 
113  if (tmuxCounter_ == 1) {
115  }
116 
117  tmuxCounter_ = (tmuxCounter_ + 1) % 2;
118  eventCounter_++;
119 
120  if (maxEvents_ != 0 && eventCounter_ == maxEvents_) {
122  eventCounter_ = 0;
123  }
124 }
const std::array< unsigned long long, 9 > algoBitMask_
const edm::EDGetTokenT< P2GTAlgoBlockMap > algoBlocksToken_
void addEvent(const EventData &data)
std::map< std::string, P2GTAlgoBlock > P2GTAlgoBlockMap
Definition: P2GTAlgoBlock.h:11
uint64_t word
const std::array< unsigned int, 2 > channels_
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
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_

◆ endJob()

void L1GTAlgoBoardWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 126 of file L1GTAlgoBoardWriter.cc.

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

126  {
127  if (tmuxCounter_ == 1) {
129  }
130 
132 }
void addEvent(const EventData &data)
std::map< l1t::demo::LinkId, std::vector< ap_uint< 64 > > > linkData_
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 L1GTAlgoBoardWriter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 134 of file L1GTAlgoBoardWriter.cc.

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

134  {
136  desc.addUntracked<std::string>("filename");
137  desc.addUntracked<std::string>("fileExtension", "txt");
138  desc.addUntracked<edm::InputTag>("algoBlocksTag");
139  desc.addUntracked<unsigned int>("maxEvents", 0);
140  desc.addUntracked<std::vector<unsigned int>>("channels");
141  desc.addUntracked<std::vector<unsigned long long>>("algoBitMask",
142  {0xffffffffffffffffull,
143  0xffffffffffffffffull,
144  0xffffffffffffffffull,
145  0xffffffffffffffffull,
146  0xffffffffffffffffull,
147  0xffffffffffffffffull,
148  0xffffffffffffffffull,
149  0xffffffffffffffffull,
150  0xffffffffffffffffull});
151  desc.addUntracked<unsigned int>("maxFrames", 1024);
152  desc.addUntracked<std::string>("patternFormat", "EMPv2");
153 
154  descriptions.addDefault(desc);
155 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ algoBitMask_

const std::array<unsigned long long, 9> L1GTAlgoBoardWriter::algoBitMask_
private

Definition at line 46 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze().

◆ algoBlocksToken_

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

Definition at line 47 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze().

◆ boardDataWriter_

l1t::demo::BoardDataWriter L1GTAlgoBoardWriter::boardDataWriter_
private

Definition at line 48 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze(), and endJob().

◆ channels_

const std::array<unsigned int, 2> L1GTAlgoBoardWriter::channels_
private

Definition at line 45 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze().

◆ eventCounter_

unsigned int L1GTAlgoBoardWriter::eventCounter_
private

Definition at line 42 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze().

◆ linkData_

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

Definition at line 50 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze(), and endJob().

◆ maxEvents_

unsigned int L1GTAlgoBoardWriter::maxEvents_
private

Definition at line 43 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze().

◆ tmuxCounter_

std::size_t L1GTAlgoBoardWriter::tmuxCounter_
private

Definition at line 51 of file L1GTAlgoBoardWriter.cc.

Referenced by analyze(), and endJob().