Histogram-based analysis for VPSP scan. More...
#include <VpspScanAlgorithm.h>
Public Member Functions | |
const Histo & | histo (const uint16_t &apv) const |
VpspScanAlgorithm (const edm::ParameterSet &pset, VpspScanAnalysis *const ) | |
virtual | ~VpspScanAlgorithm () |
Private Member Functions | |
void | analyse () |
void | extract (const std::vector< TH1 * > &) |
VpspScanAlgorithm () | |
Private Attributes | |
std::vector< Histo > | histos_ |
Histogram-based analysis for VPSP scan.
Definition at line 16 of file VpspScanAlgorithm.h.
VpspScanAlgorithm::VpspScanAlgorithm | ( | const edm::ParameterSet & | pset, |
VpspScanAnalysis * const | anal | ||
) |
Definition at line 17 of file VpspScanAlgorithm.cc.
: CommissioningAlgorithm(anal), histos_( 2, Histo(0,"") ) {;}
virtual VpspScanAlgorithm::~VpspScanAlgorithm | ( | ) | [inline, virtual] |
Definition at line 22 of file VpspScanAlgorithm.h.
{;}
VpspScanAlgorithm::VpspScanAlgorithm | ( | ) | [inline, private] |
Definition at line 29 of file VpspScanAlgorithm.h.
{;}
void VpspScanAlgorithm::analyse | ( | ) | [private, virtual] |
Performs histogram anaysis.
Implements CommissioningAlgorithm.
Definition at line 76 of file VpspScanAlgorithm.cc.
References VpspScanAnalysis::adcLevel_, CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), VpspScanAnalysis::bottomEdge_, VpspScanAnalysis::bottomLevel_, first, VpspScanAnalysis::fraction_, mergeVDriftHistosByStation::histos, histos_, sistrip::invalid_, gen::k, prof2calltree::last, sistrip::mlCommissioning_, sistrip::noBaselineLevel_, sistrip::noBottomPlateau_, sistrip::noTopPlateau_, sistrip::noVpspSetting_, sistrip::nullPtr_, tmp, VpspScanAnalysis::topEdge_, VpspScanAnalysis::topLevel_, sistrip::valid_, and VpspScanAnalysis::vpsp_.
{ if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[VpspScanAlgorithm::" << __func__ << "]" << " NULL pointer to base Analysis object!"; return; } CommissioningAnalysis* tmp = const_cast<CommissioningAnalysis*>( anal() ); VpspScanAnalysis* anal = dynamic_cast<VpspScanAnalysis*>( tmp ); if ( !anal ) { edm::LogWarning(mlCommissioning_) << "[VpspScanAlgorithm::" << __func__ << "]" << " NULL pointer to derived Analysis object!"; return; } // from deprecated() std::vector<const TProfile*> histos; std::vector<uint16_t> monitorables; for ( uint16_t iapv = 0; iapv < 2; iapv++ ) { monitorables.clear(); monitorables.resize( 7, sistrip::invalid_ ); histos.clear(); histos.push_back( const_cast<const TProfile*>( dynamic_cast<TProfile*>(histos_[iapv].first) ) ); if ( !histos[0] ) { anal->addErrorCode(sistrip::nullPtr_); continue; } // Find "top" plateau int first = sistrip::invalid_; float top = -1. * sistrip::invalid_;; for ( int k = 5; k < 55; k++ ) { if ( !histos[0]->GetBinEntries(k) ) { continue; } if ( histos[0]->GetBinContent(k) >= top ) { first = k; top = histos[0]->GetBinContent(k); } } if ( top < -1. * sistrip::valid_ ) { top = sistrip::invalid_; } //@@ just want +ve invalid number here if ( top > 1. * sistrip::valid_ ) { anal->addErrorCode(sistrip::noTopPlateau_); continue; } monitorables[5] = static_cast<uint16_t>(top); monitorables[3] = first; // Find "bottom" plateau int last = sistrip::invalid_; float bottom = 1. * sistrip::invalid_; for ( int k = 55; k > 5; k-- ) { if ( !histos[0]->GetBinEntries(k) ) { continue; } if ( histos[0]->GetBinContent(k) <= bottom ) { last = k; bottom = histos[0]->GetBinContent(k); } } if ( bottom > 1. * sistrip::valid_ ) { anal->addErrorCode(sistrip::noBottomPlateau_); continue; } monitorables[6] = static_cast<uint16_t>(bottom); monitorables[4] = last; // Set optimum baseline level float opt = bottom + ( top - bottom ) * 1./3.; monitorables[1] = static_cast<uint16_t>(opt); // Find optimum VPSP setting uint16_t vpsp = sistrip::invalid_; if ( opt < 1. * sistrip::valid_ ) { uint16_t ivpsp = 5; for ( ; ivpsp < 55; ivpsp++ ) { if ( histos[0]->GetBinContent(ivpsp) < opt ) { break; } } if ( ivpsp != 54 ) { vpsp = ivpsp; monitorables[0] = vpsp; } else { anal->addErrorCode(sistrip::noVpspSetting_); continue; } } else { anal->addErrorCode(sistrip::noBaselineLevel_); continue; } // Set analysis results for both APVs anal->vpsp_[iapv] = monitorables[0]; anal->adcLevel_[iapv] = monitorables[1]; anal->fraction_[iapv] = monitorables[2]; anal->topEdge_[iapv] = monitorables[3]; anal->bottomEdge_[iapv] = monitorables[4]; anal->topLevel_[iapv] = monitorables[5]; anal->bottomLevel_[iapv] = monitorables[6]; } }
void VpspScanAlgorithm::extract | ( | const std::vector< TH1 * > & | histos | ) | [private, virtual] |
Extracts and organises histograms.
Implements CommissioningAlgorithm.
Definition at line 24 of file VpspScanAlgorithm.cc.
References CommissioningAnalysis::addErrorCode(), CommissioningAlgorithm::anal(), sistrip::apv_, CommissioningAlgorithm::extractFedKey(), CommissioningAnalysis::fedKey(), histos_, sistrip::invalid_, sistrip::mlCommissioning_, sistrip::numberOfHistos_, indexGen::title, sistrip::unexpectedExtraInfo_, sistrip::unexpectedTask_, and sistrip::VPSP_SCAN.
{ if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[VpspScanAlgorithm::" << __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 pointer if ( !(*ihis) ) { continue; } // Check name SiStripHistoTitle title( (*ihis)->GetName() ); if ( title.runType() != sistrip::VPSP_SCAN ) { anal()->addErrorCode(sistrip::unexpectedTask_); continue; } // Extract APV number uint16_t apv = sistrip::invalid_; if ( title.extraInfo().find(sistrip::apv_) != std::string::npos ) { std::stringstream ss; ss << title.extraInfo().substr( title.extraInfo().find(sistrip::apv_) + (sizeof(sistrip::apv_) - 1), 1 ); ss >> std::dec >> apv; } if ( apv <= 1 ) { histos_[apv].first = *ihis; histos_[apv].second = (*ihis)->GetName(); } else { anal()->addErrorCode(sistrip::unexpectedExtraInfo_); } } }
const Histo& VpspScanAlgorithm::histo | ( | const uint16_t & | apv | ) | const |
Histogram pointer and title.
std::vector<Histo> VpspScanAlgorithm::histos_ [private] |
Pointers and titles for histograms.
Definition at line 40 of file VpspScanAlgorithm.h.