00001 #ifndef ASSOCIATIONUTILS_OVERLAPREMOVALTOOL_H
00002 #define ASSOCIATIONUTILS_OVERLAPREMOVALTOOL_H
00003
00004
00005 #include "AsgTools/AsgTool.h"
00006
00007
00008 #include "xAODBase/IParticle.h"
00009
00010
00011 #include "AssociationUtils/IOverlapRemovalTool.h"
00012 #include "AssociationUtils/OverlapRemovalDefs.h"
00013
00025 class OverlapRemovalTool : public virtual IOverlapRemovalTool,
00026 public asg::AsgTool
00027 {
00028
00030 ASG_TOOL_CLASS(OverlapRemovalTool, IOverlapRemovalTool)
00031
00032 public:
00033
00035 OverlapRemovalTool(const std::string& name);
00037 ~OverlapRemovalTool();
00038
00041
00043 virtual StatusCode initialize() override;
00044
00046
00049
00055 virtual StatusCode removeOverlaps(const xAOD::ElectronContainer* electrons,
00056 const xAOD::MuonContainer* muons,
00057 const xAOD::JetContainer* jets,
00058 const xAOD::TauJetContainer* taus = 0,
00059 const xAOD::PhotonContainer* photons = 0) override;
00060
00067 virtual StatusCode removeOverlaps(const xAOD::ElectronContainer* electrons,
00068 const xAOD::MuonContainer* muons,
00069 const xAOD::JetContainer* jets,
00070 const xAOD::TauJetContainer* taus,
00071 const xAOD::ElectronContainer* looseElectrons,
00072 const xAOD::MuonContainer* looseMuons,
00073 const xAOD::PhotonContainer* photons = 0) override;
00074
00078 virtual StatusCode removeEleJetOverlap(const xAOD::ElectronContainer& electrons,
00079 const xAOD::JetContainer& jets) override;
00080
00082 virtual StatusCode removeMuonJetOverlap(const xAOD::MuonContainer& muons,
00083 const xAOD::JetContainer& jets) override;
00084
00087 virtual StatusCode removeEleMuonOverlap(const xAOD::ElectronContainer& electrons,
00088 const xAOD::MuonContainer& muons) override;
00089
00091 virtual StatusCode removeTauJetOverlap(const xAOD::TauJetContainer& taus,
00092 const xAOD::JetContainer& jets) override;
00093
00095 virtual StatusCode removeTauEleOverlap(const xAOD::TauJetContainer& taus,
00096 const xAOD::ElectronContainer& electrons) override;
00097
00099 virtual StatusCode removeTauMuonOverlap(const xAOD::TauJetContainer& taus,
00100 const xAOD::MuonContainer& muons) override;
00101
00103 virtual StatusCode removePhotonEleOverlap(const xAOD::PhotonContainer& photons,
00104 const xAOD::ElectronContainer& electrons) override;
00105
00107 virtual StatusCode removePhotonMuonOverlap(const xAOD::PhotonContainer& photons,
00108 const xAOD::MuonContainer& muons) override;
00109
00111 virtual StatusCode removePhotonPhotonOverlap(const xAOD::PhotonContainer& photons) override;
00112
00114 virtual StatusCode removePhotonJetOverlap(const xAOD::PhotonContainer& photons,
00115 const xAOD::JetContainer& jets) override;
00116
00118
00119 protected:
00120
00121
00122
00124 StatusCode isLooseEleForTauEleOR(const xAOD::Electron* electron, bool& pass);
00126 StatusCode isLooseMuonForTauMuonOR(const xAOD::Muon* muon, bool& pass);
00127
00130 bool isBJet(const xAOD::Jet* jet);
00131
00133 bool objectOverlaps(const xAOD::IParticle* obj,
00134 const xAOD::IParticleContainer& container,
00135 double dR);
00136
00138 bool objectsOverlap(const xAOD::IParticle* p1, const xAOD::IParticle* p2,
00139 double dRMax, double dRMin = 0);
00140
00142 StatusCode addOverlapObjectLink(const xAOD::IParticle* p1,
00143 const xAOD::IParticle* p2);
00144
00149 double deltaR2(const xAOD::IParticle* p1, const xAOD::IParticle* p2);
00151 double deltaR(const xAOD::IParticle* p1, const xAOD::IParticle* p2);
00152
00154 bool isInputObject(const xAOD::IParticle* obj);
00155
00157 bool isRejectedObject(const xAOD::IParticle* obj);
00158
00160 bool isSurvivingObject(const xAOD::IParticle* obj)
00161 { return isInputObject(obj) && !isRejectedObject(obj); }
00162
00164 void setOverlapDecoration(const xAOD::IParticle* obj, bool result);
00165
00167 void setObjectPass(const xAOD::IParticle* obj)
00168 { setOverlapDecoration(obj, false); }
00169
00171 void setObjectFail(const xAOD::IParticle* obj)
00172 { setOverlapDecoration(obj, true); }
00173
00177 bool isDecorated(const xAOD::IParticleContainer& container);
00178
00183 void initializeDecorations(const xAOD::IParticleContainer& container);
00184
00186 void resetDecorations(const xAOD::IParticleContainer& container);
00187
00192
00195 bool checkTrackParticles(const xAOD::ElectronContainer& container);
00197 bool checkSharesTrackDecoration(const xAOD::ElectronContainer& container);
00199 bool sharesTrack(const xAOD::IParticle* obj);
00201 StatusCode setSharesTrackDecoration(const xAOD::IParticle* obj, bool sharesTrack);
00203 void initializeSharesTrackDecoration(const xAOD::ElectronContainer& container);
00204
00205 private:
00206
00207
00208
00209
00210
00212 std::string m_inputLabel;
00214 std::string m_overlapLabel;
00215
00217 std::string m_bJetLabel;
00218
00220 bool m_linkOverlapObjects;
00221
00223 float m_electronJetDR;
00225 float m_jetElectronDR;
00227 float m_muonJetDR;
00229 float m_tauJetDR;
00231 float m_tauElectronDR;
00233 float m_tauMuonDR;
00235 float m_photonElectronDR;
00237 float m_photonMuonDR;
00239 float m_photonPhotonDR;
00241 float m_photonJetDR;
00242
00244 std::string m_tauEleOverlapID;
00246 float m_tauMuOverlapMuPt;
00248 float m_tauMuOverlapTauPt;
00249
00252 bool m_writeSharedTrackFlag;
00254 bool m_useSharedTrackFlag;
00255
00256
00257
00258
00259
00261 ort::inputAccessor_t* m_inputAccessor;
00263 ort::outputDecorator_t* m_outputDecorator;
00265 ort::inputAccessor_t* m_bJetAccessor;
00267 ort::objLinkDecorator_t* m_overlapLinkDecorator;
00269 ort::sharedTrackDecorator_t* m_sharedTrackDecorator;
00271 ort::sharedTrackAccessor_t* m_sharedTrackAccessor;
00272
00273 }
00274 #if not defined(__GCCXML__) and not defined(__ROOTCLING__) and not defined(__MAKECINT__)
00275 __attribute__((deprecated))
00276 #endif
00277 ;
00278
00279 #endif