CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
ShallowDigisProducer Class Reference

#include <ShallowDigisProducer.h>

Inheritance diagram for ShallowDigisProducer:
edm::stream::EDProducer<>

Classes

struct  products
 

Public Member Functions

 ShallowDigisProducer (const edm::ParameterSet &)
 
- 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 Member Functions

template<class T >
bool findInput (edm::Handle< T > &, const edm::Event &)
 
void insert (products &, edm::Event &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
template<class T >
void recordDigis (const T &, products &, const SiStripNoises &noises)
 

Private Attributes

std::vector< edm::InputTaginputTags
 
edm::ESGetToken< SiStripNoises, SiStripNoisesRcdnoisesToken_
 

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 10 of file ShallowDigisProducer.h.

Constructor & Destructor Documentation

◆ ShallowDigisProducer()

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

Definition at line 11 of file ShallowDigisProducer.cc.

12  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")), noisesToken_(esConsumes()) {
13  produces<std::vector<unsigned> >("id");
14  produces<std::vector<unsigned> >("subdet");
15  produces<std::vector<unsigned> >("strip");
16  produces<std::vector<unsigned> >("adc");
17  produces<std::vector<float> >("noise");
18 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< edm::InputTag > inputTags
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noisesToken_

Member Function Documentation

◆ findInput()

template<class T >
bool ShallowDigisProducer::findInput ( edm::Handle< T > &  handle,
const edm::Event e 
)
inlineprivate

Definition at line 57 of file ShallowDigisProducer.cc.

References MillePedeFileConverter_cfg::e, patZpeak::handle, SimL1EmulatorRepack_Full_cff::inputTag, inputTags, and LogDebug.

Referenced by produce().

57  {
58  for (auto const& inputTag : inputTags) {
59  e.getByLabel(inputTag, handle);
60  if (handle.isValid() && !handle->empty()) {
61  LogDebug("Input") << inputTag;
62  return true;
63  }
64  }
65  return false;
66 }
std::vector< edm::InputTag > inputTags
#define LogDebug(id)

◆ insert()

void ShallowDigisProducer::insert ( products p,
edm::Event e 
)
private

Definition at line 20 of file ShallowDigisProducer.cc.

References MillePedeFileConverter_cfg::e, eostools::move(), and AlCaHLTBitMon_ParallelJobs::p.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly(), and produce().

20  {
21  e.put(std::move(p.id), "id");
22  e.put(std::move(p.subdet), "subdet");
23  e.put(std::move(p.strip), "strip");
24  e.put(std::move(p.adc), "adc");
25  e.put(std::move(p.noise), "noise");
26 }
def move(src, dest)
Definition: eostools.py:511

◆ produce()

void ShallowDigisProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
overrideprivate

Definition at line 42 of file ShallowDigisProducer.cc.

References MillePedeFileConverter_cfg::e, findInput(), edm::EventSetup::getData(), insert(), hgcalLayerClusters_cfi::noises, noisesToken_, AlCaHLTBitMon_ParallelJobs::p, and recordDigis().

42  {
43  products p;
46  const auto& noises = es.getData(noisesToken_);
47  if (findInput(inputOld, e))
48  recordDigis(*inputOld, p, noises);
49  else if (findInput(inputNew, e))
50  recordDigis(*inputNew, p, noises);
51  else
52  edm::LogWarning("Input Not Found");
53  insert(p, e);
54 }
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&... args)
Definition: ESProducts.h:128
void insert(products &, edm::Event &)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
bool findInput(edm::Handle< T > &, const edm::Event &)
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noisesToken_
void recordDigis(const T &, products &, const SiStripNoises &noises)
Log< level::Warning, false > LogWarning

◆ recordDigis()

template<class T >
void ShallowDigisProducer::recordDigis ( const T digiCollection,
products p,
const SiStripNoises noises 
)
inlineprivate

Definition at line 29 of file ShallowDigisProducer.cc.

References apvshotsanalyzer_cfi::digiCollection, hgcalLayerClusters_cfi::noises, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by produce().

29  {
30  for (auto const& set : digiCollection) {
31  SiStripNoises::Range detNoiseRange = noises.getRange(set.detId());
32  for (auto const& digi : set) {
33  p.id->push_back(set.detId());
34  p.subdet->push_back((set.detId() >> 25) & 0x7);
35  p.strip->push_back(digi.strip());
36  p.adc->push_back(digi.adc());
37  p.noise->push_back(noises.getNoise(digi.strip(), detNoiseRange));
38  }
39  }
40 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47

Member Data Documentation

◆ inputTags

std::vector<edm::InputTag> ShallowDigisProducer::inputTags
private

Definition at line 28 of file ShallowDigisProducer.h.

Referenced by findInput().

◆ noisesToken_

edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> ShallowDigisProducer::noisesToken_
private

Definition at line 29 of file ShallowDigisProducer.h.

Referenced by produce().