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

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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
 

Detailed Description

Definition at line 19 of file SiStripClusterToDigiProducer.cc.

Member Typedef Documentation

Definition at line 20 of file SiStripClusterToDigiProducer.cc.

Definition at line 22 of file SiStripClusterToDigiProducer.cc.

Definition at line 21 of file SiStripClusterToDigiProducer.cc.

Definition at line 25 of file SiStripClusterToDigiProducer.cc.

Definition at line 26 of file SiStripClusterToDigiProducer.cc.

Definition at line 24 of file SiStripClusterToDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 45 of file SiStripClusterToDigiProducer.cc.

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

45  {
46  token = consumes<ClusterCollection>(conf.getParameter<edm::InputTag>("ClusterProducer"));
47 
48  produces<DigiCollection>("ZeroSuppressed");
49  produces<DigiCollection>("VirginRaw");
50  produces<DigiCollection>("ProcessedRaw");
51  produces<DigiCollection>("ScopeMode");
52 }
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 114 of file SiStripClusterToDigiProducer.cc.

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

Referenced by gain(), and process().

114  {
115  if (adc > 255)
116  throw cms::Exception("Invalid Charge") << " digi at strip " << strip << " has ADC out of range " << adc;
117  if (adc > 253)
118  return adc; //saturated, do not scale
119  uint16_t charge = static_cast<uint16_t>(
120  adc * gain(strip) +
121  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
122  return (charge > 1022 ? 255 : (charge > 253 ? 254 : charge));
123 }
float gain(const uint16_t &strip) const
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
float SiStripClusterToDigiProducer::gain ( const uint16_t &  strip) const
inlineprivate

Definition at line 36 of file SiStripClusterToDigiProducer.cc.

References ecalMGPA::adc(), applyGain(), gainHandle, gainRange, SiStripGain::getStripGain(), and digitizers_cfi::strip.

Referenced by applyGain().

edm::ESHandle< SiStripGain > gainHandle
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
void SiStripClusterToDigiProducer::initialize ( const edm::EventSetup es)
private

Definition at line 100 of file SiStripClusterToDigiProducer.cc.

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

Referenced by produce().

100  {
101  uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();
102 
103  if (g_cache_id != gain_cache_id) {
104  es.get<SiStripGainRcd>().get(gainHandle);
105  gain_cache_id = g_cache_id;
106  }
107 }
edm::ESHandle< SiStripGain > gainHandle
T get() const
Definition: EventSetup.h:73
void SiStripClusterToDigiProducer::process ( const ClusterCollection input,
std::vector< DetDigiCollection > &  output_base 
)
private

Definition at line 75 of file SiStripClusterToDigiProducer.cc.

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

Referenced by produce().

76  {
77  for (ClusterCollection::const_iterator it = input.begin(); it != input.end(); ++it) {
78  uint32_t detid = it->detId();
79 
80  setDetId(detid);
81  DetDigiCollection detDigis(detid);
82 
83  DetClusIter clus(it->begin()), endclus(it->end());
84  for (; clus != endclus; clus++) {
85  size_t istrip = 0;
86  size_t width = clus->amplitudes().size();
87  size_t firstStrip = clus->firstStrip();
88  uint16_t stripPos = firstStrip;
89  for (; istrip < width; ++istrip) {
90  detDigis.data.push_back(SiStripDigi(stripPos, applyGain(stripPos, clus->amplitudes()[istrip])));
91  stripPos++;
92  }
93  }
94 
95  if (!detDigis.empty())
96  output_base.push_back(detDigis);
97  }
98 }
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
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
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 54 of file SiStripClusterToDigiProducer.cc.

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

54  {
55  initialize(es);
56 
57  std::vector<DetDigiCollection> output_base;
59  event.getByToken(token, input);
60 
61  if (input.isValid())
62  process(*input, output_base);
63 
64  auto outputZS = std::make_unique<DigiCollection>(output_base);
65  auto outputVR = std::make_unique<DigiCollection>();
66  auto outputPR = std::make_unique<DigiCollection>();
67  auto outputSM = std::make_unique<DigiCollection>();
68 
69  event.put(std::move(outputZS), "ZeroSuppressed");
70  event.put(std::move(outputVR), "VirginRaw");
71  event.put(std::move(outputPR), "ProcessedRaw");
72  event.put(std::move(outputSM), "ScopeMode");
73 }
static std::string const input
Definition: EdmProvDump.cc:48
void initialize(const edm::EventSetup &es)
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< ClusterCollection > token
void process(const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
def move(src, dest)
Definition: eostools.py:511
void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id)
inlineprivate

Definition at line 109 of file SiStripClusterToDigiProducer.cc.

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

Referenced by process().

109  {
111  detId = id;
112 }
edm::ESHandle< SiStripGain > gainHandle
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71

Member Data Documentation

uint32_t SiStripClusterToDigiProducer::detId
private

Definition at line 42 of file SiStripClusterToDigiProducer.cc.

Referenced by setDetId().

uint32_t SiStripClusterToDigiProducer::gain_cache_id
private

Definition at line 42 of file SiStripClusterToDigiProducer.cc.

Referenced by initialize().

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

Definition at line 41 of file SiStripClusterToDigiProducer.cc.

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

SiStripApvGain::Range SiStripClusterToDigiProducer::gainRange
private

Definition at line 40 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), and setDetId().

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

Definition at line 39 of file SiStripClusterToDigiProducer.cc.

Referenced by produce(), and SiStripClusterToDigiProducer().