CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
sistrip::DigiToRawModule Class Referencefinal

A plug-in module that takes StripDigis as input from the Event and creates an EDProduct comprising a FEDRawDataCollection. More...

#include <SiStripDigiToRawModule.h>

Inheritance diagram for sistrip::DigiToRawModule:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
 DigiToRawModule (const edm::ParameterSet &)
 
virtual void endJob ()
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~DigiToRawModule () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool copyBufferHeader_
 
DigiToRawdigiToRaw_
 
uint32_t eventCounter_
 
std::string inputDigiLabel_
 
std::string inputModuleLabel_
 
FEDReadoutMode mode_
 
edm::InputTag rawDataTag_
 
bool rawdigi_
 
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > tokenDigi
 
edm::EDGetTokenT< FEDRawDataCollectiontokenRawBuffer
 
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > tokenRawDigi
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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
 
- 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

A plug-in module that takes StripDigis as input from the Event and creates an EDProduct comprising a FEDRawDataCollection.

Definition at line 28 of file SiStripDigiToRawModule.h.

Constructor & Destructor Documentation

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

Creates instance of DigiToRaw converter, defines EDProduct type.

Definition at line 37 of file SiStripDigiToRawModule.cc.

References copyBufferHeader_, digiToRaw_, edm::ParameterSet::getParameter(), inputDigiLabel_, inputModuleLabel_, edm::isDebugEnabled(), LogDebug, mode_, rawDataTag_, rawdigi_, sistrip::READOUT_MODE_INVALID, sistrip::READOUT_MODE_PREMIX_RAW, sistrip::READOUT_MODE_PROC_RAW, sistrip::READOUT_MODE_SCOPE, sistrip::READOUT_MODE_SPY, sistrip::READOUT_MODE_VIRGIN_RAW, sistrip::READOUT_MODE_ZERO_SUPPRESSED, sistrip::READOUT_MODE_ZERO_SUPPRESSED_FAKE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE10, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE10_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_BOTBOT_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_CMOVERRIDE, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT, sistrip::READOUT_MODE_ZERO_SUPPRESSED_LITE8_TOPBOT_CMOVERRIDE, AlCaHLTBitMon_QueryRunRegistry::string, tokenDigi, tokenRawBuffer, and tokenRawDigi.

37  :
38  inputModuleLabel_( pset.getParameter<std::string>( "InputModuleLabel" ) ),
39  inputDigiLabel_( pset.getParameter<std::string>( "InputDigiLabel" ) ),
40  copyBufferHeader_(pset.getParameter<bool>("CopyBufferHeader")),
41  mode_( fedReadoutModeFromString(pset.getParameter<std::string>( "FedReadoutMode" ))),
42  rawdigi_( false ),
43  digiToRaw_(nullptr),
44  eventCounter_(0),
45  rawDataTag_(pset.getParameter<edm::InputTag>("RawDataTag"))
46  {
47  if ( edm::isDebugEnabled() ) {
48  LogDebug("DigiToRawModule")
49  << "[sistrip::DigiToRawModule::DigiToRawModule]"
50  << " Constructing object...";
51  }
52 
53 
54  switch(mode_) {
55  case READOUT_MODE_ZERO_SUPPRESSED: rawdigi_ = false; break;
56  case READOUT_MODE_ZERO_SUPPRESSED_FAKE: rawdigi_ = false; break;
57  case READOUT_MODE_ZERO_SUPPRESSED_LITE10: rawdigi_ = false; break;
59  case READOUT_MODE_ZERO_SUPPRESSED_LITE8: rawdigi_ = false; break;
65  case READOUT_MODE_PREMIX_RAW: rawdigi_ = false; break;
66  case READOUT_MODE_VIRGIN_RAW: rawdigi_ = true; break;
67  case READOUT_MODE_PROC_RAW: rawdigi_ = true; break;
68  case READOUT_MODE_SCOPE: rawdigi_ = true; break;
69  case READOUT_MODE_INVALID: {
70  if( edm::isDebugEnabled()) {
71  edm::LogWarning("DigiToRawModule")
72  << "[sistrip::DigiToRawModule::DigiToRawModule]"
73  << " UNKNOWN readout mode: " << pset.getParameter<std::string>("FedReadoutMode");
74  }} break;
75  case READOUT_MODE_SPY: {
76  if( edm::isDebugEnabled()) {
77  edm::LogWarning("DigiToRawModule")
78  << "[sistrip::DigiToRawModule::DigiToRawModule]"
79  << " Digi to raw is not supported for spy channel data";
80  }} break;
81  }
82  if(pset.getParameter<bool>("UseWrongDigiType")) {
83  rawdigi_ = !rawdigi_;
84  if( edm::isDebugEnabled()) {
85  edm::LogWarning("DigiToRawModule")
86  << "[sistrip::DigiToRawModule::DigiToRawModule]"
87  << " You are using the wrong type of digis!";
88  }
89  }
90 
91  // Create instance of DigiToRaw formatter
92  digiToRaw_ = new DigiToRaw( mode_, pset.getParameter<bool>("UseFedKey") );
93 
94  if (rawdigi_) {
95  tokenRawDigi = consumes< edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabel_, inputDigiLabel_));
96  } else {
97  tokenDigi = consumes< edm::DetSetVector<SiStripDigi> >(edm::InputTag(inputModuleLabel_, inputDigiLabel_));
98  }
99  if (copyBufferHeader_){
100  //CAMM input raw module label or same as digi ????
101  if( edm::isDebugEnabled()) {
102  edm::LogWarning("DigiToRawModule")
103  << "[sistrip::DigiToRawModule::DigiToRawModule]"
104  << "Copying buffer header from collection " << rawDataTag_;
105  }
106  tokenRawBuffer = consumes<FEDRawDataCollection>(rawDataTag_);
107  }
108 
109  produces<FEDRawDataCollection>();
110 
111  }
#define LogDebug(id)
T getParameter(std::string const &) const
bool isDebugEnabled()
edm::EDGetTokenT< FEDRawDataCollection > tokenRawBuffer
FEDReadoutMode fedReadoutModeFromString(const std::string &readoutModeString)
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > tokenDigi
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > tokenRawDigi
sistrip::DigiToRawModule::~DigiToRawModule ( )
override

Definition at line 115 of file SiStripDigiToRawModule.cc.

References digiToRaw_, edm::isDebugEnabled(), and LogDebug.

115  {
116  if ( edm::isDebugEnabled() ) {
117  LogDebug("DigiToRaw")
118  << "[sistrip::DigiToRawModule::~DigiToRawModule]"
119  << " Destructing object...";
120  }
121  if ( digiToRaw_ ) delete digiToRaw_;
122  }
#define LogDebug(id)
bool isDebugEnabled()

Member Function Documentation

virtual void sistrip::DigiToRawModule::beginJob ( void  )
inlinevirtual

Definition at line 35 of file SiStripDigiToRawModule.h.

35 {}
virtual void sistrip::DigiToRawModule::endJob ( void  )
inlinevirtual

Definition at line 36 of file SiStripDigiToRawModule.h.

36 {}
void sistrip::DigiToRawModule::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 21 of file SiStripDigiToRawModule.cc.

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

21  {
23  desc.add<std::string>("InputModuleLabel", "simSiStripDigis");
24  desc.add<std::string>("InputDigiLabel", "ZeroSuppressed");
25  desc.add<std::string>("FedReadoutMode", "ZERO_SUPPRESSED");
26  desc.add<bool>("UseFedKey", false);
27  desc.add<bool>("UseWrongDigiType", false);
28  desc.add<bool>("CopyBufferHeader", false);
29  desc.add<edm::InputTag>("RawDataTag", edm::InputTag("rawDataCollector"));
30  descriptions.add("SiStripDigiToRawModule",desc);
31  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void sistrip::DigiToRawModule::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Retrieves cabling map from EventSetup, retrieves a DetSetVector of SiStripDigis from Event, creates a FEDRawDataCollection (EDProduct), uses DigiToRaw converter to fill FEDRawDataCollection, attaches FEDRawDataCollection to Event.

Definition at line 131 of file SiStripDigiToRawModule.cc.

References copyBufferHeader_, sistrip::DigiToRaw::createFedBuffers(), digiToRaw_, MillePedeFileConverter_cfg::e, eventCounter_, edm::EventSetup::get(), edm::Event::getByToken(), edm::isDebugEnabled(), eostools::move(), edm::Event::put(), rawDataTag_, rawdigi_, tokenDigi, tokenRawBuffer, and tokenRawDigi.

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

132  {
133 
134  eventCounter_++;
135 
136  auto buffers = std::make_unique<FEDRawDataCollection>();
137 
139  iSetup.get<SiStripFedCablingRcd>().get( cabling );
140 
141  //get buffer header from original rawdata
143  if (copyBufferHeader_){
144  if( edm::isDebugEnabled()) {
145  edm::LogWarning("DigiToRawModule")
146  << "[sistrip::DigiToRawModule::DigiToRawModule]"
147  << "Getting raw buffer: ";
148  }
149  try {
150  iEvent.getByToken( tokenRawBuffer, rawbuffers );
151  } catch (const cms::Exception& e){
152  if( edm::isDebugEnabled()) {
153  edm::LogWarning("DigiToRawModule")
154  << "[sistrip::DigiToRawModule::DigiToRawModule]"
155  << " Failed to get collection " << rawDataTag_;
156  }
157  }
158  }
159 
160  if( rawdigi_ ) {
162  iEvent.getByToken( tokenRawDigi, rawdigis );
163  if (copyBufferHeader_) digiToRaw_->createFedBuffers( iEvent, cabling, rawbuffers, rawdigis, buffers );
164  else digiToRaw_->createFedBuffers( iEvent, cabling, rawdigis, buffers );
165  } else {
167  iEvent.getByToken( tokenDigi, digis );
168  if (copyBufferHeader_) digiToRaw_->createFedBuffers( iEvent, cabling, rawbuffers, digis, buffers );
169  else digiToRaw_->createFedBuffers( iEvent, cabling, digis, buffers );
170  }
171 
172 
173  iEvent.put(std::move(buffers));
174 
175  }
bool isDebugEnabled()
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
edm::EDGetTokenT< FEDRawDataCollection > tokenRawBuffer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void createFedBuffers(edm::Event &, edm::ESHandle< SiStripFedCabling > &cabling, edm::Handle< edm::DetSetVector< SiStripDigi > > &digis, std::unique_ptr< FEDRawDataCollection > &buffers)
const T & get() const
Definition: EventSetup.h:58
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > tokenDigi
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > tokenRawDigi
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

bool sistrip::DigiToRawModule::copyBufferHeader_
private

Definition at line 46 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

DigiToRaw* sistrip::DigiToRawModule::digiToRaw_
private

Definition at line 49 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), produce(), and ~DigiToRawModule().

uint32_t sistrip::DigiToRawModule::eventCounter_
private

Definition at line 50 of file SiStripDigiToRawModule.h.

Referenced by produce().

std::string sistrip::DigiToRawModule::inputDigiLabel_
private

Definition at line 44 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

std::string sistrip::DigiToRawModule::inputModuleLabel_
private

Definition at line 43 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

FEDReadoutMode sistrip::DigiToRawModule::mode_
private

Definition at line 47 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

edm::InputTag sistrip::DigiToRawModule::rawDataTag_
private

Definition at line 53 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

bool sistrip::DigiToRawModule::rawdigi_
private

Definition at line 48 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

edm::EDGetTokenT< edm::DetSetVector<SiStripDigi> > sistrip::DigiToRawModule::tokenDigi
private

Definition at line 52 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

edm::EDGetTokenT<FEDRawDataCollection> sistrip::DigiToRawModule::tokenRawBuffer
private

Definition at line 54 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

edm::EDGetTokenT< edm::DetSetVector<SiStripRawDigi> > sistrip::DigiToRawModule::tokenRawDigi
private

Definition at line 51 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().