25 <<
"[ApvLatencyAlgorithm::" << __func__ <<
"]" 26 <<
" NULL pointer to Analysis object!";
31 if ( histos.size() != 1 ) {
39 std::vector<TH1*>::const_iterator ihis = histos.begin();
40 for ( ; ihis != histos.end(); ihis++ ) {
43 if ( !(*ihis) ) {
continue; }
54 histo_.second = (*ihis)->GetName();
66 <<
"[ApvLatencyAlgorithm::" << __func__ <<
"]" 67 <<
" NULL pointer to base Analysis object!";
75 <<
"[ApvLatencyAlgorithm::" << __func__ <<
"]" 76 <<
" NULL pointer to derived Analysis object!";
82 std::vector<const TProfile*>
histos;
83 std::vector<unsigned short> monitorables;
88 histos.push_back( const_cast<const TProfile*>( dynamic_cast<TProfile*>(
histo_.first) ) );
100 if (histos.size() != 1) {
102 monitorables.push_back(0);
105 const TProfile*
histo = histos[0];
110 std::vector<unsigned short> binContent; binContent.reserve((
unsigned short)histo->GetNbinsX()); binContent.resize((
unsigned short)histo->GetNbinsX(), 0);
112 for (
unsigned short k = 0;
k < (
unsigned short)histo->GetNbinsX();
k++) {
115 binContent.push_back((
unsigned int)(histo->GetBinContent(
k)));}
119 sort(binContent.begin(), binContent.end());
123 float meanNoise = 0.;
124 float mean2Noise = 0.;
126 for (
unsigned short k = (
unsigned short)(binContent.size()*.1);
k < (
unsigned short)(binContent.size()*.9);
k++) {
127 meanNoise += binContent[
k];
128 mean2Noise += binContent[
k]*binContent[
k];;
131 meanNoise = meanNoise * binContent.size() * 0.8;
132 mean2Noise = mean2Noise * binContent.size() * 0.8;
133 float sigmaNoise =
sqrt(fabs(meanNoise*meanNoise - mean2Noise));
136 unsigned short count = 0;
137 unsigned short maxlatency = 0;
138 unsigned int maxhits = 0;
140 for (
unsigned short k = 1;
k < ((
unsigned short)histo->GetNbinsX() + 1);
k++) {
141 if (histo->GetBinContent((Int_t)
k) > maxhits) maxlatency = k - 1;
142 if ((
float)histo->GetBinContent((Int_t)k) > (meanNoise + 5 * sigmaNoise)) {
143 latency = k - 1; count++;
149 latency = maxlatency;
154 latency = maxlatency;
158 monitorables.clear();
159 monitorables.push_back(latency);
static const char unexpectedTask_[]
const uint32_t & fedKey() const
Utility class that holds histogram title.
const Histo & histo() const
static const char numberOfHistos_[]
static const char mlCommissioning_[]
uint32_t extractFedKey(const TH1 *const )
virtual void addErrorCode(const std::string &error)
Analysis for APV latency scan.
std::vector< std::vector< double > > tmp
Abstract base for derived classes that provide analysis of commissioning histograms.
void extract(const std::vector< TH1 * > &) override
CommissioningAnalysis *const anal() const
static const char nullPtr_[]