CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
sistrip::SpyDigiConverterModule Class Reference
Inheritance diagram for sistrip::SpyDigiConverterModule:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 SpyDigiConverterModule (const edm::ParameterSet &)
 
 ~SpyDigiConverterModule () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const bool discardDigisWithAPVAddressError_
 
const uint32_t expectedHeaderBit_
 
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcdfedCablingToken_
 
sistrip::SpyUtilities::FrameQuality frameQuality_
 
const edm::InputTag productLabel_
 
edm::EDGetTokenT< sistrip::SpyDigiConverter::DSVRawDigisproductToken_
 
const bool storeAPVAddress_
 True = store APVE address for each channel. More...
 
const bool storeModuleDigis_
 
const bool storePayloadDigis_
 
const bool storeReorderedDigis_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 34 of file SiStripSpyDigiConverterModule.cc.

Constructor & Destructor Documentation

◆ SpyDigiConverterModule()

sistrip::SpyDigiConverterModule::SpyDigiConverterModule ( const edm::ParameterSet pset)

Definition at line 57 of file SiStripSpyDigiConverterModule.cc.

References fedCablingToken_, frameQuality_, edm::isDebugEnabled(), LogTrace, sistrip::SpyUtilities::FrameQuality::maxDigiRange, sistrip::SpyUtilities::FrameQuality::maxTickHeight, sistrip::SpyUtilities::FrameQuality::maxZeroLight, sistrip::SpyUtilities::FrameQuality::minDigiRange, sistrip::SpyUtilities::FrameQuality::minTickHeight, sistrip::SpyUtilities::FrameQuality::minZeroLight, productLabel_, productToken_, muonDTDigis_cfi::pset, storeAPVAddress_, storeModuleDigis_, storePayloadDigis_, and storeReorderedDigis_.

58  : productLabel_(pset.getParameter<edm::InputTag>("InputProductLabel")),
59  storeAPVAddress_(pset.getParameter<bool>("StoreAPVAddress")),
60  storePayloadDigis_(pset.getParameter<bool>("StorePayloadDigis")),
61  storeReorderedDigis_(pset.getParameter<bool>("StoreReorderedDigis")),
62  storeModuleDigis_(pset.getParameter<bool>("StoreModuleDigis")),
63  discardDigisWithAPVAddressError_(pset.getParameter<bool>("DiscardDigisWithWrongAPVAddress")),
64  expectedHeaderBit_(pset.getParameter<uint32_t>("ExpectedPositionOfFirstHeaderBit")) {
65  productToken_ = consumes<sistrip::SpyDigiConverter::DSVRawDigis>(productLabel_);
66  if (edm::isDebugEnabled()) {
67  LogTrace("SiStripSpyDigiConverter") << "[sistrip::SpyDigiConverterModule::" << __func__ << "]"
68  << " Constructing object...";
69  }
70  if (storeModuleDigis_) {
71  fedCablingToken_ = esConsumes<>();
72  }
73 
75  produces<edm::DetSetVector<SiStripRawDigi> >("SpyPayload");
77  produces<edm::DetSetVector<SiStripRawDigi> >("SpyReordered");
79  produces<edm::DetSetVector<SiStripRawDigi> >("SpyVirginRaw");
80 
81  if (storeAPVAddress_) {
82  produces<std::vector<uint32_t> >("APVAddress");
83  //produces<uint8_t>("APVAddress");
84  }
85 
86  frameQuality_.minDigiRange = static_cast<uint16_t>(pset.getParameter<uint32_t>("MinDigiRange"));
87  frameQuality_.maxDigiRange = static_cast<uint16_t>(pset.getParameter<uint32_t>("MaxDigiRange"));
88  frameQuality_.minZeroLight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MinZeroLight"));
89  frameQuality_.maxZeroLight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MaxZeroLight"));
90  frameQuality_.minTickHeight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MinTickHeight"));
91  frameQuality_.maxTickHeight = static_cast<uint16_t>(pset.getParameter<uint32_t>("MaxTickHeight"));
92 
93  } // end of constructor.
bool isDebugEnabled()
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
#define LogTrace(id)
edm::EDGetTokenT< sistrip::SpyDigiConverter::DSVRawDigis > productToken_
const bool storeAPVAddress_
True = store APVE address for each channel.
sistrip::SpyUtilities::FrameQuality frameQuality_

◆ ~SpyDigiConverterModule()

sistrip::SpyDigiConverterModule::~SpyDigiConverterModule ( )
override

Definition at line 95 of file SiStripSpyDigiConverterModule.cc.

References edm::isDebugEnabled(), and LogTrace.

95  {
96  if (edm::isDebugEnabled()) {
97  LogTrace("SiStripSpyDigiConverter") << "[sistrip::SpyDigiConverterModule::" << __func__ << "]"
98  << " Destructing object...";
99  }
100  } // end of destructor.
bool isDebugEnabled()
#define LogTrace(id)

Member Function Documentation

◆ produce()

void sistrip::SpyDigiConverterModule::produce ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup setup 
) const
overridevirtual

Retrieves cabling map from EventSetup and spy channel scope mode digis from Event, creates DetSetVectors of SiStripRawDigis, at verious levels of processing, using the SiStripSpyDigiConverter class and attaches the containers to the Event.

Implements edm::global::EDProducerBase.

Definition at line 108 of file SiStripSpyDigiConverterModule.cc.

References discardDigisWithAPVAddressError_, expectedHeaderBit_, sistrip::SpyDigiConverter::extractPayloadDigis(), fedCablingToken_, frameQuality_, sistrip::SpyUtilities::getMajorityHeader(), sistrip::SpyDigiConverter::mergeModuleChannels(), eostools::move(), edm::Handle< T >::product(), productToken_, sistrip::SpyDigiConverter::reorderDigis(), singleTopDQM_cfi::setup, storeAPVAddress_, storeModuleDigis_, storePayloadDigis_, and storeReorderedDigis_.

108  {
110  return;
111 
112  //retrieve the scope mode digis
114  event.getByToken(productToken_, scopeDigisHandle);
115 
116  //32-bit to accomodate known CMSSW container
117  std::unique_ptr<std::vector<uint32_t> > pAPVAddresses(new std::vector<uint32_t>);
118 
119  std::unique_ptr<sistrip::SpyDigiConverter::DSVRawDigis> payloadDigis, reorderedDigis, moduleDigis;
120 
121  //get the majority value for expected position of first header bit
122  //from first event, compare to expected one, else output warning.
123  auto run_once = [this](auto digis) {
124  uint16_t lFirstHeaderBit;
125  sistrip::SpyUtilities::getMajorityHeader(digis, lFirstHeaderBit);
126 
127  if (lFirstHeaderBit != static_cast<uint16_t>(expectedHeaderBit_)) {
128  edm::LogWarning("") << " -- Majority position for firstHeaderBit in first event (" << lFirstHeaderBit
129  << ") is not where expected: " << static_cast<uint16_t>(expectedHeaderBit_) << std::endl;
130  }
131  return false;
132  };
133 
134  [[maybe_unused]] static const bool lFirstEvent = run_once(scopeDigisHandle.product());
135 
136  //extract frame digis and APV addresses
137  payloadDigis = sistrip::SpyDigiConverter::extractPayloadDigis(scopeDigisHandle.product(),
138  pAPVAddresses.get(),
141  static_cast<uint16_t>(expectedHeaderBit_));
142 
143  // Reorder
145  reorderedDigis = sistrip::SpyDigiConverter::reorderDigis(payloadDigis.get());
146  }
147 
148  // Merge into modules
149  if (storeModuleDigis_) {
150  auto const& fedCabling = setup.getData(fedCablingToken_);
151  moduleDigis = sistrip::SpyDigiConverter::mergeModuleChannels(reorderedDigis.get(), fedCabling);
152  }
153 
154  //add to event
155  if (storePayloadDigis_)
156  event.put(std::move(payloadDigis), "SpyPayload");
158  event.put(std::move(reorderedDigis), "SpyReordered");
159  if (storeModuleDigis_)
160  event.put(std::move(moduleDigis), "SpyVirginRaw");
161  if (storeAPVAddress_) {
162  event.put(std::move(pAPVAddresses), "APVAddress");
163  }
164 
165  } // end of SpyDigiConverter::produce method.
static std::unique_ptr< DSVRawDigis > reorderDigis(const DSVRawDigis *inputPayloadDigis)
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
T const * product() const
Definition: Handle.h:70
static std::unique_ptr< DSVRawDigis > extractPayloadDigis(const DSVRawDigis *inputScopeDigis, std::vector< uint32_t > *pAPVAddresses, const bool discardDigisWithAPVAddrErr, const sistrip::SpyUtilities::FrameQuality &aQuality, const uint16_t expectedPos)
Extract frames from the scope digis.
edm::EDGetTokenT< sistrip::SpyDigiConverter::DSVRawDigis > productToken_
void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
static std::unique_ptr< DSVRawDigis > mergeModuleChannels(const DSVRawDigis *inputPhysicalOrderChannelDigis, const SiStripFedCabling &cabling)
const bool storeAPVAddress_
True = store APVE address for each channel.
sistrip::SpyUtilities::FrameQuality frameQuality_
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ discardDigisWithAPVAddressError_

const bool sistrip::SpyDigiConverterModule::discardDigisWithAPVAddressError_
private

Definition at line 46 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

◆ expectedHeaderBit_

const uint32_t sistrip::SpyDigiConverterModule::expectedHeaderBit_
private

Definition at line 47 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

◆ fedCablingToken_

edm::ESGetToken<SiStripFedCabling, SiStripFedCablingRcd> sistrip::SpyDigiConverterModule::fedCablingToken_
private

Definition at line 50 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

◆ frameQuality_

sistrip::SpyUtilities::FrameQuality sistrip::SpyDigiConverterModule::frameQuality_
private

Definition at line 45 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

◆ productLabel_

const edm::InputTag sistrip::SpyDigiConverterModule::productLabel_
private

Definition at line 41 of file SiStripSpyDigiConverterModule.cc.

Referenced by SpyDigiConverterModule().

◆ productToken_

edm::EDGetTokenT<sistrip::SpyDigiConverter::DSVRawDigis> sistrip::SpyDigiConverterModule::productToken_
private

Definition at line 42 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

◆ storeAPVAddress_

const bool sistrip::SpyDigiConverterModule::storeAPVAddress_
private

True = store APVE address for each channel.

Definition at line 43 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

◆ storeModuleDigis_

const bool sistrip::SpyDigiConverterModule::storeModuleDigis_
private

Definition at line 44 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

◆ storePayloadDigis_

const bool sistrip::SpyDigiConverterModule::storePayloadDigis_
private

Definition at line 44 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

◆ storeReorderedDigis_

const bool sistrip::SpyDigiConverterModule::storeReorderedDigis_
private

Definition at line 44 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().