Skip to content
Snippets Groups Projects
Commit 9fce82b3 authored by Emily Anne Thompson's avatar Emily Anne Thompson
Browse files

Migrate KinkTrkZeeTagTool to use DataHandles

parent 22fdb5fd
No related branches found
No related tags found
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!39666Migrate LongLivedParticleDPDMaker to R22
......@@ -19,6 +19,9 @@
#include "xAODEgamma/ElectronContainer.h"
#include "xAODCaloEvent/CaloClusterContainer.h"
#include "xAODMissingET/MissingETContainer.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/WriteHandleKey.h"
#include<string>
#include<vector>
......@@ -59,12 +62,12 @@ namespace DerivationFramework {
float m_trigMatchDeltaR;
bool m_doTrigMatch;
std::string m_electronSGKey;
SG::ReadHandleKey<xAOD::ElectronContainer> m_electronSGKey { this, "ElectronContainerKey", "ElectronCollection", ""};
std::vector<std::string> m_electronIDKeys;
float m_electronPtCut;
float m_electronEtaMax;
std::string m_clusterSGKey;
SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterSGKey { this, "ClusterContainerKey", "egammaClusters", ""};
float m_clusterEtCut;
float m_clusterEtaMax;
......@@ -73,6 +76,8 @@ namespace DerivationFramework {
float m_dPhiMax;
std::string m_sgKeyPrefix;
//SG::WriteHandleKey< std::vector<float> > m_DiEleMassKey { this, "KinkTrkDiEleMass", "", "" };
//SG::WriteHandleKey< std::vector<float> > m_ProbeEleEtKey { this, "KinkTrkProbeEleEt", "", "" };
};
......
......@@ -8,8 +8,6 @@
// Author: Shimpei Yamamoto (shimpei.yamamoto@cern.ch)
#include "LongLivedParticleDPDMaker/KinkTrkZeeTagTool.h"
#include "xAODTracking/TrackingPrimitives.h"
#include "xAODMissingET/MissingETContainer.h"
#include <vector>
#include <string>
......@@ -23,11 +21,9 @@ DerivationFramework::KinkTrkZeeTagTool::KinkTrkZeeTagTool(const std::string& t,
m_trigNames(std::vector<std::string>()),
m_trigMatchDeltaR(0.1),
m_doTrigMatch(false),
m_electronSGKey("ElectronCollection"),
m_electronIDKeys(std::vector<std::string>()),
m_electronPtCut(0),
m_electronEtaMax(9999),
m_clusterSGKey("egammaClusters"),
m_clusterEtCut(0),
m_clusterEtaMax(2.8),
m_diEleMassLow(50.),
......@@ -41,16 +37,14 @@ DerivationFramework::KinkTrkZeeTagTool::KinkTrkZeeTagTool(const std::string& t,
declareProperty("Triggers", m_trigNames);
declareProperty("TriggerMatchDeltaR", m_trigMatchDeltaR);
declareProperty("RequireTriggerMatch", m_doTrigMatch);
declareProperty("ElectronContainerKey", m_electronSGKey);
declareProperty("ElectronIDKeys", m_electronIDKeys),
declareProperty("ElectronPtMin", m_electronPtCut);
declareProperty("ElectronEtaMax", m_electronEtaMax);
declareProperty("ClusterContainerKey", m_clusterSGKey);
declareProperty("ClusterEtMin", m_clusterEtCut);
declareProperty("ClusterEtaMax", m_clusterEtaMax);
declareProperty("DiEleMassLow", m_diEleMassLow);
declareProperty("DiEleMassHigh", m_diEleMassHigh);
declareProperty("DeltaPhiMax", m_dPhiMax);
declareProperty("DeltaPhiMax", m_dPhiMax);
declareProperty("StoreGateKeyPrefix", m_sgKeyPrefix);
}
......@@ -81,6 +75,11 @@ StatusCode DerivationFramework::KinkTrkZeeTagTool::initialize()
ATH_MSG_INFO("TrgMatchTool retrived successfully");
}
ATH_CHECK(m_electronSGKey.initialize());
ATH_CHECK(m_clusterSGKey.initialize());
//ATH_CHECK(m_DiEleMassKey.initialize() );
//ATH_CHECK(m_ProbeEleEtKey.initialize() );
return StatusCode::SUCCESS;
}
......@@ -96,15 +95,15 @@ StatusCode DerivationFramework::KinkTrkZeeTagTool::finalize()
// Augmentation
StatusCode DerivationFramework::KinkTrkZeeTagTool::addBranches() const
{
std::vector<float> *diEleMass = new std::vector<float>();
std::vector<float> *probeEleEt = new std::vector<float>();
const xAOD::ElectronContainer* electrons(0);
ATH_CHECK(evtStore()->retrieve(electrons, m_electronSGKey));
SG::WriteHandle< std::vector<float> > diEleMass(m_sgKeyPrefix+"DiEleMass");
ATH_CHECK(diEleMass.record(std::make_unique< std::vector<float> >()));
const xAOD::CaloClusterContainer* clusters(0);
ATH_CHECK(evtStore()->retrieve(clusters, m_clusterSGKey));
SG::WriteHandle< std::vector<float> > probeEleEt(m_sgKeyPrefix+"ProbeEleEt");
ATH_CHECK(probeEleEt.record(std::make_unique< std::vector<float> >()));
SG::ReadHandle<xAOD::ElectronContainer> electrons(m_electronSGKey);
SG::ReadHandle<xAOD::CaloClusterContainer> clusters(m_clusterSGKey);
for (const auto ele: *electrons) {
if (!checkTagElectron(ele)) continue;
for (const auto clu: *clusters) {
......@@ -115,25 +114,6 @@ StatusCode DerivationFramework::KinkTrkZeeTagTool::addBranches() const
}
}
// Writing to SG
std::string sgKey1(m_sgKeyPrefix+"DiEleMass");
if (evtStore()->contains< float >(sgKey1)) {
ATH_MSG_ERROR("StoreGate key " << sgKey1 << "already exists.");
// avoid mem leak
delete probeEleEt;
delete diEleMass;
return StatusCode::FAILURE;
}
CHECK(evtStore()->record(diEleMass, sgKey1));
std::string sgKey2(m_sgKeyPrefix+"ProbeEleEt");
if (evtStore()->contains< float >(sgKey2)) {
ATH_MSG_ERROR("StoreGate key " << sgKey2 << "already exists.");
delete probeEleEt; // avoid mem leak
return StatusCode::FAILURE;
}
CHECK(evtStore()->record(probeEleEt, sgKey2));
return StatusCode::SUCCESS;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment