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
 
 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< 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 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, SiStripGainRcdgainToken_
 
edm::ESWatcher< SiStripGainRcdgainWatcher_
 
edm::EDGetTokenT< ClusterCollectiontoken
 

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

◆ ClusterCollection

Definition at line 20 of file SiStripClusterToDigiProducer.cc.

◆ DetClusIter

Definition at line 22 of file SiStripClusterToDigiProducer.cc.

◆ DetClusterCollection

Definition at line 21 of file SiStripClusterToDigiProducer.cc.

◆ DetDigiCollection

Definition at line 25 of file SiStripClusterToDigiProducer.cc.

◆ DetDigiIter

Definition at line 26 of file SiStripClusterToDigiProducer.cc.

◆ DigiCollection

Definition at line 24 of file SiStripClusterToDigiProducer.cc.

Constructor & Destructor Documentation

◆ SiStripClusterToDigiProducer()

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

Definition at line 46 of file SiStripClusterToDigiProducer.cc.

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 }

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

Member Function Documentation

◆ applyGain()

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

Definition at line 109 of file SiStripClusterToDigiProducer.cc.

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 }

References gpuClustering::adc, ALCARECOTkAlJpsiMuMu_cff::charge, Exception, gain(), and digitizers_cfi::strip.

Referenced by process().

◆ gain()

float SiStripClusterToDigiProducer::gain ( const uint16_t &  strip) const
inlineprivate

Definition at line 35 of file SiStripClusterToDigiProducer.cc.

35 { return gain_->getStripGain(strip, gainRange); }

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

Referenced by applyGain().

◆ process()

void SiStripClusterToDigiProducer::process ( const ClusterCollection input,
std::vector< DetDigiCollection > &  output_base 
)
private

Definition at line 79 of file SiStripClusterToDigiProducer.cc.

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 }

References applyGain(), edm::DetSet< T >::data, edm::DetSet< T >::empty(), input, setDetId(), and ApeEstimator_cff::width.

Referenced by produce().

◆ produce()

void SiStripClusterToDigiProducer::produce ( edm::Event event,
const edm::EventSetup es 
)
override

Definition at line 56 of file SiStripClusterToDigiProducer.cc.

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 }

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

◆ setDetId()

void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id)
inlineprivate

Definition at line 104 of file SiStripClusterToDigiProducer.cc.

104  {
105  gainRange = gain_->getRange(id);
106  detId = id;
107 }

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

Referenced by process().

Member Data Documentation

◆ detId

uint32_t SiStripClusterToDigiProducer::detId
private

Definition at line 43 of file SiStripClusterToDigiProducer.cc.

Referenced by setDetId().

◆ gain_

const SiStripGain* SiStripClusterToDigiProducer::gain_
private

Definition at line 42 of file SiStripClusterToDigiProducer.cc.

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

◆ gainRange

SiStripApvGain::Range SiStripClusterToDigiProducer::gainRange
private

Definition at line 39 of file SiStripClusterToDigiProducer.cc.

Referenced by gain(), and setDetId().

◆ gainToken_

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

Definition at line 40 of file SiStripClusterToDigiProducer.cc.

Referenced by produce(), and SiStripClusterToDigiProducer().

◆ gainWatcher_

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

Definition at line 41 of file SiStripClusterToDigiProducer.cc.

Referenced by produce().

◆ token

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

Definition at line 38 of file SiStripClusterToDigiProducer.cc.

Referenced by produce(), and SiStripClusterToDigiProducer().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
SiStripClusterToDigiProducer::gain_
const SiStripGain * gain_
Definition: SiStripClusterToDigiProducer.cc:42
input
static const std::string input
Definition: EdmProvDump.cc:48
SiStripClusterToDigiProducer::gainWatcher_
edm::ESWatcher< SiStripGainRcd > gainWatcher_
Definition: SiStripClusterToDigiProducer.cc:41
SiStripClusterToDigiProducer::process
void process(const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
Definition: SiStripClusterToDigiProducer.cc:79
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
edm::Handle
Definition: AssociativeIterator.h:50
SiStripGain::getStripGain
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75
SiStripClusterToDigiProducer::DetClusIter
edmNew::DetSet< SiStripCluster >::const_iterator DetClusIter
Definition: SiStripClusterToDigiProducer.cc:22
SiStripClusterToDigiProducer::gainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Definition: SiStripClusterToDigiProducer.cc:40
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
SiStripClusterToDigiProducer::gain
float gain(const uint16_t &strip) const
Definition: SiStripClusterToDigiProducer.cc:35
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripClusterToDigiProducer::DetDigiCollection
edm::DetSet< SiStripDigi > DetDigiCollection
Definition: SiStripClusterToDigiProducer.cc:25
SiStripClusterToDigiProducer::detId
uint32_t detId
Definition: SiStripClusterToDigiProducer.cc:43
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiStripClusterToDigiProducer::token
edm::EDGetTokenT< ClusterCollection > token
Definition: SiStripClusterToDigiProducer.cc:38
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
SiStripClusterToDigiProducer::gainRange
SiStripApvGain::Range gainRange
Definition: SiStripClusterToDigiProducer.cc:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripClusterToDigiProducer::setDetId
void setDetId(const uint32_t id)
Definition: SiStripClusterToDigiProducer.cc:104
SiStripDigi
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
SiStripClusterToDigiProducer::applyGain
uint16_t applyGain(const uint16_t &strip, const uint16_t &adc)
Definition: SiStripClusterToDigiProducer.cc:109
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::InputTag
Definition: InputTag.h:15