 |
ATLAS Offline Software
|
Go to the documentation of this file.
28 std::shared_ptr<std::vector<m_pair_t>> histArray =
nullptr;
33 else if (nProng == 1) {
37 else if (nProng == 2) {
41 else if (nProng == 3) {
47 return StatusCode::FAILURE;
51 std::unique_ptr<TFile>
file(TFile::Open(
fullPath.c_str(),
"READ"));
55 return StatusCode::FAILURE;
61 for (
int i = 0;
i < 100; ++
i) {
63 TH2* graph =
dynamic_cast<TH2*
>(
file->Get(Form(
"h2_%02d",
i)));
65 ATH_MSG_ERROR(
"Failed to retrieve Graph " <<
i <<
" named " << Form(
"h2_%02d",
i));
66 return StatusCode::FAILURE;
68 graph->SetDirectory(
nullptr);
69 std::shared_ptr<TH2> sharedGraph(graph);
70 histArray->push_back(
m_pair_t(
float(
i)/100., std::move(sharedGraph)));
75 return StatusCode::SUCCESS;
80 std::shared_ptr<std::vector<m_pair_t>> histArray =
nullptr;
84 else if (nProng == 1) {
87 else if (nProng == 2) {
90 else if (nProng == 3) {
95 return StatusCode::FAILURE;
98 std::shared_ptr<TH2> firstHist = histArray->at(0).second;
99 m_xMin[nProng] = firstHist->GetXaxis()->GetXmin();
100 m_xMax[nProng] = firstHist->GetXaxis()->GetBinCenter(firstHist->GetNbinsX());
101 m_yMin[nProng] = firstHist->GetYaxis()->GetXmin();
102 m_yMax[nProng] = firstHist->GetYaxis()->GetBinCenter(firstHist->GetNbinsY());
105 for (
size_t i = 1;
i < histArray->size(); ++
i) {
106 std::shared_ptr<TH2>
hist = histArray->at(
i).second;
108 double xMin =
hist->GetXaxis()->GetXmin();
109 double xMax =
hist->GetXaxis()->GetBinCenter(firstHist->GetNbinsX());
110 double yMin =
hist->GetYaxis()->GetXmin();
111 double yMax =
hist->GetYaxis()->GetBinCenter(firstHist->GetNbinsY());
113 if (std::abs(
m_xMin[nProng] - xMin) > 1
e-5 ||
114 std::abs(
m_xMax[nProng] - xMax) > 1
e-5 ||
115 std::abs(
m_yMin[nProng] - yMin) > 1
e-5 ||
116 std::abs(
m_yMax[nProng] - yMax) > 1
e-5) {
121 return StatusCode::SUCCESS;
126 double efficiency = effLow + (
score - cutLow)/(cutHigh - cutLow) * (effHigh - effLow);
135 ATH_MSG_ERROR(
"TauContainerName is provided but DecorWPNames is empty");
136 return StatusCode::FAILURE;
138 for (
size_t wpIndex=0; wpIndex <
m_decorWPs.size(); ++wpIndex) {
154 return StatusCode::FAILURE;
159 m_hists0p = std::make_shared<std::vector<m_pair_t>>();
164 m_hists1p = std::make_shared<std::vector<m_pair_t>>();
170 m_hists2p = std::make_shared<std::vector<m_pair_t>>();
175 m_hists3p = std::make_shared<std::vector<m_pair_t>>();
179 return StatusCode::SUCCESS;
186 double xVariable = tau.
pt();
189 double yVariable = 0.0;
192 yVariable = std::abs(acc_absEta(tau));
198 return StatusCode::FAILURE;
200 yVariable = eventInfoDecorHandle(0);
204 int nProng = nTracks;
215 else if (nTracks > 2) {
239 std::shared_ptr<std::vector<m_pair_t>> histArray =
nullptr;
241 else if (nProng == 1) histArray =
m_hists1p;
242 else if (nProng == 2) histArray =
m_hists2p;
245 std::array<double, 2>
cuts = {-1.01, 1.01};
246 std::array<double, 2> effs = {1.0, 0.0};
248 bool gotHigh =
false;
251 double score = acc_score(tau);
254 for (
unsigned int i = 0;
i < histArray->size(); ++
i) {
255 std::shared_ptr<TH2> myHist = histArray->at(
i).second;
256 double myCut = myHist->Interpolate(xVariable, yVariable);
260 effs[0] = histArray->at(
i).first;
263 else if (myCut >
score && ((!gotHigh) || std::abs(myCut-
score) < std::abs(
cuts[1]-
score))) {
265 effs[1] = histArray->at(
i).first;
269 if (gotLow && gotHigh){
275 double scoreTrans = -1111.;
277 scoreTrans = 1 - effs[1];
280 scoreTrans = 1 - effs[0];
287 acc_scoreTrans(tau) = scoreTrans;
291 for (
size_t wpIndex=0; wpIndex <
m_EDMWPs.size(); ++wpIndex) {
295 else if(nProng == 1) {
298 else if(nProng == 2) {
306 for (
size_t wpIndex=0; wpIndex <
m_decorWPs.size(); ++wpIndex) {
312 else if(nProng == 1) {
315 else if(nProng == 2) {
324 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.
Gaudi::Property< std::vector< float > > m_EDMWPEffs2p
Helper class to provide type-safe access to aux data.
SG::WriteDecorHandleKeyArray< xAOD::TauJetContainer > m_decorHandleKeys
Gaudi::Property< std::vector< std::string > > m_decorWPs
Gaudi::Property< std::vector< float > > m_EDMWPEffs3p
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)
Gaudi::Property< std::vector< float > > m_decorWPEffs0p
Gaudi::Property< std::vector< float > > m_EDMWPEffs0p
void setIsTau(TauJetParameters::IsTauFlag flag, bool value)
Set Flag for tau acceptance based on predefined arbitrary criteria.
std::shared_ptr< std::vector< m_pair_t > > m_hists1p
Efficiency and corresponding score distributions of 1-prong taus.
Gaudi::Property< std::vector< int > > m_EDMWPs
Gaudi::Property< std::vector< float > > m_decorWPEffs1p
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="")
Gaudi::Property< std::string > m_scoreName
Handle class for reading a decoration on an object.
TauWPDecorator(const std::string &name="TauWPDecorator")
Constructor.
::StatusCode StatusCode
StatusCode definition for legacy code.
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.
Gaudi::Property< std::vector< float > > m_EDMWPEffs1p
std::shared_ptr< std::vector< m_pair_t > > m_hists2p
Efficiency and corresponding score distributions of 2-prong taus.
Gaudi::Property< std::string > m_file3p
Gaudi::Property< std::string > m_file2p
Gaudi::Property< std::string > m_file0p
Gaudi::Property< std::string > m_file1p
virtual StatusCode execute(xAOD::TauJet &tau) const override
Executation of this tool.
std::map< int, double > m_yMin
Map of n-prong and the minimum value of y variables.
Gaudi::Property< bool > m_useAbsEta
Gaudi::Property< std::string > m_tauContainerName
#define ATH_MSG_WARNING(x)
Gaudi::Property< std::string > m_scoreNameTrans
IsTauFlag
Enum for IsTau flags.
Gaudi::Property< std::vector< float > > m_decorWPEffs3p
Gaudi::Property< bool > m_defineWPs
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.
Gaudi::Property< std::vector< float > > m_decorWPEffs2p
std::pair< double, std::shared_ptr< TH2 > > m_pair_t