Commit a49bfd6f authored by Julien Maurer's avatar Julien Maurer
Browse files

Merge branch 'muctpi_SL_DQ_check' into '22.0'

muctpi DQ: add check for missing SL

See merge request atlas/athena!58939
parents d615370b d4c22b5f
......@@ -156,10 +156,13 @@ dir CT {
output = CentralTrigger/MuCTPI/Cand/Expert
hist candSLVsLBBA {
algorithm = check_MUCTPISLAnyHit
}
hist candSLVsLBEC {
algorithm = check_MUCTPISLAnyHit
}
hist candSLVsLBFW {
algorithm = check_MUCTPISLAnyHit
}
hist candVetoFlag_RoiVsSLBA {
}
......@@ -271,6 +274,12 @@ algorithm check_MUCTPISLTiming {
thresh = 0.4
}
algorithm check_MUCTPISLAnyHit {
libname = libdqm_algorithms.so
name = MUCTPISLAnyHit
thresh = 0.1
}
algorithm MUCTPI_Histogram_Not_Empty {
libname = libdqm_algorithms.so
name = Histogram_Not_Empty
......
......@@ -156,10 +156,13 @@ dir CT {
output = CentralTrigger/MuCTPI/Cand/Expert
hist candSLVsLBBA {
algorithm = check_MUCTPISLAnyHit
}
hist candSLVsLBEC {
algorithm = check_MUCTPISLAnyHit
}
hist candSLVsLBFW {
algorithm = check_MUCTPISLAnyHit
}
hist candVetoFlag_RoiVsSLBA {
}
......@@ -271,6 +274,12 @@ algorithm check_MUCTPISLTiming {
thresh = 0.4
}
algorithm check_MUCTPISLAnyHit {
libname = libdqm_algorithms.so
name = MUCTPISLAnyHit
thresh = 0.1
}
algorithm MUCTPI_Histogram_Not_Empty {
libname = libdqm_algorithms.so
name = Histogram_Not_Empty
......
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#ifndef DQM_ALGORITHMS_MUCTPISLANYHIT_H
#define DQM_ALGORITHMS_MUCTPISLANYHIT_H
#include <string>
#include "TObject.h"
#include "dqm_core/Algorithm.h"
namespace dqm_algorithms {
class MUCTPISLAnyHit : public dqm_core::Algorithm {
public:
MUCTPISLAnyHit();
virtual ~MUCTPISLAnyHit() = default;
virtual dqm_core::Algorithm* clone();
virtual dqm_core::Result* execute( const std::string& name, const TObject& data, const dqm_core::AlgorithmConfig& config );
using dqm_core::Algorithm::printDescription;
virtual void printDescription(std::ostream& out);
private:
std::string m_name;
};
} //namespace dqm_algorithms
#endif // DQM_ALGORITHMS_MUCTPISLANYHIT_H
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "dqm_algorithms/MUCTPISLAnyHit.h"
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <TClass.h>
#include <TH1.h>
#include <TH2.h>
#include "dqm_core/exceptions.h"
#include "dqm_core/AlgorithmConfig.h"
#include "dqm_core/AlgorithmManager.h"
#include "dqm_core/Result.h"
#include "dqm_algorithms/tools/AlgorithmHelper.h"
#include "ers/ers.h"
static dqm_algorithms::MUCTPISLAnyHit staticInstance;
namespace dqm_algorithms {
// *********************************************************************
// Public Methods
// *********************************************************************
MUCTPISLAnyHit::MUCTPISLAnyHit()
: m_name("MUCTPISLAnyHit")
{
dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
}
dqm_core::Algorithm*
MUCTPISLAnyHit::clone()
{
return new MUCTPISLAnyHit(*this);
}
dqm_core::Result*
MUCTPISLAnyHit::execute( const std::string& name, const TObject& object, const dqm_core::AlgorithmConfig& config)
{
using namespace std;
TH2 * hist;
//ensure that input histo is 2D
if( object.IsA()->InheritsFrom( "TH2" ) ) {
hist = (TH2*)&object;
if (hist->GetDimension() != 2 ){
throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " );
}
} else {
throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2" );
}
//Get Parameters and Thresholds
double thresh=0.1;
try {
thresh = dqm_algorithms::tools::GetFirstFromMap("thresh", config.getParameters(), 0.1);
}
catch ( dqm_core::Exception & ex ) {
throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
}
//Algo
//project our 2D histogram to 1D (on the y-axis), thus summing up along x
TH1* projection = hist->ProjectionY();
dqm_core::Result* result = new dqm_core::Result();
std::map<std::string,double> tags; //defined in https://gitlab.cern.ch/atlas-tdaq-software/dqm_core/-/blob/master/dqm_core/Result.h
//assume all good, until find a bad one
result->status_ = dqm_core::Result::Green;
uint howmanybad=0;
for(int iBin=0;iBin<projection->GetNbinsX();iBin++)//foreach bin of the projection
{
if( projection->GetBinContent(iBin) < thresh ) //if bin content less than algorithm threshold => bad
{
result->status_ = dqm_core::Result::Yellow;
howmanybad++;
}
}
tags["howmanybad"] = howmanybad;
//set the result tags
result->tags_ = tags;
// Return the result
return result;
}
void
MUCTPISLAnyHit::printDescription(std::ostream& out){
std::string message;
message += "\n";
message += "Algorithm: \"" + m_name + "\"\n";
message += "Description: Makes the ProjectionY of the 2D input histo. If any bin content is below the given threshold => warning.\n";
message += "Optional Parameters: thresh = if any bin content in the ProjectionY is below this value => warning\n";
out << message;
}
} // namespace dqm_algorithms
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment