CMS 3D CMS Logo

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

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 SpyDigiConverterModule (const edm::ParameterSet &)
 
 ~SpyDigiConverterModule () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const bool discardDigisWithAPVAddressError_
 
const uint32_t expectedHeaderBit_
 
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_
 
SpyUtilities utility_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 37 of file SiStripSpyDigiConverterModule.cc.

Constructor & Destructor Documentation

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

Definition at line 63 of file SiStripSpyDigiConverterModule.cc.

References frameQuality_, edm::ParameterSet::getParameter(), 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_, storeAPVAddress_, storeModuleDigis_, storePayloadDigis_, and storeReorderedDigis_.

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

Definition at line 100 of file SiStripSpyDigiConverterModule.cc.

References edm::isDebugEnabled(), and LogTrace.

100  {
101  if ( edm::isDebugEnabled() ) {
102  LogTrace("SiStripSpyDigiConverter")
103  << "[sistrip::SpyDigiConverterModule::" << __func__ << "]"
104  << " Destructing object...";
105  }
106  } // end of destructor.
bool isDebugEnabled()
#define LogTrace(id)

Member Function Documentation

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

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.

Definition at line 114 of file SiStripSpyDigiConverterModule.cc.

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

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

114  {
115 
116  static bool lFirstEvent = true;
117 
118  const SiStripFedCabling* lCabling = utility_.getCabling( setup );
119 
121 
122  //retrieve the scope mode digis
124  event.getByToken(productToken_, scopeDigisHandle);
125 
126  //32-bit to accomodate known CMSSW container
127  std::unique_ptr< std::vector<uint32_t> > pAPVAddresses(new std::vector<uint32_t>);
128 
129  std::unique_ptr<sistrip::SpyDigiConverter::DSVRawDigis> payloadDigis, reorderedDigis, moduleDigis;
130 
131  //get the majority value for expected position of first header bit
132  //from first event, compare to expected one, else output warning.
133  if (lFirstEvent){
134  uint16_t lFirstHeaderBit;
135  sistrip::SpyUtilities::getMajorityHeader(scopeDigisHandle.product(),lFirstHeaderBit);
136 
137  if (lFirstHeaderBit != static_cast<uint16_t>(expectedHeaderBit_)) {
138  edm::LogWarning("") << " -- Majority position for firstHeaderBit in first event ("
139  << lFirstHeaderBit
140  << ") is not where expected: "
141  << static_cast<uint16_t>(expectedHeaderBit_)
142  << std::endl;
143  }
144 
145  }
146 
147 
148 
149  //extract frame digis and APV addresses
150  payloadDigis = sistrip::SpyDigiConverter::extractPayloadDigis(scopeDigisHandle.product(),
151  pAPVAddresses.get(),
153  frameQuality_,
154  static_cast<uint16_t>(expectedHeaderBit_));
155 
156  // Reorder
158  reorderedDigis = sistrip::SpyDigiConverter::reorderDigis(payloadDigis.get());
159  }
160 
161  // Merge into modules
162  if (storeModuleDigis_) {
163  moduleDigis = sistrip::SpyDigiConverter::mergeModuleChannels(reorderedDigis.get(), *lCabling);
164  }
165 
166  //add to event
167  if (storePayloadDigis_) event.put(std::move(payloadDigis),"Payload");
168  if (storeReorderedDigis_) event.put(std::move(reorderedDigis),"Reordered");
169  if (storeModuleDigis_) event.put(std::move(moduleDigis),"VirginRaw");
170  if (storeAPVAddress_) {
171  event.put(std::move(pAPVAddresses), "APVAddress");
172  }
173 
174 
175  lFirstEvent = false;
176 
177  } // end of SpyDigiConverter::produce method.
static std::unique_ptr< DSVRawDigis > reorderDigis(const DSVRawDigis *inputPayloadDigis)
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_
static std::unique_ptr< DSVRawDigis > mergeModuleChannels(const DSVRawDigis *inputPhysicalOrderChannelDigis, const SiStripFedCabling &cabling)
const bool storeAPVAddress_
True = store APVE address for each channel.
T const * product() const
Definition: Handle.h:81
const SiStripFedCabling * getCabling(const edm::EventSetup &)
Updates the cabling object from the DB.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
sistrip::SpyUtilities::FrameQuality frameQuality_
static void getMajorityHeader(const edm::DetSetVector< SiStripRawDigi > *aInputDigis, uint16_t &firstHeaderBit, bool printResult=true)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

const bool sistrip::SpyDigiConverterModule::discardDigisWithAPVAddressError_
private

Definition at line 50 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

const uint32_t sistrip::SpyDigiConverterModule::expectedHeaderBit_
private

Definition at line 51 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().

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

Definition at line 49 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

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

Definition at line 45 of file SiStripSpyDigiConverterModule.cc.

Referenced by SpyDigiConverterModule().

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

Definition at line 46 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

const bool sistrip::SpyDigiConverterModule::storeAPVAddress_
private

True = store APVE address for each channel.

Definition at line 47 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

const bool sistrip::SpyDigiConverterModule::storeModuleDigis_
private

Definition at line 48 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

const bool sistrip::SpyDigiConverterModule::storePayloadDigis_
private

Definition at line 48 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

const bool sistrip::SpyDigiConverterModule::storeReorderedDigis_
private

Definition at line 48 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce(), and SpyDigiConverterModule().

SpyUtilities sistrip::SpyDigiConverterModule::utility_
private

Definition at line 54 of file SiStripSpyDigiConverterModule.cc.

Referenced by produce().