24 m_pimpl = std::make_unique<Root::TElectronEfficiencyCorrectionTool>(
25 (this->
name() +
".TElectronEfficiencyCorrection").c_str());
34 if (filename.empty()) {
36 return StatusCode::FAILURE;
38 ATH_MSG_INFO(
" Using recommendations file = " << filename);
46 if (
m_pimpl->initialize() == 0) {
48 "Could not initialize the TElectronEfficiencyCorrectionTool!");
49 return StatusCode::FAILURE;
54 std::map<float, std::vector<float>> tmp;
62 m_SF = baseName +
".EFF_" + key +
"_SF";
63 m_TotalUp = baseName +
".EFF_" + key +
"_Total__Up";
64 m_TotalDown = baseName +
".EFF_" + key +
"_Total__Down";
65 m_uncorrUp = baseName +
".EFF_" + key +
"_UnCorr__Up";
66 m_uncorrDown = baseName +
".EFF_" + key +
"_UnCorr__Down";
67 m_HistIndex = baseName +
".EFF_" + key +
"_HistIndex";
68 m_HistBin = baseName +
".EFF_" + key +
"_HistBin";
69 m_corrUp = baseName +
".EFF_" + key +
"_Corr__Up";
70 m_corrDown = baseName +
".EFF_" + key +
"_Corr__Down";
71 m_toys = baseName +
".EFF_" + key +
"__toys";
84 return StatusCode::SUCCESS;
90 unsigned int runNumber = 428648;
96 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, double>> SF;
97 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, double>> TotalUp;
98 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, double>>
100 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, double>> uncorrUp;
101 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, double>>
103 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, int>> HistIndex;
104 std::optional<SG::WriteDecorHandle<xAOD::ElectronContainer, int>> HistBin;
116 SF.emplace(
m_SF, ctx);
128 toys.emplace(
m_toys, ctx);
137 if (std::abs(el->eta()) > 2.469 || el->pt() < 10000) {
141 SF.value()(*el) =
result.SF;
147 HistIndex.value()(*el) =
result.histIndex;
148 HistBin.value()(*el) =
result.histBinNum;
149 corrUp.value()(*el) =
result.Corr;
150 corrDown.value()(*el) =
result.Corr;
153 toys.value()(*el) =
result.toys;
160 double cluster_eta(-9999.9);
163 ATH_MSG_ERROR(
"ERROR no cluster associated to the Electron \n");
164 return StatusCode::FAILURE;
170 cluster_eta = cluster->
eta();
172 cluster_eta = cluster->
etaBE(2);
177 const double energy = cluster->
e();
178 const double parEta = el->eta();
179 const double coshEta = std::cosh(parEta);
180 double et = (coshEta != 0.) ? energy / coshEta : 0.;
187 const int status =
m_pimpl->calculate(
193 return StatusCode::FAILURE;
197 ATH_MSG_INFO(
"--------------------------------------------");
198 ATH_MSG_INFO(
"Electron pt : " << el->pt() <<
" eta " << el->eta());
217 SF.value()(*el) =
result.SF;
223 HistIndex.value()(*el) =
result.histIndex;
224 HistBin.value()(*el) =
result.histBinNum;
225 const size_t corrsize =
result.Corr.size();
226 std::vector<double> up(corrsize, 0);
227 std::vector<double> down(corrsize, 0);
228 for (
size_t i = 0; i < corrsize; ++i) {
232 corrUp.value()(*el) = std::move(up);
233 corrDown.value()(*el) = std::move(down);
236 toys.value()(*el) = std::move(
result.toys);
241 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
std::pair< std::vector< unsigned int >, bool > res
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< bool > m_decorate
Gaudi::Property< int > m_dataType
SG::ReadHandleKey< xAOD::ElectronContainer > m_electronContainer
Input collection name.
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_toys
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_HistIndex
Gaudi::Property< std::string > m_idKey
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_TotalUp
std::unique_ptr< Root::TElectronEfficiencyCorrectionTool > m_pimpl
Lowest Et for the reccomendations.
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_corrDown
double m_lowestEt
Number of Correlated syst.
Gaudi::Property< int > m_mode
Gaudi::Property< std::string > m_isoKey
Gaudi::Property< std::string > m_triggerKey
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_TotalDown
virtual StatusCode execute(const EventContext &ctx) const override final
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_uncorrDown
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_HistBin
virtual StatusCode initialize() override final
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_SF
Gaudi::Property< std::string > m_recoKey
Gaudi::Property< int > m_number_of_toys
Gaudi::Property< std::string > m_mapFile
Label for the collection.
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_uncorrUp
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_corrUp
SG::ConstAccessor< T, ALLOC > ConstAccessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Handle class for adding a decoration to an object.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
std::string getValueByKey(const std::string &mapFile, const std::string &key)
std::string convertToOneKey(const std::string &recokey, const std::string &idkey, const std::string &isokey, const std::string &trigkey)
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Electron_v1 Electron
Definition of the current "egamma version".