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

#include <BinsOutOfRange.h>

Inheritance diagram for dqm_algorithms::BinsOutOfRange:
Collaboration diagram for dqm_algorithms::BinsOutOfRange:

Public Member Functions

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

Detailed Description

Definition at line 19 of file BinsOutOfRange.h.

Constructor & Destructor Documentation

◆ BinsOutOfRange()

dqm_algorithms::BinsOutOfRange::BinsOutOfRange ( )

Definition at line 26 of file BinsOutOfRange.cxx.

27 {
28  dqm_core::AlgorithmManager::instance().registerAlgorithm("BinsOutOfRange", this);
29 }

◆ ~BinsOutOfRange()

dqm_algorithms::BinsOutOfRange::~BinsOutOfRange ( )

Definition at line 31 of file BinsOutOfRange.cxx.

32 {
33 }

Member Function Documentation

◆ clone()

dqm_algorithms::BinsOutOfRange * dqm_algorithms::BinsOutOfRange::clone ( )

Definition at line 36 of file BinsOutOfRange.cxx.

37 {
38 
39  return new BinsOutOfRange();
40 }

◆ execute()

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

Definition at line 44 of file BinsOutOfRange.cxx.

47 {
48  const TH1* histogram;
49 
50  if( object.IsA()->InheritsFrom( "TH1" ) ) {
51  histogram = static_cast<const TH1*>(&object);
52  if (histogram->GetDimension() > 2 ){
53  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
54  }
55  } else {
56  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
57  }
58 
59  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
60  const double ignoreval = dqm_algorithms::tools::GetFirstFromMap( "ignoreval", config.getParameters(), -99999);
61  const bool publish = (bool) dqm_algorithms::tools::GetFirstFromMap( "PublishBins", config.getParameters(), 1);
62  const int Nmaxpublish = (int) dqm_algorithms::tools::GetFirstFromMap( "MaxPublish", config.getParameters(), 20);
63  const double RANGE_D = dqm_algorithms::tools::GetFirstFromMap( "RANGE_D", config.getParameters(), -50);
64  const double RANGE_U = dqm_algorithms::tools::GetFirstFromMap( "RANGE_U", config.getParameters(), 50);
65  if ( histogram->GetEntries() < minstat ) {
67  result->tags_["InsufficientEntries"] = histogram->GetEntries();
68  return result;
69  }
70 
71  double gthreshold;
72  double rthreshold;
73  try {
74  rthreshold = dqm_algorithms::tools::GetFromMap( "NbadBins", config.getRedThresholds() );
75  gthreshold = dqm_algorithms::tools::GetFromMap( "NbadBins", config.getGreenThresholds() );
76  }
77  catch( dqm_core::Exception & ex ) {
78  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
79  }
80 
81  std::vector<int> range=dqm_algorithms::tools::GetBinRange(histogram, config.getParameters());
82  std::vector<bin3> badbinstrip;
83  for ( int k = range[0]; k <= range[1]; ++k ) {
84  for ( int l = range[2]; l <= range[3]; ++l ) {
85  double binvalue = histogram->GetBinContent(k,l);
86  if (binvalue== ignoreval) continue;
87  double eta = histogram->GetXaxis()->GetBinCenter(k);
88  double phi = histogram->GetYaxis()->GetBinCenter(l);
89  if(binvalue > RANGE_D && binvalue < RANGE_U ) continue;
90  bin3 onebin = {eta,phi,k,l,binvalue};
91  badbinstrip.push_back(onebin);
92  }
93  }
94 
95  std::sort(badbinstrip.begin(),badbinstrip.end(),mySortfunc);
97 // publish problematic bins
98  int count=0;
99  for(unsigned int i=0;i<badbinstrip.size();i++){
100  if(publish){
101  char tmp[500];
102  sprintf(tmp,"%i-(eta,phi)=(%0.3f,%0.3f)",count,badbinstrip[i].m_eta,badbinstrip[i].m_phi);
103  std::string tag = tmp;
104  result->tags_[tag] = badbinstrip[i].m_value;
105  }
106  count++;
107  if(count>Nmaxpublish) break;
108  }
109 
110  result->tags_["NBadBins"] = count;
111 
112  if(count>rthreshold ) result->status_ = dqm_core::Result::Red;
113  else if (count>gthreshold) result->status_ = dqm_core::Result::Yellow;
114  else result->status_ = dqm_core::Result::Green;
115 
116  return result;
117 
118 }

◆ printDescription()

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

Definition at line 122 of file BinsOutOfRange.cxx.

123 {
124 
125  out<<"BinsOutOfRange: Print out the badbins which are out of range [range_d,range_u] "<<std::endl;
126  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
127  out<<"Optional Parameter: ignoreval: valued to be ignored for being processed"<<std::endl;
128  out<<"Optional Parameter: MaxPublish: Max number of bins to save (default 20)"<<std::endl;
129 
130 }

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
mySortfunc
bool mySortfunc(const bin3 &i, const bin3 &j)
Definition: BinsOutOfRange.cxx:23
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
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
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
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
python.handimod.Red
Red
Definition: handimod.py:551
dqm_algorithms::BinsOutOfRange::BinsOutOfRange
BinsOutOfRange()
Definition: BinsOutOfRange.cxx:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
bin3
Definition: BinsOutOfRange.h:33
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
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
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
fitman.k
k
Definition: fitman.py:528