CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_
 
unsigned long eventCounter_
 
std::set< unsigned int > fedIds_
 
CTPPSPixelFramePosition fPos_
 
bool isRun3_
 
std::string mappingLabel_
 
edm::ESWatcher
< CTPPSPixelDAQMappingRcd
recordWatcher_
 
edm::ESGetToken
< CTPPSPixelDAQMapping,
CTPPSPixelDAQMappingRcd
tCTPPSPixelDAQMapping_
 
edm::EDGetTokenT
< edm::DetSetVector
< CTPPSPixelDigi > > 
tCTPPSPixelDigi_
 
std::vector
< CTPPSPixelDataFormatter::PPSPixelIndex
v_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 63 of file CTPPSPixelDigiToRaw.cc.

Constructor & Destructor Documentation

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

Definition at line 99 of file CTPPSPixelDigiToRaw.cc.

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

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

Definition at line 115 of file CTPPSPixelDigiToRaw.cc.

115 {}

Member Function Documentation

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

Definition at line 176 of file CTPPSPixelDigiToRaw.cc.

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

176  {
178  desc.add<bool>("isRun3", true);
179  desc.add<edm::InputTag>("InputLabel", edm::InputTag("RPixDetDigitizer"));
180  desc.add<std::string>("mappingLabel", "RPix");
181  descriptions.add("ctppsPixelRawData", desc);
182 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CTPPSPixelDigiToRaw::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 122 of file CTPPSPixelDigiToRaw.cc.

References allDigiCounter_, allWordCounter_, CTPPSPixelDataFormatter::compare(), debug_, reco_application_2006_simpleTBanalysis_cfg::digiCollection, edm::EventID::event(), eventCounter_, fedIds_, CTPPSPixelDataFormatter::formatRawData(), edm::Event::getByToken(), edm::EventSetup::getHandle(), edm::EventBase::id(), isRun3_, LogDebug, eostools::move(), CTPPSPixelDataFormatter::nDigis(), CTPPSPixelDataFormatter::nWords(), AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), findQualityFiles::size, tCTPPSPixelDAQMapping_, tCTPPSPixelDigi_, and v_iDdet2fed_.

122  {
123  using namespace edm;
124  using namespace std;
125 
126  eventCounter_++;
127 
130 
133 
134  int digiCounter = 0;
135  for (auto const& di : *digiCollection) {
136  digiCounter += (di.data).size();
137  digis[di.id] = di.data;
138  }
139  allDigiCounter_ += digiCounter;
141 
142  mapping = iSetup.getHandle(tCTPPSPixelDAQMapping_);
143  for (const auto& p : mapping->ROCMapping)
145  p.second.iD, p.second.roc, p.first.getROC(), p.first.getFEDId(), p.first.getChannelIdx()});
146  fedIds_ = mapping->fedIds();
147 
148  CTPPSPixelDataFormatter formatter(mapping->ROCMapping);
149 
150  // create product (raw data)
151  auto buffers = std::make_unique<FEDRawDataCollection>();
152 
154 
155  // convert data to raw
156  formatter.formatRawData(isRun3_, iEvent.id().event(), rawdata, digis, v_iDdet2fed_);
157 
158  // pack raw data into collection
159  for (auto it = fedIds_.begin(); it != fedIds_.end(); it++) {
160  FEDRawData& fedRawData = buffers->FEDData(*it);
161  CTPPSPixelDataFormatter::RawData::iterator fedbuffer = rawdata.find(*it);
162  if (fedbuffer != rawdata.end())
163  fedRawData = fedbuffer->second;
164  }
165  allWordCounter_ += formatter.nWords();
166 
167  if (debug_)
168  LogDebug("CTPPSPixelDigiToRaw") << "Words/Digis this iEvent: " << digiCounter << "(fm:" << formatter.nDigis()
169  << ")/" << formatter.nWords() << " all: " << allDigiCounter_ << "/"
170  << allWordCounter_;
171 
172  iEvent.put(std::move(buffers));
173 }
EventNumber_t event() const
Definition: EventID.h:40
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::unordered_map< int, FEDRawData > RawData
static bool compare(const PPSPixelIndex &a, const PPSPixelIndex &b)
std::unordered_map< cms_uint32_t, DetDigis > Digis
std::vector< CTPPSPixelDataFormatter::PPSPixelIndex > v_iDdet2fed_
def move
Definition: eostools.py:511
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
edm::ESGetToken< CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd > tCTPPSPixelDAQMapping_
std::set< unsigned int > fedIds_
edm::EventID id() const
Definition: EventBase.h:59
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
tuple size
Write out results.
#define LogDebug(id)

Member Data Documentation

int CTPPSPixelDigiToRaw::allDigiCounter_
private

Definition at line 75 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

int CTPPSPixelDigiToRaw::allWordCounter_
private

Definition at line 76 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

bool CTPPSPixelDigiToRaw::debug_
private

Definition at line 77 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

unsigned long CTPPSPixelDigiToRaw::eventCounter_
private

Definition at line 74 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

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

Definition at line 78 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

CTPPSPixelFramePosition CTPPSPixelDigiToRaw::fPos_
private

Definition at line 84 of file CTPPSPixelDigiToRaw.cc.

bool CTPPSPixelDigiToRaw::isRun3_
private

Definition at line 85 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

std::string CTPPSPixelDigiToRaw::mappingLabel_
private

Definition at line 79 of file CTPPSPixelDigiToRaw.cc.

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

Definition at line 80 of file CTPPSPixelDigiToRaw.cc.

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

Definition at line 82 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

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

Definition at line 81 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

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

Definition at line 83 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().