CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripMeanCMExtractor Class Reference

#include <RecoLocalTracker/SiStripMeanCMExtractor/src/SiStripMeanCMExtractor.cc>

Inheritance diagram for SiStripMeanCMExtractor:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 SiStripMeanCMExtractor (const edm::ParameterSet &)
 
 ~SiStripMeanCMExtractor ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
void CMExtractorFromPedestals (const edm::DetSetVector< SiStripRawDigi > &, std::vector< edm::DetSet< SiStripProcessedRawDigi > > &)
 
void ConvertMeanMapToDetSetVector (std::vector< edm::DetSet< SiStripProcessedRawDigi > > &)
 
virtual void endJob ()
 
void init (const edm::EventSetup &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
void StoreMean (const edm::DetSetVector< SiStripProcessedRawDigi > &)
 

Private Attributes

uint16_t _actualEvent
 
std::string _Algorithm
 
CMMap _CMMap
 
edm::InputTag _inputTag
 
uint16_t _nEventsToUse
 
uint32_t pedestal_cache_id_
 
edm::ESHandle< SiStripPedestalspedestalHandle_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 54 of file SiStripMeanCMExtractor.cc.

Constructor & Destructor Documentation

SiStripMeanCMExtractor::SiStripMeanCMExtractor ( const edm::ParameterSet conf)
explicit

Definition at line 81 of file SiStripMeanCMExtractor.cc.

References _nEventsToUse.

81  :
82  _inputTag(conf.getParameter<edm::InputTag> ("CMCollection")),
83  _Algorithm(conf.getParameter<std::string>("Algorithm")),
84  _nEventsToUse(conf.getParameter<uint32_t>("NEvents"))
85 {
86 
87 
88  if(_nEventsToUse < 1) _nEventsToUse=1;
89  produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("MEANAPVCM");
90 }
T getParameter(std::string const &) const
SiStripMeanCMExtractor::~SiStripMeanCMExtractor ( )

Definition at line 93 of file SiStripMeanCMExtractor.cc.

94 {
95 
96 }

Member Function Documentation

void SiStripMeanCMExtractor::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 212 of file SiStripMeanCMExtractor.cc.

References _actualEvent, and _CMMap.

213 {
214  _actualEvent =1;
215 
216  _CMMap.clear();
217 
218 }
void SiStripMeanCMExtractor::CMExtractorFromPedestals ( const edm::DetSetVector< SiStripRawDigi > &  input,
std::vector< edm::DetSet< SiStripProcessedRawDigi > > &  meancm 
)
private

Definition at line 145 of file SiStripMeanCMExtractor.cc.

References sistrip::APV, edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), pedestalHandle_, edm::DetSet< T >::push_back(), and strip().

Referenced by produce().

145  {
146  meancm.clear();
147  meancm.reserve(15000);
148 
150  rawDigis = input.begin(); rawDigis != input.end(); rawDigis++) {
151  SiStripPedestals::Range detPedestalRange = pedestalHandle_->getRange(rawDigis->id);
152  edm::DetSet<SiStripProcessedRawDigi> MeanCMDetSet(rawDigis->id);
153 
154  for(uint16_t APV = 0; APV < rawDigis->size()/128; ++APV){
155  uint16_t MinPed =0;
156  for(uint16_t strip = APV*128; strip< (APV+1)*128; ++strip){
157  uint16_t ped = (uint16_t)pedestalHandle_->getPed(strip,detPedestalRange);
158  if(ped < MinPed) MinPed = ped;
159  }
160  if(MinPed>128) MinPed=128;
161  MeanCMDetSet.push_back(MinPed);
162  }
163 
164  meancm.push_back(MeanCMDetSet);
165  }
166 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::pair< ContainerIterator, ContainerIterator > Range
edm::ESHandle< SiStripPedestals > pedestalHandle_
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void SiStripMeanCMExtractor::ConvertMeanMapToDetSetVector ( std::vector< edm::DetSet< SiStripProcessedRawDigi > > &  meancm)
private

Definition at line 197 of file SiStripMeanCMExtractor.cc.

References _actualEvent, _CMMap, end, and edm::DetSet< T >::push_back().

Referenced by produce().

197  {
198  CMMap::iterator itMap;
199  std::vector<float>::const_iterator itMapVector;
200 
201  meancm.clear();
202  meancm.reserve(15000);
203 
204  for(itMap = _CMMap.begin(); itMap != _CMMap.end(); ++itMap){
205  edm::DetSet<SiStripProcessedRawDigi> MeanCMDetSet(itMap->first);
206  for(itMapVector = (itMap->second).begin(); itMapVector != (itMap->second).end(); ++itMapVector) MeanCMDetSet.push_back(*itMapVector/(float)_actualEvent);
207  meancm.push_back(MeanCMDetSet);
208  }
209 
210 }
#define end
Definition: vmac.h:38
void SiStripMeanCMExtractor::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 221 of file SiStripMeanCMExtractor.cc.

221  {
222 
223 
224 }
void SiStripMeanCMExtractor::init ( const edm::EventSetup es)
private

Definition at line 98 of file SiStripMeanCMExtractor.cc.

References edm::EventSetup::get(), pedestal_cache_id_, and pedestalHandle_.

Referenced by produce().

98  {
99 
100  uint32_t p_cache_id = es.get<SiStripPedestalsRcd>().cacheIdentifier();
101 
102  if(p_cache_id != pedestal_cache_id_) {
104  pedestal_cache_id_ = p_cache_id;
105  }
106 }
edm::ESHandle< SiStripPedestals > pedestalHandle_
const T & get() const
Definition: EventSetup.h:55
void SiStripMeanCMExtractor::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 110 of file SiStripMeanCMExtractor.cc.

References _actualEvent, _Algorithm, _inputTag, CMExtractorFromPedestals(), ConvertMeanMapToDetSetVector(), edm::Event::getByLabel(), init(), LaserDQM_cfg::input, edm::Event::put(), and StoreMean().

111 {
112  using namespace edm;
113 
114 
115  //if(_actualEvent > _nEventsToUse) return;
116 
117  std::vector<edm::DetSet<SiStripProcessedRawDigi> > meancm;
118 
119  if(_Algorithm == "StoredCM"){
121  iEvent.getByLabel(_inputTag,inputCM);
122 
123  this->StoreMean(*inputCM);
124  this->ConvertMeanMapToDetSetVector(meancm);
125 
126  } else if (_Algorithm == "Pedestals"){
127  this->init(iSetup);
128 
130  iEvent.getByLabel(_inputTag,input);
131 
132  this->CMExtractorFromPedestals(*input,meancm);
133  }
134 
135  ++_actualEvent;
136 
137 
138 
139 
140  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputMeanCM(new edm::DetSetVector<SiStripProcessedRawDigi>(meancm) );
141  iEvent.put( outputMeanCM,"MEANAPVCM");
142 
143 }
void ConvertMeanMapToDetSetVector(std::vector< edm::DetSet< SiStripProcessedRawDigi > > &)
void init(const edm::EventSetup &)
void StoreMean(const edm::DetSetVector< SiStripProcessedRawDigi > &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void CMExtractorFromPedestals(const edm::DetSetVector< SiStripRawDigi > &, std::vector< edm::DetSet< SiStripProcessedRawDigi > > &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void SiStripMeanCMExtractor::StoreMean ( const edm::DetSetVector< SiStripProcessedRawDigi > &  Input)
private

Definition at line 168 of file SiStripMeanCMExtractor.cc.

References _CMMap, edm::DetSetVector< T >::begin(), and edm::DetSetVector< T >::end().

Referenced by produce().

168  {
169 
170  uint32_t detId;
171  CMMap::iterator itMap;
173 
174  for(itInput = Input.begin(); itInput != Input.end(); ++itInput){
175  detId = itInput->id;
176  itMap = _CMMap.find(detId);
178  std::vector<float> MeanCMNValue;
179  MeanCMNValue.clear();
180  if(itMap!=_CMMap.end()){ //the detId was already found
181  std::vector< float >& MapContent = itMap->second;
182  std::vector<float>::iterator itMapVector = MapContent.begin();
183  for(itCM = itInput->begin(); itCM != itInput->end(); ++itCM, ++itMapVector){
184  MeanCMNValue.push_back(itCM->adc() + *itMapVector);
185  }
186  _CMMap.erase(itMap);
187  _CMMap.insert(itMap, std::pair<uint32_t, std::vector<float> >(detId,MeanCMNValue));
188  } else { //no detId found
189  for(itCM = itInput->begin(); itCM != itInput->end(); ++itCM) MeanCMNValue.push_back(itCM->adc());
190  _CMMap.insert(std::pair<uint32_t, std::vector<float> >(detId,MeanCMNValue));
191  }
192  }
193 
194 }
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106

Member Data Documentation

uint16_t SiStripMeanCMExtractor::_actualEvent
private

Definition at line 75 of file SiStripMeanCMExtractor.cc.

Referenced by beginJob(), ConvertMeanMapToDetSetVector(), and produce().

std::string SiStripMeanCMExtractor::_Algorithm
private

Definition at line 73 of file SiStripMeanCMExtractor.cc.

Referenced by produce().

CMMap SiStripMeanCMExtractor::_CMMap
private

Definition at line 77 of file SiStripMeanCMExtractor.cc.

Referenced by beginJob(), ConvertMeanMapToDetSetVector(), and StoreMean().

edm::InputTag SiStripMeanCMExtractor::_inputTag
private

Definition at line 72 of file SiStripMeanCMExtractor.cc.

Referenced by produce().

uint16_t SiStripMeanCMExtractor::_nEventsToUse
private

Definition at line 74 of file SiStripMeanCMExtractor.cc.

Referenced by SiStripMeanCMExtractor().

uint32_t SiStripMeanCMExtractor::pedestal_cache_id_
private

Definition at line 67 of file SiStripMeanCMExtractor.cc.

Referenced by init().

edm::ESHandle<SiStripPedestals> SiStripMeanCMExtractor::pedestalHandle_
private

Definition at line 66 of file SiStripMeanCMExtractor.cc.

Referenced by CMExtractorFromPedestals(), and init().