ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
dqm_algorithms
src
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
5
#include "
dqm_algorithms/AFP_Sync_check.h
"
6
7
#include <
dqm_algorithms/tools/AlgorithmHelper.h
>
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
{
19
static
dqm_algorithms::AFP_Sync_check
instance
;
20
}
21
22
dqm_algorithms::AFP_Sync_check::AFP_Sync_check
() {
23
dqm_core::AlgorithmManager::instance().registerAlgorithm(
"AFP_Sync_check"
,
this
);
24
}
25
26
dqm_algorithms::AFP_Sync_check::~AFP_Sync_check
() {
27
}
28
29
dqm_algorithms::AFP_Sync_check
*
30
dqm_algorithms::AFP_Sync_check::clone
() {
31
return
new
AFP_Sync_check
();
32
}
33
34
dqm_core::Result*
35
dqm_algorithms::AFP_Sync_check::execute
(
const
std::string& name,
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 )
76
result->status_ = dqm_core::Result::Undefined;
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
82
result->status_ = dqm_core::Result::Green;
83
84
return
result;
85
}
86
87
void
dqm_algorithms::AFP_Sync_check::printDescriptionTo
( std::ostream& out ) {
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
}
AFP_Sync_check.h
AlgorithmHelper.h
instance
std::map< std::string, double > instance
Definition
Run_To_Get_Tags.h:8
histogram
std::string histogram
Definition
chains.cxx:52
dqm_algorithms::AFP_Sync_check
Definition
AFP_Sync_check.h:21
dqm_algorithms::AFP_Sync_check::clone
AFP_Sync_check * clone() override
Definition
AFP_Sync_check.cxx:30
dqm_algorithms::AFP_Sync_check::AFP_Sync_check
AFP_Sync_check()
Definition
AFP_Sync_check.cxx:22
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
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
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string ¶mName, const std::map< std::string, double > ¶ms)
Definition
AlgorithmHelper.cxx:346
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > ¶ms)
Definition
AlgorithmHelper.h:109
str
Definition
BTagTrackIpAccessor.cxx:11
IsA
#define IsA
Declare the TObject style functions.
Definition
xAODTEventBranch.h:59
Generated on
for ATLAS Offline Software by
1.17.0