Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AFP_Sync_check.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 #include <dqm_core/AlgorithmManager.h>
9 #include "dqm_core/AlgorithmConfig.h"
10 #include <dqm_core/exceptions.h>
11 
12 #include <TDirectory.h>
13 #include <TH1.h>
14 #include <TH2.h>
15 #include <TProfile.h>
16 #include <TFile.h>
17 
18 namespace {
20 }
21 
23  dqm_core::AlgorithmManager::instance().registerAlgorithm( "AFP_Sync_check", this );
24 }
25 
27 }
28 
31  return new AFP_Sync_check();
32 }
33 
36  const TObject& object,
37  const dqm_core::AlgorithmConfig& config ) {
38  if ( !object.IsA()->InheritsFrom( "TProfile" ) ) {
39  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TProfile" );
40  }
41 
42  auto histogram = static_cast<const TProfile*>( &object );
43 
44  auto gthreshold = static_cast<uint32_t>( dqm_algorithms::tools::GetFromMap( "FractionBadLBs", config.getGreenThresholds() ) );
45  auto rthreshold = static_cast<uint32_t>( dqm_algorithms::tools::GetFromMap( "FractionBadLBs", config.getRedThresholds() ) );
46  auto dif_limit = static_cast<float>( dqm_algorithms::tools::GetFirstFromMap( "dif_limit", config.getParameters() ) );
47 
48  std::vector<double> bad_errs;
49  std::vector<int> bad_lbs;
50  int nonZerocounter = 0;
51  double percentBadBins = -10.0;
52 
53  for (int i = 1; i <= 2000; i++)
54  {
55  if (abs(histogram->GetBinContent(i)) >= dif_limit)
56  {
57  bad_errs.push_back( histogram->GetBinContent(i) );
58  bad_lbs.push_back(i);
59  }
60  if (histogram->GetBinContent(i) != 0)
61  nonZerocounter++;
62  }
63  percentBadBins = double( bad_errs.size() )/double(nonZerocounter)*100;
64 
65  auto result = new dqm_core::Result();
66 
67  // publish problematic bins
68  result->tags_[ "% Bad bins " ] = percentBadBins;
69  for ( int i = 0; i < int(bad_errs.size()); ++i )
70  {
71  auto tag = ( std::ostringstream() << "LB " << bad_lbs[i] ).str();
72  result->tags_[ tag ] = bad_errs[i];
73  }
74 
75  if ( nonZerocounter == 0 )
77  else if ( percentBadBins > rthreshold )
78  result->status_ = dqm_core::Result::Red;
79  else if ( percentBadBins > gthreshold )
80  result->status_ = dqm_core::Result::Yellow;
81  else
83 
84  return result;
85 }
86 
88  out << "AFP_Sync_check: Print out fraction of bad bins where module/station is out of synchronization\n"
89  << "Required Parameter: dif_limit: threshold for content of the individual bin to be assumed out of sync" << std::endl;
90 }
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
dqm_algorithms::AFP_Sync_check
Definition: AFP_Sync_check.h:21
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
dqm_algorithms::AFP_Sync_check::AFP_Sync_check
AFP_Sync_check()
Definition: AFP_Sync_check.cxx:22
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
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.CaloAddPedShiftConfig.str
str
Definition: CaloAddPedShiftConfig.py:42
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
AFP_Sync_check.h
python.handimod.Green
int Green
Definition: handimod.py:524
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
dqm_algorithms::AFP_Sync_check::execute
dqm_core::Result * execute(const std::string &name, const TObject &object, const dqm_core::AlgorithmConfig &config) override
Definition: AFP_Sync_check.cxx:35
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
dqm_algorithms::AFP_Sync_check::~AFP_Sync_check
~AFP_Sync_check()
Definition: AFP_Sync_check.cxx:26
dqm_algorithms::AFP_Sync_check::printDescriptionTo
void printDescriptionTo(std::ostream &out) override
Definition: AFP_Sync_check.cxx:87
AlgorithmHelper.h
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
dqm_algorithms::AFP_Sync_check::clone
AFP_Sync_check * clone() override
Definition: AFP_Sync_check.cxx:30
histogram
std::string histogram
Definition: chains.cxx:52