CMS 3D CMS Logo

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

Public Member Functions

 L1CTJetFileWriter (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const 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
 
bool wantsStreamRuns () const
 
 ~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
 
std::vector< ap_uint< 64 > > encodeJets (const std::vector< l1t::PFJet > jets)
 
void endJob () override
 

Private Attributes

std::map< l1t::demo::LinkId, std::pair< l1t::demo::ChannelSpec, std::vector< size_t > > > channelSpecsOutputToGT_
 
size_t ctl2BoardTMUX_
 
l1t::demo::BoardDataWriter fileWriterOutputToGT_
 
size_t gapLengthOutput_
 
edm::EDGetTokenT< edm::View< l1t::PFJet > > jetsToken_
 
size_t maxLinesPerFile_
 
size_t nFramesPerBX_
 
unsigned nJets_
 

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 24 of file L1CTJetFileWriter.cc.

Constructor & Destructor Documentation

◆ L1CTJetFileWriter()

L1CTJetFileWriter::L1CTJetFileWriter ( const edm::ParameterSet iConfig)
explicit

Definition at line 48 of file L1CTJetFileWriter.cc.

References ctl2BoardTMUX_, and gapLengthOutput_.

49  : nJets_(iConfig.getParameter<unsigned>("nJets")),
50  nFramesPerBX_(iConfig.getParameter<unsigned>("nFramesPerBX")),
51  ctl2BoardTMUX_(iConfig.getParameter<unsigned>("TMUX")),
53  maxLinesPerFile_(iConfig.getParameter<unsigned>("maxLinesPerFile")),
57  iConfig.getParameter<std::string>("outputFilename"),
58  iConfig.getParameter<std::string>("outputFileExtension"),
std::map< l1t::demo::LinkId, std::pair< l1t::demo::ChannelSpec, std::vector< size_t > > > channelSpecsOutputToGT_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
FileFormat parseFileFormat(const std::string &)
Definition: utilities.cc:73
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
l1t::demo::BoardDataWriter fileWriterOutputToGT_
edm::EDGetTokenT< edm::View< l1t::PFJet > > jetsToken_

Member Function Documentation

◆ analyze()

void L1CTJetFileWriter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 64 of file L1CTJetFileWriter.cc.

References l1t::demo::EventData::add(), l1t::demo::BoardDataWriter::addEvent(), filterCSVwithJSON::copy, encodeJets(), fileWriterOutputToGT_, mps_fire::i, iEvent, dqmiolumiharvest::j, PDWG_EXODelayedJetMET_cff::jets, and jetsToken_.

64  {
65  using namespace edm;
66 
67  // 1) Encode jet information onto vectors containing link data
68  // TODO remove the sort here and sort the input collection where it's created
70  std::vector<l1t::PFJet> sortedJets;
71  sortedJets.reserve(jets.size());
72  std::copy(jets.begin(), jets.end(), std::back_inserter(sortedJets));
73 
74  std::stable_sort(
75  sortedJets.begin(), sortedJets.end(), [](l1t::PFJet i, l1t::PFJet j) { return (i.hwPt() > j.hwPt()); });
76  const auto outputJets(encodeJets(sortedJets));
77 
78  // 2) Pack jet information into 'event data' object, and pass that to file writer
79  l1t::demo::EventData eventDataJets;
80  eventDataJets.add({"jets", 0}, outputJets);
81  fileWriterOutputToGT_.addEvent(eventDataJets);
82 }
void addEvent(const EventData &data)
void add(const LinkId &, const std::vector< ap_uint< 64 >> &)
Definition: EventData.cc:14
int iEvent
Definition: GenABIO.cc:224
l1t::demo::BoardDataWriter fileWriterOutputToGT_
std::vector< ap_uint< 64 > > encodeJets(const std::vector< l1t::PFJet > jets)
HLT enums.
edm::EDGetTokenT< edm::View< l1t::PFJet > > jetsToken_
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

◆ encodeJets()

std::vector< ap_uint< 64 > > L1CTJetFileWriter::encodeJets ( const std::vector< l1t::PFJet jets)
private

Definition at line 90 of file L1CTJetFileWriter.cc.

References mps_fire::i, dqmiolumiharvest::j, PDWG_EXODelayedJetMET_cff::jets, and nJets_.

Referenced by analyze().

90  {
91  std::vector<ap_uint<64>> jet_words;
92  for (unsigned i = 0; i < nJets_; i++) {
93  l1t::PFJet j;
94  if (i < jets.size()) {
95  j = jets.at(i);
96  } else { // pad up to nJets_ with null jets
97  l1t::PFJet j(0, 0, 0, 0, 0, 0);
98  }
99  jet_words.push_back(j.encodedJet()[0]);
100  jet_words.push_back(j.encodedJet()[1]);
101  }
102  return jet_words;
103 }

◆ endJob()

void L1CTJetFileWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 85 of file L1CTJetFileWriter.cc.

References fileWriterOutputToGT_, and l1t::demo::BoardDataWriter::flush().

85  {
86  // Writing pending events to file before exiting
88 }
l1t::demo::BoardDataWriter fileWriterOutputToGT_

◆ fillDescriptions()

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

Definition at line 106 of file L1CTJetFileWriter.cc.

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

106  {
107  //The following says we do not know what parameters are allowed so do no validation
108  // Please change this to state exactly what you do use, even if it is no parameters
110  desc.add<edm::InputTag>("jets");
111  desc.add<std::string>("outputFilename");
112  desc.add<std::string>("outputFileExtension", "txt");
113  desc.add<uint32_t>("nJets", 12);
114  desc.add<uint32_t>("nFramesPerBX", 9);
115  desc.add<uint32_t>("TMUX", 6);
116  desc.add<uint32_t>("maxLinesPerFile", 1024);
117  desc.add<std::string>("format", "EMPv2");
118  descriptions.addDefault(desc);
119 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ channelSpecsOutputToGT_

std::map<l1t::demo::LinkId, std::pair<l1t::demo::ChannelSpec, std::vector<size_t> > > L1CTJetFileWriter::channelSpecsOutputToGT_
private

Definition at line 37 of file L1CTJetFileWriter.cc.

◆ ctl2BoardTMUX_

size_t L1CTJetFileWriter::ctl2BoardTMUX_
private

Definition at line 34 of file L1CTJetFileWriter.cc.

Referenced by L1CTJetFileWriter().

◆ fileWriterOutputToGT_

l1t::demo::BoardDataWriter L1CTJetFileWriter::fileWriterOutputToGT_
private

Definition at line 45 of file L1CTJetFileWriter.cc.

Referenced by analyze(), and endJob().

◆ gapLengthOutput_

size_t L1CTJetFileWriter::gapLengthOutput_
private

Definition at line 35 of file L1CTJetFileWriter.cc.

Referenced by L1CTJetFileWriter().

◆ jetsToken_

edm::EDGetTokenT<edm::View<l1t::PFJet> > L1CTJetFileWriter::jetsToken_
private

Definition at line 44 of file L1CTJetFileWriter.cc.

Referenced by analyze().

◆ maxLinesPerFile_

size_t L1CTJetFileWriter::maxLinesPerFile_
private

Definition at line 36 of file L1CTJetFileWriter.cc.

◆ nFramesPerBX_

size_t L1CTJetFileWriter::nFramesPerBX_
private

Definition at line 33 of file L1CTJetFileWriter.cc.

◆ nJets_

unsigned L1CTJetFileWriter::nJets_
private

Definition at line 32 of file L1CTJetFileWriter.cc.

Referenced by encodeJets().