 |
ATLAS Offline Software
|
Go to the documentation of this file.
15 #include "TObjString.h"
22 #include "GaudiKernel/SystemOfUnits.h"
53 ATH_MSG_FATAL(
"Particle type not set: you have to set property ParticleType to a valid value");
54 return StatusCode::FAILURE;
64 return StatusCode::FAILURE;
72 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
80 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
88 std::unique_ptr<egammaMVAFunctions::funcMap_t> funcLibraryPtr =
96 return StatusCode::FAILURE;
101 TClass::GetClass (
"TH2Poly");
102 TClass::GetClass (
"TMultiGraph");
104 return StatusCode::SUCCESS;
112 std::unique_ptr<TFile>
f(TFile::Open(
fileName.c_str()));
113 if (!
f ||
f->IsZombie()) {
115 return StatusCode::FAILURE;
119 TH2Poly *hPoly =
nullptr;
120 f->GetObject(
"hPoly", hPoly);
123 return StatusCode::FAILURE;
126 m_hPoly.reset(
static_cast<TH2Poly*
>(hPoly));
127 m_hPoly->SetDirectory(
nullptr);
130 TObjArray *variablesTmp =
nullptr;
131 f->GetObject(
"variables", variablesTmp);
134 return StatusCode::FAILURE;
136 auto variables = std::unique_ptr<TObjArray>(variablesTmp);
140 TObjArray *shiftsTmp =
nullptr;
141 f->GetObject(
"shifts", shiftsTmp);
144 return StatusCode::FAILURE;
146 auto shifts = std::unique_ptr<TObjArray>(shiftsTmp);
150 TObjArray *treesTmp =
nullptr;
151 std::unique_ptr<TObjArray>
trees;
152 f->GetObject(
"trees", treesTmp);
154 trees = std::unique_ptr<TObjArray>(treesTmp);
159 trees = std::make_unique<TObjArray>();
163 TTree *
tree =
nullptr;
164 f->GetObject(Form(
"BDT%d",
i),
tree);
173 <<
" while variables has size " <<
variables->GetEntries());
174 return StatusCode::FAILURE;
182 TIter nextTree(
trees.get());
184 TIter nextShift(shifts.get());
185 for (
int i=0; (
tree = (TTree*) nextTree()) && ((TObjString*) nextVariables()); ++
i)
191 char separator_var =
';';
194 TIter nextVar(
tokens.get());
195 while ((str2 = (TObjString*) nextVar()))
200 return StatusCode::FAILURE;
203 funcs.push_back(funcLibrary.at(
varName.Data()));
204 }
catch(
const std::out_of_range&
e) {
206 return StatusCode::FAILURE;
209 m_funcs->funcs.push_back(std::move(funcs));
212 shift = (TObjString*) nextShift();
213 const TString& shiftFormula =
getString(shift);
214 m_shifts.emplace_back(
"", shiftFormula);
217 return StatusCode::SUCCESS;
223 TObjString *objS =
dynamic_cast<TObjString*
>(
obj);
225 throw std::runtime_error(
"egammaMVACalibTool::getString was passed something that was not a string object");
227 return objS->GetString();
241 const auto etVarGeV = (initEnergy / std::cosh(clus.
eta())) /
GeV;
242 const auto etaVar = std::abs(clus.
eta());
244 ATH_MSG_DEBUG(
"Looking at object with initEnergy = " << initEnergy
245 <<
", etVarGeV = " << etVarGeV
246 <<
", etaVar = " << etaVar
247 <<
", clus->e() = " << clus.
e());
254 const int bin = hPoly->FindBin(etaVar, etVarGeV) - 1;
259 ATH_MSG_DEBUG(
"The bin is under/overflow; just return the energy");
263 if (
bin >=
static_cast<int>(
m_BDTs.size())) {
264 ATH_MSG_WARNING(
"The bin is outside the range, so just return the energy");
270 const int bin_BDT =
m_BDTs.size() != 1 ?
bin : 0;
271 const auto& bdt =
m_BDTs[bin_BDT];
272 const auto& funcs =
m_funcs->funcs[bin_BDT];
274 const size_t sz = funcs.size();
277 std::vector<float> vars(
sz);
279 for (
size_t i = 0;
i <
sz; ++
i) {
280 vars[
i] = funcs[
i](
eg, &clus);
284 const float mvaOutput = bdt.GetResponse(vars);
287 if (mvaOutput == 0.) {
296 mvaOutput : (initEnergy * mvaOutput);
306 const auto etGeV = (
energy / std::cosh(clus.
eta())) /
GeV;
314 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.
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)
#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.