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::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 
 SiStripClusterToDigiProducer (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 19 of file SiStripClusterToDigiProducer.cc.

Member Typedef Documentation

Definition at line 21 of file SiStripClusterToDigiProducer.cc.

Definition at line 23 of file SiStripClusterToDigiProducer.cc.

Definition at line 22 of file SiStripClusterToDigiProducer.cc.

Definition at line 27 of file SiStripClusterToDigiProducer.cc.

Definition at line 28 of file SiStripClusterToDigiProducer.cc.

Definition at line 26 of file SiStripClusterToDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 53 of file SiStripClusterToDigiProducer.cc.

54  : _inputTag( conf.getParameter<edm::InputTag>("ClusterProducer") ){
55 
56  produces< DigiCollection > ("ZeroSuppressed");
57  produces< DigiCollection > ("VirginRaw" );
58  produces< DigiCollection > ("ProcessedRaw" );
59  produces< DigiCollection > ("ScopeMode" );
60 
61 }
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 134 of file SiStripClusterToDigiProducer.cc.

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

Referenced by process().

134  {
135 
136  if(adc > 255) throw cms::Exception("Invalid Charge") << " digi at strip " << strip << " has ADC out of range " << adc;
137  if(adc > 253) return adc; //saturated, do not scale
138  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
139  return ( charge > 1022 ? 255 :
140  ( charge > 253 ? 254 : charge ));
141 }
int adc(sample_type sample)
get the ADC sample (12 bits)
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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 41 of file SiStripClusterToDigiProducer.cc.

References gainHandle, and gainRange.

Referenced by applyGain().

41 { return gainHandle->getStripGain( strip, gainRange ); }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
edm::ESHandle< SiStripGain > gainHandle
void SiStripClusterToDigiProducer::initialize ( const edm::EventSetup es)
private

Definition at line 115 of file SiStripClusterToDigiProducer.cc.

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

Referenced by produce().

115  {
116  uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();
117 
118  if(g_cache_id != gain_cache_id) {
119  es.get<SiStripGainRcd>().get( gainHandle );
120  gain_cache_id = g_cache_id;
121  }
122 }
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 88 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 tablePrinter::width.

Referenced by ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), and produce().

88  {
89 
90  for(ClusterCollection::const_iterator it = input.begin(); it!=input.end(); ++it) {
91 
92  uint32_t detid=it->detId();
93 
94  setDetId(detid);
95  DetDigiCollection detDigis(detid);
96 
97  DetClusIter clus(it->begin()), endclus(it->end());
98  for(;clus!=endclus;clus++){
99  size_t istrip = 0;
100  size_t width = clus->amplitudes().size();
101  size_t firstStrip = clus->firstStrip();
102  uint16_t stripPos=firstStrip;
103  for(;istrip<width;++istrip){
104  detDigis.data.push_back( SiStripDigi( stripPos, applyGain(stripPos,clus->amplitudes()[istrip]) ) );
105  stripPos++;
106  }
107  }
108 
109  if (detDigis.size())
110  output_base.push_back(detDigis);
111  }
112 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
uint16_t applyGain(const uint16_t &strip, const uint16_t &adc)
edm::DetSet< SiStripDigi > DetDigiCollection
const_iterator end() const
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
void SiStripClusterToDigiProducer::produce ( edm::Event event,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 64 of file SiStripClusterToDigiProducer.cc.

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

64  {
65 
66  initialize(es);
67 
68  std::vector<DetDigiCollection> output_base;
70  event.getByLabel(_inputTag,input);
71 
72  if(input.isValid())
73  process(*input, output_base);
74 
75 
76  std::auto_ptr< DigiCollection > outputZS(new DigiCollection(output_base) );
77  std::auto_ptr< DigiCollection > outputVR(new DigiCollection() );
78  std::auto_ptr< DigiCollection > outputPR(new DigiCollection() );
79  std::auto_ptr< DigiCollection > outputSM(new DigiCollection() );
80 
81  event.put( outputZS, "ZeroSuppressed");
82  event.put( outputVR, "VirginRaw" );
83  event.put( outputPR, "ProcessedRaw" );
84  event.put( outputSM, "ScopeMode" );
85 }
edm::DetSetVector< SiStripDigi > DigiCollection
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

Member Data Documentation

const edm::InputTag SiStripClusterToDigiProducer::_inputTag
private

Definition at line 44 of file SiStripClusterToDigiProducer.cc.

Referenced by produce().

uint32_t SiStripClusterToDigiProducer::detId
private

Definition at line 47 of file SiStripClusterToDigiProducer.cc.

Referenced by setDetId().

uint32_t SiStripClusterToDigiProducer::gain_cache_id
private

Definition at line 47 of file SiStripClusterToDigiProducer.cc.

Referenced by initialize().

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

Definition at line 46 of file SiStripClusterToDigiProducer.cc.

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

SiStripApvGain::Range SiStripClusterToDigiProducer::gainRange
private

Definition at line 45 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), and setDetId().