CMS 3D CMS Logo

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

#include <CTPPSPixelDigiToRaw.cc>

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

Public Member Functions

 CTPPSPixelDigiToRaw (const edm::ParameterSet &)
 
 ~CTPPSPixelDigiToRaw () override
 
- 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 Member Functions

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

Private Attributes

int allDigiCounter_
 
int allWordCounter_
 
bool debug_
 
CTPPSRawToDigiErrorSummary eSummary_
 
unsigned long eventCounter_
 
std::set< unsigned int > fedIds_
 
CTPPSPixelFramePosition fPos_
 
bool isRun3_
 
std::string mappingLabel_
 
edm::ESWatcher< CTPPSPixelDAQMappingRcdrecordWatcher_
 
edm::ESGetToken< CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcdtCTPPSPixelDAQMapping_
 
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
 
std::vector< CTPPSPixelDataFormatter::PPSPixelIndexv_iDdet2fed_
 

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: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 64 of file CTPPSPixelDigiToRaw.cc.

Constructor & Destructor Documentation

◆ CTPPSPixelDigiToRaw()

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

Definition at line 101 of file CTPPSPixelDigiToRaw.cc.

References edm::ParameterSet::getParameter(), isRun3_, tCTPPSPixelDAQMapping_, and tCTPPSPixelDigi_.

102  : eventCounter_(0),
103  allDigiCounter_(0),
104  allWordCounter_(0),
105  debug_(false),
106  mappingLabel_(iConfig.getParameter<std::string>("mappingLabel")),
107  eSummary_("CTPPSPixelDataFormatter", "[ctppsPixelRawToDigi]", false) {
108  //register your products
109  tCTPPSPixelDigi_ = consumes<edm::DetSetVector<CTPPSPixelDigi>>(iConfig.getParameter<edm::InputTag>("InputLabel"));
110  tCTPPSPixelDAQMapping_ = esConsumes<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd>();
111 
112  // Define EDProduct type
113  produces<FEDRawDataCollection>();
114 
115  isRun3_ = iConfig.getParameter<bool>("isRun3");
116 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
CTPPSRawToDigiErrorSummary eSummary_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
edm::ESGetToken< CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd > tCTPPSPixelDAQMapping_

◆ ~CTPPSPixelDigiToRaw()

CTPPSPixelDigiToRaw::~CTPPSPixelDigiToRaw ( )
override

Definition at line 118 of file CTPPSPixelDigiToRaw.cc.

118 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 179 of file CTPPSPixelDigiToRaw.cc.

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

179  {
181  desc.add<bool>("isRun3", true);
182  desc.add<edm::InputTag>("InputLabel", edm::InputTag("RPixDetDigitizer"));
183  desc.add<std::string>("mappingLabel", "RPix");
184  descriptions.add("ctppsPixelRawData", desc);
185 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 125 of file CTPPSPixelDigiToRaw.cc.

References allDigiCounter_, allWordCounter_, CTPPSPixelDataFormatter::compare(), debug_, apvshotsanalyzer_cfi::digiCollection, eSummary_, eventCounter_, fedIds_, l1t_dqm_sourceclient-live_cfg::fedRawData, CTPPSPixelDataFormatter::formatRawData(), edm::EventSetup::getHandle(), iEvent, isRun3_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, LogDebug, HPSPFTaus_cff::mapping, eostools::move(), CTPPSPixelDataFormatter::nDigis(), CTPPSPixelDataFormatter::nWords(), AlCaHLTBitMon_ParallelJobs::p, findQualityFiles::size, jetUpdater_cfi::sort, tCTPPSPixelDAQMapping_, tCTPPSPixelDigi_, and v_iDdet2fed_.

125  {
126  using namespace edm;
127  using namespace std;
128 
129  eventCounter_++;
130 
133 
136 
137  int digiCounter = 0;
138  for (auto const& di : *digiCollection) {
139  digiCounter += (di.data).size();
140  digis[di.id] = di.data;
141  }
142  allDigiCounter_ += digiCounter;
144 
146  for (const auto& p : mapping->ROCMapping)
148  p.second.iD, p.second.roc, p.first.getROC(), p.first.getFEDId(), p.first.getChannelIdx()});
149  fedIds_ = mapping->fedIds();
150 
151  CTPPSPixelDataFormatter formatter(mapping->ROCMapping, eSummary_);
152 
153  // create product (raw data)
154  auto buffers = std::make_unique<FEDRawDataCollection>();
155 
157 
158  // convert data to raw
159  formatter.formatRawData(isRun3_, iEvent.id().event(), rawdata, digis, v_iDdet2fed_);
160 
161  // pack raw data into collection
162  for (auto it = fedIds_.begin(); it != fedIds_.end(); it++) {
163  FEDRawData& fedRawData = buffers->FEDData(*it);
164  CTPPSPixelDataFormatter::RawData::iterator fedbuffer = rawdata.find(*it);
165  if (fedbuffer != rawdata.end())
166  fedRawData = fedbuffer->second;
167  }
168  allWordCounter_ += formatter.nWords();
169 
170  if (debug_)
171  LogDebug("CTPPSPixelDigiToRaw") << "Words/Digis this iEvent: " << digiCounter << "(fm:" << formatter.nDigis()
172  << ")/" << formatter.nWords() << " all: " << allDigiCounter_ << "/"
173  << allWordCounter_;
174 
175  iEvent.put(std::move(buffers));
176 }
size
Write out results.
std::unordered_map< int, FEDRawData > RawData
static bool compare(const PPSPixelIndex &a, const PPSPixelIndex &b)
int iEvent
Definition: GenABIO.cc:224
std::unordered_map< cms_uint32_t, DetDigis > Digis
std::vector< CTPPSPixelDataFormatter::PPSPixelIndex > v_iDdet2fed_
CTPPSRawToDigiErrorSummary eSummary_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::ESGetToken< CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd > tCTPPSPixelDAQMapping_
std::set< unsigned int > fedIds_
HLT enums.
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ allDigiCounter_

int CTPPSPixelDigiToRaw::allDigiCounter_
private

Definition at line 76 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

◆ allWordCounter_

int CTPPSPixelDigiToRaw::allWordCounter_
private

Definition at line 77 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

◆ debug_

bool CTPPSPixelDigiToRaw::debug_
private

Definition at line 78 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

◆ eSummary_

CTPPSRawToDigiErrorSummary CTPPSPixelDigiToRaw::eSummary_
private

Definition at line 86 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

◆ eventCounter_

unsigned long CTPPSPixelDigiToRaw::eventCounter_
private

Definition at line 75 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

◆ fedIds_

std::set<unsigned int> CTPPSPixelDigiToRaw::fedIds_
private

Definition at line 79 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

◆ fPos_

CTPPSPixelFramePosition CTPPSPixelDigiToRaw::fPos_
private

Definition at line 85 of file CTPPSPixelDigiToRaw.cc.

◆ isRun3_

bool CTPPSPixelDigiToRaw::isRun3_
private

Definition at line 87 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

◆ mappingLabel_

std::string CTPPSPixelDigiToRaw::mappingLabel_
private

Definition at line 80 of file CTPPSPixelDigiToRaw.cc.

◆ recordWatcher_

edm::ESWatcher<CTPPSPixelDAQMappingRcd> CTPPSPixelDigiToRaw::recordWatcher_
private

Definition at line 81 of file CTPPSPixelDigiToRaw.cc.

◆ tCTPPSPixelDAQMapping_

edm::ESGetToken<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd> CTPPSPixelDigiToRaw::tCTPPSPixelDAQMapping_
private

Definition at line 83 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

◆ tCTPPSPixelDigi_

edm::EDGetTokenT<edm::DetSetVector<CTPPSPixelDigi> > CTPPSPixelDigiToRaw::tCTPPSPixelDigi_
private

Definition at line 82 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

◆ v_iDdet2fed_

std::vector<CTPPSPixelDataFormatter::PPSPixelIndex> CTPPSPixelDigiToRaw::v_iDdet2fed_
private

Definition at line 84 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().