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

#include <ZDCTestConstantVsLB.h>

Inheritance diagram for dqm_algorithms::ZDCTestConstantVsLB:
Collaboration diagram for dqm_algorithms::ZDCTestConstantVsLB:

Public Member Functions

 ZDCTestConstantVsLB ()
virtual ~ZDCTestConstantVsLB ()
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)

Protected Attributes

std::string m_name

Detailed Description

Definition at line 16 of file ZDCTestConstantVsLB.h.

Constructor & Destructor Documentation

◆ ZDCTestConstantVsLB()

dqm_algorithms::ZDCTestConstantVsLB::ZDCTestConstantVsLB ( )

Definition at line 43 of file ZDCTestConstantVsLB.cxx.

45 : m_name("ZDCTestConstantVsLB")
46 {
47 dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
48 }

◆ ~ZDCTestConstantVsLB()

dqm_algorithms::ZDCTestConstantVsLB::~ZDCTestConstantVsLB ( )
virtual

Definition at line 51 of file ZDCTestConstantVsLB.cxx.

53 {
54 }

Member Function Documentation

◆ clone()

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

Definition at line 58 of file ZDCTestConstantVsLB.cxx.

◆ execute()

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

Definition at line 66 of file ZDCTestConstantVsLB.cxx.

68 {
69 //No status flags are set
70 dqm_core::Result* result = new dqm_core::Result();
71 result->status_ = dqm_core::Result::Undefined;
72 const TH2 * histogram;
73
74 if( object.IsA()->InheritsFrom( "TH2" ) ) {
75 histogram = static_cast<const TH2*>(&object);
76 if (histogram->GetDimension() > 2 ){
77 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
78 }
79 } else {
80 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2" );
81 }
82
83 TProfile *profile = histogram->ProfileX();
84 TH1 *projection = histogram->ProjectionX("projection");
85 int Xbins = histogram->GetXaxis()->GetNbins();
86
87 float minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), 100);
88 float NsigYellow = dqm_algorithms::tools::GetFirstFromMap( "NsigYellow", config.getParameters(), 5);
89 float NsigMultRed = dqm_algorithms::tools::GetFirstFromMap( "NsigMultRed", config.getParameters(), 10);
90
91 bool redflag = false;
92 bool yellowflag = false;
93 bool greenflag = true; // if nothing goes wrong, return green
94
95 TGraphErrors* ge = new TGraphErrors;
96 int nge =0;
97 for (int ilb = 0; ilb<Xbins ;ilb++)
98 {
99 if (projection->GetBinContent(ilb+1) >= minstat)
100 {
101 ge->SetPoint(nge,ilb,profile->GetBinContent(ilb+1));
102 ge->SetPointError(nge,ilb,profile->GetBinError(ilb+1));
103 nge++;
104 }
105 }
106
107 TFitResultPtr fit_res = ge->Fit("pol0","QNS0");
108 if (!fit_res.Get())
109 {
110 result->status_ = dqm_core::Result::Yellow;
111 return result;
112 }
113
114 double mean = fit_res->Value(0);
115
116 std::vector<int> yellowLBs;
117 std::vector<double> yellowR;
118 for (int ip = 0; ip<ge->GetN() ;ip++)
119 {
120 double x,y;
121 ge->GetPoint(ip,x,y);
122 double ey = ge->GetErrorY(ip);
123 double r = TMath::Abs(( y - mean ) / ey); // number of sigma from const mean, use only pointwise error
124 if (r>NsigYellow)
125 {
126 yellowflag = true;
127 yellowLBs.push_back(x); // store LB
128 yellowR.push_back(r); // store R
129 }
130 }
131
132 for (size_t iy=0;iy<yellowLBs.size();iy++)
133 {
134 int LB = yellowLBs.at(iy);
135 double R = yellowR.at(iy);
136 char ctag[256];
137 sprintf(ctag,"Bad LB %d with R", LB);
138 result->tags_[ctag] = R;
139 }
140
141 if (yellowLBs.size() > NsigMultRed)
142 {
143 redflag = true;
144 }
145
146 if (redflag)
147 {
148 result->status_ = dqm_core::Result::Red;
149 }
150 else if (yellowflag)
151 {
152 result->status_ = dqm_core::Result::Yellow;
153 }
154 else if (greenflag)
155 {
156 result->status_ = dqm_core::Result::Green;
157 }
158
159 return result;
160 }
#define y
#define x
std::string histogram
Definition chains.cxx:52
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
int r
Definition globals.cxx:22
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
#define IsA
Declare the TObject style functions.

◆ printDescription()

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

Definition at line 29 of file ZDCTestConstantVsLB.cxx.

31 {
32 std::string message;
33 message += "\n";
34 message += "Algorithm: \"" + m_name + "\"\n";
35 message += "Description: Calculates the mean of the LB dependence\n";
36 message += "A constant fit is performed, for bins with minimum statistics, and outliers are reported. Yellow is for any 5 sigma deviations, red is for 10 or more\n";
37 message += " Overflow (and Underflow) bins are not included\n";
38 message += "\n";
39
40 out << message;
41 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::ZDCTestConstantVsLB::m_name
protected

Definition at line 30 of file ZDCTestConstantVsLB.h.


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