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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
std::string mappingLabel_
 
edm::ESWatcher< CTPPSPixelDAQMappingRcdrecordWatcher_
 
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
 
std::vector< CTPPSPixelDataFormatter::PPSPixelIndexv_iDdet2fed_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 62 of file CTPPSPixelDigiToRaw.cc.

Constructor & Destructor Documentation

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

Definition at line 96 of file CTPPSPixelDigiToRaw.cc.

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

97  : eventCounter_(0),
98  allDigiCounter_(0),
99  allWordCounter_(0),
100  mappingLabel_(iConfig.getParameter<std::string>("mappingLabel")) {
101  //register your products
102  tCTPPSPixelDigi_ = consumes<edm::DetSetVector<CTPPSPixelDigi>>(iConfig.getParameter<edm::InputTag>("InputLabel"));
103 
104  // Define EDProduct type
105  produces<FEDRawDataCollection>();
106 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
CTPPSPixelDigiToRaw::~CTPPSPixelDigiToRaw ( )
override

Definition at line 108 of file CTPPSPixelDigiToRaw.cc.

108 {}

Member Function Documentation

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

Definition at line 169 of file CTPPSPixelDigiToRaw.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

169  {
171  desc.add<edm::InputTag>("InputLabel", edm::InputTag("RPixDetDigitizer"));
172  desc.add<std::string>("mappingLabel", "RPix");
173  descriptions.add("ctppsPixelRawData", desc);
174 }
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 115 of file CTPPSPixelDigiToRaw.cc.

References allDigiCounter_, allWordCounter_, edm::ESWatcher< T >::check(), CTPPSPixelDataFormatter::compare(), debug_, apvshotsanalyzer_cfi::digiCollection, edm::EventID::event(), eventCounter_, CTPPSPixelDAQMapping::fedIds(), fedIds_, l1t_dqm_sourceclient-live_cfg::fedRawData, CTPPSPixelDataFormatter::formatRawData(), edm::EventSetup::get(), edm::Event::getByToken(), edm::EventBase::id(), LogDebug, taus_updatedMVAIds_cff::mapping, eostools::move(), CTPPSPixelDataFormatter::nDigis(), CTPPSPixelDataFormatter::nWords(), AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), recordWatcher_, CTPPSPixelDAQMapping::ROCMapping, findQualityFiles::size, tCTPPSPixelDigi_, and v_iDdet2fed_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

115  {
116  using namespace edm;
117  using namespace std;
118 
119  eventCounter_++;
120 
122  iEvent.getByToken(tCTPPSPixelDigi_, digiCollection);
123 
126 
127  int digiCounter = 0;
128  for (auto const& di : *digiCollection) {
129  digiCounter += (di.data).size();
130  digis[di.id] = di.data;
131  }
132  allDigiCounter_ += digiCounter;
134  if (recordWatcher_.check(iSetup)) {
135  iSetup.get<CTPPSPixelDAQMappingRcd>().get(mapping);
136  for (const auto& p : mapping->ROCMapping)
138  p.second.iD, p.second.roc, p.first.getROC(), p.first.getFEDId(), p.first.getChannelIdx()});
139  fedIds_ = mapping->fedIds();
140  }
141  CTPPSPixelDataFormatter formatter(mapping->ROCMapping);
142 
143  // create product (raw data)
144  auto buffers = std::make_unique<FEDRawDataCollection>();
145 
147 
148  // convert data to raw
149  formatter.formatRawData(iEvent.id().event(), rawdata, digis, v_iDdet2fed_);
150 
151  // pack raw data into collection
152  for (auto it = fedIds_.begin(); it != fedIds_.end(); it++) {
153  FEDRawData& fedRawData = buffers->FEDData(*it);
154  CTPPSPixelDataFormatter::RawData::iterator fedbuffer = rawdata.find(*it);
155  if (fedbuffer != rawdata.end())
156  fedRawData = fedbuffer->second;
157  }
158  allWordCounter_ += formatter.nWords();
159 
160  if (debug_)
161  LogDebug("CTPPSPixelDigiToRaw") << "Words/Digis this iEvent: " << digiCounter << "(fm:" << formatter.nDigis()
162  << ")/" << formatter.nWords() << " all: " << allDigiCounter_ << "/"
163  << allWordCounter_;
164 
165  iEvent.put(std::move(buffers));
166 }
#define LogDebug(id)
size
Write out results.
EventNumber_t event() const
Definition: EventID.h:40
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::set< unsigned int > fedIds() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::unordered_map< int, FEDRawData > RawData
edm::ESWatcher< CTPPSPixelDAQMappingRcd > recordWatcher_
static bool compare(const PPSPixelIndex &a, const PPSPixelIndex &b)
std::unordered_map< cms_uint32_t, DetDigis > Digis
std::vector< CTPPSPixelDataFormatter::PPSPixelIndex > v_iDdet2fed_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tCTPPSPixelDigi_
std::map< CTPPSPixelFramePosition, CTPPSPixelROCInfo > ROCMapping
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
std::set< unsigned int > fedIds_
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
T get() const
Definition: EventSetup.h:73
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

int CTPPSPixelDigiToRaw::allDigiCounter_
private

Definition at line 74 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

int CTPPSPixelDigiToRaw::allWordCounter_
private

Definition at line 75 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

bool CTPPSPixelDigiToRaw::debug_
private

Definition at line 76 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

unsigned long CTPPSPixelDigiToRaw::eventCounter_
private

Definition at line 73 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

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

Definition at line 77 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

CTPPSPixelFramePosition CTPPSPixelDigiToRaw::fPos_
private

Definition at line 82 of file CTPPSPixelDigiToRaw.cc.

std::string CTPPSPixelDigiToRaw::mappingLabel_
private

Definition at line 78 of file CTPPSPixelDigiToRaw.cc.

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

Definition at line 79 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().

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

Definition at line 80 of file CTPPSPixelDigiToRaw.cc.

Referenced by CTPPSPixelDigiToRaw(), and produce().

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

Definition at line 81 of file CTPPSPixelDigiToRaw.cc.

Referenced by produce().