Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
51 std::shared_ptr<std::vector<m_pair_t>> histArray =
nullptr;
56 else if (nProng == 1) {
60 else if (nProng == 2) {
64 else if (nProng == 3) {
70 return StatusCode::FAILURE;
74 std::unique_ptr<TFile>
file(TFile::Open(
fullPath.c_str(),
"READ"));
78 return StatusCode::FAILURE;
84 for (
int i = 0;
i < 100; ++
i) {
86 TH2* graph =
dynamic_cast<TH2*
>(
file->Get(Form(
"h2_%02d",
i)));
88 ATH_MSG_ERROR(
"Failed to retrieve Graph " <<
i <<
" named " << Form(
"h2_%02d",
i));
89 return StatusCode::FAILURE;
91 graph->SetDirectory(
nullptr);
92 std::shared_ptr<TH2> sharedGraph(graph);
93 histArray->push_back(
m_pair_t(
float(
i)/100., std::move(sharedGraph)));
98 return StatusCode::SUCCESS;
103 std::shared_ptr<std::vector<m_pair_t>> histArray =
nullptr;
107 else if (nProng == 1) {
110 else if (nProng == 2) {
113 else if (nProng == 3) {
118 return StatusCode::FAILURE;
121 std::shared_ptr<TH2> firstHist = histArray->at(0).second;
122 m_xMin[nProng] = firstHist->GetXaxis()->GetXmin();
123 m_xMax[nProng] = firstHist->GetXaxis()->GetBinCenter(firstHist->GetNbinsX());
124 m_yMin[nProng] = firstHist->GetYaxis()->GetXmin();
125 m_yMax[nProng] = firstHist->GetYaxis()->GetBinCenter(firstHist->GetNbinsY());
128 for (
size_t i = 1;
i < histArray->size(); ++
i) {
129 std::shared_ptr<TH2>
hist = histArray->at(
i).second;
131 double xMin =
hist->GetXaxis()->GetXmin();
132 double xMax =
hist->GetXaxis()->GetBinCenter(firstHist->GetNbinsX());
133 double yMin =
hist->GetYaxis()->GetXmin();
134 double yMax =
hist->GetYaxis()->GetBinCenter(firstHist->GetNbinsY());
136 if (std::abs(
m_xMin[nProng] - xMin) > 1
e-5 ||
137 std::abs(
m_xMax[nProng] - xMax) > 1
e-5 ||
138 std::abs(
m_yMin[nProng] - yMin) > 1
e-5 ||
139 std::abs(
m_yMax[nProng] - yMax) > 1
e-5) {
144 return StatusCode::SUCCESS;
149 double efficiency = effLow + (
score - cutLow)/(cutHigh - cutLow) * (effHigh - effLow);
158 ATH_MSG_ERROR(
"TauContainerName is provided but DecorWPNames is empty");
159 return StatusCode::FAILURE;
161 for (
size_t wpIndex=0; wpIndex <
m_decorWPs.size(); ++wpIndex) {
175 return StatusCode::FAILURE;
180 m_hists0p = std::make_shared<std::vector<m_pair_t>>();
185 m_hists1p = std::make_shared<std::vector<m_pair_t>>();
191 m_hists2p = std::make_shared<std::vector<m_pair_t>>();
196 m_hists3p = std::make_shared<std::vector<m_pair_t>>();
200 return StatusCode::SUCCESS;
207 double xVariable = tau.
pt();
210 double yVariable = 0.0;
213 yVariable = std::abs(acc_absEta(tau));
219 return StatusCode::FAILURE;
221 yVariable = eventInfoDecorHandle(0);
225 int nProng = nTracks;
236 else if (nTracks > 2) {
260 std::shared_ptr<std::vector<m_pair_t>> histArray =
nullptr;
262 else if (nProng == 1) histArray =
m_hists1p;
263 else if (nProng == 2) histArray =
m_hists2p;
266 std::array<double, 2>
cuts = {-1.01, 1.01};
267 std::array<double, 2> effs = {1.0, 0.0};
269 bool gotHigh =
false;
272 double score = acc_score(tau);
275 for (
unsigned int i = 0;
i < histArray->size(); ++
i) {
276 std::shared_ptr<TH2> myHist = histArray->at(
i).second;
277 double myCut = myHist->Interpolate(xVariable, yVariable);
281 effs[0] = histArray->at(
i).first;
284 else if (myCut >
score && ((!gotHigh) || std::abs(myCut-
score) < std::abs(
cuts[1]-
score))) {
286 effs[1] = histArray->at(
i).first;
290 if (gotLow && gotHigh){
296 double scoreTrans = -1111.;
298 scoreTrans = 1 - effs[1];
301 scoreTrans = 1 - effs[0];
308 acc_scoreTrans(tau) = scoreTrans;
312 for (
size_t wpIndex=0; wpIndex <
m_EDMWPs.size(); ++wpIndex) {
316 else if(nProng == 1) {
319 else if(nProng == 2) {
327 for (
size_t wpIndex=0; wpIndex <
m_decorWPs.size(); ++wpIndex) {
333 else if(nProng == 1) {
336 else if(nProng == 2) {
345 return StatusCode::SUCCESS;
std::vector< SG::AuxElement::Accessor< char > > m_charDecors
std::map< int, double > m_yMax
Map of n-prong and the maximum value of y variables.
Helper class to provide type-safe access to aux data.
SG::WriteDecorHandleKeyArray< xAOD::TauJetContainer > m_decorHandleKeys
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
bool isPresent() const
Is the referenced container present in SG?
std::map< int, double > m_xMax
Map of n-prong and the maximum value of x variables.
~TauWPDecorator()
Destructor.
double transformScore(double score, double cutLow, double effLow, double cutHigh, double effHigh) const
Obtain the flattened score.
virtual StatusCode initialize() override
Initialization of this tool.
#define ATH_MSG_VERBOSE(x)
std::string m_file3p
Calibration file name of 3-prong taus.
void setIsTau(TauJetParameters::IsTauFlag flag, bool value)
Set Flag for tau acceptance based on predefined arbitrary criteria.
std::vector< float > m_EDMWPEffs3p
Efficiency of each WP in EDM for 3-prong taus.
std::shared_ptr< std::vector< m_pair_t > > m_hists1p
Efficiency and corresponding score distributions of 1-prong taus.
bool m_useAbsEta
Whether we are flatterning electron veto WP.
virtual double pt() const
The transverse momentum ( ) of the particle.
SG::ReadDecorHandleKey< xAOD::EventInfo > m_aveIntPerXKey
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Handle class for reading a decoration on an object.
std::string m_scoreName
Name of the original score.
TauWPDecorator(const std::string &name="TauWPDecorator")
Constructor.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::vector< float > m_EDMWPEffs1p
Efficiency of each WP in EDM for 1-prong taus.
std::shared_ptr< std::vector< m_pair_t > > m_hists0p
Efficiency and corresponding score distributions of 0-prong taus.
Class describing a tau jet.
std::map< int, double > m_xMin
Map of n-prong and the minimum value of x variables.
StatusCode storeLimits(int nProng)
Obtain the limit of the dependent variables.
std::shared_ptr< std::vector< m_pair_t > > m_hists2p
Efficiency and corresponding score distributions of 2-prong taus.
std::vector< float > m_EDMWPEffs2p
Efficiency of each WP in EDM for 2-prong taus.
std::vector< float > m_decorWPEffs0p
Efficiency of each WP to be docorated for 0-prong taus.
std::string m_scoreNameTrans
Name of the transformed score.
std::vector< std::string > m_decorWPs
name of WPs
virtual StatusCode execute(xAOD::TauJet &tau) const override
Executation of this tool.
std::vector< float > m_decorWPEffs3p
Efficiency of each WP to be docorated for 3-prong taus.
std::map< int, double > m_yMin
Map of n-prong and the minimum value of y variables.
Gaudi::Property< std::string > m_tauContainerName
std::vector< int > m_EDMWPs
Vector of WPs in the EDM.
std::vector< float > m_EDMWPEffs0p
Efficiency of each WP in EDM for 0-prong taus.
std::vector< float > m_decorWPEffs1p
Efficiency of each WP to be docorated for 1-prong taus.
bool m_defineWPs
Whether to decorate the WPs.
#define ATH_MSG_WARNING(x)
std::string m_file0p
Calibration file name of 0-prong taus.
IsTauFlag
Enum for IsTau flags.
std::string m_file1p
Calibration file name of 1-prong taus.
std::string m_file2p
Calibration file name of 2-prong taus.
std::shared_ptr< std::vector< m_pair_t > > m_hists3p
Efficiency and corresponding score distributions of 3-prong taus.
StatusCode retrieveHistos(int nProng)
Retrieve the histograms containing BDT/RNN score distributions as a function of dependent variables.
std::vector< float > m_decorWPEffs2p
Efficiency of each WP to be docorated for 2-prong taus.
std::pair< double, std::shared_ptr< TH2 > > m_pair_t