#include <SiStripAPVRestorer.h>
Public Member Functions | |
void | fixAPVsCM (edm::DetSet< SiStripProcessedRawDigi > &) |
RawDigiMap & | GetBaselineMap () |
std::vector< DigiMap > & | GetSmoothedPoints () |
void | init (const edm::EventSetup &es) |
int16_t | inspect (const uint32_t &, std::vector< int16_t > &, const std::vector< std::pair< short, float > > &) |
void | LoadMeanCMMap (edm::Event &) |
void | restore (std::vector< int16_t > &) |
virtual | ~SiStripAPVRestorer () |
Protected Member Functions | |
SiStripAPVRestorer (const edm::ParameterSet &conf) | |
Private Member Functions | |
template<typename T > | |
int16_t | AbnormalBaselineInspect (std::vector< T > &) |
template<typename T > | |
int16_t | BaselineAndSaturationInspect (std::vector< T > &) |
void | BaselineFollower (DigiMap &, std::vector< int16_t > &, float) |
template<typename T > | |
int16_t | BaselineFollowerInspect (std::vector< T > &) |
template<typename T > | |
void | BaselineFollowerRestore (std::vector< T > &, uint16_t, float) |
void | CreateCMMap (const edm::DetSetVector< SiStripProcessedRawDigi > &) |
bool | FlatRegionsFinder (std::vector< int16_t > &, DigiMap &, float, uint16_t) |
template<typename T > | |
void | FlatRestore (std::vector< T > &, uint16_t) |
template<typename T > | |
int16_t | NullInspect (std::vector< T > &) |
float | pairMedian (std::vector< std::pair< float, float > > &) |
Private Attributes | |
std::vector< std::string > | apvFlags_ |
RawDigiMap | BaselineMap_ |
uint32_t | consecThreshold_ |
double | CutToAvoidSignal_ |
uint32_t | DeltaCMThreshold_ |
uint32_t | detId_ |
uint32_t | deviation_ |
uint32_t | distortionThreshold_ |
bool | ForceNoRestore_ |
double | fraction_ |
uint32_t | hitStripThreshold_ |
edm::InputTag | inputTag_ |
std::string | InspectAlgo_ |
CMMap | MeanCMmap_ |
std::vector< float > | median_ |
uint32_t | minStripsToFit_ |
uint32_t | noise_cache_id |
edm::ESHandle< SiStripNoises > | noiseHandle |
uint32_t | nSaturatedStrip_ |
uint32_t | nSigmaNoiseDerTh_ |
uint32_t | nSmooth_ |
uint32_t | quality_cache_id |
edm::ESHandle< SiStripQuality > | qualityHandle |
std::string | RestoreAlgo_ |
double | restoreThreshold_ |
bool | SelfSelectRestoreAlgo_ |
std::vector< DigiMap > | SmoothedMaps_ |
bool | useRealMeanCM_ |
Friends | |
class | SiStripRawProcessingFactory |
Definition at line 27 of file SiStripAPVRestorer.h.
virtual SiStripAPVRestorer::~SiStripAPVRestorer | ( | ) | [inline, virtual] |
Definition at line 33 of file SiStripAPVRestorer.h.
{};
SiStripAPVRestorer::SiStripAPVRestorer | ( | const edm::ParameterSet & | conf | ) | [protected] |
Definition at line 10 of file SiStripAPVRestorer.cc.
References apvFlags_, BaselineMap_, median_, and SmoothedMaps_.
: quality_cache_id(-1), noise_cache_id(-1), ForceNoRestore_(conf.getParameter<bool>("ForceNoRestore")), SelfSelectRestoreAlgo_(conf.getParameter<bool>("SelfSelectRestoreAlgo")), InspectAlgo_(conf.getParameter<std::string>("APVInspectMode")), RestoreAlgo_(conf.getParameter<std::string>("APVRestoreMode")), useRealMeanCM_(conf.getParameter<bool>("useRealMeanCM")), fraction_(conf.getParameter<double>("Fraction")), deviation_(conf.getParameter<uint32_t>("Deviation")), restoreThreshold_(conf.getParameter<double>("restoreThreshold")), DeltaCMThreshold_(conf.getParameter<uint32_t>("DeltaCMThreshold")), nSigmaNoiseDerTh_(conf.getParameter<uint32_t>("nSigmaNoiseDerTh")), consecThreshold_(conf.getParameter<uint32_t>("consecThreshold")), hitStripThreshold_(conf.getParameter<uint32_t>("hitStripThreshold")), nSmooth_(conf.getParameter<uint32_t>("nSmooth")), minStripsToFit_(conf.getParameter<uint32_t>("minStripsToFit")), distortionThreshold_(conf.getParameter<uint32_t>("distortionThreshold")), CutToAvoidSignal_(conf.getParameter<double>("CutToAvoidSignal")), nSaturatedStrip_(conf.getParameter<uint32_t>("nSaturatedStrip")) { apvFlags_.clear(); median_.clear(); SmoothedMaps_.clear(); BaselineMap_.erase(BaselineMap_.begin(), BaselineMap_.end()); }
int16_t SiStripAPVRestorer::AbnormalBaselineInspect | ( | std::vector< T > & | digis | ) | [inline, private] |
Definition at line 208 of file SiStripAPVRestorer.cc.
References abs, sistrip::APV, apvFlags_, detId_, deviation_, fraction_, MeanCMmap_, min, qualityHandle, RestoreAlgo_, and useRealMeanCM_.
Referenced by inspect().
{ SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_); typename std::vector<T>::iterator fs; int16_t nAPVflagged=0; CMMap::iterator itCMMap; if(useRealMeanCM_) itCMMap = MeanCMmap_.find(detId_); int devCount = 0, qualityCount = 0, minstrip = 0; for( uint16_t APV=0; APV< digis.size()/128; ++APV){ int MeanAPVCM = 128; if(useRealMeanCM_&&itCMMap!= MeanCMmap_.end()) MeanAPVCM =(itCMMap->second)[APV]; for (uint16_t istrip=APV*128; istrip<(APV+1)*128; ++istrip){ fs = digis.begin() + istrip; if ( !qualityHandle->IsStripBad(detQualityRange,istrip) ){ qualityCount++; if ( std::abs((int) *fs - MeanAPVCM) > (int)deviation_ ) devCount++; minstrip = std::min((int) *fs, minstrip); } } if( devCount > fraction_ * qualityCount ) { apvFlags_.push_back( RestoreAlgo_ ); //specify any algo to make the restore nAPVflagged++; } else { apvFlags_.push_back( "" ); } } return nAPVflagged; }
int16_t SiStripAPVRestorer::BaselineAndSaturationInspect | ( | std::vector< T > & | digis | ) | [inline, private] |
Definition at line 163 of file SiStripAPVRestorer.cc.
References abs, sistrip::APV, apvFlags_, DeltaCMThreshold_, detId_, MeanCMmap_, median_, nSaturatedStrip_, qualityHandle, strip(), and useRealMeanCM_.
Referenced by inspect().
{ SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_); std::vector<T> singleAPVdigi; singleAPVdigi.clear(); int16_t nAPVflagged = 0; CMMap::iterator itCMMap; if(useRealMeanCM_) itCMMap = MeanCMmap_.find(detId_); for( uint16_t APV=0; APV< digis.size()/128; ++APV){ int MeanAPVCM = 128; if(useRealMeanCM_&&itCMMap!= MeanCMmap_.end()) MeanAPVCM =(itCMMap->second)[APV]; singleAPVdigi.clear(); uint16_t nSatStrip =0; for(int16_t strip = APV*128; strip < (APV+1)*128; ++strip){ singleAPVdigi.push_back(digis[strip]); if(digis[strip] >=1023) ++nSatStrip; } float DeltaCM = median_[APV] -MeanAPVCM; if(DeltaCM < 0 && std::abs(DeltaCM) > DeltaCMThreshold_&&nSatStrip>= nSaturatedStrip_){ apvFlags_.push_back( "RestoreAlgo_" ); //specify any algo to make the restore nAPVflagged++; } else{ apvFlags_.push_back( "" ); } } return nAPVflagged; }
void SiStripAPVRestorer::BaselineFollower | ( | DigiMap & | smoothedpoints, |
std::vector< int16_t > & | baseline, | ||
float | median | ||
) | [inline, private] |
Definition at line 467 of file SiStripAPVRestorer.cc.
References m, and minStripsToFit_.
Referenced by BaselineFollowerRestore().
{ baseline.clear(); DigiMapIter itSmoothedpoints; //if not enough points if(smoothedpoints.size() < minStripsToFit_){ baseline.clear(); baseline.insert(baseline.begin(),128, median); } else { baseline.insert(baseline.begin(),128, 0); DigiMapIter itSmoothedpointsBegin, itSmoothedpointsEnd; itSmoothedpointsBegin = smoothedpoints.begin(); itSmoothedpointsEnd = --(smoothedpoints.end()); uint16_t firstStripFlat = itSmoothedpointsBegin->first; uint16_t lastStripFlat = itSmoothedpointsEnd->first; int16_t firstStipFlatADC= itSmoothedpointsBegin->second; int16_t lastStipFlatADC= itSmoothedpointsEnd->second; //adding here the costant line at the extremities baseline.erase(baseline.begin(), baseline.begin()+firstStripFlat); baseline.insert(baseline.begin(), firstStripFlat, firstStipFlatADC); baseline.erase(baseline.begin()+lastStripFlat, baseline.end()); baseline.insert(baseline.end(), 128 - lastStripFlat, lastStipFlatADC); //IMPORTANT: the itSmoothedpointsEnd should be at least smaller than smoothedpoints.end() -1 for(itSmoothedpoints = itSmoothedpointsBegin; itSmoothedpoints != itSmoothedpointsEnd; ++itSmoothedpoints){ DigiMapIter itSmoothedpointsNext = itSmoothedpoints; ++itSmoothedpointsNext; float strip1 = itSmoothedpoints->first; float strip2 = itSmoothedpointsNext->first; float adc1 = itSmoothedpoints->second; float adc2 = itSmoothedpointsNext->second; baseline[strip1] = adc1; baseline[strip2] = adc2; float m = (adc2 -adc1)/(strip2 -strip1); uint16_t itStrip = strip1 +1; float stripadc = adc1 + m; while(itStrip < strip2){ baseline[itStrip] = stripadc; ++itStrip; stripadc+=m; } } } }
int16_t SiStripAPVRestorer::BaselineFollowerInspect | ( | std::vector< T > & | digis | ) | [inline, private] |
Definition at line 110 of file SiStripAPVRestorer.cc.
References abs, sistrip::APV, apvFlags_, DeltaCMThreshold_, detId_, FlatRegionsFinder(), MeanCMmap_, median_, qualityHandle, SmoothedMaps_, strip(), and useRealMeanCM_.
Referenced by inspect().
{ SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_); std::vector<T> singleAPVdigi; singleAPVdigi.clear(); int16_t nAPVflagged = 0; CMMap::iterator itCMMap; if(useRealMeanCM_) itCMMap = MeanCMmap_.find(detId_); for( uint16_t APV=0; APV< digis.size()/128; ++APV){ int MeanAPVCM = 128; if(useRealMeanCM_&&itCMMap!= MeanCMmap_.end()) MeanAPVCM =(itCMMap->second)[APV]; singleAPVdigi.clear(); for(int16_t strip = APV*128; strip < (APV+1)*128; ++strip){ singleAPVdigi.push_back(digis[strip]); } float DeltaCM = median_[APV] -MeanAPVCM; //if(DeltaCM > DeltaCMThreshold_){ //to be modified when code is extended // apvFlags_.push_back( RestoreAlgo_ ); // nAPVflagged++; //}else DigiMap smoothedmap; if(DeltaCM < 0 && std::abs(DeltaCM) > DeltaCMThreshold_){ bool isFlat= FlatRegionsFinder(singleAPVdigi,smoothedmap, median_[APV], APV); if(!isFlat){ apvFlags_.push_back( "BaselineFollower" ); //specify any algo to make the restore nAPVflagged++; }else{ apvFlags_.push_back( "" ); } } else{ apvFlags_.push_back( "" ); } SmoothedMaps_.push_back(smoothedmap); } return nAPVflagged; }
void SiStripAPVRestorer::BaselineFollowerRestore | ( | std::vector< T > & | digis, |
uint16_t | APVn, | ||
float | median | ||
) | [inline, private] |
Definition at line 289 of file SiStripAPVRestorer.cc.
References BaselineFollower(), BaselineMap_, FlatRegionsFinder(), and SmoothedMaps_.
Referenced by restore().
{ typename std::vector<T>::iterator firstStrip(digis.begin() + APVn*128), lastStrip(firstStrip + 128), actualStrip; std::vector<int16_t> baseline; baseline.clear(); baseline.insert(baseline.begin(),128, 0); std::vector<int16_t> adcs; adcs.clear(); //============================= Copying only ADCs of one APV ============================= for(actualStrip= firstStrip; actualStrip < lastStrip; ++actualStrip ) adcs.push_back(*actualStrip); //============================= Calculate Median ========================================= //this code was here in order to use the median calculated during the inspect //but actually now we use the one calculated by the cmnsubtractor //float median; //if(median_.size()) median = median_[APVn]; //else median = this->median(adcs); //============================= Find Flat Regions & Interpolating the baseline & subtracting the baseline ================= if(SmoothedMaps_.size()){ this->BaselineFollower(SmoothedMaps_[APVn], baseline, median); } else { median=0; DigiMap smoothedpoints; this->FlatRegionsFinder(adcs,smoothedpoints, median, APVn ); this->BaselineFollower(smoothedpoints, baseline, median); } //============================= subtracting the baseline ============================================= for(int16_t itStrip= 0 ; itStrip< 128; ++itStrip){ //int tempDigi = digis[itStrip+APVn*128] - baseline[itStrip] + median; //std::cout << "BaselineFollowerRestore - detId: " << detId_ << " APV: " << APVn << " strip: " << itStrip << " digis: " << digis[itStrip+APVn*128] << " baseline: " << baseline[itStrip] << " median: " << median << " digis after baseline subtraction: " << tempDigi << std::endl; digis[itStrip+APVn*128] -= baseline[itStrip] - median; } //============================= storing baseline to the map ============================================= BaselineMap_.insert(BaselineMap_.end(), std::pair< uint16_t, std::vector < int16_t> >(APVn, baseline)); }
void SiStripAPVRestorer::CreateCMMap | ( | const edm::DetSetVector< SiStripProcessedRawDigi > & | Input | ) | [private] |
Definition at line 586 of file SiStripAPVRestorer.cc.
References edm::DetSetVector< T >::begin(), detId_, edm::DetSetVector< T >::end(), and MeanCMmap_.
Referenced by LoadMeanCMMap().
{ MeanCMmap_.erase(MeanCMmap_.begin(), MeanCMmap_.end()); uint32_t detId_; edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator itInput; edm::DetSet<SiStripProcessedRawDigi>::const_iterator itCM; std::vector<float> MeanCMNValue; for(itInput = Input.begin(); itInput != Input.end(); ++itInput){ detId_ = itInput->id; MeanCMNValue.clear(); for(itCM = itInput->begin(); itCM != itInput->end(); ++itCM) MeanCMNValue.push_back(itCM->adc()); MeanCMmap_.insert(std::pair<uint32_t, std::vector<float> >(detId_,MeanCMNValue)); } }
void SiStripAPVRestorer::fixAPVsCM | ( | edm::DetSet< SiStripProcessedRawDigi > & | cmdigis | ) |
Definition at line 547 of file SiStripAPVRestorer.cc.
References apvFlags_, edm::DetSet< T >::begin(), edm::DetSet< T >::clear(), edm::DetSet< T >::end(), edm::DetSet< T >::push_back(), and edm::DetSet< T >::size().
{ // cmdigis should be the same size as apvFlags_ // otherwise something pathological has happened and we do nothing if ( cmdigis.size() != apvFlags_.size() ) return; edm::DetSet<SiStripProcessedRawDigi>::iterator cm_iter = cmdigis.begin(); std::vector<std::string>::const_iterator apvf_iter = apvFlags_.begin(); // No way to change the adc value of a SiStripProcessedRawDigi // so we just extract the values, clear the DetSet, and // replace with the proper values. std::vector<float> cmvalues; for( ; cm_iter != cmdigis.end(); ++cm_iter ) cmvalues.push_back( (*cm_iter).adc() ); cmdigis.clear(); std::vector<float>::const_iterator cmv_iter = cmvalues.begin(); while( apvf_iter != apvFlags_.end() ){ if( *apvf_iter != "") { //std::cout << " apvFlag was " << *apvf_iter << std::endl; //std::cout << " baseline was " << *cmv_iter << std::endl; cmdigis.push_back( SiStripProcessedRawDigi( -999.) ); } else cmdigis.push_back( SiStripProcessedRawDigi( *cmv_iter ) ); apvf_iter++; cmv_iter++; } }
bool SiStripAPVRestorer::FlatRegionsFinder | ( | std::vector< int16_t > & | adcs, |
DigiMap & | smoothedpoints, | ||
float | median, | ||
uint16_t | APVn | ||
) | [inline, private] |
Definition at line 365 of file SiStripAPVRestorer.cc.
References ecalMGPA::adc(), consecThreshold_, detId_, distortionThreshold_, hitStripThreshold_, max(), min, n, noiseHandle, nSigmaNoiseDerTh_, and nSmooth_.
Referenced by BaselineFollowerInspect(), and BaselineFollowerRestore().
{ SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId_); DigiMap consecpoints; DigiMapIter itConsecpoints, itSmoothedpoints; consecpoints.erase(consecpoints.begin(), consecpoints.end()); smoothedpoints.erase(smoothedpoints.begin(), smoothedpoints.end()); //uint32_t idToLook = 369120382; //to be removed //============================= Height above local minimum =============================== std::vector<float> adcsLocalMinSubtracted; adcsLocalMinSubtracted.clear(); adcsLocalMinSubtracted.insert(adcsLocalMinSubtracted.begin(), 128,0); for(uint32_t istrip=0; istrip<128; ++istrip) { float localmin = 999.9; for(uint16_t jstrip=std::max(0,(int)(istrip-nSmooth_/2)); jstrip<std::min(128,(int)(istrip+nSmooth_/2)); ++jstrip) { float nextvalue = adcs[jstrip]; if(nextvalue < localmin) localmin=nextvalue; } adcsLocalMinSubtracted[istrip] = adcs[istrip] - localmin; } //============================= Find regions with stable slopes ======================== std::vector<uint16_t> nConsStrip; nConsStrip.clear(); //Creating maps with all the neighborhood strip and putting in a nCosntStip vector how many we have uint16_t consecStrips=0; for(uint32_t istrip=0; istrip<128; ++istrip) { int16_t adc = adcs[istrip]; if( adcsLocalMinSubtracted[istrip] < nSigmaNoiseDerTh_ * (float)noiseHandle->getNoiseFast(istrip+APVn*128,detNoiseRange) && adc - median < hitStripThreshold_) { //&& std::abs(adc - adcsLocalMinSubtracted[istrip]) < hitStripThreshold_) { //count of many consecutive strips consecpoints.insert(consecpoints.end(), std::pair<uint16_t, int16_t >(istrip, adc)); ++consecStrips; } else if (consecStrips >0){ nConsStrip.push_back(consecStrips); consecStrips = 0; } } //to cope with the last flat region of the APV if(consecStrips >0) nConsStrip.push_back(consecStrips); //removing from the map the fist and last points in wide flat regions and erasing from the map too small regions itConsecpoints = consecpoints.begin(); float MinSmoothValue=2000., MaxSmoothValue=0.; for(std::vector<uint16_t>::iterator itnConsStrip = nConsStrip.begin(); itnConsStrip < nConsStrip.end(); ++itnConsStrip){ consecStrips = *itnConsStrip; if(consecStrips >=consecThreshold_){ ++itConsecpoints; //skipping first point uint16_t nFirstStrip = itConsecpoints->first; uint16_t nLastStrip; float smoothValue = 0.0; float stripCount =1; for(uint16_t n =0; n < consecStrips-2; ++n){ smoothValue += itConsecpoints->second; if(stripCount == consecThreshold_){ smoothValue /= (float)stripCount; nLastStrip = nFirstStrip + stripCount -1; smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nFirstStrip, smoothValue)); smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nLastStrip, smoothValue)); if(smoothValue > MaxSmoothValue) MaxSmoothValue = smoothValue; if(smoothValue < MinSmoothValue) MinSmoothValue = smoothValue; nFirstStrip = nLastStrip+1; smoothValue=0; stripCount=0; } ++stripCount; ++itConsecpoints; } ++itConsecpoints; //and putting the pointer to the new seies of point if(smoothValue>0){ --stripCount; smoothValue /= (float)(stripCount); nLastStrip = nFirstStrip + stripCount -1; smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nFirstStrip, smoothValue)); smoothedpoints.insert(smoothedpoints.end(), std::pair<uint16_t, int16_t >(nLastStrip, smoothValue)); if(smoothValue > MaxSmoothValue) MaxSmoothValue = smoothValue; if(smoothValue < MinSmoothValue) MinSmoothValue = smoothValue; } } else{ for(int n =0; n< consecStrips ; ++n) ++itConsecpoints; } } if( (MaxSmoothValue-MinSmoothValue) > distortionThreshold_) return false; return true; }
void SiStripAPVRestorer::FlatRestore | ( | std::vector< T > & | digis, |
uint16_t | APVn | ||
) | [inline, private] |
Definition at line 341 of file SiStripAPVRestorer.cc.
References BaselineMap_, cmsDriverOptions::counter, and strip().
Referenced by restore().
{ std::vector<int16_t> baseline; baseline.clear(); baseline.insert(baseline.begin(),128, 150); baseline[0]=0; baseline[127]=0; BaselineMap_.insert(BaselineMap_.end(), std::pair< uint16_t, std::vector < int16_t> >(APVn, baseline)); typename std::vector<T>::iterator strip(digis.begin() + APVn*128), lastStrip(strip + 128); int counter = 0; while (strip < lastStrip) { *strip = baseline[counter]; counter++; strip++; } }
RawDigiMap& SiStripAPVRestorer::GetBaselineMap | ( | ) | [inline] |
std::vector< DigiMap >& SiStripAPVRestorer::GetSmoothedPoints | ( | ) | [inline] |
Definition at line 41 of file SiStripAPVRestorer.h.
References SmoothedMaps_.
{return SmoothedMaps_;}
void SiStripAPVRestorer::init | ( | const edm::EventSetup & | es | ) |
Definition at line 39 of file SiStripAPVRestorer.cc.
References edm::EventSetup::get(), noise_cache_id, noiseHandle, quality_cache_id, and qualityHandle.
{ uint32_t n_cache_id = es.get<SiStripNoisesRcd>().cacheIdentifier(); uint32_t q_cache_id = es.get<SiStripQualityRcd>().cacheIdentifier(); if(n_cache_id != noise_cache_id) { es.get<SiStripNoisesRcd>().get( noiseHandle ); noise_cache_id = n_cache_id; } else { noise_cache_id = n_cache_id; } if(q_cache_id != quality_cache_id) { es.get<SiStripQualityRcd>().get( qualityHandle ); quality_cache_id = q_cache_id; }else { quality_cache_id = q_cache_id; } }
int16_t SiStripAPVRestorer::inspect | ( | const uint32_t & | detId, |
std::vector< int16_t > & | digis, | ||
const std::vector< std::pair< short, float > > & | vmedians | ||
) |
Definition at line 60 of file SiStripAPVRestorer.cc.
References AbnormalBaselineInspect(), apvFlags_, BaselineAndSaturationInspect(), BaselineFollowerInspect(), BaselineMap_, detId_, Exception, i, InspectAlgo_, median_, NullInspect(), and SmoothedMaps_.
{ detId_ = detId; apvFlags_.clear(); median_.clear(); SmoothedMaps_.clear(); BaselineMap_.erase(BaselineMap_.begin(), BaselineMap_.end()); for(size_t i=0; i< vmedians.size(); ++i) median_.push_back(vmedians[i].second); if(InspectAlgo_=="BaselineFollower") return this->BaselineFollowerInspect(digis); if(InspectAlgo_=="AbnormalBaseline") return this->AbnormalBaselineInspect(digis); if(InspectAlgo_=="Null") return this->NullInspect(digis); if(InspectAlgo_=="BaselineAndSaturation") return this->BaselineAndSaturationInspect(digis); throw cms::Exception("Unregistered Inspect Algorithm") << "SiStripAPVRestorer possibilities: (Null), (AbnormalBaseline),(BaselineFollower)"; }
void SiStripAPVRestorer::LoadMeanCMMap | ( | edm::Event & | iEvent | ) |
Definition at line 578 of file SiStripAPVRestorer.cc.
References CreateCMMap(), edm::Event::getByLabel(), inputTag_, and useRealMeanCM_.
{ if(useRealMeanCM_){ edm::Handle< edm::DetSetVector<SiStripProcessedRawDigi> > inputCM; iEvent.getByLabel(inputTag_,inputCM); this->CreateCMMap(*inputCM); } }
int16_t SiStripAPVRestorer::NullInspect | ( | std::vector< T > & | digis | ) | [inline, private] |
Definition at line 250 of file SiStripAPVRestorer.cc.
References sistrip::APV, apvFlags_, detId_, qualityHandle, RestoreAlgo_, and restoreThreshold_.
Referenced by inspect().
{ SiStripQuality::Range detQualityRange = qualityHandle->getRange(detId_); typename std::vector<T>::iterator fs; int16_t nAPVflagged = 0; for( uint16_t APV=0; APV< digis.size()/128; ++APV){ int zeroCount = 0, qualityCount = 0; for (uint16_t istrip=APV*128; istrip<(APV+1)*128; ++istrip){ fs = digis.begin() + istrip; if ( !qualityHandle->IsStripBad(detQualityRange,istrip) ){ qualityCount++; if ( (int) *fs < 1 ) zeroCount++; } } if( zeroCount > restoreThreshold_ * qualityCount ) { apvFlags_.push_back( RestoreAlgo_ ); //specify any algo to make the restore nAPVflagged++; } else { apvFlags_.push_back( "" ); } } return nAPVflagged; }
float SiStripAPVRestorer::pairMedian | ( | std::vector< std::pair< float, float > > & | ) | [private] |
void SiStripAPVRestorer::restore | ( | std::vector< int16_t > & | digis | ) |
Definition at line 80 of file SiStripAPVRestorer.cc.
References sistrip::APV, apvFlags_, BaselineFollowerRestore(), Exception, FlatRestore(), ForceNoRestore_, median_, RestoreAlgo_, and SelfSelectRestoreAlgo_.
{ if(ForceNoRestore_) return; for( uint16_t APV=0; APV< digis.size()/128; ++APV){ std::string algoToUse = *( apvFlags_.begin() + APV ); if ( algoToUse != ""){ if(!SelfSelectRestoreAlgo_) algoToUse = RestoreAlgo_; if(algoToUse=="Flat"){ this->FlatRestore(digis, APV); }else if(algoToUse=="BaselineFollower"){ this->BaselineFollowerRestore(digis, APV, median_[APV]); // }else if(algoToUse=="IterativeMedian"){ //this->IterativeMedian(digis, APV); }else{ throw cms::Exception("Unregistered Restore Algorithm") << "SiStripAPVRestorer possibilities: (Flat), (BaselineFollower)"; } } } }
friend class SiStripRawProcessingFactory [friend] |
Definition at line 29 of file SiStripAPVRestorer.h.
std::vector<std::string> SiStripAPVRestorer::apvFlags_ [private] |
Definition at line 72 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect(), BaselineAndSaturationInspect(), BaselineFollowerInspect(), fixAPVsCM(), inspect(), NullInspect(), restore(), and SiStripAPVRestorer().
RawDigiMap SiStripAPVRestorer::BaselineMap_ [private] |
Definition at line 75 of file SiStripAPVRestorer.h.
Referenced by BaselineFollowerRestore(), FlatRestore(), GetBaselineMap(), inspect(), and SiStripAPVRestorer().
uint32_t SiStripAPVRestorer::consecThreshold_ [private] |
Definition at line 100 of file SiStripAPVRestorer.h.
Referenced by FlatRegionsFinder().
double SiStripAPVRestorer::CutToAvoidSignal_ [private] |
Definition at line 105 of file SiStripAPVRestorer.h.
uint32_t SiStripAPVRestorer::DeltaCMThreshold_ [private] |
Definition at line 97 of file SiStripAPVRestorer.h.
Referenced by BaselineAndSaturationInspect(), and BaselineFollowerInspect().
uint32_t SiStripAPVRestorer::detId_ [private] |
Definition at line 78 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect(), BaselineAndSaturationInspect(), BaselineFollowerInspect(), CreateCMMap(), FlatRegionsFinder(), inspect(), and NullInspect().
uint32_t SiStripAPVRestorer::deviation_ [private] |
Definition at line 95 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect().
uint32_t SiStripAPVRestorer::distortionThreshold_ [private] |
Definition at line 104 of file SiStripAPVRestorer.h.
Referenced by FlatRegionsFinder().
bool SiStripAPVRestorer::ForceNoRestore_ [private] |
Definition at line 84 of file SiStripAPVRestorer.h.
Referenced by restore().
double SiStripAPVRestorer::fraction_ [private] |
Definition at line 94 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect().
uint32_t SiStripAPVRestorer::hitStripThreshold_ [private] |
Definition at line 101 of file SiStripAPVRestorer.h.
Referenced by FlatRegionsFinder().
edm::InputTag SiStripAPVRestorer::inputTag_ [private] |
Definition at line 81 of file SiStripAPVRestorer.h.
Referenced by LoadMeanCMMap().
std::string SiStripAPVRestorer::InspectAlgo_ [private] |
Definition at line 86 of file SiStripAPVRestorer.h.
Referenced by inspect().
CMMap SiStripAPVRestorer::MeanCMmap_ [private] |
Definition at line 80 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect(), BaselineAndSaturationInspect(), BaselineFollowerInspect(), and CreateCMMap().
std::vector<float> SiStripAPVRestorer::median_ [private] |
Definition at line 73 of file SiStripAPVRestorer.h.
Referenced by BaselineAndSaturationInspect(), BaselineFollowerInspect(), inspect(), restore(), and SiStripAPVRestorer().
uint32_t SiStripAPVRestorer::minStripsToFit_ [private] |
Definition at line 103 of file SiStripAPVRestorer.h.
Referenced by BaselineFollower().
uint32_t SiStripAPVRestorer::noise_cache_id [private] |
Definition at line 70 of file SiStripAPVRestorer.h.
Referenced by init().
Definition at line 69 of file SiStripAPVRestorer.h.
Referenced by FlatRegionsFinder(), and init().
uint32_t SiStripAPVRestorer::nSaturatedStrip_ [private] |
Definition at line 106 of file SiStripAPVRestorer.h.
Referenced by BaselineAndSaturationInspect().
uint32_t SiStripAPVRestorer::nSigmaNoiseDerTh_ [private] |
Definition at line 99 of file SiStripAPVRestorer.h.
Referenced by FlatRegionsFinder().
uint32_t SiStripAPVRestorer::nSmooth_ [private] |
Definition at line 102 of file SiStripAPVRestorer.h.
Referenced by FlatRegionsFinder().
uint32_t SiStripAPVRestorer::quality_cache_id [private] |
Definition at line 67 of file SiStripAPVRestorer.h.
Referenced by init().
Definition at line 66 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect(), BaselineAndSaturationInspect(), BaselineFollowerInspect(), init(), and NullInspect().
std::string SiStripAPVRestorer::RestoreAlgo_ [private] |
Definition at line 87 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect(), NullInspect(), and restore().
double SiStripAPVRestorer::restoreThreshold_ [private] |
Definition at line 96 of file SiStripAPVRestorer.h.
Referenced by NullInspect().
bool SiStripAPVRestorer::SelfSelectRestoreAlgo_ [private] |
Definition at line 85 of file SiStripAPVRestorer.h.
Referenced by restore().
std::vector< DigiMap > SiStripAPVRestorer::SmoothedMaps_ [private] |
Definition at line 74 of file SiStripAPVRestorer.h.
Referenced by BaselineFollowerInspect(), BaselineFollowerRestore(), GetSmoothedPoints(), inspect(), and SiStripAPVRestorer().
bool SiStripAPVRestorer::useRealMeanCM_ [private] |
Definition at line 88 of file SiStripAPVRestorer.h.
Referenced by AbnormalBaselineInspect(), BaselineAndSaturationInspect(), BaselineFollowerInspect(), and LoadMeanCMMap().