CMS 3D CMS Logo

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

#include <L1TCorrelatorLayer1PatternFileWriter.h>

Public Member Functions

void flush ()
 
 L1TCorrelatorLayer1PatternFileWriter (const edm::ParameterSet &iConfig, const l1ct::Event &eventTemplate)
 
void write (const l1ct::Event &event)
 
 ~L1TCorrelatorLayer1PatternFileWriter ()
 

Private Types

enum  Partition { Partition::Barrel, Partition::HGCal, Partition::HGCalNoTk, Partition::HF }
 

Private Member Functions

void configLinks (const edm::ParameterSet &iConfig, const std::string &prefix, unsigned int linksFactor, unsigned int offset)
 
void configSectors (const edm::ParameterSet &iConfig, const std::string &prefix, unsigned int nSectors, unsigned int linksFactor)
 
void configTimeSlices (const edm::ParameterSet &iConfig, const std::string &prefix, unsigned int nSectors, unsigned int nTimeSlices, unsigned int linksFactor)
 
void writeBarrelGCT (const l1ct::Event &event, l1t::demo::EventData &out)
 
void writeEgamma (const l1ct::Event &event, l1t::demo::EventData &out)
 
void writeGMT (const l1ct::Event &event, l1t::demo::EventData &out)
 
void writeGTT (const l1ct::Event &event, l1t::demo::EventData &out)
 
void writeHGC (const l1ct::Event &event, l1t::demo::EventData &out)
 
void writePuppi (const l1ct::Event &event, l1t::demo::EventData &out)
 
void writeTF (const l1ct::Event &event, l1t::demo::EventData &out)
 

Static Private Member Functions

static Partition parsePartition (const std::string &partition)
 

Private Attributes

std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_
 
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsOutput_
 
std::map< std::string, l1t::demo::ChannelSpecchannelSpecsInput_
 
std::map< std::string, l1t::demo::ChannelSpecchannelSpecsOutput_
 
uint32_t eventIndex_
 
const uint32_t eventsPerFile_
 
const std::string fileFormat_
 
const unsigned int gctLinksEcal_ = 1
 
const unsigned int gctLinksHad_ = 2
 
const unsigned int gctSectors_ = 3
 
const unsigned int gctTimeslices_ = 1
 
const unsigned int gmtLinksFactor_ = 1
 
uint32_t gmtNumberOfMuons_
 
const unsigned int gmtTimeslices_ = 3
 
uint32_t gttLatency_
 
const unsigned int gttLinksFactor_ = 1
 
uint32_t gttNumberOfPVs_
 
const unsigned int gttTimeslices_ = 1
 
const unsigned int hgcLinksFactor_ = 4
 
const unsigned int hgcTimeslices_ = 3
 
std::unique_ptr< l1t::demo::BoardDataWriterinputFileWriter_
 
uint32_t nEgammaObjectsOut_
 
uint32_t nInputFramesPerBX_
 
uint32_t nOutputFramesPerBX_
 
unsigned int nPuppiFramesPerRegion_
 
int32_t outputBoard_
 
std::unique_ptr< l1t::demo::BoardDataWriteroutputFileWriter_
 
int32_t outputLinkEgamma_
 
std::vector< uint32_t > outputLinksPuppi_
 
std::vector< uint32_t > outputRegions_
 
Partition partition_
 
const unsigned int tfLinksFactor_ = 1
 
const unsigned int tfTimeslices_ = 3
 
const unsigned int tmuxFactor_ = 6
 
bool writeInputs_
 
bool writeOutputs_
 

Detailed Description

Definition at line 10 of file L1TCorrelatorLayer1PatternFileWriter.h.

Member Enumeration Documentation

◆ Partition

Enumerator
Barrel 
HGCal 
HGCalNoTk 
HF 

Definition at line 19 of file L1TCorrelatorLayer1PatternFileWriter.h.

19 { Barrel, HGCal, HGCalNoTk, HF };

Constructor & Destructor Documentation

◆ L1TCorrelatorLayer1PatternFileWriter()

L1TCorrelatorLayer1PatternFileWriter::L1TCorrelatorLayer1PatternFileWriter ( const edm::ParameterSet iConfig,
const l1ct::Event eventTemplate 
)

Definition at line 5 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References Barrel, channelIdsInput_, channelIdsOutput_, channelSpecsInput_, channelSpecsOutput_, configTimeSlices(), Exception, fileFormat_, gctLinksEcal_, gctLinksHad_, gctSectors_, gctTimeslices_, edm::ParameterSet::getParameter(), gmtLinksFactor_, gmtNumberOfMuons_, gmtTimeslices_, gttLatency_, gttLinksFactor_, gttNumberOfPVs_, gttTimeslices_, HGCal, l1ct::RawInputs::hgcalcluster, HGCalNoTk, hgcLinksFactor_, hgcTimeslices_, mps_fire::i, inputFileWriter_, nEgammaObjectsOut_, nInputFramesPerBX_, nOutputFramesPerBX_, nPuppiFramesPerRegion_, outputBoard_, outputFileWriter_, outputLinkEgamma_, outputLinksPuppi_, outputRegions_, l1t::demo::parseFileFormat(), partition_, l1ct::Event::raw, AlCaHLTBitMon_QueryRunRegistry::string, tfLinksFactor_, tfTimeslices_, tmuxFactor_, l1ct::RawInputs::track, writeInputs_, and writeOutputs_.

7  : partition_(parsePartition(iConfig.getParameter<std::string>("partition"))),
8  writeInputs_(iConfig.existsAs<std::string>("inputFileName") &&
9  !iConfig.getParameter<std::string>("inputFileName").empty()),
10  writeOutputs_(iConfig.existsAs<std::string>("outputFileName") &&
11  !iConfig.getParameter<std::string>("outputFileName").empty()),
12  outputBoard_(-1),
14  fileFormat_(iConfig.getParameter<std::string>("fileFormat")),
15  eventsPerFile_(iConfig.getParameter<uint32_t>("eventsPerFile")),
16  eventIndex_(0) {
17  if (writeInputs_) {
18  nInputFramesPerBX_ = iConfig.getParameter<uint32_t>("nInputFramesPerBX");
19 
21  configTimeSlices(iConfig, "tf", eventTemplate.raw.track.size(), tfTimeslices_, tfLinksFactor_);
23  }
25  auto sectorConfig = iConfig.getParameter<std::vector<edm::ParameterSet>>("gctSectors");
26  if (sectorConfig.size() != gctSectors_)
27  throw cms::Exception("Configuration", "Bad number of GCT sectors");
28  for (unsigned int iS = 0; iS < gctSectors_; ++iS) {
29  auto linksEcal = sectorConfig[iS].getParameter<std::vector<int32_t>>("gctLinksEcal");
30  auto linksHad = sectorConfig[iS].getParameter<std::vector<int32_t>>("gctLinksHad");
31  if (linksEcal.size() != gctLinksEcal_ || linksHad.size() != gctLinksHad_)
32  throw cms::Exception("Configuration", "Bad number of GCT links");
33  unsigned int iLink = 0;
34  for (unsigned int i = 0; i < gctLinksHad_; ++i, ++iLink) {
35  if (linksHad[i] != -1)
36  channelIdsInput_[l1t::demo::LinkId{"gct", iLink + 10 * iS}].push_back(linksHad[i]);
37  }
38  for (unsigned int i = 0; i < gctLinksEcal_; ++i) {
39  if (linksEcal[i] != -1)
40  channelIdsInput_[l1t::demo::LinkId{"gct", iLink + 10 * iS}].push_back(linksEcal[i]);
41  }
43  }
44  }
46  configTimeSlices(iConfig, "hgc", eventTemplate.raw.hgcalcluster.size(), hgcTimeslices_, hgcLinksFactor_);
48  }
50  configTimeSlices(iConfig, "gmt", 1, gmtTimeslices_, gmtLinksFactor_);
51  gmtNumberOfMuons_ = iConfig.getParameter<uint32_t>("gmtNumberOfMuons");
54  }
56  configTimeSlices(iConfig, "gtt", 1, gttTimeslices_, gttLinksFactor_);
57  gttLatency_ = iConfig.getParameter<uint32_t>("gttLatency");
58  gttNumberOfPVs_ = iConfig.getParameter<uint32_t>("gttNumberOfPVs");
60  }
62  std::make_unique<l1t::demo::BoardDataWriter>(l1t::demo::parseFileFormat(fileFormat_),
63  iConfig.getParameter<std::string>("inputFileName"),
66  iConfig.getParameter<uint32_t>("maxLinesPerInputFile"),
69  }
70 
71  if (writeOutputs_) {
72  nOutputFramesPerBX_ = iConfig.getParameter<uint32_t>("nOutputFramesPerBX");
73 
74  outputRegions_ = iConfig.getParameter<std::vector<uint32_t>>("outputRegions");
75  outputLinksPuppi_ = iConfig.getParameter<std::vector<uint32_t>>("outputLinksPuppi");
76  for (unsigned int i = 0; i < outputLinksPuppi_.size(); ++i) {
78  }
79  channelSpecsOutput_["puppi"] = {tmuxFactor_, 0};
82  outputBoard_ = iConfig.getParameter<int32_t>("outputBoard");
83  outputLinkEgamma_ = iConfig.getParameter<int32_t>("outputLinkEgamma");
84  nEgammaObjectsOut_ = iConfig.getParameter<uint32_t>("nEgammaObjectsOut");
85  if (outputLinkEgamma_ != -1) {
86  channelIdsOutput_[l1t::demo::LinkId{"egamma", 0}].push_back(outputLinkEgamma_);
88  }
89  }
90  if ((outputBoard_ == -1) != (outputLinkEgamma_ == -1)) {
91  throw cms::Exception("Configuration", "Inconsistent configuration of outputLinkEgamma, outputBoard");
92  }
94  std::make_unique<l1t::demo::BoardDataWriter>(l1t::demo::parseFileFormat(fileFormat_),
95  iConfig.getParameter<std::string>("outputFileName"),
98  iConfig.getParameter<uint32_t>("maxLinesPerOutputFile"),
101  }
102 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
void configTimeSlices(const edm::ParameterSet &iConfig, const std::string &prefix, unsigned int nSectors, unsigned int nTimeSlices, unsigned int linksFactor)
std::unique_ptr< l1t::demo::BoardDataWriter > inputFileWriter_
FileFormat parseFileFormat(const std::string &)
Definition: utilities.cc:70
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
std::map< std::string, l1t::demo::ChannelSpec > channelSpecsInput_
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsOutput_
RawInputs raw
std::unique_ptr< l1t::demo::BoardDataWriter > outputFileWriter_
static Partition parsePartition(const std::string &partition)
std::vector< DetectorSector< ap_uint< 96 > > > track
std::vector< DetectorSector< ap_uint< 256 > > > hgcalcluster
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_
std::map< std::string, l1t::demo::ChannelSpec > channelSpecsOutput_

◆ ~L1TCorrelatorLayer1PatternFileWriter()

L1TCorrelatorLayer1PatternFileWriter::~L1TCorrelatorLayer1PatternFileWriter ( )

Definition at line 104 of file L1TCorrelatorLayer1PatternFileWriter.cc.

104 {}

Member Function Documentation

◆ configLinks()

void L1TCorrelatorLayer1PatternFileWriter::configLinks ( const edm::ParameterSet iConfig,
const std::string &  prefix,
unsigned int  linksFactor,
unsigned int  offset 
)
private

Definition at line 191 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References channelIdsInput_, edm::ParameterSet::getParameter(), mps_fire::i, electronStore::links, hltrates_dqm_sourceclient-live_cfg::offset, and hcallasereventfilter2012_cfi::prefix.

Referenced by configSectors().

194  {
195  if (linksFactor > 1) {
196  auto links = iConfig.getParameter<std::vector<int32_t>>(prefix + "Links");
197  if (links.size() != linksFactor)
198  throw cms::Exception("Configuration")
199  << "Mismatched number of " << prefix << "Links, expected " << linksFactor << std::endl;
200  for (unsigned int i = 0; i < linksFactor; ++i) {
201  if (links[i] != -1) {
203  }
204  }
205  } else {
206  auto link = iConfig.getParameter<int32_t>(prefix + "Link");
207  if (link != -1) {
208  channelIdsInput_[l1t::demo::LinkId{prefix, offset}].push_back(link);
209  }
210  }
211 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_

◆ configSectors()

void L1TCorrelatorLayer1PatternFileWriter::configSectors ( const edm::ParameterSet iConfig,
const std::string &  prefix,
unsigned int  nSectors,
unsigned int  linksFactor 
)
private

Definition at line 175 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References configLinks(), edm::ParameterSet::getParameter(), and hcallasereventfilter2012_cfi::prefix.

Referenced by configTimeSlices().

178  {
179  if (nSectors > 1) {
180  auto sectorConfig = iConfig.getParameter<std::vector<edm::ParameterSet>>(prefix + "Sectors");
181  if (sectorConfig.size() != nSectors)
182  throw cms::Exception("Configuration")
183  << "Mismatched number of " << prefix << "Sectors, expected " << nSectors << std::endl;
184  for (unsigned int iS = 0; iS < nSectors; ++iS) {
185  configLinks(sectorConfig[iS], prefix, linksFactor, linksFactor > 1 ? iS * 10 : iS);
186  }
187  } else {
188  configLinks(iConfig, prefix, linksFactor, 0);
189  }
190 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void configLinks(const edm::ParameterSet &iConfig, const std::string &prefix, unsigned int linksFactor, unsigned int offset)

◆ configTimeSlices()

void L1TCorrelatorLayer1PatternFileWriter::configTimeSlices ( const edm::ParameterSet iConfig,
const std::string &  prefix,
unsigned int  nSectors,
unsigned int  nTimeSlices,
unsigned int  linksFactor 
)
private

Definition at line 157 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References configSectors(), edm::ParameterSet::getParameter(), and hcallasereventfilter2012_cfi::prefix.

Referenced by L1TCorrelatorLayer1PatternFileWriter().

161  {
162  if (nTimeSlices > 1) {
163  auto timeSliceConfig = iConfig.getParameter<std::vector<edm::ParameterSet>>(prefix + "TimeSlices");
164  if (timeSliceConfig.size() != nTimeSlices)
165  throw cms::Exception("Configuration")
166  << "Mismatched number of " << prefix << "TimeSlices, expected " << nTimeSlices << std::endl;
167  for (unsigned int iT = 0; iT < nTimeSlices; ++iT) {
168  configSectors(timeSliceConfig[iT], prefix, nSectors, linksFactor);
169  }
170  } else {
171  configSectors(iConfig, prefix, nSectors, linksFactor);
172  }
173 }
void configSectors(const edm::ParameterSet &iConfig, const std::string &prefix, unsigned int nSectors, unsigned int linksFactor)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ flush()

void L1TCorrelatorLayer1PatternFileWriter::flush ( )

Definition at line 350 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References inputFileWriter_, and outputFileWriter_.

350  {
351  if (inputFileWriter_)
352  inputFileWriter_->flush();
353  if (outputFileWriter_)
354  outputFileWriter_->flush();
355 }
std::unique_ptr< l1t::demo::BoardDataWriter > inputFileWriter_
std::unique_ptr< l1t::demo::BoardDataWriter > outputFileWriter_

◆ parsePartition()

L1TCorrelatorLayer1PatternFileWriter::Partition L1TCorrelatorLayer1PatternFileWriter::parsePartition ( const std::string &  partition)
staticprivate

◆ write()

void L1TCorrelatorLayer1PatternFileWriter::write ( const l1ct::Event event)

Definition at line 106 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References Barrel, eventIndex_, eventsPerFile_, HGCal, HGCalNoTk, inputFileWriter_, PixelMapPlotter::inputs, outputFileWriter_, outputLinkEgamma_, PatBasicFWLiteJetAnalyzer_Selector_cfg::outputs, partition_, writeBarrelGCT(), writeEgamma(), writeGMT(), writeGTT(), writeHGC(), writeInputs_, writeOutputs_, writePuppi(), and writeTF().

106  {
107  if (writeInputs_) {
110  writeTF(event, inputs);
111  }
112  if (partition_ == Partition::Barrel) {
114  }
117  }
120  }
123  }
124  inputFileWriter_->addEvent(inputs);
125  }
126 
127  if (writeOutputs_) {
130  if (outputLinkEgamma_ != -1)
132  outputFileWriter_->addEvent(outputs);
133  }
134 
135  eventIndex_++;
136  if (eventIndex_ % eventsPerFile_ == 0) {
137  if (writeInputs_)
138  inputFileWriter_->flush();
139  if (writeOutputs_)
140  outputFileWriter_->flush();
141  }
142 }
void writeGMT(const l1ct::Event &event, l1t::demo::EventData &out)
std::unique_ptr< l1t::demo::BoardDataWriter > inputFileWriter_
void writeGTT(const l1ct::Event &event, l1t::demo::EventData &out)
void writePuppi(const l1ct::Event &event, l1t::demo::EventData &out)
void writeTF(const l1ct::Event &event, l1t::demo::EventData &out)
void writeBarrelGCT(const l1ct::Event &event, l1t::demo::EventData &out)
std::unique_ptr< l1t::demo::BoardDataWriter > outputFileWriter_
void writeHGC(const l1ct::Event &event, l1t::demo::EventData &out)
void writeEgamma(const l1ct::Event &event, l1t::demo::EventData &out)
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
Definition: event.py:1

◆ writeBarrelGCT()

void L1TCorrelatorLayer1PatternFileWriter::writeBarrelGCT ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 269 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References channelIdsInput_, gctLinksEcal_, gctLinksHad_, gctSectors_, mps_fire::i, MillePedeFileConverter_cfg::out, timeUnitHelper::pack(), and runTheMatrix::ret.

Referenced by write().

269  {
270  std::vector<ap_uint<64>> ret;
271  for (unsigned int iS = 0; iS < gctSectors_; ++iS) {
272  l1t::demo::LinkId key0{"gct", iS * 10};
273  if (channelIdsInput_.count(key0) == 0)
274  continue;
275  const auto& had = event.decoded.hadcalo[iS];
276  const auto& ecal = event.decoded.emcalo[iS];
277  unsigned int iLink = 0, nHad = had.size(), nEcal = ecal.size();
278  for (unsigned int i = 0; i < gctLinksHad_; ++i, ++iLink) {
279  ret.clear();
280  for (unsigned int iHad = i; iHad < nHad; iHad += gctLinksHad_) {
281  ret.emplace_back(had[iHad].pack());
282  }
283  if (ret.empty())
284  ret.emplace_back(0);
285  out.add(l1t::demo::LinkId{"gct", iS * 10 + iLink}, ret);
286  }
287  for (unsigned int i = 0; i < gctLinksEcal_; ++i, ++iLink) {
288  ret.clear();
289  for (unsigned int iEcal = i; iEcal < nEcal; iEcal += gctLinksEcal_) {
290  ret.emplace_back(ecal[iEcal].pack());
291  }
292  if (ret.empty())
293  ret.emplace_back(0);
294  out.add(l1t::demo::LinkId{"gct", iS * 10 + iLink}, ret);
295  }
296  }
297 }
def pack(high, low)
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
ret
prodAgent to be discontinued
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_

◆ writeEgamma()

void L1TCorrelatorLayer1PatternFileWriter::writeEgamma ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 332 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References nEgammaObjectsOut_, MillePedeFileConverter_cfg::out, outputBoard_, AlCaHLTBitMon_ParallelJobs::p, and runTheMatrix::ret.

Referenced by write().

332  {
333  std::vector<ap_uint<64>> ret;
334  const auto& pho = event.board_out[outputBoard_].egphoton;
335  const auto& ele = event.board_out[outputBoard_].egelectron;
336  ret.reserve(3 * nEgammaObjectsOut_);
337  for (const auto& p : pho) {
338  ret.emplace_back(p.pack());
339  }
340  ret.resize(nEgammaObjectsOut_, ap_uint<64>(0));
341  for (const auto& p : ele) {
342  ap_uint<128> dword = p.pack();
343  ret.push_back(dword(63, 0));
344  ret.push_back(dword(127, 64));
345  }
346  ret.resize(3 * nEgammaObjectsOut_, ap_uint<64>(0));
347  out.add(l1t::demo::LinkId{"egamma", 0}, ret);
348 }
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
ret
prodAgent to be discontinued

◆ writeGMT()

void L1TCorrelatorLayer1PatternFileWriter::writeGMT ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 299 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References channelIdsInput_, gmtNumberOfMuons_, crabWrapper::key, PDWG_BPHSkim_cff::muons, and MillePedeFileConverter_cfg::out.

Referenced by write().

299  {
300  l1t::demo::LinkId key{"gmt", 0};
301  if (channelIdsInput_.count(key) == 0)
302  return;
303  std::vector<ap_uint<64>> muons = event.raw.muon.obj;
304  muons.resize(gmtNumberOfMuons_, ap_uint<64>(0));
305  out.add(key, muons);
306 }
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_

◆ writeGTT()

void L1TCorrelatorLayer1PatternFileWriter::writeGTT ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 308 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References channelIdsInput_, gttNumberOfPVs_, crabWrapper::key, MillePedeFileConverter_cfg::out, and FSQDQM_cfi::pvs.

Referenced by write().

308  {
309  l1t::demo::LinkId key{"gtt", 0};
310  if (channelIdsInput_.count(key) == 0)
311  return;
312  std::vector<ap_uint<64>> pvs = event.pvs_emu;
313  pvs.resize(gttNumberOfPVs_, ap_uint<64>(0));
314  out.add(key, pvs);
315 }
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_

◆ writeHGC()

void L1TCorrelatorLayer1PatternFileWriter::writeHGC ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 237 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References cms::cuda::assert(), channelIdsInput_, eventIndex_, hgcLinksFactor_, dqmiolumiharvest::j, MillePedeFileConverter_cfg::out, and runTheMatrix::ret.

Referenced by write().

237  {
238  assert(hgcLinksFactor_ == 4); // this piece of code won't really work otherwise
239  std::vector<ap_uint<64>> ret[hgcLinksFactor_];
240  for (unsigned int iS = 0, nS = event.raw.hgcalcluster.size(); iS < nS; ++iS) {
241  l1t::demo::LinkId key0{"hgc", iS * 10};
242  if (channelIdsInput_.count(key0) == 0)
243  continue;
244  for (unsigned int il = 0; il < hgcLinksFactor_; ++il) {
245  // put header word and (dummy) towers
246  ret[il].resize(31);
247  ap_uint<64>& head64 = ret[il][0];
248  head64(63, 48) = 0xABC0; // Magic
249  head64(47, 38) = 0; // Opaque
250  head64(39, 32) = (eventIndex_ % 3) * 6; // TM slice
251  head64(31, 24) = iS; // Sector
252  head64(23, 16) = il; // link
253  head64(15, 0) = eventIndex_ % 3564; // BX
254  for (unsigned int j = 0; j < 30; ++j) {
255  ret[il][j + 1] = 4 * j + il;
256  }
257  }
258  for (auto clust : event.raw.hgcalcluster[iS].obj) {
259  for (unsigned int il = 0; il < hgcLinksFactor_; ++il) {
260  ret[il].push_back(clust(64 * il + 63, 64 * il));
261  }
262  }
263  for (unsigned int il = 0; il < hgcLinksFactor_; ++il) {
264  out.add(l1t::demo::LinkId{"hgc", iS * 10 + il}, ret[il]);
265  }
266  }
267 }
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
ret
prodAgent to be discontinued
assert(be >=bs)
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_
Definition: event.py:1

◆ writePuppi()

void L1TCorrelatorLayer1PatternFileWriter::writePuppi ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 317 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References mps_fire::i, electronStore::links, dqmiodumpmetadata::n, nPuppiFramesPerRegion_, MillePedeFileConverter_cfg::out, outputLinksPuppi_, outputRegions_, and timeUnitHelper::pack().

Referenced by write().

317  {
318  unsigned int n = outputLinksPuppi_.size();
319  std::vector<std::vector<ap_uint<64>>> links(n);
320  for (auto ir : outputRegions_) {
321  auto puppi = event.out[ir].puppi;
322  unsigned int npuppi = puppi.size();
323  for (unsigned int i = 0; i < n * nPuppiFramesPerRegion_; ++i) {
324  links[i / nPuppiFramesPerRegion_].push_back(i < npuppi ? puppi[i].pack() : ap_uint<l1ct::PuppiObj::BITWIDTH>(0));
325  }
326  }
327  for (unsigned int i = 0; i < n; ++i) {
328  out.add(l1t::demo::LinkId{"puppi", i}, links[i]);
329  }
330 }
def pack(high, low)
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10

◆ writeTF()

void L1TCorrelatorLayer1PatternFileWriter::writeTF ( const l1ct::Event event,
l1t::demo::EventData out 
)
private

Definition at line 213 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References channelIdsInput_, mps_fire::i, crabWrapper::key, dqmiodumpmetadata::n, MillePedeFileConverter_cfg::out, runTheMatrix::ret, and pwdgSkimBPark_cfi::tracks.

Referenced by write().

213  {
214  for (unsigned int iS = 0, nS = event.raw.track.size(); iS < nS; ++iS) {
215  l1t::demo::LinkId key{"tf", iS};
216  if (channelIdsInput_.count(key) == 0)
217  continue;
218  std::vector<ap_uint<64>> ret;
219  std::vector<ap_uint<96>> tracks = event.raw.track[iS].obj;
220  if (tracks.empty())
221  tracks.emplace_back(0);
222  for (unsigned int i = 0, n = tracks.size(); i < n; ++i) {
223  const ap_uint<96>& packedtk = tracks[i];
224  if (i % 2 == 0) {
225  ret.emplace_back(packedtk(63, 0));
226  ret.emplace_back(0);
227  ret.back()(31, 0) = packedtk(95, 64);
228  } else {
229  ret.back()(63, 32) = packedtk(31, 0);
230  ret.emplace_back(packedtk(95, 32));
231  }
232  }
233  out.add(key, ret);
234  }
235 }
Logical ID for link within any given time slice (e.g. ["tracks", 0] -> ["tracks", 17] for links from ...
Definition: LinkId.h:10
ret
prodAgent to be discontinued
std::map< l1t::demo::LinkId, std::vector< size_t > > channelIdsInput_
Definition: event.py:1

Member Data Documentation

◆ channelIdsInput_

std::map<l1t::demo::LinkId, std::vector<size_t> > L1TCorrelatorLayer1PatternFileWriter::channelIdsInput_
private

◆ channelIdsOutput_

std::map<l1t::demo::LinkId, std::vector<size_t> > L1TCorrelatorLayer1PatternFileWriter::channelIdsOutput_
private

◆ channelSpecsInput_

std::map<std::string, l1t::demo::ChannelSpec> L1TCorrelatorLayer1PatternFileWriter::channelSpecsInput_
private

◆ channelSpecsOutput_

std::map<std::string, l1t::demo::ChannelSpec> L1TCorrelatorLayer1PatternFileWriter::channelSpecsOutput_
private

◆ eventIndex_

uint32_t L1TCorrelatorLayer1PatternFileWriter::eventIndex_
private

Definition at line 48 of file L1TCorrelatorLayer1PatternFileWriter.h.

Referenced by write(), and writeHGC().

◆ eventsPerFile_

const uint32_t L1TCorrelatorLayer1PatternFileWriter::eventsPerFile_
private

Definition at line 47 of file L1TCorrelatorLayer1PatternFileWriter.h.

Referenced by write().

◆ fileFormat_

const std::string L1TCorrelatorLayer1PatternFileWriter::fileFormat_
private

◆ gctLinksEcal_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gctLinksEcal_ = 1
private

◆ gctLinksHad_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gctLinksHad_ = 2
private

◆ gctSectors_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gctSectors_ = 3
private

◆ gctTimeslices_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gctTimeslices_ = 1
private

◆ gmtLinksFactor_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gmtLinksFactor_ = 1
private

◆ gmtNumberOfMuons_

uint32_t L1TCorrelatorLayer1PatternFileWriter::gmtNumberOfMuons_
private

◆ gmtTimeslices_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gmtTimeslices_ = 3
private

◆ gttLatency_

uint32_t L1TCorrelatorLayer1PatternFileWriter::gttLatency_
private

◆ gttLinksFactor_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gttLinksFactor_ = 1
private

◆ gttNumberOfPVs_

uint32_t L1TCorrelatorLayer1PatternFileWriter::gttNumberOfPVs_
private

◆ gttTimeslices_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::gttTimeslices_ = 1
private

◆ hgcLinksFactor_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::hgcLinksFactor_ = 4
private

◆ hgcTimeslices_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::hgcTimeslices_ = 3
private

◆ inputFileWriter_

std::unique_ptr<l1t::demo::BoardDataWriter> L1TCorrelatorLayer1PatternFileWriter::inputFileWriter_
private

◆ nEgammaObjectsOut_

uint32_t L1TCorrelatorLayer1PatternFileWriter::nEgammaObjectsOut_
private

◆ nInputFramesPerBX_

uint32_t L1TCorrelatorLayer1PatternFileWriter::nInputFramesPerBX_
private

◆ nOutputFramesPerBX_

uint32_t L1TCorrelatorLayer1PatternFileWriter::nOutputFramesPerBX_
private

◆ nPuppiFramesPerRegion_

unsigned int L1TCorrelatorLayer1PatternFileWriter::nPuppiFramesPerRegion_
private

◆ outputBoard_

int32_t L1TCorrelatorLayer1PatternFileWriter::outputBoard_
private

◆ outputFileWriter_

std::unique_ptr<l1t::demo::BoardDataWriter> L1TCorrelatorLayer1PatternFileWriter::outputFileWriter_
private

◆ outputLinkEgamma_

int32_t L1TCorrelatorLayer1PatternFileWriter::outputLinkEgamma_
private

◆ outputLinksPuppi_

std::vector<uint32_t> L1TCorrelatorLayer1PatternFileWriter::outputLinksPuppi_
private

◆ outputRegions_

std::vector<uint32_t> L1TCorrelatorLayer1PatternFileWriter::outputRegions_
private

◆ partition_

Partition L1TCorrelatorLayer1PatternFileWriter::partition_
private

◆ tfLinksFactor_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::tfLinksFactor_ = 1
private

◆ tfTimeslices_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::tfTimeslices_ = 3
private

◆ tmuxFactor_

const unsigned int L1TCorrelatorLayer1PatternFileWriter::tmuxFactor_ = 6
private

◆ writeInputs_

bool L1TCorrelatorLayer1PatternFileWriter::writeInputs_
private

◆ writeOutputs_

bool L1TCorrelatorLayer1PatternFileWriter::writeOutputs_
private