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(p.id, "id");
27  e.put(p.subdet, "subdet");
28  e.put(p.strip, "strip");
29  e.put(p.adc, "adc");
30  e.put(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
std::vector< edm::InputTag > inputTags
std::auto_ptr< std::vector< unsigned > > adc
void insert(products &, edm::Event &)
std::auto_ptr< std::vector< unsigned > > subdet
ShallowDigisProducer(const edm::ParameterSet &)
void recordDigis(const T &, products &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
const uint16_t & strip() const
Definition: SiStripDigi.h:40
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
std::auto_ptr< std::vector< float > > noise
bool isValid() const
Definition: HandleBase.h:76
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
tuple conf
Definition: dbtoconf.py:185
const T & get() const
Definition: EventSetup.h:55
bool findInput(edm::Handle< T > &, const edm::Event &)
std::auto_ptr< std::vector< unsigned > > id
void produce(edm::Event &, const edm::EventSetup &)
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:41
const uint16_t & adc() const
Definition: SiStripDigi.h:41
long double T
std::auto_ptr< std::vector< unsigned > > strip