ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::AFP_Sync_check Class Reference

#include <AFP_Sync_check.h>

Inheritance diagram for dqm_algorithms::AFP_Sync_check:
Collaboration diagram for dqm_algorithms::AFP_Sync_check:

Public Member Functions

 AFP_Sync_check ()
 ~AFP_Sync_check ()
AFP_Sync_checkclone () override
dqm_core::Result * execute (const std::string &name, const TObject &object, const dqm_core::AlgorithmConfig &config) override
void printDescriptionTo (std::ostream &out) override

Detailed Description

Definition at line 21 of file AFP_Sync_check.h.

Constructor & Destructor Documentation

◆ AFP_Sync_check()

dqm_algorithms::AFP_Sync_check::AFP_Sync_check ( )

Definition at line 22 of file AFP_Sync_check.cxx.

22 {
23 dqm_core::AlgorithmManager::instance().registerAlgorithm( "AFP_Sync_check", this );
24}

◆ ~AFP_Sync_check()

dqm_algorithms::AFP_Sync_check::~AFP_Sync_check ( )

Definition at line 26 of file AFP_Sync_check.cxx.

26 {
27}

Member Function Documentation

◆ clone()

dqm_algorithms::AFP_Sync_check * dqm_algorithms::AFP_Sync_check::clone ( )
override

Definition at line 30 of file AFP_Sync_check.cxx.

30 {
31 return new AFP_Sync_check();
32}

◆ execute()

dqm_core::Result * dqm_algorithms::AFP_Sync_check::execute ( const std::string & name,
const TObject & object,
const dqm_core::AlgorithmConfig & config )
override

Definition at line 35 of file AFP_Sync_check.cxx.

37 {
38 if ( !object.IsA()->InheritsFrom( "TProfile" ) ) {
39 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TProfile" );
40 }
41
42 auto histogram = static_cast<const TProfile*>( &object );
43
44 auto gthreshold = static_cast<uint32_t>( dqm_algorithms::tools::GetFromMap( "FractionBadLBs", config.getGreenThresholds() ) );
45 auto rthreshold = static_cast<uint32_t>( dqm_algorithms::tools::GetFromMap( "FractionBadLBs", config.getRedThresholds() ) );
46 auto dif_limit = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "dif_limit", config.getParameters() ) );
47
48 std::vector<double> bad_errs;
49 std::vector<int> bad_lbs;
50 int nonZerocounter = 0;
51 double percentBadBins = -10.0;
52
53 for (int i = 1; i <= 2000; i++)
54 {
55 if (abs(histogram->GetBinContent(i)) >= dif_limit)
56 {
57 bad_errs.push_back( histogram->GetBinContent(i) );
58 bad_lbs.push_back(i);
59 }
60 if (histogram->GetBinContent(i) != 0)
61 nonZerocounter++;
62 }
63 percentBadBins = double( bad_errs.size() )/double(nonZerocounter)*100;
64
65 auto result = new dqm_core::Result();
66
67 // publish problematic bins
68 result->tags_[ "% Bad bins " ] = percentBadBins;
69 for ( int i = 0; i < int(bad_errs.size()); ++i )
70 {
71 auto tag = ( std::ostringstream() << "LB " << bad_lbs[i] ).str();
72 result->tags_[ tag ] = bad_errs[i];
73 }
74
75 if ( nonZerocounter == 0 )
76 result->status_ = dqm_core::Result::Undefined;
77 else if ( percentBadBins > rthreshold )
78 result->status_ = dqm_core::Result::Red;
79 else if ( percentBadBins > gthreshold )
80 result->status_ = dqm_core::Result::Yellow;
81 else
82 result->status_ = dqm_core::Result::Green;
83
84 return result;
85}
std::string histogram
Definition chains.cxx:52
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
setEventNumber uint32_t
#define IsA
Declare the TObject style functions.

◆ printDescriptionTo()

void dqm_algorithms::AFP_Sync_check::printDescriptionTo ( std::ostream & out)
override

Definition at line 87 of file AFP_Sync_check.cxx.

87 {
88 out << "AFP_Sync_check: Print out fraction of bad bins where module/station is out of synchronization\n"
89 << "Required Parameter: dif_limit: threshold for content of the individual bin to be assumed out of sync" << std::endl;
90}

The documentation for this class was generated from the following files: