CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
sistrip::DigiToRawModule Class Reference

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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
 DigiToRawModule (const edm::ParameterSet &)
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~DigiToRawModule ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 24 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 21 of file SiStripDigiToRawModule.cc.

References DigiToRaw_cff::DigiToRaw, digiToRaw_, edm::ParameterSet::getParameter(), inputDigiLabel_, inputModuleLabel_, edm::isDebugEnabled(), LogDebug, mode_, rawdigi_, sistrip::READOUT_MODE_INVALID, 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_LITE, AlCaHLTBitMon_QueryRunRegistry::string, tokenDigi, and tokenRawDigi.

21  :
22  inputModuleLabel_( pset.getParameter<std::string>( "InputModuleLabel" ) ),
23  inputDigiLabel_( pset.getParameter<std::string>( "InputDigiLabel" ) ),
24  mode_( fedReadoutModeFromString(pset.getParameter<std::string>( "FedReadoutMode" ))),
25  rawdigi_( false ),
26  digiToRaw_(0),
27  eventCounter_(0)
28  {
29  if ( edm::isDebugEnabled() ) {
30  LogDebug("DigiToRawModule")
31  << "[sistrip::DigiToRawModule::DigiToRawModule]"
32  << " Constructing object...";
33  }
34 
35  switch(mode_) {
36  case READOUT_MODE_ZERO_SUPPRESSED_LITE: rawdigi_ = false; break;
37  case READOUT_MODE_ZERO_SUPPRESSED: rawdigi_ = false; break;
38  case READOUT_MODE_VIRGIN_RAW: rawdigi_ = true; break;
39  case READOUT_MODE_PROC_RAW: rawdigi_ = true; break;
40  case READOUT_MODE_SCOPE: rawdigi_ = true; break;
41  case READOUT_MODE_INVALID: {
42  if( edm::isDebugEnabled()) {
43  edm::LogWarning("DigiToRawModule")
44  << "[sistrip::DigiToRawModule::DigiToRawModule]"
45  << " UNKNOWN readout mode: " << pset.getParameter<std::string>("FedReadoutMode");
46  }} break;
47  case READOUT_MODE_SPY: {
48  if( edm::isDebugEnabled()) {
49  edm::LogWarning("DigiToRawModule")
50  << "[sistrip::DigiToRawModule::DigiToRawModule]"
51  << " Digi to raw is not supported for spy channel data";
52  }} break;
53  }
54  if(pset.getParameter<bool>("UseWrongDigiType")) {
55  rawdigi_ = !rawdigi_;
56  if( edm::isDebugEnabled()) {
57  edm::LogWarning("DigiToRawModule")
58  << "[sistrip::DigiToRawModule::DigiToRawModule]"
59  << " You are using the wrong type of digis!";
60  }
61  }
62 
63  // Create instance of DigiToRaw formatter
64  digiToRaw_ = new DigiToRaw( mode_, pset.getParameter<bool>("UseFedKey") );
65 
66  if (rawdigi_) {
67  tokenRawDigi = consumes< edm::DetSetVector<SiStripRawDigi> >(edm::InputTag(inputModuleLabel_, inputDigiLabel_));
68  } else {
69  tokenDigi = consumes< edm::DetSetVector<SiStripDigi> >(edm::InputTag(inputModuleLabel_, inputDigiLabel_));
70 
71  }
72 
73  produces<FEDRawDataCollection>();
74 
75  }
#define LogDebug(id)
T getParameter(std::string const &) const
bool isDebugEnabled()
FEDReadoutMode fedReadoutModeFromString(const std::string &readoutModeString)
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > tokenDigi
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > tokenRawDigi
sistrip::DigiToRawModule::~DigiToRawModule ( )

Definition at line 79 of file SiStripDigiToRawModule.cc.

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

79  {
80  if ( edm::isDebugEnabled() ) {
81  LogDebug("DigiToRaw")
82  << "[sistrip::DigiToRawModule::~DigiToRawModule]"
83  << " Destructing object...";
84  }
85  if ( digiToRaw_ ) delete digiToRaw_;
86  }
#define LogDebug(id)
bool isDebugEnabled()

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 31 of file SiStripDigiToRawModule.h.

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

Reimplemented from edm::EDProducer.

Definition at line 32 of file SiStripDigiToRawModule.h.

32 {}
void sistrip::DigiToRawModule::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

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.

Implements edm::EDProducer.

Definition at line 95 of file SiStripDigiToRawModule.cc.

References sistrip::DigiToRaw::createFedBuffers(), digiToRaw_, eventCounter_, edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::put(), rawdigi_, tokenDigi, and tokenRawDigi.

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

96  {
97 
98  eventCounter_++;
99 
100  std::auto_ptr<FEDRawDataCollection> buffers( new FEDRawDataCollection );
101 
103  iSetup.get<SiStripFedCablingRcd>().get( cabling );
104 
105  if( rawdigi_ ) {
107  iEvent.getByToken( tokenRawDigi, rawdigis );
108  digiToRaw_->createFedBuffers( iEvent, cabling, rawdigis, buffers );
109  } else {
111  iEvent.getByToken( tokenDigi, digis );
112  digiToRaw_->createFedBuffers( iEvent, cabling, digis, buffers );
113  }
114 
115  iEvent.put( buffers );
116 
117  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void createFedBuffers(edm::Event &, edm::ESHandle< SiStripFedCabling > &cabling, edm::Handle< edm::DetSetVector< SiStripDigi > > &digis, std::auto_ptr< FEDRawDataCollection > &buffers)
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > tokenDigi
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > tokenRawDigi

Member Data Documentation

DigiToRaw* sistrip::DigiToRawModule::digiToRaw_
private

Definition at line 42 of file SiStripDigiToRawModule.h.

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

uint32_t sistrip::DigiToRawModule::eventCounter_
private

Definition at line 43 of file SiStripDigiToRawModule.h.

Referenced by produce().

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

Definition at line 39 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

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

Definition at line 38 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

FEDReadoutMode sistrip::DigiToRawModule::mode_
private

Definition at line 40 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule().

bool sistrip::DigiToRawModule::rawdigi_
private

Definition at line 41 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

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

Definition at line 45 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().

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

Definition at line 44 of file SiStripDigiToRawModule.h.

Referenced by DigiToRawModule(), and produce().