CMS 3D CMS Logo

ShallowDigisProducer.cc
Go to the documentation of this file.
2 
12 
14  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")) {
15  produces<std::vector<unsigned> >("id");
16  produces<std::vector<unsigned> >("subdet");
17  produces<std::vector<unsigned> >("strip");
18  produces<std::vector<unsigned> >("adc");
19  produces<std::vector<float> >("noise");
20 }
21 
23  e.put(std::move(p.id), "id");
24  e.put(std::move(p.subdet), "subdet");
25  e.put(std::move(p.strip), "strip");
26  e.put(std::move(p.adc), "adc");
27  e.put(std::move(p.noise), "noise");
28 }
29 
30 template <class T>
32  for (auto const& set : digiCollection) {
33  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(set.detId());
34  for (auto const& digi : set) {
35  p.id->push_back(set.detId());
36  p.subdet->push_back((set.detId() >> 25) & 0x7);
37  p.strip->push_back(digi.strip());
38  p.adc->push_back(digi.adc());
39  p.noise->push_back(noiseHandle->getNoise(digi.strip(), detNoiseRange));
40  }
41  }
42 }
43 
45  products p;
48  es.get<SiStripNoisesRcd>().get(noiseHandle);
49  if (findInput(inputOld, e))
50  recordDigis(*inputOld, p);
51  else if (findInput(inputNew, e))
52  recordDigis(*inputNew, p);
53  else
54  edm::LogWarning("Input Not Found");
55  insert(p, e);
56 }
57 
58 template <class T>
60  for (auto const& inputTag : inputTags) {
61  e.getByLabel(inputTag, handle);
62  if (handle.isValid() && !handle->empty()) {
63  LogDebug("Input") << inputTag;
64  return true;
65  }
66  }
67  return false;
68 }
#define LogDebug(id)
edm::ESHandle< SiStripNoises > noiseHandle
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::unique_ptr< std::vector< float > > noise
std::vector< edm::InputTag > inputTags
std::unique_ptr< std::vector< unsigned > > strip
void insert(products &, edm::Event &)
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:71
ShallowDigisProducer(const edm::ParameterSet &)
void recordDigis(const T &, products &)
std::unique_ptr< std::vector< unsigned > > id
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
std::unique_ptr< std::vector< unsigned > > adc
inputTags
All input tags are specified in this pset for convenience.
bool findInput(edm::Handle< T > &, const edm::Event &)
HLT enums.
const Range getRange(const uint32_t detID) const
T get() const
Definition: EventSetup.h:73
void produce(edm::Event &, const edm::EventSetup &) override
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
long double T
std::unique_ptr< std::vector< unsigned > > subdet
def move(src, dest)
Definition: eostools.py:511