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.

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 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
edm::EDGetTokenT< ClusterCollection > 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.

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

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

◆ gain()

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

Definition at line 35 of file SiStripClusterToDigiProducer.cc.

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

Referenced by applyGain().

35 { return gain_->getStripGain(strip, gainRange); }
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77

◆ process()

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

Definition at line 79 of file SiStripClusterToDigiProducer.cc.

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

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 }
uint16_t applyGain(const uint16_t &strip, const uint16_t &adc)
static std::string const input
Definition: EdmProvDump.cc:50
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

◆ produce()

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, 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 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
edm::ESWatcher< SiStripGainRcd > gainWatcher_
static std::string const input
Definition: EdmProvDump.cc:50
edm::EDGetTokenT< ClusterCollection > token
void process(const ClusterCollection &input, std::vector< DetDigiCollection > &output_base)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
def move(src, dest)
Definition: eostools.py:511

◆ setDetId()

void SiStripClusterToDigiProducer::setDetId ( const uint32_t  id)
inlineprivate

Definition at line 104 of file SiStripClusterToDigiProducer.cc.

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

Referenced by process().

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

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