Algorithm for scope mode data. More...
#include <DaqScopeModeAlgorithm.h>
Public Member Functions | |
DaqScopeModeAlgorithm (const edm::ParameterSet &pset, DaqScopeModeAnalysis *const ) | |
const float & | entries () const |
const Histo & | histo () const |
const float & | max () const |
const float & | mean () const |
const float & | median () const |
const float & | min () const |
const float & | mode () const |
const float & | rms () const |
virtual | ~DaqScopeModeAlgorithm () |
Private Member Functions | |
void | analyse () |
DaqScopeModeAlgorithm () | |
void | extract (const std::vector< TH1 * > &) |
Private Attributes | |
Histo | histo_ |
Algorithm for scope mode data.
Definition at line 16 of file DaqScopeModeAlgorithm.h.
DaqScopeModeAlgorithm::DaqScopeModeAlgorithm | ( | const edm::ParameterSet & | pset, |
DaqScopeModeAnalysis * const | anal | ||
) |
Definition at line 15 of file DaqScopeModeAlgorithm.cc.
: CommissioningAlgorithm(anal), histo_(0,"") {;}
virtual DaqScopeModeAlgorithm::~DaqScopeModeAlgorithm | ( | ) | [inline, virtual] |
Definition at line 22 of file DaqScopeModeAlgorithm.h.
{;}
DaqScopeModeAlgorithm::DaqScopeModeAlgorithm | ( | ) | [inline, private] |
Definition at line 36 of file DaqScopeModeAlgorithm.h.
{;}
void DaqScopeModeAlgorithm::analyse | ( | ) | [private, virtual] |
Performs histogram anaylsis.
Implements CommissioningAlgorithm.
Definition at line 63 of file DaqScopeModeAlgorithm.cc.
References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), relmon_rootfiles_spy::contents, DaqScopeModeAnalysis::entries_, histo_, sistrip::invalid_, DaqScopeModeAnalysis::max_, sistrip::maximum_, DaqScopeModeAnalysis::mean_, median(), DaqScopeModeAnalysis::median_, DaqScopeModeAnalysis::min_, sistrip::mlCommissioning_, DaqScopeModeAnalysis::mode_, pileupCalc::nbins, sistrip::nullPtr_, DaqScopeModeAnalysis::rms_, python::multivaluedict::sort(), mathSSE::sqrt(), tmp, and relativeConstraints::value.
{ if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[DaqScopeModeAlgorithm::" << __func__ << "]" << " NULL pointer to base Analysis object!"; return; } CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>( anal() ); DaqScopeModeAnalysis* anal = dynamic_cast<DaqScopeModeAnalysis*>( tmp ); if ( !anal ) { edm::LogWarning(mlCommissioning_) << "[DaqScopeModeAlgorithm::" << __func__ << "]" << " NULL pointer to derived Analysis object!"; return; } if ( !histo_.first ) { anal->addErrorCode(sistrip::nullPtr_); return; } // Some initialization std::vector<float> median; float max_value = -1. * sistrip::invalid_; float max_contents = -1. * sistrip::invalid_; float sum = 0.; float sum2 = 0.; // Entries, min, mode uint16_t nbins = static_cast<uint16_t>( histo_.first->GetNbinsX() ); for ( uint16_t ibin = 0; ibin < nbins; ibin++ ) { float value = histo_.first->GetBinLowEdge(ibin+1) + histo_.first->GetBinWidth(ibin+1) / 2.; float contents = histo_.first->GetBinContent(ibin+1); //float errors = histo_.first->GetBinError(ibin+1); if ( contents ) { if ( contents > max_contents ) { anal->mode_ = contents; max_contents = contents; } if ( value > max_value ) { max_value = value; } if ( value < anal->min_ ) { anal->min_ = value; } sum += value * contents; sum2 += value * contents* value * contents; median.insert( median.end(), static_cast<uint32_t>(contents), value ); } anal->entries_ += contents; } // Max if ( max_value > -1. * sistrip::maximum_ ) { anal->max_ = max_value; } // Median sort( median.begin(), median.end() ); if ( !median.empty() ) { anal->median_ = median[ median.size()%2 ? median.size()/2 : median.size()/2 ]; } // Mean, rms if ( anal->entries_ ) { sum /= static_cast<float>(anal->entries_); sum2 /= static_cast<float>(anal->entries_); anal->mean_ = sum; if ( sum2 > sum*sum ) { anal->rms_ = sqrt( sum2 - sum*sum ); } } }
const float& DaqScopeModeAlgorithm::entries | ( | ) | const [inline] |
void DaqScopeModeAlgorithm::extract | ( | const std::vector< TH1 * > & | ) | [private, virtual] |
Extracts and organises histograms.
Implements CommissioningAlgorithm.
Definition at line 22 of file DaqScopeModeAlgorithm.cc.
References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::DAQ_SCOPE_MODE, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), histo_, sistrip::mlCommissioning_, sistrip::numberOfHistos_, indexGen::title, and sistrip::unexpectedTask_.
{ if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[DaqScopeModeAlgorithm::" << __func__ << "]" << " NULL pointer to base Analysis object!"; return; } // Check if ( histos.size() != 1 ) { 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 name SiStripHistoTitle title( (*ihis)->GetName() ); if ( title.runType() != sistrip::DAQ_SCOPE_MODE ) { anal()->addErrorCode(sistrip::unexpectedTask_); continue; } // Extract timing histo histo_.first = *ihis; histo_.second = (*ihis)->GetName(); } }
const DaqScopeModeAlgorithm::Histo & DaqScopeModeAlgorithm::histo | ( | ) | const [inline] |
const float& DaqScopeModeAlgorithm::max | ( | ) | const [inline] |
const float& DaqScopeModeAlgorithm::mean | ( | ) | const [inline] |
const float& DaqScopeModeAlgorithm::median | ( | ) | const [inline] |
Referenced by analyse().
const float& DaqScopeModeAlgorithm::min | ( | ) | const [inline] |
const float& DaqScopeModeAlgorithm::mode | ( | ) | const [inline] |
const float& DaqScopeModeAlgorithm::rms | ( | ) | const [inline] |
Histo DaqScopeModeAlgorithm::histo_ [private] |
Histogram of scope mode data.
Definition at line 45 of file DaqScopeModeAlgorithm.h.