|
ATLAS Offline Software
|
Go to the documentation of this file.
25 std::unique_ptr<TFile> calFile(TFile::Open(calFilePath.c_str(),
"READ"));
32 for (
size_t decayModeIndex = 0; decayModeIndex <
DecayModeBinning; ++ decayModeIndex) {
36 hist->SetDirectory(
nullptr);
42 return StatusCode::FAILURE;
46 tf1 =
dynamic_cast<TF1*
> (calFile->Get(
histName.c_str()));
53 return StatusCode::FAILURE;
58 TGraph* graph =
nullptr;
59 std::string graphName=
"";
60 for (
size_t decayModeIndex = 0; decayModeIndex <
DecayModeBinning; ++decayModeIndex) {
61 for (
size_t etaIndex = 0; etaIndex <
EtaBinning; ++etaIndex) {
64 graph =
dynamic_cast<TGraph*
> (calFile->Get(graphName.c_str()));
66 m_caloRelBiasMaxEt[decayModeIndex][etaIndex] = TMath::MaxElement(graph->GetN(), graph->GetX());
67 m_caloRelBias[decayModeIndex][etaIndex] = std::unique_ptr<TGraph>(graph);
71 ATH_MSG_FATAL(
"Failed to get an object with name " << graphName);
72 return StatusCode::FAILURE;
77 graph =
dynamic_cast<TGraph*
> (calFile->Get(graphName.c_str()));
79 m_caloResMaxEt[decayModeIndex][etaIndex] = TMath::MaxElement(graph->GetN(), graph->GetX());
80 m_caloRes[decayModeIndex][etaIndex] = std::unique_ptr<TGraph>(graph);
84 ATH_MSG_FATAL(
"Failed to get an object with name " << graphName);
85 return StatusCode::FAILURE;
90 graph =
dynamic_cast<TGraph*
> (calFile->Get(graphName.c_str()));
92 m_panTauRelBiasMaxEt[decayModeIndex][etaIndex] = TMath::MaxElement(graph->GetN(), graph->GetX());
93 m_panTauRelBias[decayModeIndex][etaIndex] = std::unique_ptr<TGraph>(graph);
97 ATH_MSG_FATAL(
"Failed to get an object with name " << graphName);
98 return StatusCode::FAILURE;
103 graph =
dynamic_cast<TGraph*
> (calFile->Get(graphName.c_str()));
105 m_panTauResMaxEt[decayModeIndex][etaIndex] = TMath::MaxElement(graph->GetN(), graph->GetX());
106 m_panTauRes[decayModeIndex][etaIndex] = std::unique_ptr<TGraph>(graph);
110 ATH_MSG_FATAL(
"Failed to get an object with name " << graphName);
111 return StatusCode::FAILURE;
117 graph =
dynamic_cast<TGraph*
> (calFile->Get(graphName.c_str()));
119 m_mvaResMaxEt[decayModeIndex][etaIndex] = TMath::MaxElement(graph->GetN(), graph->GetX());
120 m_mvaRes[decayModeIndex][etaIndex] = std::unique_ptr<TGraph>(graph);
124 ATH_MSG_FATAL(
"Failed to get an object with name " << graphName);
125 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
154 decPtCombined(tau) = combinedP4.Pt();
155 decEtaCombined(tau) = combinedP4.Eta();
156 decPhiCombined(tau) = combinedP4.Phi();
157 decMCombined(tau) = combinedP4.M();
169 decPtConstituent(tau) =
variables.pt_constituent;
170 decPtTauRecCalibrated(tau) =
variables.pt_tauRecCalibrated;
171 decPtWeighted(tau) =
variables.pt_weighted;
172 decWeightWeighted(tau) =
variables.weight;
174 decSigmaCompatibility(tau) =
variables.sigma_compatibility;
175 decSigmaTaurec(tau) =
variables.sigma_tauRec;
176 decSigmaConstituent(tau) =
variables.sigma_constituent;
177 decCorrelationCoefficient(tau) =
variables.corrcoeff;
180 return StatusCode::SUCCESS;
186 if (!
isValid(tau))
return false;
196 bool compatibility =
true;
199 if (std::abs(deltaEt) > 5 * caloSigma) {
200 compatibility =
false;
203 return compatibility;
210 if (std::abs(
eta) < 0.3) {
213 if (std::abs(
eta) < 0.8) {
216 if (std::abs(
eta) < 1.3) {
219 if (std::abs(
eta) < 1.6) {
223 if (std::abs(
eta) < 2.6) {
242 return static_cast<int>(decayMode);
273 int etaIndex)
const {
283 double caloCalEt = caloEt -
ratio * caloEt;
292 int etaIndex)
const {
301 double panTauCalEt = panTauEt -
ratio * panTauEt;
346 double correlation)
const {
347 double cov = correlation * caloSigma * panTauSigma;
348 double caloWeight =
std::pow(panTauSigma, 2) -
cov;
349 double panTauWeight =
std::pow(caloSigma, 2) -
cov;
351 double weight = (caloWeight + panTauWeight !=0.) ? caloWeight/(caloWeight + panTauWeight) : 0.;
353 return std::clamp(
weight, 0., 1.);
360 double correlation)
const {
363 - 2 * correlation * caloSigma * panTauSigma;
372 double correlation)
const {
373 double compatibilitySigma2 =
std::pow(caloSigma, 2) +
std::pow(panTauSigma, 2) - 2 * correlation * caloSigma * panTauSigma;
375 return std::sqrt(compatibilitySigma2);
383 if (nsigma < 0.)
return 0.;
405 if (0. == caloSigma) {
407 m_caloRes[decayModeIndex][etaIndex]->Print(
"all");
413 if (0. == panTauSigma) {
415 m_panTauRes[decayModeIndex][etaIndex]->Print(
"all");
420 double caloCalEt =
getCaloCalEt(caloEt, decayModeIndex, etaIndex);
423 double panTauCalEt =
getPanTauCalEt(panTauEt, decayModeIndex, etaIndex);
428 double weightedEt =
weight * caloCalEt + (1 -
weight) * panTauCalEt;
438 double deltaEt = caloCalEt - panTauCalEt;
447 variables.sigma_constituent = panTauSigma;
448 variables.pt_tauRecCalibrated = caloCalEt;
451 variables.sigma_compatibility = compatibilitySigma;
455 "coff: " << correlation <<
" sigma(calo): " << caloSigma <<
" sigma(constituent): " << panTauSigma <<
456 "\ncalibrated et(calo): " << caloCalEt <<
" calibrated et(constituent): " << panTauCalEt <<
457 "\nweight:" <<
weight <<
" combined et: " << weightedEt <<
" compatibility sigma: " << compatibilitySigma);
468 ATH_MSG_DEBUG(
"Four momentum at calo TES, pt: " << caloP4.Pt() <<
" eta: " << caloP4.Eta() <<
469 " phi: " << caloP4.Phi() <<
" mass: " << caloP4.M());
470 ATH_MSG_DEBUG(
"Four momentum at PanTau, pt: " << panTauP4.Pt() <<
" eta: " << panTauP4.Eta() <<
471 " phi: " << panTauP4.Phi() <<
" mass: " << panTauP4.M());
478 TLorentzVector combinedP4;
479 combinedP4.SetPtEtaPhiM(combinedEt, panTauP4.Eta(), panTauP4.Phi(), 0.);
481 ATH_MSG_DEBUG(
"Combined four momentum, pt: " << combinedP4.Pt() <<
" eta: " << combinedP4.Eta() <<
482 " phi: " << combinedP4.Phi() <<
" mass: " << combinedP4.M());
double getCaloCalEt(double et, int decayModeIndex, int etaIndex) const
Get the Et at the calo TES after calibration correction.
double getMvaEnergyResolution(const xAOD::TauJet &tau) const
Get MVA Et resolution, invoked by METSignificance.
std::array< std::array< double, EtaBinning >, DecayModeBinning > m_mvaResMaxEt
Maximum Et of m_mvaRes.
bool getTESCompatibility(const xAOD::TauJet &tau) const
Check if MVA TES and CaloTES are compatible, invoked by TauSmearing tool.
Extra patterns decribing particle interation process.
double etaTauEnergyScale() const
int getDecayModeIndex(xAOD::TauJetParameters::DecayMode decayMode) const
Get the index of decay mode in the calibration histogram.
Scalar eta() const
pseudorapidity method
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
bool isValid(const xAOD::TauJet &tau) const
Whether the tau candidate is valid for the calculation.
std::array< std::array< double, EtaBinning >, DecayModeBinning > m_caloRelBiasMaxEt
Maximum Et of m_caloRelBias.
double etaFinalCalib() const
int getEtaIndex(float eta) const
Get the index of eta in the calibration histogram.
virtual StatusCode initialize() override
Tool initializer.
std::array< std::unique_ptr< TF1 >, DecayModeBinning > m_nSigmaCompatibility
Maximum tolerence in unit of combined sigma, as a function of calo Et.
bool panTauDetail(TauJetParameters::PanTauDetails panTauDetail, int &value) const
Get and set values of pantau details variables via enum.
double resolution[nGasTypes][nParametersResolution]
double getCorrelation(int decayModeIndex, int etaIndex) const
Get correlation coefficient between the calo TES and PanTau.
double getCombinedSigma(double caloSigma, double panTauSigma, double correlation) const
Get the combined sigma of calo TES and PanTau.
double ptTauEnergyScale() const
::StatusCode StatusCode
StatusCode definition for legacy code.
const std::array< std::string, DecayModeBinning > m_decayModeNames
Decay mode binning in the calibration graph/hist.
double getCaloResolution(double et, int decayModeIndex, int etaIndex) const
Get the resolution of Et at the calo TES.
Class describing a tau jet.
double getCompatibilitySigma(double caloSigma, double panTauSigma, double correlation) const
Get the compatibility sigma of calo TES and PanTau.
std::array< std::unique_ptr< TH1F >, DecayModeBinning > m_correlationHists
Calibration histogram: correlation coefficient of calo TES and PanTau.
std::array< std::array< std::unique_ptr< TGraph >, EtaBinning >, DecayModeBinning > m_panTauRelBias
Calibration graph: mean of bias/panTauEt as a funtion of panTauEt.
const std::array< std::string, EtaBinning > m_etaBinNames
Eta binning in the calibration graph.
double getWeight(double caloSigma, double panTauSigma, double correlatioon) const
Get the weight of calo TES.
xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet &tau) const
Get the decay mode of the tau candidate.
virtual StatusCode execute(xAOD::TauJet &xTau) const override
Execute - called for each tau candidate.
double getPanTauResolution(double et, int decayModeIndex, int etaIndex) const
Get the resolution of Et at PanTau.
std::array< std::array< double, EtaBinning >, DecayModeBinning > m_panTauRelBiasMaxEt
Maximum Et of m_panTauRelBias.
double getPanTauCalEt(double panTauEt, int decayModeIndex, int etaIndex) const
Get the Et at PanTau after calibration correction.
double getNsigmaCompatibility(double caloEt, int decayModeIndex) const
Get the allowed difference between calo TES and PanTau.
std::string m_calFileName
Name of the calibration file.
TauCombinedTES(const std::string &name="TauCombinedTES")
std::array< std::array< std::unique_ptr< TGraph >, EtaBinning >, DecayModeBinning > m_caloRelBias
Calibration graph: mean of bias/caloEt as a function of caloEt.
std::array< std::array< double, EtaBinning >, DecayModeBinning > m_caloResMaxEt
Maximum Et of m_caloRes.
#define ATH_MSG_WARNING(x)
virtual FourMom_t p4() const
The full 4-momentum of the particle.
std::array< std::array< std::unique_ptr< TGraph >, EtaBinning >, DecayModeBinning > m_caloRes
Calibration graph: resolution at Calo TES as a function of caloEt.
std::array< std::array< double, EtaBinning >, DecayModeBinning > m_panTauResMaxEt
Maximum Et of m_panTauRes.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
double getCombinedEt(double caloEt, double et_substructure, xAOD::TauJetParameters::DecayMode decayMode, float eta, Variables &variables) const
Get the combined Et of calo TES and PanTau.
std::array< std::array< std::unique_ptr< TGraph >, EtaBinning >, DecayModeBinning > m_mvaRes
Calibration graph: MVA TES resolution as a function of MVA pt.
bool m_useMvaResolution
Use MVA TES resolution (for MET significance)
TLorentzVector getCombinedP4(const xAOD::TauJet &tau, Variables &variables) const
Get the weighted four momentum of calo TES and PanTau.
constexpr int pow(int base, int exp) noexcept
double ptFinalCalib() const
std::array< std::array< std::unique_ptr< TGraph >, EtaBinning >, DecayModeBinning > m_panTauRes
Calibration graph: resolution at PanTau as a function of panTauEt.
bool m_addCalibrationResultVariables
Switch for decorating the intermediate results, for combined TES tuning.