CMS 3D CMS Logo

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

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

Inheritance diagram for GTTFileReader:
edm::stream::EDProducer<>

Public Member Functions

 GTTFileReader (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef TTTrack< Ref_Phase2TrackerDigi_L1Track
 
typedef std::vector< L1TrackTTTrackCollection
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::optional< l1t::demo::BoardDataReaderfileReaderInputTracks_ = std::nullopt
 
std::optional< l1t::demo::BoardDataReaderfileReaderOutputToCorrelator_ = std::nullopt
 
std::optional< l1t::demo::BoardDataReaderfileReaderOutputToGlobalTrigger_ = std::nullopt
 
const size_t kEmptyFramesInputTracks_
 
const size_t kEmptyFramesOutputToCorrelator_
 
const size_t kEmptyFramesOutputToGlobalTrigger_
 
std::string l1TrackCollectionName_
 
std::string l1VertexCollectionName_
 
const bool processInputTracks_
 
const bool processOutputToCorrelator_
 
const bool processOutputToGlobalTrigger_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Example EDProducer class, illustrating how BoardDataReader can be used to read I/O buffer files (that have been created in hardware/firmware tests), decode the contained data, and store this in EDM collections.

Implementation: [Notes on implementation]

Definition at line 45 of file GTTFileReader.cc.

Member Typedef Documentation

◆ L1Track

Definition at line 53 of file GTTFileReader.cc.

◆ TTTrackCollection

typedef std::vector<L1Track> GTTFileReader::TTTrackCollection
private

Definition at line 54 of file GTTFileReader.cc.

Constructor & Destructor Documentation

◆ GTTFileReader()

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

Definition at line 73 of file GTTFileReader.cc.

References fileReaderInputTracks_, fileReaderOutputToCorrelator_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), l1t::demo::gtt::kChannelMapInput, l1t::demo::gtt::kChannelMapOutputToCorrelator, kEmptyFramesInputTracks_, kEmptyFramesOutputToCorrelator_, l1t::demo::gtt::kFramesPerTMUXPeriod, l1t::demo::gtt::kGTTBoardTMUX, l1TrackCollectionName_, l1VertexCollectionName_, l1t::demo::parseFileFormat(), processInputTracks_, processOutputToCorrelator_, processOutputToGlobalTrigger_, and AlCaHLTBitMon_QueryRunRegistry::string.

74  : processOutputToCorrelator_(iConfig.getParameter<bool>("processOutputToCorrelator")),
75  processInputTracks_(iConfig.getParameter<bool>("processInputTracks")),
76  processOutputToGlobalTrigger_(iConfig.getParameter<bool>("processOutputToGlobalTrigger")),
77  kEmptyFramesOutputToCorrelator_(iConfig.getUntrackedParameter<unsigned int>("kEmptyFramesOutputToCorrelator")),
78  kEmptyFramesInputTracks_(iConfig.getUntrackedParameter<unsigned int>("kEmptyFramesInputTracks")),
80  iConfig.getUntrackedParameter<unsigned int>("kEmptyFramesOutputToGlobalTrigger")),
81  l1VertexCollectionName_(iConfig.getParameter<std::string>("l1VertexCollectionName")),
82  l1TrackCollectionName_(iConfig.getParameter<std::string>("l1TrackCollectionName")) {
86  iConfig.getParameter<std::vector<std::string>>("filesOutputToCorrelator"),
91  produces<l1t::VertexWordCollection>(l1VertexCollectionName_);
92  }
93  if (processInputTracks_) {
96  iConfig.getParameter<std::vector<std::string>>("filesInputTracks"),
101  produces<TTTrackCollection>(l1TrackCollectionName_);
102  }
104  // fileReaderOutputToGlobalTrigger_ =
105  // l1t::demo::BoardDataReader(l1t::demo::parseFileFormat(iConfig.getUntrackedParameter<std::string>("format")),
106  // iConfig.getParameter<std::vector<std::string>>("filesOutputToGlobalTrigger"),
107  // l1t::demo::gtt::kFramesPerTMUXPeriod,
108  // l1t::demo::gtt::kGTTBoardTMUX,
109  // kEmptyFramesOutputToGlobalTrigger_,
110  // l1t::demo::gtt::kChannelMapInput);
111  throw std::invalid_argument("Processing OutputToGlobalTrigger files has not been fully implemented and validated.");
112  // need to produce output collections for Prompt and Displaced Jets, HTMiss, ETMiss, Taus, Mesons, Vertices, and Isolated Tracks
113  }
114 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static const ChannelMap_t kChannelMapInput
Definition: GTTInterface.h:53
const size_t kEmptyFramesOutputToCorrelator_
const bool processOutputToGlobalTrigger_
FileFormat parseFileFormat(const std::string &)
Definition: utilities.cc:73
std::string l1TrackCollectionName_
T getUntrackedParameter(std::string const &, T const &) const
const bool processInputTracks_
std::string l1VertexCollectionName_
const bool processOutputToCorrelator_
static constexpr size_t kFramesPerTMUXPeriod
Definition: GTTInterface.h:16
static constexpr size_t kGTTBoardTMUX
Definition: GTTInterface.h:24
const size_t kEmptyFramesInputTracks_
std::optional< l1t::demo::BoardDataReader > fileReaderInputTracks_
std::optional< l1t::demo::BoardDataReader > fileReaderOutputToCorrelator_
static const ChannelMap_t kChannelMapOutputToCorrelator
Definition: GTTInterface.h:79
const size_t kEmptyFramesOutputToGlobalTrigger_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 161 of file GTTFileReader.cc.

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

161  {
162  // GTTFileReader
164  desc.add<bool>("processOutputToCorrelator")
165  ->setComment("boolean flag to load Correlator outputs via BoardDataReader and produce vertex collection");
166  desc.add<bool>("processInputTracks")
167  ->setComment("boolean flag to load track inputs via BoardDataReader and produce a TTTrack collection");
168  desc.add<bool>("processOutputToGlobalTrigger")
169  ->setComment(
170  "boolean flag to load Global Trigger outputs via BoardDataReader and produce Track Object collections");
171  desc.addUntracked<unsigned int>("kEmptyFramesOutputToCorrelator", 0)
172  ->setComment("empty frames to expect in OutputToCorrelator");
173  desc.addUntracked<unsigned int>("kEmptyFramesInputTracks", 0)->setComment("empty frames to expect in Track Input");
174  desc.addUntracked<unsigned int>("kEmptyFramesOutputToGlobalTrigger", 0)
175  ->setComment("empty frames to expect in OutputToGlobalTrigger");
176  desc.add<std::vector<std::string>>("filesOutputToCorrelator",
177  {
178  "L1GTTOutputToCorrelator_0.txt",
179  });
180  desc.add<std::vector<std::string>>("filesInputTracks",
181  {
182  "L1GTTInputFile_0.txt",
183  });
184  desc.add<std::vector<std::string>>("filesOutputToGlobalTrigger",
185  {
186  "L1GTTOutputToGlobalTriggerFile_0.txt",
187  });
188  desc.addUntracked<std::string>("format", "APx");
189  desc.add<std::string>("l1VertexCollectionName", "L1VerticesFirmware");
190  desc.add<std::string>("l1TrackCollectionName", "Level1TTTracks");
191  descriptions.add("GTTFileReader", desc);
192 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void GTTFileReader::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 117 of file GTTFileReader.cc.

References l1t::demo::codecs::decodeTracks(), l1t::demo::codecs::decodeVertices(), fileReaderInputTracks_, fileReaderOutputToCorrelator_, mps_fire::i, iEvent, lostTracks_cfi::inputTracks, l1t::demo::gtt::kTrackTMUX, l1TrackCollectionName_, l1VertexCollectionName_, eostools::move(), processInputTracks_, processOutputToCorrelator_, volumeBasedMagneticField_160812_cfi::sectors, l1t::demo::codecs::sectorsEtaPhiFromGTTLinkID(), HLT_2024v14_cff::track, and AlignmentTracksFromVertexSelector_cfi::vertices.

117  {
118  using namespace edm;
119  using namespace l1t::demo::codecs;
121  l1t::demo::EventData correlatorEventData(fileReaderOutputToCorrelator_.value().getNextEvent());
122  l1t::VertexWordCollection vertices(decodeVertices(correlatorEventData.at({"vertices", 0})));
123  edm::LogInfo("GTTFileReader") << vertices.size() << " vertices found";
124 
125  iEvent.put(std::make_unique<l1t::VertexWordCollection>(vertices), l1VertexCollectionName_);
126  } // end if ( processOutputToCorrelator_ )
127 
129  l1t::demo::EventData inputEventData(fileReaderInputTracks_.value().getNextEvent());
130  auto inputTracks = std::make_unique<TTTrackCollection>();
131  for (size_t i = 0; i < l1t::demo::gtt::kTrackTMUX; i++) {
132  auto iTracks = decodeTracks(inputEventData.at({"tracks", i}));
133  for (auto& trackword : iTracks) {
134  if (!trackword.getValidWord())
135  continue;
136  L1Track track = L1Track(trackword.getValidWord(),
137  trackword.getRinvWord(),
138  trackword.getPhiWord(),
139  trackword.getTanlWord(),
140  trackword.getZ0Word(),
141  trackword.getD0Word(),
142  trackword.getChi2RPhiWord(),
143  trackword.getChi2RZWord(),
144  trackword.getBendChi2Word(),
145  trackword.getHitPatternWord(),
146  trackword.getMVAQualityWord(),
147  trackword.getMVAOtherWord());
148  //retrieve the eta (first) and phi (second) sectors for GTT, encoded in an std::pair
150  track.setEtaSector(sectors.first);
151  track.setPhiSector(sectors.second);
152  track.trackWord_ = trackword.trackWord_;
153  inputTracks->push_back(track);
154  } //end loop over trackwoards
155  } // end loop over GTT input links
157  } // end if ( processInputTracks_ )
158 }
static constexpr size_t kTrackTMUX
Definition: GTTInterface.h:23
std::string l1TrackCollectionName_
const bool processInputTracks_
std::string l1VertexCollectionName_
const bool processOutputToCorrelator_
static std::pair< unsigned int, unsigned int > sectorsEtaPhiFromGTTLinkID(unsigned int id)
Definition: tracks.h:29
int iEvent
Definition: GenABIO.cc:224
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
std::vector< l1t::VertexWord > decodeVertices(const std::vector< ap_uint< 64 >> &)
std::vector< VertexWord > VertexWordCollection
Definition: VertexWord.h:197
std::optional< l1t::demo::BoardDataReader > fileReaderInputTracks_
Log< level::Info, false > LogInfo
std::optional< l1t::demo::BoardDataReader > fileReaderOutputToCorrelator_
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
def move(src, dest)
Definition: eostools.py:511
std::vector< TTTrack_TrackWord > decodeTracks(const std::vector< ap_uint< 64 >> &)

Member Data Documentation

◆ fileReaderInputTracks_

std::optional<l1t::demo::BoardDataReader> GTTFileReader::fileReaderInputTracks_ = std::nullopt
private

Definition at line 68 of file GTTFileReader.cc.

Referenced by GTTFileReader(), and produce().

◆ fileReaderOutputToCorrelator_

std::optional<l1t::demo::BoardDataReader> GTTFileReader::fileReaderOutputToCorrelator_ = std::nullopt
private

Definition at line 66 of file GTTFileReader.cc.

Referenced by GTTFileReader(), and produce().

◆ fileReaderOutputToGlobalTrigger_

std::optional<l1t::demo::BoardDataReader> GTTFileReader::fileReaderOutputToGlobalTrigger_ = std::nullopt
private

Definition at line 70 of file GTTFileReader.cc.

◆ kEmptyFramesInputTracks_

const size_t GTTFileReader::kEmptyFramesInputTracks_
private

Definition at line 64 of file GTTFileReader.cc.

Referenced by GTTFileReader().

◆ kEmptyFramesOutputToCorrelator_

const size_t GTTFileReader::kEmptyFramesOutputToCorrelator_
private

Definition at line 63 of file GTTFileReader.cc.

Referenced by GTTFileReader().

◆ kEmptyFramesOutputToGlobalTrigger_

const size_t GTTFileReader::kEmptyFramesOutputToGlobalTrigger_
private

Definition at line 65 of file GTTFileReader.cc.

◆ l1TrackCollectionName_

std::string GTTFileReader::l1TrackCollectionName_
private

Definition at line 69 of file GTTFileReader.cc.

Referenced by GTTFileReader(), and produce().

◆ l1VertexCollectionName_

std::string GTTFileReader::l1VertexCollectionName_
private

Definition at line 67 of file GTTFileReader.cc.

Referenced by GTTFileReader(), and produce().

◆ processInputTracks_

const bool GTTFileReader::processInputTracks_
private

Definition at line 61 of file GTTFileReader.cc.

Referenced by GTTFileReader(), and produce().

◆ processOutputToCorrelator_

const bool GTTFileReader::processOutputToCorrelator_
private

Definition at line 60 of file GTTFileReader.cc.

Referenced by GTTFileReader(), and produce().

◆ processOutputToGlobalTrigger_

const bool GTTFileReader::processOutputToGlobalTrigger_
private

Definition at line 62 of file GTTFileReader.cc.

Referenced by GTTFileReader().