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 Types | Private Member Functions | Private Attributes
SiStripZeroSuppression Class Reference

#include <SiStripZeroSuppression.h>

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

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 SiStripZeroSuppression (const edm::ParameterSet &)
 
- 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 Types

typedef std::vector
< edm::InputTag >
::const_iterator 
tag_iterator_t
 

Private Member Functions

void CollectionMergedZeroSuppression (edm::Event &)
 
void processRaw (const edm::InputTag &, const edm::DetSetVector< SiStripRawDigi > &, std::vector< edm::DetSet< SiStripDigi > > &, std::vector< edm::DetSet< SiStripRawDigi > > &)
 
void StandardZeroSuppression (edm::Event &)
 
void storeBaseline (uint32_t, const std::vector< std::pair< short, float > > &, std::map< uint16_t, std::vector< int16_t > > &)
 
void storeBaselinePoints (uint32_t, std::vector< std::map< uint16_t, int16_t > > &)
 
void storeCMN (uint32_t, const std::vector< std::pair< short, float > > &)
 

Private Attributes

std::auto_ptr
< SiStripRawProcessingAlgorithms
algorithms
 
bool doAPVRestore
 
bool fixCM
 
std::vector< edm::InputTaginputTags
 
bool mergeCollections
 
std::vector< edm::DetSet
< SiStripProcessedRawDigi > > 
output_apvcm
 
std::vector< edm::DetSet
< SiStripProcessedRawDigi > > 
output_baseline
 
std::vector< edm::DetSet
< SiStripDigi > > 
output_baseline_points
 
bool produceBaselinePoints
 
bool produceCalculatedBaseline
 
bool produceRawDigis
 
bool storeCM
 
bool storeInZScollBadAPV
 
bool useCMMeanMap
 

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)
 
- 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

Definition at line 16 of file SiStripZeroSuppression.h.

Member Typedef Documentation

typedef std::vector<edm::InputTag>::const_iterator SiStripZeroSuppression::tag_iterator_t
private

Definition at line 34 of file SiStripZeroSuppression.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file SiStripZeroSuppression.cc.

References doAPVRestore, fixCM, edm::ParameterSet::getParameter(), inputTags, mergeCollections, produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, storeCM, storeInZScollBadAPV, and useCMMeanMap.

15  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("RawDigiProducersList")),
17  storeCM(conf.getParameter<bool>("storeCM")),
18  doAPVRestore(conf.getParameter<bool>("doAPVRestore")),
19  mergeCollections(conf.getParameter<bool>("mergeCollections"))
20 
21 {
22 
23  if(doAPVRestore){
24  produceRawDigis = conf.getParameter<bool>("produceRawDigis");
25  produceCalculatedBaseline = conf.getParameter<bool>("produceCalculatedBaseline");
26  produceBaselinePoints = conf.getParameter<bool>("produceBaselinePoints");
27  storeInZScollBadAPV = conf.getParameter<bool>("storeInZScollBadAPV");
28  useCMMeanMap = conf.getParameter<bool>("useCMMeanMap");
29  fixCM = conf.getParameter<bool>("fixCM");
30  } else {
31  produceRawDigis = false;
33  produceBaselinePoints = false;
34  storeInZScollBadAPV = false;
35  useCMMeanMap = false;
36  fixCM = false;
37  }
38 
39  if(mergeCollections){
40  storeCM = false;
41  produceRawDigis = false;
42  }
43 
44  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ){
45  produces< edm::DetSetVector<SiStripDigi> > (inputTag->instance());
46  if(produceRawDigis)
47  produces< edm::DetSetVector<SiStripRawDigi> > (inputTag->instance());
48  }
49 
51  produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("BADAPVBASELINE");
52 
54  produces< edm::DetSetVector<SiStripDigi> > ("BADAPVBASELINEPOINTS");
55 
56  if(storeCM)
57  produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("APVCM");
58 
59 
60 }
std::vector< edm::InputTag > inputTags
T getParameter(std::string const &) const
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
static std::auto_ptr< SiStripRawProcessingAlgorithms > create(const edm::ParameterSet &)
std::vector< edm::InputTag >::const_iterator tag_iterator_t

Member Function Documentation

void SiStripZeroSuppression::CollectionMergedZeroSuppression ( edm::Event e)
inlineprivate

Definition at line 119 of file SiStripZeroSuppression.cc.

References edm::Event::getByLabel(), inputTags, convertSQLitetoXML_cfg::output, processRaw(), and edm::Event::put().

Referenced by produce().

119  {
120 
121  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {
122 
125  e.getByLabel(*inputTag,inputdigi);
126  e.getByLabel(*inputTag,inputraw);
127 
128  std::vector<edm::DetSet<SiStripDigi> > outputdigi;
129  std::vector<edm::DetSet<SiStripRawDigi> > outputraw;
130 
131  if (inputraw->size())
132  processRaw(*inputTag, *inputraw, outputdigi, outputraw );
133 
134 
135  for ( std::vector<edm::DetSet<SiStripDigi> >::const_iterator itinputdigi = inputdigi->begin(); itinputdigi !=inputdigi->end(); ++itinputdigi) {
136  outputdigi.push_back(*itinputdigi);
137  }
138 
139  std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(outputdigi) );
140  e.put( output, inputTag->instance() );
141 
142  }
143 
144 }
std::vector< edm::InputTag > inputTags
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
void processRaw(const edm::InputTag &, const edm::DetSetVector< SiStripRawDigi > &, std::vector< edm::DetSet< SiStripDigi > > &, std::vector< edm::DetSet< SiStripRawDigi > > &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
std::vector< edm::InputTag >::const_iterator tag_iterator_t
void SiStripZeroSuppression::processRaw ( const edm::InputTag inputTag,
const edm::DetSetVector< SiStripRawDigi > &  input,
std::vector< edm::DetSet< SiStripDigi > > &  output,
std::vector< edm::DetSet< SiStripRawDigi > > &  outputraw 
)
inlineprivate

Definition at line 148 of file SiStripZeroSuppression.cc.

References SiStripRawDigi::adc(), algorithms, edm::DetSetVector< T >::begin(), doAPVRestore, edm::DetSetVector< T >::end(), edm::hlt::Exception, edm::InputTag::instance(), convertSQLitetoXML_cfg::output, output_apvcm, output_baseline, output_baseline_points, produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, edm::DetSet< T >::size(), storeBaseline(), storeCM, storeCMN(), and storeInZScollBadAPV.

Referenced by CollectionMergedZeroSuppression(), and StandardZeroSuppression().

148  {
149 
150  if(storeCM){
151  output_apvcm.clear();
152  output_apvcm.reserve(16000);
153  }
154 
156  output_baseline.clear();
157  output_baseline.reserve(16000);
158  }
159 
161  output_baseline_points.clear();
162  output_baseline_points.reserve(16000);
163  }
164 
165  output.reserve(10000);
166  outputraw.reserve(10000);
168  rawDigis = input.begin(); rawDigis != input.end(); ++rawDigis) {
169 
170  edm::DetSet<SiStripDigi> suppressedDigis(rawDigis->id);
171 
172  int16_t nAPVflagged = 0;
173 
174  if ( "ProcessedRaw" == inputTag.instance()) {
175  std::vector<int16_t> processedRawDigis, processedRawDigisCopy ;
176  transform(rawDigis->begin(), rawDigis->end(), back_inserter(processedRawDigis), boost::bind(&SiStripRawDigi::adc , _1));
177  if( doAPVRestore ){
178  processedRawDigisCopy.assign(processedRawDigis.begin(), processedRawDigis.end());
179  }
180  algorithms->subtractorCMN->subtract( rawDigis->id, processedRawDigis);
181  if( doAPVRestore ){
182  nAPVflagged = algorithms->restorer->inspect( rawDigis->id, processedRawDigisCopy, algorithms->subtractorCMN->getAPVsCM() );
183  algorithms->restorer->restore( processedRawDigis );
184  }
185  algorithms->suppressor->suppress( processedRawDigis, suppressedDigis );
186 
187  const std::vector< std::pair<short,float> >& vmedians= algorithms->subtractorCMN->getAPVsCM();
188  if(storeCM) this->storeCMN(rawDigis->id, vmedians);
189  if(produceCalculatedBaseline&& nAPVflagged > 0){
190  std::map< uint16_t, std::vector < int16_t> >& baselinemap = algorithms->restorer->GetBaselineMap();
191  this->storeBaseline(rawDigis->id, vmedians, baselinemap);
192  }
193  // if(produceBaselinePoints&& nAPVflagged > 0){
194  // std::vector< std::map< uint16_t, int16_t> >& baselinpoints = algorithms->restorer->GetSmoothedPoints();
195  // this->storeBaselinePoints(rawDigis->id, baselinpoints);
196  // }
197  } else if ( "VirginRaw" == inputTag.instance()) {
198  std::vector<int16_t> processedRawDigis(rawDigis->size()), processedRawDigisCopy;
199  algorithms->subtractorPed->subtract( *rawDigis, processedRawDigis);
200  if( doAPVRestore ){
201  processedRawDigisCopy.assign(processedRawDigis.begin(), processedRawDigis.end());
202  }
203  algorithms->subtractorCMN->subtract( rawDigis->id, processedRawDigis);
204  if( doAPVRestore ){
205  nAPVflagged = algorithms->restorer->inspect( rawDigis->id, processedRawDigisCopy, algorithms->subtractorCMN->getAPVsCM() );
206  algorithms->restorer->restore( processedRawDigis );
207  }
208  algorithms->suppressor->suppress( processedRawDigis, suppressedDigis );
209 
210  const std::vector< std::pair<short,float> >& vmedians = algorithms->subtractorCMN->getAPVsCM();
211  if(storeCM) this->storeCMN(rawDigis->id, vmedians);
212  if(produceCalculatedBaseline&& nAPVflagged > 0){
213  std::map< uint16_t, std::vector < int16_t> >& baselinemap = algorithms->restorer->GetBaselineMap();
214  this->storeBaseline(rawDigis->id, vmedians, baselinemap);
215  }
216  // if(produceBaselinePoints&& nAPVflagged > 0){
217  // std::vector< std::map< uint16_t, int16_t> >& baselinpoints = algorithms->restorer->GetSmoothedPoints();
218  // this->storeBaselinePoints(rawDigis->id, baselinpoints);
219  // }
220 
221  } else
222 
223  throw cms::Exception("Unknown input type")
224  << inputTag.instance() << " unknown. SiStripZeroZuppression can only process types \"VirginRaw\" and \"ProcessedRaw\" ";
225 
226  if (suppressedDigis.size() && (storeInZScollBadAPV || nAPVflagged ==0))
227  output.push_back(suppressedDigis);
228 
229  if (produceRawDigis && nAPVflagged > 0)
230  outputraw.push_back(*rawDigis);
231 
232  }
233 
234 }
const uint16_t & adc() const
std::vector< edm::DetSet< SiStripDigi > > output_baseline_points
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
void storeCMN(uint32_t, const std::vector< std::pair< short, float > > &)
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_apvcm
void storeBaseline(uint32_t, const std::vector< std::pair< short, float > > &, std::map< uint16_t, std::vector< int16_t > > &)
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
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
std::string const & instance() const
Definition: InputTag.h:26
void SiStripZeroSuppression::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 63 of file SiStripZeroSuppression.cc.

References algorithms, CollectionMergedZeroSuppression(), doAPVRestore, mergeCollections, StandardZeroSuppression(), and useCMMeanMap.

63  {
64 
65  //std::cout << "SiStripZeroSuppression EventN: " <<e.id() << std::endl;
66  algorithms->initialize(es);
67  if( doAPVRestore && useCMMeanMap) algorithms->restorer->LoadMeanCMMap( e );
68 
71  else
72  this->StandardZeroSuppression(e);
73 
74 }
void CollectionMergedZeroSuppression(edm::Event &)
void StandardZeroSuppression(edm::Event &)
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
void SiStripZeroSuppression::StandardZeroSuppression ( edm::Event e)
inlineprivate

Definition at line 76 of file SiStripZeroSuppression.cc.

References edm::Event::getByLabel(), collect_tpl::input, inputTags, convertSQLitetoXML_cfg::output, output_apvcm, output_baseline, output_baseline_points, processRaw(), produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, edm::Event::put(), and storeCM.

Referenced by produce().

76  {
77 
78  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {
79 
81  e.getByLabel(*inputTag,input);
82 
83  std::vector<edm::DetSet<SiStripDigi> > output_base;
84  std::vector<edm::DetSet<SiStripRawDigi> > output_base_raw;
85 
86  if (input->size())
87  processRaw(*inputTag, *input, output_base, output_base_raw );
88 
89  std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(output_base) );
90  e.put( output, inputTag->instance() );
91 
92 
93  if(produceRawDigis){
94  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > outputraw(new edm::DetSetVector<SiStripRawDigi>(output_base_raw) );
95  e.put(outputraw, inputTag->instance() );
96 
97 
98  }
99  }
100 
101 
103  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputbaseline(new edm::DetSetVector<SiStripProcessedRawDigi>(output_baseline) );
104  e.put(outputbaseline, "BADAPVBASELINE" );
105  }
106 
108  std::auto_ptr< edm::DetSetVector<SiStripDigi> > outputbaselinepoints(new edm::DetSetVector<SiStripDigi>(output_baseline_points) );
109  e.put(outputbaselinepoints, "BADAPVBASELINEPOINTS" );
110  }
111 
112  if(storeCM){
113  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputAPVCM(new edm::DetSetVector<SiStripProcessedRawDigi>(output_apvcm) );
114  e.put( outputAPVCM,"APVCM");
115  }
116 }
std::vector< edm::InputTag > inputTags
std::vector< edm::DetSet< SiStripDigi > > output_baseline_points
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_apvcm
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
void processRaw(const edm::InputTag &, const edm::DetSetVector< SiStripRawDigi > &, std::vector< edm::DetSet< SiStripDigi > > &, std::vector< edm::DetSet< SiStripRawDigi > > &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple input
Definition: collect_tpl.py:10
std::vector< edm::InputTag >::const_iterator tag_iterator_t
void SiStripZeroSuppression::storeBaseline ( uint32_t  id,
const std::vector< std::pair< short, float > > &  vmedians,
std::map< uint16_t, std::vector< int16_t > > &  baselinemap 
)
inlineprivate

Definition at line 238 of file SiStripZeroSuppression.cc.

References i, output_baseline, edm::DetSet< T >::push_back(), edm::DetSet< T >::size(), and strip().

Referenced by processRaw().

238  {
239 
240  edm::DetSet<SiStripProcessedRawDigi> baselineDetSet(id);
241  std::map< uint16_t, std::vector < int16_t> >::iterator itBaselineMap;
242 
243  for(size_t i=0;i<vmedians.size();++i){
244  uint16_t APVn = vmedians[i].first;
245  float median = vmedians[i].second;
246  itBaselineMap = baselinemap.find(APVn);
247  if(itBaselineMap==baselinemap.end()){
248  for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi(median));
249  } else {
250  for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi((itBaselineMap->second)[strip]));
251  }
252 
253  }
254 
255  if(baselineDetSet.size())
256  output_baseline.push_back(baselineDetSet);
257 
258 }
int i
Definition: DBlmapReader.cc:9
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
A signed Digi for the silicon strip detector, containing only adc information, and suitable for stori...
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
void SiStripZeroSuppression::storeBaselinePoints ( uint32_t  ,
std::vector< std::map< uint16_t, int16_t > > &   
)
private
void SiStripZeroSuppression::storeCMN ( uint32_t  id,
const std::vector< std::pair< short, float > > &  vmedians 
)
inlineprivate

Definition at line 284 of file SiStripZeroSuppression.cc.

References algorithms, first, fixCM, i, output_apvcm, edm::DetSet< T >::push_back(), edm::second(), and edm::DetSet< T >::size().

Referenced by processRaw().

284  {
285 
287  short apvNb=0;
288  for(size_t i=0;i<vmedians.size();++i){
289  if(vmedians[i].first>apvNb){
290  for(int i=0;i<vmedians[i].first-apvNb;++i){
291  apvDetSet.push_back(SiStripProcessedRawDigi(0.));
292  apvNb++;
293  }
294  }
295  apvDetSet.push_back(SiStripProcessedRawDigi(vmedians[i].second));
296  //std::cout << "CM patch in VR " << rawDigis->id << " " << vmedians[i].first << " " << vmedians[i].second << " " << apvNb<< std::endl;
297  apvNb++;
298  }
299  if(fixCM) algorithms->restorer->fixAPVsCM( apvDetSet );
300  if(apvDetSet.size())
301  output_apvcm.push_back(apvDetSet);
302 
303 }
int i
Definition: DBlmapReader.cc:9
A signed Digi for the silicon strip detector, containing only adc information, and suitable for stori...
U second(std::pair< T, U > const &p)
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_apvcm
bool first
Definition: L1TdeRCT.cc:79

Member Data Documentation

std::auto_ptr<SiStripRawProcessingAlgorithms> SiStripZeroSuppression::algorithms
private

Definition at line 38 of file SiStripZeroSuppression.h.

Referenced by processRaw(), produce(), and storeCMN().

bool SiStripZeroSuppression::doAPVRestore
private

Definition at line 42 of file SiStripZeroSuppression.h.

Referenced by processRaw(), produce(), and SiStripZeroSuppression().

bool SiStripZeroSuppression::fixCM
private

Definition at line 48 of file SiStripZeroSuppression.h.

Referenced by SiStripZeroSuppression(), and storeCMN().

std::vector<edm::InputTag> SiStripZeroSuppression::inputTags
private
bool SiStripZeroSuppression::mergeCollections
private

Definition at line 47 of file SiStripZeroSuppression.h.

Referenced by produce(), and SiStripZeroSuppression().

std::vector< edm::DetSet<SiStripProcessedRawDigi> > SiStripZeroSuppression::output_apvcm
private

Definition at line 35 of file SiStripZeroSuppression.h.

Referenced by processRaw(), StandardZeroSuppression(), and storeCMN().

std::vector< edm::DetSet<SiStripProcessedRawDigi> > SiStripZeroSuppression::output_baseline
private

Definition at line 36 of file SiStripZeroSuppression.h.

Referenced by processRaw(), StandardZeroSuppression(), and storeBaseline().

std::vector< edm::DetSet<SiStripDigi> > SiStripZeroSuppression::output_baseline_points
private

Definition at line 37 of file SiStripZeroSuppression.h.

Referenced by processRaw(), and StandardZeroSuppression().

bool SiStripZeroSuppression::produceBaselinePoints
private
bool SiStripZeroSuppression::produceCalculatedBaseline
private
bool SiStripZeroSuppression::produceRawDigis
private
bool SiStripZeroSuppression::storeCM
private
bool SiStripZeroSuppression::storeInZScollBadAPV
private

Definition at line 46 of file SiStripZeroSuppression.h.

Referenced by processRaw(), and SiStripZeroSuppression().

bool SiStripZeroSuppression::useCMMeanMap
private

Definition at line 49 of file SiStripZeroSuppression.h.

Referenced by produce(), and SiStripZeroSuppression().