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::EDConsumerBase 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 ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

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

Private Member Functions

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

Private Attributes

std::auto_ptr
< SiStripRawProcessingAlgorithms
algorithms
 
edm::InputTag DigisToMergeVR
 
edm::InputTag DigisToMergeZS
 
bool fixCM
 
std::vector< edm::InputTaginputTags
 
bool mergeCollections
 
std::vector< edm::DetSet
< SiStripProcessedRawDigi > > 
output_apvcm
 
std::vector< edm::DetSet
< SiStripDigi > > 
output_base
 
std::vector< edm::DetSet
< SiStripRawDigi > > 
output_base_raw
 
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
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 40 of file SiStripZeroSuppression.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file SiStripZeroSuppression.cc.

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

15  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("RawDigiProducersList")),
17  storeCM(conf.getParameter<bool>("storeCM")),
18  mergeCollections(conf.getParameter<bool>("mergeCollections"))
19 
20 {
21 
22  produceRawDigis = conf.getParameter<bool>("produceRawDigis");
23  produceCalculatedBaseline = conf.getParameter<bool>("produceCalculatedBaseline");
24  produceBaselinePoints = conf.getParameter<bool>("produceBaselinePoints");
25  storeInZScollBadAPV = conf.getParameter<bool>("storeInZScollBadAPV");
26  fixCM = conf.getParameter<bool>("fixCM");
27 
28  if(mergeCollections){
29  storeCM = false;
30  produceRawDigis = false;
31  DigisToMergeZS = conf.getParameter<edm::InputTag>("DigisToMergeZS");
32  DigisToMergeVR = conf.getParameter<edm::InputTag>("DigisToMergeVR");
33  produces< edm::DetSetVector<SiStripDigi> > ("ZeroSuppressed");
34  }
35 
36  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ){
37  produces< edm::DetSetVector<SiStripDigi> > (inputTag->instance());
38  if(produceRawDigis) produces< edm::DetSetVector<SiStripRawDigi> > (inputTag->instance());
39  if(produceCalculatedBaseline) produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("BADAPVBASELINE"+inputTag->instance());
40  if(produceBaselinePoints) produces< edm::DetSetVector<SiStripDigi> > ("BADAPVBASELINEPOINTS"+inputTag->instance());
41  if(storeCM) produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("APVCM"+inputTag->instance());
42  }
43 
44 
45 
46 
47 
48 }
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 413 of file SiStripZeroSuppression.cc.

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

413  {
414 
415  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {
416 
419  e.getByLabel(*inputTag,inputdigi);
420  e.getByLabel(*inputTag,inputraw);
421 
422  std::vector<edm::DetSet<SiStripDigi> > outputdigi;
423  std::vector<edm::DetSet<SiStripRawDigi> > outputraw;
424 
425 
426  if (inputraw->size())
427  processRaw(*inputTag, *inputraw);
428 
429 
430  for ( std::vector<edm::DetSet<SiStripDigi> >::const_iterator itinputdigi = inputdigi->begin(); itinputdigi !=inputdigi->end(); ++itinputdigi) {
431  output_base.push_back(*itinputdigi);
432  }
433 
434  std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(output_base) );
435  e.put( output, inputTag->instance() );
436 
437  }
438 
439 }
std::vector< edm::InputTag > inputTags
std::vector< edm::DetSet< SiStripDigi > > output_base
void processRaw(const edm::InputTag &, const edm::DetSetVector< SiStripRawDigi > &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< edm::InputTag >::const_iterator tag_iterator_t
void SiStripZeroSuppression::formatRawDigis ( edm::DetSetVector< SiStripRawDigi >::const_iterator  rawDigis,
edm::DetSet< SiStripRawDigi > &  outRawDigis 
)
inlineprivate

Definition at line 146 of file SiStripZeroSuppression.cc.

References algorithms, edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), and edm::DetSet< T >::push_back().

Referenced by processRaw().

147  {
148 
149  const std::vector<bool>& apvf = algorithms->GetAPVFlags();
150  edm::DetSet<SiStripRawDigi>::const_iterator itRawDigis = rawDigis->begin();
151 
152  uint32_t strip=0;
153  for (; itRawDigis != rawDigis->end(); ++itRawDigis){
154  int16_t APVn = strip/128;
155  if(apvf[APVn]) outRawDigis.push_back(*itRawDigis);
156  else outRawDigis.push_back(SiStripRawDigi(0));
157  ++strip;
158  }
159 
160 }
void push_back(const T &t)
Definition: DetSet.h:68
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
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:33
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
void SiStripZeroSuppression::MergeCollectionsZeroSuppression ( edm::Event e)
inlineprivate

Definition at line 263 of file SiStripZeroSuppression.cc.

References ecalMGPA::adc(), algorithms, edm::DetSet< T >::begin(), edm::HandleBase::clear(), prof2calltree::count, gather_cfg::cout, DigisToMergeVR, DigisToMergeZS, edm::DetSet< T >::end(), edm::Event::getByLabel(), convertSQLitetoXML_cfg::output, edm::Event::put(), and edm::DetSet< T >::size().

Referenced by produce().

263  {
264 
265  std::cout<< "starting Merging" << std::endl;
268  e.getByLabel(DigisToMergeZS,inputdigi);
269  e.getByLabel(DigisToMergeVR,inputraw);
270 
271  std::cout << inputdigi->size() << " " << inputraw->size() << std::endl;
272 
273  if (inputraw->size()){
274 
275  std::vector<edm::DetSet<SiStripDigi> > outputdigi;
276  outputdigi.clear();
277 
278  //std::cout << "copying the input ZS to the output ZS collection" << std::endl;
279  for ( edm::DetSetVector<SiStripDigi>::const_iterator Digis = inputdigi->begin(); Digis != inputdigi->end(); ++Digis) outputdigi.push_back(*Digis);
280 
281 
282  std::cout << "looping over the raw data collection" << std::endl;
283  for ( edm::DetSetVector<SiStripRawDigi>::const_iterator rawDigis = inputraw->begin(); rawDigis != inputraw->end(); ++rawDigis) {
284 
285  edm::DetSet<SiStripRawDigi>::const_iterator itRawDigis = rawDigis->begin();
286  uint16_t nAPV = rawDigis->size()/128;
287  uint32_t rawDetId = rawDigis->id;
288 
289  std::vector<bool> restoredAPV;
290  restoredAPV.clear();
291  restoredAPV.insert(restoredAPV.begin(), nAPV, false);
292 
293 
294  bool isModuleRestored = false;
295  for( uint16_t strip =0; strip < rawDigis->size();++strip){
296  if(itRawDigis[strip].adc()!=0){
297  restoredAPV[strip/128] = true;
298  isModuleRestored = true;
299  }
300  }
301 
302 
303  if(isModuleRestored){
304  std::cout << "apply the ZS to the raw data collection" << std::endl;
305  edm::DetSet<SiStripDigi> suppressedDigis(rawDetId);
306  std::vector<int16_t> processedRawDigis(rawDigis->size());
307  algorithms->SuppressVirginRawData(*rawDigis, suppressedDigis);
308 
309  if(suppressedDigis.size()){
310  std::cout << "looking for the detId with the new ZS in the collection of the zero suppressed data" << std::endl;
311  std::vector<edm::DetSet<SiStripDigi> >::iterator zsModule = outputdigi.begin();
312  //std::vector<edm::DetSet<SiStripDigi> >::iterator LastLowerIdDigis = zsModule;
313 
314  uint32_t zsDetId = zsModule->id;
315  bool isModuleInZscollection = false;
316  while((zsDetId <= rawDetId)&&(zsModule != outputdigi.end())&&(!isModuleInZscollection)){
317  //std::cout << rawDetId << " ==== " << zsDetId << std::endl;
318  if( zsDetId == rawDetId){
319  isModuleInZscollection = true;
320  }else{
321  ++zsModule;
322  zsDetId = zsModule->id;
323  }
324  }
325  std::cout << "after the look " << rawDetId << " ==== " << zsDetId << std::endl;
326  std::cout << "exiting looking for the detId with the new ZS in the collection of the zero suppressed data" << std::endl;
327 
328  //creating the map containing the digis (in rawdigi format) merged
329  std::vector<uint16_t> MergedRawDigis;
330  MergedRawDigis.clear();
331  MergedRawDigis.insert(MergedRawDigis.begin(), nAPV*128, 0);
332 
333  uint32_t count=0; // to be removed...
334 
335  edm::DetSet<SiStripDigi> newDigiToIndert(rawDetId);
336  if(!isModuleInZscollection){
337  std::cout << "WE HAVE A PROBLEM, THE MODULE IS NTOT FOUND" << std::endl;
338  outputdigi.insert(zsModule, newDigiToIndert);
339  --zsModule;
340  std::cout << "new module id -1 " << zsModule->id << std::endl;
341  ++zsModule;
342  std::cout << "new module id " << zsModule->id << std::endl;
343  ++zsModule;
344  std::cout << "new module id +1 " << zsModule->id << std::endl;
345  --zsModule;
346 
347  } else {
348  std::cout << "inserting only the digis for not restored APVs" << std::endl;
349  std::cout << "size : " << zsModule->size() << std::endl;
350  edm::DetSet<SiStripDigi>::iterator itZsModule = zsModule->begin();
351  for(; itZsModule != zsModule->end(); ++itZsModule){
352  uint16_t adc = itZsModule->adc();
353  uint16_t strip = itZsModule->strip();
354  if(!restoredAPV[strip/128]){
355  MergedRawDigis[strip] = adc;
356  ++count;
357  std::cout << "original count: "<< count << " strip: " << strip << " adc: " << adc << std::endl;
358  }
359  }
360 
361  }
362 
363  std::cout << "size of digis to keep: " << count << std::endl;
364  std::cout << "inserting only the digis for the restored APVs" << std::endl;
365  std::cout << "size : " << suppressedDigis.size() << std::endl;
366  edm::DetSet<SiStripDigi>::iterator itSuppDigi = suppressedDigis.begin();
367  for(; itSuppDigi != suppressedDigis.end(); ++itSuppDigi){
368  uint16_t adc = itSuppDigi->adc();
369  uint16_t strip = itSuppDigi->strip();
370  if(restoredAPV[strip/128]){
371  MergedRawDigis[strip] = adc;
372  std::cout << "new suppressed strip: " << strip << " adc: " << adc << std::endl;
373  }
374  }
375 
376 
377 
378  std::cout << "suppressing the raw digis" << std::endl;
379  zsModule->clear();
380  for(uint16_t strip=0; strip < MergedRawDigis.size(); ++strip){
381  uint16_t adc = MergedRawDigis[strip];
382  if(adc) zsModule->push_back(SiStripDigi(strip, adc));
383  }
384  std::cout << "size zsModule after the merging: " << zsModule->size() << std::endl;
385  if((count + suppressedDigis.size()) != zsModule->size()) std::cout << "WE HAVE A PROBLEM!!!! THE NUMBER OF DIGIS IS NOT RIGHT==============" << std::endl;
386  std::cout << "exiting suppressing the raw digis" << std::endl;
387  }//if new ZS digis size
388  } //if module restored
389  }//loop over raw data collection
390 
391  uint32_t oldid =0;
392  for(edm::DetSetVector<SiStripDigi>::const_iterator dg = outputdigi.begin(); dg != outputdigi.end(); ++dg){
393  uint32_t iddg = dg->id;
394  if(iddg < oldid){
395  std::cout<< "NOT IN THE RIGHT ORGER" << std:: endl;
396  std::cout<< "======================="<< std:: endl;
397  }
398  oldid = iddg;
399  }
400 
401 
402  std::cout << "write the output vector" << std::endl;
403  std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(outputdigi) );
404  e.put( output, "ZeroSuppressed" );
405 
406 
407  }//if inputraw.size
408 
409 
410 
411 }
int adc(sample_type sample)
get the ADC sample (12 bits)
iterator end()
Definition: DetSet.h:60
collection_type::iterator iterator
Definition: DetSet.h:32
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
tuple cout
Definition: gather_cfg.py:121
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void SiStripZeroSuppression::processRaw ( const edm::InputTag inputTag,
const edm::DetSetVector< SiStripRawDigi > &  input 
)
inlineprivate

Definition at line 103 of file SiStripZeroSuppression.cc.

References algorithms, edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), edm::hlt::Exception, formatRawDigis(), edm::InputTag::instance(), output_apvcm, output_base, output_base_raw, output_baseline, output_baseline_points, produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, edm::DetSet< T >::size(), storeCM, storeExtraOutput(), and storeInZScollBadAPV.

Referenced by CollectionMergedZeroSuppression(), and StandardZeroSuppression().

103  {
104 
105  output_apvcm.clear();
106  output_baseline.clear();
107  output_baseline_points.clear();
108  output_base.clear();
109  output_base_raw.clear();
110 
111  if(storeCM) output_apvcm.reserve(16000);
112  if(produceCalculatedBaseline) output_baseline.reserve(16000);
114  if(produceRawDigis) output_base_raw.reserve(16000);
115  output_base.reserve(16000);
116 
117 
119  rawDigis = input.begin(); rawDigis != input.end(); ++rawDigis) {
120 
121  edm::DetSet<SiStripDigi> suppressedDigis(rawDigis->id);
122  int16_t nAPVflagged = 0;
123 
124  if ( "ProcessedRaw" == inputTag.instance()) nAPVflagged = algorithms->SuppressProcessedRawData(*rawDigis, suppressedDigis);
125  else if ( "VirginRaw" == inputTag.instance()) nAPVflagged = algorithms->SuppressVirginRawData(*rawDigis, suppressedDigis);
126  else
127  throw cms::Exception("Unknown input type")
128  << inputTag.instance() << " unknown. SiStripZeroZuppression can only process types \"VirginRaw\" and \"ProcessedRaw\" ";
129 
130  //here storing the output
131  this->storeExtraOutput(rawDigis->id, nAPVflagged);
132  if (suppressedDigis.size() && (storeInZScollBadAPV || nAPVflagged ==0))
133  output_base.push_back(suppressedDigis);
134 
135  if (produceRawDigis && nAPVflagged > 0){
136  edm::DetSet<SiStripRawDigi> outRawDigis(rawDigis->id);
137  this->formatRawDigis(rawDigis, outRawDigis);
138  output_base_raw.push_back(outRawDigis);
139  }
140 
141  }
142 
143 }
void formatRawDigis(edm::DetSetVector< SiStripRawDigi >::const_iterator, edm::DetSet< SiStripRawDigi > &)
std::vector< edm::DetSet< SiStripDigi > > output_base
std::vector< edm::DetSet< SiStripDigi > > output_baseline_points
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
void storeExtraOutput(uint32_t, int16_t)
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_apvcm
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
std::vector< edm::DetSet< SiStripRawDigi > > output_base_raw
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:43
void SiStripZeroSuppression::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 51 of file SiStripZeroSuppression.cc.

References algorithms, mergeCollections, MergeCollectionsZeroSuppression(), and StandardZeroSuppression().

51  {
52 
53  algorithms->initialize(es, e);
54 
55  if(mergeCollections){
57  }else{
58  this->StandardZeroSuppression(e);
59  }
60 }
void StandardZeroSuppression(edm::Event &)
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
void MergeCollectionsZeroSuppression(edm::Event &)
void SiStripZeroSuppression::StandardZeroSuppression ( edm::Event e)
inlineprivate

Definition at line 62 of file SiStripZeroSuppression.cc.

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

Referenced by produce().

62  {
63 
64  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {
65 
67  e.getByLabel(*inputTag,input);
68 
69  if (input->size())
70  processRaw(*inputTag, *input);
71 
72  std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(output_base) );
73  e.put( output, inputTag->instance() );
74 
75  if(produceRawDigis){
76  std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > outputraw(new edm::DetSetVector<SiStripRawDigi>(output_base_raw) );
77  e.put(outputraw, inputTag->instance() );
78  }
79 
81  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputbaseline(new edm::DetSetVector<SiStripProcessedRawDigi>(output_baseline) );
82  e.put(outputbaseline, "BADAPVBASELINE"+inputTag->instance() );
83  }
84 
86  std::auto_ptr< edm::DetSetVector<SiStripDigi> > outputbaselinepoints(new edm::DetSetVector<SiStripDigi>(output_baseline_points) );
87  e.put(outputbaselinepoints, "BADAPVBASELINEPOINTS"+inputTag->instance() );
88  }
89 
90  if(storeCM){
91  std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputAPVCM(new edm::DetSetVector<SiStripProcessedRawDigi>(output_apvcm) );
92  e.put( outputAPVCM,"APVCM"+inputTag->instance());
93  }
94 
95  }
96 }
std::vector< edm::InputTag > inputTags
std::vector< edm::DetSet< SiStripDigi > > output_base
void processRaw(const edm::InputTag &, const edm::DetSetVector< SiStripRawDigi > &)
std::vector< edm::DetSet< SiStripDigi > > output_baseline_points
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_apvcm
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< edm::DetSet< SiStripRawDigi > > output_base_raw
std::vector< edm::InputTag >::const_iterator tag_iterator_t
void SiStripZeroSuppression::storeBaseline ( uint32_t  id,
const std::vector< std::pair< short, float > > &  vmedians 
)
inlineprivate

Definition at line 176 of file SiStripZeroSuppression.cc.

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

Referenced by storeExtraOutput().

176  {
177 
178  std::map< uint16_t, std::vector < int16_t> >& baselinemap = algorithms->GetBaselineMap();
179 
180  edm::DetSet<SiStripProcessedRawDigi> baselineDetSet(id);
181  std::map< uint16_t, std::vector < int16_t> >::iterator itBaselineMap;
182 
183  for(size_t i=0;i<vmedians.size();++i){
184  uint16_t APVn = vmedians[i].first;
185  float median = vmedians[i].second;
186  itBaselineMap = baselinemap.find(APVn);
187  if(itBaselineMap==baselinemap.end()){
188  for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi(median));
189  } else {
190  for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi((itBaselineMap->second)[strip]));
191  }
192 
193  }
194 
195  if(baselineDetSet.size())
196  output_baseline.push_back(baselineDetSet);
197 
198 }
int i
Definition: DBlmapReader.cc:9
A signed Digi for the silicon strip detector, containing only adc information, and suitable for stori...
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
void SiStripZeroSuppression::storeBaselinePoints ( uint32_t  id)
inlineprivate

Definition at line 201 of file SiStripZeroSuppression.cc.

References algorithms, output_baseline_points, edm::DetSet< T >::push_back(), and edm::DetSet< T >::size().

Referenced by storeExtraOutput().

201  {
202 
203  std::map< uint16_t, std::map< uint16_t, int16_t> >& BasPointVec = algorithms->GetSmoothedPoints();
204  std::map< uint16_t, std::map< uint16_t, int16_t> >::iterator itBasPointVect = BasPointVec.begin() ;
205  std::map< uint16_t, int16_t>::iterator itBaselinePointMap;
206 
207  edm::DetSet<SiStripDigi> baspointDetSet(id);
208 
209  for(; itBasPointVect != BasPointVec.end(); ++itBasPointVect){
210  uint16_t APVn= itBasPointVect->first;
211  itBaselinePointMap =itBasPointVect->second.begin();
212  for(;itBaselinePointMap != itBasPointVect->second.end(); ++itBaselinePointMap){
213  uint16_t bpstrip = (itBaselinePointMap->first) + APVn*128;
214  int16_t bp = itBaselinePointMap->second;
215  baspointDetSet.push_back(SiStripDigi(bpstrip,bp+128));
216 
217  }
218  }
219 
220 
221  if(baspointDetSet.size())
222  output_baseline_points.push_back(baspointDetSet);
223 
224 }
std::vector< edm::DetSet< SiStripDigi > > output_baseline_points
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
void SiStripZeroSuppression::storeCMN ( uint32_t  id,
const std::vector< std::pair< short, float > > &  vmedians 
)
inlineprivate

Definition at line 227 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 storeExtraOutput().

227  {
228 
230  short apvNb=0;
231 
232  std::vector<bool> apvf;
233  apvf.clear();
234  apvf.insert(apvf.begin(), 6, false);
235 
236  if(fixCM){
237  std::vector<bool>& apvFlagged = algorithms->GetAPVFlags();
238  for(uint16_t it=0; it< apvFlagged.size(); ++it) apvf[it] = apvFlagged[it];
239  }
240 
241  for(size_t i=0;i<vmedians.size();++i){
242  if(vmedians[i].first>apvNb){
243  for(int i=0;i<vmedians[i].first-apvNb;++i){
244  apvDetSet.push_back(SiStripProcessedRawDigi(-999.));
245  apvNb++;
246  }
247  }
248 
249  if(fixCM&&apvf[vmedians[i].first]){
250  apvDetSet.push_back(SiStripProcessedRawDigi(-999.));
251  }else{
252  apvDetSet.push_back(SiStripProcessedRawDigi(vmedians[i].second));
253  }
254  apvNb++;
255  }
256 
257  if(apvDetSet.size())
258  output_apvcm.push_back(apvDetSet);
259 
260 }
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
void SiStripZeroSuppression::storeExtraOutput ( uint32_t  id,
int16_t  nAPVflagged 
)
inlineprivate

Definition at line 164 of file SiStripZeroSuppression.cc.

References algorithms, produceBaselinePoints, produceCalculatedBaseline, storeBaseline(), storeBaselinePoints(), storeCM, and storeCMN().

Referenced by processRaw().

164  {
165 
166  const std::vector< std::pair<short,float> >& vmedians = algorithms->getAPVsCM();
167  if(storeCM) this->storeCMN(id, vmedians);
168  if(nAPVflagged > 0){
169  if(produceCalculatedBaseline) this->storeBaseline(id, vmedians);
171  }
172 }
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
void storeCMN(uint32_t, const std::vector< std::pair< short, float > > &)
void storeBaseline(uint32_t, const std::vector< std::pair< short, float > > &)

Member Data Documentation

std::auto_ptr<SiStripRawProcessingAlgorithms> SiStripZeroSuppression::algorithms
private
edm::InputTag SiStripZeroSuppression::DigisToMergeVR
private
edm::InputTag SiStripZeroSuppression::DigisToMergeZS
private
bool SiStripZeroSuppression::fixCM
private

Definition at line 54 of file SiStripZeroSuppression.h.

Referenced by SiStripZeroSuppression(), and storeCMN().

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

Definition at line 53 of file SiStripZeroSuppression.h.

Referenced by produce(), and SiStripZeroSuppression().

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

Definition at line 43 of file SiStripZeroSuppression.h.

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

std::vector<edm::DetSet<SiStripDigi> > SiStripZeroSuppression::output_base
private
std::vector<edm::DetSet<SiStripRawDigi> > SiStripZeroSuppression::output_base_raw
private

Definition at line 42 of file SiStripZeroSuppression.h.

Referenced by processRaw(), and StandardZeroSuppression().

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

Definition at line 44 of file SiStripZeroSuppression.h.

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

std::vector< edm::DetSet<SiStripDigi> > SiStripZeroSuppression::output_baseline_points
private
bool SiStripZeroSuppression::produceBaselinePoints
private
bool SiStripZeroSuppression::produceCalculatedBaseline
private
bool SiStripZeroSuppression::produceRawDigis
private
bool SiStripZeroSuppression::storeCM
private
bool SiStripZeroSuppression::storeInZScollBadAPV
private

Definition at line 52 of file SiStripZeroSuppression.h.

Referenced by processRaw(), and SiStripZeroSuppression().