CMS 3D CMS Logo

SiStripProcessedRawDigiProducer.cc
Go to the documentation of this file.
2 
8 
12 
13 #include <functional>
14 
16  : inputTags_(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
17  inputTokensDigi_(edm::vector_transform(
18  inputTags_, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripDigi> >(tag); })),
19  inputTokensRawDigi_(edm::vector_transform(
20  inputTags_, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripRawDigi> >(tag); })),
21  gainToken_(esConsumes()),
22  subtractorPed_(SiStripRawProcessingFactory::create_SubtractorPed(conf, consumesCollector())),
23  subtractorCMN_(SiStripRawProcessingFactory::create_SubtractorCMN(conf, consumesCollector())) {
24  produces<edm::DetSetVector<SiStripProcessedRawDigi> >("");
25 }
26 
28  std::unique_ptr<edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
31 
32  const auto& gain = es.getData(gainToken_);
33  subtractorPed_->init(es);
34  subtractorCMN_->init(es);
35 
36  std::string label = findInput(inputRawdigis, inputTokensRawDigi_, e);
37  if ("VirginRaw" == label)
38  vr_process(*inputRawdigis, *output, gain);
39  else if ("ProcessedRaw" == label)
40  pr_process(*inputRawdigis, *output, gain);
41  else if ("ZeroSuppressed" == findInput(inputDigis, inputTokensDigi_, e))
43  else
44  edm::LogError("Input Not Found");
45 
46  e.put(std::move(output));
47 }
48 
49 template <class T>
51  const std::vector<edm::EDGetTokenT<T> >& tokens,
52  const edm::Event& e) {
53  for (typename std::vector<edm::EDGetTokenT<T> >::const_iterator token = tokens.begin(); token != tokens.end();
54  ++token) {
55  unsigned index(token - tokens.begin());
56  e.getByToken(*token, handle);
57  if (handle.isValid() && !handle->empty()) {
58  edm::LogInfo("Input") << inputTags_.at(index);
59  return inputTags_.at(index).instance();
60  }
61  }
62  return "Input Not Found";
63 }
64 
67  const SiStripGain& gain) {
68  std::vector<float> digis;
69  for (edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
70  digis.clear();
71  for (edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) {
72  digis.resize(digi->strip(), 0);
73  digis.push_back(digi->adc());
74  }
75  common_process(detset->id, digis, output, gain);
76  }
77 }
78 
81  const SiStripGain& gain) {
82  for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
83  std::vector<float> digis;
84  transform(
85  detset->begin(), detset->end(), back_inserter(digis), std::bind(&SiStripRawDigi::adc, std::placeholders::_1));
86  subtractorCMN_->subtract(detset->id, 0, digis);
87  common_process(detset->id, digis, output, gain);
88  }
89 }
90 
93  const SiStripGain& gain) {
94  for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
95  std::vector<int16_t> int_digis(detset->size());
96  subtractorPed_->subtract(*detset, int_digis);
97  std::vector<float> digis(int_digis.begin(), int_digis.end());
98  subtractorCMN_->subtract(detset->id, 0, digis);
99  common_process(detset->id, digis, output, gain);
100  }
101 }
102 
104  std::vector<float>& digis,
106  const SiStripGain& gain) {
107  //Apply Gains
108  SiStripApvGain::Range detGainRange = gain.getRange(detId);
109  for (std::vector<float>::iterator it = digis.begin(); it < digis.end(); ++it)
110  (*it) /= (gain.getStripGain(it - digis.begin(), detGainRange));
111 
112  //Insert as DetSet
114  copy(digis.begin(), digis.end(), back_inserter(ds.data));
115  output.insert(ds);
116 }
edm::DetSetVector
Definition: DetSetVector.h:61
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
SiStripProcessedRawDigiProducer::inputTokensDigi_
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi_
Definition: SiStripProcessedRawDigiProducer.h:47
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
edm::DetSet
Definition: DetSet.h:23
SiStripGain
Definition: SiStripGain.h:44
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
patZpeak.handle
handle
Definition: patZpeak.py:23
SiStripProcessedRawDigiProducer::subtractorCMN_
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN_
Definition: SiStripProcessedRawDigiProducer.h:52
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripRawDigi.h
SiStripProcessedRawDigiProducer::subtractorPed_
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed_
Definition: SiStripProcessedRawDigiProducer.h:51
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
SiStripProcessedRawDigiProducer::zs_process
void zs_process(const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
Definition: SiStripProcessedRawDigiProducer.cc:65
SiStripProcessedRawDigiProducer::inputTags_
std::vector< edm::InputTag > inputTags_
Definition: SiStripProcessedRawDigiProducer.h:46
SiStripProcessedRawDigiProducer::pr_process
void pr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
Definition: SiStripProcessedRawDigiProducer.cc:79
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripProcessedRawDigiProducer::common_process
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
Definition: SiStripProcessedRawDigiProducer.cc:103
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
SiStripProcessedRawDigi.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
SiStripProcessedRawDigiProducer::vr_process
void vr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &, const SiStripGain &)
Definition: SiStripProcessedRawDigiProducer.cc:91
SiStripRawDigi::adc
uint16_t adc() const
Definition: SiStripRawDigi.h:22
SiStripDigi.h
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
SiStripProcessedRawDigiProducer::produce
void produce(edm::Event &e, const edm::EventSetup &es) override
Definition: SiStripProcessedRawDigiProducer.cc:27
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
SiStripRawProcessingFactory::create_SubtractorCMN
static std::unique_ptr< SiStripCommonModeNoiseSubtractor > create_SubtractorCMN(const edm::ParameterSet &, edm::ConsumesCollector)
Definition: SiStripRawProcessingFactory.cc:34
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
SiStripProcessedRawDigiProducer.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:57
SiStripProcessedRawDigiProducer::inputTokensRawDigi_
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi_
Definition: SiStripProcessedRawDigiProducer.h:48
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiStripProcessedRawDigiProducer::gainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > gainToken_
Definition: SiStripProcessedRawDigiProducer.h:49
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
transform.h
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
CommPDSkim_cfg.inputDigis
inputDigis
Definition: CommPDSkim_cfg.py:68
edm::DetSet::data
collection_type data
Definition: DetSet.h:80
EventSetup.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiStripRawProcessingFactory::create_SubtractorPed
static std::unique_ptr< SiStripPedestalsSubtractor > create_SubtractorPed(const edm::ParameterSet &, edm::ConsumesCollector)
Definition: SiStripRawProcessingFactory.cc:28
ParameterSet.h
edm::Event
Definition: Event.h:73
SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer
SiStripProcessedRawDigiProducer(edm::ParameterSet const &)
Definition: SiStripProcessedRawDigiProducer.cc:15
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
SiStripProcessedRawDigiProducer::findInput
std::string findInput(edm::Handle< T > &handle, const std::vector< edm::EDGetTokenT< T > > &tokens, const edm::Event &e)
Definition: SiStripProcessedRawDigiProducer.cc:50
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31