CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
GTTFileWriter Class Reference

#include <L1Trigger/DemonstratorTools/plugins/GTTFileWriter.cc>

Inheritance diagram for GTTFileWriter:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 GTTFileWriter (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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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 Types

typedef TTTrack< Ref_Phase2TrackerDigi_Track_t
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< edm::View< Track_t > > convertedTracksToken_
 
l1t::demo::BoardDataWriter fileWriterConvertedTracks_
 
l1t::demo::BoardDataWriter fileWriterInputTracks_
 
l1t::demo::BoardDataWriter fileWriterOutputToCorrelator_
 
const std::map< l1t::demo::LinkId, std::vector< size_t > > kChannelIdsInput
 
const std::map< std::string, l1t::demo::ChannelSpeckChannelSpecsInput
 
const std::map< l1t::demo::LinkId, std::pair< l1t::demo::ChannelSpec, std::vector< size_t > > > kChannelSpecsOutputToCorrelator
 
edm::EDGetTokenT< edm::View< Track_t > > tracksToken_
 
edm::EDGetTokenT< edm::View< l1t::VertexWord > > verticesToken_
 

Static Private Attributes

static constexpr size_t kFramesPerTMUXPeriod = 9
 
static constexpr size_t kGapLengthInput = 6
 
static constexpr size_t kGapLengthOutput = 44
 
static constexpr size_t kGTTBoardTMUX = 6
 
static constexpr size_t kMaxLinesPerFile = 1024
 
static constexpr size_t kTrackTMUX = 18
 

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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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

Description: Example EDAnalyzer class, illustrating how BoardDataWriter can be used to write I/O buffer files for hardware/firmware tests

Implementation: [Notes on implementation]

Definition at line 50 of file GTTFileWriter.cc.

Member Typedef Documentation

◆ Track_t

Definition at line 96 of file GTTFileWriter.cc.

Constructor & Destructor Documentation

◆ GTTFileWriter()

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

Definition at line 116 of file GTTFileWriter.cc.

119  consumes<edm::View<Track_t>>(iConfig.getUntrackedParameter<edm::InputTag>("convertedTracks"))),
122  iConfig.getUntrackedParameter<std::string>("inputFilename"),
129  iConfig.getUntrackedParameter<std::string>("inputConvertedFilename"),
136  iConfig.getUntrackedParameter<std::string>("outputFilename"),
l1t::demo::BoardDataWriter fileWriterOutputToCorrelator_
FileFormat parseFileFormat(const std::string &)
Definition: utilities.cc:70
edm::EDGetTokenT< edm::View< l1t::VertexWord > > verticesToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< Track_t > > tracksToken_
static constexpr size_t kMaxLinesPerFile
static constexpr size_t kFramesPerTMUXPeriod
l1t::demo::BoardDataWriter fileWriterInputTracks_
const std::map< l1t::demo::LinkId, std::pair< l1t::demo::ChannelSpec, std::vector< size_t > > > kChannelSpecsOutputToCorrelator
edm::EDGetTokenT< edm::View< Track_t > > convertedTracksToken_
const std::map< l1t::demo::LinkId, std::vector< size_t > > kChannelIdsInput
const std::map< std::string, l1t::demo::ChannelSpec > kChannelSpecsInput
static constexpr size_t kGTTBoardTMUX
l1t::demo::BoardDataWriter fileWriterConvertedTracks_

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 142 of file GTTFileWriter.cc.

References l1t::demo::EventData::add(), l1t::demo::BoardDataWriter::addEvent(), convertedTracksToken_, l1t::demo::codecs::encodeTracks(), l1t::demo::codecs::encodeVertices(), fileWriterConvertedTracks_, fileWriterInputTracks_, fileWriterOutputToCorrelator_, mps_fire::i, iEvent, tracksToken_, and verticesToken_.

142  {
143  using namespace edm;
144  using namespace l1t::demo::codecs;
145 
146  // 1) Encode track information onto vectors containing link data
147  const auto trackData(encodeTracks(iEvent.get(tracksToken_)));
148  const auto convertedTrackData(encodeTracks(iEvent.get(convertedTracksToken_)));
149  const auto outputData(encodeVertices(iEvent.get(verticesToken_)));
150 
151  // 2) Pack track information into 'event data' object, and pass that to file writer
152  l1t::demo::EventData eventDataTracks;
153  l1t::demo::EventData eventDataConvertedTracks;
154  for (size_t i = 0; i < 18; i++) {
155  eventDataTracks.add({"tracks", i}, trackData.at(i));
156  eventDataConvertedTracks.add({"tracks", i}, convertedTrackData.at(i));
157  }
158 
159  l1t::demo::EventData eventDataVertices;
160  eventDataVertices.add({"vertices", 0}, outputData.at(0));
161 
162  fileWriterInputTracks_.addEvent(eventDataTracks);
163  fileWriterConvertedTracks_.addEvent(eventDataConvertedTracks);
164  fileWriterOutputToCorrelator_.addEvent(eventDataVertices);
165 }
l1t::demo::BoardDataWriter fileWriterOutputToCorrelator_
void addEvent(const EventData &data)
edm::EDGetTokenT< edm::View< l1t::VertexWord > > verticesToken_
void add(const LinkId &, const std::vector< ap_uint< 64 >> &)
Definition: EventData.cc:14
std::array< std::vector< ap_uint< 64 > >, 18 > encodeTracks(const edm::View< TTTrack< Ref_Phase2TrackerDigi_ >> &, int debug=0)
Definition: codecs_tracks.cc:9
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< Track_t > > tracksToken_
l1t::demo::BoardDataWriter fileWriterInputTracks_
edm::EDGetTokenT< edm::View< Track_t > > convertedTracksToken_
std::array< std::vector< ap_uint< 64 > >, 1 > encodeVertices(const edm::View< l1t::VertexWord > &)
HLT enums.
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 fileWriterConvertedTracks_

◆ endJob()

void GTTFileWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 168 of file GTTFileWriter.cc.

References fileWriterConvertedTracks_, fileWriterInputTracks_, fileWriterOutputToCorrelator_, and l1t::demo::BoardDataWriter::flush().

168  {
169  // Writing pending events to file before exiting
173 }
l1t::demo::BoardDataWriter fileWriterOutputToCorrelator_
l1t::demo::BoardDataWriter fileWriterInputTracks_
l1t::demo::BoardDataWriter fileWriterConvertedTracks_

◆ fillDescriptions()

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

Definition at line 176 of file GTTFileWriter.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_2022v11_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

176  {
177  // GTTFileWriter
179  desc.addUntracked<edm::InputTag>("tracks", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"));
180  desc.addUntracked<edm::InputTag>("convertedTracks", edm::InputTag("L1GTTInputProducer", "Level1TTTracksConverted"));
181  desc.addUntracked<edm::InputTag>("vertices", edm::InputTag("VertexProducer", "l1verticesEmulation"));
182  desc.addUntracked<std::string>("inputFilename", "L1GTTInputFile");
183  desc.addUntracked<std::string>("inputConvertedFilename", "L1GTTInputConvertedFile");
184  desc.addUntracked<std::string>("outputFilename", "L1GTTOutputToCorrelatorFile");
185  desc.addUntracked<std::string>("format", "APx");
186  descriptions.add("GTTFileWriter", desc);
187 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ convertedTracksToken_

edm::EDGetTokenT<edm::View<Track_t> > GTTFileWriter::convertedTracksToken_
private

Definition at line 104 of file GTTFileWriter.cc.

Referenced by analyze().

◆ fileWriterConvertedTracks_

l1t::demo::BoardDataWriter GTTFileWriter::fileWriterConvertedTracks_
private

Definition at line 108 of file GTTFileWriter.cc.

Referenced by analyze(), and endJob().

◆ fileWriterInputTracks_

l1t::demo::BoardDataWriter GTTFileWriter::fileWriterInputTracks_
private

Definition at line 107 of file GTTFileWriter.cc.

Referenced by analyze(), and endJob().

◆ fileWriterOutputToCorrelator_

l1t::demo::BoardDataWriter GTTFileWriter::fileWriterOutputToCorrelator_
private

Definition at line 109 of file GTTFileWriter.cc.

Referenced by analyze(), and endJob().

◆ kChannelIdsInput

const std::map<l1t::demo::LinkId, std::vector<size_t> > GTTFileWriter::kChannelIdsInput
private
Initial value:
= {
{{"tracks", 0}, {0, 18, 36}},
{{"tracks", 1}, {1, 19, 37}},
{{"tracks", 2}, {2, 20, 38}},
{{"tracks", 3}, {3, 21, 39}},
{{"tracks", 4}, {4, 22, 40}},
{{"tracks", 5}, {5, 23, 41}},
{{"tracks", 6}, {6, 24, 42}},
{{"tracks", 7}, {7, 25, 43}},
{{"tracks", 8}, {8, 26, 44}},
{{"tracks", 9}, {9, 27, 45}},
{{"tracks", 10}, {10, 28, 46}},
{{"tracks", 11}, {11, 29, 47}},
{{"tracks", 12}, {12, 30, 48}},
{{"tracks", 13}, {13, 31, 49}},
{{"tracks", 14}, {14, 32, 50}},
{{"tracks", 15}, {15, 33, 51}},
{{"tracks", 16}, {16, 34, 52}},
{{"tracks", 17}, {17, 35, 53}}}

Definition at line 66 of file GTTFileWriter.cc.

◆ kChannelSpecsInput

const std::map<std::string, l1t::demo::ChannelSpec> GTTFileWriter::kChannelSpecsInput
private
Initial value:
= {
{"tracks", {kTrackTMUX, kGapLengthInput}}}

Definition at line 87 of file GTTFileWriter.cc.

◆ kChannelSpecsOutputToCorrelator

const std::map<l1t::demo::LinkId, std::pair<l1t::demo::ChannelSpec, std::vector<size_t> > > GTTFileWriter::kChannelSpecsOutputToCorrelator
private
Initial value:
= {
{{"vertices", 0}, {{kGTTBoardTMUX, kGapLengthOutput}, {0}}}}

Definition at line 92 of file GTTFileWriter.cc.

◆ kFramesPerTMUXPeriod

constexpr size_t GTTFileWriter::kFramesPerTMUXPeriod = 9
staticprivate

Definition at line 59 of file GTTFileWriter.cc.

◆ kGapLengthInput

constexpr size_t GTTFileWriter::kGapLengthInput = 6
staticprivate

Definition at line 60 of file GTTFileWriter.cc.

◆ kGapLengthOutput

constexpr size_t GTTFileWriter::kGapLengthOutput = 44
staticprivate

Definition at line 61 of file GTTFileWriter.cc.

◆ kGTTBoardTMUX

constexpr size_t GTTFileWriter::kGTTBoardTMUX = 6
staticprivate

Definition at line 63 of file GTTFileWriter.cc.

◆ kMaxLinesPerFile

constexpr size_t GTTFileWriter::kMaxLinesPerFile = 1024
staticprivate

Definition at line 64 of file GTTFileWriter.cc.

◆ kTrackTMUX

constexpr size_t GTTFileWriter::kTrackTMUX = 18
staticprivate

Definition at line 62 of file GTTFileWriter.cc.

◆ tracksToken_

edm::EDGetTokenT<edm::View<Track_t> > GTTFileWriter::tracksToken_
private

Definition at line 103 of file GTTFileWriter.cc.

Referenced by analyze().

◆ verticesToken_

edm::EDGetTokenT<edm::View<l1t::VertexWord> > GTTFileWriter::verticesToken_
private

Definition at line 105 of file GTTFileWriter.cc.

Referenced by analyze().