CMS 3D CMS Logo

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

#include <temp/CTPPSTotemDigiToRaw/plugins/CTPPSTotemDigiToRaw.cc>

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

Public Member Functions

 CTPPSTotemDigiToRaw (const edm::ParameterSet &)
 
 ~CTPPSTotemDigiToRaw () 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 beginStream (edm::StreamID) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

int allDigiCounter_
 
int allWordCounter_
 
bool debug_
 
unsigned long eventCounter_
 
std::set< unsigned int > fedIds_
 
TotemFramePosition fPos_
 
edm::ESWatcher< TotemReadoutRcdrecordWatcher_
 
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcdtTotemDAQMapping_
 
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_
 
std::vector< CTPPSTotemDataFormatter::PPSStripIndexv_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 60 of file CTPPSTotemDigiToRaw.cc.

Constructor & Destructor Documentation

◆ CTPPSTotemDigiToRaw()

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

Definition at line 96 of file CTPPSTotemDigiToRaw.cc.

References edm::ParameterSet::getParameter(), tTotemDAQMapping_, and tTotemRPDigi_.

98  //register your products
99  tTotemRPDigi_ = consumes<edm::DetSetVector<TotemRPDigi>>(iConfig.getParameter<edm::InputTag>("InputLabel"));
100  tTotemDAQMapping_ = esConsumes<TotemDAQMapping, TotemReadoutRcd>();
101  produces<FEDRawDataCollection>();
102 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > tTotemDAQMapping_
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_

◆ ~CTPPSTotemDigiToRaw()

CTPPSTotemDigiToRaw::~CTPPSTotemDigiToRaw ( )
override

Definition at line 104 of file CTPPSTotemDigiToRaw.cc.

104  {
105  edm::LogInfo("CTPPSTotemDigiToRaw") << " CTPPSTotemDigiToRaw destructor!";
106 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ beginStream()

void CTPPSTotemDigiToRaw::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 174 of file CTPPSTotemDigiToRaw.cc.

174 {}

◆ fillDescriptions()

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

Definition at line 177 of file CTPPSTotemDigiToRaw.cc.

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

177  {
179  desc.add<edm::InputTag>("InputLabel", edm::InputTag("RPSiDetDigitizer"));
180  descriptions.add("ctppsTotemRawData", desc);
181 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 113 of file CTPPSTotemDigiToRaw.cc.

References allDigiCounter_, allWordCounter_, edm::ESWatcher< T >::check(), CTPPSTotemDataFormatter::compare(), debug_, apvshotsanalyzer_cfi::digiCollection, eventCounter_, fedIds_, l1t_dqm_sourceclient-live_cfg::fedRawData, CTPPSTotemDataFormatter::formatRawData(), edm::EventSetup::getHandle(), iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, LogDebug, HPSPFTaus_cff::mapping, eostools::move(), CTPPSTotemDataFormatter::nDigis(), CTPPSTotemDataFormatter::nWords(), AlCaHLTBitMon_ParallelJobs::p, recordWatcher_, findQualityFiles::size, jetUpdater_cfi::sort, tTotemDAQMapping_, tTotemRPDigi_, and v_iDdet2fed_.

113  {
114  using namespace edm;
115  using namespace std;
116  eventCounter_++;
117 
119  iEvent.getByToken(tTotemRPDigi_, digiCollection);
120 
123 
124  int digiCounter = 0;
125  for (auto const& di : *digiCollection) {
126  digiCounter += (di.data).size();
127  digis[di.detId()] = di.data;
128  }
129  allDigiCounter_ += digiCounter;
131  // label of the CTPPS sub-system
132  if (recordWatcher_.check(iSetup)) {
134  for (const auto& p : mapping->VFATMapping) {
135  //get TotemVFATInfo information
136  fedIds_.emplace(p.first.getFEDId());
137  CTPPSTotemDataFormatter::PPSStripIndex iDdet2fed = {(p.second.symbolicID).symbolicID,
138  p.second.hwID,
139  p.first.getFEDId(),
140  p.first.getIdxInFiber(),
141  p.first.getGOHId()};
142  v_iDdet2fed_.emplace_back(iDdet2fed);
143  }
144  }
145 
146  CTPPSTotemDataFormatter formatter(mapping->VFATMapping);
147 
148  // create product (raw data)
149  auto buffers = std::make_unique<FEDRawDataCollection>();
150 
152 
153  // convert data to raw
154  formatter.formatRawData(iEvent.id().event(), rawdata, digis, v_iDdet2fed_);
155 
156  // pack raw data into collection
157  for (auto it : fedIds_) {
158  FEDRawData& fedRawData = buffers->FEDData(it);
159  CTPPSTotemDataFormatter::RawData::iterator fedbuffer = rawdata.find(it);
160  if (fedbuffer != rawdata.end())
161  fedRawData = fedbuffer->second;
162  }
163  allWordCounter_ += formatter.nWords();
164 
165  if (debug_)
166  LogDebug("CTPPSTotemDigiToRaw") << "Words/Digis this iEvent: " << digiCounter << "(fm:" << formatter.nDigis()
167  << ")/" << formatter.nWords() << " all: " << allDigiCounter_ << "/"
168  << allWordCounter_;
169 
170  iEvent.put(std::move(buffers));
171 }
size
Write out results.
std::set< unsigned int > fedIds_
std::unordered_map< cms_uint32_t, DetDigis > Digis
std::vector< CTPPSTotemDataFormatter::PPSStripIndex > v_iDdet2fed_
int iEvent
Definition: GenABIO.cc:224
std::unordered_map< int, FEDRawData > RawData
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
static bool compare(const PPSStripIndex &a, const PPSStripIndex &b)
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > tTotemDAQMapping_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< TotemReadoutRcd > recordWatcher_
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_
HLT enums.
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ allDigiCounter_

int CTPPSTotemDigiToRaw::allDigiCounter_
private

Definition at line 73 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

◆ allWordCounter_

int CTPPSTotemDigiToRaw::allWordCounter_
private

Definition at line 74 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

◆ debug_

bool CTPPSTotemDigiToRaw::debug_
private

Definition at line 75 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

◆ eventCounter_

unsigned long CTPPSTotemDigiToRaw::eventCounter_
private

Definition at line 71 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

◆ fedIds_

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

Definition at line 72 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

◆ fPos_

TotemFramePosition CTPPSTotemDigiToRaw::fPos_
private

Definition at line 80 of file CTPPSTotemDigiToRaw.cc.

◆ recordWatcher_

edm::ESWatcher<TotemReadoutRcd> CTPPSTotemDigiToRaw::recordWatcher_
private

Definition at line 76 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

◆ tTotemDAQMapping_

edm::ESGetToken<TotemDAQMapping, TotemReadoutRcd> CTPPSTotemDigiToRaw::tTotemDAQMapping_
private

Definition at line 78 of file CTPPSTotemDigiToRaw.cc.

Referenced by CTPPSTotemDigiToRaw(), and produce().

◆ tTotemRPDigi_

edm::EDGetTokenT<edm::DetSetVector<TotemRPDigi> > CTPPSTotemDigiToRaw::tTotemRPDigi_
private

Definition at line 77 of file CTPPSTotemDigiToRaw.cc.

Referenced by CTPPSTotemDigiToRaw(), and produce().

◆ v_iDdet2fed_

std::vector<CTPPSTotemDataFormatter::PPSStripIndex> CTPPSTotemDigiToRaw::v_iDdet2fed_
private

Definition at line 79 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().