#include <SiStripZeroSuppression.h>
Public Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
SiStripZeroSuppression (const edm::ParameterSet &) | |
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::InputTag > | inputTags |
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 |
Definition at line 16 of file SiStripZeroSuppression.h.
typedef std::vector<edm::InputTag>::const_iterator SiStripZeroSuppression::tag_iterator_t [private] |
Definition at line 34 of file SiStripZeroSuppression.h.
SiStripZeroSuppression::SiStripZeroSuppression | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 14 of file SiStripZeroSuppression.cc.
References doAPVRestore, fixCM, edm::ParameterSet::getParameter(), ExpressReco_HICollisions_FallBack::inputTag, inputTags, mergeCollections, produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, storeCM, storeInZScollBadAPV, and useCMMeanMap.
: inputTags(conf.getParameter<std::vector<edm::InputTag> >("RawDigiProducersList")), algorithms(SiStripRawProcessingFactory::create(conf.getParameter<edm::ParameterSet>("Algorithms"))), storeCM(conf.getParameter<bool>("storeCM")), doAPVRestore(conf.getParameter<bool>("doAPVRestore")), mergeCollections(conf.getParameter<bool>("mergeCollections")) { if(doAPVRestore){ produceRawDigis = conf.getParameter<bool>("produceRawDigis"); produceCalculatedBaseline = conf.getParameter<bool>("produceCalculatedBaseline"); produceBaselinePoints = conf.getParameter<bool>("produceBaselinePoints"); storeInZScollBadAPV = conf.getParameter<bool>("storeInZScollBadAPV"); useCMMeanMap = conf.getParameter<bool>("useCMMeanMap"); fixCM = conf.getParameter<bool>("fixCM"); } else { produceRawDigis = false; produceCalculatedBaseline = false; produceBaselinePoints = false; storeInZScollBadAPV = false; useCMMeanMap = false; fixCM = false; } if(mergeCollections){ storeCM = false; produceRawDigis = false; } for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ){ produces< edm::DetSetVector<SiStripDigi> > (inputTag->instance()); if(produceRawDigis) produces< edm::DetSetVector<SiStripRawDigi> > (inputTag->instance()); } if(produceCalculatedBaseline) produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("BADAPVBASELINE"); if(produceBaselinePoints) produces< edm::DetSetVector<SiStripDigi> > ("BADAPVBASELINEPOINTS"); if(storeCM) produces< edm::DetSetVector<SiStripProcessedRawDigi> > ("APVCM"); }
void SiStripZeroSuppression::CollectionMergedZeroSuppression | ( | edm::Event & | e | ) | [inline, private] |
Definition at line 119 of file SiStripZeroSuppression.cc.
References edm::Event::getByLabel(), ExpressReco_HICollisions_FallBack::inputTag, inputTags, convertSQLitetoXML_cfg::output, processRaw(), and edm::Event::put().
Referenced by produce().
{ for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) { edm::Handle< edm::DetSetVector<SiStripDigi> > inputdigi; edm::Handle< edm::DetSetVector<SiStripRawDigi> > inputraw; e.getByLabel(*inputTag,inputdigi); e.getByLabel(*inputTag,inputraw); std::vector<edm::DetSet<SiStripDigi> > outputdigi; std::vector<edm::DetSet<SiStripRawDigi> > outputraw; if (inputraw->size()) processRaw(*inputTag, *inputraw, outputdigi, outputraw ); for ( std::vector<edm::DetSet<SiStripDigi> >::const_iterator itinputdigi = inputdigi->begin(); itinputdigi !=inputdigi->end(); ++itinputdigi) { outputdigi.push_back(*itinputdigi); } std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(outputdigi) ); e.put( output, inputTag->instance() ); } }
void SiStripZeroSuppression::processRaw | ( | const edm::InputTag & | inputTag, |
const edm::DetSetVector< SiStripRawDigi > & | input, | ||
std::vector< edm::DetSet< SiStripDigi > > & | output, | ||
std::vector< edm::DetSet< SiStripRawDigi > > & | outputraw | ||
) | [inline, private] |
Definition at line 148 of file SiStripZeroSuppression.cc.
References SiStripRawDigi::adc(), algorithms, edm::DetSetVector< T >::begin(), doAPVRestore, edm::DetSetVector< T >::end(), 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().
{ if(storeCM){ output_apvcm.clear(); output_apvcm.reserve(16000); } if(produceCalculatedBaseline){ output_baseline.clear(); output_baseline.reserve(16000); } if(produceBaselinePoints){ output_baseline_points.clear(); output_baseline_points.reserve(16000); } output.reserve(10000); outputraw.reserve(10000); for ( edm::DetSetVector<SiStripRawDigi>::const_iterator rawDigis = input.begin(); rawDigis != input.end(); ++rawDigis) { edm::DetSet<SiStripDigi> suppressedDigis(rawDigis->id); int16_t nAPVflagged = 0; if ( "ProcessedRaw" == inputTag.instance()) { std::vector<int16_t> processedRawDigis, processedRawDigisCopy ; transform(rawDigis->begin(), rawDigis->end(), back_inserter(processedRawDigis), boost::bind(&SiStripRawDigi::adc , _1)); if( doAPVRestore ){ processedRawDigisCopy.assign(processedRawDigis.begin(), processedRawDigis.end()); } algorithms->subtractorCMN->subtract( rawDigis->id, processedRawDigis); if( doAPVRestore ){ nAPVflagged = algorithms->restorer->inspect( rawDigis->id, processedRawDigisCopy, algorithms->subtractorCMN->getAPVsCM() ); algorithms->restorer->restore( processedRawDigis ); } algorithms->suppressor->suppress( processedRawDigis, suppressedDigis ); const std::vector< std::pair<short,float> >& vmedians= algorithms->subtractorCMN->getAPVsCM(); if(storeCM) this->storeCMN(rawDigis->id, vmedians); if(produceCalculatedBaseline&& nAPVflagged > 0){ std::map< uint16_t, std::vector < int16_t> >& baselinemap = algorithms->restorer->GetBaselineMap(); this->storeBaseline(rawDigis->id, vmedians, baselinemap); } // if(produceBaselinePoints&& nAPVflagged > 0){ // std::vector< std::map< uint16_t, int16_t> >& baselinpoints = algorithms->restorer->GetSmoothedPoints(); // this->storeBaselinePoints(rawDigis->id, baselinpoints); // } } else if ( "VirginRaw" == inputTag.instance()) { std::vector<int16_t> processedRawDigis(rawDigis->size()), processedRawDigisCopy; algorithms->subtractorPed->subtract( *rawDigis, processedRawDigis); if( doAPVRestore ){ processedRawDigisCopy.assign(processedRawDigis.begin(), processedRawDigis.end()); } algorithms->subtractorCMN->subtract( rawDigis->id, processedRawDigis); if( doAPVRestore ){ nAPVflagged = algorithms->restorer->inspect( rawDigis->id, processedRawDigisCopy, algorithms->subtractorCMN->getAPVsCM() ); algorithms->restorer->restore( processedRawDigis ); } algorithms->suppressor->suppress( processedRawDigis, suppressedDigis ); const std::vector< std::pair<short,float> >& vmedians = algorithms->subtractorCMN->getAPVsCM(); if(storeCM) this->storeCMN(rawDigis->id, vmedians); if(produceCalculatedBaseline&& nAPVflagged > 0){ std::map< uint16_t, std::vector < int16_t> >& baselinemap = algorithms->restorer->GetBaselineMap(); this->storeBaseline(rawDigis->id, vmedians, baselinemap); } // if(produceBaselinePoints&& nAPVflagged > 0){ // std::vector< std::map< uint16_t, int16_t> >& baselinpoints = algorithms->restorer->GetSmoothedPoints(); // this->storeBaselinePoints(rawDigis->id, baselinpoints); // } } else throw cms::Exception("Unknown input type") << inputTag.instance() << " unknown. SiStripZeroZuppression can only process types \"VirginRaw\" and \"ProcessedRaw\" "; if (suppressedDigis.size() && (storeInZScollBadAPV || nAPVflagged ==0)) output.push_back(suppressedDigis); if (produceRawDigis && nAPVflagged > 0) outputraw.push_back(*rawDigis); } }
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.
{ //std::cout << "SiStripZeroSuppression EventN: " <<e.id() << std::endl; algorithms->initialize(es); if( doAPVRestore && useCMMeanMap) algorithms->restorer->LoadMeanCMMap( e ); if(mergeCollections) this->CollectionMergedZeroSuppression(e); else this->StandardZeroSuppression(e); }
void SiStripZeroSuppression::StandardZeroSuppression | ( | edm::Event & | e | ) | [inline, private] |
Definition at line 76 of file SiStripZeroSuppression.cc.
References edm::Event::getByLabel(), collect_tpl::input, ExpressReco_HICollisions_FallBack::inputTag, inputTags, convertSQLitetoXML_cfg::output, output_apvcm, output_baseline, output_baseline_points, processRaw(), produceBaselinePoints, produceCalculatedBaseline, produceRawDigis, edm::Event::put(), and storeCM.
Referenced by produce().
{ for(tag_iterator_t inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) { edm::Handle< edm::DetSetVector<SiStripRawDigi> > input; e.getByLabel(*inputTag,input); std::vector<edm::DetSet<SiStripDigi> > output_base; std::vector<edm::DetSet<SiStripRawDigi> > output_base_raw; if (input->size()) processRaw(*inputTag, *input, output_base, output_base_raw ); std::auto_ptr< edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(output_base) ); e.put( output, inputTag->instance() ); if(produceRawDigis){ std::auto_ptr< edm::DetSetVector<SiStripRawDigi> > outputraw(new edm::DetSetVector<SiStripRawDigi>(output_base_raw) ); e.put(outputraw, inputTag->instance() ); } } if(produceCalculatedBaseline){ std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputbaseline(new edm::DetSetVector<SiStripProcessedRawDigi>(output_baseline) ); e.put(outputbaseline, "BADAPVBASELINE" ); } if(produceBaselinePoints){ std::auto_ptr< edm::DetSetVector<SiStripDigi> > outputbaselinepoints(new edm::DetSetVector<SiStripDigi>(output_baseline_points) ); e.put(outputbaselinepoints, "BADAPVBASELINEPOINTS" ); } if(storeCM){ std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > outputAPVCM(new edm::DetSetVector<SiStripProcessedRawDigi>(output_apvcm) ); e.put( outputAPVCM,"APVCM"); } }
void SiStripZeroSuppression::storeBaseline | ( | uint32_t | id, |
const std::vector< std::pair< short, float > > & | vmedians, | ||
std::map< uint16_t, std::vector< int16_t > > & | baselinemap | ||
) | [inline, private] |
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().
{ edm::DetSet<SiStripProcessedRawDigi> baselineDetSet(id); std::map< uint16_t, std::vector < int16_t> >::iterator itBaselineMap; for(size_t i=0;i<vmedians.size();++i){ uint16_t APVn = vmedians[i].first; float median = vmedians[i].second; itBaselineMap = baselinemap.find(APVn); if(itBaselineMap==baselinemap.end()){ for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi(median)); } else { for(size_t strip=0; strip < 128; ++strip) baselineDetSet.push_back(SiStripProcessedRawDigi((itBaselineMap->second)[strip])); } } if(baselineDetSet.size()) output_baseline.push_back(baselineDetSet); }
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 | ||
) | [inline, private] |
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().
{ edm::DetSet<SiStripProcessedRawDigi> apvDetSet(id); short apvNb=0; for(size_t i=0;i<vmedians.size();++i){ if(vmedians[i].first>apvNb){ for(int i=0;i<vmedians[i].first-apvNb;++i){ apvDetSet.push_back(SiStripProcessedRawDigi(0.)); apvNb++; } } apvDetSet.push_back(SiStripProcessedRawDigi(vmedians[i].second)); //std::cout << "CM patch in VR " << rawDigis->id << " " << vmedians[i].first << " " << vmedians[i].second << " " << apvNb<< std::endl; apvNb++; } if(fixCM) algorithms->restorer->fixAPVsCM( apvDetSet ); if(apvDetSet.size()) output_apvcm.push_back(apvDetSet); }
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] |
Definition at line 33 of file SiStripZeroSuppression.h.
Referenced by CollectionMergedZeroSuppression(), SiStripZeroSuppression(), and StandardZeroSuppression().
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] |
Definition at line 45 of file SiStripZeroSuppression.h.
Referenced by processRaw(), SiStripZeroSuppression(), and StandardZeroSuppression().
bool SiStripZeroSuppression::produceCalculatedBaseline [private] |
Definition at line 44 of file SiStripZeroSuppression.h.
Referenced by processRaw(), SiStripZeroSuppression(), and StandardZeroSuppression().
bool SiStripZeroSuppression::produceRawDigis [private] |
Definition at line 43 of file SiStripZeroSuppression.h.
Referenced by processRaw(), SiStripZeroSuppression(), and StandardZeroSuppression().
bool SiStripZeroSuppression::storeCM [private] |
Definition at line 41 of file SiStripZeroSuppression.h.
Referenced by processRaw(), SiStripZeroSuppression(), and StandardZeroSuppression().
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().