CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiStripClusterToDigiProducer Class Reference
Inheritance diagram for SiStripClusterToDigiProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase 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::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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef edmNew::DetSetVector< SiStripClusterClusterCollection
 
typedef edmNew::DetSet< SiStripCluster >::const_iterator DetClusIter
 
typedef edmNew::DetSet< SiStripClusterDetClusterCollection
 
typedef edm::DetSet< SiStripDigiDetDigiCollection
 
typedef edm::DetSet< SiStripDigi >::const_iterator DetDigiIter
 
typedef edm::DetSetVector< SiStripDigiDigiCollection
 

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

uint32_t detId
 
uint32_t gain_cache_id
 
edm::ESHandle< SiStripGaingainHandle
 
SiStripApvGain::Range gainRange
 
edm::EDGetTokenT< ClusterCollectiontoken
 

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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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 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.

References edm::ParameterSet::getParameter(), produce(), and token.

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

Member Function Documentation

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

Definition at line 137 of file SiStripClusterToDigiProducer.cc.

References ecalMGPA::adc(), ALCARECOTkAlJpsiMuMu_cff::charge, DEFINE_FWK_MODULE, Exception, and gain().

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

137  {
138 
139  if(adc > 255) throw cms::Exception("Invalid Charge") << " digi at strip " << strip << " has ADC out of range " << adc;
140  if(adc > 253) return adc; //saturated, do not scale
141  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
142  return ( charge > 1022 ? 255 :
143  ( charge > 253 ? 254 : charge ));
144 }
int adc(sample_type sample)
get the ADC sample (12 bits)
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 ecalMGPA::adc(), applyGain(), gainHandle, gainRange, SiStripGain::getStripGain(), and digi_MixPreMix_cfi::strip.

Referenced by applyGain().

42 { return gainHandle->getStripGain( strip, gainRange ); }
edm::ESHandle< SiStripGain > gainHandle
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
void SiStripClusterToDigiProducer::initialize ( const edm::EventSetup es)
private

Definition at line 118 of file SiStripClusterToDigiProducer.cc.

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

Referenced by process(), and produce().

118  {
119  uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();
120 
121  if(g_cache_id != gain_cache_id) {
122  es.get<SiStripGainRcd>().get( gainHandle );
123  gain_cache_id = g_cache_id;
124  }
125 }
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 91 of file SiStripClusterToDigiProducer.cc.

References applyGain(), edmNew::DetSetVector< T >::begin(), edm::DetSet< T >::data, edm::DetSet< T >::empty(), edmNew::DetSetVector< T >::end(), initialize(), setDetId(), and ApeEstimator_cff::width.

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

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

Definition at line 67 of file SiStripClusterToDigiProducer.cc.

References initialize(), input, edm::HandleBase::isValid(), eostools::move(), process(), and token.

Referenced by SiStripClusterToDigiProducer().

67  {
68 
69  initialize(es);
70 
71  std::vector<DetDigiCollection> output_base;
73  event.getByToken(token,input);
74 
75  if(input.isValid())
76  process(*input, output_base);
77 
78 
79  auto outputZS = std::make_unique<DigiCollection>(output_base);
80  auto outputVR = std::make_unique<DigiCollection>();
81  auto outputPR = std::make_unique<DigiCollection>();
82  auto outputSM = std::make_unique<DigiCollection>();
83 
84  event.put(std::move(outputZS), "ZeroSuppressed");
85  event.put(std::move(outputVR), "VirginRaw" );
86  event.put(std::move(outputPR), "ProcessedRaw" );
87  event.put(std::move(outputSM), "ScopeMode" );
88 }
static std::string const input
Definition: EdmProvDump.cc:44
void initialize(const edm::EventSetup &es)
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< ClusterCollection > token
void process(const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
def move(src, dest)
Definition: eostools.py:510
void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id)
inlineprivate

Definition at line 130 of file SiStripClusterToDigiProducer.cc.

References applyGain(), detId, gainHandle, gainRange, SiStripGain::getRange(), and triggerObjects_cff::id.

Referenced by initialize(), and process().

130  {
131  gainRange = gainHandle->getRange(id);
132  detId = id;
133 }
edm::ESHandle< SiStripGain > gainHandle
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70

Member Data Documentation

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().

edm::EDGetTokenT<ClusterCollection> SiStripClusterToDigiProducer::token
private

Definition at line 45 of file SiStripClusterToDigiProducer.cc.

Referenced by produce(), and SiStripClusterToDigiProducer().