ATLAS Offline Software
Public Member Functions | List of all members
dqm_algorithms::BinsFilledOutRange Struct Reference

#include <BinsFilledOutRange.h>

Inheritance diagram for dqm_algorithms::BinsFilledOutRange:
Collaboration diagram for dqm_algorithms::BinsFilledOutRange:

Public Member Functions

 BinsFilledOutRange ()
 
 ~BinsFilledOutRange ()
 
BinsFilledOutRangeclone ()
 
dqm_core::Resultexecute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
 
void printDescription (std::ostream &out)
 

Detailed Description

Definition at line 18 of file BinsFilledOutRange.h.

Constructor & Destructor Documentation

◆ BinsFilledOutRange()

dqm_algorithms::BinsFilledOutRange::BinsFilledOutRange ( )

Definition at line 24 of file BinsFilledOutRange.cxx.

25 {
26  dqm_core::AlgorithmManager::instance().registerAlgorithm( "BinsFilledOutRange", this );
27 }

◆ ~BinsFilledOutRange()

dqm_algorithms::BinsFilledOutRange::~BinsFilledOutRange ( )

Definition at line 29 of file BinsFilledOutRange.cxx.

30 {
31 }

Member Function Documentation

◆ clone()

dqm_algorithms::BinsFilledOutRange * dqm_algorithms::BinsFilledOutRange::clone ( )

Definition at line 34 of file BinsFilledOutRange.cxx.

35 {
36  return new BinsFilledOutRange();
37 }

◆ execute()

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

Definition at line 41 of file BinsFilledOutRange.cxx.

44 {
45  const TH1 * histogram;
46 
47  if(object.IsA()->InheritsFrom( "TH1" )) {
48  histogram = static_cast<const TH1*>(&object);
49  if (histogram->GetDimension() > 1 ){
50  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 1 " );
51  }
52  } else {
53  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1");
54  }
55 
56 
57  const bool publish = (bool) dqm_algorithms::tools::GetFirstFromMap( "PublishBins", config.getParameters(), 0);
58  const int maxpublish = (int) dqm_algorithms::tools::GetFirstFromMap( "MaxPublish", config.getParameters(), 20);
59  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
60  if (histogram->GetEntries() < minstat ) {
62  result->tags_["InsufficientEntries"] = histogram->GetEntries();
63  return result;
64  }
65 
66  double gthreshold;
67  double rthreshold;
68  try {
69  rthreshold = dqm_algorithms::tools::GetFromMap( "NBins", config.getRedThresholds() );
70  gthreshold = dqm_algorithms::tools::GetFromMap( "NBins", config.getGreenThresholds() );
71  }
72  catch( dqm_core::Exception & ex ) {
73  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
74  }
75 
76 
77  int count = 0;
78  std::vector<int> range=dqm_algorithms::tools::GetBinRange(histogram, config.getParameters());
79  int nbins=histogram->GetNbinsX();
81  TH1* resulthisto;
82  if (histogram->InheritsFrom("TH2")) {
83  resulthisto=(TH1*)(histogram->Clone());
84  } else if (histogram->InheritsFrom("TH1")) {
85  resulthisto=(TH1*)(histogram->Clone());
86  } else {
87  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
88  }
89 
90  resulthisto->Reset();
91 
92  for ( int i = 1; i < range[0]; ++i ) {
93  double content = histogram -> GetBinContent(i);
94  if ( content !=0 ) {
95  ++count;
96  resulthisto->SetBinContent(i,content);
97  if (publish && count<maxpublish) {
99  }
100  }
101  }
102  for ( int j = range[1]; j <= nbins; ++j ) {
103  double content= histogram -> GetBinContent(j);
104  if ( content != 0 ) {
105  ++count;
106  resulthisto->SetBinContent(j,content);
107  if (publish && count<maxpublish) {
109  }
110  }
111  }
112 
113  ERS_DEBUG(1,"Number of bins with content != 0 is " << count );
114  ERS_DEBUG(1,"Green threshold: "<< gthreshold << " bin(s); Red threshold : " << rthreshold << " bin(s) ");
115 
116 
117  result->tags_["NBins"] = count;
118  result->object_ = (boost::shared_ptr<TObject>)(TObject*)(resulthisto);
119 
120  if (gthreshold > rthreshold) {
121  if ( count >= gthreshold ) {
122  result->status_ = dqm_core::Result::Green;
123  } else if ( count > rthreshold ) {
124  result->status_ = dqm_core::Result::Yellow;
125  } else {
126  result->status_ = dqm_core::Result::Red;
127  }
128  } else {
129  if ( count <= gthreshold ) {
130  result->status_ = dqm_core::Result::Green;
131  } else if ( count < rthreshold ) {
132  result->status_ = dqm_core::Result::Yellow;
133  } else {
134  result->status_ = dqm_core::Result::Red;
135  }
136  }
137 
138  return result;
139 }

◆ printDescription()

void dqm_algorithms::BinsFilledOutRange::printDescription ( std::ostream &  out)

Definition at line 141 of file BinsFilledOutRange.cxx.

142 {
143  out<<"Bins_Filled_OutsideRange: Checks for number of non-empty bins outside bin range\n"<<std::endl;
144 
145  out<<"Mandatory Parameter: xmin: minimum x range"<<std::endl;
146  out<<"Mandatory Parameter: xmax: maximum x range"<<std::endl;
147  out<<"Mandatory Green/Red Threshold: NBins: Number of non-empty bins to give Green/Red result\n"<<std::endl;
148 
149  out<<"Optional Parameter: PublishBins: Save bins which are different from average in Result (set to 1)"<<std::endl;
150  out<<"Optional Parameter: MaxPublish: Max number of bins to save (default 20)"<<std::endl;
151  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
152 }

The documentation for this struct was generated from the following files:
dqm_algorithms::tools::GetBinRange
std::vector< int > GetBinRange(const TH1 *histogram, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:380
Undefined
@ Undefined
Definition: MaterialTypes.h:8
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
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
dqm_algorithms::tools::PublishBin
void PublishBin(const TH1 *histogram, int xbin, int ybin, double content, dqm_core::Result *result)
Definition: AlgorithmHelper.cxx:426
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
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.handimod.Green
int Green
Definition: handimod.py:524
dqm_algorithms::BinsFilledOutRange::BinsFilledOutRange
BinsFilledOutRange()
Definition: BinsFilledOutRange.cxx:24
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
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
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
histogram
std::string histogram
Definition: chains.cxx:52