ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
dqm_algorithms::CorrelationYX Class Reference

#include <CorrelationYX.h>

Inheritance diagram for dqm_algorithms::CorrelationYX:
Collaboration diagram for dqm_algorithms::CorrelationYX:

Public Member Functions

 CorrelationYX ()
 
virtual ~CorrelationYX ()
 
virtual dqm_core::Algorithm * clone ()
 
virtual dqm_core::Resultexecute (const std::string &name, const TObject &object, const dqm_core::AlgorithmConfig &config)
 
virtual void printDescription (std::ostream &out)
 

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 16 of file DataQuality/dqm_algorithms/dqm_algorithms/CorrelationYX.h.

Constructor & Destructor Documentation

◆ CorrelationYX()

dqm_algorithms::CorrelationYX::CorrelationYX ( )

Definition at line 32 of file DataQuality/dqm_algorithms/src/CorrelationYX.cxx.

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

◆ ~CorrelationYX()

dqm_algorithms::CorrelationYX::~CorrelationYX ( )
virtual

Definition at line 40 of file DataQuality/dqm_algorithms/src/CorrelationYX.cxx.

42  {
43  }

Member Function Documentation

◆ clone()

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

Definition at line 47 of file DataQuality/dqm_algorithms/src/CorrelationYX.cxx.

49  {
50  return new CorrelationYX(*this);
51  }

◆ execute()

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

Definition at line 55 of file DataQuality/dqm_algorithms/src/CorrelationYX.cxx.

57  {
58  const TH1 * histogram;
59 
60  if( object.IsA()->InheritsFrom( "TH1" ) ) {
61  histogram = static_cast<const TH1*>(&object);
62  if (histogram->GetDimension() > 2 ){
63  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
64  }
65  } else {
66  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
67  }
68 
69  int binStart, binEnd;
70  double gmin;
71  double rmin;
72  try {
73  binStart = (int) dqm_algorithms::tools::GetFirstFromMap("BinStart", config.getParameters() );
74  binEnd = (int) dqm_algorithms::tools::GetFirstFromMap("BinEnd" , config.getParameters() );
75  rmin = dqm_algorithms::tools::GetFromMap( "CorrMin", config.getRedThresholds());
76  gmin = dqm_algorithms::tools::GetFromMap( "CorrMin", config.getGreenThresholds() );
77  }
78  catch ( dqm_core::Exception & ex ) {
79  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
80  }
81 
82 
83  double count = 0;
84  double avX = 0;
85  double avY = 0;
86  double avX2 = 0;
87  double avY2 = 0;
88  double avXY = 0;
89  double sdX = 0;
90  double sdY = 0;
91  double correlation=0;
92 
93  int nbiny = histogram -> GetNbinsY();
94  if(binStart>binEnd) {
95  binStart= 1;
96  binEnd = histogram -> GetNbinsX();
97  }
98  int binSize = binEnd-binStart+1;
99 
100  std::vector<double> contents;
101  contents.resize(binSize);
102  for(int i=0;i<binSize;i++) {
103  int binx = binStart+i;
104  contents[i]=0;
105  for ( int j = 1; j <= nbiny; ++j ) {
106  double content= histogram -> GetBinContent(binx,j);
107  contents[i]+=content;
108  for(int k=0; k!=content;k++) {
109  count ++ ;
110  avX += binx ;
111  avY += j ;
112  avX2 += binx*binx ;
113  avY2 += j*j ;
114  avXY += binx*j ;
115  }
116  }
117  }
118 
119  if(count>0) {
120  avX = avX / count;
121  avY = avY / count;
122  avX2 = avX2 / count;
123  avY2 = avY2 / count;
124  avXY = avXY / count;
125  }
126 
127  sdX = std::sqrt(avX2-avX*avX) ;
128  sdY = std::sqrt(avY2-avY*avY) ;
129  if(sdX>0&&sdY>0)correlation=(avXY-avX*avY)/(sdX*sdY);
130 
131 
132  ERS_DEBUG(1,"Number of entries for bins is "<< count );
133  ERS_DEBUG(1,"Correlation biny and binx is "<< correlation );
134  ERS_DEBUG(1,"Green: "<< gmin << " entries; Red: " << rmin << " entries ");
135 
137 
138 
139 
140  if ( correlation >= gmin ) {
141  result->status_ = dqm_core::Result::Green;
142  } else if ( correlation > rmin ) {
143  result->status_ = dqm_core::Result::Yellow;
144  } else {
145  result->status_ = dqm_core::Result::Red;
146  }
147  result->tags_["Correlation"] = correlation;
148 
149 
150  return result;
151  }

◆ printDescription()

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

Definition at line 155 of file DataQuality/dqm_algorithms/src/CorrelationYX.cxx.

157  {
158  std::string message;
159  message += "\n";
160  message += "Algorithm: \"" + m_name + "\"\n";
161  message += "Description: Counts the number of listed bins with entries above CountsTh\n";
162  message += "Parameters: BinStart first bin to be checked (1=first bin)\n";
163  message += " BinEnd last bin to be checked (nbin=last bin)\n";
164  message += " CorrMin minimum correlation Red/Green\n";
165  message += "\n";
166 
167  out << message;
168  }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::CorrelationYX::m_name
private

The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
dqm_algorithms::CorrelationYX::CorrelationYX
CorrelationYX()
Definition: DataQuality/dqm_algorithms/src/CorrelationYX.cxx:33
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ReweightUtils.message
message
Definition: ReweightUtils.py:15
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
grepfile.content
string content
Definition: grepfile.py:56
lumiFormat.i
int i
Definition: lumiFormat.py:92
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
contents
void contents(std::vector< std::string > &keys, TDirectory *td, const std::string &directory, const std::string &pattern, const std::string &path)
Definition: computils.cxx:319
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TH1
Definition: rootspy.cxx:268
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
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
dqm_algorithms::CorrelationYX::m_name
std::string m_name
Definition: DataQuality/dqm_algorithms/dqm_algorithms/CorrelationYX.h:29
histogram
std::string histogram
Definition: chains.cxx:52
fitman.k
k
Definition: fitman.py:528