CMS 3D CMS Logo

ShallowDigisProducer.cc
Go to the documentation of this file.
1 #include "ShallowDigisProducer.h"
2 
10 
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 }
19 
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 }
27 
28 template <class T>
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 }
41 
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 }
55 
56 template <class T>
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 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::vector< edm::InputTag > inputTags
void insert(products &, edm::Event &)
ShallowDigisProducer(const edm::ParameterSet &)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
inputTags
All input tags are specified in this pset for convenience.
bool findInput(edm::Handle< T > &, const edm::Event &)
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noisesToken_
HLT enums.
void recordDigis(const T &, products &, const SiStripNoises &noises)
void produce(edm::Event &, const edm::EventSetup &) override
Log< level::Warning, false > LogWarning
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
long double T
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)