CMS 3D CMS Logo

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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< edm::InputTag >::const_iterator tag_iterator_t
 
typedef token_v::const_iterator token_iterator_t
 
typedef edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > token_t
 
typedef std::vector< token_ttoken_v
 

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< SiStripRawProcessingAlgorithmsalgorithms
 
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > DigisToMergeVR
 
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > DigisToMergeZS
 
bool fixCM
 
std::vector< edm::InputTaginputTags
 
token_v inputTokens
 
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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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.

typedef token_v::const_iterator SiStripZeroSuppression::token_iterator_t
private

Definition at line 49 of file SiStripZeroSuppression.h.

Definition at line 47 of file SiStripZeroSuppression.h.

typedef std::vector<token_t> SiStripZeroSuppression::token_v
private

Definition at line 48 of file SiStripZeroSuppression.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file SiStripZeroSuppression.cc.

References DigisToMergeVR, DigisToMergeZS, fixCM, edm::ParameterSet::getParameter(), HiClusterCompatibility_cfi::inputTag, inputTags, inputTokens, mergeCollections, produce(), produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, storeCM, storeInZScollBadAPV, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

16  : inputTags(conf.getParameter<std::vector<edm::InputTag> >("RawDigiProducersList")),
17  algorithms(SiStripRawProcessingFactory::create(conf.getParameter<edm::ParameterSet>("Algorithms"))),
18  storeCM(conf.getParameter<bool>("storeCM")),
19  mergeCollections(conf.getParameter<bool>("mergeCollections"))
20 
21 {
22 
23  produceRawDigis = conf.getParameter<bool>("produceRawDigis");
24  produceCalculatedBaseline = conf.getParameter<bool>("produceCalculatedBaseline");
25  produceBaselinePoints = conf.getParameter<bool>("produceBaselinePoints");
26  storeInZScollBadAPV = conf.getParameter<bool>("storeInZScollBadAPV");
27  fixCM = conf.getParameter<bool>("fixCM");
28 
29  if(mergeCollections){
30  storeCM = false;
31  produceRawDigis = false;
32  DigisToMergeZS = consumes< edm::DetSetVector<SiStripDigi> >(conf.getParameter<edm::InputTag>("DigisToMergeZS"));
33  DigisToMergeVR = consumes< edm::DetSetVector<SiStripRawDigi> >(conf.getParameter<edm::InputTag>("DigisToMergeVR"));
34  produces< edm::DetSetVector<SiStripDigi> > ("ZeroSuppressed");
35  }
36 
37  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ){
38  produces< edm::DetSetVector<SiStripDigi> > (inputTag->instance());
39  if(produceRawDigis) produces< edm::DetSetVector<SiStripRawDigi> > (inputTag->instance());
40  if(produceCalculatedBaseline) produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("BADAPVBASELINE"+inputTag->instance());
41  if(produceBaselinePoints) produces< edm::DetSetVector<SiStripDigi> > ("BADAPVBASELINEPOINTS"+inputTag->instance());
42  if(storeCM) produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("APVCM"+inputTag->instance());
43 // tokens consumes<reco::BeamSpot>(
44  }
45  inputTokens = edm::vector_transform( inputTags, [this](edm::InputTag const & tag) { return consumes< edm::DetSetVector<SiStripRawDigi> >(tag);} );
46 
47 
48 
49 }
std::vector< edm::InputTag > inputTags
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::EDGetTokenT< edm::DetSetVector< SiStripDigi > > DigisToMergeZS
std::auto_ptr< SiStripRawProcessingAlgorithms > algorithms
static std::auto_ptr< SiStripRawProcessingAlgorithms > create(const edm::ParameterSet &)
edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > DigisToMergeVR
std::vector< edm::InputTag >::const_iterator tag_iterator_t

Member Function Documentation

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

Definition at line 409 of file SiStripZeroSuppression.cc.

References edm::Event::getByLabel(), HiClusterCompatibility_cfi::inputTag, inputTags, output_base, processRaw(), and edm::Event::put().

409  {
410 
411  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {
412 
415  e.getByLabel(*inputTag,inputdigi);
416  e.getByLabel(*inputTag,inputraw);
417 
418  std::vector<edm::DetSet<SiStripDigi> > outputdigi;
419  std::vector<edm::DetSet<SiStripRawDigi> > outputraw;
420 
421 
422  if (inputraw->size())
423  processRaw(*inputTag, *inputraw);
424 
425 
426  for ( std::vector<edm::DetSet<SiStripDigi> >::const_iterator itinputdigi = inputdigi->begin(); itinputdigi !=inputdigi->end(); ++itinputdigi) {
427  output_base.push_back(*itinputdigi);
428  }
429 
430  e.put(std::make_unique<edm::DetSetVector<SiStripDigi>>(output_base), inputTag->instance());
431 
432  }
433 
434 }
std::vector< edm::InputTag > inputTags
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::vector< edm::DetSet< SiStripDigi > > output_base
void processRaw(const edm::InputTag &, const edm::DetSetVector< SiStripRawDigi > &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
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 143 of file SiStripZeroSuppression.cc.

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

Referenced by processRaw().

144  {
145 
146  const std::vector<bool>& apvf = algorithms->GetAPVFlags();
147  edm::DetSet<SiStripRawDigi>::const_iterator itRawDigis = rawDigis->begin();
148 
149  uint32_t strip=0;
150  for (; itRawDigis != rawDigis->end(); ++itRawDigis){
151  int16_t APVn = strip/128;
152  if(apvf[APVn]) outRawDigis.push_back(*itRawDigis);
153  else outRawDigis.push_back(SiStripRawDigi(0));
154  ++strip;
155  }
156 
157 }
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:361
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
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 260 of file SiStripZeroSuppression.cc.

References ecalMGPA::adc(), algorithms, edm::DetSet< T >::begin(), edm::HandleBase::clear(), KineDebug3::count(), gather_cfg::cout, DigisToMergeVR, DigisToMergeZS, edm::DetSet< T >::end(), edm::Event::getByToken(), edm::Event::put(), edm::DetSet< T >::size(), and digi_MixPreMix_cfi::strip.

Referenced by produce().

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

Definition at line 100 of file SiStripZeroSuppression.cc.

References algorithms, edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), 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().

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

Definition at line 52 of file SiStripZeroSuppression.cc.

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

Referenced by SiStripZeroSuppression().

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

Definition at line 63 of file SiStripZeroSuppression.cc.

References edm::Event::getByToken(), input, HiClusterCompatibility_cfi::inputTag, inputTags, inputTokens, output_apvcm, output_base, output_base_raw, output_baseline, output_baseline_points, processRaw(), produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, edm::Event::put(), and storeCM.

Referenced by produce().

63  {
64 
65  token_iterator_t inputToken = inputTokens.begin();
66  for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag,++inputToken ) {
67 
69  e.getByToken(*inputToken,input);
70 
71  if (input->size())
72  processRaw(*inputTag, *input);
73 
74  e.put(std::make_unique<edm::DetSetVector<SiStripDigi>>(output_base), inputTag->instance());
75 
76  if(produceRawDigis){
77  e.put(std::make_unique<edm::DetSetVector<SiStripRawDigi>>(output_base_raw), inputTag->instance());
78  }
79 
81  e.put(std::make_unique<edm::DetSetVector<SiStripProcessedRawDigi>>(output_baseline), "BADAPVBASELINE"+inputTag->instance());
82  }
83 
85  e.put(std::make_unique<edm::DetSetVector<SiStripDigi>>(output_baseline_points), "BADAPVBASELINEPOINTS"+inputTag->instance());
86  }
87 
88  if(storeCM){
89  e.put(std::make_unique<edm::DetSetVector<SiStripProcessedRawDigi>>(output_apvcm), "APVCM"+inputTag->instance());
90  }
91 
92  }
93 }
std::vector< edm::InputTag > inputTags
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
std::vector< edm::DetSet< SiStripDigi > > output_base
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
std::vector< edm::DetSet< SiStripRawDigi > > output_base_raw
token_v::const_iterator token_iterator_t
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 173 of file SiStripZeroSuppression.cc.

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

Referenced by storeExtraOutput().

173  {
174 
175  std::map< uint16_t, std::vector < int16_t> >& baselinemap = algorithms->GetBaselineMap();
176 
177  edm::DetSet<SiStripProcessedRawDigi> baselineDetSet(id);
178  std::map< uint16_t, std::vector < int16_t> >::iterator itBaselineMap;
179 
180  for(size_t i=0;i<vmedians.size();++i){
181  uint16_t APVn = vmedians[i].first;
182  float median = vmedians[i].second;
183  itBaselineMap = baselinemap.find(APVn);
184  if(itBaselineMap==baselinemap.end()){
185  for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi(median));
186  } else {
187  for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi((itBaselineMap->second)[strip]));
188  }
189 
190  }
191 
192  if(baselineDetSet.size())
193  output_baseline.push_back(baselineDetSet);
194 
195 }
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 198 of file SiStripZeroSuppression.cc.

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

Referenced by storeExtraOutput().

198  {
199 
200  std::map< uint16_t, std::map< uint16_t, int16_t> >& BasPointVec = algorithms->GetSmoothedPoints();
201  std::map< uint16_t, std::map< uint16_t, int16_t> >::iterator itBasPointVect = BasPointVec.begin() ;
202  std::map< uint16_t, int16_t>::iterator itBaselinePointMap;
203 
204  edm::DetSet<SiStripDigi> baspointDetSet(id);
205 
206  for(; itBasPointVect != BasPointVec.end(); ++itBasPointVect){
207  uint16_t APVn= itBasPointVect->first;
208  itBaselinePointMap =itBasPointVect->second.begin();
209  for(;itBaselinePointMap != itBasPointVect->second.end(); ++itBaselinePointMap){
210  uint16_t bpstrip = (itBaselinePointMap->first) + APVn*128;
211  int16_t bp = itBaselinePointMap->second;
212  baspointDetSet.push_back(SiStripDigi(bpstrip,bp+128));
213 
214  }
215  }
216 
217 
218  if(baspointDetSet.size())
219  output_baseline_points.push_back(baspointDetSet);
220 
221 }
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 224 of file SiStripZeroSuppression.cc.

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

Referenced by storeExtraOutput().

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

Definition at line 161 of file SiStripZeroSuppression.cc.

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

Referenced by processRaw().

161  {
162 
163  const std::vector< std::pair<short,float> >& vmedians = algorithms->getAPVsCM();
164  if(storeCM) this->storeCMN(id, vmedians);
165  if(nAPVflagged > 0){
166  if(produceCalculatedBaseline) this->storeBaseline(id, vmedians);
168  }
169 }
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::EDGetTokenT< edm::DetSetVector<SiStripRawDigi> > SiStripZeroSuppression::DigisToMergeVR
private
edm::EDGetTokenT< edm::DetSetVector<SiStripDigi> > SiStripZeroSuppression::DigisToMergeZS
private
bool SiStripZeroSuppression::fixCM
private

Definition at line 58 of file SiStripZeroSuppression.h.

Referenced by SiStripZeroSuppression(), and storeCMN().

std::vector<edm::InputTag> SiStripZeroSuppression::inputTags
private
token_v SiStripZeroSuppression::inputTokens
private

Definition at line 50 of file SiStripZeroSuppression.h.

Referenced by SiStripZeroSuppression(), and StandardZeroSuppression().

bool SiStripZeroSuppression::mergeCollections
private

Definition at line 57 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 56 of file SiStripZeroSuppression.h.

Referenced by processRaw(), and SiStripZeroSuppression().