CMS 3D CMS Logo

SiStripProcessedRawDigiProducer.cc
Go to the documentation of this file.
2 
8 
11 
15 
16 #include "boost/bind.hpp"
17 
18 #include <functional>
19 
21  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
22  inputTokensDigi(edm::vector_transform(
23  inputTags, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripDigi> >(tag); })),
24  inputTokensRawDigi(edm::vector_transform(
25  inputTags, [this](edm::InputTag const& tag) { return consumes<edm::DetSetVector<SiStripRawDigi> >(tag); })),
28  produces<edm::DetSetVector<SiStripProcessedRawDigi> >("");
29 }
30 
32  std::unique_ptr<edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
35 
37  subtractorPed->init(es);
38  subtractorCMN->init(es);
39 
40  std::string label = findInput(inputRawdigis, inputTokensRawDigi, e);
41  if ("VirginRaw" == label)
42  vr_process(*inputRawdigis, *output);
43  else if ("ProcessedRaw" == label)
44  pr_process(*inputRawdigis, *output);
45  else if ("ZeroSuppressed" == findInput(inputDigis, inputTokensDigi, e))
47  else
48  edm::LogError("Input Not Found");
49 
50  e.put(std::move(output));
51 }
52 
53 template <class T>
55  const std::vector<edm::EDGetTokenT<T> >& tokens,
56  const edm::Event& e) {
57  for (typename std::vector<edm::EDGetTokenT<T> >::const_iterator token = tokens.begin(); token != tokens.end();
58  ++token) {
59  unsigned index(token - tokens.begin());
60  e.getByToken(*token, handle);
61  if (handle.isValid() && !handle->empty()) {
62  edm::LogInfo("Input") << inputTags.at(index);
63  return inputTags.at(index).instance();
64  }
65  }
66  return "Input Not Found";
67 }
68 
71  std::vector<float> digis;
72  for (edm::DetSetVector<SiStripDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
73  digis.clear();
74  for (edm::DetSet<SiStripDigi>::const_iterator digi = detset->begin(); digi != detset->end(); ++digi) {
75  digis.resize(digi->strip(), 0);
76  digis.push_back(digi->adc());
77  }
78  common_process(detset->id, digis, output);
79  }
80 }
81 
84  for (edm::DetSetVector<SiStripRawDigi>::const_iterator detset = input.begin(); detset != input.end(); ++detset) {
85  std::vector<float> digis;
86  transform(detset->begin(), detset->end(), back_inserter(digis), boost::bind(&SiStripRawDigi::adc, _1));
87  subtractorCMN->subtract(detset->id, 0, digis);
88  common_process(detset->id, digis, output);
89  }
90 }
91 
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);
100  }
101 }
102 
104  std::vector<float>& digis,
106  //Apply Gains
107  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
108  for (std::vector<float>::iterator it = digis.begin(); it < digis.end(); ++it)
109  (*it) /= (gainHandle->getStripGain(it - digis.begin(), detGainRange));
110 
111  //Insert as DetSet
113  copy(digis.begin(), digis.end(), back_inserter(ds.data));
114  output.insert(ds);
115 }
SiStripRawProcessingFactory::create_SubtractorPed
static std::unique_ptr< SiStripPedestalsSubtractor > create_SubtractorPed(const edm::ParameterSet &)
Definition: SiStripRawProcessingFactory.cc:23
edm::DetSetVector
Definition: DetSetVector.h:61
SiStripGainRcd
Definition: SiStripDependentRecords.h:29
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
SiStripProcessedRawDigiProducer::vr_process
void vr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
Definition: SiStripProcessedRawDigiProducer.cc:92
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
SiStripGain.h
edm::DetSet
Definition: DetSet.h:23
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
SiStripRawDigi.h
edm::LogInfo
Definition: MessageLogger.h:254
SiStripGainRcd.h
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
SiStripProcessedRawDigiProducer::zs_process
void zs_process(const edm::DetSetVector< SiStripDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
Definition: SiStripProcessedRawDigiProducer.cc:69
SiStripGain::getStripGain
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
SiStripProcessedRawDigiProducer::inputTokensDigi
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > > inputTokensDigi
Definition: SiStripProcessedRawDigiProducer.h:37
SiStripProcessedRawDigiProducer::inputTags
std::vector< edm::InputTag > inputTags
Definition: SiStripProcessedRawDigiProducer.h:36
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripProcessedRawDigi.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
SiStripRawDigi::adc
uint16_t adc() const
Definition: SiStripRawDigi.h:22
SiStripDigi.h
HLTMuonOfflineAnalyzer_cfi.inputTags
inputTags
All input tags are specified in this pset for convenience.
Definition: HLTMuonOfflineAnalyzer_cfi.py:82
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
SiStripProcessedRawDigiProducer::subtractorPed
std::unique_ptr< SiStripPedestalsSubtractor > subtractorPed
Definition: SiStripProcessedRawDigiProducer.h:41
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:31
SiStripProcessedRawDigiProducer::inputTokensRawDigi
std::vector< edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > > inputTokensRawDigi
Definition: SiStripProcessedRawDigiProducer.h:38
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
Event.h
SiStripProcessedRawDigiProducer::subtractorCMN
std::unique_ptr< SiStripCommonModeNoiseSubtractor > subtractorCMN
Definition: SiStripProcessedRawDigiProducer.h:42
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
SiStripProcessedRawDigiProducer.h
edm::EventSetup
Definition: EventSetup.h:57
SiStripProcessedRawDigiProducer::pr_process
void pr_process(const edm::DetSetVector< SiStripRawDigi > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
Definition: SiStripProcessedRawDigiProducer.cc:82
SiStripProcessedRawDigiProducer::gainHandle
edm::ESHandle< SiStripGain > gainHandle
Definition: SiStripProcessedRawDigiProducer.h:39
get
#define get
SiStripRawProcessingFactory::create_SubtractorCMN
static std::unique_ptr< SiStripCommonModeNoiseSubtractor > create_SubtractorCMN(const edm::ParameterSet &)
Definition: SiStripRawProcessingFactory.cc:29
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
SiStripProcessedRawDigiProducer::common_process
void common_process(const uint32_t, std::vector< float > &, edm::DetSetVector< SiStripProcessedRawDigi > &)
Definition: SiStripProcessedRawDigiProducer.cc:103
ParameterSet.h
edm::Event
Definition: Event.h:73
SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer
SiStripProcessedRawDigiProducer(edm::ParameterSet const &)
Definition: SiStripProcessedRawDigiProducer.cc:20
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:54
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31