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 Types | Private Member Functions | Private Attributes
SiStripClusterToDigiProducer Class Reference
Inheritance diagram for SiStripClusterToDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 SiStripClusterToDigiProducer (const edm::ParameterSet &conf)
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edmNew::DetSetVector
< SiStripCluster
ClusterCollection
 
typedef edmNew::DetSet
< SiStripCluster >
::const_iterator 
DetClusIter
 
typedef edmNew::DetSet
< SiStripCluster
DetClusterCollection
 
typedef edm::DetSet< SiStripDigiDetDigiCollection
 
typedef edm::DetSet
< SiStripDigi >
::const_iterator 
DetDigiIter
 
typedef edm::DetSetVector
< SiStripDigi
DigiCollection
 

Private Member Functions

uint16_t applyGain (const uint16_t &strip, const uint16_t &adc)
 
float gain (const uint16_t &strip) const
 
void initialize (const edm::EventSetup &es)
 
void process (const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
 
void setDetId (const uint32_t id)
 

Private Attributes

const edm::InputTag _inputTag
 
uint32_t detId
 
uint32_t gain_cache_id
 
edm::ESHandle< SiStripGaingainHandle
 
SiStripApvGain::Range gainRange
 

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

Definition at line 20 of file SiStripClusterToDigiProducer.cc.

Member Typedef Documentation

Definition at line 22 of file SiStripClusterToDigiProducer.cc.

Definition at line 24 of file SiStripClusterToDigiProducer.cc.

Definition at line 23 of file SiStripClusterToDigiProducer.cc.

Definition at line 28 of file SiStripClusterToDigiProducer.cc.

Definition at line 29 of file SiStripClusterToDigiProducer.cc.

Definition at line 27 of file SiStripClusterToDigiProducer.cc.

Constructor & Destructor Documentation

SiStripClusterToDigiProducer::SiStripClusterToDigiProducer ( const edm::ParameterSet conf)
explicit

Definition at line 54 of file SiStripClusterToDigiProducer.cc.

55  : _inputTag( conf.getParameter<edm::InputTag>("ClusterProducer") ){
56 
57  produces< DigiCollection > ("ZeroSuppressed");
58  produces< DigiCollection > ("VirginRaw" );
59  produces< DigiCollection > ("ProcessedRaw" );
60  produces< DigiCollection > ("ScopeMode" );
61 
62 }
T getParameter(std::string const &) const

Member Function Documentation

uint16_t SiStripClusterToDigiProducer::applyGain ( const uint16_t &  strip,
const uint16_t &  adc 
)
inlineprivate

Definition at line 135 of file SiStripClusterToDigiProducer.cc.

References ecalMGPA::adc(), DeDxDiscriminatorTools::charge(), edm::hlt::Exception, and gain().

Referenced by process().

135  {
136 
137  if(adc > 255) throw cms::Exception("Invalid Charge") << " digi at strip " << strip << " has ADC out of range " << adc;
138  if(adc > 253) return adc; //saturated, do not scale
139  uint16_t charge = static_cast<uint16_t>( adc*gain(strip) + 0.5 ); //NB: here we revert the gain applied at the clusterizer level. for this reason the adc counts are multiplied by gain and not divided
140  return ( charge > 1022 ? 255 :
141  ( charge > 253 ? 254 : charge ));
142 }
int adc(sample_type sample)
get the ADC sample (12 bits)
double charge(const std::vector< uint8_t > &Ampls)
float gain(const uint16_t &strip) const
float SiStripClusterToDigiProducer::gain ( const uint16_t &  strip) const
inlineprivate

Definition at line 42 of file SiStripClusterToDigiProducer.cc.

References gainHandle, and gainRange.

Referenced by applyGain().

42 { return gainHandle->getStripGain( strip, gainRange ); }
edm::ESHandle< SiStripGain > gainHandle
void SiStripClusterToDigiProducer::initialize ( const edm::EventSetup es)
private

Definition at line 116 of file SiStripClusterToDigiProducer.cc.

References gain_cache_id, gainHandle, and edm::EventSetup::get().

Referenced by produce().

116  {
117  uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();
118 
119  if(g_cache_id != gain_cache_id) {
120  es.get<SiStripGainRcd>().get( gainHandle );
121  gain_cache_id = g_cache_id;
122  }
123 }
edm::ESHandle< SiStripGain > gainHandle
const T & get() const
Definition: EventSetup.h:55
void SiStripClusterToDigiProducer::process ( const ClusterCollection input,
std::vector< DetDigiCollection > &  output_base 
)
private

Definition at line 89 of file SiStripClusterToDigiProducer.cc.

References applyGain(), edmNew::DetSetVector< T >::begin(), edm::DetSet< T >::data, cond::rpcobgas::detid, edmNew::DetSetVector< T >::end(), setDetId(), edm::DetSet< T >::size(), and create_public_lumi_plots::width.

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), produce(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

89  {
90 
91  for(ClusterCollection::const_iterator it = input.begin(); it!=input.end(); ++it) {
92 
93  uint32_t detid=it->detId();
94 
95  setDetId(detid);
96  DetDigiCollection detDigis(detid);
97 
98  DetClusIter clus(it->begin()), endclus(it->end());
99  for(;clus!=endclus;clus++){
100  size_t istrip = 0;
101  size_t width = clus->amplitudes().size();
102  size_t firstStrip = clus->firstStrip();
103  uint16_t stripPos=firstStrip;
104  for(;istrip<width;++istrip){
105  detDigis.data.push_back( SiStripDigi( stripPos, applyGain(stripPos,clus->amplitudes()[istrip]) ) );
106  stripPos++;
107  }
108  }
109 
110  if (detDigis.size())
111  output_base.push_back(detDigis);
112  }
113 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
uint16_t applyGain(const uint16_t &strip, const uint16_t &adc)
edm::DetSet< SiStripDigi > DetDigiCollection
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
edmNew::DetSet< SiStripCluster >::const_iterator DetClusIter
const_iterator end(bool update=true) const
const_iterator begin(bool update=true) const
void SiStripClusterToDigiProducer::produce ( edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 65 of file SiStripClusterToDigiProducer.cc.

References _inputTag, initialize(), input, edm::HandleBase::isValid(), and process().

65  {
66 
67  initialize(es);
68 
69  std::vector<DetDigiCollection> output_base;
71  event.getByLabel(_inputTag,input);
72 
73  if(input.isValid())
74  process(*input, output_base);
75 
76 
77  std::auto_ptr< DigiCollection > outputZS(new DigiCollection(output_base) );
78  std::auto_ptr< DigiCollection > outputVR(new DigiCollection() );
79  std::auto_ptr< DigiCollection > outputPR(new DigiCollection() );
80  std::auto_ptr< DigiCollection > outputSM(new DigiCollection() );
81 
82  event.put( outputZS, "ZeroSuppressed");
83  event.put( outputVR, "VirginRaw" );
84  event.put( outputPR, "ProcessedRaw" );
85  event.put( outputSM, "ScopeMode" );
86 }
edm::DetSetVector< SiStripDigi > DigiCollection
static std::string const input
Definition: EdmProvDump.cc:44
void initialize(const edm::EventSetup &es)
bool isValid() const
Definition: HandleBase.h:76
void process(const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id)
inlineprivate

Definition at line 128 of file SiStripClusterToDigiProducer.cc.

References detId, gainHandle, and gainRange.

Referenced by process().

128  {
129  gainRange = gainHandle->getRange(id);
130  detId = id;
131 }
edm::ESHandle< SiStripGain > gainHandle

Member Data Documentation

const edm::InputTag SiStripClusterToDigiProducer::_inputTag
private

Definition at line 45 of file SiStripClusterToDigiProducer.cc.

Referenced by produce().

uint32_t SiStripClusterToDigiProducer::detId
private

Definition at line 48 of file SiStripClusterToDigiProducer.cc.

Referenced by setDetId().

uint32_t SiStripClusterToDigiProducer::gain_cache_id
private

Definition at line 48 of file SiStripClusterToDigiProducer.cc.

Referenced by initialize().

edm::ESHandle<SiStripGain> SiStripClusterToDigiProducer::gainHandle
private

Definition at line 47 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), initialize(), and setDetId().

SiStripApvGain::Range SiStripClusterToDigiProducer::gainRange
private

Definition at line 46 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), and setDetId().