CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ShallowDigisProducer.cc
Go to the documentation of this file.
2 
12 #include "boost/foreach.hpp"
13 
15  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList"))
16 {
17  produces<std::vector<unsigned> >("id");
18  produces<std::vector<unsigned> >("subdet");
19  produces<std::vector<unsigned> >("strip");
20  produces<std::vector<unsigned> >("adc");
21  produces<std::vector<float> >("noise");
22 }
23 
26  e.put(std::move(p.id), "id");
27  e.put(std::move(p.subdet), "subdet");
28  e.put(std::move(p.strip), "strip");
29  e.put(std::move(p.adc), "adc");
30  e.put(std::move(p.noise), "noise");
31 }
32 
33 template<class T>
34 inline
37  BOOST_FOREACH(const typename T::value_type set, digiCollection) {
38  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(set.detId());
39  BOOST_FOREACH(const SiStripDigi digi, set) {
40  p.id->push_back(set.detId());
41  p.subdet->push_back((set.detId()>>25)&0x7);
42  p.strip->push_back(digi.strip());
43  p.adc->push_back(digi.adc());
44  p.noise->push_back(noiseHandle->getNoise( digi.strip(), detNoiseRange));
45  }
46  }
47 }
48 
51  products p;
54  es.get<SiStripNoisesRcd>().get(noiseHandle);
55  if( findInput(inputOld, e) ) recordDigis(*inputOld, p); else
56  if( findInput(inputNew, e) ) recordDigis(*inputNew, p); else
57  edm::LogWarning("Input Not Found");
58  insert(p,e);
59 }
60 
61 template<class T>
62 inline
65  BOOST_FOREACH( const edm::InputTag inputTag, inputTags) {
66  e.getByLabel(inputTag, handle);
67  if( handle.isValid() && !handle->empty() ) {
68  LogDebug("Input") << inputTag;
69  return true;
70  }
71  }
72  return false;
73 }
#define LogDebug(id)
edm::ESHandle< SiStripNoises > noiseHandle
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::unique_ptr< std::vector< float > > noise
std::vector< edm::InputTag > inputTags
std::unique_ptr< std::vector< unsigned > > strip
void insert(products &, edm::Event &)
ShallowDigisProducer(const edm::ParameterSet &)
void recordDigis(const T &, products &)
const uint16_t & strip() const
Definition: SiStripDigi.h:40
def move
Definition: eostools.py:510
std::unique_ptr< std::vector< unsigned > > id
tuple handle
Definition: patZpeak.py:22
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
std::unique_ptr< std::vector< unsigned > > adc
const T & get() const
Definition: EventSetup.h:56
bool findInput(edm::Handle< T > &, const edm::Event &)
void produce(edm::Event &, const edm::EventSetup &)
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:48
const uint16_t & adc() const
Definition: SiStripDigi.h:41
long double T
std::unique_ptr< std::vector< unsigned > > subdet