ATLAS Offline Software
OverlapRemovalASG.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 // $Id$
7 #include "TopEvent/EventTools.h"
8 
9 #include <list>
10 
11 namespace top {
13  m_overlapRemovalTool("OverlapRemovalTool"),
14  m_overlapRemovalToolLoose("OverlapRemovalToolLoose"),
15  m_passPreORSelection("passPreORSelection"),
16  m_passPreORSelectionLoose("passPreORSelectionLoose"),
17  m_overlaps("overlaps"),
18  m_doLargeJet(dolargeJet) {
19  top::check(m_overlapRemovalTool.retrieve(), "Failed to retrieve overlap removal tool");
20  top::check(m_overlapRemovalToolLoose.retrieve(), "Failed to retrieve (loose) overlap removal tool");
21  }
22 
24  }
25 
28  const xAOD::MuonContainer* mu,
29  const xAOD::TauJetContainer* tau,
30  const xAOD::JetContainer* jet,
31  const xAOD::JetContainer* ljet,
32  std::vector<unsigned int>& goodPhotons,
33  std::vector<unsigned int>& goodElectrons,
34  std::vector<unsigned int>& goodMuons,
35  std::vector<unsigned int>& goodTaus,
36  std::vector<unsigned int>& goodJets,
37  std::vector<unsigned int>& goodLargeRJets,
38  const bool isLoose) {
39  std::string passTopCuts("");
40  if (!isLoose) {
42  ljet), "Failed to remove overlaps");
43  else top::check(m_overlapRemovalTool->removeOverlaps(el, mu, jet, tau, photon), "Failed to remove overlaps");
44  passTopCuts = m_passPreORSelection;
45  }
46  if (isLoose) {
48  ljet), "Failed to remove overlaps");
49  else top::check(m_overlapRemovalToolLoose->removeOverlaps(el, mu, jet, tau, photon), "Failed to remove overlaps");
50 
51  passTopCuts = m_passPreORSelectionLoose;
52  }
53 
54  removeObjectOverlap(photon, goodPhotons, passTopCuts);
55  removeObjectOverlap(el, goodElectrons, passTopCuts);
56  removeObjectOverlap(mu, goodMuons, passTopCuts);
57  removeObjectOverlap(tau, goodTaus, passTopCuts);
58  removeObjectOverlap(jet, goodJets, passTopCuts);
59  if (m_doLargeJet) removeObjectOverlap(ljet, goodLargeRJets, passTopCuts);
60  else removeObject(ljet, goodLargeRJets, passTopCuts);
61  }
62 
64  std::vector<unsigned int>& OUT_vec,
65  const std::string passTopCuts) {
66  OUT_vec.clear();
67 
68  unsigned int index(0);
69 
70  if (xaod) {
71  for (auto x : *xaod) {
72  if (x->auxdataConst< char >(passTopCuts) == 1 && x->auxdataConst< char >(m_overlaps) == 0) {
73  OUT_vec.push_back(index);
74  }
75  ++index;
76  }
77  }
78  }
79 
81  std::vector<unsigned int>& OUT_vec,
82  const std::string passTopCuts) {
83  OUT_vec.clear();
84 
85  unsigned int index(0);
86 
87  if (xaod) {
88  for (auto x : *xaod) {
89  if (x->auxdataConst< char >(passTopCuts) == 1) {
90  OUT_vec.push_back(index);
91  }
92  ++index;
93  }
94  }
95  }
96 
97  void OverlapRemovalASG::print(std::ostream& os) const {
98  os << "OverlapRemovalASG\n";
99  os << " (1) remove electron that sharing track with muon\n";
100  os << " (2) remove single jet closest to an electron (within dR < 0.2)\n";
101  os << " (3) remove electron with dR < 0.4 of jet\n";
102  os << " (4) remove muon within dR < 0.4 of any jet\n";
103  }
104 }
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
ORUtils::IOverlapRemovalTool::removeOverlaps
virtual StatusCode removeOverlaps(const xAOD::ElectronContainer *electrons, const xAOD::MuonContainer *muons, const xAOD::JetContainer *jets, const xAOD::TauJetContainer *taus=0, const xAOD::PhotonContainer *photons=0, const xAOD::JetContainer *fatJets=0) const =0
Declare the interface.
asg::AnaToolHandle::retrieve
StatusCode retrieve()
initialize the tool
index
Definition: index.py:1
top::OverlapRemovalASG::m_overlapRemovalToolLoose
asg::AnaToolHandle< ORUtils::IOverlapRemovalTool > m_overlapRemovalToolLoose
Definition: OverlapRemovalASG.h:90
top::OverlapRemovalASG::removeObjectOverlap
virtual void removeObjectOverlap(const xAOD::IParticleContainer *xaod, std::vector< unsigned int > &OUT_vec, const std::string passTopCuts)
For a generic container of type DataVector, fill a vector of ints for objects we want to keep.
Definition: OverlapRemovalASG.cxx:63
OverlapRemovalASG.h
top::OverlapRemovalASG::m_passPreORSelection
const std::string m_passPreORSelection
Definition: OverlapRemovalASG.h:92
x
#define x
top::OverlapRemovalASG::OverlapRemovalASG
OverlapRemovalASG(bool dolargeJet=false)
Sets up ASG Overlap Removal Tool.
Definition: OverlapRemovalASG.cxx:12
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::OverlapRemovalASG::m_passPreORSelectionLoose
const std::string m_passPreORSelectionLoose
Definition: OverlapRemovalASG.h:93
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
top::OverlapRemovalASG::removeObject
virtual void removeObject(const xAOD::IParticleContainer *xaod, std::vector< unsigned int > &OUT_vec, const std::string passTopCuts)
For a generic container of type DataVector, fill a vector of ints for objects we want to keep This do...
Definition: OverlapRemovalASG.cxx:80
top::OverlapRemovalASG::~OverlapRemovalASG
virtual ~OverlapRemovalASG()
does nothing
Definition: OverlapRemovalASG.cxx:23
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
top::OverlapRemovalASG::print
virtual void print(std::ostream &) const
Print something useful to the screen.
Definition: OverlapRemovalASG.cxx:97
DeMoScan.index
string index
Definition: DeMoScan.py:362
top::OverlapRemovalASG::m_doLargeJet
bool m_doLargeJet
Definition: OverlapRemovalASG.h:96
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
top::OverlapRemovalASG::m_overlaps
const std::string m_overlaps
Definition: OverlapRemovalASG.h:94
top::OverlapRemovalASG::m_overlapRemovalTool
asg::AnaToolHandle< ORUtils::IOverlapRemovalTool > m_overlapRemovalTool
Definition: OverlapRemovalASG.h:89
top::OverlapRemovalASG::overlapremoval
virtual void overlapremoval(const xAOD::PhotonContainer *photon, const xAOD::ElectronContainer *el, const xAOD::MuonContainer *mu, const xAOD::TauJetContainer *tau, const xAOD::JetContainer *jet, const xAOD::JetContainer *ljet, std::vector< unsigned int > &goodPhotons, std::vector< unsigned int > &goodElectrons, std::vector< unsigned int > &goodMuons, std::vector< unsigned int > &goodTaus, std::vector< unsigned int > &goodJets, std::vector< unsigned int > &goodLargeRJets, const bool isLooseEvent)
Perform the "ASG standard" overlap removal.
Definition: OverlapRemovalASG.cxx:26
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53