ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
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::Resultexecute (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.

60  {
61  return new ZDCTestConstantVsLB(*this);
62  }

◆ 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
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  }

◆ 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:
beamspotman.r
def r
Definition: beamspotman.py:676
Undefined
@ Undefined
Definition: MaterialTypes.h:8
mean
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="")
Definition: dependence.cxx:254
get_generator_info.result
result
Definition: get_generator_info.py:21
CaloCellTimeCorrFiller.LB
LB
Definition: CaloCellTimeCorrFiller.py:37
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
checkCorrelInHIST.ilb
ilb
Definition: checkCorrelInHIST.py:563
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
x
#define x
ReweightUtils.message
message
Definition: ReweightUtils.py:15
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
dqm_algorithms::ZDCTestConstantVsLB::ZDCTestConstantVsLB
ZDCTestConstantVsLB()
Definition: ZDCTestConstantVsLB.cxx:44
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
python.handimod.Green
int Green
Definition: handimod.py:524
LArG4ValidationPlotter.profile
profile
Definition: LArG4ValidationPlotter.py:113
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
dqm_algorithms::ZDCTestConstantVsLB::m_name
std::string m_name
Definition: ZDCTestConstantVsLB.h:30
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
y
#define y
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
histogram
std::string histogram
Definition: chains.cxx:52