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

#include <MUCTPISLTiming.h>

Inheritance diagram for dqm_algorithms::MUCTPISLTiming:
Collaboration diagram for dqm_algorithms::MUCTPISLTiming:

Public Member Functions

 MUCTPISLTiming ()
virtual ~MUCTPISLTiming ()=default
virtual dqm_core::Algorithm * clone ()
virtual dqm_core::Result * execute (const std::string &name, const TObject &data, const dqm_core::AlgorithmConfig &config)
virtual void printDescription (std::ostream &out)

Private Attributes

std::string m_name

Detailed Description

Definition at line 15 of file MUCTPISLTiming.h.

Constructor & Destructor Documentation

◆ MUCTPISLTiming()

dqm_algorithms::MUCTPISLTiming::MUCTPISLTiming ( )

Definition at line 34 of file MUCTPISLTiming.cxx.

35 : m_name("MUCTPISLTiming")
36{
37 dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
38}

◆ ~MUCTPISLTiming()

virtual dqm_algorithms::MUCTPISLTiming::~MUCTPISLTiming ( )
virtualdefault

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::MUCTPISLTiming::clone ( )
virtual

Definition at line 41 of file MUCTPISLTiming.cxx.

42{
43 return new MUCTPISLTiming(*this);
44}

◆ execute()

dqm_core::Result * dqm_algorithms::MUCTPISLTiming::execute ( const std::string & name,
const TObject & data,
const dqm_core::AlgorithmConfig & config )
virtual

Definition at line 48 of file MUCTPISLTiming.cxx.

49{
50 using namespace std;
51
52 const TH2 * hist;
53 //TH2 * ref; //not using reference in this case
54
55 if( object.IsA()->InheritsFrom( "TH2" ) ) {
56 hist = static_cast<const TH2*>(&object);
57 if (hist->GetDimension() != 2 ){
58 throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " );
59 }
60 } else {
61 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2" );
62 }
63
64 //Get Parameters and Thresholds
65 double thresh=0.5;
66 double minstat=-1;
67 int centralBin=4; // the middle of 7 bins;
68
69 try {
70 thresh = dqm_algorithms::tools::GetFirstFromMap("thresh", config.getParameters(), 0.5);
71 minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
72 }
73 catch ( dqm_core::Exception & ex ) {
74 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
75 }
76
77 //Algo
78
79 //project our 2D histogram to 1D (x-axis), thus summing up along y
80 //will then compare every bin of the projection with the GetBinContent of the central bin in the 2D histo
81 TH1* projection = hist->ProjectionX();
82
83 dqm_core::Result* result = new dqm_core::Result();
84 std::map<std::string,double> tags; //defined in https://gitlab.cern.ch/atlas-tdaq-software/dqm_core/-/blob/master/dqm_core/Result.h
85
86 //assume all good, until find a bad one
87 result->status_ = dqm_core::Result::Green;
88 uint howmanybad=0;
89
90 for(int iBin=1;iBin<=projection->GetNbinsX();iBin++)//0=underflow bin
91 {
92 if( projection->GetBinContent(iBin)*thresh > hist->GetBinContent(iBin,centralBin) ) //if central slice is less than half of SL sum => bad
93 {
94 result->status_ = dqm_core::Result::Yellow;
95 howmanybad++;
96 //add tag to print which bins are actually the "problematic" ones
97 std::string slNum = std::to_string(iBin-1);
98 if(iBin < 10) slNum = "0" + slNum; // leading zero for conformity
99
100 tags[slNum] = hist->GetBinContent(iBin,centralBin)*1.0 / projection->GetBinContent(iBin) ;
101 }
102 }
103 tags["howmanybad"] = howmanybad;
104
105 //set the result tags
106 result->tags_ = std::move(tags);
107
108 //If more than 2SL have bad timing, make it red
109 if(howmanybad>2)
110 result->status_ = dqm_core::Result::Red;
111
112 Double_t stats[7];
113 hist->GetStats(stats);
114 //if not enough stats, reset the result (but keep this here, so can still see the tag for bad SL)
115 if(stats[0]<minstat)
116 result->status_ = dqm_core::Result::Undefined;
117
118 // Return the result
119 return result;
120}
unsigned int uint
std::vector< std::string > tags
Definition hcg.cxx:105
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
#define IsA
Declare the TObject style functions.

◆ printDescription()

void dqm_algorithms::MUCTPISLTiming::printDescription ( std::ostream & out)
virtual

Definition at line 124 of file MUCTPISLTiming.cxx.

124 {
125 std::string message;
126 message += "\n";
127 message += "Algorithm: \"" + m_name + "\"\n";
128 message += "Description: for each SL x-slice (set of y-bins for the same x value) check that the central y bin has at least 'thresh' percent(ratio) of the sum of values in the SL \n";
129 out << message;
130}

Member Data Documentation

◆ m_name

std::string dqm_algorithms::MUCTPISLTiming::m_name
private

Definition at line 27 of file MUCTPISLTiming.h.


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