 |
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "TObjString.h"
23 #include "GaudiKernel/SystemOfUnits.h"
54 ATH_MSG_FATAL(
"Particle type not set: you have to set property ParticleType to a valid value");
55 return StatusCode::FAILURE;
65 return StatusCode::FAILURE;
73 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
81 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
89 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
97 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
106 return StatusCode::FAILURE;
111 TClass::GetClass (
"TH2Poly");
112 TClass::GetClass (
"TMultiGraph");
114 return StatusCode::SUCCESS;
122 std::unique_ptr<TFile>
f(TFile::Open(
fileName.c_str()));
123 if (!
f ||
f->IsZombie()) {
125 return StatusCode::FAILURE;
129 TH2Poly *hPoly =
nullptr;
130 f->GetObject(
"hPoly", hPoly);
133 return StatusCode::FAILURE;
136 m_hPoly.reset(
static_cast<TH2Poly*
>(hPoly));
137 m_hPoly->SetDirectory(
nullptr);
140 TObjArray *variablesTmp =
nullptr;
141 f->GetObject(
"variables", variablesTmp);
144 return StatusCode::FAILURE;
146 auto variables = std::unique_ptr<TObjArray>(variablesTmp);
150 TObjArray *shiftsTmp =
nullptr;
151 f->GetObject(
"shifts", shiftsTmp);
154 return StatusCode::FAILURE;
156 auto shifts = std::unique_ptr<TObjArray>(shiftsTmp);
160 TObjArray *treesTmp =
nullptr;
161 std::unique_ptr<TObjArray>
trees;
162 f->GetObject(
"trees", treesTmp);
164 trees = std::unique_ptr<TObjArray>(treesTmp);
169 trees = std::make_unique<TObjArray>();
173 TTree *
tree =
nullptr;
174 f->GetObject(Form(
"BDT%d",
i),
tree);
183 <<
" while variables has size " <<
variables->GetEntries());
184 return StatusCode::FAILURE;
192 TIter nextTree(
trees.get());
194 TIter nextShift(shifts.get());
195 for (
int i=0; (
tree = (TTree*) nextTree()) && ((TObjString*) nextVariables()); ++
i)
201 char separator_var =
';';
204 TIter nextVar(
tokens.get());
205 while ((str2 = (TObjString*) nextVar()))
208 if (
varName.Contains(
"npv") ||
varName.Contains(
"actualIntPerXing"))
212 return StatusCode::FAILURE;
215 funcs.push_back(funcLibrary.at(
varName.Data()));
216 }
catch(
const std::out_of_range&
e) {
218 return StatusCode::FAILURE;
221 m_funcs->funcs.push_back(std::move(funcs));
224 shift = (TObjString*) nextShift();
225 const TString& shiftFormula =
getString(shift);
226 m_shifts.emplace_back(
"", shiftFormula);
229 return StatusCode::SUCCESS;
235 TObjString *objS =
dynamic_cast<TObjString*
>(
obj);
237 throw std::runtime_error(
"egammaMVACalibTool::getString was passed something that was not a string object");
239 return objS->GetString();
250 const auto initEnergy =
256 const auto etVarGeV = (initEnergy / std::cosh(clus.
eta())) /
GeV;
257 const auto etaVar = std::abs(clus.
eta());
259 ATH_MSG_DEBUG(
"Looking at object with initEnergy = " << initEnergy
260 <<
", etVarGeV = " << etVarGeV
261 <<
", etaVar = " << etaVar
262 <<
", clus->e() = " << clus.
e());
269 const int bin = hPoly->FindBin(etaVar, etVarGeV) - 1;
274 ATH_MSG_DEBUG(
"The bin is under/overflow; just return the energy");
278 if (
bin >=
static_cast<int>(
m_BDTs.size())) {
279 ATH_MSG_WARNING(
"The bin is outside the range, so just return the energy");
286 const int bin_BDT =
m_BDTs.size() != 1 ?
bin : 0;
287 const auto& bdt =
m_BDTs[bin_BDT];
288 const auto& funcs =
m_funcs->funcs[bin_BDT];
290 const size_t sz = funcs.size();
293 std::vector<float> vars(
sz);
295 for (
size_t i = 0;
i <
sz; ++
i) {
296 vars[
i] = funcs[
i](
eg, &clus);
303 vars.insert(vars.end(),{float(gei.nPV), gei.acmu});
307 const float mvaOutput = bdt.GetResponse(vars);
311 if (mvaOutput == 0.) {
320 mvaOutput : (initEnergy * mvaOutput);
330 const auto etGeV = (
energy / std::cosh(clus.
eta())) /
GeV;
339 ATH_MSG_WARNING(
"Shift value too small: " << shift <<
"; not applying shift");
float compute_rawcl_Eacc(const xAOD::CaloCluster &cl)
std::unordered_map< std::string, std::function< float(const xAOD::Egamma *, const xAOD::CaloCluster *)> > funcMap_t
Define the map type since it's long.
Description of a calorimeter cluster.
std::unique_ptr< funcMap_t > initializeConvertedPhotonFuncs(bool useLayerCorrected)
A function to build the map for converted photons.
virtual double eta() const
The pseudorapidity ( ) of the particle.
std::unique_ptr< funcMap_t > initializeForwardElectronFuncs(bool useLayerCorrected)
NEW: A function to build the map for forward electrons.
string varName
end cluster ToT and charge
::StatusCode StatusCode
StatusCode definition for legacy code.
std::unique_ptr< funcMap_t > initializeUnconvertedPhotonFuncs(bool useLayerCorrected)
A function to build the map for uncoverted photons.
size_t index() const
Return the index of this element within its container.
float compute_correctedcl_Eacc(const xAOD::CaloCluster &cl)
std::unique_ptr< funcMap_t > initializeElectronFuncs(bool useLayerCorrected)
A function to build the map for electrons.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
A structure holding some global event information.
#define ATH_MSG_WARNING(x)
#define ATLAS_THREAD_SAFE
Define macros for attributes used to control the static checker.
virtual double e() const
The total energy of the particle.