Histogram-based analysis for pedestal run. More...
#include <PedestalsAlgorithm.h>
Public Member Functions | |
const Histo & | hNoise () const |
const Histo & | hPeds () const |
PedestalsAlgorithm (const edm::ParameterSet &pset, PedestalsAnalysis *const ) | |
virtual | ~PedestalsAlgorithm () |
Private Member Functions | |
void | analyse () |
void | extract (const std::vector< TH1 * > &) |
PedestalsAlgorithm () | |
Private Attributes | |
float | deadStripMax_ |
Histo | hNoise_ |
Histo | hPeds_ |
float | noisyStripMin_ |
Histogram-based analysis for pedestal run.
Definition at line 16 of file PedestalsAlgorithm.h.
PedestalsAlgorithm::PedestalsAlgorithm | ( | const edm::ParameterSet & | pset, |
PedestalsAnalysis * const | anal | ||
) |
Definition at line 16 of file PedestalsAlgorithm.cc.
References deadStripMax_, LogDebug, sistrip::mlCommissioning_, and noisyStripMin_.
: CommissioningAlgorithm(anal), hPeds_(0,""), hNoise_(0,""), deadStripMax_(pset.getParameter<double>("DeadStripMax")), noisyStripMin_(pset.getParameter<double>("NoisyStripMin")) { LogDebug(mlCommissioning_) << "[PedestalsAlgorithm::" << __func__ << "]" << " Set maximum noise deviation for dead strip determination to: " << deadStripMax_; LogDebug(mlCommissioning_) << "[PedestalsAlgorithm::" << __func__ << "]" << " Set minimal noise deviation for noisy strip determination to: " << noisyStripMin_; }
virtual PedestalsAlgorithm::~PedestalsAlgorithm | ( | ) | [inline, virtual] |
Definition at line 22 of file PedestalsAlgorithm.h.
{;}
PedestalsAlgorithm::PedestalsAlgorithm | ( | ) | [inline, private] |
Definition at line 30 of file PedestalsAlgorithm.h.
{;}
void PedestalsAlgorithm::analyse | ( | ) | [private, virtual] |
Performs histogram anaysis.
Implements CommissioningAlgorithm.
Definition at line 93 of file PedestalsAlgorithm.cc.
References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), PedestalsAnalysis::dead_, deadStripMax_, hNoise_, hPeds_, sistrip::invalid_, sistrip::maximum_, sistrip::mlCommissioning_, PedestalsAnalysis::noise_, PedestalsAnalysis::noiseMax_, PedestalsAnalysis::noiseMean_, PedestalsAnalysis::noiseMin_, PedestalsAnalysis::noiseSpread_, PedestalsAnalysis::noisy_, noisyStripMin_, sistrip::nullPtr_, sistrip::numberOfBins_, PedestalsAnalysis::peds_, PedestalsAnalysis::pedsMax_, PedestalsAnalysis::pedsMean_, PedestalsAnalysis::pedsMin_, PedestalsAnalysis::pedsSpread_, PedestalsAnalysis::raw_, PedestalsAnalysis::rawMax_, PedestalsAnalysis::rawMean_, PedestalsAnalysis::rawMin_, PedestalsAnalysis::rawSpread_, mathSSE::sqrt(), strip(), and tmp.
{ if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[PedestalsAlgorithm::" << __func__ << "]" << " NULL pointer to base Analysis object!"; return; } CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>( anal() ); PedestalsAnalysis* anal = dynamic_cast<PedestalsAnalysis*>( tmp ); if ( !anal ) { edm::LogWarning(mlCommissioning_) << "[PedestalsAlgorithm::" << __func__ << "]" << " NULL pointer to derived Analysis object!"; return; } if ( !hPeds_.first ) { anal->addErrorCode(sistrip::nullPtr_); return; } if ( !hNoise_.first ) { anal->addErrorCode(sistrip::nullPtr_); return; } TProfile* peds_histo = dynamic_cast<TProfile*>(hPeds_.first); TProfile* noise_histo = dynamic_cast<TProfile*>(hNoise_.first); if ( !peds_histo ) { anal->addErrorCode(sistrip::nullPtr_); return; } if ( !noise_histo ) { anal->addErrorCode(sistrip::nullPtr_); return; } if ( peds_histo->GetNbinsX() != 256 ) { anal->addErrorCode(sistrip::numberOfBins_); return; } if ( noise_histo->GetNbinsX() != 256 ) { anal->addErrorCode(sistrip::numberOfBins_); return; } // Iterate through APVs for ( uint16_t iapv = 0; iapv < 2; iapv++ ) { // Used to calc mean and rms for peds and noise float p_sum = 0., p_sum2 = 0., p_max = -1.*sistrip::invalid_, p_min = sistrip::invalid_; float n_sum = 0., n_sum2 = 0., n_max = -1.*sistrip::invalid_, n_min = sistrip::invalid_; float r_sum = 0., r_sum2 = 0., r_max = -1.*sistrip::invalid_, r_min = sistrip::invalid_; // Iterate through strips of APV for ( uint16_t istr = 0; istr < 128; istr++ ) { static uint16_t strip; strip = iapv*128 + istr; // Pedestals and raw noise if ( peds_histo ) { if ( peds_histo->GetBinEntries(strip+1) ) { anal->peds_[iapv][istr] = peds_histo->GetBinContent(strip+1); p_sum += anal->peds_[iapv][istr]; p_sum2 += (anal->peds_[iapv][istr] * anal->peds_[iapv][istr]); if ( anal->peds_[iapv][istr] > p_max ) { p_max = anal->peds_[iapv][istr]; } if ( anal->peds_[iapv][istr] < p_min ) { p_min = anal->peds_[iapv][istr]; } anal->raw_[iapv][istr] = peds_histo->GetBinError(strip+1); r_sum += anal->raw_[iapv][istr]; r_sum2 += (anal->raw_[iapv][istr] * anal->raw_[iapv][istr]); if ( anal->raw_[iapv][istr] > r_max ) { r_max = anal->raw_[iapv][istr]; } if ( anal->raw_[iapv][istr] < r_min ) { r_min = anal->raw_[iapv][istr]; } } } // Noise if ( noise_histo ) { if ( noise_histo->GetBinEntries(strip+1) ) { anal->noise_[iapv][istr] = noise_histo->GetBinContent(strip+1); n_sum += anal->noise_[iapv][istr]; n_sum2 += (anal->noise_[iapv][istr] * anal->noise_[iapv][istr]); if ( anal->noise_[iapv][istr] > n_max ) { n_max = anal->noise_[iapv][istr]; } if ( anal->noise_[iapv][istr] < n_min ) { n_min = anal->noise_[iapv][istr]; } } } } // strip loop // Calc mean and rms for peds if ( !anal->peds_[iapv].empty() ) { p_sum /= static_cast<float>( anal->peds_[iapv].size() ); p_sum2 /= static_cast<float>( anal->peds_[iapv].size() ); anal->pedsMean_[iapv] = p_sum; anal->pedsSpread_[iapv] = sqrt( fabs(p_sum2 - p_sum*p_sum) ); } // Calc mean and rms for noise if ( !anal->noise_[iapv].empty() ) { n_sum /= static_cast<float>( anal->noise_[iapv].size() ); n_sum2 /= static_cast<float>( anal->noise_[iapv].size() ); anal->noiseMean_[iapv] = n_sum; anal->noiseSpread_[iapv] = sqrt( fabs(n_sum2 - n_sum*n_sum) ); } // Calc mean and rms for raw noise if ( !anal->raw_[iapv].empty() ) { r_sum /= static_cast<float>( anal->raw_[iapv].size() ); r_sum2 /= static_cast<float>( anal->raw_[iapv].size() ); anal->rawMean_[iapv] = r_sum; anal->rawSpread_[iapv] = sqrt( fabs(r_sum2 - r_sum*r_sum) ); } // Set max and min values for peds, noise and raw noise if ( p_max > -1.*sistrip::maximum_ ) { anal->pedsMax_[iapv] = p_max; } if ( p_min < 1.*sistrip::maximum_ ) { anal->pedsMin_[iapv] = p_min; } if ( n_max > -1.*sistrip::maximum_ ) { anal->noiseMax_[iapv] = n_max; } if ( n_min < 1.*sistrip::maximum_ ) { anal->noiseMin_[iapv] = n_min; } if ( r_max > -1.*sistrip::maximum_ ) { anal->rawMax_[iapv] = r_max; } if ( r_min < 1.*sistrip::maximum_ ) { anal->rawMin_[iapv] = r_min; } // Set dead and noisy strips for ( uint16_t istr = 0; istr < 128; istr++ ) { if ( anal->noiseMin_[iapv] > sistrip::maximum_ || anal->noiseMax_[iapv] > sistrip::maximum_ ) { continue; } if ( anal->noise_[iapv][istr] < ( anal->noiseMean_[iapv] - deadStripMax_ * anal->noiseSpread_[iapv] ) ) { anal->dead_[iapv].push_back(istr); } else if ( anal->noise_[iapv][istr] > ( anal->noiseMean_[iapv] + noisyStripMin_ * anal->noiseSpread_[iapv] ) ) { anal->noisy_[iapv].push_back(istr); } } } // apv loop }
void PedestalsAlgorithm::extract | ( | const std::vector< TH1 * > & | histos | ) | [private, virtual] |
Extracts and organises histograms.
Implements CommissioningAlgorithm.
Definition at line 33 of file PedestalsAlgorithm.cc.
References a, CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::extrainfo::commonMode_, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), hNoise_, hPeds_, PedestalsAnalysis::legacy_, sistrip::mlCommissioning_, sistrip::extrainfo::noise_, sistrip::numberOfHistos_, sistrip::PEDESTALS, sistrip::extrainfo::pedestals_, sistrip::extrainfo::pedsAndCmSubNoise_, sistrip::extrainfo::pedsAndRawNoise_, indexGen::title, sistrip::unexpectedExtraInfo_, and sistrip::unexpectedTask_.
{ if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[PedestalsAlgorithm::" << __func__ << "]" << " NULL pointer to Analysis object!"; return; } // Check number of histograms if ( histos.size() != 2 ) { anal()->addErrorCode(sistrip::numberOfHistos_); } // Extract FED key from histo title if ( !histos.empty() ) { anal()->fedKey( extractFedKey( histos.front() ) ); } // Extract histograms std::vector<TH1*>::const_iterator ihis = histos.begin(); for ( ; ihis != histos.end(); ihis++ ) { // Check for NULL pointer if ( !(*ihis) ) { continue; } // Check run type SiStripHistoTitle title( (*ihis)->GetName() ); if ( title.runType() != sistrip::PEDESTALS ) { anal()->addErrorCode(sistrip::unexpectedTask_); continue; } // Extract peds and noise histos (check for legacy names first!) if ( title.extraInfo().find(sistrip::extrainfo::pedsAndRawNoise_) != std::string::npos ) { hPeds_.first = *ihis; hPeds_.second = (*ihis)->GetName(); PedestalsAnalysis* a = dynamic_cast<PedestalsAnalysis*>( const_cast<CommissioningAnalysis*>( anal() ) ); if ( a ) { a->legacy_ = true; } } else if ( title.extraInfo().find(sistrip::extrainfo::pedsAndCmSubNoise_) != std::string::npos ) { hNoise_.first = *ihis; hNoise_.second = (*ihis)->GetName(); PedestalsAnalysis* a = dynamic_cast<PedestalsAnalysis*>( const_cast<CommissioningAnalysis*>( anal() ) ); if ( a ) { a->legacy_ = true; } } else if ( title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos ) { hPeds_.first = *ihis; hPeds_.second = (*ihis)->GetName(); } else if ( title.extraInfo().find(sistrip::extrainfo::noise_) != std::string::npos ) { hNoise_.first = *ihis; hNoise_.second = (*ihis)->GetName(); } else if ( title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos ) { //@@ something here for CM plots? } else { anal()->addErrorCode(sistrip::unexpectedExtraInfo_); } } }
const PedestalsAlgorithm::Histo & PedestalsAlgorithm::hNoise | ( | ) | const [inline] |
const PedestalsAlgorithm::Histo & PedestalsAlgorithm::hPeds | ( | ) | const [inline] |
float PedestalsAlgorithm::deadStripMax_ [private] |
Analysis parameters
Definition at line 47 of file PedestalsAlgorithm.h.
Referenced by analyse(), and PedestalsAlgorithm().
Histo PedestalsAlgorithm::hNoise_ [private] |
Residuals and noise
Definition at line 44 of file PedestalsAlgorithm.h.
Histo PedestalsAlgorithm::hPeds_ [private] |
float PedestalsAlgorithm::noisyStripMin_ [private] |
Definition at line 48 of file PedestalsAlgorithm.h.
Referenced by analyse(), and PedestalsAlgorithm().