ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dqi::CountsBinsGreaterThan Class Reference

#include <CountsBinsGreaterThan.h>

Inheritance diagram for dqi::CountsBinsGreaterThan:
Collaboration diagram for dqi::CountsBinsGreaterThan:

Public Member Functions

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

Protected Member Functions

double GetFirstFromMap (const std::string &pname, const std::map< std::string, std::vector< double > > &params)
 
std::vector< double > GetVectorFromMap (const std::string &pname, const std::map< std::string, std::vector< double > > &params)
 
double GetFromMap (const std::string &pname, const std::map< std::string, double > &params)
 

Protected Attributes

std::string name
 

Detailed Description

Definition at line 15 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.h.

Constructor & Destructor Documentation

◆ CountsBinsGreaterThan() [1/2]

dqi::CountsBinsGreaterThan::CountsBinsGreaterThan ( )

Definition at line 32 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

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

◆ CountsBinsGreaterThan() [2/2]

dqi::CountsBinsGreaterThan::CountsBinsGreaterThan ( const CountsBinsGreaterThan other)

Definition at line 40 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

42  : dqm_core::Algorithm(other)
43  , name(other.name)
44  {
45  }

◆ ~CountsBinsGreaterThan()

dqi::CountsBinsGreaterThan::~CountsBinsGreaterThan ( )
virtual

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqi::CountsBinsGreaterThan::clone ( )
virtual

◆ execute()

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

Definition at line 63 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

65  {
66  TH1 * histogram;
67 
68  if( object.IsA()->InheritsFrom( "TH1" ) ) {
69  histogram = (TH1*)&object;
70  if (histogram->GetDimension() > 2 ){
71  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
72  }
73  } else {
74  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
75  }
76 
77  int binStart, binEnd;
78  int CountsTh;
79  int method;
80  double gmin;
81  double rmin;
82  try {
83  binStart = (int) GetFirstFromMap("BinStart", config.getParameters() );
84  binEnd = (int) GetFirstFromMap("BinEnd" , config.getParameters() );
85  CountsTh = (int) GetFirstFromMap("CountsTh", config.getParameters() );
86  rmin = GetFromMap( "NEntries", config.getRedThresholds());
87  gmin = GetFromMap( "NEntries", config.getGreenThresholds() );
88  }
89  catch ( dqm_core::Exception & ex ) {
90  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
91  }
92 
93 
94  double count = 0;
95 
96  int nbinx = histogram -> GetNbinsX();
97  int nbiny = histogram -> GetNbinsY();
98  if(binStart>binEnd) {
99  binStart= 1;
100  binEnd = histogram -> GetNbinsX();
101  }
102  int binSize = binEnd-binStart+1;
103 
104  std::vector<double> contents;
105  contents.resize(binSize);
106  for(int i=0;i<binSize;i++) {
107  int binx = binStart+i;
108  contents[i]=0;
109  for ( int j = 1; j <= nbiny; ++j ) {
110  double content= histogram -> GetBinContent(binx,j);
111  contents[i]+=content;
112  if(content>CountsTh)count++;
113  }
114  }
115 
116 
117  ERS_DEBUG(1,"Number of entries for bins is "<< count );
118  ERS_DEBUG(1,"Green: "<< gmin << " entries; Red: " << rmin << " entries ");
119 
121 
122 
123 
124  if ( count >= gmin ) {
125  result->status_ = dqm_core::Result::Green;
126  } else if ( count > rmin ) {
127  result->status_ = dqm_core::Result::Yellow;
128  } else {
129  result->status_ = dqm_core::Result::Red;
130  }
131  result->tags_["BinsAboveTh"] = count;
132 
133 
134  return result;
135  }

◆ GetFirstFromMap()

double dqi::CountsBinsGreaterThan::GetFirstFromMap ( const std::string &  pname,
const std::map< std::string, std::vector< double > > &  params 
)
protected

Definition at line 160 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

161  {
162  std::map<std::string,std::vector<double> >::const_iterator it = params.find(pname);
163  if ( it != params.end() && it->second.size() ){
164  return it->second[0];
165  }else {
166  throw dqm_core::BadConfig( ERS_HERE, "None", pname );
167  }
168  }

◆ GetFromMap()

double dqi::CountsBinsGreaterThan::GetFromMap ( const std::string &  pname,
const std::map< std::string, double > &  params 
)
protected

Definition at line 180 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

181  {
182  std::map<std::string,double>::const_iterator it = params.find( pname );
183  if ( it != params.end() ){
184  return it->second;
185  }else {
186  throw dqm_core::BadConfig( ERS_HERE, "None", pname );
187  }
188  }

◆ GetVectorFromMap()

std::vector< double > dqi::CountsBinsGreaterThan::GetVectorFromMap ( const std::string &  pname,
const std::map< std::string, std::vector< double > > &  params 
)
protected

Definition at line 170 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

171  {
172  std::map<std::string,std::vector<double> >::const_iterator it = params.find(pname);
173  if ( it != params.end() && it->second.size() ){
174  return it->second;
175  }else {
176  throw dqm_core::BadConfig( ERS_HERE, "None", pname );
177  }
178  }

◆ printDescription()

void dqi::CountsBinsGreaterThan::printDescription ( )
virtual

Definition at line 139 of file MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx.

141  {
142  std::string message;
143  message += "\n";
144  message += "Algorithm: \"" + name + "\"\n";
145  message += "Description: Counts the number of listed bins with entries above CountsTh\n";
146  message += "Parameters: BinStart first bin to be checked (1=first bin)\n";
147  message += " BinEnd last bin to be checked (nbin=last bin)\n";
148  message += " CountsTh thresholds on bin counts \n";
149  message += " Nentries Red/Green";
150  message += "\n";
151 
152  std::cout << message;
153  }

Member Data Documentation

◆ name

std::string dqi::CountsBinsGreaterThan::name
protected

The documentation for this class was generated from the following files:
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
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
skel.it
it
Definition: skel.GENtoEVGEN.py:396
dqi::CountsBinsGreaterThan::name
std::string name
Definition: MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.h:33
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:85
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:320
python.handimod.Red
Red
Definition: handimod.py:551
dqi::CountsBinsGreaterThan::GetFromMap
double GetFromMap(const std::string &pname, const std::map< std::string, double > &params)
Definition: MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx:180
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
dqi::CountsBinsGreaterThan::CountsBinsGreaterThan
CountsBinsGreaterThan()
Definition: MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx:33
dqi::CountsBinsGreaterThan::GetFirstFromMap
double GetFirstFromMap(const std::string &pname, const std::map< std::string, std::vector< double > > &params)
Definition: MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/dqmfAlgs/CountsBinsGreaterThan.cxx:160
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
histogram
std::string histogram
Definition: chains.cxx:52