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
 
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 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::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_
 
std::vector< CTPPSTotemDataFormatter::PPSStripIndexv_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 59 of file CTPPSTotemDigiToRaw.cc.

Constructor & Destructor Documentation

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

Definition at line 94 of file CTPPSTotemDigiToRaw.cc.

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

96  //register your products
97  tTotemRPDigi_ = consumes<edm::DetSetVector<TotemRPDigi>>(iConfig.getParameter<edm::InputTag>("InputLabel"));
98  produces<FEDRawDataCollection>();
99 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_
CTPPSTotemDigiToRaw::~CTPPSTotemDigiToRaw ( )
override

Definition at line 101 of file CTPPSTotemDigiToRaw.cc.

101  {
102  edm::LogInfo("CTPPSTotemDigiToRaw") << " CTPPSTotemDigiToRaw destructor!";
103 }

Member Function Documentation

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

Definition at line 171 of file CTPPSTotemDigiToRaw.cc.

171 {}
void CTPPSTotemDigiToRaw::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 174 of file CTPPSTotemDigiToRaw.cc.

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

174  {
176  desc.add<edm::InputTag>("InputLabel", edm::InputTag("RPSiDetDigitizer"));
177  descriptions.add("ctppsTotemRawData", desc);
178 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CTPPSTotemDigiToRaw::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 110 of file CTPPSTotemDigiToRaw.cc.

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

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

110  {
111  using namespace edm;
112  using namespace std;
113  eventCounter_++;
114 
116  iEvent.getByToken(tTotemRPDigi_, digiCollection);
117 
120 
121  int digiCounter = 0;
122  for (auto const& di : *digiCollection) {
123  digiCounter += (di.data).size();
124  digis[di.detId()] = di.data;
125  }
126  allDigiCounter_ += digiCounter;
128  // label of the CTPPS sub-system
129  if (recordWatcher_.check(iSetup)) {
130  iSetup.get<TotemReadoutRcd>().get(mapping);
131  for (const auto& p : mapping->VFATMapping) {
132  //get TotemVFATInfo information
133  fedIds_.emplace(p.first.getFEDId());
134  CTPPSTotemDataFormatter::PPSStripIndex iDdet2fed = {(p.second.symbolicID).symbolicID,
135  p.second.hwID,
136  p.first.getFEDId(),
137  p.first.getIdxInFiber(),
138  p.first.getGOHId()};
139  v_iDdet2fed_.emplace_back(iDdet2fed);
140  }
141  }
142 
143  CTPPSTotemDataFormatter formatter(mapping->VFATMapping);
144 
145  // create product (raw data)
146  auto buffers = std::make_unique<FEDRawDataCollection>();
147 
149 
150  // convert data to raw
151  formatter.formatRawData(iEvent.id().event(), rawdata, digis, v_iDdet2fed_);
152 
153  // pack raw data into collection
154  for (auto it : fedIds_) {
155  FEDRawData& fedRawData = buffers->FEDData(it);
156  CTPPSTotemDataFormatter::RawData::iterator fedbuffer = rawdata.find(it);
157  if (fedbuffer != rawdata.end())
158  fedRawData = fedbuffer->second;
159  }
160  allWordCounter_ += formatter.nWords();
161 
162  if (debug_)
163  LogDebug("CTPPSTotemDigiToRaw") << "Words/Digis this iEvent: " << digiCounter << "(fm:" << formatter.nDigis()
164  << ")/" << formatter.nWords() << " all: " << allDigiCounter_ << "/"
165  << allWordCounter_;
166 
167  iEvent.put(std::move(buffers));
168 }
#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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
EventSetup record for TOTEM readout-related information.
std::set< unsigned int > fedIds_
std::unordered_map< cms_uint32_t, DetDigis > Digis
std::vector< CTPPSTotemDataFormatter::PPSStripIndex > v_iDdet2fed_
std::unordered_map< int, FEDRawData > RawData
static bool compare(const PPSStripIndex &a, const PPSStripIndex &b)
std::map< TotemFramePosition, TotemVFATInfo > VFATMapping
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESWatcher< TotemReadoutRcd > recordWatcher_
edm::EventID id() const
Definition: EventBase.h:59
edm::EDGetTokenT< edm::DetSetVector< TotemRPDigi > > tTotemRPDigi_
HLT enums.
T get() const
Definition: EventSetup.h:73
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

int CTPPSTotemDigiToRaw::allDigiCounter_
private

Definition at line 72 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

int CTPPSTotemDigiToRaw::allWordCounter_
private

Definition at line 73 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

bool CTPPSTotemDigiToRaw::debug_
private

Definition at line 74 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

unsigned long CTPPSTotemDigiToRaw::eventCounter_
private

Definition at line 70 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

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

Definition at line 71 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

TotemFramePosition CTPPSTotemDigiToRaw::fPos_
private

Definition at line 78 of file CTPPSTotemDigiToRaw.cc.

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

Definition at line 75 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().

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

Definition at line 76 of file CTPPSTotemDigiToRaw.cc.

Referenced by CTPPSTotemDigiToRaw(), and produce().

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

Definition at line 77 of file CTPPSTotemDigiToRaw.cc.

Referenced by produce().