CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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 process (const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
 
void setDetId (const uint32_t id)
 

Private Attributes

uint32_t detId
 
const SiStripGaingain_
 
SiStripApvGain::Range gainRange
 
edm::ESGetToken< SiStripGain,
SiStripGainRcd
gainToken_
 
edm::ESWatcher< SiStripGainRcdgainWatcher_
 
edm::EDGetTokenT
< ClusterCollection
token
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 46 of file SiStripClusterToDigiProducer.cc.

References DeDxTools::esConsumes(), gainToken_, edm::ParameterSet::getParameter(), and token.

46  {
47  token = consumes<ClusterCollection>(conf.getParameter<edm::InputTag>("ClusterProducer"));
49 
50  produces<DigiCollection>("ZeroSuppressed");
51  produces<DigiCollection>("VirginRaw");
52  produces<DigiCollection>("ProcessedRaw");
53  produces<DigiCollection>("ScopeMode");
54 }
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
edm::EDGetTokenT< ClusterCollection > token
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283

Member Function Documentation

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

Definition at line 109 of file SiStripClusterToDigiProducer.cc.

References gpuClustering::adc, RecoTauCleanerPlugins::charge, Exception, and gain().

Referenced by process().

109  {
110  if (adc > 255)
111  throw cms::Exception("Invalid Charge") << " digi at strip " << strip << " has ADC out of range " << adc;
112  if (adc > 253)
113  return adc; //saturated, do not scale
114  uint16_t charge = static_cast<uint16_t>(
115  adc * gain(strip) +
116  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
117  return (charge > 1022 ? 255 : (charge > 253 ? 254 : charge));
118 }
float gain(const uint16_t &strip) const
uint16_t *__restrict__ uint16_t const *__restrict__ adc
float SiStripClusterToDigiProducer::gain ( const uint16_t &  strip) const
inlineprivate

Definition at line 35 of file SiStripClusterToDigiProducer.cc.

References gain_, gainRange, and SiStripGain::getStripGain().

Referenced by applyGain().

35 { return gain_->getStripGain(strip, gainRange); }
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
void SiStripClusterToDigiProducer::process ( const ClusterCollection input,
std::vector< DetDigiCollection > &  output_base 
)
private

Definition at line 79 of file SiStripClusterToDigiProducer.cc.

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

Referenced by produce().

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

References edm::ESWatcher< T >::check(), gain_, gainToken_, gainWatcher_, edm::EventSetup::getData(), input, edm::HandleBase::isValid(), eostools::move(), process(), and token.

56  {
57  if (gainWatcher_.check(es)) {
58  gain_ = &es.getData(gainToken_);
59  }
60 
61  std::vector<DetDigiCollection> output_base;
63  event.getByToken(token, input);
64 
65  if (input.isValid())
66  process(*input, output_base);
67 
68  auto outputZS = std::make_unique<DigiCollection>(output_base);
69  auto outputVR = std::make_unique<DigiCollection>();
70  auto outputPR = std::make_unique<DigiCollection>();
71  auto outputSM = std::make_unique<DigiCollection>();
72 
73  event.put(std::move(outputZS), "ZeroSuppressed");
74  event.put(std::move(outputVR), "VirginRaw");
75  event.put(std::move(outputPR), "ProcessedRaw");
76  event.put(std::move(outputSM), "ScopeMode");
77 }
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
edm::ESWatcher< SiStripGainRcd > gainWatcher_
static std::string const input
Definition: EdmProvDump.cc:47
bool getData(T &iHolder) const
Definition: EventSetup.h:128
def move
Definition: eostools.py:511
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< ClusterCollection > token
void process(const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id)
inlineprivate

Definition at line 104 of file SiStripClusterToDigiProducer.cc.

References detId, gain_, gainRange, SiStripGain::getRange(), and gpuClustering::id.

Referenced by process().

104  {
105  gainRange = gain_->getRange(id);
106  detId = id;
107 }
uint16_t *__restrict__ id
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75

Member Data Documentation

uint32_t SiStripClusterToDigiProducer::detId
private

Definition at line 43 of file SiStripClusterToDigiProducer.cc.

Referenced by setDetId().

const SiStripGain* SiStripClusterToDigiProducer::gain_
private

Definition at line 42 of file SiStripClusterToDigiProducer.cc.

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

SiStripApvGain::Range SiStripClusterToDigiProducer::gainRange
private

Definition at line 39 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), and setDetId().

edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripClusterToDigiProducer::gainToken_
private

Definition at line 40 of file SiStripClusterToDigiProducer.cc.

Referenced by produce(), and SiStripClusterToDigiProducer().

edm::ESWatcher<SiStripGainRcd> SiStripClusterToDigiProducer::gainWatcher_
private

Definition at line 41 of file SiStripClusterToDigiProducer.cc.

Referenced by produce().

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

Definition at line 38 of file SiStripClusterToDigiProducer.cc.

Referenced by produce(), and SiStripClusterToDigiProducer().