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"),
64  iConfig.getParameter<std::string>("inputFileExtension"),
67  iConfig.getParameter<uint32_t>("maxLinesPerInputFile"),
70  }
71 
72  if (writeOutputs_) {
73  nOutputFramesPerBX_ = iConfig.getParameter<uint32_t>("nOutputFramesPerBX");
74 
75  outputRegions_ = iConfig.getParameter<std::vector<uint32_t>>("outputRegions");
76  outputLinksPuppi_ = iConfig.getParameter<std::vector<uint32_t>>("outputLinksPuppi");
77  for (unsigned int i = 0; i < outputLinksPuppi_.size(); ++i) {
79  }
80  channelSpecsOutput_["puppi"] = {tmuxFactor_, 0};
83  outputBoard_ = iConfig.getParameter<int32_t>("outputBoard");
84  outputLinkEgamma_ = iConfig.getParameter<int32_t>("outputLinkEgamma");
85  nEgammaObjectsOut_ = iConfig.getParameter<uint32_t>("nEgammaObjectsOut");
86  if (outputLinkEgamma_ != -1) {
87  channelIdsOutput_[l1t::demo::LinkId{"egamma", 0}].push_back(outputLinkEgamma_);
89  }
90  }
91  if ((outputBoard_ == -1) != (outputLinkEgamma_ == -1)) {
92  throw cms::Exception("Configuration", "Inconsistent configuration of outputLinkEgamma, outputBoard");
93  }
95  std::make_unique<l1t::demo::BoardDataWriter>(l1t::demo::parseFileFormat(fileFormat_),
96  iConfig.getParameter<std::string>("outputFileName"),
97  iConfig.getParameter<std::string>("outputFileExtension"),
100  iConfig.getParameter<uint32_t>("maxLinesPerOutputFile"),
103  }
104 }
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:73
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 106 of file L1TCorrelatorLayer1PatternFileWriter.cc.

106 {}

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 193 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().

196  {
197  if (linksFactor > 1) {
198  auto links = iConfig.getParameter<std::vector<int32_t>>(prefix + "Links");
199  if (links.size() != linksFactor)
200  throw cms::Exception("Configuration")
201  << "Mismatched number of " << prefix << "Links, expected " << linksFactor << std::endl;
202  for (unsigned int i = 0; i < linksFactor; ++i) {
203  if (links[i] != -1) {
205  }
206  }
207  } else {
208  auto link = iConfig.getParameter<int32_t>(prefix + "Link");
209  if (link != -1) {
210  channelIdsInput_[l1t::demo::LinkId{prefix, offset}].push_back(link);
211  }
212  }
213 }
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 177 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by configTimeSlices().

180  {
181  if (nSectors > 1) {
182  auto sectorConfig = iConfig.getParameter<std::vector<edm::ParameterSet>>(prefix + "Sectors");
183  if (sectorConfig.size() != nSectors)
184  throw cms::Exception("Configuration")
185  << "Mismatched number of " << prefix << "Sectors, expected " << nSectors << std::endl;
186  for (unsigned int iS = 0; iS < nSectors; ++iS) {
187  configLinks(sectorConfig[iS], prefix, linksFactor, linksFactor > 1 ? iS * 10 : iS);
188  }
189  } else {
190  configLinks(iConfig, prefix, linksFactor, 0);
191  }
192 }
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 159 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by L1TCorrelatorLayer1PatternFileWriter().

163  {
164  if (nTimeSlices > 1) {
165  auto timeSliceConfig = iConfig.getParameter<std::vector<edm::ParameterSet>>(prefix + "TimeSlices");
166  if (timeSliceConfig.size() != nTimeSlices)
167  throw cms::Exception("Configuration")
168  << "Mismatched number of " << prefix << "TimeSlices, expected " << nTimeSlices << std::endl;
169  for (unsigned int iT = 0; iT < nTimeSlices; ++iT) {
170  configSectors(timeSliceConfig[iT], prefix, nSectors, linksFactor);
171  }
172  } else {
173  configSectors(iConfig, prefix, nSectors, linksFactor);
174  }
175 }
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 352 of file L1TCorrelatorLayer1PatternFileWriter.cc.

References inputFileWriter_, and outputFileWriter_.

352  {
353  if (inputFileWriter_)
354  inputFileWriter_->flush();
355  if (outputFileWriter_)
356  outputFileWriter_->flush();
357 }
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 108 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().

108  {
109  if (writeInputs_) {
112  writeTF(event, inputs);
113  }
114  if (partition_ == Partition::Barrel) {
116  }
119  }
122  }
125  }
126  inputFileWriter_->addEvent(inputs);
127  }
128 
129  if (writeOutputs_) {
132  if (outputLinkEgamma_ != -1)
134  outputFileWriter_->addEvent(outputs);
135  }
136 
137  eventIndex_++;
138  if (eventIndex_ % eventsPerFile_ == 0) {
139  if (writeInputs_)
140  inputFileWriter_->flush();
141  if (writeOutputs_)
142  outputFileWriter_->flush();
143  }
144 }
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 271 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by write().

271  {
272  std::vector<ap_uint<64>> ret;
273  for (unsigned int iS = 0; iS < gctSectors_; ++iS) {
274  l1t::demo::LinkId key0{"gct", iS * 10};
275  if (channelIdsInput_.count(key0) == 0)
276  continue;
277  const auto& had = event.decoded.hadcalo[iS];
278  const auto& ecal = event.decoded.emcalo[iS];
279  unsigned int iLink = 0, nHad = had.size(), nEcal = ecal.size();
280  for (unsigned int i = 0; i < gctLinksHad_; ++i, ++iLink) {
281  ret.clear();
282  for (unsigned int iHad = i; iHad < nHad; iHad += gctLinksHad_) {
283  ret.emplace_back(had[iHad].pack());
284  }
285  if (ret.empty())
286  ret.emplace_back(0);
287  out.add(l1t::demo::LinkId{"gct", iS * 10 + iLink}, ret);
288  }
289  for (unsigned int i = 0; i < gctLinksEcal_; ++i, ++iLink) {
290  ret.clear();
291  for (unsigned int iEcal = i; iEcal < nEcal; iEcal += gctLinksEcal_) {
292  ret.emplace_back(ecal[iEcal].pack());
293  }
294  if (ret.empty())
295  ret.emplace_back(0);
296  out.add(l1t::demo::LinkId{"gct", iS * 10 + iLink}, ret);
297  }
298  }
299 }
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 334 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by write().

334  {
335  std::vector<ap_uint<64>> ret;
336  const auto& pho = event.board_out[outputBoard_].egphoton;
337  const auto& ele = event.board_out[outputBoard_].egelectron;
338  ret.reserve(3 * nEgammaObjectsOut_);
339  for (const auto& p : pho) {
340  ret.emplace_back(p.pack());
341  }
342  ret.resize(nEgammaObjectsOut_, ap_uint<64>(0));
343  for (const auto& p : ele) {
344  ap_uint<128> dword = p.pack();
345  ret.push_back(dword(63, 0));
346  ret.push_back(dword(127, 64));
347  }
348  ret.resize(3 * nEgammaObjectsOut_, ap_uint<64>(0));
349  out.add(l1t::demo::LinkId{"egamma", 0}, ret);
350 }
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 301 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by write().

301  {
302  l1t::demo::LinkId key{"gmt", 0};
303  if (channelIdsInput_.count(key) == 0)
304  return;
305  std::vector<ap_uint<64>> muons = event.raw.muon.obj;
306  muons.resize(gmtNumberOfMuons_, ap_uint<64>(0));
307  out.add(key, muons);
308 }
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 310 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by write().

310  {
311  l1t::demo::LinkId key{"gtt", 0};
312  if (channelIdsInput_.count(key) == 0)
313  return;
314  std::vector<ap_uint<64>> pvs = event.pvs_emu;
315  pvs.resize(gttNumberOfPVs_, ap_uint<64>(0));
316  out.add(key, pvs);
317 }
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 239 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by write().

239  {
240  assert(hgcLinksFactor_ == 4); // this piece of code won't really work otherwise
241  std::vector<ap_uint<64>> ret[hgcLinksFactor_];
242  for (unsigned int iS = 0, nS = event.raw.hgcalcluster.size(); iS < nS; ++iS) {
243  l1t::demo::LinkId key0{"hgc", iS * 10};
244  if (channelIdsInput_.count(key0) == 0)
245  continue;
246  for (unsigned int il = 0; il < hgcLinksFactor_; ++il) {
247  // put header word and (dummy) towers
248  ret[il].resize(31);
249  ap_uint<64>& head64 = ret[il][0];
250  head64(63, 48) = 0xABC0; // Magic
251  head64(47, 38) = 0; // Opaque
252  head64(39, 32) = (eventIndex_ % 3) * 6; // TM slice
253  head64(31, 24) = iS; // Sector
254  head64(23, 16) = il; // link
255  head64(15, 0) = eventIndex_ % 3564; // BX
256  for (unsigned int j = 0; j < 30; ++j) {
257  ret[il][j + 1] = 4 * j + il;
258  }
259  }
260  for (auto clust : event.raw.hgcalcluster[iS].obj) {
261  for (unsigned int il = 0; il < hgcLinksFactor_; ++il) {
262  ret[il].push_back(clust(64 * il + 63, 64 * il));
263  }
264  }
265  for (unsigned int il = 0; il < hgcLinksFactor_; ++il) {
266  out.add(l1t::demo::LinkId{"hgc", iS * 10 + il}, ret[il]);
267  }
268  }
269 }
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 319 of file L1TCorrelatorLayer1PatternFileWriter.cc.

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

Referenced by write().

319  {
320  unsigned int n = outputLinksPuppi_.size();
321  std::vector<std::vector<ap_uint<64>>> links(n);
322  for (auto ir : outputRegions_) {
323  auto puppi = event.out[ir].puppi;
324  unsigned int npuppi = puppi.size();
325  for (unsigned int i = 0; i < n * nPuppiFramesPerRegion_; ++i) {
326  links[i / nPuppiFramesPerRegion_].push_back(i < npuppi ? puppi[i].pack() : ap_uint<l1ct::PuppiObj::BITWIDTH>(0));
327  }
328  }
329  for (unsigned int i = 0; i < n; ++i) {
330  out.add(l1t::demo::LinkId{"puppi", i}, links[i]);
331  }
332 }
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 215 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().

215  {
216  for (unsigned int iS = 0, nS = event.raw.track.size(); iS < nS; ++iS) {
217  l1t::demo::LinkId key{"tf", iS};
218  if (channelIdsInput_.count(key) == 0)
219  continue;
220  std::vector<ap_uint<64>> ret;
221  std::vector<ap_uint<96>> tracks = event.raw.track[iS].obj;
222  if (tracks.empty())
223  tracks.emplace_back(0);
224  for (unsigned int i = 0, n = tracks.size(); i < n; ++i) {
225  const ap_uint<96>& packedtk = tracks[i];
226  if (i % 2 == 0) {
227  ret.emplace_back(packedtk(63, 0));
228  ret.emplace_back(0);
229  ret.back()(31, 0) = packedtk(95, 64);
230  } else {
231  ret.back()(63, 32) = packedtk(31, 0);
232  ret.emplace_back(packedtk(95, 32));
233  }
234  }
235  out.add(key, ret);
236  }
237 }
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