Commit 881d6c6e authored by Federica Fabbri's avatar Federica Fabbri Committed by Nils Erik Krumnack
Browse files

Add selection and uncertainties for tracks GA to largeR jets in AnalysisTop

parent a2d3a7a8
......@@ -136,6 +136,11 @@ namespace top {
2.5,topConfig->ghostTracksVertexAssociation(),topConfig->jetPtGhostTracks(), 2.5));
}
///-- Ghost Track Jets --///
if (topConfig->useLargeRJetGhostTrack() && topConfig->useLargeRJets()) {
objectSelection->jetGhostTrackSelectionLargeR(new top::JetGhostTrackSelection(topConfig->ghostTrackspTLargeR(),2.5,topConfig->ghostTracksVertexAssociationLargeR(),topConfig->largeRjetPtGhostTracks(),topConfig->largeRjetEtaGhostTracks(),false));
}
///-- Tracks --///
if (topConfig->useTracks()) {
objectSelection->trackSelection(new top::TrackSelection(topConfig->trackPtcut(), topConfig->trackEtacut()));
......
......@@ -30,7 +30,7 @@ namespace top {
return StatusCode::SUCCESS;
}
if (!m_config->useJets() || !m_config->useJetGhostTrack()) {
if ((!m_config->useJets() || !m_config->useJetGhostTrack()) && (!m_config->useLargeRJets() || !m_config->useLargeRJetGhostTrack() )) {
ATH_MSG_INFO(
"top::GhostTrackCPTools: no need to initialise anything since not using jets or tracks ghost-matched to jets");
return StatusCode::SUCCESS;
......@@ -73,13 +73,26 @@ namespace top {
StatusCode GhostTrackCPTools::setupSelectionTool() {
if (asg::ToolStore::contains<InDet::InDetTrackSelectionTool>(m_TrkSelName)) {
m_trackseltool = asg::ToolStore::get<InDet::InDetTrackSelectionTool>(m_TrkSelName);
} else {
auto selTool = std::make_unique<InDet::InDetTrackSelectionTool>( m_TrkSelName ,m_config->ghostTracksQuality());
top::check(selTool -> initialize(), "Failed to initialize InDetTrackSelectionTool for GA tracks");
m_trackseltool = selTool.release();
ATH_MSG_INFO("Creating selection tool " + m_TrkSelName);
if(m_config->useJets() && m_config->useJetGhostTrack()) {
if (asg::ToolStore::contains<InDet::InDetTrackSelectionTool>(m_TrkSelName)) {
m_trackseltool = asg::ToolStore::get<InDet::InDetTrackSelectionTool>(m_TrkSelName);
} else {
auto selTool = std::make_unique<InDet::InDetTrackSelectionTool>( m_TrkSelName ,m_config->ghostTracksQuality());
top::check(selTool -> initialize(), "Failed to initialize InDetTrackSelectionTool for GA tracks");
m_trackseltool = selTool.release();
ATH_MSG_INFO("Creating selection tool " + m_TrkSelName);
}
}
if(m_config->useLargeRJets() && m_config->useLargeRJetGhostTrack()) {
if (asg::ToolStore::contains<InDet::InDetTrackSelectionTool>(m_TrkSelNameLargeR)) {
m_trackseltoolLargeR = asg::ToolStore::get<InDet::InDetTrackSelectionTool>(m_TrkSelNameLargeR);
} else {
auto selTool = std::make_unique<InDet::InDetTrackSelectionTool>( m_TrkSelNameLargeR ,m_config->ghostTracksQualityLargeR());
top::check(selTool -> initialize(), "Failed to initialize InDetTrackSelectionTool for GA tracks in LargeR jets");
m_trackseltoolLargeR = selTool.release();
ATH_MSG_INFO("Creating selection tool " + m_TrkSelNameLargeR);
}
}
return StatusCode::SUCCESS;
......
......@@ -60,6 +60,10 @@ namespace top {
const std::string m_TrkSelName {
"top::GhostTrackCPTools::TrkSelTool"
};
const std::string m_TrkSelNameLargeR {
"top::GhostTrackCPTools::TrkSelToolLargeR"
};
ToolHandle<InDet::InDetTrackSmearingTool> m_smearingTool;
ToolHandle<InDet::InDetTrackTruthOriginTool> m_truthOriginTool;
......@@ -67,8 +71,11 @@ namespace top {
ToolHandle<InDet::JetTrackFilterTool> m_jetTrackFilterTool;
ToolHandle<InDet::InDetTrackSelectionTool> m_trackseltool;
std::vector<ToolHandle<InDet::InDetTrackBiasingTool> > m_biasingTool;
ToolHandle<InDet::InDetTrackSelectionTool> m_trackseltoolLargeR;
StatusCode setupSmearingTool();
StatusCode setupBiasingTools();
......
......@@ -189,6 +189,21 @@ namespace top {
"WP of the ghost track vertex association. Option: none, nominal and tight. Default nominal.","nominal");
registerParameter("GhostTracksQuality",
"WP of the ghost track quality. Option: TightPrimary, LoosePrimary. Loose, NoCut. Default TightPrimary.","TightPrimary");
registerParameter("LargeRJetPtGhostTracks",
"Jet pT threshold for ghost track systematic variations calculation (in MeV). Default 150000 GeV.",
"150000.");
registerParameter("LargeRJetEtaGhostTracks",
"Jet eta threshold for ghost track systematic variations calculation. Default 2.0",
"2.0");
registerParameter("GhostTrackspTLargeR",
"PT of the ghost tracks associated large-R jets (in MeV). Default 500 MeV.",
"500.");
registerParameter("GhostTracksVertexAssociationLargeR",
"WP of the ghost track vertex association (for largeR jets). Option: none, nominal and tight. Default nominal.","nominal");
registerParameter("GhostTracksQualityLargeR",
"WP of the ghost track quality (for largeR jets). Option: TightPrimary, LoosePrimary. Loose, NoCut. Default TightPrimary.","TightPrimary");
registerParameter("JetUncertainties_NPModel",
"AllNuisanceParameters, CategoryReduction (default), GlobalReduction, StrongReduction - for JetUncertainties",
"CategoryReduction");
......
......@@ -39,6 +39,7 @@ namespace top {
m_useRCJets(false),
m_useVarRCJets(false),
m_useJetGhostTrack(false),
m_useLargeRJetGhostTrack(false),
m_useTracks(false),
m_useTruthParticles(false),
m_useTruthElectrons(false),
......@@ -250,6 +251,8 @@ namespace top {
m_jetEtacut(2.5),
m_jetPtGhostTracks(30000.),
m_jetEtaGhostTracks(2.5),
m_largeRjetPtGhostTracks(150000),
m_largeRjetEtaGhostTracks(2.0),
m_jetUncertainties_NPModel("AllNuisanceParameters"),
m_jetUncertainties_QGFracFile("None"),
m_jetUncertainties_QGHistPatterns(),
......@@ -271,6 +274,10 @@ namespace top {
m_ghostTrackspT(500.),
m_ghostTracksVertexAssociation("nominal"),
m_ghostTracksQuality("TightPrimary"),
m_ghostTrackspTLargeR(500.),
m_ghostTracksVertexAssociationLargeR("nominal"),
m_ghostTracksQualityLargeR("TightPrimary"),
m_largeRJetPtcut(25000.),
m_largeRJetEtacut(2.5),
......@@ -1322,6 +1329,8 @@ namespace top {
ATH_MSG_WARNING("jetPtGhostTracks set to " << m_jetPtGhostTracks <<" to ensure that all the selected jets have the ghost tracks associated");
}
this->jetEtaGhostTracks(std::stof(settings->value("JetEtaGhostTracks")));
this->largeRjetEtaGhostTracks(std::stof(settings->value("LargeRJetEtaGhostTracks")));
this->largeRjetPtGhostTracks(std::stof(settings->value("LargeRJetPtGhostTracks")));
this->jetUncertainties_NPModel(settings->value("JetUncertainties_NPModel"));
this->jetUncertainties_QGFracFile(settings->value("JetUncertainties_QGFracFile"));
this->jetUncertainties_QGHistPatterns(settings->value("JetUncertainties_QGHistPatterns"));
......@@ -1377,6 +1386,10 @@ namespace top {
this->ghostTrackspT(std::stof(settings->value("GhostTrackspT")));
this->ghostTracksVertexAssociation(settings->value("GhostTracksVertexAssociation"));
this->ghostTracksQuality(settings->value("GhostTracksQuality"));
this->ghostTrackspTLargeR(std::stof(settings->value("GhostTrackspTLargeR")));
this->ghostTracksVertexAssociationLargeR(settings->value("GhostTracksVertexAssociationLargeR"));
this->ghostTracksQualityLargeR(settings->value("GhostTracksQualityLargeR"));
this->trackPtcut(std::stof(settings->value("TrackPt")));
this->trackEtacut(std::stof(settings->value("TrackEta")));
......@@ -2079,7 +2092,11 @@ namespace top {
void TopConfig::decoKeyJetGhostTrack(const std::string& key) {
if (!m_configFixed) {
m_useJetGhostTrack = false;
if (key != "None") m_useJetGhostTrack = true;
if (key != "None")
{
m_useJetGhostTrack = true;
m_useLargeRJetGhostTrack = true;
}
m_decoKeyJetGhostTrack = key;
}
......@@ -2088,7 +2105,7 @@ namespace top {
// setting the run periods for ghost track
// even if configuration is fixed - could be changed later
void TopConfig::runPeriodJetGhostTrack(const std::vector<std::uint32_t>& vect) {
if (m_useJetGhostTrack == true) m_jetGhostTrackRunPeriods = vect;
if (m_useJetGhostTrack == true || m_useLargeRJetGhostTrack == true) m_jetGhostTrackRunPeriods = vect;
}
// setting the run periods for tracks
......@@ -2827,7 +2844,7 @@ namespace top {
m_systAllTTreeNames->insert(std::make_pair((*i).first, (*i).second.name()));
}
}
if (m_useJetGhostTrack) {
if (m_useJetGhostTrack || m_useLargeRJetGhostTrack) {
for (Itr i = m_systMapJetGhostTrack->begin(); i != m_systMapJetGhostTrack->end(); ++i) {
m_systAllTTreeNames->insert(std::make_pair((*i).first, (*i).second.name()));
}
......
......@@ -88,6 +88,7 @@ namespace top {
inline bool useTrackJets() const {return m_useTrackJets;}
inline bool useTracks() const {return m_useTracks;}
inline bool useJetGhostTrack() const {return m_useJetGhostTrack;}
inline bool useLargeRJetGhostTrack() const {return m_useLargeRJetGhostTrack;}
inline bool useRCJets() const {return m_useRCJets;}
inline bool useVarRCJets() const {return m_useVarRCJets;}
......@@ -1102,6 +1103,36 @@ namespace top {
m_ghostTracksQuality = ghostTracksQuality;
}
}
inline virtual void largeRjetPtGhostTracks(const float pt) {
if (!m_configFixed) {
m_largeRjetPtGhostTracks = pt;
}
}
inline virtual void largeRjetEtaGhostTracks(const float eta) {
if (!m_configFixed) {
m_largeRjetEtaGhostTracks = eta;
}
}
inline virtual void ghostTrackspTLargeR(const float pt) {
if (!m_configFixed) {
m_ghostTrackspTLargeR = pt;
}
}
inline virtual void ghostTracksVertexAssociationLargeR(const std::string& vertexassociation) {
if (!m_configFixed) {
m_ghostTracksVertexAssociationLargeR = vertexassociation;
}
}
inline virtual void ghostTracksQualityLargeR(const std::string& ghostTracksQuality) {
if (!m_configFixed) {
m_ghostTracksQualityLargeR = ghostTracksQuality;
}
}
inline virtual float jetPtcut() const {return m_jetPtcut;}
inline virtual float jetEtacut() const {return m_jetEtacut;}
......@@ -1110,8 +1141,15 @@ namespace top {
inline virtual const std::string& ghostTracksVertexAssociation() const {return m_ghostTracksVertexAssociation;}
inline virtual const std::string& ghostTracksQuality() const {return m_ghostTracksQuality;}
inline virtual float ghostTrackspTLargeR() const {return m_ghostTrackspTLargeR;}
inline virtual const std::string& ghostTracksVertexAssociationLargeR() const {return m_ghostTracksVertexAssociationLargeR;}
inline virtual const std::string& ghostTracksQualityLargeR() const {return m_ghostTracksQualityLargeR;}
inline virtual float jetPtGhostTracks() const {return m_jetPtGhostTracks;}
inline virtual float jetEtaGhostTracks() const {return m_jetEtaGhostTracks;}
inline virtual float largeRjetEtaGhostTracks() const {return m_largeRjetEtaGhostTracks;}
inline virtual float largeRjetPtGhostTracks() const {return m_largeRjetPtGhostTracks;}
inline virtual void largeRJetPtcut(const float pt) {
......@@ -2011,6 +2049,7 @@ namespace top {
// available. However, we want the systematics to be executed automatically
// whenever the user has "configured" ghost tracks.
bool m_useJetGhostTrack;
bool m_useLargeRJetGhostTrack;
bool m_useTracks;
......@@ -2275,6 +2314,8 @@ namespace top {
float m_jetEtacut; // jet object selection (abs) eta cut
float m_jetPtGhostTracks; // jet pt threshold for ghost track systematic variations calculation
float m_jetEtaGhostTracks; // jet eta threshold for ghost track systematic variations calculation
float m_largeRjetPtGhostTracks; // jet pt threshold for ghost track systematic variations calculation
float m_largeRjetEtaGhostTracks; // jet eta threshold for ghost track systematic variations calculation
std::string m_jetUncertainties_NPModel; // AllNuisanceParameters, 19NP or 3NP
std::string m_jetUncertainties_QGFracFile; // to improve Flavour composition and response
std::vector<std::string> m_jetUncertainties_QGHistPatterns; // to improve Flavour composition and response, with
......@@ -2297,6 +2338,10 @@ namespace top {
float m_ghostTrackspT;
std::string m_ghostTracksVertexAssociation;
std::string m_ghostTracksQuality;
float m_ghostTrackspTLargeR;
std::string m_ghostTracksVertexAssociationLargeR;
std::string m_ghostTracksQualityLargeR;
// Large R jet configuration
float m_largeRJetPtcut; // large R jet object selection pT cut
......
......@@ -646,8 +646,10 @@ void RCJetMC15::getPflowConstituent(std::vector<fastjet::PseudoJet>& clusters, c
}
}
} else {
ATH_MSG_WARNING(
"RCJETMC15::No remaining tracks associated to the PFlow jet");
}
if (m_config->nominalHashValue() == event.m_hashValue){
ATH_MSG_WARNING(
"RCJETMC15::No remaining tracks associated to the PFlow jet");
}
}
}
}
......@@ -18,15 +18,20 @@ using namespace TopObjectSelectionTools;
namespace top {
JetGhostTrackSelection::JetGhostTrackSelection(const double ptcut, const double etamax, const std::string vertexassociation, const double ptcut_jet, const double etacut_jet ) :
JetGhostTrackSelection::JetGhostTrackSelection(const double ptcut, const double etamax, const std::string vertexassociation, const double ptcut_jet, const double etacut_jet, bool smallJet ) :
m_ptcut(ptcut),
m_etamax(etamax),
m_ptcut_jet(ptcut_jet),
m_etamax_jet(etacut_jet),
m_vertexassociation(vertexassociation),
m_trkseltool("top::GhostTrackCPTools::TrkSelTool")
m_vertexassociation(vertexassociation)
{
if (smallJet) {
m_trkseltool=ToolHandle<InDet::InDetTrackSelectionTool>("top::GhostTrackCPTools::TrkSelTool");
}
else
m_trkseltool=ToolHandle<InDet::InDetTrackSelectionTool>("top::GhostTrackCPTools::TrkSelToolLargeR");
top::check(m_trkseltool.retrieve(), "Failed to retrieve InDetTrackSelectionTool");
// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/TrackingCPRecsRun2Final
......@@ -37,6 +42,7 @@ namespace top {
else if(m_vertexassociation == "tight"){
m_d0=0.5;
m_z0sintheta=0.5;
}
else {
ATH_MSG_INFO("Not applying any vertex association for GA tracks");
......
......@@ -41,6 +41,7 @@ namespace top {
m_largeJetSelection(nullptr),
m_trackJetSelection(nullptr),
m_jetGhostTrackSelection(nullptr),
m_jetGhostTrackSelectionLargeR(nullptr),
m_trackSelection(nullptr),
m_overlapRemovalToolPostSelection(nullptr),
m_electronInJetSubtractor(nullptr),
......@@ -154,6 +155,10 @@ namespace top {
void TopObjectSelection::jetGhostTrackSelection(JetGhostTrackSelectionBase* ptr) {
m_jetGhostTrackSelection.reset(ptr);
}
void TopObjectSelection::jetGhostTrackSelectionLargeR(JetGhostTrackSelectionBase* ptr) {
m_jetGhostTrackSelectionLargeR.reset(ptr);
}
void TopObjectSelection::trackSelection(TrackSelectionBase* ptr) {
m_trackSelection.reset(ptr);
......@@ -219,6 +224,9 @@ namespace top {
if (m_config->useJetGhostTrack() && m_jetGhostTrackSelection != nullptr) {
applySelectionPreOverlapRemovalJetGhostTracks();
}
if (m_config->useLargeRJetGhostTrack() && m_jetGhostTrackSelectionLargeR != nullptr) {
applySelectionPreOverlapRemovalJetGhostTracksLargeR();
}
if (m_config->useTracks() && m_trackSelection != nullptr) {
applySelectionPreOverlapRemovalTracks();
}
......@@ -625,11 +633,13 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
std::vector<const xAOD::TrackParticle*> jetTracks;
jetTracks = jetPtr->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(currentSystematic.first));
try{jetTracks = jetPtr->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(currentSystematic.first));}catch (...) { }
if (jetTracks.size() == 0){
ATH_MSG_WARNING("TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() failed to retrieve tracks, jet pT and eta:" << jetPtr->pt() << " " << std::fabs(jetPtr->eta()) );
continue;
if (jetPtr->pt() > m_config->jetPtcut() && std::fabs(jetPtr->eta()) < m_config->jetEtacut() ){
ATH_MSG_WARNING("TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() failed to retrieve tracks, jet pT and eta:" << jetPtr->pt() << " " << std::fabs(jetPtr->eta()) );
continue;
}
}
const xAOD::VertexContainer* vertices = nullptr;
......@@ -654,6 +664,72 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
}
}
void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracksLargeR() {
auto jetsystematic = *m_config->systSgKeyMapLargeRJets();
CP::SystematicSet nominal;
std::size_t m_nominalHashValue = nominal.hash();
for (auto currentSystematic : *m_config->systMapJetGhostTrack()) {
// At this point some specific jet collection doesn't exist for tracking systematic so use the nominal jet collection to retrieve the ghost tracks
std::unordered_map<std::size_t, std::string>::const_iterator jetsyst_name = jetsystematic.find(currentSystematic.first);
if (jetsyst_name == jetsystematic.end()) {
jetsyst_name = jetsystematic.find(m_nominalHashValue);
}
///-- if executeNominal, skip other systematics (and vice-versa) --///
if (m_executeNominal && !m_config->isSystNominal(m_config->systematicName(currentSystematic.first))) continue;
if (!m_executeNominal && m_config->isSystNominal(m_config->systematicName(currentSystematic.first))) continue;
const xAOD::JetContainer* jets(nullptr);
top::check(evtStore()->retrieve(jets,
(*jetsyst_name).second),
"TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracksLargeR() failed to retrieve large-R jets");
ATH_MSG_DEBUG(" Cut on JetsGhostTracksLargeR with key = " << (*jetsyst_name).second);
for (auto jetPtr : *jets)
{
if(!m_jetGhostTrackSelectionLargeR->JetConsideredForGhostTrackSelection(jetPtr->pt(),jetPtr->eta())) continue;
std::vector<const xAOD::TrackParticle*> jetTracks;
try{jetTracks = jetPtr->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(currentSystematic.first));} catch(...){}
if (jetTracks.size() == 0){
if (jetPtr->pt() > m_config->largeRJetPtcut() && std::fabs(jetPtr->eta()) < m_config->largeRJetEtacut() ){
if (jetPtr->pt() > m_config->largeRjetPtGhostTracks() && std::fabs(jetPtr->eta()) < m_config->largeRjetEtaGhostTracks() ){
ATH_MSG_WARNING("TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracksLargeR() failed to retrieve tracks, jet pT and eta:" << jetPtr->pt() << " " << std::fabs(jetPtr->eta()) );
continue;
}
}
}
const xAOD::VertexContainer* vertices = nullptr;
top::check(evtStore() -> retrieve( vertices, "PrimaryVertices" ), "Failed to get primary vertices");
const auto it_pv = std::find_if(vertices->cbegin(), vertices->cend(),
[](const xAOD::Vertex* vtx)
{return vtx->vertexType() == xAOD::VxType::PriVtx;});
const xAOD::Vertex* primaryVertex = (it_pv == vertices->cend()) ? nullptr : *it_pv;
if (primaryVertex == nullptr) ATH_MSG_WARNING("TopObjectSelection No primary vertex found." );
for (auto jetTrIt : jetTracks){
//Decorate the tracks with a flag "passPreORSelection" to indicate if they passed the selection
jetTrIt->auxdecor<char>(m_passPreORSelection) = m_jetGhostTrackSelectionLargeR->passSelection(*jetTrIt, *primaryVertex);
jetTrIt->auxdecor<char>(m_ORToolDecoration) = jetTrIt->auxdataConst<char>(m_passPreORSelection) * 2;
}
}
}
}
void TopObjectSelection::applySelectionPreOverlapRemovalTracks() {
......@@ -668,7 +744,8 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
top::check(evtStore()->retrieve(tracks,
currentSystematic.second),
"TopObjectSelection::applySelectionPreOverlapRemovalTracks() failed to retrieve tracks");
ATH_MSG_DEBUG(" Cut on Tracks with key = " << currentSystematic.second);
const xAOD::VertexContainer* vertices = nullptr;
......@@ -989,13 +1066,11 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
//It doesn't work for the nominal systematic
if (m_config->useJetGhostTrack() && m_config->useJets()) {
std::vector<const xAOD::TrackParticle*> jetTracks;
xAOD::JetContainer* xaod_jet_ga(nullptr);
top::check(evtStore()->retrieve(xaod_jet_ga, m_config->sgKeyJets(hash,looseLeptonOR)),
"TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve jets for ghost matching");
unsigned int index= -1;
int index= 0;
for (const auto jetPtr : *xaod_jet_ga){
......@@ -1008,10 +1083,11 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
continue;
}
jetTracks.clear();
std::vector<const xAOD::TrackParticle*> goodJetGhostTracks;
jetTracks = jetPtr->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(hash));
std::vector<const xAOD::TrackParticle*> jetTracks;
try{ jetTracks = jetPtr->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(hash));} catch (...) { ATH_MSG_WARNING("TopObjectSelection::applyOverlapRemoval(), failed to load tracks from the jet with pT "<< jetPtr->pt() << "you should decrease the jetPt requirements for ghost tracks");
}
if (jetTracks.size() != 0) {
......@@ -1032,6 +1108,52 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
}
if (m_config->useLargeRJetGhostTrack() && m_config->useLargeRJets()) {
xAOD::JetContainer* xaod_largeRjet_ga(nullptr);
top::check(evtStore()->retrieve(xaod_largeRjet_ga, m_config->sgKeyLargeRJets(
hash)),
"TopObjectSelection::applyOverlapRemovalPostSelection() failed to retrieve large-R jets for ghost matching");
int index= -1;
for (const auto jetPtr : *xaod_largeRjet_ga){
index=index+1;
if(!m_jetGhostTrackSelectionLargeR->JetConsideredForGhostTrackSelection(jetPtr->pt(),jetPtr->eta()))
continue;
if (std::find(goodLargeRJets.begin(), goodLargeRJets.end(), index) == goodLargeRJets.end()){
continue;
}
std::vector<const xAOD::TrackParticle*> goodJetGhostTracks;
std::vector<const xAOD::TrackParticle*> jetTracks;
try{ jetTracks = jetPtr->getAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(hash));} catch (...) { ATH_MSG_WARNING("TopObjectSelection::applyOverlapRemoval(), failed to load tracks from the large-R jet with pT "<< jetPtr->pt() << "you should decrease the largeRjetPt requirements for ghost tracks"); }
if (jetTracks.size() != 0) {
std::string passTopCuts = "passPreORSelection";
for (const auto& track: jetTracks) {
if (track->auxdataConst< char >(passTopCuts) == 1) {
goodJetGhostTracks.push_back(track);
}
}
jetPtr->setAssociatedObjects<xAOD::TrackParticle>(m_config->decoKeyJetGhostTrack(hash), goodJetGhostTracks);
}
}
}
// set the indices in the xAOD::SystematicEvent
currentSystematic->setGoodPhotons(goodPhotons);
currentSystematic->setGoodElectrons(goodElectrons);
......@@ -1256,12 +1378,18 @@ void TopObjectSelection::applySelectionPreOverlapRemovalJetGhostTracks() {
os << "GhostTracks\n";
os << " ContainerName: " << m_config->decoKeyJetGhostTrack() << "\n";
if (m_config->useJetGhostTrack()) {
os << " Selection: ";
os << " Selection small-R jets: ";
if (!m_jetGhostTrackSelection) os << "All";
// else m_jetGhostTrackSelection->print(os);
else os << *m_jetGhostTrackSelection;
}
if (m_config->useLargeRJetGhostTrack() && m_config->useLargeRJets()) {
os << "\n";
os << " Selection Large-R jets: ";
if (!m_jetGhostTrackSelectionLargeR) os << "All";
else os << *m_jetGhostTrackSelectionLargeR;
}
os << "\n";
os << "MET\n";
......
......@@ -15,7 +15,7 @@
namespace top {
class JetGhostTrackSelection: public JetGhostTrackSelectionBase {
public:
JetGhostTrackSelection(const double ptcut, const double etamax, const std::string vertexassociation, const double m_ptcut_jet, const double m_etamax_jet );
JetGhostTrackSelection(const double ptcut, const double etamax, const std::string vertexassociation, const double m_ptcut_jet, const double m_etamax_jet, bool smallJet=true);
~JetGhostTrackSelection();
virtual bool JetConsideredForGhostTrackSelection(double pt, double eta) const override;
virtual bool passSelection(const xAOD::TrackParticle&, const xAOD::Vertex&) const override;
......
......@@ -207,6 +207,17 @@ namespace top {
*/
void jetGhostTrackSelection(JetGhostTrackSelectionBase* ptr);
/**
* @brief Set the code used to select tracks ghost associated to large-R jets.
*
* Note that nullptr means that no selection will be applied (so all
* tracks associated to jets will be accepted).
*
* @param ptr The code used to perform the ghost track selection (see
* TopObjectSelectionTools).