diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1da37e881cb49effc6fd6f16c6739e04653c86dc --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/CMakeLists.txt @@ -0,0 +1,41 @@ +################################################################################ +# Package: DerivationFrameworkHiggs +################################################################################ + +# Declare the package name: +atlas_subdir( DerivationFrameworkHiggs ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + Event/xAOD/xAODEgamma + Event/xAOD/xAODJet + Event/xAOD/xAODMuon + PhysicsAnalysis/DerivationFramework/DerivationFrameworkInterfaces + Trigger/TrigAnalysis/TrigDecisionTool + PRIVATE + Event/xAOD/xAODEventInfo + Event/xAOD/xAODTracking + GaudiKernel ) + +# External dependencies: +find_package( CLHEP ) + +# Component(s) in the package: +atlas_add_library( DerivationFrameworkHiggsLib + src/*.cxx + PUBLIC_HEADERS DerivationFrameworkHiggs + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES AthenaBaseComps xAODEgamma xAODJet xAODMuon TrigDecisionToolLib + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} xAODEventInfo xAODTracking GaudiKernel ) + +atlas_add_component( DerivationFrameworkHiggs + src/components/*.cxx + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps xAODEgamma xAODJet xAODMuon TrigDecisionToolLib xAODEventInfo xAODTracking GaudiKernel DerivationFrameworkHiggsLib ) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*.py ) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG1.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG1.h new file mode 100644 index 0000000000000000000000000000000000000000..1f9e78cc2829d622b871035e4c5ff2df2c71314f --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG1.h @@ -0,0 +1,191 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// SkimmingToolHIGG1.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG1_H +#define DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG1_H 1 + +#include <string> +#include <vector> +#include <algorithm> + +// Gaudi & Athena basics +#include "AthenaBaseComps/AthAlgTool.h" + +// DerivationFramework includes +#include "DerivationFrameworkInterfaces/ISkimmingTool.h" + +// xAOD header files +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODMuon/MuonContainer.h" + +#include "TrigDecisionTool/TrigDecisionTool.h" + + + +namespace DerivationFramework { + + /** @class SkimmingToolHIGG1 + @author jsaxon@cern.ch + @author magdac@cern.ch + */ + class SkimmingToolHIGG1 : public AthAlgTool, public ISkimmingTool { + + public: + /** Constructor with parameters */ + SkimmingToolHIGG1( const std::string& t, const std::string& n, const IInterface* p ); + + /** Destructor */ + ~SkimmingToolHIGG1(); + + // Athena algtool's Hooks + StatusCode initialize(); + StatusCode finalize(); + + /** Check that the current event passes this filter */ + virtual bool eventPassesFilter() const; + + private: + + /////////////// + ///// TOOLS + + ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool; + + /////////////// + ///// SETTINGS + + std::string m_photonSGKey; + std::string m_electronSGKey; + std::string m_muonSGKey; + + // CUTS TO APPLY OR NOT + bool m_reqGRL; + bool m_reqLArError; + bool m_reqTrigger; + bool m_reqPreselection; + bool m_incSingleElectron; + bool m_incDoubleElectron; + bool m_incSingleMuon; + bool m_reqKinematic; + bool m_reqQuality; + bool m_reqIsolation; + bool m_reqInvariantMass; + + + // CUT VALUES/SETTINGS + + std::string m_goodRunList; + + std::string m_defaultTrigger; + std::vector<std::string> m_triggers; + + mutable bool m_isMC; + + double m_minPhotonPt; + bool m_removeCrack; + double m_maxEta; + + bool m_relativePtCuts; + double m_leadingPhotonPt; + double m_subleadingPhotonPt; + + double m_minInvariantMass; + double m_maxInvariantMass; + + double m_minElectronPt; + double m_minMuonPt; + double m_maxMuonEta; + + //////////////// + ///// FUNCTIONS + + // Cuts + bool SubcutGoodRunList() const; + bool SubcutLArError() const; + bool SubcutTrigger() const; + bool SubcutPreselect() const; + bool SubcutOnePhotonOneElectron() const; + bool SubcutTwoElectrons() const; + bool SubcutOnePhotonOneMuon() const; + bool SubcutKinematic() const; + bool SubcutQuality() const; + bool SubcutIsolation() const; + bool SubcutInvariantMass() const; + + // Calculators + bool PhotonPreselect(const xAOD::Photon *ph) const; + bool ElectronPreselect(const xAOD::Electron *el) const; + bool MuonPreselect(const xAOD::Muon *mu) const; + void CalculateInvariantMass() const; + void GetDiphotonVertex() const; + double CorrectedEnergy(const xAOD::Photon *ph) const; + double CorrectedEta(const xAOD::Photon *ph) const; + double ReturnRZ_1stSampling_cscopt2(double eta1) const; + + /////////////// + ///// COUNTERS + + mutable unsigned int n_tot; + mutable unsigned int n_passGRL; + mutable unsigned int n_passLArError; + mutable unsigned int n_passTrigger; + mutable unsigned int n_passPreselect; + mutable unsigned int n_passSingleElectronPreselect; + mutable unsigned int n_passDoubleElectronPreselect; + mutable unsigned int n_passSingleMuonPreselect; + mutable unsigned int n_passKinematic; + mutable unsigned int n_passQuality; + mutable unsigned int n_passIsolation; + mutable unsigned int n_passInvariantMass; + mutable unsigned int n_pass; + + + ///////////////////////////// + ///// EVENT LEVEL QUANTITIES + + mutable std::vector<const xAOD::Photon*> e_leadingPhotons; + + mutable TLorentzVector leadPhotonLV; + mutable TLorentzVector sublPhotonLV; + + mutable bool e_tot; + mutable bool e_passGRL; + mutable bool e_passLArError; + mutable bool e_passTrigger; + mutable bool e_passPreselect; + mutable bool e_passSingleElectronPreselect; + mutable bool e_passDoubleElectronPreselect; + mutable bool e_passSingleMuonPreselect; + mutable bool e_passKinematic; + mutable bool e_passQuality; + mutable bool e_passIsolation; + mutable bool e_passInvariantMass; + mutable bool e_pass; + + mutable int ph_pos_lead, ph_pos_subl; + mutable double ph_pt_lead, ph_eta_lead, ph_phi_lead, ph_e_lead; + mutable double ph_pt_subl, ph_eta_subl, ph_phi_subl, ph_e_subl; + + mutable int ph_tight_lead, ph_tight_subl; + mutable int ph_iso_lead, ph_iso_subl; + + mutable double e_invariantMass; + mutable double e_diphotonZ; + + ///////////////////////////// + ///// FUNCTIONS + + static const double s_MZ; + + }; + +} + +#endif // DERIVATIONFRAMEWORK_SKIMMINGTOOLEXAMPLE_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG2.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG2.h new file mode 100644 index 0000000000000000000000000000000000000000..05cfb9eba5877b2174548022b3172ab50b26c5d1 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG2.h @@ -0,0 +1,171 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// SkimmingToolHIGG2.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG2_H +#define DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG2_H 1 + +#include<string> +#include<vector> +#include<map> + +// Gaudi & Athena basics +#include "AthenaBaseComps/AthAlgTool.h" + +// DerivationFramework includes +#include "DerivationFrameworkInterfaces/ISkimmingTool.h" + +// xAOD header files +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODJet/JetContainer.h" +#include "xAODMuon/MuonContainer.h" + +#include "TrigDecisionTool/TrigDecisionTool.h" + +namespace DerivationFramework { + + /** @class SkimmingToolHIGG2 + @author Susumu.Oda@cern.ch + */ + class SkimmingToolHIGG2 : public AthAlgTool, public ISkimmingTool { + + public: + /** Constructor with parameters */ + SkimmingToolHIGG2( const std::string& t, const std::string& n, const IInterface* p ); + + /** Destructor */ + ~SkimmingToolHIGG2(); + + // Athena algtool's Hooks + StatusCode initialize(); + StatusCode finalize(); + + /** Check that the current event passes this filter */ + virtual bool eventPassesFilter() const; + + private: + enum { + NUMBER_OF_MERGED_JET_TYPES = 3 + }; + + ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool; + + mutable unsigned int m_ntot; + mutable unsigned int m_npass; + + bool m_skipTriggerRequirement; + + mutable std::vector<const xAOD::Electron*> m_goodElectrons; + mutable std::vector<const xAOD::Muon*> m_goodMuons; + mutable std::vector<const xAOD::Jet*> m_goodJets; + mutable std::vector<const xAOD::Jet*> m_goodMergedJets[NUMBER_OF_MERGED_JET_TYPES]; + mutable std::vector<const xAOD::Photon*> m_goodPhotons; + mutable std::vector<const xAOD::TrackParticle*> m_goodTracks; + + std::string m_filterType; + + std::string m_electronSGKey; + std::string m_muonSGKey; + std::string m_jetSGKey; + std::string m_mergedJetSGKey[NUMBER_OF_MERGED_JET_TYPES]; + std::string m_photonSGKey; + std::string m_trackSGKey; + + unsigned int m_nLeptons; + unsigned int m_nElectrons; + unsigned int m_nMuons; + unsigned int m_nJets; + unsigned int m_nMergedJets[NUMBER_OF_MERGED_JET_TYPES]; + unsigned int m_nPhotons; + unsigned int m_nTracks; + + std::string m_electronQual; + std::string m_muonQual; + std::string m_tightMuonQual; + std::string m_tightElectronQual; + std::string m_jetQual; + std::string m_mergedJetQual[NUMBER_OF_MERGED_JET_TYPES]; + std::string m_photonQual; + + std::string m_primaryElectronQual4L; + + std::vector<std::string> m_trigger2L; + std::vector<std::string> m_triggerTP; + std::vector<std::string> m_trigger2L2Q; + std::vector<std::string> m_triggerJPSI; + std::vector<std::string> m_triggerPHI; + + double m_electronEtCut; + double m_muonPtCut; + double m_tightElectronEtCut; + double m_tightMuonPtCut; + double m_jetPtCut; + double m_mergedJetPtCut[NUMBER_OF_MERGED_JET_TYPES]; + double m_photonPtCut; + double m_trackPtCut; + + double m_electronEtaCut; + double m_muonEtaCut; + double m_caloMuonEtaCut; + double m_jetEtaCut; + double m_mergedJetEtaCut[NUMBER_OF_MERGED_JET_TYPES]; + double m_photonEtaCut; + + double m_invariantMassCut; + double m_invariantMassJpsiLowCut; + double m_invariantMassJpsiUpCut; + double m_invariantMassUpsilonLowCut; + double m_invariantMassUpsilonUpCut; + double m_invariantMassPhiLowCut; + double m_invariantMassPhiUpCut; + + double m_leadingElectronEtCut; + double m_leadingMuonPtCut; + + double m_dRElectronJetCut; + + bool m_checkLArError; + bool m_defaultElectronFourMomentum; + + // bool m_DFCommonElectronFourMomentum; + // mutable std::map<const xAOD::Electron*, unsigned int> m_mapElectrons; + // mutable const std::vector<float> *m_DFCommonElectrons_pt; + // mutable const std::vector<float> *m_DFCommonElectrons_eta; + // mutable const std::vector<float> *m_DFCommonElectrons_phi; + + bool m_DFCommonJetFourMomentum; + + bool m_requireTightLeptons; + + bool checkElectronQuality(const xAOD::Electron *el, const bool isTight=false) const; + bool checkMuonQuality(const xAOD::Muon *mu, const bool isTight=false) const; + bool checkJetQuality(const xAOD::Jet *jet) const; + bool checkMergedJetQuality(const xAOD::Jet *jet, const unsigned int type) const; + bool checkPhotonQuality(const xAOD::Photon *ph) const; + bool checkTrackQuality(const xAOD::TrackParticle *trk) const; + + bool check2L() const; + bool check4L() const; + bool checkTP() const; + bool check2L2Q() const; + bool checkJPSI() const; + bool checkPHI() const; + + TLorentzVector electronFourMomentum(const xAOD::Electron *el) const; + TLorentzVector muonFourMomentum(const xAOD::Muon *mu) const; + TLorentzVector jetFourMomentum(const xAOD::Jet *jet) const; + + double getDeltaR(const double eta1, const double phi1, const double eta2, const double phi2) const; + + static const double s_MZ; + static const double s_MKplus; + }; + +} + +#endif // DERIVATIONFRAMEWORK_SKIMMINGTOOLEXAMPLE_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG5VBF.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG5VBF.h new file mode 100644 index 0000000000000000000000000000000000000000..3d15f9898c143bff804fa484abe007e2a7cac8f8 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/DerivationFrameworkHiggs/SkimmingToolHIGG5VBF.h @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// SkimmingToolHIGG5VBF.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG5VBF_H +#define DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG5VBF_H + +#include<string> +#include<vector> + +// Gaudi & Athena basics +#include "AthenaBaseComps/AthAlgTool.h" + +// DerivationFramework includes +#include "DerivationFrameworkInterfaces/ISkimmingTool.h" + +// xAOD header files +#include "xAODJet/JetContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "TrigDecisionTool/TrigDecisionTool.h" + +class TLoretzVector; + +namespace DerivationFramework { + + + /** @class SkimmingToolHIGG5VBF + @author Yasuyuki.Okumura@cern.ch + */ + class SkimmingToolHIGG5VBF : public AthAlgTool, public ISkimmingTool { + + public: + /** Constructor with parameters */ + SkimmingToolHIGG5VBF( const std::string& t, const std::string& n, const IInterface* p ); + + /** Destructor */ + ~SkimmingToolHIGG5VBF(); + + // Athena algtool's Hooks + StatusCode initialize(); + StatusCode finalize(); + + /** Check that the current event passes this filter */ + virtual bool eventPassesFilter() const; + + private: + bool m_debug; + + ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool; + + mutable unsigned int m_ntot; + mutable unsigned int m_npass; + + mutable std::vector<TLorentzVector> m_goodAllJets; + mutable std::vector<TLorentzVector> m_goodCentralJets; + + std::string m_jetSGKey; + std::string m_calibedJetMomKey; + + // for jet multiplicity + bool m_reqNAllJets; + unsigned int m_nAllJets; + double m_allJetPtCut; + double m_allJetEtaCut; + + bool m_reqNCentralJets; + unsigned int m_nCentralJets; + double m_centralJetPtCut; + double m_centralJetEtaCut; + + // for trigger + bool m_reqTrigger; + std::vector<std::string> m_triggers; + + // for Mjj + bool m_reqVbfMjj; + double m_vbfMjjCut; + + bool checkAllJetQuality(const TLorentzVector& jet) const; + bool checkCentralJetQuality(const TLorentzVector& jet) const; + TLorentzVector getCalibedJets(const xAOD::Jet* jet) const; + + //for photon (p. rose) + std::string m_phSGKey; + bool m_reqPh; + double m_phPtCut; + double m_centralPhEtaCut; + }; + +} + +#endif // #ifndef DERIVATIONFRAMEWORK_SKIMMINGTOOLHSG5VBF_H diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/cmt/requirements b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..ede0b3ebbedff4ff29d52681b51958d1bc67b4c8 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/cmt/requirements @@ -0,0 +1,29 @@ +package DerivationFrameworkHiggs +author James Catmore <james.catmore@cern.ch> + +################################################################# +# public use statements +use AtlasPolicy AtlasPolicy-* +use AthenaBaseComps AthenaBaseComps-* Control +use DerivationFrameworkInterfaces DerivationFrameworkInterfaces-* PhysicsAnalysis/DerivationFramework +use TrigDecisionTool TrigDecisionTool-* Trigger/TrigAnalysis +use xAODEgamma xAODEgamma-* Event/xAOD +use xAODJet xAODJet-* Event/xAOD +use xAODMuon xAODMuon-* Event/xAOD + +private +use AtlasCLHEP AtlasCLHEP-* External +use GaudiInterface GaudiInterface-* External +use xAODEventInfo xAODEventInfo-* Event/xAOD +use xAODTracking xAODTracking-* Event/xAOD + +################################################################# +# +public + +## declare the directories CMT should know about +branches python share src + +apply_pattern dual_use_library files= " *.cxx " +apply_pattern declare_joboptions files=" *.py" +apply_pattern declare_python_modules files="*.py" diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D1ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D1ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..8ea429b515bbf7834d0063dc57d5311da3af3e36 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D1ExtraContent.py @@ -0,0 +1,26 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +HIGG2D1ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "GSFTrackParticles.expectNextToInnermostPixelLayerHit.numberOfNextToInnermostPixelLayerHits.numberOfNextToInnermostPixelLayerOutliers", + "Muons.quality.etcone20.ptconecoreTrackPtrCorrection", + "ExtrapolatedMuonTrackParticles.numberOfTRTHits.numberOfTRTOutliers", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m" + ] + +HIGG2D1ExtraContentTruth=[ + ] + +HIGG2D1ExtraContainers=[ + "MuonClusterCollection", + "MET_Track", + "CaloCalTopoClusters"] + +HIGG2D1ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D2ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D2ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..8586dd6774bd71ba00afff8ad8aa044aefe51513 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D2ExtraContent.py @@ -0,0 +1,26 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +HIGG2D2ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "GSFTrackParticles.expectNextToInnermostPixelLayerHit.numberOfNextToInnermostPixelLayerHits.numberOfNextToInnermostPixelLayerOutliers", + "Muons.quality.etcone20.ptconecoreTrackPtrCorrection", + "ExtrapolatedMuonTrackParticles.numberOfTRTHits.numberOfTRTOutliers", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m" + ] + +HIGG2D2ExtraContentTruth=[ + ] + +HIGG2D2ExtraContainers=[ + "MuonClusterCollection", + "MET_Track", + "CaloCalTopoClusters"] + +HIGG2D2ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D3ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D3ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..3a4f57785ac6b75c1856a4b1f1a23947be51ec8d --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D3ExtraContent.py @@ -0,0 +1,24 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +HIGG2D3ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "GSFTrackParticles.expectNextToInnermostPixelLayerHit.numberOfNextToInnermostPixelLayerHits.numberOfNextToInnermostPixelLayerOutliers", + "Muons.quality.etcone20", + "ExtrapolatedMuonTrackParticles.numberOfTRTHits.numberOfTRTOutliers", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m" + ] + +HIGG2D3ExtraContentTruth=[ + ] + +HIGG2D3ExtraContainers=[ + "MET_Track"] + +HIGG2D3ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D4ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D4ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..0b1b192576885e19260e5c1c9482e204374c7b89 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D4ExtraContent.py @@ -0,0 +1,25 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +HIGG2D4ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "GSFTrackParticles.expectNextToInnermostPixelLayerHit.numberOfNextToInnermostPixelLayerHits.numberOfNextToInnermostPixelLayerOutliers", + "Muons.quality.etcone20.etcone30.etcone40", + "ExtrapolatedMuonTrackParticles.numberOfTRTHits.numberOfTRTOutliers", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.GhostTrackCount.TrackWidthPt500", + "AntiKt4EMTopoJets.DFCommonJets_Calib_pt.DFCommonJets_Calib_eta.DFCommonJets_Calib_phi.DFCommonJets_Calib_m", + "AntiKt4LCTopoJets.TrackWidthPt500.TrackCount.GhostTrackCount"] + +HIGG2D4ExtraContentTruth=[ + ] + +HIGG2D4ExtraContainers=[ + "BTagging_AntiKt3Track", + "BTagging_AntiKt2Track"] + +HIGG2D4ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D5ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D5ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..a3ff02930cdebb27dc001852b2e38c462c05b880 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG2D5ExtraContent.py @@ -0,0 +1,24 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +HIGG2D5ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "GSFTrackParticles.expectNextToInnermostPixelLayerHit.numberOfNextToInnermostPixelLayerHits.numberOfNextToInnermostPixelLayerOutliers", + "Muons.quality.etcone20", + "ExtrapolatedMuonTrackParticles.numberOfTRTHits.numberOfTRTOutliers", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m" + ] + +HIGG2D5ExtraContentTruth=[ + ] + +HIGG2D5ExtraContainers=[ + "MET_Track"] + +HIGG2D5ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D1ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D1ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..df4c295fd781987de9474af843301d1053a75d62 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D1ExtraContent.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + + +# The additional HIGG3D1 content lists + +HIGG3D1ExtraVariables = [ "GSFTrackParticles.z0.vz", + "CombinedMuonTrackParticles.z0.vz", + "ExtrapolatedMuonTrackParticles.z0.vz", + "Muons.clusterLink.extrapolatedMuonSpectrometerTrackParticleLink", + "Electrons.author", + "AntiKt4LCTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4PV0TrackJets.pt.eta.phi.m.constituentLinks.constituentWeights.btaggingLink", + "AntiKt2PV0TrackJets.pt.eta.phi.m.constituentLinks.constituentWeights.btaggingLink"] + +HIGG3D1ExtraTruthVariables = [ "Electrons.truthOrigin.truthType.truthParticleLink.bkgTruthType.bkgMotherPdgId.bkgTruthOrigin", + "AntiKt4LCTopoJets.ConeTruthLabelID.PartonTruthLabelID", + "AntiKt4EMTopoJets.ConeTruthLabelID.PartonTruthLabelID", + "InDetTrackParticles.truthOrigin.truthType", + "AntiKt4PV0TrackJets.TruthLabelDeltaR_B.TruthLabelDeltaR_C.TruthLabelDeltaR_T.GhostTruth.GhostTruthCount.GhostTruthPt.HadronConeExclTruthLabelID.PartonTruthLabelID.ConeTruthLabelID", + "AntiKt2PV0TrackJets.TruthLabelDeltaR_B.TruthLabelDeltaR_C.TruthLabelDeltaR_T.GhostTruth.GhostTruthCount.GhostTruthPt.HadronConeExclTruthLabelID.PartonTruthLabelID.ConeTruthLabelID"] + +HIGG3D1ExtraContainers = [ ] + +HIGG3D1ExtraTruthContainers = [ "TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets", + "MuonTruthParticles" ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D2ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D2ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..e74f4ae85cefd916e2cd280394a678ce6225ab05 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D2ExtraContent.py @@ -0,0 +1,10 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + + +# The additional HIGG3D2 content lists + +HIGG3D2ExtraVariables = [ "PrimaryVertices.vertexType" ] + +HIGG3D2ExtraTruthContainers = [ "TruthEvents", + "AntiKt4TruthJets", + "TruthParticles" ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D3ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D3ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..87f858f1b3a6b6e84b5f756961ce5f8f67b14cf5 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG3D3ExtraContent.py @@ -0,0 +1,24 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + + +# The additional HIGG3D3 content lists + +HIGG3D3ExtraVariables = [ "GSFTrackParticles.z0.vz", + "CombinedMuonTrackParticles.z0.vz", + "ExtrapolatedMuonTrackParticles.z0.vz", + "Muons.clusterLink.extrapolatedMuonSpectrometerTrackParticleLink", + "Electrons.author", + "AntiKt4LCTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt" ] + +HIGG3D3ExtraTruthVariables = [ "Electrons.truthOrigin.truthType.truthParticleLink", + "AntiKt4LCTopoJets.ConeTruthLabelID.PartonTruthLabelID", + "AntiKt4EMTopoJets.ConeTruthLabelID.PartonTruthLabelID" ] + +HIGG3D3ExtraContainers = [ ] + +HIGG3D3ExtraTruthContainers = [ "TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets", + "MuonTruthParticles" ] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxAugmentation.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxAugmentation.py new file mode 100644 index 0000000000000000000000000000000000000000..795444b0c592b9e9a71cef5d005ea6e6ba71d9aa --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxAugmentation.py @@ -0,0 +1,105 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +################################################# +# Common code used for the HIGG4 augmentation # +# Z.Zinonos # +# zenon@cern.ch # +# Nov 2015 # +################################################# + +from AthenaCommon.GlobalFlags import globalflags +# running on data or MC +DFisMC = (globalflags.DataSource()=='geant4') + +def setup(HIGG4DxName, ToolSvc): + + augmentationTools=[] + + # DELTA R TOOL + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__DeltaRTool + HIGG4DxTauJetsElectronsDeltaRTool = DerivationFramework__DeltaRTool( name = "HIGG4DxTauJetsElectronsDeltaRTool", + ContainerName = "Electrons", + SecondContainerName = "TauJets", + StoreGateEntryName = "HIGG4DxTauJetsElectronsDeltaR") + ToolSvc += HIGG4DxTauJetsElectronsDeltaRTool + augmentationTools.append(HIGG4DxTauJetsElectronsDeltaRTool) + + # TAU SELECTOR TOOL + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauSelectionWrapper + HIGG4DxJetBDTSigMediumSelectionWrapper = DerivationFramework__TauSelectionWrapper( name = "HIGG4DxJetBDTSigMediumSelectionWrapper", + #IsTauFlag = IsTauFlag.JetBDTSigMedium, + IsTauFlag = 20, + CollectionName = "TauJets", + StoreGateEntryName = "HIGG4DxJetBDTSigMedium") + ToolSvc += HIGG4DxJetBDTSigMediumSelectionWrapper + augmentationTools.append(HIGG4DxJetBDTSigMediumSelectionWrapper) + + HIGG4DxJetBDTSigLooseSelectionWrapper = DerivationFramework__TauSelectionWrapper( name = "HIGG4DxJetBDTSigLooseSelectionWrapper", + IsTauFlag = 19, + CollectionName = "TauJets", + StoreGateEntryName = "HIGG4DxJetBDTSigLoose") + ToolSvc += HIGG4DxJetBDTSigLooseSelectionWrapper + augmentationTools.append(HIGG4DxJetBDTSigLooseSelectionWrapper) + + + + # Tau primary vertex refit + if HIGG4DxName == "HIGG4D3": + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauPVTrkSelectionTool + HIGG4DxTauPVTrkSelectionTool = DerivationFramework__TauPVTrkSelectionTool( name = "HIGG4DxTauPVTrkSelectionTool", + #minPt = 15000, + #m_maxDeltaR = 0.2, + UseTrueTracks = DFisMC, + TauContainerName = "TauJets", + TauPVTracksContainerName = "TauPVTracks") + ToolSvc += HIGG4DxTauPVTrkSelectionTool + augmentationTools.append(HIGG4DxTauPVTrkSelectionTool) + + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauPVRefitTool + HIGG4DxTauPVRefittingTool = DerivationFramework__TauPVRefitTool( name = "HIGG4DxTauPVRefittingTool", + PVLinkName = "PVLink", + RefittedLinkName = "TauRefittedPVLink", + PVContainerName = "PrimaryVertices", + TauTrkContainerName = "TauPVTracks", + PVRefContainerName = "TauRefittedPrimaryVertices") + ToolSvc += HIGG4DxTauPVRefittingTool + augmentationTools.append(HIGG4DxTauPVRefittingTool) + + if DFisMC: + # Tau truth matching + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool + HIGG4DxTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(name="HIGG4DxTauTruthMatchingTool", + WriteTruthTaus = True) + + ToolSvc += HIGG4DxTauTruthMatchingTool + + # Tau truth matching wrapper + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper + HIGG4DxTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper( name = "HIGG4DxTauTruthMatchingWrapper", + TauTruthMatchingTool = HIGG4DxTauTruthMatchingTool) + + ToolSvc += HIGG4DxTauTruthMatchingWrapper + augmentationTools.append(HIGG4DxTauTruthMatchingWrapper) + + + #Tau Overlapping Electron LLH Decorator + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauOverlappingElectronLLHDecorator + HIGG4DxTauOrlElLLHDec = TauAnalysisTools__TauOverlappingElectronLLHDecorator(name="HIGG4DxTauOrlElLLHDec", + ElectronContainerName = "Electrons") + + ToolSvc += HIGG4DxTauOrlElLLHDec + + #Tau Overlapping Electron LLH Decorator Wrapper + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauOverlappingElectronLLHDecoratorWrapper + HIGG4DxTauOrlElLLHDecWrapper = DerivationFramework__TauOverlappingElectronLLHDecoratorWrapper( name = "HIGG4DxTauOrlElLLHDecWrapper", + TauOverlappingElectronLLHDecorator = HIGG4DxTauOrlElLLHDec, + TauContainerName = "TauJets") + + ToolSvc += HIGG4DxTauOrlElLLHDecWrapper + augmentationTools.append(HIGG4DxTauOrlElLLHDecWrapper) + + #============= + # return tools + #============= + return augmentationTools + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxJets.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxJets.py new file mode 100644 index 0000000000000000000000000000000000000000..04d095c46fd8cebf6c3810d916f6bd9bd3c2e851 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxJets.py @@ -0,0 +1,33 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +################################################################# +# Common code used for the HIGG4 jet building and calibration # +# Z.Zinonos # +# zenon@cern.ch # +# Nov 2015 # +################################################################# + +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * + +def setup(HIGG4DxName, HIGG4DxSequence, HIGG4DxSlimmingHelper): + +# if not DAOD_StreamID+"Jets" in OutputJets: + + # add a small-R collection +# OutputJets[DAOD_StreamID+"Jets"] = ["AntiKt2PV0TrackJets"] + + # schedule reconstruction of AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets +# addTrimmedJets("AntiKt", 1.0, "LCTopo", rclus=0.2, ptfrac=0.05, algseq=DerivationFrameworkJob) +# OutputJets[DAOD_StreamID+"Jets"].append("AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets") +# print "HELLO HERE", OutputJets[DAOD_StreamID+"Jets"] + + jet_collection = HIGG4DxName+"Jets" + if not jet_collection in OutputJets: + # AntiKt10*PtFrac5Rclus20 jets + if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: + addDefaultTrimmedJets(HIGG4DxSequence, jet_collection, False) + + if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: + OutputJets[jet_collection].append("AntiKt2PV0TrackJets") + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxSkimming.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxSkimming.py new file mode 100644 index 0000000000000000000000000000000000000000..c2b41a1f0f3799705806d468400d3e492709beda --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxSkimming.py @@ -0,0 +1,72 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +################################################# +# Common code used for the HIGG4 skimming # +# Z.Zinonos # +# zenon@cern.ch # +# Nov 2015 # +################################################# + +from AthenaCommon.GlobalFlags import globalflags + +def setup(HIGG4DxName, ToolSvc): + + skimmingTools = [] + + if HIGG4DxName == 'HIGG4D1': + muonLead = "(Muons.pt > 13.0*GeV) && (Muons.DFCommonGoodMuon)" + muonSubL = "(Muons.pt > 9.0*GeV) && (Muons.DFCommonGoodMuon)" + electron = "(Electrons.pt > 13.0*GeV) && ((Electrons.DFCommonElectronsIsEMMedium) || (Electrons.DFCommonElectronsLHMedium))" + count1 = "( count("+muonLead+") + count("+electron+") ) >=1" + count2 = "( count("+muonSubL+") + count("+electron+") ) >=2" + skim_expression = "("+count1+") && ("+count2+")" + elif HIGG4DxName == 'HIGG4D2': + #(pT(mu)>18 && pT(tau)>18) || (pT(mu)>12 && pT(tau)>23) + #(pT(el)>22 && pT(tau)>18) || (pT(el)>15 && pT(tau)>23) + e15 = '(count((Electrons.pt > 15.0*GeV) && ((Electrons.DFCommonElectronsIsEMMedium)||(Electrons.DFCommonElectronsLHMedium))) >= 1)' + e22 = '(count((Electrons.pt > 22.0*GeV) && ((Electrons.DFCommonElectronsIsEMMedium)||(Electrons.DFCommonElectronsLHMedium))) >= 1)' + mu12 = '(count( (Muons.pt > 12.0*GeV) && Muons.DFCommonGoodMuon ) >= 1)' + mu18 = '(count( (Muons.pt > 18.0*GeV) && Muons.DFCommonGoodMuon ) >= 1)' + tau18 = '(count( (TauJets.pt > 18.0*GeV) && (abs(TauJets.charge)==1.0) && ((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) ) >= 1)' + tau23 = '(count( (TauJets.pt > 23.0*GeV) && (abs(TauJets.charge)==1.0) && ((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) ) >= 1)' + mutau = '('+mu18+' && '+tau18+') || ('+mu12+' && '+tau23+')' + etau = '('+e22+' && '+tau18+') || ('+e15+' && '+tau23+')' + skim_expression = '('+mutau+') || ('+etau+')' + + elif HIGG4DxName == 'HIGG4D3': + tauTrks = '( (TauJets.nTracks + TauJets.nWideTracks >= 1) && (TauJets.nTracks + TauJets.nWideTracks <= 8) )' + tauLead = '(TauJets.pt > 33.0*GeV)' + tauSubl = '(TauJets.pt > 23.0*GeV)' + tauId = 'HIGG4DxJetBDTSigLoose' + tauReq0 = '(count( '+tauSubl+' && '+tauTrks+' ) >= 2)' + tauReq1 = '(count( '+tauSubl+' && '+tauTrks+' && '+tauId+' ) >= 1)' + tauReq2 = '(count( '+tauLead+' && '+tauTrks+' ) >= 1)' + skim_expression = tauReq0 + '&&' + tauReq1 + '&&' + tauReq2 + #skim_expression = tauReq0 + '&&' + tauReq2 + elif HIGG4DxName == 'HIGG4D4': + ditau = '(count(((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) && (TauJets.pt > 45.0*GeV)) >= 2)' + tau1 = '(count((TauJets.pt > 100.0*GeV)) >= 1)' + tau2 = '(count((TauJets.pt > 45.0*GeV)) >= 2)' + tauTrack = '(count(((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) && (TauJets.pt > 45.0*GeV)) >= 1)' + #muonveto = '(count((Muons.pt > 15.0*GeV) && (Muons.DFCommonMuonsTight) && (abs(Muons.eta < 2.4))) == 0)' + #eleveto = '(count((Electrons.pt > 20.0*GeV) && (Electrons.DFCommonElectronsLHTight) && ((abs(Electrons.eta) < 1.3) || ((abs(Electrons.eta) > 1.6) && (abs(Electrons.eta) < 2.4)))) == 0)' + trigger = '( HLT_j15 || HLT_j25 || HLT_j35 || HLT_j55 || HLT_j60 || HLT_j85 || HLT_j110 || HLT_j150 || HLT_j175 || HLT_j200 || HLT_j260 || HLT_j300 || HLT_j320 || HLT_j360 || HLT_j380 || HLT_j400 || HLT_j420 || HLT_j440 || HLT_j460 || HLT_tau80_medium1_tracktwo_L1TAU60 || HLT_tau125_medium1_tracktwo || HLT_tau160_medium1_tracktwo || HLT_tau80_medium1_tracktwo_L1TAU60_tau50_medium1_tracktwo_L1TAU12 || HLT_tau35_medium1_tracktwo_tau25_medium1_tracktwo_L1TAU20IM_2TAU12IM)' + monotau = '(count(((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) && (TauJets.pt > 60.0*GeV)) >= 1)' + monotrigger = '( HLT_xe70 || HLT_j360 || HLT_j80_xe80 )' + mono_skim = '('+monotau+' && '+monotrigger+')' + DFisMC = (globalflags.DataSource()=='geant4') + if not DFisMC: + hadhad = '(((' + ditau + ') || (' + tau1 + ' && ' + tau2 + ' && ' + tauTrack + ')) && ' + trigger + ') || '+mono_skim + else: + hadhad = ditau + ' || '+mono_skim + skim_expression = hadhad + else: + assert False, "HIGG4DxSkimming: Unknown derivation stream '{}'".format(HIGG4DxName) + + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool + HIGG4DxSkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = HIGG4DxName+"SkimmingTool", + expression = skim_expression) + ToolSvc += HIGG4DxSkimmingTool + skimmingTools.append(HIGG4DxSkimmingTool) + + return skimmingTools diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxSlimming.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxSlimming.py new file mode 100644 index 0000000000000000000000000000000000000000..72134b3d452045b13652246db8015ebf8ad03777 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxSlimming.py @@ -0,0 +1,165 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +################################################# +# Common code used for the HIGG4 slimming # +# Z.Zinonos # +# zenon@cern.ch # +# Nov 2015 # +################################################# + + +def setup(HIGG4DxName, HIGG4DxStream, HIGG4DxSlimmingHelper): + from AthenaCommon.GlobalFlags import globalflags + DFisMC = (globalflags.DataSource()=='geant4') + + #HIGG4DxSlimmingHelper = SlimmingHelper(HIGG4DxName+"SlimmingHelper") + + #smart slimming + + if HIGG4DxName == 'HIGG4D4': + HIGG4DxSlimmingHelper.SmartCollections = ["Electrons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4EMTopoJets", + "BTagging_AntiKt4EMTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + else: + HIGG4DxSlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + + #extra variables added to the smart slimming content + ExtraContentElectrons=[ + "Electrons." + "LHLoose." + "LHMedium." + "LHTight." + "LHValue" + ] + + ExtraElectronsTruth=[ + "Electrons." + "truthOrigin." + "truthType." + "truthParticleLink" + ] + + ExtraContentMuons=[ + "Muons." + "quality." + "m" + ] + + ExtraMuonsTruth=[ + "MuonTruthParticles." + "truthOrigin." + "truthType" + ] + + ExtraContentTaus=[ + "TauJets." + "pantau_CellBasedInput_isPanTauCandidate." + "pantau_CellBasedInput_DecayMode." + "ptPanTauCellBased." + "etaPanTauCellBased." + "phiPanTauCellBased." + "mPanTauCellBased." + "pantau_CellBasedInput_BDTValue_1p0n_vs_1p1n." + "pantau_CellBasedInput_BDTValue_1p1n_vs_1pXn." + "pantau_CellBasedInput_BDTValue_3p0n_vs_3pXn" + , + "TauNeutralParticleFlowObjects." + "pt." + "eta." + "phi." + "m." + "e." + "rapidity." + "bdtPi0Score" + ] + + ExtraTausTruth = [ + "TauJets.IsTruthMatched.truthParticleLink.truthJetLink.ele_match_lhscore.ele_olr_pass.electronLink" + ] + + + if HIGG4DxName == 'HIGG4D3': + ExtraContentVtx=["PrimaryVertices.x.y.z.vertexType.TauRefittedPVLink"] + else: + ExtraContentVtx=["PrimaryVertices.x.y.z.vertexType"] + + HIGG4DxSlimmingHelper.ExtraVariables = ExtraContentElectrons + ExtraContentMuons + ExtraContentTaus + ExtraContentVtx + + if DFisMC: + HIGG4DxSlimmingHelper.ExtraVariables += ExtraElectronsTruth + ExtraMuonsTruth + ExtraTausTruth + + #extra containers + if HIGG4DxName in ['HIGG4D2', 'HIGG4D3', 'HIGG4D4']: + HIGG4DxSlimmingHelper.AllVariables += ["LVL1JetRoIs"] + + if DFisMC: + HIGG4DxSlimmingHelper.AllVariables += ["TruthEvents", + "TruthParticles", + "TruthVertices", + "AntiKt4TruthJets"] + + #derivation truth + if DFisMC: + + from DerivationFrameworkMCTruth.MCTruthCommon import * + + HIGG4DxSlimmingHelper.StaticContent = ["xAOD::TruthParticleContainer#TruthMuons", + "xAOD::TruthParticleAuxContainer#TruthMuonsAux.", + "xAOD::TruthParticleContainer#TruthElectrons", + "xAOD::TruthParticleAuxContainer#TruthElectronsAux.", + #"xAOD::TruthParticleContainer#TruthPhotons", + #"xAOD::TruthParticleAuxContainer#TruthPhotonsAux.", + "xAOD::TruthParticleContainer#TruthNeutrinos", + "xAOD::TruthParticleAuxContainer#TruthNeutrinosAux.", + "xAOD::TruthParticleContainer#TruthTaus", + "xAOD::TruthParticleAuxContainer#TruthTausAux."] + + + + #trigger content + if HIGG4DxName == 'HIGG4D1': + HIGG4DxSlimmingHelper.IncludeMuonTriggerContent = True + HIGG4DxSlimmingHelper.IncludeEGammaTriggerContent = True + elif HIGG4DxName == 'HIGG4D2': + HIGG4DxSlimmingHelper.IncludeMuonTriggerContent = True + HIGG4DxSlimmingHelper.IncludeEGammaTriggerContent = True + HIGG4DxSlimmingHelper.IncludeTauTriggerContent = True + elif HIGG4DxName == 'HIGG4D3': + HIGG4DxSlimmingHelper.IncludeTauTriggerContent = True + elif HIGG4DxName == 'HIGG4D4': + HIGG4DxSlimmingHelper.IncludeJetTriggerContent = True + HIGG4DxSlimmingHelper.IncludeTauTriggerContent = True + else: + assert False, "HIGG4DxSlimming: Unknown derivation stream '{}'".format(HIGG4DxName) + + if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: + from DerivationFrameworkJetEtMiss.JetCommon import * + addJetOutputs(HIGG4DxSlimmingHelper, [HIGG4DxName+"Jets"]) + + # the very last line in job options + HIGG4DxSlimmingHelper.AppendContentToStream(HIGG4DxStream) + + #add tau PV refitted results + if HIGG4DxName == 'HIGG4D3': + HIGG4DxStream.AddItem(['xAOD::VertexContainer#TauRefittedPrimaryVertices']) + HIGG4DxStream.AddItem(['xAOD::VertexAuxContainer#TauRefittedPrimaryVerticesAux.-vxTrackAtVertex']) + + + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py new file mode 100644 index 0000000000000000000000000000000000000000..6275dc721638f12eec84cde11032b965fa63a389 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py @@ -0,0 +1,187 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +################################################# +# Common code used for the HIGG4 thinning # +# Z.Zinonos # +# zenon@cern.ch # +# Nov 2015 # +################################################# + +from AthenaCommon.GlobalFlags import globalflags + +# running on data or MC +DFisMC = (globalflags.DataSource()=='geant4') + +# trigger navigation +def TriggerChains(HIGG4DxName): + if HIGG4DxName == 'HIGG4D1': + return 'HLT_e.*|HLT_2e.*|HLT_mu.*|HLT_2mu.*' + elif HIGG4DxName == 'HIGG4D2': + return 'HLT_e.*|HLT_mu.*' + elif HIGG4DxName in ['HIGG4D3', 'HIGG4D4']: + return 'HLT_tau.*' + else : + assert False, "HIGG4DxThinning: Unknown derivation stream '{}'".format(HIGG4DxName) + +def setup(HIGG4DxName, HIGG4DxThinningSvc, ToolSvc): + thinningTools=[] + + #jets and tracks + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + HIGG4DxJetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetTPThinningTool", + ThinningService = HIGG4DxThinningSvc, + JetKey = "AntiKt4EMTopoJets", + SelectionString = "AntiKt4EMTopoJets.pt > 18*GeV", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += HIGG4DxJetTPThinningTool + thinningTools.append(HIGG4DxJetTPThinningTool) + + HIGG4DxJetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetLCTPThinningTool", + ThinningService = HIGG4DxThinningSvc, + JetKey = "AntiKt4LCTopoJets", + SelectionString = "AntiKt4LCTopoJets.pt > 18*GeV", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += HIGG4DxJetLCTPThinningTool + thinningTools.append(HIGG4DxJetLCTPThinningTool) + + #fat jets and track thinning + if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + HIGG4DxJetTrackThinningTool1 = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetTrackThinningTool1", + ThinningService = HIGG4DxThinningSvc, + JetKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", + SelectionString = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 150*GeV", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + ToolSvc += HIGG4DxJetTrackThinningTool1 + thinningTools.append(HIGG4DxJetTrackThinningTool1) + + if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning + HIGG4DxJetTrackThinningTool2 = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetTrackThinningTool2", + ThinningService = HIGG4DxThinningSvc, + JetKey = "AntiKt2PV0TrackJets", + SelectionString = "AntiKt2PV0TrackJets.pt > 6*GeV", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + #ToolSvc += HIGG4DxJetTrackThinningTool2 + #thinningTools.append(HIGG4DxJetTrackThinningTool2) + + # Tracks associated with Muons + HIGG4DxMuonSelectionString = "" + if HIGG4DxName in ['HIGG4D3', 'HIGG4D4']: + HIGG4DxMuonSelectionString = "Muons.pt > 1*GeV" + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning + HIGG4DxMuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = HIGG4DxName+"MuonTPThinningTool", + ThinningService = HIGG4DxThinningSvc, + MuonKey = "Muons", + SelectionString = HIGG4DxMuonSelectionString, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += HIGG4DxMuonTPThinningTool + thinningTools.append(HIGG4DxMuonTPThinningTool) + + # Tracks associated with Electrons + HIGG4DxElectronSelectionString = "" + if HIGG4DxName in ['HIGG4D3', 'HIGG4D4']: + HIGG4DxElectronSelectionString = "Electrons.pt > 1*GeV" + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning + HIGG4DxElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = HIGG4DxName+"ElectronTPThinningTool", + ThinningService = HIGG4DxThinningSvc, + SGKey = "Electrons", + SelectionString = HIGG4DxElectronSelectionString, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += HIGG4DxElectronTPThinningTool + thinningTools.append(HIGG4DxElectronTPThinningTool) + + # Tracks associated with taus + HIGG4DxTauSelectionString = "TauJets.pt > 18*GeV" + if HIGG4DxName == 'HIGG4D4': + HIGG4DxTauSelectionString = "TauJets.pt > 40*GeV" + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning + HIGG4DxTauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = HIGG4DxName+"TauTPThinningTool", + ThinningService = HIGG4DxThinningSvc, + TauKey = "TauJets", + SelectionString = HIGG4DxTauSelectionString, + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") + ToolSvc += HIGG4DxTauTPThinningTool + thinningTools.append(HIGG4DxTauTPThinningTool) + + + #Truth tau/nutau and their ancestors and descendants + truth_cond_tau = "((abs(TruthParticles.pdgId) == 15 || abs(TruthParticles.pdgId) == 16) && (TruthParticles.pt > 0.01*GeV) && (TruthParticles.barcode<200000))" + truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11 && abs(TruthParticles.pdgId) <= 14) && (TruthParticles.pt > 4.0*GeV) && (TruthParticles.status == 1) && (TruthParticles.barcode<200000))" + truth_cond_comb = "("+truth_cond_lep+"||"+truth_cond_tau+")" + + #truth_photon_thinning = "(TruthPhotons.pt > 1.0*GeV) && (abs(TruthPhotons.eta)<3.0)" + # PreserveGeneratorDescendants only keeps particles that came directly from the event generator + # PreserveDescendants keeps all particles including those that come from Geant processes + + if DFisMC: + #thin special containers + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + #thin taus + HIGG4DxTruthTool_TAU = DerivationFramework__GenericTruthThinning(name = HIGG4DxName+"TruthTool_TAU", + ThinningService = HIGG4DxThinningSvc, + ParticleSelectionString = truth_cond_tau, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = False, + TauHandling = False) + ToolSvc += HIGG4DxTruthTool_TAU + thinningTools.append(HIGG4DxTruthTool_TAU) + + #thin leptons and taus + HIGG4DxTruthTool_COMB = DerivationFramework__GenericTruthThinning(name = HIGG4DxName+"TruthTool_COMB", + ThinningService = HIGG4DxThinningSvc, + ParticleSelectionString = truth_cond_comb, + PreserveDescendants = False, + PreserveGeneratorDescendants = False, + PreserveAncestors = True, + TauHandling = False) + + ToolSvc += HIGG4DxTruthTool_COMB + thinningTools.append(HIGG4DxTruthTool_COMB) + + #thin photons + """HIGG4DxTruthTool_PHO = DerivationFramework__GenericTruthThinning(name = "HIGG4DxTruthTool_PHO", + ThinningService = HIGG4DxThinningHelper.ThinningSvc(), + ParticlesKey = "TruthPhotons", + ParticleSelectionString = truth_photon_thinning) + + ToolSvc += HIGG4DxTruthTool_PHO + thinningTools.append(HIGG4DxTruthTool_PHO)""" + + #thinning the master truth collection + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning + HIGG4DxTruthTool_MENU = DerivationFramework__MenuTruthThinning( name = HIGG4DxName+"TruthTool_MENU", + ThinningService = HIGG4DxThinningSvc, + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = False, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = False, + PartonPtThresh = -1.0, + WriteBSM = False, + WriteBosons = False, + WriteBSMProducts = False, + WriteBosonProducts = False, + WriteTopAndDecays = False, + WriteEverything = False, + WriteAllLeptons = False, + WriteStatus3 = False, + PreserveDescendants = False, + PreserveGeneratorDescendants = False, + PreserveAncestors = True, + WriteFirstN = 15) + + ToolSvc += HIGG4DxTruthTool_MENU + thinningTools.append(HIGG4DxTruthTool_MENU) + #end of MC + + # return thinning tools + return thinningTools + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D1ContentList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D1ContentList.py new file mode 100644 index 0000000000000000000000000000000000000000..b79b4baff42aec0909e79a04c877d2b856616935 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D1ContentList.py @@ -0,0 +1,137 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +HIGG5D1Content = [ +### Event info +"xAOD::EventInfo_v1#EventInfo", +"xAOD::EventAuxInfo_v1#EventInfoAux.", +"PileUpEventInfo#McEventInfo", +### Electron +"xAOD::ElectronContainer_v1#ElectronCollection", +"xAOD::ElectronAuxContainer#ElectronCollectionAux.", +"xAOD::ElectronContainer_v1#FwdElectrons", ### may not need +"xAOD::ElectronAuxContainer#FwdElectronsAux.", ### may not need +### Muon +"xAOD::MuonContainer_v1#Muons", +"xAOD::MuonAuxContainer_v1#MuonsAux.", +### Tau +"xAOD::TauJetContainer_v1#TauRecContainer", +"xAOD::TauJetAuxContainer_v1#TauRecContainerAux.", +### Photon +#"xAOD::PhotonContainer_v1#*", +#"xAOD::PhotonAuxContainer_v1#*", +### Jet +"xAOD::JetContainer_v1#AntiKt4EMTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt4EMTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt4LCTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt4LCTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt4TruthJets", +"xAOD::JetAuxContainer_v1#AntiKt4TruthJetsAux.", +"xAOD::JetContainer_v1#AntiKt4TruthWZJets", +"xAOD::JetAuxContainer_v1#AntiKt4TruthWZJetsAux.", +"xAOD::JetContainer_v1#AntiKt10LCTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt10LCTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt10TruthJets", +"xAOD::JetAuxContainer_v1#AntiKt10TruthJetsAux.", +"xAOD::JetContainer_v1#AntiKt10TruthWZJets", +"xAOD::JetAuxContainer_v1#AntiKt10TruthWZJetsAux.", +"xAOD::JetContainer_v1#CamKt12LCTopoJets", +"xAOD::JetAuxContainer_v1#CamKt12LCTopoJetsAux.", +"xAOD::JetContainer_v1#CamKt12TruthJets", +"xAOD::JetAuxContainer_v1#CamKt12TruthJetsAux.", +"xAOD::JetContainer_v1#CamKt12TruthWZJets", +"xAOD::JetAuxContainer_v1#CamKt12TruthWZJetsAux.", +"xAOD::JetContainer_v1#AntiKt3PV0TrackJets", +"xAOD::JetAuxContainer_v1#AntiKt3PV0TrackJetsAux.", +"xAOD::EventShape_v1#*", +"xAOD::EventShapeAuxInfo_v1#*", +### Calo cluster +#"xAOD::CaloClusterContainer_v1#CaloCalTopoCluster", +#"xAOD::CaloClusterAuxContainer_v1#CaloCalTopoClusterAux.", +"xAOD::CaloClusterContainer_v1#LArClusterEMFrwd", +"xAOD::CaloClusterAuxContainer_v1#LArClusterEMFrwdAux.", +"xAOD::CaloClusterContainer_v1#egClusterCollection", +"xAOD::CaloClusterAuxContainer_v1#egClusterCollectionAux.", +### Track +"xAOD::TrackParticleContainer_v1#CombinedMuonTrackParticles", +"xAOD::TrackParticleContainer_v1#ExtrapolatedMuonTrackParticles", +"xAOD::TrackParticleContainer_v1#GSFTrackParticles", +"xAOD::TrackParticleContainer_v1#InDetTrackParticles", +"xAOD::TrackParticleContainer_v1#InDetTrackParticlesForward", +"xAOD::TrackParticleAuxContainer_v1#CombinedMuonTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#ExtrapolatedMuonTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#GSFTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#InDetTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#InDetTrackParticlesForwardAux.", +### Missing ET +"xAOD::MissingETContainer_v1#MET_EMJets", +"xAOD::MissingETAuxContainer_v1#MET_EMJetsAux.", +"xAOD::MissingETContainer_v1#MET_EleLHMedEMJets", +"xAOD::MissingETAuxContainer_v1#MET_EleLHMedEMJetsAux.", +#"xAOD::MissingETContainer_v1#MET_RefFinal", +#"xAOD::MissingETAuxContainer_v1#MET_RefFinalAux.", +"xAOD::MissingETContainer_v1#MET_RefFinalFix", +"xAOD::MissingETAuxContainer_v1#MET_RefFinalFixAux.", +"xAOD::MissingETContainer_v1#MET_Truth", +"xAOD::MissingETAuxContainer_v1#MET_TruthAux.", +#"xAOD::MissingETContainer_v1#MET_Track", +#"xAOD::MissingETAuxContainer_v1#MET_TrackAux.", +"xAOD::MissingETContainer_v1#MET_TrackFix", +"xAOD::MissingETAuxContainer_v1#MET_TrackFixAux.", +"xAOD::MissingETComponentMap_v1#METMap_EMJets", +"xAOD::MissingETAuxComponentMap_v1#METMap_EMJetsAux.", +"xAOD::MissingETComponentMap_v1#METMap_EleLHMedEMJets", +"xAOD::MissingETAuxComponentMap_v1#METMap_EleLHMedEMJetsAux.", +"xAOD::MissingETComponentMap_v1#METMap_RefFinalFix", +"xAOD::MissingETAuxComponentMap_v1#METMap_RefFinalFixAux.", +"xAOD::MissingETComponentMap_v1#METMap_Truth", +"xAOD::MissingETAuxComponentMap_v1#METMap_TruthAux.", +"xAOD::MissingETComponentMap_v1#METMap_TrackFix", +"xAOD::MissingETAuxComponentMap_v1#METMap_TrackFixAux.", +### Vertex +"xAOD::VertexContainer_v1#*", +"xAOD::VertexAuxContainer_v1#*", +### B-tag +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4EMTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4EMTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4LCTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4LCTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4Truth", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4TruthAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4TruthWZ", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4TruthWZAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10LCTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10LCTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10Truth", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10TruthAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10TruthWZ", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10TruthWZAux.", +### Trigger +"xAOD::TrigDecision_v1#xTrigDecision", +"xAOD::TrigDecisionAuxInfo_v1#xTrigDecisionAux.", +"xAOD::TriggerMenuContainer_v1#TriggerMenu", +"xAOD::TriggerMenuAuxContainer_v1#TriggerMenuAux.", +"HLT::HLTResult#HLTResult_HLT", +"HLT::HLTResult#HLTResult_L2", +"HLT::HLTResult#HLTResult_EF", +"TrigDec::TrigDecision#TrigDecision", +### Truth +"xAOD::TruthVertexContainer_v1#TruthVertex", +"xAOD::TruthVertexAuxContainer_v1#TruthVertexAux.", +"xAOD::TruthParticleContainer_v1#TruthParticle", +"xAOD::TruthParticleContainer_v1#MuonTruthParticle", +"xAOD::TruthParticleAuxContainer_v1#TruthParticleAux.", +"xAOD::TruthParticleAuxContainer_v1#MuonTruthParticleAux.", +"xAOD::TruthEventContainer_v1#TruthEvent", +"xAOD::TruthEventAuxContainer_v1#TruthEventAux.", +### Tau +"xAOD::PFOContainer_v1#TauPi0ChargedPFOContainer", +"xAOD::PFOAuxContainer_v1#TauPi0ChargedPFOContainerAux.", +"xAOD::PFOContainer_v1#TauPi0NeutralPFOContainer", +"xAOD::PFOAuxContainer_v1#TauPi0NeutralPFOContainerAux.", +"xAOD::PFOContainer_v1#TauShotPFOContainer", +"xAOD::PFOAuxContainer_v1#TauShotPFOContainerAux.", +"xAOD::PFOContainer_v1#chargedTauPFO_eflowRec", +"xAOD::PFOAuxContainer_v1#chargedTauPFO_eflowRecAux.", +"xAOD::PFOContainer_v1#neutralTauPFO_eflowRec", +"xAOD::PFOAuxContainer_v1#neutralTauPFO_eflowRecAux." +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D1ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D1ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..bd631fad1172cb9ef2bb2a0372a18124ee826bcc --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D1ExtraContent.py @@ -0,0 +1,28 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "Muons.clusterLink.EnergyLoss.energyLossType", + "AntiKt4LCTopoJets.TrackWidthPt500.GhostTrackCount.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4LCTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m", + "AntiKt4EMTopoJets.TrackWidthPt500.GhostTrackCount.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m", + "AntiKt4EMTopoJets.DFCommonJets_Calib_pt.DFCommonJets_Calib_eta.DFCommonJets_Calib_phi.DFCommonJets_Calib_m", + "Photons.f3core"] + +ExtraContentTruth=[ + "AntiKt4EMTopoJets.ConeTruthLabelID", + "AntiKt4LCTopoJets.ConeTruthLabelID"] + +ExtraContainers=[ + "BTagging_AntiKt3Track", + "BTagging_AntiKt2Track", + "MuonSegments"] + +ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D2ContentList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D2ContentList.py new file mode 100644 index 0000000000000000000000000000000000000000..b2d5a4e8cf3cfa43f223a6a5cb1ca7343236383c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D2ContentList.py @@ -0,0 +1,137 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +HIGG5D2Content = [ +### Event info +"xAOD::EventInfo_v1#EventInfo", +"xAOD::EventAuxInfo_v1#EventInfoAux.", +"PileUpEventInfo#McEventInfo", +### Electron +"xAOD::ElectronContainer_v1#ElectronCollection", +"xAOD::ElectronAuxContainer#ElectronCollectionAux.", +"xAOD::ElectronContainer_v1#FwdElectrons", ### may not need +"xAOD::ElectronAuxContainer#FwdElectronsAux.", ### may not need +### Muon +"xAOD::MuonContainer_v1#Muons", +"xAOD::MuonAuxContainer_v1#MuonsAux.", +### Tau +"xAOD::TauJetContainer_v1#TauRecContainer", +"xAOD::TauJetAuxContainer_v1#TauRecContainerAux.", +### Photon +#"xAOD::PhotonContainer_v1#*", +#"xAOD::PhotonAuxContainer_v1#*", +### Jet +"xAOD::JetContainer_v1#AntiKt4EMTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt4EMTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt4LCTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt4LCTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt4TruthJets", +"xAOD::JetAuxContainer_v1#AntiKt4TruthJetsAux.", +"xAOD::JetContainer_v1#AntiKt4TruthWZJets", +"xAOD::JetAuxContainer_v1#AntiKt4TruthWZJetsAux.", +"xAOD::JetContainer_v1#AntiKt10LCTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt10LCTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt10TruthJets", +"xAOD::JetAuxContainer_v1#AntiKt10TruthJetsAux.", +"xAOD::JetContainer_v1#AntiKt10TruthWZJets", +"xAOD::JetAuxContainer_v1#AntiKt10TruthWZJetsAux.", +"xAOD::JetContainer_v1#CamKt12LCTopoJets", +"xAOD::JetAuxContainer_v1#CamKt12LCTopoJetsAux.", +"xAOD::JetContainer_v1#CamKt12TruthJets", +"xAOD::JetAuxContainer_v1#CamKt12TruthJetsAux.", +"xAOD::JetContainer_v1#CamKt12TruthWZJets", +"xAOD::JetAuxContainer_v1#CamKt12TruthWZJetsAux.", +"xAOD::JetContainer_v1#AntiKt3PV0TrackJets", +"xAOD::JetAuxContainer_v1#AntiKt3PV0TrackJetsAux.", +"xAOD::EventShape_v1#*", +"xAOD::EventShapeAuxInfo_v1#*", +### Calo cluster +#"xAOD::CaloClusterContainer_v1#CaloCalTopoCluster", +#"xAOD::CaloClusterAuxContainer_v1#CaloCalTopoClusterAux.", +"xAOD::CaloClusterContainer_v1#LArClusterEMFrwd", +"xAOD::CaloClusterAuxContainer_v1#LArClusterEMFrwdAux.", +"xAOD::CaloClusterContainer_v1#egClusterCollection", +"xAOD::CaloClusterAuxContainer_v1#egClusterCollectionAux.", +### Track +"xAOD::TrackParticleContainer_v1#CombinedMuonTrackParticles", +"xAOD::TrackParticleContainer_v1#ExtrapolatedMuonTrackParticles", +"xAOD::TrackParticleContainer_v1#GSFTrackParticles", +"xAOD::TrackParticleContainer_v1#InDetTrackParticles", +"xAOD::TrackParticleContainer_v1#InDetTrackParticlesForward", +"xAOD::TrackParticleAuxContainer_v1#CombinedMuonTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#ExtrapolatedMuonTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#GSFTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#InDetTrackParticlesAux.", +"xAOD::TrackParticleAuxContainer_v1#InDetTrackParticlesForwardAux.", +### Missing ET +"xAOD::MissingETContainer_v1#MET_EMJets", +"xAOD::MissingETAuxContainer_v1#MET_EMJetsAux.", +"xAOD::MissingETContainer_v1#MET_EleLHMedEMJets", +"xAOD::MissingETAuxContainer_v1#MET_EleLHMedEMJetsAux.", +#"xAOD::MissingETContainer_v1#MET_RefFinal", +#"xAOD::MissingETAuxContainer_v1#MET_RefFinalAux.", +"xAOD::MissingETContainer_v1#MET_RefFinalFix", +"xAOD::MissingETAuxContainer_v1#MET_RefFinalFixAux.", +"xAOD::MissingETContainer_v1#MET_Truth", +"xAOD::MissingETAuxContainer_v1#MET_TruthAux.", +#"xAOD::MissingETContainer_v1#MET_Track", +#"xAOD::MissingETAuxContainer_v1#MET_TrackAux.", +"xAOD::MissingETContainer_v1#MET_TrackFix", +"xAOD::MissingETAuxContainer_v1#MET_TrackFixAux.", +"xAOD::MissingETComponentMap_v1#METMap_EMJets", +"xAOD::MissingETAuxComponentMap_v1#METMap_EMJetsAux.", +"xAOD::MissingETComponentMap_v1#METMap_EleLHMedEMJets", +"xAOD::MissingETAuxComponentMap_v1#METMap_EleLHMedEMJetsAux.", +"xAOD::MissingETComponentMap_v1#METMap_RefFinalFix", +"xAOD::MissingETAuxComponentMap_v1#METMap_RefFinalFixAux.", +"xAOD::MissingETComponentMap_v1#METMap_Truth", +"xAOD::MissingETAuxComponentMap_v1#METMap_TruthAux.", +"xAOD::MissingETComponentMap_v1#METMap_TrackFix", +"xAOD::MissingETAuxComponentMap_v1#METMap_TrackFixAux.", +### Vertex +"xAOD::VertexContainer_v1#*", +"xAOD::VertexAuxContainer_v1#*", +### B-tag +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4EMTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4EMTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4LCTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4LCTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4Truth", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4TruthAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4TruthWZ", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4TruthWZAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10LCTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10LCTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10Truth", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10TruthAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10TruthWZ", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10TruthWZAux.", +### Trigger +"xAOD::TrigDecision_v1#xTrigDecision", +"xAOD::TrigDecisionAuxInfo_v1#xTrigDecisionAux.", +"xAOD::TriggerMenuContainer_v1#TriggerMenu", +"xAOD::TriggerMenuAuxContainer_v1#TriggerMenuAux.", +"HLT::HLTResult#HLTResult_HLT", +"HLT::HLTResult#HLTResult_L2", +"HLT::HLTResult#HLTResult_EF", +"TrigDec::TrigDecision#TrigDecision", +### Truth +"xAOD::TruthVertexContainer_v1#TruthVertex", +"xAOD::TruthVertexAuxContainer_v1#TruthVertexAux.", +"xAOD::TruthParticleContainer_v1#TruthParticle", +"xAOD::TruthParticleContainer_v1#MuonTruthParticle", +"xAOD::TruthParticleAuxContainer_v1#TruthParticleAux.", +"xAOD::TruthParticleAuxContainer_v1#MuonTruthParticleAux.", +"xAOD::TruthEventContainer_v1#TruthEvent", +"xAOD::TruthEventAuxContainer_v1#TruthEventAux.", +### Tau +"xAOD::PFOContainer_v1#TauPi0ChargedPFOContainer", +"xAOD::PFOAuxContainer_v1#TauPi0ChargedPFOContainerAux.", +"xAOD::PFOContainer_v1#TauPi0NeutralPFOContainer", +"xAOD::PFOAuxContainer_v1#TauPi0NeutralPFOContainerAux.", +"xAOD::PFOContainer_v1#TauShotPFOContainer", +"xAOD::PFOAuxContainer_v1#TauShotPFOContainerAux.", +"xAOD::PFOContainer_v1#chargedTauPFO_eflowRec", +"xAOD::PFOAuxContainer_v1#chargedTauPFO_eflowRecAux.", +"xAOD::PFOContainer_v1#neutralTauPFO_eflowRec", +"xAOD::PFOAuxContainer_v1#neutralTauPFO_eflowRecAux." +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D2ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D2ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..bd631fad1172cb9ef2bb2a0372a18124ee826bcc --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D2ExtraContent.py @@ -0,0 +1,28 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +ExtraContent=[ + "egammaClusters.rawE.phi_sampl.calM", + "Muons.clusterLink.EnergyLoss.energyLossType", + "AntiKt4LCTopoJets.TrackWidthPt500.GhostTrackCount.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4LCTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m", + "AntiKt4EMTopoJets.TrackWidthPt500.GhostTrackCount.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m", + "AntiKt4EMTopoJets.DFCommonJets_Calib_pt.DFCommonJets_Calib_eta.DFCommonJets_Calib_phi.DFCommonJets_Calib_m", + "Photons.f3core"] + +ExtraContentTruth=[ + "AntiKt4EMTopoJets.ConeTruthLabelID", + "AntiKt4LCTopoJets.ConeTruthLabelID"] + +ExtraContainers=[ + "BTagging_AntiKt3Track", + "BTagging_AntiKt2Track", + "MuonSegments"] + +ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D3ExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D3ExtraContent.py new file mode 100644 index 0000000000000000000000000000000000000000..1d1e9e1b2780677ba179d948a4dc7898324eba2a --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG5D3ExtraContent.py @@ -0,0 +1,35 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +#Content included in addition to the Smart Slimming Content + +ExtraContent=[ + "Muons.clusterLink.EnergyLoss.energyLossType", + "AntiKt4LCTopoJets.TrackWidthPt500.GhostTrackCount.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4LCTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m", + "AntiKt4EMTopoJets.TrackWidthPt500.GhostTrackCount.Jvt.JvtJvfcorr.JvtRpt", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m", + "AntiKt4EMTopoJets.DFCommonJets_Calib_pt.DFCommonJets_Calib_eta.DFCommonJets_Calib_phi.DFCommonJets_Calib_m", + "Photons.f3core"] + +ExtraContentTruth=[ + "AntiKt4EMTopoJets.ConeTruthLabelID", + "AntiKt4LCTopoJets.ConeTruthLabelID"] + +ExtraContainers=[ + #"BTagging_AntiKt10LCTopo", + "BTagging_AntiKt3Track", + "BTagging_AntiKt2Track", + #"xTrigDecision", # for xAOD::TrigDecision_v1 + #"xTrigDecisionAux", # for xAOD::TrigDecisionAuxInfo_v1 + #"TrigDecision", # for TrigDec::TrigDecision + #"HLT_TrigEFBjetContainer_EFBjetFex", # for TrigEFBjetContainer + #"HLT_TrigL2BjetContainer_L2BjetFex", # for TrigL2BjetContainer + #"HLT_JetCollection_TrigJetRec", + "MuonSegments"] + + +ExtraContainersTruth=[ + "TruthEvents", + "TruthParticles", + "TruthVertices", + "MuonTruthParticles"] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HiggsCommonContentList.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HiggsCommonContentList.py new file mode 100644 index 0000000000000000000000000000000000000000..74bc8129a2d25e6bdee3ee8bf7fc97b8d10c208e --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HiggsCommonContentList.py @@ -0,0 +1,100 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +HiggsCommonContent=[ +"xAOD::TrackParticleContainer_v1#CombinedMuonTrackParticles", +"xAOD::TrackParticleAuxContainer_v1#CombinedMuonTrackParticlesAux.", +"xAOD::TrackParticleContainer_v1#ExtrapolatedMuonTrackParticles", +"xAOD::TrackParticleAuxContainer_v1#ExtrapolatedMuonTrackParticlesAux.", +"xAOD::TrackParticleContainer_v1#GSFTrackParticles", +"xAOD::TrackParticleAuxContainer_v1#GSFTrackParticlesAux.", +"xAOD::TrackParticleContainer_v1#InDetTrackParticles", +"xAOD::TrackParticleAuxContainer_v1#InDetTrackParticlesAux.", +"xAOD::TrackParticleContainer_v1#InDetTrackParticlesForward", +"xAOD::TrackParticleAuxContainer_v1#InDetTrackParticlesForwardAux.", +"xAOD::MissingETComponentMap_v1#*", +"xAOD::MissingETAuxComponentMap_v1#*", +"xAOD::MissingETContainer_v1#*", +"xAOD::MissingETAuxContainer_v1#*", +"xAOD::EventShape_v1#*", +"xAOD::EventShapeAuxInfo_v1#*", +"xAOD::VertexContainer_v1#GSFConversionVertices", +"xAOD::VertexAuxContainer_v1#GSFConversionVerticesAux.", +"xAOD::VertexContainer_v1#PrimaryVertices", +"xAOD::VertexAuxContainer_v1#PrimaryVerticesAux.", +"xAOD::VertexContainer_v1#TauSecondaryVertexContainer", +"xAOD::VertexAuxContainer_v1#TauSecondaryVertexContainerAux.", +"xAOD::JetContainer_v1#AntiKt4EMTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt4EMTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt4LCTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt4LCTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt4TruthJets", +"xAOD::JetAuxContainer_v1#AntiKt4TruthJetsAux.", +"xAOD::JetContainer_v1#AntiKt4TruthWZJets", +"xAOD::JetAuxContainer_v1#AntiKt4TruthWZJetsAux.", +"xAOD::JetContainer_v1#AntiKt10LCTopoJets", +"xAOD::JetAuxContainer_v1#AntiKt10LCTopoJetsAux.", +"xAOD::JetContainer_v1#AntiKt10TruthJets", +"xAOD::JetAuxContainer_v1#AntiKt10TruthJetsAux.", +"xAOD::JetContainer_v1#AntiKt10TruthWZJets", +"xAOD::JetAuxContainer_v1#AntiKt10TruthWZJetsAux.", +"xAOD::JetContainer_v1#CamKt12LCTopoJets", +"xAOD::JetAuxContainer_v1#CamKt12LCTopoJetsAux.", +"xAOD::JetContainer_v1#CamKt12TruthJets", +"xAOD::JetAuxContainer_v1#CamKt12TruthJetsAux.", +"xAOD::JetContainer_v1#CamKt12TruthWZJets", +"xAOD::JetAuxContainer_v1#CamKt12TruthWZJetsAux.", +"xAOD::CaloClusterContainer_v1#CaloCalTopoCluster", +"xAOD::CaloClusterAuxContainer_v1#CaloCalTopoClusterAux.", +"xAOD::CaloClusterContainer_v1#LArClusterEMFrwd", +"xAOD::CaloClusterAuxContainer_v1#LArClusterEMFrwdAux.", +"xAOD::CaloClusterContainer_v1#egClusterCollection", +"xAOD::CaloClusterAuxContainer_v1#egClusterCollectionAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4EMTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4EMTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4LCTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4LCTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4Truth", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4TruthAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt4TruthWZ", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt4TruthWZAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10LCTopo", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10LCTopoAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10Truth", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10TruthAux.", +"xAOD::BTaggingContainer_v1#BTagging_AntiKt10TruthWZ", +"xAOD::BTaggingAuxContainer_v1#BTagging_AntiKt10TruthWZAux.", +"xAOD::EventInfo_v1#EventInfo", +"xAOD::EventAuxInfo_v1#EventInfoAux.", +"xAOD::MissingETContainer_v1#MET_RefFinal", +"xAOD::MissingETAuxContainer_v1#MET_RefFinalAux.", +"xAOD::MissingETContainer_v1#MET_Truth", +"xAOD::MissingETAuxContainer_v1#MET_TruthAux.", +"xAOD::MissingETContainer_v1#MET_Track", +"xAOD::MissingETAuxContainer_v1#MET_TrackAux.", +"xAOD::TauJetContainer_v1#TauRecContainer", +"xAOD::TauJetAuxContainer_v1#TauRecContainerAux.", +"xAOD::MuonContainer_v1#Muons", +"xAOD::MuonAuxContainer_v1#MuonsAux.", +"xAOD::TruthParticleContainer_v1#MuonTruthParticle", +"xAOD::TruthParticleAuxContainer_v1#MuonTruthParticleAux.", +"xAOD::TruthParticleContainer_v1#TruthParticle", +"xAOD::TruthParticleAuxContainer_v1#TruthParticleAux.", +"PileUpEventInfo#McEventInfo", +"xAOD::TruthEventContainer_v1#TruthEvent", +"xAOD::TruthEventAuxContainer_v1#TruthEventAux.", +"xAOD::TruthVertexContainer_v1#TruthVertex", +"xAOD::TruthVertexAuxContainer_v1#TruthVertexAux.", +"xAOD::PFOContainer_v1#TauPi0ChargedPFOContainer", +"xAOD::PFOAuxContainer_v1#TauPi0ChargedPFOContainerAux.", +"xAOD::PFOContainer_v1#TauPi0NeutralPFOContainer", +"xAOD::PFOAuxContainer_v1#TauPi0NeutralPFOContainerAux.", +"xAOD::PFOContainer_v1#TauShotPFOContainer", +"xAOD::PFOAuxContainer_v1#TauShotPFOContainerAux.", +"xAOD::PFOContainer_v1#chargedTauPFO_eflowRec", +"xAOD::PFOAuxContainer_v1#chargedTauPFO_eflowRecAux.", +"xAOD::PFOContainer_v1#neutralTauPFO_eflowRec", +"xAOD::PFOAuxContainer_v1#neutralTauPFO_eflowRecAux.", +"xAOD::ElectronContainer_v1#ElectronCollection", +"xAOD::ElectronAuxContainer#ElectronCollectionAux.", +"xAOD::ElectronContainer_v1#FwdElectrons", +"xAOD::ElectronAuxContainer#FwdElectronsAux."] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/__init__.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..74583d364ec2ca794156596c7254d9b234a940c6 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py new file mode 100644 index 0000000000000000000000000000000000000000..c8c73e5a1690ee9a7aa7504ce98073ddc77e9b79 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py @@ -0,0 +1,243 @@ +#==================================================================== +# HIGG1D1.py +# This requires the reductionConf flag HIGG1D1 in Reco_tf.py +#==================================================================== + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +import AthenaCommon.SystemOfUnits as Units +from AthenaCommon.GlobalFlags import globalflags +from AthenaCommon.BeamFlags import jobproperties + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + +print "HIGG1D1.py jobproperties.Beam.energy()", jobproperties.Beam.energy() +SkipTriggerRequirement=((globalflags.DataSource()=='geant4') and (jobproperties.Beam.energy()==4000000.0)) +# 8 TeV MC does not have trigger information +print "HIGG1D1.py SkipTriggerRequirement", SkipTriggerRequirement +TriggerExp = [] +if not SkipTriggerRequirement: + if jobproperties.Beam.energy()==4000000.0: + # 8 TeV data + TriggerExp = ["EF_g35_loose_g25_loose"] + if jobproperties.Beam.energy()==6500000.0: + # 13 TeV MC + # TriggerTP = ["HLT_e28_tight_iloose", "HLT_e60_medium", "HLT_mu26_imedium", "HLT_mu50"] + TriggerExp = ["HLT_g35_medium_g25_medium","HLT_2g20_tight"] +print "HIGG1D1.py TriggerExp", TriggerExp + +#KeepTrigger=not SkipTriggerRequirement +KeepTrigger=False + +print "HIGG1D1.py KeepTrigger", KeepTrigger + +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG1 +SkimmingToolHIGG1D1 = DerivationFramework__SkimmingToolHIGG1( + name = "SkimmingToolHIGG1D1", + RequireGRL = True, + ReqireLArError = True, + RequireTrigger = KeepTrigger, + RequirePreselection = True, + RequireKinematic = False, + RequireQuality = False, + RequireIsolation = False, + RequireInvariantMass = False, + Triggers = TriggerExp, + IncludeSingleElectronPreselection = True, + IncludeDoubleElectronPreselection = True, + IncludeSingleMuonPreselection = True) + +ToolSvc += SkimmingToolHIGG1D1 +print SkimmingToolHIGG1D1 + +#================ +# THINNING +#================ +thinningTools=[] +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG1D1MetTPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D1MetTPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG1D1MetTPThinningTool +print HIGG1D1MetTPThinningTool +#thinningTools.append(HIGG1D1MetTPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG1D1JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D1JetLCTPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG1D1JetLCTPThinningTool +print HIGG1D1JetLCTPThinningTool +#thinningTools.append(HIGG1D1JetLCTPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG1D1JetEMTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D1JetEMTPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG1D1JetEMTPThinningTool +print HIGG1D1JetEMTPThinningTool +#thinningTools.append(HIGG1D1JetEMTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG1D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "HIGG1D1MuonTPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D1MuonTPThinningTool +print HIGG1D1MuonTPThinningTool +#thinningTools.append(HIGG1D1MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG1D1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG1D1ElectronTPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D1ElectronTPThinningTool +print HIGG1D1ElectronTPThinningTool +#thinningTools.append(HIGG1D1ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG1D1PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG1D1PhotonTPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D1PhotonTPThinningTool +print HIGG1D1PhotonTPThinningTool +#thinningTools.append(HIGG1D1PhotonTPThinningTool) + +# Tracks themselves +HIGG1D1TPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D1TPThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D1TPThinningTool +print HIGG1D1TPThinningTool +#thinningTools.append(HIGG1D1TPThinningTool) + +# Truth thinning +truth_cond_1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond_2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond_3 = "((abs(TruthParticles.pdgId) == 6))" # Top quark +truth_cond_4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon +truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles +truth_expression = '('+truth_cond_1+' || '+truth_cond_2 +' || '+truth_cond_3 +' || '+truth_cond_4+') || ('+truth_cond_finalState+')' + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG1D1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG1D1TruthThinningTool", + ThinningService = "HIGG1D1ThinningSvc", + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG1D1.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG1D1TruthThinningTool + thinningTools.append(HIGG1D1TruthThinningTool) +print "HIGG1D1.py thinningTools", thinningTools + + +#==================================================================== +# Max Cell sum decoration tool +#==================================================================== +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__MaxCellDecorator +HIGG1D1_MaxCellDecoratorTool = DerivationFramework__MaxCellDecorator( name = "HIGG1D1_MaxCellDecoratorTool", + SGKey_electrons = "Electrons", + SGKey_photons = "Photons" + ) +ToolSvc += HIGG1D1_MaxCellDecoratorTool + +#==================================================================== +# Cell sum decoration tool +#==================================================================== + +from DerivationFrameworkCalo.DerivationFrameworkCaloFactories import GainDecorator, getGainDecorations +HIGG1D1_GainDecoratorTool = GainDecorator() + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== + +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG1D1Kernel", + SkimmingTools = [SkimmingToolHIGG1D1], + AugmentationTools = [HIGG1D1_MaxCellDecoratorTool,HIGG1D1_GainDecoratorTool], + ThinningTools = thinningTools + ) +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG1D1Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG1D1Stream ) +HIGG1D1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG1D1Stream.AcceptAlgs(["HIGG1D1Kernel"]) + +## Do not use this variable at the derivation stage +#HIGG1D1Stream.AddItem("std::vector<int>#leadingV") + +# Thinning service name must match the one passed to the thinning tools +from AthenaServices.Configurables import ThinningSvc, createThinningSvc +augStream = MSMgr.GetStream( streamName ) +evtStream = augStream.GetEventStream() +svcMgr += createThinningSvc( svcName="HIGG1D1ThinningSvc", outStreams=[evtStream] ) + + #==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG1D1SlimmingHelper = SlimmingHelper("HIGG1D1SlimmingHelper") + + +HIGG1D1SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4EMTopoJets", + "BTagging_AntiKt4EMTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + +HIGG1D1SlimmingHelper.AllVariables = ["Electrons","Photons","egammaClusters","GSFConversionVertices","TruthEvents", "TruthParticles", "TruthVertices", "AntiKt4TruthJets","AntiKt4TruthWZJets","PrimaryVertices","MET_Truth", "egammaTruthParticles","CaloCalTopoClusters"] + +HIGG1D1SlimmingHelper.ExtraVariables = ["Muons.quality.EnergyLoss.energyLossType", + "GSFTrackParticles.parameterY.parameterZ.vx.vy", + "InDetTrackParticles.vx.vy", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt", + "CombinedMuonTrackParticles.z0.vz.definingParametersCovMatrix", + "BTagging_AntiKt4EMTopo.MV1_discriminant", + "ExtrapolatedMuonTrackParticles.z0.vz.definingParametersCovMatrix", + "MuonTruthParticles.truthOrigin.truthType", + "Electrons.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z", + "Photons.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z"] + +HIGG1D1SlimmingHelper.ExtraVariables.extend( getGainDecorations(HIGG1D1_GainDecoratorTool) ) + +#addMETOutputs(HIGG1D1SlimmingHelper) + +HIGG1D1SlimmingHelper.IncludeEGammaTriggerContent = True + +HIGG1D1SlimmingHelper.AppendContentToStream(HIGG1D1Stream) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py new file mode 100644 index 0000000000000000000000000000000000000000..585f7460d83a87caded95535a66127110460d296 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py @@ -0,0 +1,246 @@ +#==================================================================== +# HIGG1D2.py +# This requires the reductionConf flag HIGG1D2 in Reco_tf.py +#==================================================================== + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +RecomputeElectronSelectors = True +#RecomputeElectronSelectors = False + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + + +#==================================================================== +# eegamma selection, di-electron triggers +# two opposite-sign medium el, pT>10 GeV, |eta|<2.5, mee>40 GeV +# gamma: reco, ET>10 GeV< |eta|<2.5 +#==================================================================== + +if RecomputeElectronSelectors : + requirementEl = '(Electrons.DFCommonElectronsIsEMMedium || Electrons.DFCommonElectronsLHMedium) && abs(Electrons.eta)<2.5 && (Electrons.pt > 9.5*GeV)' +else : + requirementEl = '(Electrons.Medium || Electrons.DFCommonElectronsLHMedium) && abs(Electrons.eta)<2.5 && (Electrons.pt > 9.5*GeV)' + + +requirementMu = 'Muons.pt>9.5*GeV && abs(Muons.eta)<2.7 && Muons.DFCommonGoodMuon' + +from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGInvariantMassTool +HIGG1D2_EEMassTool = DerivationFramework__EGInvariantMassTool( name = "HIGG1D2_EEMassTool", + Object1Requirements = requirementEl, + Object2Requirements = requirementEl, + StoreGateEntryName = "HIGG1D2_DiElectronMass", + Mass1Hypothesis = 0.511*MeV, + Mass2Hypothesis = 0.511*MeV, + Container1Name = "Electrons", + Container2Name = "Electrons", + Pt1BranchName = "DFCommonElectrons_pt", + Eta1BranchName = "DFCommonElectrons_eta", + Phi1BranchName = "DFCommonElectrons_phi", + Pt2BranchName = "DFCommonElectrons_pt", + Eta2BranchName = "DFCommonElectrons_eta", + Phi2BranchName = "DFCommonElectrons_phi", + CheckCharge = True, + DoTransverseMass = False, + MinDeltaR = 0.0) +ToolSvc += HIGG1D2_EEMassTool +print HIGG1D2_EEMassTool + +HIGG1D2_MuMuMassTool = DerivationFramework__EGInvariantMassTool( name = "HIGG1D2_MuMuMassTool", + Object1Requirements = requirementMu, + Object2Requirements = requirementMu, + StoreGateEntryName = "HIGG1D2_DiMuonMass", + Mass1Hypothesis = 105*MeV, + Mass2Hypothesis = 105*MeV, + Container1Name = "Muons", + Container2Name = "Muons", + CheckCharge = True, + DoTransverseMass = False, + MinDeltaR = 0.0) +ToolSvc += HIGG1D2_MuMuMassTool +print HIGG1D2_MuMuMassTool + + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +expression = '(count(abs(DFCommonPhotons_eta)<2.5 && DFCommonPhotons_et>9.5*GeV)>=1 && (count(HIGG1D2_DiElectronMass > 40.0*GeV)>=1 || count(HIGG1D2_DiMuonMass > 40.0*GeV)>=1))' +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG1D2SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG1D2SkimmingTool", + expression = expression) +ToolSvc += HIGG1D2SkimmingTool +print "HIGG1D2 skimming tool:", HIGG1D2SkimmingTool + + + +#================ +# THINNING +#================ +thinningTools=[] +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG1D2MetTPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D2MetTPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG1D2MetTPThinningTool +print HIGG1D2MetTPThinningTool +#thinningTools.append(HIGG1D2MetTPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG1D2JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D2JetLCTPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG1D2JetLCTPThinningTool +print HIGG1D2JetLCTPThinningTool +#thinningTools.append(HIGG1D2JetLCTPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG1D2JetEMTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D2JetEMTPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG1D2JetEMTPThinningTool +print HIGG1D2JetEMTPThinningTool +#thinningTools.append(HIGG1D2JetEMTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG1D2MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( name = "HIGG1D2MuonTPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D2MuonTPThinningTool +print HIGG1D2MuonTPThinningTool +#thinningTools.append(HIGG1D2MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG1D2ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG1D2ElectronTPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D2ElectronTPThinningTool +print HIGG1D2ElectronTPThinningTool +#thinningTools.append(HIGG1D2ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG1D2PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG1D2PhotonTPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D2PhotonTPThinningTool +print HIGG1D2PhotonTPThinningTool +#thinningTools.append(HIGG1D2PhotonTPThinningTool) + +# Tracks themselves +HIGG1D2TPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D2TPThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG1D2TPThinningTool +print HIGG1D2TPThinningTool +#thinningTools.append(HIGG1D2TPThinningTool) + + + +# Truth thinning +truth_cond_1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond_2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond_3 = "((abs(TruthParticles.pdgId) == 6))" # Top quark +truth_cond_4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon +truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)' # stable particles +truth_expression = '('+truth_cond_1+' || '+truth_cond_2 +' || '+truth_cond_3 +' || '+truth_cond_4+') || ('+truth_cond_finalState+')' + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG1D2TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG1D2TruthThinningTool", + ThinningService = "HIGG1D2ThinningSvc", + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG1D2.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG1D2TruthThinningTool + thinningTools.append(HIGG1D2TruthThinningTool) +print "HIGG1D2.py thinningTools", thinningTools + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== + +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG1D2Kernel", + AugmentationTools = [HIGG1D2_EEMassTool,HIGG1D2_MuMuMassTool], + SkimmingTools = [HIGG1D2SkimmingTool], + ThinningTools = thinningTools + ) + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG1D2Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG1D2Stream ) +HIGG1D2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG1D2Stream.AcceptAlgs(["HIGG1D2Kernel"]) + + +# Thinning service name must match the one passed to the thinning tools +from AthenaServices.Configurables import ThinningSvc, createThinningSvc +augStream = MSMgr.GetStream( streamName ) +evtStream = augStream.GetEventStream() +svcMgr += createThinningSvc( svcName="HIGG1D2ThinningSvc", outStreams=[evtStream] ) + + #==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG1D2SlimmingHelper = SlimmingHelper("HIGG1D2SlimmingHelper") + + +HIGG1D2SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4EMTopoJets", + "BTagging_AntiKt4EMTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + +HIGG1D2SlimmingHelper.AllVariables = ["Electrons","Photons","egammaClusters","egammaTopoSeededClusters","GSFConversionVertices","TruthEvents", "TruthParticles", "TruthVertices", "AntiKt4TruthJets","AntiKt4TruthWZJets","PrimaryVertices","MET_Truth", "egammaTruthParticles","CaloCalTopoClusters"] + +HIGG1D2SlimmingHelper.ExtraVariables = ["Muons.quality.EnergyLoss.energyLossType", + "GSFTrackParticles.parameterY.parameterZ.vx.vy", + "InDetTrackParticles.vx.vy", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt", + "CombinedMuonTrackParticles.z0.vz.definingParametersCovMatrix", + "BTagging_AntiKt4EMTopo.MV1_discriminant", + "ExtrapolatedMuonTrackParticles.z0.vz.definingParametersCovMatrix", + "MuonTruthParticles.truthOrigin.truthType"] + +# Add AODCellContainer (have to find how to keep only cells belonging to e/gamma objects) +# Usage of AddItem is forbidden +# HIGG1D2Stream.AddItem("CaloCellContainer#AODCellContainer") + +HIGG1D2SlimmingHelper.IncludeMuonTriggerContent = True +HIGG1D2SlimmingHelper.IncludeEGammaTriggerContent = True + +HIGG1D2SlimmingHelper.AppendContentToStream(HIGG1D2Stream) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py new file mode 100644 index 0000000000000000000000000000000000000000..3a8b457c3d1b225bb667b86da5b8e4de26c5737a --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py @@ -0,0 +1,245 @@ +#==================================================================== +# HIGG2D1.py for 2L filter +# This requires the reductionConf flag HIGG2D1 in Reco_tf.py +#==================================================================== + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * +import AthenaCommon.SystemOfUnits as Units + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG2D1Stream.StreamName +fileName = buildFileName(derivationFlags.WriteDAOD_HIGG2D1Stream) +HIGG2D1Stream = MSMgr.NewPoolRootStream( streamName, fileName) +HIGG2D1Stream.AcceptAlgs(["HIGG2D1Kernel"]) + +#================ +# THINNING +#================ +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG2D1ThinningHelper = ThinningHelper("HIGG2D1ThinningHelper") +#trigger navigation content +HIGG2D1ThinningHelper.TriggerChains = 'HLT_e.*|HLT_2e.*|HLT_3e.*|HLT_mu.*|HLT_2mu.*|HLT_3mu.*' +HIGG2D1ThinningHelper.AppendToStream(HIGG2D1Stream) + +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG2D1TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D1TPThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D1TPThinningTool +thinningTools.append(HIGG2D1TPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG2D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D1JetTPThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D1JetTPThinningTool +thinningTools.append(HIGG2D1JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG2D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG2D1MuonTPThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D1MuonTPThinningTool +thinningTools.append(HIGG2D1MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG2D1ElectronTPThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = False) +ToolSvc += HIGG2D1ElectronTPThinningTool +thinningTools.append(HIGG2D1ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D1PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG2D1PhotonTPThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG2D1PhotonTPThinningTool +thinningTools.append(HIGG2D1PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG2D1TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG2D1TauTPThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D1TauTPThinningTool +thinningTools.append(HIGG2D1TauTPThinningTool) + +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning +HIGG2D1MuonCCThinningTool = DerivationFramework__CaloClusterThinning(name = "HIGG2D1MuonCCThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + SGKey = "Muons", + TopoClCollectionSGKey = "CaloCalTopoClusters", + SelectionString = "Muons.pt>0.*GeV", + ConeSize = 0.6) +ToolSvc += HIGG2D1MuonCCThinningTool +thinningTools.append(HIGG2D1MuonCCThinningTool) + +# Truth particles +useGenericTruthThinning = True +if useGenericTruthThinning: + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + + truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + HIGG2D1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG2D1TruthThinningTool", + ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) +else: + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning + HIGG2D1TruthThinningTool = DerivationFramework__MenuTruthThinning(name = "HIGG2D1TruthThinningTool", + ThinningService = "HIGG2D1ThinningSvc", + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = True, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = True, + WriteBosons = True, + WriteBSMProducts = True, + WriteBosonProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = True, + WriteStatus3 = False, + PreserveGeneratorDescendants = True, + WriteFirstN = -1) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG2D1.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG2D1TruthThinningTool + thinningTools.append(HIGG2D1TruthThinningTool) +print "HIGG2D1.py thinningTools", thinningTools + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + +## Trigger requirement +from AthenaCommon.BeamFlags import jobproperties +print "HIGG2D1.py jobproperties.Beam.energy()", jobproperties.Beam.energy() +# 13 TeV +singleElectronTriggerRequirement=["L1_EM.*"] +diElectronTriggerRequirement=["L1_2EM.*", "L1_3EM.*"] +singleMuonTriggerRequirement=["L1_MU.*"] +diMuonTriggerRequirement=["L1_2MU.*", "L1_3MU.*"] +electronMuonTriggerRequirement=[] +if jobproperties.Beam.energy()==4000000.0: + # 8 TeV + singleElectronTriggerRequirement=["EF_e24vhi_medium1", "EF_e60_medium1"] + diElectronTriggerRequirement=["EF_2e12Tvh_loose1", "EF_2e12Tvh_loose1_L2StarB"] + singleMuonTriggerRequirement=["EF_mu24i_tight", "EF_mu36_tight"] + diMuonTriggerRequirement=["EF_2mu13", "EF_mu18_tight_mu8_EFFS"] + electronMuonTriggerRequirement=["EF_e12Tvh_medium1_mu8", "EF_e24vhi_loose1_mu8"] +triggerRequirement=singleElectronTriggerRequirement+diElectronTriggerRequirement+singleMuonTriggerRequirement+diMuonTriggerRequirement+electronMuonTriggerRequirement +# 8 TeV MC does not have trigger information +SkipTriggerRequirement=((globalflags.DataSource()=='geant4') and (jobproperties.Beam.energy()==4000000.0)) +print "HIGG2D1.py SkipTriggerRequirement", SkipTriggerRequirement +if SkipTriggerRequirement: + triggerRequirement=[] +print "HIGG2D1.py triggerRequirement", triggerRequirement + +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG2 +SkimmingToolHIGG2D1 = DerivationFramework__SkimmingToolHIGG2(name = "SkimmingToolHIGG2D1", + FilterType = "2L", + NumberOfLeptons = 2, + NumberOfElectrons = 0, + NumberOfMuons = 0, + NumberOfJets = 0, + NumberOfPhotons = 0, + ElectronQuality = "any", #"DFCommonElectronsLHVeryLoose", + MuonQuality = "DFCommonGoodMuon", + ElectronEtCut = 5.*Units.GeV, + MuonPtCut = 5.*Units.GeV, + RequireTightLeptons = True, + TightElectronQuality = "DFCommonElectronsLHVeryLoose", + TightMuonQuality = "DFCommonMuonsLoose", + TightElectronEtCut = 15.*Units.GeV, + TightMuonPtCut = 15.*Units.GeV, + InvariantMassCut = 5.*Units.GeV, + Trigger2L = triggerRequirement) +ToolSvc += SkimmingToolHIGG2D1 +print SkimmingToolHIGG2D1 + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== + +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG2D1Kernel", + SkimmingTools = [SkimmingToolHIGG2D1], + ThinningTools = thinningTools) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkHiggs.HIGG2D1ExtraContent import * +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG2D1SlimmingHelper = SlimmingHelper("HIGG2D1SlimmingHelper") + +HIGG2D1SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices"] + +HIGG2D1SlimmingHelper.ExtraVariables = HIGG2D1ExtraContent +HIGG2D1SlimmingHelper.AllVariables = HIGG2D1ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG2D1SlimmingHelper.ExtraVariables += HIGG2D1ExtraContentTruth + HIGG2D1SlimmingHelper.AllVariables += HIGG2D1ExtraContainersTruth + +# Add MET_RefFinalFix +addMETOutputs(HIGG2D1SlimmingHelper,["AntiKt4LCTopo","Track"]) + +HIGG2D1SlimmingHelper.IncludeMuonTriggerContent = True +HIGG2D1SlimmingHelper.IncludeEGammaTriggerContent = True + +HIGG2D1SlimmingHelper.AppendContentToStream(HIGG2D1Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py new file mode 100644 index 0000000000000000000000000000000000000000..8c758f8629b6aa1c09f6090a0940d466ad91a567 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py @@ -0,0 +1,206 @@ +#==================================================================== +# HIGG2D2.py for 4L filter +# This requires the reductionConf flag HIGG2D2 in Reco_tf.py +#==================================================================== + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * +import AthenaCommon.SystemOfUnits as Units + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG2D2Stream.StreamName +fileName = buildFileName(derivationFlags.WriteDAOD_HIGG2D2Stream) +HIGG2D2Stream = MSMgr.NewPoolRootStream( streamName, fileName) +HIGG2D2Stream.AcceptAlgs(["HIGG2D2Kernel"]) + +#================ +# THINNING +#================ +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG2D2ThinningHelper = ThinningHelper("HIGG2D2ThinningHelper") +#trigger navigation content +HIGG2D2ThinningHelper.TriggerChains = 'HLT_e.*|HLT_2e.*|HLT_3e.*|HLT_mu.*|HLT_2mu.*|HLT_3mu.*' +HIGG2D2ThinningHelper.AppendToStream(HIGG2D2Stream) + +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG2D2TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D2TPThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D2TPThinningTool +thinningTools.append(HIGG2D2TPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG2D2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D2JetTPThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D2JetTPThinningTool +thinningTools.append(HIGG2D2JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG2D2MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG2D2MuonTPThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D2MuonTPThinningTool +thinningTools.append(HIGG2D2MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D2ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG2D2ElectronTPThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = False) +ToolSvc += HIGG2D2ElectronTPThinningTool +thinningTools.append(HIGG2D2ElectronTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG2D2TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG2D2TauTPThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D2TauTPThinningTool +thinningTools.append(HIGG2D2TauTPThinningTool) + +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning +HIGG2D2MuonCCThinningTool = DerivationFramework__CaloClusterThinning(name = "HIGG2D2MuonCCThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + SGKey = "Muons", + TopoClCollectionSGKey = "CaloCalTopoClusters", + SelectionString = "Muons.pt>0.*GeV", + ConeSize = 0.6) +ToolSvc += HIGG2D2MuonCCThinningTool +thinningTools.append(HIGG2D2MuonCCThinningTool) + +# Truth particles +useGenericTruthThinning = True +if useGenericTruthThinning: + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + + truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + HIGG2D2TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG2D2TruthThinningTool", + ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) +else: + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning + HIGG2D2TruthThinningTool = DerivationFramework__MenuTruthThinning(name = "HIGG2D2TruthThinningTool", + ThinningService = "HIGG2D2ThinningSvc", + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = True, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = True, + WriteBosons = True, + WriteBSMProducts = True, + WriteBosonProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = True, + WriteStatus3 = False, + PreserveGeneratorDescendants = True, + WriteFirstN = -1) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG2D2.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG2D2TruthThinningTool + thinningTools.append(HIGG2D2TruthThinningTool) +print "HIGG2D2.py thinningTools", thinningTools + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG2 +SkimmingToolHIGG2D2 = DerivationFramework__SkimmingToolHIGG2(name = "SkimmingToolHIGG2D2", + FilterType = "4L", + NumberOfLeptons = 4, + NumberOfElectrons = 0, + NumberOfMuons = 0, + NumberOfJets = 0, + NumberOfPhotons = 0, + ElectronQuality = "any", + PrimaryElectronQuality4L = "DFCommonElectronsLHVeryLoose", + ElectronEtCut = 5.*Units.GeV, + MuonPtCut = 4.*Units.GeV, + JetPtCut = 15.*Units.GeV, + InvariantMassCut = 10.*Units.GeV) +ToolSvc += SkimmingToolHIGG2D2 +print SkimmingToolHIGG2D2 + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== + +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG2D2Kernel", + SkimmingTools = [SkimmingToolHIGG2D2], + ThinningTools = thinningTools) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkHiggs.HIGG2D2ExtraContent import * +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG2D2SlimmingHelper = SlimmingHelper("HIGG2D2SlimmingHelper") + +HIGG2D2SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices"] + +HIGG2D2SlimmingHelper.ExtraVariables = HIGG2D2ExtraContent +HIGG2D2SlimmingHelper.AllVariables = HIGG2D2ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG2D2SlimmingHelper.ExtraVariables += HIGG2D2ExtraContentTruth + HIGG2D2SlimmingHelper.AllVariables += HIGG2D2ExtraContainersTruth + +# Add MET_RefFinalFix +addMETOutputs(HIGG2D2SlimmingHelper,["AntiKt4LCTopo","Track"]) + +HIGG2D2SlimmingHelper.IncludeMuonTriggerContent = True +HIGG2D2SlimmingHelper.IncludeEGammaTriggerContent = True + +HIGG2D2SlimmingHelper.AppendContentToStream(HIGG2D2Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py new file mode 100644 index 0000000000000000000000000000000000000000..ab335f63156159613acf8a9e3063e23383ebe126 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py @@ -0,0 +1,223 @@ +#==================================================================== +# HIGG2D3.py for TP filter +# This requires the reductionConf flag HIGG2D3 in Reco_tf.py +#==================================================================== + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * +import AthenaCommon.SystemOfUnits as Units + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG2D3Stream.StreamName +fileName = buildFileName(derivationFlags.WriteDAOD_HIGG2D3Stream) +HIGG2D3Stream = MSMgr.NewPoolRootStream( streamName, fileName) +HIGG2D3Stream.AcceptAlgs(["HIGG2D3Kernel"]) + +#================ +# THINNING +#================ +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG2D3ThinningHelper = ThinningHelper("HIGG2D3ThinningHelper") +#trigger navigation content +HIGG2D3ThinningHelper.TriggerChains = 'HLT_e.*|HLT_2e.*|HLT_mu.*|HLT_2mu.*' +HIGG2D3ThinningHelper.AppendToStream(HIGG2D3Stream) + +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG2D3TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D3TPThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D3TPThinningTool +thinningTools.append(HIGG2D3TPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG2D3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D3JetTPThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D3JetTPThinningTool +thinningTools.append(HIGG2D3JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG2D3MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG2D3MuonTPThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D3MuonTPThinningTool +thinningTools.append(HIGG2D3MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D3ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG2D3ElectronTPThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = False) +ToolSvc += HIGG2D3ElectronTPThinningTool +thinningTools.append(HIGG2D3ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D3PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG2D3PhotonTPThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG2D3PhotonTPThinningTool +thinningTools.append(HIGG2D3PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG2D3TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG2D3TauTPThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D3TauTPThinningTool +thinningTools.append(HIGG2D3TauTPThinningTool) + +# cluster thinning tools +# from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__CaloClusterThinning +# HIGG2D3ElectronCCThinningTool = DerivationFramework__CaloClusterThinning(name = "HIGG2D3ElectronCCThinningTool", +# ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), +# SGKey = "Electrons", +# CaloClCollectionSGKey = "egammaClusters", +# SelectionString = "Electrons.DFCommonElectronsLHVeryLoose", +# ConeSize = 0.4) +# ToolSvc += HIGG2D3ElectronCCThinningTool +# thinningTools.append(HIGG2D3ElectronCCThinningTool) + +# HIGG2D3PhotonCCThinningTool = DerivationFramework__CaloClusterThinning(name = "HIGG2D3PhotonCCThinningTool", +# ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), +# SGKey = "Photons", +# CaloClCollectionSGKey = "egammaClusters", +# SelectionString = "Photons.pt>0.*GeV", +# ConeSize = 0.4) +# ToolSvc += HIGG2D3PhotonCCThinningTool +# thinningTools.append(HIGG2D3PhotonCCThinningTool) + +# Truth particles +truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6))" # Top quark +truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + +truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG2D3TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG2D3TruthThinningTool", + ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG2D3.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG2D3TruthThinningTool + thinningTools.append(HIGG2D3TruthThinningTool) +print "HIGG2D3.py thinningTools", thinningTools + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + +from AthenaCommon.BeamFlags import jobproperties +print "HIGG2D3.py jobproperties.Beam.energy()", jobproperties.Beam.energy() +# SkipTriggerRequirement=((globalflags.DataSource()=='geant4') and (jobproperties.Beam.energy()==4000000.0)) +SkipTriggerRequirement=True # Temporally disabled (2015-05-28) +# 8 TeV MC does not have trigger information +print "HIGG2D3.py SkipTriggerRequirement", SkipTriggerRequirement +TriggerTP = [] +if not SkipTriggerRequirement: + if jobproperties.Beam.energy()==4000000.0: + # 8 TeV data + TriggerTP = ["EF_e24vhi_medium1", "EF_e60_medium1", "EF_mu24i_tight", "EF_mu36_tight"] + if jobproperties.Beam.energy()==6500000.0: + # 13 TeV + # TriggerTP = ["HLT_e28_tight_iloose", "HLT_e60_medium", "HLT_mu26_imedium", "HLT_mu50"] + # TriggerTP = ["HLT_e24_medium_iloose", "HLT_e24_tight_L1EM20V", "HLT_e28_tight_iloose", "HLT_e60_medium", "HLT_mu24_imedium", "HLT_mu26_imedium", "HLT_mu50"] + TriggerTP = ["HLT_e24_lhmedium_cutd0dphi_iloose_L1EM18VH", "HLT_e24_lhmedium_cutd0dphi_iloose_L1EM20VH", "HLT_e24_lhmedium_iloose_L1EM18VH", "HLT_e24_lhmedium_iloose_L1EM20VH", "HLT_e24_lhmedium_nod0_iloose_L1EM18VH", "HLT_e24_lhmedium_nod0_iloose_L1EM20VH", "HLT_e24_lhmedium_nodeta_iloose_L1EM18VH", "HLT_e24_lhmedium_nodphires_iloose_L1EM18VH", "HLT_e24_medium_iloose_L1EM18VH", "HLT_e24_medium_iloose_L1EM20VH", "HLT_e24_tight_iloose", "HLT_e26_lhtight_cutd0dphideta_iloose", "HLT_e26_lhtight_iloose", "HLT_e26_lhtight_nod0_iloose", "HLT_e26_tight_iloose", "HLT_e60_lhmedium", "HLT_e60_lhmedium_cutd0dphideta", "HLT_e60_lhmedium_nod0", "HLT_e60_medium", "HLT_mu24_imedium", "HLT_mu26_imedium", "HLT_mu50"] +print "HIGG2D3.py TriggerTP", TriggerTP + +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG2 +SkimmingToolHIGG2D3 = DerivationFramework__SkimmingToolHIGG2(name = "SkimmingToolHIGG2D3", + SkipTriggerRequirement = SkipTriggerRequirement, + FilterType = "TP", + NumberOfLeptons = 2, + NumberOfElectrons = 0, + NumberOfMuons = 0, + NumberOfJets = 0, + NumberOfPhotons = 0, + ElectronQuality = "any", + TriggerTP = TriggerTP, + ElectronEtCut = 5.*Units.GeV, + MuonPtCut = 4.*Units.GeV, + LeadingElectronEtCut = 15.*Units.GeV, + LeadingMuonPtCut = 15.*Units.GeV, + InvariantMassCut = 50.*Units.GeV) +ToolSvc += SkimmingToolHIGG2D3 +print SkimmingToolHIGG2D3 + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== + +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG2D3Kernel", + SkimmingTools = [SkimmingToolHIGG2D3], + ThinningTools = thinningTools) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkHiggs.HIGG2D3ExtraContent import * +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG2D3SlimmingHelper = SlimmingHelper("HIGG2D3SlimmingHelper") + +HIGG2D3SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices"] + +HIGG2D3SlimmingHelper.ExtraVariables = HIGG2D3ExtraContent +HIGG2D3SlimmingHelper.AllVariables = HIGG2D3ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG2D3SlimmingHelper.ExtraVariables += HIGG2D3ExtraContentTruth + HIGG2D3SlimmingHelper.AllVariables += HIGG2D3ExtraContainersTruth + +# Add MET_RefFinalFix +addMETOutputs(HIGG2D3SlimmingHelper,["AntiKt4LCTopo","Track"]) + +HIGG2D3SlimmingHelper.IncludeMuonTriggerContent = True +HIGG2D3SlimmingHelper.IncludeEGammaTriggerContent = True + +HIGG2D3SlimmingHelper.AppendContentToStream(HIGG2D3Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py new file mode 100644 index 0000000000000000000000000000000000000000..35029133710d7a3c6b74796b447c64e6263aa704 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py @@ -0,0 +1,329 @@ +#==================================================================== +# HIGG2D4.py for 2L2Q filter +# This requires the reductionConf flag HIGG2D4 in Reco_tf.py +#==================================================================== + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * +import AthenaCommon.SystemOfUnits as Units + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG2D4Stream.StreamName +fileName = buildFileName(derivationFlags.WriteDAOD_HIGG2D4Stream) +HIGG2D4Stream = MSMgr.NewPoolRootStream( streamName, fileName) +HIGG2D4Stream.AcceptAlgs(["HIGG2D4Kernel"]) + +#================ +# THINNING +#================ +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG2D4ThinningHelper = ThinningHelper("HIGG2D4ThinningHelper") +#trigger navigation content +HIGG2D4ThinningHelper.TriggerChains = 'HLT_e.*|HLT_2e.*|HLT_mu.*|HLT_2mu.*' +HIGG2D4ThinningHelper.AppendToStream(HIGG2D4Stream) + +# MET/Jet tracks +# thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +# from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +# HIGG2D4TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D4TPThinningTool", +# ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), +# SelectionString = thinning_expression, +# InDetTrackParticlesKey = "InDetTrackParticles", +# ApplyAnd = True) +# ToolSvc += HIGG2D4TPThinningTool +# thinningTools.append(HIGG2D4TPThinningTool) + + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG2D4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D4JetTPThinningTool", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D4JetTPThinningTool +thinningTools.append(HIGG2D4JetTPThinningTool) + +HIGG2D4JetTPThinningTool2 = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D4JetTPThinningTool2", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D4JetTPThinningTool2 +thinningTools.append(HIGG2D4JetTPThinningTool2) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG2D4MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG2D4MuonTPThinningTool", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D4MuonTPThinningTool +thinningTools.append(HIGG2D4MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D4ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG2D4ElectronTPThinningTool", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = False) +ToolSvc += HIGG2D4ElectronTPThinningTool +thinningTools.append(HIGG2D4ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D4PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG2D4PhotonTPThinningTool", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG2D4PhotonTPThinningTool +thinningTools.append(HIGG2D4PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG2D4TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG2D4TauTPThinningTool", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D4TauTPThinningTool +thinningTools.append(HIGG2D4TauTPThinningTool) + +# Truth particles +useGenericTruthThinning = True +if useGenericTruthThinning: + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6) || (abs(TruthParticles.pdgId) == 5))" # Top or Bottom quark + truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + + truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + HIGG2D4TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG2D4TruthThinningTool", + ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) +else: + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning + HIGG2D4TruthThinningTool = DerivationFramework__MenuTruthThinning(name = "HIGG2D4TruthThinningTool", + ThinningService = "HIGG2D4ThinningSvc", + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = True, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = True, + WriteBosons = True, + WriteBSMProducts = True, + WriteBosonProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = True, + WriteStatus3 = False, + PreserveGeneratorDescendants = True, + WriteFirstN = -1) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG2D4.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG2D4TruthThinningTool + thinningTools.append(HIGG2D4TruthThinningTool) +print "HIGG2D4.py thinningTools", thinningTools + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + +## Trigger requirement +from AthenaCommon.BeamFlags import jobproperties +print "HIGG2D4.py jobproperties.Beam.energy()", jobproperties.Beam.energy() +# 13 TeV +singleElectronTriggerRequirement=["L1_EM.*"] +diElectronTriggerRequirement=["L1_2EM.*"] +singleMuonTriggerRequirement=["L1_MU.*"] +diMuonTriggerRequirement=["L1_2MU.*"] +electronMuonTriggerRequirement=[] +if jobproperties.Beam.energy()==4000000.0: + # 8 TeV + singleElectronTriggerRequirement=["EF_e24vhi_medium1", "EF_e60_medium1"] + diElectronTriggerRequirement=["EF_2e12Tvh_loose1", "EF_2e12Tvh_loose1_L2StarB"] + singleMuonTriggerRequirement=["EF_mu24i_tight", "EF_mu36_tight"] + diMuonTriggerRequirement=["EF_2mu13", "EF_mu18_tight_mu8_EFFS"] + electronMuonTriggerRequirement=["EF_e12Tvh_medium1_mu8", "EF_e24vhi_loose1_mu8"] +triggerRequirement=singleElectronTriggerRequirement+diElectronTriggerRequirement+singleMuonTriggerRequirement+diMuonTriggerRequirement+electronMuonTriggerRequirement +# 8 TeV MC does not have trigger information +SkipTriggerRequirement=((globalflags.DataSource()=='geant4') and (jobproperties.Beam.energy()==4000000.0)) +print "HIGG2D4.py SkipTriggerRequirement", SkipTriggerRequirement +if SkipTriggerRequirement: + triggerRequirement=[] +print "HIGG2D4.py triggerRequirement", triggerRequirement + +# Pre-selection for di-leptons +electronPtRequirement='(Electrons.pt>6.*GeV)' +electronRequirement='('+electronPtRequirement+')' +#electronQualityRequirement='(Electrons.DFCommonElectronsLHVeryLoose)' +#electronRequirement='('+electronQualityRequirement+'&&'+electronPtRequirement+')' +combinedMuonQualityRequirement='(Muons.muonType==0)' +standaloneMuonQualityRequirement='(Muons.muonType==1 && abs(abs(Muons.eta)-2.6)<0.12)' +segmentTaggedMuonQualityRequirement='(Muons.muonType==2)' +calorimeterTaggedMuonQualityRequirement='(Muons.muonType==3 && abs(Muons.eta)<0.2)' +muonQualityRequirement='('+combinedMuonQualityRequirement+'||'+standaloneMuonQualityRequirement+'||'+segmentTaggedMuonQualityRequirement+'||'+calorimeterTaggedMuonQualityRequirement+')' +muonPtRequirement='(Muons.pt>6.*GeV)' +muonRequirement='('+muonQualityRequirement+'&&'+muonPtRequirement+')' +leptonRequirement='(count('+electronRequirement+')+count('+muonRequirement+')>= 2)' +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +SkimmingToolHIGG2D4_preLep = DerivationFramework__xAODStringSkimmingTool(name = "SkimmingToolHIGG2D4_preLep", + expression = leptonRequirement) +ToolSvc += SkimmingToolHIGG2D4_preLep + +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG2 +SkimmingToolHIGG2D4 = DerivationFramework__SkimmingToolHIGG2(name = "SkimmingToolHIGG2D4", + FilterType = "2L2Q", + NumberOfLeptons = 2, + NumberOfElectrons = 0, + NumberOfMuons = 0, + JetContainerKey = "AntiKt4EMTopoJets", + NumberOfJets = 1, + JetPtCut = 15.*Units.GeV, + JetEtaCut = 2.6, + MergedJetContainerKey0 = "AntiKt4EMTopoJets", + NumberOfMergedJets0 = 1, + MergedJetPtCut0 = 100.*Units.GeV, + MergedJetEtaCut0 = 2.6, + MergedJetContainerKey1 = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",#"AntiKt10LCTopoJets", + NumberOfMergedJets1 = 1, + MergedJetPtCut1 = 100.*Units.GeV, + MergedJetEtaCut1 = 2.6, + MergedJetContainerKey2 = "CamKt12LCTopoBDRSFilteredMU100Y15Jets",#"CamKt12LCTopoJets", + NumberOfMergedJets2 = 1, + MergedJetPtCut2 = 100.*Units.GeV, + MergedJetEtaCut2 = 2.6, + NumberOfPhotons = 0, + ElectronQuality = "DFCommonElectronsLHVeryLoose", + ElectronEtCut = 6.*Units.GeV, + MuonQuality = "DFCommonMuonsLoose", + MuonPtCut = 6.*Units.GeV, + RequireTightLeptons = False, + InvariantMassCut = 5.*Units.GeV, + DRElectronJetCut = -1., + Trigger2L2Q = triggerRequirement) +ToolSvc += SkimmingToolHIGG2D4 +print SkimmingToolHIGG2D4 + + +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +higg2d4Seq = CfgMgr.AthSequencer("HIGG2D4Sequence") + +# Then apply the TruthWZ fix +if globalflags.DataSource()=='geant4': + replaceBuggyAntiKt4TruthWZJets(higg2d4Seq,'HIGG2D4') + replaceBuggyAntiKt10TruthWZJets(higg2d4Seq,'HIGG2D4') + + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +higg2d4Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG2D4Kernel_preLep", + SkimmingTools = [SkimmingToolHIGG2D4_preLep] + ) + +#==================================================================== +# Special jets +#==================================================================== +# from JetRec.JetRecStandard import jtm +# from JetRec.JetRecConf import JetAlgorithm + +if not "HIGG2D4Jets" in OutputJets: + OutputJets["HIGG2D4Jets"] = ["AntiKt3PV0TrackJets","AntiKt2PV0TrackJets","AntiKt10LCTopoJets","CamKt12LCTopoJets"] + + if jetFlags.useTruth: + # addPrunedJets("CamKt", 1.0, "Truth", rcut=0.5, zcut=0.15, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + # addFilteredJets("CamKt", 1.2, "Truth", mumax=1.0, ymin=0.15, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + # addTrimmedJets("AntiKt", 1.0, "Truth", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + # addTrimmedJets("AntiKt", 1.0, "Truth", rclus=0.3, ptfrac=0.05, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + OutputJets["HIGG2D4Jets"].append("AntiKt4TruthJets") + OutputJets["HIGG2D4Jets"].append("AntiKt4TruthWZJets") + # OutputJets["HIGG2D4Jets"].append("AntiKt10TruthWZJets") + # OutputJets["HIGG2D4Jets"].append("AntiKt10TruthJets") + #OutputJets["HIGG2D4Jets"].append("CamKt12TruthJets") + addTrimmedJets("AntiKt", 1.0, "TruthWZ", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + + # CamKtLCTopo 10 and 12 + # addPrunedJets("CamKt", 1.0, "LCTopo", rcut=0.5, zcut=0.15, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + addFilteredJets("CamKt", 1.2, "LCTopo", mumax=1.0, ymin=0.15, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + # AntiKt10LCTopo trimmed rclus 0.2 and 0.3 + addTrimmedJets("AntiKt", 1.0, "LCTopo", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + # addTrimmedJets("AntiKt", 1.0, "LCTopo", rclus=0.3, ptfrac=0.05, includePreTools=False, algseq=higg2d4Seq,outputGroup="HIGG2D4Jets") + +# Jet calibration should come after fat jets +applyJetCalibration_xAODColl(jetalg="AntiKt4EMTopo", sequence=higg2d4Seq) + + +# Main selection +higg2d4Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG2D4Kernel", + SkimmingTools = [SkimmingToolHIGG2D4], + ThinningTools = thinningTools + ) + +DerivationFrameworkJob += higg2d4Seq + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkHiggs.HIGG2D4ExtraContent import * +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG2D4SlimmingHelper = SlimmingHelper("HIGG2D4SlimmingHelper") + +HIGG2D4SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices"] + +HIGG2D4SlimmingHelper.ExtraVariables = HIGG2D4ExtraContent +HIGG2D4SlimmingHelper.AllVariables = HIGG2D4ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG2D4SlimmingHelper.ExtraVariables += HIGG2D4ExtraContentTruth + HIGG2D4SlimmingHelper.AllVariables += HIGG2D4ExtraContainersTruth + +# Add the jet containers to the stream +addJetOutputs(HIGG2D4SlimmingHelper,["HIGG2D4Jets"]) +# Add MET_RefFinalFix +addMETOutputs(HIGG2D4SlimmingHelper,["AntiKt4LCTopo","Track"]) + +HIGG2D4SlimmingHelper.IncludeMuonTriggerContent = True +HIGG2D4SlimmingHelper.IncludeEGammaTriggerContent = True + +HIGG2D4SlimmingHelper.AppendContentToStream(HIGG2D4Stream) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py new file mode 100644 index 0000000000000000000000000000000000000000..5698e068a360eb40967f50beceedc9b30cce7a5c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py @@ -0,0 +1,401 @@ +#==================================================================== +# HIGG2D5.py for JPSI filter +# This requires the reductionConf flag HIGG2D5 in Reco_tf.py +#==================================================================== + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * +import AthenaCommon.SystemOfUnits as Units + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG2D5Stream.StreamName +fileName = buildFileName(derivationFlags.WriteDAOD_HIGG2D5Stream) +HIGG2D5Stream = MSMgr.NewPoolRootStream( streamName, fileName) +HIGG2D5Stream.AcceptAlgs(["HIGG2D5Kernel"]) + +#==================================================================== +# AUGMENTATION TOOLS +# Copied from PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/share/BPHY1.py +#==================================================================== +## 1/ setup vertexing tools and services +include("JpsiUpsilonTools/configureServices.py") + +#-------------------------------------------------------------------- +## 2/ Setup the vertex fitter tools (e.g. JpsiFinder, JpsiPlus1Track, etc). +## These are general tools independent of DerivationFramework that do the +## actual vertex fitting and some pre-selection. +from JpsiUpsilonTools.JpsiUpsilonToolsConf import Analysis__JpsiFinder +HIGG2D5JpsiFinder = Analysis__JpsiFinder( + name = "HIGG2D5JpsiFinder", + OutputLevel = INFO, + muAndMu = True, + muAndTrack = False, + TrackAndTrack = False, + assumeDiMuons = True, # If true, will assume dimu hypothesis and use PDG value for mu mass + invMassUpper = 100.0*Units.GeV, + invMassLower = 0.0*Units.GeV, + Chi2Cut = 200., + oppChargesOnly = True, + atLeastOneComb = True, + useCombinedMeasurement = False, # Only takes effect if combOnly=True + muonCollectionKey = "Muons", + TrackParticleCollection = "InDetTrackParticles", + V0VertexFitterTool = TrkV0Fitter, # V0 vertex fitter + useV0Fitter = False, # if False a TrkVertexFitterTool will be used + TrkVertexFitterTool = TrkVKalVrtFitter, # VKalVrt vertex fitter + TrackSelectorTool = InDetTrackSelectorTool, + ConversionFinderHelperTool = InDetConversionHelper, + VertexPointEstimator = VtxPointEstimator, + useMCPCuts = False) +ToolSvc += HIGG2D5JpsiFinder + +# For phi -> K+ K- +HIGG2D5PhiFinder = Analysis__JpsiFinder( + name = "HIGG2D5PhiFinder", + OutputLevel = INFO, + muAndMu = False, + muAndTrack = False, + TrackAndTrack = True, + assumeDiMuons = False, # If true, will assume dimu hypothesis and use PDG value for mu mass + invMassUpper = 1.2*Units.GeV, + invMassLower = 2.*0.493677*Units.GeV, + Chi2Cut = 200., + oppChargesOnly = True, + atLeastOneComb = False, + useCombinedMeasurement = False, + track1Mass = 0.493677*Units.GeV, # charge kaon PDG mass + track2Mass = 0.493677*Units.GeV, # charge kaon PDG mass + trackThresholdPt = 5.*Units.GeV, # 5 GeV pT cut for initial implementation + muonCollectionKey = "Muons", + TrackParticleCollection = "InDetTrackParticles", + V0VertexFitterTool = TrkV0Fitter, # V0 vertex fitter + useV0Fitter = False, # if False a TrkVertexFitterTool will be used + TrkVertexFitterTool = TrkVKalVrtFitter, # VKalVrt vertex fitter + TrackSelectorTool = InDetTrackSelectorTool, + ConversionFinderHelperTool = InDetConversionHelper, + VertexPointEstimator = VtxPointEstimator, + useMCPCuts = False) +ToolSvc += HIGG2D5PhiFinder + +#-------------------------------------------------------------------- +## 3/ setup the vertex reconstruction "call" tool(s). They are part of the derivation framework. +## These Augmentation tools add output vertex collection(s) into the StoreGate and add basic +## decorations which do not depend on the vertex mass hypothesis (e.g. lxy, ptError, etc). +## There should be one tool per topology, i.e. Jpsi and Psi(2S) do not need two instance of the +## Reco tool is the JpsiFinder mass window is wide enough. +HIGG2D5RefitPV = False +from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Reco_mumu +HIGG2D5Recomumu = DerivationFramework__Reco_mumu( + name = "HIGG2D5Recomumu", + JpsiFinder = HIGG2D5JpsiFinder, + OutputVtxContainerName = "HIGG2D5OniaCandidates", + PVContainerName = "PrimaryVertices", + RefPVContainerName = "HIGG2D5OniaRefittedPrimaryVertices", + RefitPV = HIGG2D5RefitPV) +ToolSvc += HIGG2D5Recomumu + +HIGG2D5Recotrktrk = DerivationFramework__Reco_mumu( + name = "HIGG2D5Recotrktrk", + JpsiFinder = HIGG2D5PhiFinder, + OutputVtxContainerName = "HIGG2D5PhiCandidates", + PVContainerName = "PrimaryVertices", + RefPVContainerName = "HIGG2D5PhiRefittedPrimaryVertices", + RefitPV = HIGG2D5RefitPV) +ToolSvc += HIGG2D5Recotrktrk + +#-------------------------------------------------------------------- +## 4/ setup the vertex selection and augmentation tool(s). These tools decorate the vertices with +## variables that depend on the vertex mass hypothesis, e.g. invariant mass, proper decay time, etc. +## Property HypothesisName is used as a prefix for these decorations. +## They also perform tighter selection, flagging the vertecis that passed. The flag is a Char_t branch +## named "passed_"+HypothesisName. It is used later by the "SelectEvent" and "Thin_vtxTrk" tools +## to determine which events and candidates should be kept in the output stream. +## Multiple instances of the Select_* tools can be used on a single input collection as long as they +## use different "HypothesisName" flags. +from DerivationFrameworkBPhys.DerivationFrameworkBPhysConf import DerivationFramework__Select_onia2mumu +## a/ augment and select Jpsi->mumu candidates +HIGG2D5SelectJpsi2mumu = DerivationFramework__Select_onia2mumu( + name = "HIGG2D5SelectJpsi2mumu", + HypothesisName = "Jpsi", + InputVtxContainerName = HIGG2D5Recomumu.OutputVtxContainerName, + VtxMassHypo = 3.096916*Units.GeV, + MassMin = 2.0*Units.GeV, + MassMax = 3.6*Units.GeV, + Chi2Max = 200) +ToolSvc += HIGG2D5SelectJpsi2mumu +## b/ augment and select Psi(2S)->mumu candidates +HIGG2D5SelectPsi2mumu = DerivationFramework__Select_onia2mumu( + name = "HIGG2D5SelectPsi2mumu", + HypothesisName = "Psi", + InputVtxContainerName = HIGG2D5Recomumu.OutputVtxContainerName, + VtxMassHypo = 3.68609*Units.GeV, + MassMin = 3.3*Units.GeV, + MassMax = 4.3*Units.GeV, + Chi2Max = 200) +ToolSvc += HIGG2D5SelectPsi2mumu +## c/ augment and select Upsilon(nS)->mumu candidates +HIGG2D5SelectUpsi2mumu = DerivationFramework__Select_onia2mumu( + name = "HIGG2D5SelectUpsi2mumu", + HypothesisName = "Upsi", + InputVtxContainerName = HIGG2D5Recomumu.OutputVtxContainerName, + VtxMassHypo = 9.46030*Units.GeV, + MassMin = 8.0*Units.GeV, + MassMax = 12.0*Units.GeV, + Chi2Max = 200) +ToolSvc += HIGG2D5SelectUpsi2mumu +## d/ augment and select phi->KK candidates +HIGG2D5SelectPhi2trktrk = DerivationFramework__Select_onia2mumu( + name = "HIGG2D5SelectPhi2trktrk", + HypothesisName = "Phi", + InputVtxContainerName = HIGG2D5Recotrktrk.OutputVtxContainerName, + TrkMasses = [0.493677*Units.GeV, 0.493677*Units.GeV], # charge kaon PDG mass + VtxMassHypo = 1.019461*Units.GeV, # phi meson PDG mass + MassMin = 2.*0.493677*Units.GeV, + MassMax = 1.2*Units.GeV, + Chi2Max = 200) +ToolSvc += HIGG2D5SelectPhi2trktrk + +## Keep output containers +HIGG2D5StaticContent = [] +if HIGG2D5RefitPV: + HIGG2D5StaticContent += ["xAOD::VertexContainer#%s" % HIGG2D5Recomumu.RefPVContainerName] + HIGG2D5StaticContent += ["xAOD::VertexAuxContainer#%sAux." % HIGG2D5Recomumu.RefPVContainerName] + HIGG2D5StaticContent += ["xAOD::VertexContainer#%s" % HIGG2D5Recotrktrk.RefPVContainerName] + HIGG2D5StaticContent += ["xAOD::VertexAuxContainer#%sAux." % HIGG2D5Recotrktrk.RefPVContainerName] +## J/psi, psi(2S), Upsilon candidates +HIGG2D5StaticContent += ["xAOD::VertexContainer#%s" % HIGG2D5Recomumu.OutputVtxContainerName] +HIGG2D5StaticContent += ["xAOD::VertexAuxContainer#%sAux." % HIGG2D5Recomumu.OutputVtxContainerName] +## we have to disable vxTrackAtVertex branch since it is not xAOD compatible +HIGG2D5StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % HIGG2D5Recomumu.OutputVtxContainerName] +## Phi candidates +HIGG2D5StaticContent += ["xAOD::VertexContainer#%s" % HIGG2D5Recotrktrk.OutputVtxContainerName] +HIGG2D5StaticContent += ["xAOD::VertexAuxContainer#%sAux." % HIGG2D5Recotrktrk.OutputVtxContainerName] +# ## we have to disable vxTrackAtVertex branch since it is not xAOD compatible +HIGG2D5StaticContent += ["xAOD::VertexAuxContainer#%sAux.-vxTrackAtVertex" % HIGG2D5Recotrktrk.OutputVtxContainerName] + +#================ +# THINNING +#================ +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG2D5ThinningHelper = ThinningHelper("HIGG2D5ThinningHelper") +#trigger navigation content +HIGG2D5ThinningHelper.TriggerChains = 'HLT_e.*|HLT_2e.*|HLT_mu.*|HLT_2mu.*' +HIGG2D5ThinningHelper.AppendToStream(HIGG2D5Stream) + +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG2D5TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D5TPThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D5TPThinningTool +thinningTools.append(HIGG2D5TPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG2D5JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D5JetTPThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4LCTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG2D5JetTPThinningTool +thinningTools.append(HIGG2D5JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG2D5MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG2D5MuonTPThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D5MuonTPThinningTool +thinningTools.append(HIGG2D5MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D5ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG2D5ElectronTPThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = False) +ToolSvc += HIGG2D5ElectronTPThinningTool +thinningTools.append(HIGG2D5ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG2D5PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG2D5PhotonTPThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG2D5PhotonTPThinningTool +thinningTools.append(HIGG2D5PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG2D5TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG2D5TauTPThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG2D5TauTPThinningTool +thinningTools.append(HIGG2D5TauTPThinningTool) + +# Truth particles +useGenericTruthThinning = True +if useGenericTruthThinning: + truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs + truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons + truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6))" # Top quark + truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon + + truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' + + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning + HIGG2D5TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG2D5TruthThinningTool", + ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) +else: + from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning + HIGG2D5TruthThinningTool = DerivationFramework__MenuTruthThinning(name = "HIGG2D5TruthThinningTool", + ThinningService = "HIGG2D5ThinningSvc", + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = True, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = True, + WriteBosons = True, + WriteBSMProducts = True, + WriteBosonProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = True, + WriteStatus3 = False, + PreserveGeneratorDescendants = True, + WriteFirstN = -1) + +from AthenaCommon.GlobalFlags import globalflags +print "HIGG2D5.py globalflags.DataSource()", globalflags.DataSource() + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG2D5TruthThinningTool + thinningTools.append(HIGG2D5TruthThinningTool) +print "HIGG2D5.py thinningTools", thinningTools + +#==================================================================== +# SKIMMING TOOLS +#==================================================================== + +from AthenaCommon.BeamFlags import jobproperties +print "HIGG2D5.py jobproperties.Beam.energy()", jobproperties.Beam.energy() +# SkipTriggerRequirement=((globalflags.DataSource()=='geant4') and (jobproperties.Beam.energy()==4000000.0)) +SkipTriggerRequirement=True # Temporally disabled (2015-05-28) +# 8 TeV MC does not have trigger information +print "HIGG2D5.py SkipTriggerRequirement", SkipTriggerRequirement +TriggerJPSI = [] +TriggerPHI = [] # No menu yet -> No trigger requirement +if not SkipTriggerRequirement: + TriggerJPSI = ["HLT_mu24_imedium", "HLT_mu26_imedium", "HLT_mu50", "HLT_2mu10", "HLT_2mu14", "HLT_mu24_mu8noL1"] + if jobproperties.Beam.energy()==4000000.0: + # 8 TeV data + TriggerJPSI = ["EF_mu24i_tight", "EF_mu36_tight", "EF_2mu13", "EF_mu18_tight_mu8_EFFS", "EF_mu18_tight_Jpsi_EFFS"] + if jobproperties.Beam.energy()==6500000.0: + # 13 TeV MC + # TriggerJPSI = ["HLT_mu26_imedium", "HLT_mu50", "HLT_2mu14", "HLT_mu24_mu8noL1"] + TriggerJPSI = ["HLT_mu24_imedium", "HLT_mu26_imedium", "HLT_mu50", "HLT_2mu10", "HLT_2mu14", "HLT_mu24_mu8noL1"] +print "HIGG2D5.py TriggerJPSI", TriggerJPSI + +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG2 +SkimmingToolHIGG2D5 = DerivationFramework__SkimmingToolHIGG2(name = "SkimmingToolHIGG2D5", + SkipTriggerRequirement = SkipTriggerRequirement, + FilterType = "JPSI", + NumberOfLeptons = 0, + NumberOfElectrons = 0, + NumberOfMuons = 2, + NumberOfJets = 0, + NumberOfPhotons = 1, + NumberOfTracks = 2, + MuonQuality = "inMS", + TriggerJPSI = TriggerJPSI, + TriggerPHI = TriggerPHI, + MuonPtCut = 2.5*Units.GeV, + PhotonPtCut = 15.0*Units.GeV, + LeadingMuonPtCut = 15.0*Units.GeV, + TrackPtCut = 20.0*Units.GeV, + InvariantMassJpsiLowCut = 2.0*Units.GeV, + InvariantMassJpsiUpCut = 4.3*Units.GeV, + InvariantMassUpsilonLowCut = 8.0*Units.GeV, + InvariantMassUpsilonUpCut = 12.0*Units.GeV, + InvariantMassPhiLowCut = 2.*0.493677*Units.GeV, + InvariantMassPhiUpCut = 1.2*Units.GeV) +ToolSvc += SkimmingToolHIGG2D5 +print SkimmingToolHIGG2D5 + +#==================================================================== +# CREATE THE DERIVATION KERNEL ALGORITHM AND PASS THE ABOVE TOOLS +#==================================================================== + +# The name of the kernel (LooseSkimKernel in this case) must be unique to this derivation +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG2D5Kernel", + SkimmingTools = [SkimmingToolHIGG2D5], + ThinningTools = thinningTools, + AugmentationTools = [HIGG2D5Recomumu, HIGG2D5SelectJpsi2mumu, + HIGG2D5SelectPsi2mumu, HIGG2D5SelectUpsi2mumu, + HIGG2D5Recotrktrk, HIGG2D5SelectPhi2trktrk + ]) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkHiggs.HIGG2D5ExtraContent import * +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG2D5SlimmingHelper = SlimmingHelper("HIGG2D5SlimmingHelper") + +HIGG2D5SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices"] + +HIGG2D5SlimmingHelper.ExtraVariables = HIGG2D5ExtraContent +HIGG2D5SlimmingHelper.AllVariables = HIGG2D5ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG2D5SlimmingHelper.ExtraVariables += HIGG2D5ExtraContentTruth + HIGG2D5SlimmingHelper.AllVariables += HIGG2D5ExtraContainersTruth + +# For J/psi vertex augmentation +HIGG2D5SlimmingHelper.StaticContent = HIGG2D5StaticContent + +# Add MET_RefFinalFix +addMETOutputs(HIGG2D5SlimmingHelper,["AntiKt4LCTopo","Track"]) + +HIGG2D5SlimmingHelper.IncludeMuonTriggerContent = True +HIGG2D5SlimmingHelper.IncludeBPhysTriggerContent = True + +HIGG2D5SlimmingHelper.AppendContentToStream(HIGG2D5Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py new file mode 100644 index 0000000000000000000000000000000000000000..99e0fd9ca59283a5ac81e02c245aa86cdf25d06e --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py @@ -0,0 +1,166 @@ +#******************************************************************** +# HIGG3D1.py +# reductionConf flag HIGG3D1 in Reco_tf.py +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +from DerivationFrameworkCore.WeightMetadata import * + +from AthenaCommon.GlobalFlags import globalflags + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG3D1Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG3D1Stream ) +HIGG3D1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG3D1Stream.AcceptAlgs(["HIGG3D1Kernel"]) + +## Prepare thinning service and add trigger chains for TrigNavigation thinning +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG3D1ThinningHelper = ThinningHelper( "HIGG3D1ThinningHelper" ) +HIGG3D1ThinningHelper.TriggerChains = "HLT_mu.* | HLT_e.* | HLT_2e.* | HLT_2mu.*" +HIGG3D1ThinningHelper.AppendToStream( HIGG3D1Stream ) + +#================ +# THINNING +#================ +thinningTools=[] + +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG3D1MetTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG3D1MetTPThinningTool", + ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG3D1MetTPThinningTool +thinningTools.append(HIGG3D1MetTPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG3D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG3D1JetTPThinningTool", + ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG3D1JetTPThinningTool +thinningTools.append(HIGG3D1JetTPThinningTool) + + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG3D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG3D1MuonTPThinningTool", + ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG3D1MuonTPThinningTool +thinningTools.append(HIGG3D1MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG3D1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG3D1ElectronTPThinningTool", + ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG3D1ElectronTPThinningTool +thinningTools.append(HIGG3D1ElectronTPThinningTool) + +# Tracks themselves +HIGG3D1TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG3D1TPThinningTool", + ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG3D1TPThinningTool +thinningTools.append(HIGG3D1TPThinningTool) + +# Truth particles +truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond3 = "(abs(TruthParticles.pdgId) == 6)" # Top quark +truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))" # Photon + +truth_expression = truth_cond1+' || '+truth_cond2 +' || '+truth_cond3 +' || '+truth_cond4 + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG3D1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG3D1TruthThinningTool", + ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = True, + PreserveAncestors = True, + SimBarcodeOffset = DerivationFrameworkSimBarcodeOffset) + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG3D1TruthThinningTool + thinningTools.append(HIGG3D1TruthThinningTool) + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +electronIDRequirements = '(Electrons.DFCommonElectronsLHLoose)' +electronRequirements = '(Electrons.pt > 7*GeV) && (abs(Electrons.eta) < 2.6)' +leadElectron = electronRequirements + ' && (Electrons.pt > 17*GeV)' +muonsRequirements = '(Muons.pt > 7*GeV) && (Muons.DFCommonGoodMuon)' +leadMuon = muonsRequirements + ' && (Muons.pt > 17*GeV)' + +eeSelection = '((count('+electronRequirements+') >= 2) && (count('+leadElectron+') >= 1) && (count('+electronRequirements+' && '+electronIDRequirements+') >= 1))' +mmSelection = '((count('+muonsRequirements+') >= 2) && (count('+leadMuon+') >= 1))' +emSelection = '(((count('+electronRequirements+') >= 1) && (count('+muonsRequirements+') >= 1)) && ((count('+leadElectron+') >= 1) || (count('+leadMuon+') >= 1)))' +expression = eeSelection+' || '+mmSelection+' || '+emSelection + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG3D1SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG3D1SkimmingTool1", + expression = expression) +ToolSvc += HIGG3D1SkimmingTool + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG3D1Kernel", + SkimmingTools = [HIGG3D1SkimmingTool], + ThinningTools = thinningTools + ) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG3D1SlimmingHelper = SlimmingHelper("HIGG3D1SlimmingHelper") +from DerivationFrameworkHiggs.HIGG3D1ExtraContent import * + +HIGG3D1SlimmingHelper.SmartCollections = [ "Electrons", + "Muons", + "Photons", + "MET_Reference_AntiKt4LCTopo", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4LCTopo", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4Track", + "BTagging_AntiKt2Track", + "InDetTrackParticles", + "PrimaryVertices" ] + +HIGG3D1SlimmingHelper.ExtraVariables = HIGG3D1ExtraVariables +HIGG3D1SlimmingHelper.AllVariables = HIGG3D1ExtraContainers + +if globalflags.DataSource()=='geant4': + HIGG3D1SlimmingHelper.AllVariables += HIGG3D1ExtraTruthContainers + HIGG3D1SlimmingHelper.ExtraVariables += HIGG3D1ExtraTruthVariables + +# Add Trigger content +HIGG3D1SlimmingHelper.IncludeMuonTriggerContent = True +HIGG3D1SlimmingHelper.IncludeEGammaTriggerContent = True + +# Add MET to output stream +#addMETOutputs(HIGG3D1SlimmingHelper) + +HIGG3D1SlimmingHelper.AppendContentToStream(HIGG3D1Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D2.py new file mode 100644 index 0000000000000000000000000000000000000000..ad48aa1a488233bd0321ebe6a72fe6ea90425818 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D2.py @@ -0,0 +1,75 @@ +#******************************************************************** +# HIGG3D2.py +# reductionConf flag HIGG3D2 in Reco_tf.py +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +#from DerivationFrameworkInDet.InDetCommon import * +#from DerivationFrameworkJetEtMiss.JetCommon import * +#from DerivationFrameworkJetEtMiss.METCommon import * +#from DerivationFrameworkEGamma.EGammaCommon import * +#from DerivationFrameworkMuons.MuonsCommon import * +from AthenaCommon.GlobalFlags import globalflags + +#================ +# THINNING +#================ +thinningTools=[] + +# Truth particles +truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond2 = "((abs(TruthParticles.pdgId) == 11) && (TruthParticles.status == 1) && (TruthParticles.pt > 10*GeV))" # Electron +truth_cond3 = "((abs(TruthParticles.pdgId) >= 1) && (abs(TruthParticles.pdgId) <= 6))" # Partons +truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))" # Photon + +truth_expression = truth_cond1+' || '+truth_cond2 +' || '+truth_cond3 +' || '+truth_cond4 + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG3D2TruthParticlesThinningTool = DerivationFramework__GenericTruthThinning( name = "HIGG3D2TruthParticlesThinningTool", + ThinningService = "HIGG3D2ThinningSvc", + ParticlesKey = "TruthParticles", + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveAncestors = False + ) + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG3D2TruthParticlesThinningTool + thinningTools.append(HIGG3D2TruthParticlesThinningTool) + + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel( "HIGG3D2Kernel", + ThinningTools = thinningTools + ) + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG3D2Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG3D2Stream ) +HIGG3D2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG3D2Stream.AcceptAlgs(["HIGG3D2Kernel"]) +# Special lines for thinning +# Thinning service name must match the one passed to the thinning tools +from AthenaServices.Configurables import ThinningSvc, createThinningSvc +augStream = MSMgr.GetStream( streamName ) +evtStream = augStream.GetEventStream() +svcMgr += createThinningSvc( svcName="HIGG3D2ThinningSvc", outStreams=[evtStream] ) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG3D2SlimmingHelper = SlimmingHelper("HIGG3D2SlimmingHelper") +from DerivationFrameworkHiggs.HIGG3D2ExtraContent import * + +HIGG3D2SlimmingHelper.ExtraVariables = HIGG3D2ExtraVariables + +if globalflags.DataSource()=='geant4': + HIGG3D2SlimmingHelper.AllVariables = HIGG3D2ExtraTruthContainers + +HIGG3D2SlimmingHelper.AppendContentToStream(HIGG3D2Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py new file mode 100644 index 0000000000000000000000000000000000000000..16fcbe6bc3324d543a258e4428f1cebd80ad7b58 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py @@ -0,0 +1,228 @@ +#******************************************************************** +# HIGG3D3.py +# reductionConf flag HIGG3D3 in Reco_tf.py +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from AthenaCommon.GlobalFlags import globalflags + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG3D3Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG3D3Stream ) +HIGG3D3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG3D3Stream.AcceptAlgs(["HIGG3D3Kernel"]) + +## Prepare thinning service and add trigger chains for TrigNavigation thinning +TriggerChains = ["HLT_mu24_L1MU15", + "HLT_g10_etcut", + "HLT_g10_loose", + "HLT_g15_loose_L1EM7", + "HLT_g20_loose_L1EM12", + "HLT_g20_loose_L1EM15", + "HLT_g20_etcut_L1EM12", + "HLT_e17_lhloose_L1EM15", + "HLT_e17_loose_L1EM15", + "HLT_g25_loose_L1EM15", + "HLT_g35_loose_L1EM15", + "HLT_g40_loose_L1EM15", + "HLT_g45_loose_L1EM15", + "HLT_g50_loose_L1EM15", + "HLT_e60_medium", + "HLT_e60_lhmedium", + "HLT_g35_loose_L1EM15_g25_loose_L1EM15", + "HLT_e24_lhmedium_L1EM18VH", + "HLT_e24_lhmedium_L1EM20VH", + "HLT_e20_lhmedium_g35_loose", + "HLT_2e12_loose_L12EM10VH", + "HLT_2e12_lhloose_L12EM10VH", + "HLT_2e15_vloose_L12EM13VH", + "HLT_2g20_loose_g15_loose", + "HLT_mu4", + "HLT_mu6", + "HLT_mu10", + "HLT_mu14", + "HLT_mu18", + "HLT_mu20_L1MU15", + "HLT_mu24", + "HLT_mu40", + "HLT_mu20_iloose_L1MU15", + "HLT_e5_etcut", + "HLT_e10_etcut_L1EM7", + "HLT_e13_etcut_trkcut_L1EM10", + "HLT_e15_etcut_L1EM7", + "HLT_e18_etcut_trkcut_L1EM15", + "HLT_e20_etcut_L1EM12", + "HLT_e25_etcut_L1EM15", + "HLT_e30_etcut_L1EM15", + "HLT_e40_etcut_L1EM15", + "HLT_e50_etcut_L1EM15", + "HLT_e60_etcut", + "HLT_e5_lhvloose", + "HLT_e5_lhvloose_nod0", + "HLT_e10_lhvloose_L1EM7", + "HLT_e12_lhvloose_L1EM10VH", + "HLT_e12_lhvloose_nod0_L1EM10VH", + "HLT_e15_lhvloose_L1EM7", + "HLT_e15_lhvloose_L1EM13VH", + "HLT_e15_lhvloose_nod0_L1EM13VH", + "HLT_e17_lhvloose", + "HLT_e17_lhvloose_nod0", + "HLT_e20_lhvloose_L1EM12", + "HLT_e20_lhvloose", + "HLT_e20_lhvloose_nod0", + "HLT_e24_lhvloose_nod0_L1EM18VH", + "HLT_e24_lhvloose_nod0_L1EM20VH"] + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool +HIGG3D3TrigSkimmingTool = DerivationFramework__TriggerSkimmingTool( name = "HIGG3D3TrigSkimmingTool", + TriggerListOR = TriggerChains ) +ToolSvc += HIGG3D3TrigSkimmingTool + +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG3D3ThinningHelper = ThinningHelper( "HIGG3D3ThinningHelper" ) +HIGG3D3ThinningHelper.TriggerChains = " | ".join(TriggerChains) +HIGG3D3ThinningHelper.AppendToStream( HIGG3D3Stream ) + +#================ +# THINNING +#================ +thinningTools=[] + +# MET/Jet tracks +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG3D3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG3D3JetTPThinningTool", + ThinningService = HIGG3D3ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG3D3JetTPThinningTool +thinningTools.append(HIGG3D3JetTPThinningTool) + + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG3D3MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG3D3MuonTPThinningTool", + ThinningService = HIGG3D3ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG3D3MuonTPThinningTool +thinningTools.append(HIGG3D3MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG3D3ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG3D3ElectronTPThinningTool", + ThinningService = HIGG3D3ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG3D3ElectronTPThinningTool +thinningTools.append(HIGG3D3ElectronTPThinningTool) + +# Truth particles +truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond3 = "(abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 6)" # b and Top quark +truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))" # Photon + +truth_expression = truth_cond1+' || '+truth_cond2 +' || '+truth_cond3 +' || '+truth_cond4 + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG3D3TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG3D3TruthThinningTool", + ThinningService = HIGG3D3ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = True, + PreserveAncestors = True, + SimBarcodeOffset = DerivationFrameworkSimBarcodeOffset ) + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG3D3TruthThinningTool + thinningTools.append(HIGG3D3TruthThinningTool) + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +electronRequirements = '(Electrons.pt > 7*GeV) && (abs(Electrons.eta) < 2.6)' +muonsRequirements = '(Muons.pt > 7*GeV) && (abs(Muons.eta) < 2.7) && (Muons.DFCommonGoodMuon)' + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__DeltaRTool +HIGG3D3ElJDeltaRTool = DerivationFramework__DeltaRTool( name = "HIGG3D3ElJDeltaRTool", + StoreGateEntryName = "dRElecJet", + ObjectRequirements = electronRequirements, + SecondObjectRequirements = "(AntiKt4EMTopoJets.pt > 15*GeV)", + ContainerName = "Electrons", + SecondContainerName = "AntiKt4EMTopoJets" ) +ToolSvc += HIGG3D3ElJDeltaRTool +HIGG3D3MuJDeltaRTool = DerivationFramework__DeltaRTool( name = "HIGG3D3MuJDeltaRTool", + StoreGateEntryName = "dRMuJet", + ObjectRequirements = muonsRequirements, + SecondObjectRequirements = "(AntiKt4EMTopoJets.pt > 15*GeV)", + ContainerName = "Muons", + SecondContainerName = "AntiKt4EMTopoJets" ) +ToolSvc += HIGG3D3MuJDeltaRTool + +eSelection = '(count('+electronRequirements+')>=1)' +mSelection = '(count('+muonsRequirements+')>=1)' +expression = '(' + eSelection+' || '+mSelection+')' + '&& ( (count(dRMuJet > 2.5) >= 1) || (count(dRElecJet > 2.5) >= 1))' + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG3D3SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG3D3SkimmingTool1", + expression = expression) +ToolSvc += HIGG3D3SkimmingTool + +skimmingTools = [] + +# Keep only ~5% of MC to reduce the total derivation size, adding this to the skimming tool list FIRST +if globalflags.DataSource()=='geant4': + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__PrescaleTool + mcPrescaleTool = DerivationFramework__PrescaleTool(name = "HIGG3D3MCPrescaleTool", + Prescale = 19) + ToolSvc += mcPrescaleTool + skimmingTools.append(mcPrescaleTool) + +skimmingTools += [HIGG3D3TrigSkimmingTool,HIGG3D3SkimmingTool] + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG3D3Kernel", + AugmentationTools = [HIGG3D3ElJDeltaRTool,HIGG3D3MuJDeltaRTool], + SkimmingTools = skimmingTools, + ThinningTools = thinningTools ) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG3D3SlimmingHelper = SlimmingHelper("HIGG3D3SlimmingHelper") +from DerivationFrameworkHiggs.HIGG3D3ExtraContent import * +#HIGG3D3SlimmingHelper.UserContent = HIGG3D3Content +HIGG3D3SlimmingHelper.SmartCollections = [ "Electrons", + "Muons", + "AntiKt4EMTopoJets", + "InDetTrackParticles", + "BTagging_AntiKt4EMTopo", + "PrimaryVertices", + "MET_Reference_AntiKt4EMTopo" ] + +HIGG3D3SlimmingHelper.ExtraVariables = HIGG3D3ExtraVariables +HIGG3D3SlimmingHelper.AllVariables = HIGG3D3ExtraContainers + +if globalflags.DataSource()=='geant4': + HIGG3D3SlimmingHelper.AllVariables += HIGG3D3ExtraTruthContainers + HIGG3D3SlimmingHelper.ExtraVariables += HIGG3D3ExtraTruthVariables + +# Add Trigger content +HIGG3D3SlimmingHelper.IncludeMuonTriggerContent = True +HIGG3D3SlimmingHelper.IncludeEGammaTriggerContent = True + +# Add MET to output stream +#addMETOutputs(HIGG3D3SlimmingHelper) + +HIGG3D3SlimmingHelper.AppendContentToStream(HIGG3D3Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D1.py new file mode 100644 index 0000000000000000000000000000000000000000..02e3ed388d218d15ec2fb38a9997ae5ff7e5c2fd --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D1.py @@ -0,0 +1,90 @@ +#******************************************************************** +# HIGG4D1.py: reductionConf flag HIGG4D1 in Reco_tf.py +# Z. Zinonos - zenon@cern.ch +# +DAOD_StreamID = 'HIGG4D1' +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +DFisMC = (globalflags.DataSource()=='geant4') + +if DFisMC: + from DerivationFrameworkMCTruth.MCTruthCommon import * + +print "Hello, my name is {} and I am running on {}".format(DAOD_StreamID, 'MC' if DFisMC else 'Data') + +#============== +# SET UP STREAM +#============== +streamName = derivationFlags.WriteDAOD_HIGG4D1Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG4D1Stream ) +HIGG4D1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG4D1Stream.AcceptAlgs([DAOD_StreamID+"Kernel"]) + +#============ +# Setup tools +#============ +# Establish the thinning helper +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG4D1ThinningHelper = ThinningHelper( DAOD_StreamID+"ThinningHelper" ) + +#trigger navigation thinning +import DerivationFrameworkHiggs.HIGG4DxThinning +HIGG4D1ThinningHelper.TriggerChains = DerivationFrameworkHiggs.HIGG4DxThinning.TriggerChains(DAOD_StreamID) +HIGG4D1ThinningHelper.AppendToStream( HIGG4D1Stream ) + +# thinning tools +thinningTools = DerivationFrameworkHiggs.HIGG4DxThinning.setup(DAOD_StreamID, HIGG4D1ThinningHelper.ThinningSvc(), ToolSvc) + +# skimming tools +import DerivationFrameworkHiggs.HIGG4DxSkimming +skimmingTools = DerivationFrameworkHiggs.HIGG4DxSkimming.setup(DAOD_StreamID, ToolSvc) + +#augmentation tools +from DerivationFrameworkHiggs.HIGG4DxAugmentation import * +augmentationTools = DerivationFrameworkHiggs.HIGG4DxAugmentation.setup(DAOD_StreamID, ToolSvc) + +#slimming tools +import DerivationFrameworkHiggs.HIGG4DxSlimming + +#slimming helper +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG4D1SlimmingHelper = SlimmingHelper(DAOD_StreamID+"SlimmingHelper") + +# jets and calibration +# not in this derivation + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +# Create the private sequence +HIGG4D1Sequence = CfgMgr.AthSequencer(DAOD_StreamID+"Sequence") + +#augmentation +HIGG4D1Sequence += CfgMgr.DerivationFramework__CommonAugmentation("HIGG4DxCommonAugmentationKernel", AugmentationTools = augmentationTools) + +#skimming +HIGG4D1Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"SkimmingKernel", SkimmingTools = skimmingTools) + +# fat/trimmed jet building (after skimming) +# not in this derivation + +#thinning +HIGG4D1Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"Kernel", ThinningTools = thinningTools) + +#add the private sequence to the main job +DerivationFrameworkJob += HIGG4D1Sequence + +# slimming +DerivationFrameworkHiggs.HIGG4DxSlimming.setup(DAOD_StreamID, HIGG4D1Stream, HIGG4D1SlimmingHelper) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D2.py new file mode 100644 index 0000000000000000000000000000000000000000..3e03244948f97305b08548dbee03f0191f00e5d4 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D2.py @@ -0,0 +1,90 @@ +#******************************************************************** +# HIGG4D2.py: reductionConf flag HIGG4D2 in Reco_tf.py +# Z. Zinonos - zenon@cern.ch +# +DAOD_StreamID = 'HIGG4D2' +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +DFisMC = (globalflags.DataSource()=='geant4') + +if DFisMC: + from DerivationFrameworkMCTruth.MCTruthCommon import * + +print "Hello, my name is {} and I am running on {}".format(DAOD_StreamID, 'MC' if DFisMC else 'Data') + +#============== +# SET UP STREAM +#============== +streamName = derivationFlags.WriteDAOD_HIGG4D2Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG4D2Stream ) +HIGG4D2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG4D2Stream.AcceptAlgs([DAOD_StreamID+"Kernel"]) + +#============ +# Setup tools +#============ +# Establish the thinning helper +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG4D2ThinningHelper = ThinningHelper( DAOD_StreamID+"ThinningHelper" ) + +#trigger navigation thinning +import DerivationFrameworkHiggs.HIGG4DxThinning +HIGG4D2ThinningHelper.TriggerChains = DerivationFrameworkHiggs.HIGG4DxThinning.TriggerChains(DAOD_StreamID) +HIGG4D2ThinningHelper.AppendToStream( HIGG4D2Stream ) + +# thinning tools +thinningTools = DerivationFrameworkHiggs.HIGG4DxThinning.setup(DAOD_StreamID, HIGG4D2ThinningHelper.ThinningSvc(), ToolSvc) + +# skimming tools +import DerivationFrameworkHiggs.HIGG4DxSkimming +skimmingTools = DerivationFrameworkHiggs.HIGG4DxSkimming.setup(DAOD_StreamID, ToolSvc) + +#augmentation tools +from DerivationFrameworkHiggs.HIGG4DxAugmentation import * +augmentationTools = DerivationFrameworkHiggs.HIGG4DxAugmentation.setup(DAOD_StreamID, ToolSvc) + +#slimming tools +import DerivationFrameworkHiggs.HIGG4DxSlimming + +#slimming helper +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG4D2SlimmingHelper = SlimmingHelper(DAOD_StreamID+"SlimmingHelper") + +# jets and calibration +import DerivationFrameworkHiggs.HIGG4DxJets + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +# Create the private sequence +HIGG4D2Sequence = CfgMgr.AthSequencer(DAOD_StreamID+"Sequence") + +# augmentation +HIGG4D2Sequence += CfgMgr.DerivationFramework__CommonAugmentation("HIGG4DxCommonAugmentationKernel", AugmentationTools = augmentationTools) + +# skimming +HIGG4D2Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"SkimmingKernel", SkimmingTools = skimmingTools) + +# fat/trimmed jet building (after skimming) +DerivationFrameworkHiggs.HIGG4DxJets.setup(DAOD_StreamID, HIGG4D2Sequence, HIGG4D2SlimmingHelper) + +# thinning +HIGG4D2Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"Kernel", ThinningTools = thinningTools) + +# add the private sequence to the main job +DerivationFrameworkJob += HIGG4D2Sequence + +# slimming - last position +DerivationFrameworkHiggs.HIGG4DxSlimming.setup(DAOD_StreamID, HIGG4D2Stream, HIGG4D2SlimmingHelper) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D3.py new file mode 100644 index 0000000000000000000000000000000000000000..f5c4ba69cca0f526cb33b91d0b2e6a25383e2d75 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D3.py @@ -0,0 +1,89 @@ +#******************************************************************** +# HIGG4D3.py: reductionConf flag HIGG4D3 in Reco_tf.py +# Z. Zinonos - zenon@cern.ch +# +DAOD_StreamID = 'HIGG4D3' +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +DFisMC = (globalflags.DataSource()=='geant4') + +if DFisMC: + from DerivationFrameworkMCTruth.MCTruthCommon import * + +print "Hello, my name is {} and I am running on {}".format(DAOD_StreamID, 'MC' if DFisMC else 'Data') + +#============== +# SET UP STREAM +#============== +streamName = derivationFlags.WriteDAOD_HIGG4D3Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG4D3Stream ) +HIGG4D3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG4D3Stream.AcceptAlgs([DAOD_StreamID+"Kernel"]) + +#============ +# Setup tools +#============ +# Establish the thinning helper +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG4D3ThinningHelper = ThinningHelper( DAOD_StreamID+"ThinningHelper" ) + +#trigger navigation thinning +import DerivationFrameworkHiggs.HIGG4DxThinning +HIGG4D3ThinningHelper.TriggerChains = DerivationFrameworkHiggs.HIGG4DxThinning.TriggerChains(DAOD_StreamID) +HIGG4D3ThinningHelper.AppendToStream( HIGG4D3Stream ) + +# thinning tools +thinningTools = DerivationFrameworkHiggs.HIGG4DxThinning.setup(DAOD_StreamID, HIGG4D3ThinningHelper.ThinningSvc(), ToolSvc) + +# skimming tools +import DerivationFrameworkHiggs.HIGG4DxSkimming +skimmingTools = DerivationFrameworkHiggs.HIGG4DxSkimming.setup(DAOD_StreamID, ToolSvc) + +#augmentation tools +from DerivationFrameworkHiggs.HIGG4DxAugmentation import * +augmentationTools = DerivationFrameworkHiggs.HIGG4DxAugmentation.setup(DAOD_StreamID, ToolSvc) + +#slimming tools +import DerivationFrameworkHiggs.HIGG4DxSlimming + +#slimming helper +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG4D3SlimmingHelper = SlimmingHelper(DAOD_StreamID+"SlimmingHelper") + +# jets and calibration +import DerivationFrameworkHiggs.HIGG4DxJets + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +# Create the private sequence +HIGG4D3Sequence = CfgMgr.AthSequencer(DAOD_StreamID+"Sequence") + +# augmentation +HIGG4D3Sequence += CfgMgr.DerivationFramework__CommonAugmentation("HIGG4DxCommonAugmentationKernel", AugmentationTools = augmentationTools) + +# skimming +HIGG4D3Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"SkimmingKernel", SkimmingTools = skimmingTools) + +# fat/trimmed jet building (after skimming) +DerivationFrameworkHiggs.HIGG4DxJets.setup(DAOD_StreamID, HIGG4D3Sequence, HIGG4D3SlimmingHelper) + +# thinning +HIGG4D3Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"Kernel", ThinningTools = thinningTools) + +# add the private sequence to the main job +DerivationFrameworkJob += HIGG4D3Sequence + +# slimming - last position +DerivationFrameworkHiggs.HIGG4DxSlimming.setup(DAOD_StreamID, HIGG4D3Stream, HIGG4D3SlimmingHelper) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D4.py new file mode 100644 index 0000000000000000000000000000000000000000..2aa2a2c1c5962afd9dbe045d15d684ccca490c3d --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG4D4.py @@ -0,0 +1,90 @@ +#******************************************************************** +# HIGG4D4.py: reductionConf flag HIGG4D4 in Reco_tf.py +# Z. Zinonos - zenon@cern.ch +# +DAOD_StreamID = 'HIGG4D4' +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +DFisMC = (globalflags.DataSource()=='geant4') + +if DFisMC: + from DerivationFrameworkMCTruth.MCTruthCommon import * + +print "Hello, my name is {} and I am running on {}".format(DAOD_StreamID, 'MC' if DFisMC else 'Data') + +#============== +# SET UP STREAM +#============== +streamName = derivationFlags.WriteDAOD_HIGG4D4Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG4D4Stream ) +HIGG4D4Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG4D4Stream.AcceptAlgs([DAOD_StreamID+"Kernel"]) + +#============ +# Setup tools +#============ +# Establish the thinning helper +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG4D4ThinningHelper = ThinningHelper( DAOD_StreamID+"ThinningHelper" ) + +#trigger navigation thinning +import DerivationFrameworkHiggs.HIGG4DxThinning +HIGG4D4ThinningHelper.TriggerChains = DerivationFrameworkHiggs.HIGG4DxThinning.TriggerChains(DAOD_StreamID) +HIGG4D4ThinningHelper.AppendToStream( HIGG4D4Stream ) + +# thinning tools +thinningTools = DerivationFrameworkHiggs.HIGG4DxThinning.setup(DAOD_StreamID, HIGG4D4ThinningHelper.ThinningSvc(), ToolSvc) + +# skimming tools +import DerivationFrameworkHiggs.HIGG4DxSkimming +skimmingTools = DerivationFrameworkHiggs.HIGG4DxSkimming.setup(DAOD_StreamID, ToolSvc) + +#augmentation tools +from DerivationFrameworkHiggs.HIGG4DxAugmentation import * +augmentationTools = DerivationFrameworkHiggs.HIGG4DxAugmentation.setup(DAOD_StreamID, ToolSvc) + +#slimming tools +import DerivationFrameworkHiggs.HIGG4DxSlimming + +#slimming helper +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG4D4SlimmingHelper = SlimmingHelper(DAOD_StreamID+"SlimmingHelper") + +# jets and calibration +import DerivationFrameworkHiggs.HIGG4DxJets + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +# Create the private sequence +HIGG4D4Sequence = CfgMgr.AthSequencer(DAOD_StreamID+"Sequence") + +# augmentation +HIGG4D4Sequence += CfgMgr.DerivationFramework__CommonAugmentation("HIGG4DxCommonAugmentationKernel", AugmentationTools = augmentationTools) + +# skimming +HIGG4D4Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"SkimmingKernel", SkimmingTools = skimmingTools) + +# fat/trimmed jet building (after skimming) +DerivationFrameworkHiggs.HIGG4DxJets.setup(DAOD_StreamID, HIGG4D4Sequence, HIGG4D4SlimmingHelper) + +# thinning +HIGG4D4Sequence += CfgMgr.DerivationFramework__DerivationKernel(DAOD_StreamID+"Kernel", ThinningTools = thinningTools) + +# add the private sequence to the main job +DerivationFrameworkJob += HIGG4D4Sequence + +# slimming - last position +DerivationFrameworkHiggs.HIGG4DxSlimming.setup(DAOD_StreamID, HIGG4D4Stream, HIGG4D4SlimmingHelper) + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py new file mode 100644 index 0000000000000000000000000000000000000000..ddcf827940a2a8c68e4e9f73c3738d582c89a29b --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py @@ -0,0 +1,284 @@ +#******************************************************************** +# HIGG5D1.py (for 0-lepton) +# reductionConf flag HIGG5D1 in Reco_tf.py +#******************************************************************** +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +# from DerivationFrameworkJetEtMiss.JetMomentFix import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * + + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +#print "Yoshikazu Nagai test: globalflags.DataSource()" +#print globalflags.DataSource() # this should be "data" or "geant4" +is_MC = (globalflags.DataSource()=='geant4') +print "is_MC = ",is_MC + + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG5D1Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG5D1Stream ) +HIGG5D1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG5D1Stream.AcceptAlgs(["HIGG5D1Kernel"]) + +#==================================================================== +# THINNING TOOLS +#==================================================================== +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG5D1ThinningHelper = ThinningHelper("HIGG5D1ThinningHelper") +#trigger navigation content +HIGG5D1ThinningHelper.TriggerChains = 'HLT_xe.*|HLT_j.*|HLT_g.*' +HIGG5D1ThinningHelper.AppendToStream(HIGG5D1Stream) + + +# MC truth thinning (not for data) +truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6) || (abs(TruthParticles.pdgId) == 5))" # Top quark and Bottom quark +truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon +truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG5D1MCThinningTool = DerivationFramework__GenericTruthThinning( + name = "HIGG5D1MCThinningTool", + ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG5D1MCThinningTool + thinningTools.append(HIGG5D1MCThinningTool) + +# MET/Jet tracks +# thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +# from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +# HIGG5D1TPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG5D1TPThinningTool", +# ThinningService = "HIGG5D1ThinningSvc", +# SelectionString = thinning_expression, +# InDetTrackParticlesKey = "InDetTrackParticles", +# ApplyAnd = True) +# ToolSvc += HIGG5D1TPThinningTool +# thinningTools.append(HIGG5D1TPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG5D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG5D1JetTPThinningTool", + ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D1JetTPThinningTool +thinningTools.append(HIGG5D1JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG5D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG5D1MuonTPThinningTool", + ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D1MuonTPThinningTool +thinningTools.append(HIGG5D1MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG5D1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG5D1ElectronTPThinningTool", + ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG5D1ElectronTPThinningTool +thinningTools.append(HIGG5D1ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG5D1PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG5D1PhotonTPThinningTool", + ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG5D1PhotonTPThinningTool +thinningTools.append(HIGG5D1PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG5D1TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "HIGG5D1TauTPThinningTool", + ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D1TauTPThinningTool +thinningTools.append(HIGG5D1TauTPThinningTool) + + + +#==================================================================== +# jet selection +#==================================================================== +#jetSel = '(( count( (AntiKt4EMTopoJets.pt > 0.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6) ) ) > 1)' +jetSel = '(( count( (AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 15.*GeV) && (abs(AntiKt4EMTopoJets.DFCommonJets_Calib_eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (AntiKt4EMTopoJets.pt > 100.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (AntiKt10LCTopoJets.pt > 100.0*GeV) && (abs(AntiKt10LCTopoJets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (CamKt12LCTopoJets.pt > 100.0*GeV) && (abs(CamKt12LCTopoJets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 100.0*GeV) && (abs(AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.eta) < 2.6) ) ) > 0)' +# jetSel += '|| (( count( (CamKt10LCTopoPrunedR50Z15Jets.pt > 100.0*GeV) && (abs(CamKt10LCTopoPrunedR50Z15Jets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (CamKt12LCTopoBDRSFilteredMU100Y15Jets.pt > 100.0*GeV) && (abs(CamKt12LCTopoBDRSFilteredMU100Y15Jets.eta) < 2.6) ) ) > 0)' + +#==================================================================== +# Trigger selection +#==================================================================== +beamEnergy = jobproperties.Beam.energy() +triglist = [] +if (beamEnergy < 4.1e+06): # 8 TeV, name should be EF_xxx in Rel19, HLT_xxx in Rel20 + #trigSel = '(EventInfo.eventTypeBitmask==1) || EF_xe100 || EF_xe50_j40_dphi1 || EF_xe80T_tclcw_loose || EF_xe80_tclcw_loose' + triglist.append("HLT_xe100") + triglist.append("HLT_xe50_j40_dphi1") + triglist.append("HLT_xe80T_tclcw_loose") + triglist.append("HLT_xe80_tclcw_loose") +if (beamEnergy > 6.0e+06): # 13 TeV, name should be HLT_xxx + triglist.append("HLT_xe35") + triglist.append("HLT_xe50") + triglist.append("HLT_xe60") + triglist.append("HLT_xe70") + triglist.append("HLT_xe80") + triglist.append("HLT_xe80_L1XE50") + triglist.append("HLT_xe80_L1XE70") + triglist.append("HLT_xe100") + triglist.append("HLT_j80_xe80_dphi1_L1J40_DPHI-J20XE50") + triglist.append("HLT_j80_xe80_dphi1_L1J40_DPHI-J20s2XE50") + triglist.append("HLT_j100_xe80_L1J40_DPHI-J20XE50") + triglist.append("HLT_j100_xe80_L1J40_DPHI-J20s2XE50") + triglist.append("HLT_g120_loose") + # triglist.append("L1_XE50") + # triglist.append("L1_XE60") + # triglist.append("L1_XE70") + + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG5D1JetSkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG5D1JetSkimmingTool", + expression = jetSel) +ToolSvc += HIGG5D1JetSkimmingTool + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool +HIGG5D1TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( name = "HIGG5D1TriggerSkimmingTool", + TriggerListOR = triglist ) +ToolSvc += HIGG5D1TriggerSkimmingTool + + +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +higg5d1Seq = CfgMgr.AthSequencer("HIGG5D1Sequence") + + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +higg5d1Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D1Kernel_trig", + SkimmingTools = [HIGG5D1TriggerSkimmingTool] + ) + + +# Then apply the TruthWZ fix +if globalflags.DataSource()=='geant4': + replaceBuggyAntiKt4TruthWZJets(higg5d1Seq,'HIGG5D1') + replaceBuggyAntiKt10TruthWZJets(higg5d1Seq,'HIGG5D1') + +#==================================================================== +# Special jets +#==================================================================== +if not "HIGG5D1Jets" in OutputJets: + OutputJets["HIGG5D1Jets"] = ["AntiKt3PV0TrackJets","AntiKt2PV0TrackJets","AntiKt10LCTopoJets","CamKt12LCTopoJets"] + + if jetFlags.useTruth: + OutputJets["HIGG5D1Jets"].append("AntiKt4TruthJets") + OutputJets["HIGG5D1Jets"].append("AntiKt4TruthWZJets") + # OutputJets["HIGG5D1Jets"].append("AntiKt10TruthWZJets") + # OutputJets["HIGG5D1Jets"].append("AntiKt10TruthJets") + #OutputJets["HIGG5D1Jets"].append("CamKt12TruthJets") + addTrimmedJets("AntiKt", 1.0, "TruthWZ", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg5d1Seq,outputGroup="HIGG5D1Jets") + + addFilteredJets("CamKt", 1.2, "LCTopo", mumax=1.0, ymin=0.15, includePreTools=False, algseq=higg5d1Seq,outputGroup="HIGG5D1Jets") + addTrimmedJets("AntiKt", 1.0, "LCTopo", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg5d1Seq,outputGroup="HIGG5D1Jets") + +# Jet calibration should come after fat jets +applyJetCalibration_xAODColl(jetalg="AntiKt4EMTopo", sequence=higg5d1Seq) +applyJetCalibration_CustomColl(jetalg="AntiKt10LCTopoTrimmedPtFrac5SmallR20", sequence=higg5d1Seq) + + +higg5d1Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D1Kernel_jet", + SkimmingTools = [HIGG5D1JetSkimmingTool] + ) + +higg5d1Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D1Kernel", + ThinningTools = thinningTools + ) + + +DerivationFrameworkJob += higg5d1Seq + + +# # Thinning +# from AthenaServices.Configurables import ThinningSvc, createThinningSvc +# augStream = MSMgr.GetStream( streamName ) +# evtStream = augStream.GetEventStream() +# svcMgr += createThinningSvc( svcName="HIGG5D1ThinningSvc", outStreams=[evtStream] ) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +#from DerivationFrameworkHiggs.HIGG5D1ContentList import HIGG5D1Content +from DerivationFrameworkHiggs.HIGG5D1ExtraContent import * +HIGG5D1SlimmingHelper = SlimmingHelper("HIGG5D1SlimmingHelper") + +HIGG5D1SlimmingHelper.SmartCollections = [ "Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + +HIGG5D1SlimmingHelper.ExtraVariables = ExtraContent +HIGG5D1SlimmingHelper.AllVariables = ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG5D1SlimmingHelper.ExtraVariables += ExtraContentTruth + HIGG5D1SlimmingHelper.AllVariables += ExtraContainersTruth + +# Add the jet containers to the stream +addJetOutputs(HIGG5D1SlimmingHelper,["HIGG5D1Jets"]) +# Add the MET containers to the stream +addMETOutputs(HIGG5D1SlimmingHelper,["AntiKt4LCTopo","Track"]) + +# if globalflags.DataSource()!='geant4': # for very early data +# HIGG5D1SlimmingHelper.IncludeMuonTriggerContent = True +HIGG5D1SlimmingHelper.IncludeEGammaTriggerContent = True +# HIGG5D1SlimmingHelper.IncludeBJetTriggerContent = True +#HIGG5D1SlimmingHelper.IncludeBPhysTriggerContent = True +#HIGG5D1SlimmingHelper.IncludeJetTauEtMissTriggerContent = True +HIGG5D1SlimmingHelper.IncludeEtMissTriggerContent = True +HIGG5D1SlimmingHelper.IncludeJetTriggerContent = True + +HIGG5D1SlimmingHelper.AppendContentToStream(HIGG5D1Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py new file mode 100644 index 0000000000000000000000000000000000000000..55b8ab3bec54e6cc317b76e0f0b005388c5c66ab --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py @@ -0,0 +1,330 @@ +#******************************************************************** +# HIGG5D2.py (for 1-lepton) +# reductionConf flag HIGG5D2 in Reco_tf.py +#******************************************************************** +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +# from DerivationFrameworkJetEtMiss.JetMomentFix import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from DerivationFrameworkInDet.InDetCommon import * + + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +#print "Yoshikazu Nagai test: globalflags.DataSource()" +#print globalflags.DataSource() # this should be "data" or "geant4" +is_MC = (globalflags.DataSource()=='geant4') +print "is_MC = ",is_MC + + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG5D2Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG5D2Stream ) +HIGG5D2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG5D2Stream.AcceptAlgs(["HIGG5D2Kernel"]) + +#==================================================================== +# THINNING TOOLS +#==================================================================== +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG5D2ThinningHelper = ThinningHelper("HIGG5D2ThinningHelper") +#trigger navigation content +HIGG5D2ThinningHelper.TriggerChains = 'HLT_e.*|HLT_mu.*|HLT_xe.*|HLT_j.*' +HIGG5D2ThinningHelper.AppendToStream(HIGG5D2Stream) + + +# MC truth thinning (not for data) +truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6) || (abs(TruthParticles.pdgId) == 5))" # Top quark and Bottom quark +truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon +truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG5D2MCThinningTool = DerivationFramework__GenericTruthThinning( + name = "HIGG5D2MCThinningTool", + ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) + +if globalflags.DataSource()=='geant4': + ToolSvc += HIGG5D2MCThinningTool + thinningTools.append(HIGG5D2MCThinningTool) + +# MET/Jet tracks +# thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +# from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +# HIGG5D2TPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG5D2TPThinningTool", +# ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), +# SelectionString = thinning_expression, +# InDetTrackParticlesKey = "InDetTrackParticles", +# ApplyAnd = True) +# ToolSvc += HIGG5D2TPThinningTool +# thinningTools.append(HIGG5D2TPThinningTool) + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG5D2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG5D2JetTPThinningTool", + ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D2JetTPThinningTool +thinningTools.append(HIGG5D2JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG5D2MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG5D2MuonTPThinningTool", + ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D2MuonTPThinningTool +thinningTools.append(HIGG5D2MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG5D2ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG5D2ElectronTPThinningTool", + ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG5D2ElectronTPThinningTool +thinningTools.append(HIGG5D2ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG5D2PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG5D2PhotonTPThinningTool", + ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG5D2PhotonTPThinningTool +thinningTools.append(HIGG5D2PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG5D2TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "HIGG5D2TauTPThinningTool", + ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D2TauTPThinningTool +thinningTools.append(HIGG5D2TauTPThinningTool) + + +#======================================================================== +# lepton selection (keep isolation failed leptons for QCD-MJ estimation) +#======================================================================== +lepSel = '( count( (Muons.pt > 20.0*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonGoodMuon) ) + count( (Electrons.pt > 20.0*GeV) && (abs(Electrons.eta) < 2.6) && (Electrons.DFCommonElectronsLHLoose) ) ) > 0' + +#==================================================================== +# jet selection +#==================================================================== +#jetSel = '(( count( (AntiKt4EMTopoJets.pt > 0.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6) ) ) > 1)' +jetSel = '(( count( (AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 15.*GeV) && (abs(AntiKt4EMTopoJets.DFCommonJets_Calib_eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (AntiKt4EMTopoJets.pt > 100.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (AntiKt10LCTopoJets.pt > 100.0*GeV) && (abs(AntiKt10LCTopoJets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (CamKt12LCTopoJets.pt > 100.0*GeV) && (abs(CamKt12LCTopoJets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 100.0*GeV) && (abs(AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.eta) < 2.6) ) ) > 0)' +# jetSel += '|| (( count( (CamKt10LCTopoPrunedR50Z15Jets.pt > 100.0*GeV) && (abs(CamKt10LCTopoPrunedR50Z15Jets.eta) < 2.6) ) ) > 0)' +jetSel += '|| (( count( (CamKt12LCTopoBDRSFilteredMU100Y15Jets.pt > 100.0*GeV) && (abs(CamKt12LCTopoBDRSFilteredMU100Y15Jets.eta) < 2.6) ) ) > 0)' +#jetSel = '(( count( (AntiKt4EMTopoJets.pt > 0.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6) ) ) > 1) || (( count( (AntiKt4EMTopoJets.pt > 100.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6) ) ) > 0) || (( count( (AntiKt10LCTopoJets.pt > 100.0*GeV) && (abs(AntiKt10LCTopoJets.eta) < 2.6) ) ) > 0) || (( count( (CamKt12LCTopoJets.pt > 100.0*GeV) && (abs(CamKt12LCTopoJets.eta) < 2.6) ) ) > 0)' + +#==================================================================== +# Trigger selection +#==================================================================== +beamEnergy = jobproperties.Beam.energy() +triglist = [] +if (beamEnergy < 4.1e+06): # 8 TeV, name should be EF_xxx in Rel19, HLT_xxx in Rel20 + triglist.append("HLT_e24vhi_medium1") + triglist.append("HLT_e60_medium1") + triglist.append("HLT_mu24i_tight") + triglist.append("HLT_mu36_tight") + triglist.append("HLT_xe100") + triglist.append("HLT_xe50_j40_dphi1") + triglist.append("HLT_xe80T_tclcw_loose") + triglist.append("HLT_xe80_tclcw_loose") +if (beamEnergy > 6.0e+06): # 13 TeV, name should be HLT_xxx + triglist.append("HLT_e17_lhloose_L1EM15") + triglist.append("HLT_e24_medium_iloose_L1EM18VH") + triglist.append("HLT_e24_medium_iloose_L1EM20VH") + triglist.append("HLT_e24_lhmedium_iloose_L1EM20VH") + triglist.append("HLT_e24_tight_iloose") + triglist.append("HLT_e26_tight_iloose") + triglist.append("HLT_e26_tight1_iloose") + triglist.append("HLT_e26_lhtight_iloose") + triglist.append("HLT_e24_lhmedium_L1EM20VH") + triglist.append("HLT_e24_lhmedium_L1EM18VH") + triglist.append("HLT_e60_medium") + triglist.append("HLT_e60_medium1") + triglist.append("HLT_e60_lhmedium") + triglist.append("HLT_e120_lhloose") + triglist.append("HLT_e140_lhloose") + triglist.append("HLT_mu14") + triglist.append("HLT_mu20_iloose_L1MU15") + triglist.append("HLT_mu24_iloose_L1MU15") + triglist.append("HLT_mu24_imedium") + triglist.append("HLT_mu26_imedium") + triglist.append("HLT_mu50") + triglist.append("HLT_xe35") + triglist.append("HLT_xe50") + triglist.append("HLT_xe60") + triglist.append("HLT_xe70") + triglist.append("HLT_xe80") + triglist.append("HLT_xe80_L1XE50") + triglist.append("HLT_xe80_L1XE70") + triglist.append("HLT_xe100") + triglist.append("HLT_j80_xe80_dphi1_L1J40_DPHI-J20XE50") + triglist.append("HLT_j80_xe80_dphi1_L1J40_DPHI-J20s2XE50") + triglist.append("HLT_j100_xe80_L1J40_DPHI-J20XE50") + triglist.append("HLT_j100_xe80_L1J40_DPHI-J20s2XE50") + + # triglist.append("L1_EM18VH") + # triglist.append("L1_EM20VH") + # triglist.append("L1_EM20VHI") + # triglist.append("L1_EM22VHI") + # triglist.append("L1_MU15") + # triglist.append("L1_MU20") + # triglist.append("L1_XE50") + # triglist.append("L1_XE60") + # triglist.append("L1_XE70") + + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG5D2JetSkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG5D2JetSkimmingTool", + expression = jetSel) +ToolSvc += HIGG5D2JetSkimmingTool + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG5D2LepSkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG5D2LepSkimmingTool", + expression = lepSel) +ToolSvc += HIGG5D2LepSkimmingTool + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__TriggerSkimmingTool +HIGG5D2TriggerSkimmingTool = DerivationFramework__TriggerSkimmingTool( name = "HIGG5D2TriggerSkimmingTool", + TriggerListOR = triglist ) +ToolSvc += HIGG5D2TriggerSkimmingTool + + +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +higg5d2Seq = CfgMgr.AthSequencer("HIGG5D2Sequence") + + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +higg5d2Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D2Kernel_trig", + SkimmingTools = [HIGG5D2TriggerSkimmingTool] + ) + +higg5d2Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D2Kernel_lep", + SkimmingTools = [HIGG5D2LepSkimmingTool] + ) + + +# Then apply the TruthWZ fix +if globalflags.DataSource()=='geant4': + replaceBuggyAntiKt4TruthWZJets(higg5d2Seq,'HIGG5D2') + replaceBuggyAntiKt10TruthWZJets(higg5d2Seq,'HIGG5D2') + +#==================================================================== +# Special jets +#==================================================================== +if not "HIGG5D2Jets" in OutputJets: + OutputJets["HIGG5D2Jets"] = ["AntiKt3PV0TrackJets","AntiKt2PV0TrackJets","AntiKt10LCTopoJets","CamKt12LCTopoJets"] + + if jetFlags.useTruth: + OutputJets["HIGG5D2Jets"].append("AntiKt4TruthJets") + OutputJets["HIGG5D2Jets"].append("AntiKt4TruthWZJets") + # OutputJets["HIGG5D2Jets"].append("AntiKt10TruthWZJets") + # OutputJets["HIGG5D2Jets"].append("AntiKt10TruthJets") + #OutputJets["HIGG5D2Jets"].append("CamKt12TruthJets") + addTrimmedJets("AntiKt", 1.0, "TruthWZ", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg5d2Seq,outputGroup="HIGG5D2Jets") + + addFilteredJets("CamKt", 1.2, "LCTopo", mumax=1.0, ymin=0.15, includePreTools=False, algseq=higg5d2Seq,outputGroup="HIGG5D2Jets") + addTrimmedJets("AntiKt", 1.0, "LCTopo", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg5d2Seq,outputGroup="HIGG5D2Jets") + +# Jet calibration should come after fat jets +applyJetCalibration_xAODColl(jetalg="AntiKt4EMTopo", sequence=higg5d2Seq) +applyJetCalibration_CustomColl(jetalg="AntiKt10LCTopoTrimmedPtFrac5SmallR20", sequence=higg5d2Seq) + + +higg5d2Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D2Kernel_jet", + SkimmingTools = [HIGG5D2JetSkimmingTool] + ) + +higg5d2Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D2Kernel", + ThinningTools = thinningTools + ) + + + +DerivationFrameworkJob += higg5d2Seq + + +# # Thinning +# from AthenaServices.Configurables import ThinningSvc, createThinningSvc +# augStream = MSMgr.GetStream( streamName ) +# evtStream = augStream.GetEventStream() +# svcMgr += createThinningSvc( svcName="HIGG5D2ThinningSvc", outStreams=[evtStream] ) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +#from DerivationFrameworkHiggs.HIGG5D2ContentList import HIGG5D2Content +from DerivationFrameworkHiggs.HIGG5D2ExtraContent import * +HIGG5D2SlimmingHelper = SlimmingHelper("HIGG5D2SlimmingHelper") + +HIGG5D2SlimmingHelper.SmartCollections = [ "Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + +HIGG5D2SlimmingHelper.ExtraVariables = ExtraContent +HIGG5D2SlimmingHelper.AllVariables = ExtraContainers +if globalflags.DataSource()=='geant4': + HIGG5D2SlimmingHelper.ExtraVariables += ExtraContentTruth + HIGG5D2SlimmingHelper.AllVariables += ExtraContainersTruth + +# Add the jet containers to the stream +addJetOutputs(HIGG5D2SlimmingHelper,["HIGG5D2Jets"]) +# Add the MET containers to the stream +addMETOutputs(HIGG5D2SlimmingHelper,["AntiKt4LCTopo","Track"]) + +HIGG5D2SlimmingHelper.IncludeMuonTriggerContent = True +HIGG5D2SlimmingHelper.IncludeEGammaTriggerContent = True +#HIGG5D2SlimmingHelper.IncludeBPhysTriggerContent = True +#HIGG5D2SlimmingHelper.IncludeJetTauEtMissTriggerContent = True +HIGG5D2SlimmingHelper.IncludeEtMissTriggerContent = True +HIGG5D2SlimmingHelper.IncludeJetTriggerContent = True +# if globalflags.DataSource()!='geant4': # for very early data +# HIGG5D2SlimmingHelper.IncludeBJetTriggerContent = True + +HIGG5D2SlimmingHelper.AppendContentToStream(HIGG5D2Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py new file mode 100644 index 0000000000000000000000000000000000000000..73718b0b761930214debd5bd95d9890cec98932b --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py @@ -0,0 +1,399 @@ +#******************************************************************** +# HIGG5D3.py (for 0-lepton) +# reductionConf flag HIGG5D3 in Reco_tf.py +#******************************************************************** +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * +from DerivationFrameworkJetEtMiss.METCommon import * +# from DerivationFrameworkJetEtMiss.JetMomentFix import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * + + +# running on data or MC +from AthenaCommon.GlobalFlags import globalflags +#print "Yoshikazu Nagai test: globalflags.DataSource()" +#print globalflags.DataSource() # this should be "data" or "geant4" +is_MC = (globalflags.DataSource()=='geant4') +print "is_MC = ",is_MC + + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG5D3Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG5D3Stream ) +HIGG5D3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG5D3Stream.AcceptAlgs(["HIGG5D3Kernel"]) + +#==================================================================== +# THINNING TOOLS +#==================================================================== +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG5D3ThinningHelper = ThinningHelper("HIGG5D3ThinningHelper") +#trigger navigation content +HIGG5D3ThinningHelper.TriggerChains = 'HLT_g.*|HLT_mu.*|HLT_j.*|HLT_b.*' +HIGG5D3ThinningHelper.AppendToStream(HIGG5D3Stream) + + +# MC truth thinning (not for data) +truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs +truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons +truth_cond_Quark = "((abs(TruthParticles.pdgId) == 6) || (abs(TruthParticles.pdgId) == 5))" # Top quark and Bottom quark +truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))" # Photon +truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')' +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG5D3MCThinningTool = DerivationFramework__GenericTruthThinning( + name = "HIGG5D3MCThinningTool", + ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_expression, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = True) +if (is_MC) : + ToolSvc += HIGG5D3MCThinningTool + thinningTools.append(HIGG5D3MCThinningTool) + + +# MET/Jet tracks +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG5D3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG5D3JetTPThinningTool", + ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG5D3JetTPThinningTool +thinningTools.append(HIGG5D3JetTPThinningTool) + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG5D3MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG5D3MuonTPThinningTool", + ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D3MuonTPThinningTool +thinningTools.append(HIGG5D3MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG5D3ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG5D3ElectronTPThinningTool", + ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG5D3ElectronTPThinningTool +thinningTools.append(HIGG5D3ElectronTPThinningTool) + +# Tracks associated with Photons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG5D3PhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( name = "HIGG5D3PhotonTPThinningTool", + ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + SGKey = "Photons", + InDetTrackParticlesKey = "InDetTrackParticles", + BestMatchOnly = True) +ToolSvc += HIGG5D3PhotonTPThinningTool +thinningTools.append(HIGG5D3PhotonTPThinningTool) + +# Tracks associated with taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG5D3TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "HIGG5D3TauTPThinningTool", + ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG5D3TauTPThinningTool +thinningTools.append(HIGG5D3TauTPThinningTool) + +#==================================================================== +# Skimming Tool +#==================================================================== +Run2DataTriggers=['HLT_2j35_bmv2c2070_2j35_L13J25.0ETA23', + 'HLT_2j35_bmv2c2070_split_2j35_L13J25.0ETA23', + 'HLT_2j35_btight_2j35_L13J25.0ETA23', + 'HLT_2j35_btight_2j35_L14J15.0ETA25', + 'HLT_2j35_btight_split_2j35_L13J25.0ETA23', + 'HLT_2j35_btight_split_2j35_L14J15.0ETA25', + 'HLT_2j45_bmedium_2j45_L13J25.0ETA23', + 'HLT_2j45_bmedium_2j45_L14J15.0ETA25', + 'HLT_2j45_bmedium_split_2j45_L13J25.0ETA23', + 'HLT_2j45_bmedium_split_2j45_L14J15.0ETA25', + 'HLT_2j45_bmv2c2077_2j45_L13J25.0ETA23', + 'HLT_2j45_bmv2c2077_split_2j45_L13J25.0ETA23', + 'HLT_2j45_btight_2j45', + 'HLT_2j45_btight_2j45_L13J25.ETA23', + 'HLT_2j45_btight_split_2j45', + 'HLT_2j45_btight_split_2j45_L13J25.ETA23', + 'HLT_2j55_bloose_L14J20.0ETA49', + 'HLT_2j55_bmedium_2j55', + 'HLT_2j55_bmedium_2j55_L13J25.ETA23', + 'HLT_2j55_bmedium_L14J20.0ETA49', + 'HLT_2j55_bmedium_split_2j55', + 'HLT_2j55_bmedium_split_2j55_L13J25.ETA23', + 'HLT_2j55_bperf_L14J20.0ETA49', + 'HLT_2j65_btight_j65', + 'HLT_2j65_btight_split_j65', + 'HLT_2j70_bmedium_j70', + 'HLT_2j70_bmedium_split_j70', + 'HLT_2j70_btight_j70', + 'HLT_2j70_btight_split_j70', + 'HLT_2j75_bmedium_j75', + 'HLT_2j75_bmedium_split_j75', + 'HLT_j0_perf_bperf_L1MU10', + 'HLT_mu4_4j40_dr05_L1MU4_3J15', + 'HLT_mu4_4j40_dr05_L1MU4_3J20', + 'HLT_mu4_j40_dr05_3j40_L14J20', + 'HLT_mu6_2j40_0eta490_invm1000_L1MU6_J30.0ETA49_2J20.0ETA49', + 'HLT_mu6_2j40_0eta490_invm400_L1MU6_J30.0ETA49_2J20.0ETA49', + 'HLT_mu6_2j40_0eta490_invm600_L1MU6_J30.0ETA49_2J20.0ETA49', + 'HLT_mu6_2j40_0eta490_invm800_L1MU6_J30.0ETA49_2J20.0ETA49', + 'HLT_g20_loose_L1EM18VH_2j40_0eta490_3j25_0eta490', + 'HLT_g20_loose_L1EM18VH_2j40_0eta490_3j25_0eta490_invm700', + 'HLT_g25_loose_2j40_0eta490_3j25_0eta490_invm700', + 'HLT_g25_loose_L1EM20VH_2j40_0eta490_3j25_0eta490_invm700', + 'HLT_g20_loose', + 'HLT_g25_loose', # updated with TriggerMenu-00-12-40 (July 2015) + 'HLT_g25_medium_L1EM22VHI_4j35_0eta490_invm700', + 'HLT_g25_medium_L1EM22VHI_j35_0eta490_bmv2c2077_3j25_0eta490_invm700', + 'HLT_g25_medium_L1EM22VHI_2j35_0eta490_bmv2c2077_2j35_0eta490', + 'HLT_g25_loose_L1EM20VH_4j35_0eta490'] # added on Oct 2015 + + +Run2MCTriggers=["L1_3J20_4J20.0ETA49_MJJ-400", + "L1_3J25.ETA23", + "L1_4J20", + "L1_3J15_BTAG-MU4J15", + "L1_MJJ-700", + "L1_MJJ-400", + "L1_EM15VH", + "L1_EM13VH"] # based on TriggerMenu-00-09-41-12 for MC15 production + + +# Run2MCTriggers=["HLT_2j55_bloose_L13J20_4J20.0ETA49_MJJ-400", +# "HLT_2j55_bmedium_2j55_L13J25.ETA23", +# "HLT_2j45_btight_2j45_L13J25.ETA23", +# "HLT_2j55_bloose_L1J30_2J20_4J20.0ETA49_MJJ-400", +# "HLT_mu4_3j35_dr05_j35_bloose_L13J15_BTAG-MU4J15", +# "HLT_mu4_3j35_dr05_j35_bloose_L14J20", +# "HLT_g20_loose_2j40_0eta490_3j25_0eta490_L1MJJ-700", +# "HLT_g20_loose_2j40_0eta490_3j25_0eta490_L1MJJ-700", +# "HLT_g20_loose_2j40_0eta490_3j25_0eta490"] + +beamEnergy = jobproperties.Beam.energy() +from DerivationFrameworkHiggs.DerivationFrameworkHiggsConf import DerivationFramework__SkimmingToolHIGG5VBF +if (beamEnergy < 4.1e+06): # 8 TeV - Run1 + if (is_MC): + HIGG5D3SkimmingTool = DerivationFramework__SkimmingToolHIGG5VBF(name = "HIGG5D3SkimmingTool", + JetContainerKey = "AntiKt4EMTopoJets", + # jet multiplicity requirement 2b + 2j + ReqNAllJets = True, + NumberOfAllJets = 4, + AllJetPtCut = 40.*Units.GeV, + AllJetEtaCut = 4.9, + # jet multiplicity requirement in track fiducial volume (for b-tagged jet) + ReqNCentralJets = True, + NumberOfCentralJets = 2, + CentralJetPtCut = 40.*Units.GeV, + CentralJetEtaCut = 2.6, + # trigger requirement + ReqTrigger = False, + Triggers = [], + # Mjj requirement + ReqVBFMjj = True, + MjjCut = 200.*Units.GeV, # used to control event rate (and according to trigger threshold in Run2) + DoDebug = False, + #photon requirement (p. rose) + PhotonContainerKey = "Photons", + ReqPhoton = True, + PhotonPtCut = 15.*Units.GeV, + CentralPhotonEtaCut = 2.6) + + else : + HIGG5D3SkimmingTool = DerivationFramework__SkimmingToolHIGG5VBF(name = "HIGG5D3SkimmingTool", + JetContainerKey = "AntiKt4EMTopoJets", + # jet multiplicity requirement 2b + 2j + ReqNAllJets = True, + NumberOfAllJets = 4, + AllJetPtCut = 40.*Units.GeV, + AllJetEtaCut = 4.9, + # jet multiplicity requirement in track fiducial volume (for b-tagged jet) + ReqNCentralJets = True, + NumberOfCentralJets = 2, + CentralJetPtCut = 40.*Units.GeV, + CentralJetEtaCut = 2.6, + # trigger requirement + ReqTrigger = True, + #Triggers = ["EF_2b35_loose_4j35_a4tchad","EF_b35_medium_j35_a4tchad_vbf_3L1J15_FJ15","EF_b35_medium_j35_a4tchad_vbf_2L1FJ15", "EF_g20_loose"], + Triggers = ["HLT_2b35_loose_4j35_a4tchad","HLT_b35_medium_j35_a4tchad_vbf_3L1J15_FJ15","HLT_b35_medium_j35_a4tchad_vbf_2L1FJ15", "HLT_g20_loose"], + # Mjj requirement + ReqVBFMjj = True, + MjjCut = 200.*Units.GeV, # used to control event rate (and according to trigger threshold in Run2) + DoDebug = False, + + #photon requirement (p. rose) + PhotonContainerKey = "Photons", + ReqPhoton = True, + PhotonPtCut = 20.*Units.GeV, + CentralPhotonEtaCut = 2.6) + +if (beamEnergy > 6.0e+06): # 13 TeV - Run2 + if (is_MC): + HIGG5D3SkimmingTool = DerivationFramework__SkimmingToolHIGG5VBF(name = "HIGG5D3SkimmingTool", + JetContainerKey = "AntiKt4EMTopoJets", + # jet multiplicity requirement 2b + 2j + ReqNAllJets = False, + NumberOfAllJets = 4, + AllJetPtCut = 40.*Units.GeV, + AllJetEtaCut = 4.9, + # jet multiplicity requirement in track fiducial volume (for b-tagged jet) + ReqNCentralJets = True, + NumberOfCentralJets = 2, + CentralJetPtCut = 15.*Units.GeV, # to be adjusted according to b-jet trigger pT threshold + CentralJetEtaCut = 2.6, + # trigger requirement + ReqTrigger = True, + Triggers = Run2MCTriggers, + # Mjj requirement + ReqVBFMjj = False, + MjjCut = 200.*Units.GeV, # used to control event rate (and according to trigger threshold in Run2) + DoDebug = False, + #photon requirement (p. rose) + PhotonContainerKey = "Photons", + ReqPhoton = False, + PhotonPtCut = 20.*Units.GeV, + CentralPhotonEtaCut = 2.6) + else: + HIGG5D3SkimmingTool = DerivationFramework__SkimmingToolHIGG5VBF(name = "HIGG5D3SkimmingTool", + JetContainerKey = "AntiKt4EMTopoJets", + # jet multiplicity requirement 2b + 2j + ReqNAllJets = False, + NumberOfAllJets = 4, + AllJetPtCut = 40.*Units.GeV, + AllJetEtaCut = 4.9, + # jet multiplicity requirement in track fiducial volume (for b-tagged jet) + ReqNCentralJets = True, + NumberOfCentralJets = 2, + CentralJetPtCut = 15.*Units.GeV, # to be adjusted according to b-jet trigger pT threshold + CentralJetEtaCut = 2.6, + # trigger requirement + ReqTrigger = True, + Triggers = Run2DataTriggers, + # Mjj requirement + ReqVBFMjj = False, + MjjCut = 200.*Units.GeV, # used to control event rate (and according to trigger threshold in Run2) + DoDebug = False, + #photon requirement (p. rose) + PhotonContainerKey = "Photons", + ReqPhoton = False, + PhotonPtCut = 20.*Units.GeV, + CentralPhotonEtaCut = 2.6) + +ToolSvc += HIGG5D3SkimmingTool + +#print HIGG5D3SkimmingTool + + +#======================================= +# CREATE PRIVATE SEQUENCE +#======================================= +higg5d3Seq = CfgMgr.AthSequencer("HIGG5D3Sequence") + +# Then apply the TruthWZ fix +if globalflags.DataSource()=='geant4': + replaceBuggyAntiKt4TruthWZJets(higg5d3Seq,'HIGG5D3') + replaceBuggyAntiKt10TruthWZJets(higg5d3Seq,'HIGG5D3') + +# Jet calibration should come after fat jets +applyJetCalibration_xAODColl(jetalg="AntiKt4EMTopo", sequence=higg5d3Seq) + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel + +higg5d3Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D3Kernel_obj", + SkimmingTools = [HIGG5D3SkimmingTool] + ) + + +#==================================================================== +# Special jets +#==================================================================== +if not "HIGG5D3Jets" in OutputJets: + OutputJets["HIGG5D3Jets"] = ["AntiKt3PV0TrackJets","AntiKt2PV0TrackJets","AntiKt10LCTopoJets","CamKt12LCTopoJets"] + + if jetFlags.useTruth: + OutputJets["HIGG5D3Jets"].append("AntiKt4TruthJets") + OutputJets["HIGG5D3Jets"].append("AntiKt4TruthWZJets") + # OutputJets["HIGG5D3Jets"].append("AntiKt10TruthWZJets") + # OutputJets["HIGG5D3Jets"].append("AntiKt10TruthJets") + #OutputJets["HIGG5D3Jets"].append("CamKt12TruthJets") + addTrimmedJets("AntiKt", 1.0, "TruthWZ", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg5d3Seq,outputGroup="HIGG5D3Jets") + + addFilteredJets("CamKt", 1.2, "LCTopo", mumax=1.0, ymin=0.15, includePreTools=False, algseq=higg5d3Seq,outputGroup="HIGG5D3Jets") + addTrimmedJets("AntiKt", 1.0, "LCTopo", rclus=0.2, ptfrac=0.05, includePreTools=False, algseq=higg5d3Seq,outputGroup="HIGG5D3Jets") + + +higg5d3Seq += CfgMgr.DerivationFramework__DerivationKernel( + "HIGG5D3Kernel", + ThinningTools = thinningTools + ) + + +applyJetCalibration_CustomColl(jetalg="AntiKt10LCTopoTrimmedPtFrac5SmallR20", sequence=higg5d3Seq) + + +DerivationFrameworkJob += higg5d3Seq + + +# # Thinning +# from AthenaServices.Configurables import ThinningSvc, createThinningSvc +# augStream = MSMgr.GetStream( streamName ) +# evtStream = augStream.GetEventStream() +# svcMgr += createThinningSvc( svcName=HIGG5D3ThinningHelper.ThinningSvc(), outStreams=[evtStream] ) + +#==================================================================== +# Add the containers to the output stream - slimming done here +#===================o================================================= +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +#from DerivationFrameworkHiggs.HIGG5D3ContentList import HIGG5D3Content +from DerivationFrameworkHiggs.HIGG5D3ExtraContent import * +HIGG5D3SlimmingHelper = SlimmingHelper("HIGG5D3SlimmingHelper") + +HIGG5D3SlimmingHelper.SmartCollections = [ "Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + "BTagging_AntiKt4EMTopo", + "BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + +HIGG5D3SlimmingHelper.ExtraVariables = ExtraContent +HIGG5D3SlimmingHelper.AllVariables = ExtraContainers +if (is_MC) : + HIGG5D3SlimmingHelper.ExtraVariables += ExtraContentTruth + HIGG5D3SlimmingHelper.AllVariables += ExtraContainersTruth + +# Add the jet containers to the stream +addJetOutputs(HIGG5D3SlimmingHelper,["HIGG5D3Jets"]) +# Add the MET containers to the stream +addMETOutputs(HIGG5D3SlimmingHelper,["AntiKt4LCTopo","Track"]) + +#HIGG5D3SlimmingHelper.IncludeMuonTriggerContent = True +HIGG5D3SlimmingHelper.IncludeEGammaTriggerContent = True +#HIGG5D3SlimmingHelper.IncludeBPhysTriggerContent = True +#HIGG5D3SlimmingHelper.IncludeJetTauEtMissTriggerContent = True +#HIGG5D3SlimmingHelper.IncludeEtMissTriggerContent = True +HIGG5D3SlimmingHelper.IncludeJetTriggerContent = True +HIGG5D3SlimmingHelper.IncludeBJetTriggerContent = True + +HIGG5D3SlimmingHelper.AppendContentToStream(HIGG5D3Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py new file mode 100644 index 0000000000000000000000000000000000000000..b894647d14b56a93eefeb913fd588070a6335a9b --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py @@ -0,0 +1,319 @@ +#******************************************************************** +# HIGG6D1.py (for H+ -> tau-jet) +# reductionConf flag HIGG6D1 in Reco_tf.py +#******************************************************************** + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * + +#Include common variables from CP groups +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * + +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +applyJetCalibration_xAODColl(jetalg="AntiKt4EMTopo") + +import AthenaCommon.SystemOfUnits as Units +from AthenaCommon.GlobalFlags import globalflags +from AthenaCommon.BeamFlags import jobproperties + +# testing globalflags +is_MC = (globalflags.DataSource()=='geant4') +print "is_MC = ",is_MC +print "HIGG6D1.py globalflags.DataSource()", globalflags.DataSource() +print "HIGG6D1.py jobproperties.Beam.energy()", jobproperties.Beam.energy() + +if is_MC: + from DerivationFrameworkMCTruth.MCTruthCommon import * + +#==================================================================== +# TAU SELECTOR TOOL +#==================================================================== +augmentationTools = [] + +from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauSelectionWrapper +HIGG6D1TauWrapper = DerivationFramework__TauSelectionWrapper(name = "HIGG6D1TauSelectionWrapper", + #IsTauFlag = IsTauFlag.JetBDTSigLoose, + IsTauFlag = 19, + CollectionName = "TauJets", + StoreGateEntryName = "HIGG6D1JetBDTSigLoose") +ToolSvc += HIGG6D1TauWrapper +augmentationTools.append(HIGG6D1TauWrapper) + +#======================================= +# Tau truth matching tool +#======================================= + +#truth matching +if is_MC: + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool + HIGG6D1TauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(name="HIGG6D1TauTruthMatchingTool", + WriteTruthTaus = True) + + + ToolSvc += HIGG6D1TauTruthMatchingTool + + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper + HIGG6D1TauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper( name = "HIGG6D1TauTruthMatchingWrapper", + TauTruthMatchingTool = HIGG6D1TauTruthMatchingTool, + TauContainerName = "TauJets") + + ToolSvc += HIGG6D1TauTruthMatchingWrapper + augmentationTools.append(HIGG6D1TauTruthMatchingWrapper) + +#==================================================================== +# MC selection +#==================================================================== +MCselection = '1' +#if is_MC: MCselection = '(EventInfo.eventTypeBitmask==1)' + +#==================================================================== +# jet selection - jets with pt>20 and |eta|<2.5 +#==================================================================== +jetSelEM = ' count ((AntiKt4EMTopoJets.pt > 20.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6)) >= 4' +jetSelLC = ' count ((AntiKt4LCTopoJets.pt > 20.0*GeV) && (abs(AntiKt4LCTopoJets.eta) < 2.6)) >= 4' +jetSelEMCalib = ' count ((AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 20.0*GeV) && (abs(AntiKt4EMTopoJets.DFCommonJets_Calib_eta) < 2.6)) >= 4' +jetSel = '( '+ jetSelEM + ' ) || ( '+ jetSelLC + ' ) || ( '+ jetSelEMCalib + ' )' + +#============================================================================================= +# tau selection - tau pt>25GeV, with Ntracks=1,3 and |q_\tau|=1 and |eta|<2.6 +#============================================================================================= +tauSel = '(TauJets.pt > 25*GeV && (abs(TauJets.eta)<2.6) && (abs(TauJets.charge)<3) && ((TauJets.nTracks == 1) || (TauJets.nTracks == 2) || (TauJets.nTracks == 3) ) )' + +#==================================================================== +# Trigger selection +#==================================================================== +if jobproperties.Beam.energy()==6500000.0: + # 13 TeV name should be HLT_xxx + singleElectronTriggerRequirement='(HLT_e28_lhtight_iloose || HLT_e60_lhmedium)' + singleMuonTriggerRequirement='(HLT_mu26_imedium || HLT_mu50)' + singleLepTrigger='('+singleElectronTriggerRequirement+'||'+singleMuonTriggerRequirement+')' + TauMETtrigSel = '(HLT_tau35_medium1_tracktwo_L1TAU20_xe70_L1XE45 || HLT_tau35_medium1_tracktwo_xe70_L1XE45 || HLT_xe70 || HLT_xe80 || HLT_xe100 || HLT_j30_xe10_razor170 || HLT_j30_xe10_razor185 || HLT_j30_xe60_razor170 )' + BjetTrigger = 'HLT_j75_bmedium_3j75' +elif jobproperties.Beam.energy()==4000000.0: + # 8 TeV name should be EF_xxx + singleElectronTriggerRequirement='(EF_e24vhi_medium1 || EF_e60_medium1)' + singleMuonTriggerRequirement='(EF_mu24i_tight || EF_mu36_tight)' + singleLepTrigger='('+singleElectronTriggerRequirement+'||'+singleMuonTriggerRequirement+')' + TauMETtrigSel = '(tau29T_medium1_xe40_tight || tau29T_medium1_xe50tclcw_tight || tau27T_medium1_L2loose_xe50_tclcw_tight)' + + + +#======================================================================== +# lepton selection +#======================================================================== +electronRequirements = '( (Electrons.pt > 25*GeV) && (abs(Electrons.eta) < 2.6) && (Electrons.Loose || Electrons.DFCommonElectronsLHLoose) )' +muonRequirements = '( (Muons.pt > 25.0*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonGoodMuon) )' +lepSel = '( (count( ' + electronRequirements + ' ) >=1) || (count( ' + muonRequirements + ' ) >=1 ) )' + + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +#(keep trigger off for future studies) +#expression = '( '+ jetSel + ' ) && (count( ' + tauSel + ' ) >= 1) && ( ' +MCselection + ' ) && ( ' + TauMETtrigSel + ' )' +expression = '( '+ jetSel + ' ) && (count( ' + tauSel + ' ) >= 1) && ( ' +MCselection + ' )' + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG6D1SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG6D1SkimmingTool1", + expression = expression) +ToolSvc += HIGG6D1SkimmingTool +print HIGG6D1SkimmingTool + + + +#==================================================================== +# THINNING TOOLS +#==================================================================== + +thinningTools=[] + +#==================================================================== +# GenericTrackParticleThinning +#==================================================================== +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG6D1GenTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D1GenTPThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +thinningTools.append(HIGG6D1GenTPThinningTool) +ToolSvc += HIGG6D1GenTPThinningTool + + +#==================================================================== +# JetTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG6D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG6D1JetTPThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + + +thinningTools.append(HIGG6D1JetTPThinningTool) +ToolSvc += HIGG6D1JetTPThinningTool + +#==================================================================== +# TauTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG6D1TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG6D1TauTPThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + TauKey = "TauJets", + InDetTrackParticlesKey = "InDetTrackParticles", +# SelectionString = tauSel, + ConeSize = 0.6, + ApplyAnd = False) + +thinningTools.append(HIGG6D1TauTPThinningTool) +ToolSvc += HIGG6D1TauTPThinningTool + +#==================================================================== +# MuonTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG6D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name= "HIGG6D1MuonTPThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles", +# SelectionString = muonRequirements, + ConeSize = 0.4, + ApplyAnd = False) + +thinningTools.append(HIGG6D1MuonTPThinningTool) +ToolSvc += HIGG6D1MuonTPThinningTool + +#==================================================================== +# EgammaTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG6D1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name= "HIGG6D1ElectronTPThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", +# SelectionString = electronRequirements, + ConeSize = 0.4, + ApplyAnd = False) + +thinningTools.append(HIGG6D1ElectronTPThinningTool) +ToolSvc += HIGG6D1ElectronTPThinningTool + +#==================================================================== +# Tracks themselves +#==================================================================== +HIGG6D1TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D1TPThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", + InDetTrackParticlesKey = "InDetTrackParticles") + +thinningTools.append(HIGG6D1TPThinningTool) +ToolSvc += HIGG6D1TPThinningTool + +#==================================================================== +# Truth particles thinning +#==================================================================== + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning +HIGG6D1TruthThinningTool = DerivationFramework__MenuTruthThinning(name = "HIGG6D1TruthThinningTool", + ThinningService = "HIGG6D1ThinningSvc", + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = True, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = True, + WriteBosons = True, + WriteBSMProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = False, + WriteLeptonsNotFromHadrons = True, + WriteStatus3 = True, + WriteFirstN = -1, + PreserveGeneratorDescendants = True, + PreserveDescendants = False) +if is_MC: + ToolSvc += HIGG6D1TruthThinningTool + thinningTools.append(HIGG6D1TruthThinningTool) + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= + +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG6D1Kernel", + AugmentationTools = augmentationTools, + SkimmingTools = [HIGG6D1SkimmingTool], + ThinningTools = thinningTools + ) + + + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG6D1Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG6D1Stream ) +HIGG6D1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG6D1Stream.AcceptAlgs(["HIGG6D1Kernel"]) +# Special lines for thinning +# Thinning service name must match the one passed to the thinning tools +from AthenaServices.Configurables import ThinningSvc, createThinningSvc +augStream = MSMgr.GetStream( streamName ) +evtStream = augStream.GetEventStream() +svcMgr += createThinningSvc( svcName="HIGG6D1ThinningSvc", outStreams=[evtStream] ) + +#==================================================================== +# Add the containers to the output stream - slimming done here (smart slimming) +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG6D1SlimmingHelper = SlimmingHelper("HIGG6D1SlimmingHelper") + +## Smart Slimming +HIGG6D1SlimmingHelper.SmartCollections = ["Electrons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4LCTopo", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4LCTopoJets", + "AntiKt4EMTopoJets", + "BTagging_AntiKt4LCTopo", + "BTagging_AntiKt4EMTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + + +## Add extra variables +HIGG6D1SlimmingHelper.ExtraVariables += ["AntiKt4EMTopoJets.DFCommonJets_Calib_pt.DFCommonJets_Calib_eta"] +HIGG6D1SlimmingHelper.ExtraVariables += ["TauJets.BDTEleScore.pantau_CellBasedInput_isPanTauCandidate.pantau_CellBasedInput_DecayMode.ptPanTauCellBased.etaPanTauCellBased.phiPanTauCellBased.mPanTauCellBased.pantau_CellBasedInput_BDTValue_1p0n_vs_1p1n.pantau_CellBasedInput_BDTValue_1p1n_vs_1pXn.pantau_CellBasedInput_BDTValue_3p0n_vs_3pXn","TauNeutralParticleFlowObjects.pt.eta.phi.m.rapidity.bdtPi0Score"] +HIGG6D1SlimmingHelper.ExtraVariables += ["Electrons.DFCommonElectronsLHLoose.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsML.author.OQ.charge.LHLoose.LHMedium.LHTight.LHValue"] +HIGG6D1SlimmingHelper.ExtraVariables += ["Muons.DFCommonGoodMuons","CombinedMuonTrackParticles.d0.z0.vz","InDetTrackParticles.numberOfTRTHits.numberOfTRTOutliers"] +HIGG6D1SlimmingHelper.ExtraVariables += ["PrimaryVertices.x.y.z.vertexType"] + +if is_MC: + HIGG6D1SlimmingHelper.StaticContent = ["xAOD::TruthParticleContainer#TruthMuons","xAOD::TruthParticleAuxContainer#TruthMuonsAux.","xAOD::TruthParticleContainer#TruthElectrons","xAOD::TruthParticleAuxContainer#TruthElectronsAux.","xAOD::TruthParticleContainer#TruthPhotons","xAOD::TruthParticleAuxContainer#TruthPhotonsAux.","xAOD::TruthParticleContainer#TruthNeutrinos","xAOD::TruthParticleAuxContainer#TruthNeutrinosAux.","xAOD::TruthParticleContainer#TruthTaus","xAOD::TruthParticleAuxContainer#TruthTausAux."] + HIGG6D1SlimmingHelper.AllVariables = ["TruthParticles","TruthEvents","MET_Truth","METMap_Truth","TruthVertices","AntiKt4TruthJets"] + HIGG6D1SlimmingHelper.ExtraVariables += ["AntiKt4LCTopoJets.PartonTruthLabelID.TruthLabelDeltaR_B.TruthLabelDeltaR_C.TruthLabelDeltaR_T"] + HIGG6D1SlimmingHelper.ExtraVariables += ["AntiKt4EMTopoJets.PartonTruthLabelID.TruthLabelDeltaR_B.TruthLabelDeltaR_C.TruthLabelDeltaR_T"] + HIGG6D1SlimmingHelper.ExtraVariables += ["Electrons.truthOrigin.truthType.truthParticleLink","MuonTruthParticles.truthOrigin.truthType"] + HIGG6D1SlimmingHelper.ExtraVariables += ["TauJets.IsTruthMatched.truthParticleLink"] + +# Add MET_RefFinalFix +addMETOutputs(HIGG6D1SlimmingHelper,["AntiKt4LCTopo","AntiKt4EMTopo","Track"]) + +#HIGG6D1SlimmingHelper.IncludeJetTauEtMissTriggerContent = True +#JetTauEtMissTriggerContent: now splitted in 4 slices, use only Tau and MET +HIGG6D1SlimmingHelper.IncludeEtMissTriggerContent = True +HIGG6D1SlimmingHelper.IncludeTauTriggerContent = True +HIGG6D1SlimmingHelper.IncludeJetTriggerContent = True + +HIGG6D1SlimmingHelper.AppendContentToStream(HIGG6D1Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py new file mode 100644 index 0000000000000000000000000000000000000000..78f33bcaa13290f40adde0bfeac1ea60afbc72d6 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py @@ -0,0 +1,318 @@ +#******************************************************************** +# HIGG6D2.py (for H+ -> tau-lep) +# reductionConf flag HIGG6D2 in Reco_tf.py +#******************************************************************** + +# Set up common services and job object. +# This should appear in ALL derivation job options +from DerivationFrameworkCore.DerivationFrameworkMaster import * + +#Include common variables from CP groups +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * + +from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +applyJetCalibration_xAODColl(jetalg="AntiKt4EMTopo") + +import AthenaCommon.SystemOfUnits as Units +from AthenaCommon.GlobalFlags import globalflags +from AthenaCommon.BeamFlags import jobproperties + +# testing globalflags +is_MC = (globalflags.DataSource()=='geant4') +print "is_MC = ",is_MC +print "HIGG6D2.py globalflags.DataSource()", globalflags.DataSource() +print "HIGG6D2.py jobproperties.Beam.energy()", jobproperties.Beam.energy() + +if is_MC: + from DerivationFrameworkMCTruth.MCTruthCommon import * + +#==================================================================== +# TAU SELECTOR TOOL +#==================================================================== +augmentationTools = [] +from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauSelectionWrapper +HIGG6D2TauWrapper = DerivationFramework__TauSelectionWrapper(name = "HIGG6D2TauSelectionWrapper", + #IsTauFlag = IsTauFlag.JetBDTSigLoose, + IsTauFlag = 19, + CollectionName = "TauJets", + StoreGateEntryName = "HIGG6D2JetBDTSigLoose") +ToolSvc += HIGG6D2TauWrapper +augmentationTools.append(HIGG6D2TauWrapper) +#======================================= +# Tau truth matching tool +#======================================= + +#truth matching +if is_MC: + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool + HIGG6D2TauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(name="HIGG6D2TauTruthMatchingTool", + WriteTruthTaus = True) + + + ToolSvc += HIGG6D2TauTruthMatchingTool + + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper + HIGG6D2TauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper( name = "HIGG6D2TauTruthMatchingWrapper", + TauTruthMatchingTool = HIGG6D2TauTruthMatchingTool, + TauContainerName = "TauJets") + + ToolSvc += HIGG6D2TauTruthMatchingWrapper + augmentationTools.append(HIGG6D2TauTruthMatchingWrapper) + + +#==================================================================== +# MC selection +#==================================================================== +MCselection = '1' +#if is_MC: MCselection = '(EventInfo.eventTypeBitmask==1)' + +#==================================================================== +# jet selection - jets with pt>20 and |eta|<2.6 +#==================================================================== +jetSelEM = ' count ((AntiKt4EMTopoJets.pt > 20.0*GeV) && (abs(AntiKt4EMTopoJets.eta) < 2.6)) >= 2' +jetSelLC = ' count ((AntiKt4LCTopoJets.pt > 20.0*GeV) && (abs(AntiKt4LCTopoJets.eta) < 2.6)) >= 2' +jetSelEMCalib = ' count ((AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 20.0*GeV) && (abs(AntiKt4EMTopoJets.DFCommonJets_Calib_eta) < 2.6)) >= 2' +jetSel = '( '+ jetSelEM + ' ) || ( '+ jetSelLC + ' ) || ( '+ jetSelEMCalib + ' )' + + +#============================================================================================= +# tau selection - tau pt>25GeV, with Ntracks=1,3 and |q_\tau|=1 and |eta|<2.6 +#============================================================================================= +tauSel = '(TauJets.pt > 25*GeV && (abs(TauJets.eta)<2.6) && (abs(TauJets.charge)<3) && ( (TauJets.nTracks == 1) || (TauJets.nTracks == 2) || (TauJets.nTracks == 3) ) )' + +#==================================================================== +# Trigger selection +#==================================================================== +if jobproperties.Beam.energy()==6500000.0: + # 13 TeV name should be HLT_xxx + singleElectronTriggerRequirement='(HLT_e28_lhtight_iloose || HLT_e60_lhmedium)' + singleMuonTriggerRequirement='(HLT_mu26_imedium || HLT_mu50)' + singleLepTrigger='('+singleElectronTriggerRequirement+'||'+singleMuonTriggerRequirement+')' + TauMETtrigSel = '(HLT_tau35_medium1_tracktwo_L1TAU20_xe70_L1XE45 || HLT_tau35_medium1_tracktwo_xe70_L1XE45 || HLT_xe70 || HLT_xe80 || HLT_xe100 || HLT_j30_xe10_razor170 || HLT_j30_xe10_razor185 || HLT_j30_xe60_razor170 )' + BjetTrigger = 'HLT_j75_bmedium_3j75' +elif jobproperties.Beam.energy()==4000000.0: + # 8 TeV name should be EF_xxx + singleElectronTriggerRequirement='(EF_e24vhi_medium1 || EF_e60_medium1)' + singleMuonTriggerRequirement='(EF_mu24i_tight || EF_mu36_tight)' + singleLepTrigger='('+singleElectronTriggerRequirement+'||'+singleMuonTriggerRequirement+')' + TauMETtrigSel = '(tau29T_medium1_xe40_tight || tau29T_medium1_xe50tclcw_tight || tau27T_medium1_L2loose_xe50_tclcw_tight)' + + + +#======================================================================== +# lepton selection +#======================================================================== +electronRequirements = '( (Electrons.pt > 25*GeV) && (abs(Electrons.eta) < 2.6) && (Electrons.Loose || Electrons.DFCommonElectronsLHLoose) )' +muonRequirements = '( (Muons.pt > 25.0*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonGoodMuon) )' +lepSel = '( (count( ' + electronRequirements + ' ) >=1) || (count( ' + muonRequirements + ' ) >=1 ) )' + + +#==================================================================== +# SKIMMING TOOL +#==================================================================== +#expression = '(count( '+ lepSel + ' ) >= 1) && (count( ' + tauSel + ' ) >= 1) && ( ' +MCselection + ' ) && ( ' + singleLepTrigger + ' )' +expression = '( '+ jetSel + ' ) && ( '+ lepSel + ' ) && (count( ' + tauSel + ' ) >= 1) && ( ' +MCselection + ' )' + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG6D2SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG6D2SkimmingTool1", + expression = expression) +ToolSvc += HIGG6D2SkimmingTool +print HIGG6D2SkimmingTool + + +#==================================================================== +# THINNING TOOLS +#==================================================================== + +thinningTools=[] + +#==================================================================== +# GenericTrackParticleThinning +#==================================================================== +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG6D2GenTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D2GenTPThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +thinningTools.append(HIGG6D2GenTPThinningTool) +ToolSvc += HIGG6D2GenTPThinningTool + +#==================================================================== +# JetTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG6D2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG6D2JetTPThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) + + +thinningTools.append(HIGG6D2JetTPThinningTool) +ToolSvc += HIGG6D2JetTPThinningTool + + +#==================================================================== +# TauTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG6D2TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "HIGG6D2TauTPThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + TauKey = "TauJets", + InDetTrackParticlesKey = "InDetTrackParticles", +# SelectionString = tauSel, + ConeSize = 0.6, + ApplyAnd = False) + +thinningTools.append(HIGG6D2TauTPThinningTool) +ToolSvc += HIGG6D2TauTPThinningTool + +#==================================================================== +# MuonTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG6D2MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name= "HIGG6D2MuonTPThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles", +# SelectionString = muonRequirements, + ConeSize = 0.4, + ApplyAnd = False) + +thinningTools.append(HIGG6D2MuonTPThinningTool) +ToolSvc += HIGG6D2MuonTPThinningTool + +#==================================================================== +# EgammaTrackParticleThinning +#==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG6D2ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name= "HIGG6D2ElectronTPThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles", +# SelectionString = electronRequirements, + ConeSize = 0.4, + ApplyAnd = False) + +thinningTools.append(HIGG6D2ElectronTPThinningTool) +ToolSvc += HIGG6D2ElectronTPThinningTool + +#==================================================================== +# Tracks themselves +#==================================================================== +HIGG6D2TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D2TPThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", + InDetTrackParticlesKey = "InDetTrackParticles") + +thinningTools.append(HIGG6D2TPThinningTool) +ToolSvc += HIGG6D2TPThinningTool + +#==================================================================== +# Truth particles thinning +#==================================================================== + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning +HIGG6D2TruthThinningTool = DerivationFramework__MenuTruthThinning(name = "HIGG6D2TruthThinningTool", + ThinningService = "HIGG6D2ThinningSvc", + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = True, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = True, + WriteBosons = True, + WriteBSMProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = False, + WriteLeptonsNotFromHadrons = True, + WriteStatus3 = True, + WriteFirstN = -1, + PreserveGeneratorDescendants = True, + PreserveDescendants = False) + +if is_MC: + ToolSvc += HIGG6D2TruthThinningTool + thinningTools.append(HIGG6D2TruthThinningTool) + + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= + +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG6D2Kernel", + AugmentationTools = augmentationTools, + SkimmingTools = [HIGG6D2SkimmingTool], + ThinningTools = thinningTools + ) + + + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG6D2Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG6D2Stream ) +HIGG6D2Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG6D2Stream.AcceptAlgs(["HIGG6D2Kernel"]) +# Special lines for thinning +# Thinning service name must match the one passed to the thinning tools +from AthenaServices.Configurables import ThinningSvc, createThinningSvc +augStream = MSMgr.GetStream( streamName ) +evtStream = augStream.GetEventStream() +svcMgr += createThinningSvc( svcName="HIGG6D2ThinningSvc", outStreams=[evtStream] ) + +#==================================================================== +# Add the containers to the output stream - slimming done here (smart slimming) +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG6D2SlimmingHelper = SlimmingHelper("HIGG6D2SlimmingHelper") + +## Smart Slimming +HIGG6D2SlimmingHelper.SmartCollections = ["Electrons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4LCTopo", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4LCTopoJets", + "AntiKt4EMTopoJets", + "BTagging_AntiKt4LCTopo", + "BTagging_AntiKt4EMTopo", + "InDetTrackParticles", + "PrimaryVertices" ] + + +## Add extra variables +HIGG6D2SlimmingHelper.ExtraVariables += ["AntiKt4EMTopoJets.DFCommonJets_Calib_pt.DFCommonJets_Calib_eta"] +HIGG6D2SlimmingHelper.ExtraVariables += ["TauJets.BDTEleScore.pantau_CellBasedInput_isPanTauCandidate.pantau_CellBasedInput_DecayMode.ptPanTauCellBased.etaPanTauCellBased.phiPanTauCellBased.mPanTauCellBased.pantau_CellBasedInput_BDTValue_1p0n_vs_1p1n.pantau_CellBasedInput_BDTValue_1p1n_vs_1pXn.pantau_CellBasedInput_BDTValue_3p0n_vs_3pXn","TauNeutralParticleFlowObjects.pt.eta.phi.m.rapidity.bdtPi0Score"] +HIGG6D2SlimmingHelper.ExtraVariables += ["Electrons.DFCommonElectronsLHLoose.DFCommonElectronsLHMedium.DFCommonElectronsLHTight.DFCommonElectronsML.author.OQ.charge.LHLoose.LHMedium.LHTight.LHValue"] +HIGG6D2SlimmingHelper.ExtraVariables += ["Muons.DFCommonGoodMuons","CombinedMuonTrackParticles.d0.z0.vz","InDetTrackParticles.numberOfTRTHits.numberOfTRTOutliers"] +HIGG6D2SlimmingHelper.ExtraVariables += ["PrimaryVertices.x.y.z.vertexType"] + +if is_MC: + HIGG6D2SlimmingHelper.StaticContent = ["xAOD::TruthParticleContainer#TruthMuons","xAOD::TruthParticleAuxContainer#TruthMuonsAux.","xAOD::TruthParticleContainer#TruthElectrons","xAOD::TruthParticleAuxContainer#TruthElectronsAux.","xAOD::TruthParticleContainer#TruthPhotons","xAOD::TruthParticleAuxContainer#TruthPhotonsAux.","xAOD::TruthParticleContainer#TruthNeutrinos","xAOD::TruthParticleAuxContainer#TruthNeutrinosAux.","xAOD::TruthParticleContainer#TruthTaus","xAOD::TruthParticleAuxContainer#TruthTausAux."] + HIGG6D2SlimmingHelper.AllVariables = ["TruthParticles","TruthEvents","MET_Truth","METMap_Truth","TruthVertices","AntiKt4TruthJets"] + HIGG6D2SlimmingHelper.ExtraVariables += ["AntiKt4LCTopoJets.PartonTruthLabelID.TruthLabelDeltaR_B.TruthLabelDeltaR_C.TruthLabelDeltaR_T"] + HIGG6D2SlimmingHelper.ExtraVariables += ["AntiKt4EMTopoJets.PartonTruthLabelID.TruthLabelDeltaR_B.TruthLabelDeltaR_C.TruthLabelDeltaR_T"] + HIGG6D2SlimmingHelper.ExtraVariables += ["Electrons.truthOrigin.truthType.truthParticleLink","MuonTruthParticles.truthOrigin.truthType"] + HIGG6D2SlimmingHelper.ExtraVariables += ["TauJets.IsTruthMatched.truthParticleLink"] + +# Add MET_RefFinalFix +addMETOutputs(HIGG6D2SlimmingHelper,["AntiKt4LCTopo","AntiKt4EMTopo","Track"]) +HIGG6D2SlimmingHelper.IncludeMuonTriggerContent = True +HIGG6D2SlimmingHelper.IncludeEGammaTriggerContent = True +HIGG6D2SlimmingHelper.IncludeEtMissTriggerContent = True +HIGG6D2SlimmingHelper.IncludeTauTriggerContent = True +HIGG6D2SlimmingHelper.IncludeJetTriggerContent = True + +HIGG6D2SlimmingHelper.AppendContentToStream(HIGG6D2Stream) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py new file mode 100644 index 0000000000000000000000000000000000000000..b54d3497ce130983e7c620ff77d582dac0e66879 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py @@ -0,0 +1,317 @@ +#******************************************************************** +# HIGG8D1.py +# reductionConf flag HIGG8D1 in Reco_tf.py +#******************************************************************** + +from DerivationFrameworkCore.DerivationFrameworkMaster import * +from DerivationFrameworkInDet.InDetCommon import * +from DerivationFrameworkJetEtMiss.JetCommon import * +#from DerivationFrameworkJetEtMiss.METCommon import * +from DerivationFrameworkEGamma.EGammaCommon import * +from DerivationFrameworkMuons.MuonsCommon import * +from AthenaCommon.GlobalFlags import globalflags + +if globalflags.DataSource()=='geant4': + from DerivationFrameworkMCTruth.MCTruthCommon import * + from DerivationFrameworkMCTruth.HFHadronsCommon import * + +# testing globalflags +is_MC = (globalflags.DataSource()=='geant4') +print "is_MC = ",is_MC + +#==================================================================== +# SET UP STREAM +#==================================================================== +streamName = derivationFlags.WriteDAOD_HIGG8D1Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_HIGG8D1Stream ) +HIGG8D1Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +HIGG8D1Stream.AcceptAlgs(["HIGG8D1Kernel"]) + +# Thinning service name must match the one passed to the thinning tools +#from AthenaServices.Configurables import ThinningSvc, createThinningSvc +#augStream = MSMgr.GetStream( streamName ) +#evtStream = augStream.GetEventStream() +#svcMgr += createThinningSvc( svcName="HIGG8D1ThinningSvc", outStreams=[evtStream] ) + +#==================================================================== +# TAU SELECTOR TOOL +#==================================================================== +augmentationTools = [] + +from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauSelectionWrapper +HIGG8D1TauWrapper = DerivationFramework__TauSelectionWrapper(name = "HIGG8D1TauSelectionWrapper", + IsTauFlag = 19, + CollectionName = "TauJets", + StoreGateEntryName = "HIGG8D1JetBDTSigLoose") +ToolSvc += HIGG8D1TauWrapper +augmentationTools.append(HIGG8D1TauWrapper) + + +#======================================= +# Tau truth matching tool +#======================================= + +#truth matching +if globalflags.DataSource()=='geant4': + from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool + HIGG8D1TauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(name="HIGG8D1TauTruthMatchingTool", + WriteTruthTaus = True) + + + ToolSvc += HIGG8D1TauTruthMatchingTool + + from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper + HIGG8D1TauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper( name = "HIGG8D1TauTruthMatchingWrapper", + TauTruthMatchingTool = HIGG8D1TauTruthMatchingTool, + TauContainerName = "TauJets") + + ToolSvc += HIGG8D1TauTruthMatchingWrapper + augmentationTools.append(HIGG8D1TauTruthMatchingWrapper) + + +#==================================================================== +# THINNING TOOLS +#==================================================================== +thinningTools=[] + +# Establish the thinning helper (which will set up the services behind the scenes) +from DerivationFrameworkCore.ThinningHelper import ThinningHelper +HIGG8D1ThinningHelper = ThinningHelper( "HIGG8D1ThinningHelper" ) +# Trigger Thinning Tool +HIGG8D1ThinningHelper.TriggerChains = 'HLT_e.*|HLT_mu.*|HLT_2e.*|HLT_2mu.*|HLT_tau.*' +HIGG8D1ThinningHelper.AppendToStream( HIGG8D1Stream ) + + +# MET/Jet tracks +thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning +HIGG8D1MetTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG8D1MetTPThinningTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), #"HIGG8D1ThinningSvc + SelectionString = thinning_expression, + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG8D1MetTPThinningTool +thinningTools.append(HIGG8D1MetTPThinningTool) + + +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning +HIGG8D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG8D1JetTPThinningTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + JetKey = "AntiKt4EMTopoJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ApplyAnd = True) +ToolSvc += HIGG8D1JetTPThinningTool +thinningTools.append(HIGG8D1JetTPThinningTool) + + +# Tracks associated with Muons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning +HIGG8D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG8D1MuonTPThinningTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG8D1MuonTPThinningTool +thinningTools.append(HIGG8D1MuonTPThinningTool) + +# Tracks associated with Electrons +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning +HIGG8D1ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "HIGG8D1ElectronTPThinningTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG8D1ElectronTPThinningTool +thinningTools.append(HIGG8D1ElectronTPThinningTool) + +# Tracks associated with Taus +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning +HIGG8D1TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( name = "HIGG8D1TauTPThinningTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + TauKey = "TauJets", + SelectionString = "TauJets.pt > 15*GeV", + ConeSize = 0.6, + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += HIGG8D1TauTPThinningTool +thinningTools.append(HIGG8D1TauTPThinningTool) + +# Electrons - calo cluster thinning +#from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__CaloClusterThinning +from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning +HIGG8D1ElectronCCThinningTool = DerivationFramework__CaloClusterThinning( name = "HIGG8D1ElectronCCThinningTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + SGKey = "Electrons", + CaloClCollectionSGKey = "egammaClusters", + SelectionString = "Electrons.pt >= 5*GeV", + ConeSize = 0.4) +ToolSvc += HIGG8D1ElectronCCThinningTool +thinningTools.append(HIGG8D1ElectronCCThinningTool) + +#==================================================================== +# Truth Thinning +#==================================================================== + +#Truth tau/nutau and their ancestors and descendants +truth_cond_tau = " ((abs(TruthParticles.pdgId) == 15 || abs(TruthParticles.pdgId) == 16) && (TruthParticles.pt > 0.01*GeV) && (TruthParticles.barcode<200000)) " +truth_cond_lep = " ((abs(TruthParticles.pdgId) >= 11 && abs(TruthParticles.pdgId) <= 14) && (TruthParticles.pt > 4.0*GeV) && (TruthParticles.status == 1) && (TruthParticles.barcode<200000)) " +truth_photon = " ((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV)) " +truth_cond_comb = "("+truth_cond_lep+"||"+truth_cond_tau+"||"+truth_photon+")" + +# PreserveGeneratorDescendants only keeps particles that came directly from the event generator +# PreserveDescendants keeps all particles including those that come from Geant processes + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning +HIGG8D1TruthTool = DerivationFramework__GenericTruthThinning(name = "HIGG8D1TruthTool", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_cond_tau, + PreserveDescendants = False, + PreserveGeneratorDescendants = True, + PreserveAncestors = False, + TauHandling = False) + +HIGG8D1TruthTool2 = DerivationFramework__GenericTruthThinning(name = "HIGG8D1TruthTool2", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + ParticleSelectionString = truth_cond_comb, + PreserveDescendants = True, # False + PreserveGeneratorDescendants = False, + PreserveAncestors = True, + TauHandling = False) + + + +from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning +HIGG8D1TruthTool3 = DerivationFramework__MenuTruthThinning(name = "HIGG8D1TruthTool3", + ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + #WritePartons = True, + WritePartons = False, + WriteHadrons = False, + WriteBHadrons = False, + WriteGeant = False, + GeantPhotonPtThresh = -1.0, + WriteTauHad = True, + PartonPtThresh = -1.0, + WriteBSM = False, + WriteBosons = True, + WriteBSMProducts = False, + WriteBosonProducts = True, + WriteTopAndDecays = True, + WriteEverything = False, + WriteAllLeptons = True, + WriteStatus3 = False, + WritettHFHadrons = True, + #PreserveGeneratorDescendants = True, + #PreserveDescendants = True, + #PreserveAncestors = True, + WriteFirstN = -1) + +if globalflags.DataSource()=='geant4': + #ToolSvc += HIGG8D1TruthTool + #thinningTools.append(HIGG8D1TruthTool) + ToolSvc += HIGG8D1TruthTool2 + thinningTools.append(HIGG8D1TruthTool2) + ToolSvc += HIGG8D1TruthTool3 + thinningTools.append(HIGG8D1TruthTool3) + + + +#==================================================================== +# SKIMMING TOOL +#==================================================================== + +#to add: MC event info requirements + +eleRequirements = '(Electrons.pt > 5*GeV) && (abs(Electrons.eta) < 2.6) && (Electrons.Loose || Electrons.DFCommonElectronsLHLoose)' +leadElectron = eleRequirements + ' && (Electrons.pt > 15*GeV)' +muRequirements = '(Muons.DFCommonGoodMuon) && (Muons.muonType == 0) && (Muons.pt > 5*GeV) && (abs(Muons.eta) < 2.6)' +leadMuon = muRequirements + ' && (Muons.pt > 15*GeV)' +tauRequirements = '(TauJets.pt > 15*GeV) && HIGG8D1JetBDTSigLoose && (abs(TauJets.charge)==1.0) && ((TauJets.nTracks == 1) || (TauJets.nTracks == 3))' + +eeSelection = '((count('+eleRequirements+') >= 2) && (count('+leadElectron+') >= 1))' +mmSelection = '((count('+muRequirements+') >= 2) && (count('+leadMuon+') >= 1))' +emSelection = '(((count('+eleRequirements+') >= 1) && (count('+muRequirements+') >= 1)) && ((count('+leadElectron+') >= 1) || (count('+leadMuon+') >= 1)))' + +lepSelection = eeSelection+' || '+mmSelection+' || '+emSelection +tauSelection = '((count('+leadElectron+')+count('+leadMuon+') >= 1) && (count('+tauRequirements+') >= 2))' + +expression = lepSelection+ ' || ' +tauSelection + +from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool +HIGG8D1SkimmingTool = DerivationFramework__xAODStringSkimmingTool( name = "HIGG8D1SkimmingTool1", + expression = expression) +ToolSvc += HIGG8D1SkimmingTool + +#======================================= +# CREATE THE DERIVATION KERNEL ALGORITHM +#======================================= + +from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel +DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel("HIGG8D1Kernel", + ThinningTools = thinningTools, + AugmentationTools = augmentationTools, + SkimmingTools = [HIGG8D1SkimmingTool] + ) + + + + + +#==================================================================== +# Add the containers to the output stream - slimming done here +#==================================================================== +from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper +HIGG8D1SlimmingHelper = SlimmingHelper("HIGG8D1SlimmingHelper") + +## Smart Slimming +HIGG8D1SlimmingHelper.SmartCollections = ["Electrons", + "Muons", + "TauJets", + #"MET_Reference_AntiKt4LCTopo", + #"AntiKt4LCTopoJets", + #"BTagging_AntiKt4LCTopo", + "MET_Reference_AntiKt4EMTopo", + "AntiKt4EMTopoJets", + "BTagging_AntiKt4EMTopo", + "InDetTrackParticles", + "PrimaryVertices"] + +HIGG8D1SlimmingHelper.ExtraVariables = ["Muons.clusterLink.allAuthors.charge.extrapolatedMuonSpectrometerTrackParticleLink.scatteringCurvatureSignificance.scatteringNeighbourSignificance", + "Electrons.author.charge", + "AntiKt4EMTopoJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.ConeTruthLabelID.PartonTruthLabelID.SumPtTrkPt1000.Jvt.JvtJvfcorr.JvtRpt", + "GSFTrackParticles.z0.vz.definingParametersCovMatrix", + "CombinedMuonTrackParticles.z0.vz.definingParametersCovMatrix", + "ExtrapolatedMuonTrackParticles.z0.vz.definingParametersCovMatrix", + "PrimaryVertices.x.y", + "BTagging_AntiKt4Track.SV1_pb.SV1_pc.SV1_pu.IP2D_pb.IP2D_pc.IP2D_pu.IP3D_pb.IP3D_pc.IP3D_pu.JetFitter_pb.JetFitter_pc.JetFitter_pu.JetFitterCombNN_pb.JetFitterCombNN_pc.JetFitterCombNN_pu.MV2c00_discriminant.MV2c10_discriminant.MV2c20_discriminant", + "AntiKt4PV0TrackJets.pt.eta.phi.e.m.rapidity.btaggingLink" + ] + +HIGG8D1SlimmingHelper.AllVariables = ["egammaClusters"] + +if globalflags.DataSource()=='geant4': + HIGG8D1SlimmingHelper.AllVariables += ["TruthParticles", "TruthEvents","TruthVertices","AntiKt4TruthJets"] + HIGG8D1SlimmingHelper.ExtraVariables += ["Electrons.truthOrigin.truthType.truthParticleLink", + "MuonTruthParticles.truthOrigin.truthType.truthParticleLink", + "InDetTrackParticles.truthOrigin.truthType.truthParticleLink", + "CombinedMuonTrackParticles.truthOrigin.truthType.truthParticleLink", + "TauJets.IsTruthMatched.TruthTau.truthParticleLink"] + + HIGG8D1SlimmingHelper.StaticContent = ["xAOD::TruthParticleContainer#TruthMuons", + "xAOD::TruthParticleAuxContainer#TruthMuonsAux.", + "xAOD::TruthParticleContainer#TruthElectrons", + "xAOD::TruthParticleAuxContainer#TruthElectronsAux.", + "xAOD::TruthParticleContainer#TruthNeutrinos", + "xAOD::TruthParticleAuxContainer#TruthNeutrinosAux.", + "xAOD::TruthParticleContainer#TruthTaus", + "xAOD::TruthParticleAuxContainer#TruthTausAux."] + + +HIGG8D1SlimmingHelper.IncludeMuonTriggerContent=True +HIGG8D1SlimmingHelper.IncludeEGammaTriggerContent=True +HIGG8D1SlimmingHelper.IncludeTauTriggerContent=True + +HIGG8D1SlimmingHelper.AppendContentToStream(HIGG8D1Stream) + +# Add MET_RefFinalFix +#addMETOutputs(HIGG8D1Stream) + +# Add TOP dedicated MET (LHElectrons) +#from DerivationFrameworkJetEtMiss.TopCustomMET import * +#addMETOutputs(HIGG8D1Stream,["Top"]) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c1d0629c22eed9301f2863cc08959a3a4412af7f --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG1.cxx @@ -0,0 +1,568 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// SkimmingToolHIGG1.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Based on DerivationFramework::SkimmingToolExample + +#include "DerivationFrameworkHiggs/SkimmingToolHIGG1.h" +#include <vector> +#include <string> + +#include "CLHEP/Units/SystemOfUnits.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODTracking/TrackingPrimitives.h" + +// Constructor +DerivationFramework::SkimmingToolHIGG1::SkimmingToolHIGG1(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t, n, p), + m_trigDecisionTool("Trig::TrigDecisionTool/TrigDecisionTool"), + n_tot(0), + n_passGRL(0), + n_passLArError(0), + n_passTrigger(0), + n_passPreselect(0), + n_passSingleElectronPreselect(0), + n_passDoubleElectronPreselect(0), + n_passSingleMuonPreselect(0), + n_passKinematic(0), + n_passQuality(0), + n_passIsolation(0), + n_passInvariantMass(0), + n_pass(0) +{ + + declareInterface<DerivationFramework::ISkimmingTool>(this); + + declareProperty("PhotonContainerKey", m_photonSGKey="Photons"); + declareProperty("ElectronContainer", m_electronSGKey = "Electrons"); + declareProperty("MuonContainer", m_muonSGKey = "Muons"); + + declareProperty("RequireGRL", m_reqGRL = true); + declareProperty("ReqireLArError", m_reqLArError = true); + declareProperty("RequireTrigger", m_reqTrigger = true); + declareProperty("RequirePreselection", m_reqPreselection = true); + declareProperty("IncludeSingleElectronPreselection", m_incSingleElectron = true); + declareProperty("IncludeDoubleElectronPreselection", m_incDoubleElectron = false); + declareProperty("IncludeSingleMuonPreselection", m_incSingleMuon = true); + declareProperty("RequireKinematic", m_reqKinematic = true); + declareProperty("RequireQuality", m_reqQuality = true); + declareProperty("RequireIsolation", m_reqIsolation = true); + declareProperty("RequireInvariantMass", m_reqInvariantMass = true); + + declareProperty("GoodRunList", m_goodRunList = ""); + + declareProperty("DefaultTrigger", m_defaultTrigger = "EF_g35_loose_g25_loose"); + declareProperty("Triggers", m_triggers = std::vector<std::string>()); + + declareProperty("MinimumPhotonPt", m_minPhotonPt = 20*CLHEP::GeV); + declareProperty("MinimumElectronPt", m_minElectronPt = 20*CLHEP::GeV); + declareProperty("MinimumMuonPt", m_minMuonPt = 20*CLHEP::GeV); + declareProperty("MaxMuonEta", m_maxMuonEta = 2.7); + declareProperty("RemoveCrack", m_removeCrack = true); + declareProperty("MaxEta", m_maxEta = 2.47); + + declareProperty("RelativePtCuts", m_relativePtCuts = true); + declareProperty("LeadingPhotonPtCut", m_leadingPhotonPt = 0.35); + declareProperty("SubleadingPhotonPtCut", m_subleadingPhotonPt = 0.25); + + declareProperty("MinInvariantMass", m_minInvariantMass = 105*CLHEP::GeV); + declareProperty("MaxInvariantMass", m_maxInvariantMass = 160*CLHEP::GeV); + +} + +// Destructor +DerivationFramework::SkimmingToolHIGG1::~SkimmingToolHIGG1() { +} + +// Athena initialize and finalize +StatusCode DerivationFramework::SkimmingToolHIGG1::initialize() +{ + ATH_MSG_VERBOSE("INITIALIZING HSG1 SELECTOR TOOL"); + + //////////////////////////// + // trigger decision tool + if(m_trigDecisionTool.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); + return StatusCode::FAILURE; + } + if (!m_triggers.size()) m_triggers.push_back(m_defaultTrigger); + ATH_MSG_INFO("Retrieved tool: " << m_trigDecisionTool); + //////////////////////////// + + return StatusCode::SUCCESS; +} + +StatusCode DerivationFramework::SkimmingToolHIGG1::finalize() +{ + ATH_MSG_VERBOSE("finalize() ..."); + ATH_MSG_INFO("Processed " << n_tot << " events, " << n_pass << " events passed filter "); + + + ATH_MSG_INFO("GRL :: " << n_passGRL); + ATH_MSG_INFO("lar :: " << n_passLArError); + ATH_MSG_INFO("trig :: " << n_passTrigger); + ATH_MSG_INFO("----------------------------"); + if(m_incDoubleElectron) + ATH_MSG_INFO("2e :: " << n_passDoubleElectronPreselect); + if(m_incSingleElectron) + ATH_MSG_INFO("1y1e :: " << n_passSingleElectronPreselect); + if(m_incSingleMuon) + ATH_MSG_INFO("1y1mu :: " << n_passSingleMuonPreselect); + ATH_MSG_INFO("2y :: " << n_passPreselect); + ATH_MSG_INFO("----------------------------"); + ATH_MSG_INFO("2y - kin :: " << n_passKinematic); + ATH_MSG_INFO("2y - qual :: " << n_passQuality); + ATH_MSG_INFO("2y - iso :: " << n_passIsolation); + ATH_MSG_INFO("2y - inv :: " << n_passInvariantMass); + ATH_MSG_INFO("----------------------------"); + ATH_MSG_INFO("passed :: " << n_pass); + + return StatusCode::SUCCESS; +} + +// The filter itself +bool DerivationFramework::SkimmingToolHIGG1::eventPassesFilter() const +{ + + n_tot++; + + bool writeEvent(false); + + const xAOD::EventInfo *eventInfo(0); + ATH_CHECK(evtStore()->retrieve(eventInfo)); + m_isMC = eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION); + + if (!SubcutGoodRunList() && m_reqGRL ) return false; + if (!SubcutLArError() && m_reqLArError ) return false; + if (!SubcutTrigger() && m_reqTrigger ) return false; + + SubcutPreselect(); + if (!m_reqPreselection) writeEvent = true; + + // ey, ee, muy events + if (SubcutOnePhotonOneElectron() && m_incSingleElectron ) writeEvent = true; + if (SubcutTwoElectrons() && m_incDoubleElectron ) writeEvent = true; + if (SubcutOnePhotonOneMuon() && m_incSingleMuon ) writeEvent = true; + + // There *must* be two photons for the remaining + // pieces, but you can still save the event... + if (e_passPreselect) { + GetDiphotonVertex(); + CalculateInvariantMass(); + + bool passTwoPhotonCuts(true); + if (!SubcutQuality() && m_reqQuality ) passTwoPhotonCuts = false; + if (!SubcutKinematic() && m_reqKinematic ) passTwoPhotonCuts = false; + if (!SubcutIsolation() && m_reqIsolation ) passTwoPhotonCuts = false; + if (!SubcutInvariantMass() && m_reqInvariantMass) passTwoPhotonCuts = false; + // yy events + if (passTwoPhotonCuts) writeEvent = true; + } + + if (!writeEvent) return false; + + n_pass++; + return true; +} + +bool DerivationFramework::SkimmingToolHIGG1::SubcutGoodRunList() const { + + // Placeholder + + e_passGRL = true; + + if (e_passGRL) n_passGRL++; + return e_passGRL; + +} + + +bool DerivationFramework::SkimmingToolHIGG1::SubcutLArError() const { + + // Retrieve EventInfo + const xAOD::EventInfo *eventInfo(0); + ATH_CHECK(evtStore()->retrieve(eventInfo)); + + e_passLArError = !(eventInfo->errorState(xAOD::EventInfo::LAr) == xAOD::EventInfo::Error); + + if (e_passLArError) n_passLArError++; + return e_passLArError; + +} + + +bool DerivationFramework::SkimmingToolHIGG1::SubcutTrigger() const { + + //just for counting purposes + e_passTrigger = m_reqTrigger ? false : true; + + if(m_triggers.size()==0) e_passTrigger = true; + + for (unsigned int i = 0; i < m_triggers.size(); i++) { + ATH_MSG_DEBUG("TRIGGER = " << m_triggers.at(i)); + if(m_trigDecisionTool->isPassed(m_triggers.at(i))) + e_passTrigger = true; + } + + if (e_passTrigger) n_passTrigger++; + return e_passTrigger; + +} + + +bool DerivationFramework::SkimmingToolHIGG1::SubcutPreselect() const { + + const xAOD::PhotonContainer *photons(0); + ATH_CHECK(evtStore()->retrieve(photons, m_photonSGKey)); + xAOD::PhotonContainer::const_iterator ph_itr(photons->begin()); + xAOD::PhotonContainer::const_iterator ph_end(photons->end()); + + e_passPreselect = false; + ph_pos_lead = ph_pos_subl = -1; + ph_pt_lead = ph_pt_subl= 0; + + for(int i = 0; ph_itr != ph_end; ++ph_itr, ++i) { + + if (PhotonPreselect(*ph_itr)) { + + if ((*ph_itr)->pt() > ph_pt_lead) { + + ph_pos_subl = ph_pos_lead; ph_pos_lead = i; + ph_pt_subl = ph_pt_lead; + ph_pt_lead = (*ph_itr)->pt(); + + } else if ((*ph_itr)->pt() > ph_pt_subl) { + ph_pos_subl = i; + ph_pt_subl = (*ph_itr)->pt(); + } + } + } + + // save this for the derivation. + //std::vector<int> *leadingV = new std::vector<int>(); + //leadingV->push_back(ph_pos_lead); + //leadingV->push_back(ph_pos_subl); + //if (!evtStore()->contains<std::vector<int> >("leadingV")) CHECK(evtStore()->record(leadingV, "leadingV")); + + // save this for this code. + if (ph_pos_subl != -1) { + e_leadingPhotons.clear(); + e_leadingPhotons.push_back(*(photons->begin() + ph_pos_lead)); + e_leadingPhotons.push_back(*(photons->begin() + ph_pos_subl)); + e_passPreselect = true; + n_passPreselect++; + return true; + } + + e_passPreselect = false; + return false; + +} + + +bool DerivationFramework::SkimmingToolHIGG1::PhotonPreselect(const xAOD::Photon *ph) const { + + if (!ph) return false; + + if (!ph->isGoodOQ(34214)) return false; + + bool val(false); + bool defined(false); + + if(ph->isAvailable<char>("DFCommonPhotonsIsEMLoose")){ + defined = true; + val = static_cast<bool>(ph->auxdata<char>("DFCommonPhotonsIsEMLoose")); + } + else{ + defined = ph->passSelection(val, "Loose"); + } + + if(!defined || !val) return false; + + // // veto topo-seeded clusters + // uint16_t author = 0; + // author = ph->author(); + // if (author & xAOD::EgammaParameters::AuthorCaloTopo35) return false; + + // Check which variable versions are best... + const xAOD::CaloCluster *caloCluster(ph->caloCluster()); + double eta = fabs(caloCluster->etaBE(2)); + + if (eta > m_maxEta) return false; + if (m_removeCrack && + 1.37 <= eta && eta <= 1.52) return false; + if (caloCluster->e()/cosh(eta) < m_minPhotonPt) return false; + + return true; + +} + +bool DerivationFramework::SkimmingToolHIGG1::SubcutKinematic() const { + + if (m_relativePtCuts) { + e_passKinematic = (ph_pt_lead > e_invariantMass * m_leadingPhotonPt); + e_passKinematic &= (ph_pt_subl > e_invariantMass * m_subleadingPhotonPt); + } else { + e_passKinematic = (ph_pt_lead > m_leadingPhotonPt); + e_passKinematic &= (ph_pt_subl > m_subleadingPhotonPt); + } + + if (e_passKinematic) n_passKinematic++; + return e_passKinematic; + +} + +bool DerivationFramework::SkimmingToolHIGG1::SubcutQuality() const { + + bool val(0); + e_passQuality = false; + e_leadingPhotons.at(0)->passSelection(val, "Tight"); + ph_tight_lead = val; + + e_leadingPhotons.at(1)->passSelection(val, "Tight"); + ph_tight_subl = val; + + e_passQuality = (ph_tight_lead && ph_tight_subl); + + if (e_passQuality) n_passQuality++; + return e_passQuality; + +} + +bool DerivationFramework::SkimmingToolHIGG1::SubcutIsolation() const { + + // PLACEHOLDER!!! + + e_passIsolation= true; + + if (e_passIsolation) n_passIsolation++; + return e_passIsolation; + +} + + +bool DerivationFramework::SkimmingToolHIGG1::SubcutInvariantMass() const { + +// ATH_MSG_INFO("val=" << e_invariantMass << " min=" << m_minInvariantMass << " max=" << m_maxInvariantMass); + + e_passInvariantMass = (!m_minInvariantMass || + m_minInvariantMass < e_invariantMass); + + e_passInvariantMass &= (!m_maxInvariantMass || + e_invariantMass < m_maxInvariantMass); + + if (e_passInvariantMass) n_passInvariantMass++; + return e_passInvariantMass; + +} + +void DerivationFramework::SkimmingToolHIGG1::CalculateInvariantMass() const { + + /// CAUTION - PLACEHOLDERS + ph_e_lead = CorrectedEnergy(e_leadingPhotons.at(0)); + ph_e_subl = CorrectedEnergy(e_leadingPhotons.at(1)); + + /// CAUTION - CONSTANTS SHOULD BE UPDATED. + ph_eta_lead = CorrectedEta(e_leadingPhotons.at(0)); + ph_eta_subl = CorrectedEta(e_leadingPhotons.at(1)); + + ph_phi_lead = e_leadingPhotons.at(0)->phi(); + ph_phi_subl = e_leadingPhotons.at(1)->phi(); + + ph_pt_lead = ph_e_lead / cosh(ph_eta_lead); + ph_pt_subl = ph_e_subl / cosh(ph_eta_subl); + + + leadPhotonLV.SetPtEtaPhiM(ph_pt_lead, ph_eta_lead, ph_phi_lead, 0.); + sublPhotonLV.SetPtEtaPhiM(ph_pt_subl, ph_eta_subl, ph_phi_subl, 0.); + + e_invariantMass = (leadPhotonLV + sublPhotonLV).M(); + + return; + +} + + + +void DerivationFramework::SkimmingToolHIGG1::GetDiphotonVertex() const { + + e_diphotonZ = 0; + +} + +//// THIS IS A PLACEHOLDER!! +double DerivationFramework::SkimmingToolHIGG1::CorrectedEnergy(const xAOD::Photon *ph) const { + + return ph->e(); + +} + + +////////// THE FOLLOWING TWO FUNCTIONS ARE ADAPTED FROM +////////// RUN I HSG1 CUT FLOWS: USE WITH CARE AND CHECK!!! +double DerivationFramework::SkimmingToolHIGG1::CorrectedEta(const xAOD::Photon *ph) const { + + double eta1 = ph->caloCluster()->etaBE(1); + + double R_photon_front, Z_photon_front; + if (fabs(eta1) < 1.5) { // barrel + R_photon_front = ReturnRZ_1stSampling_cscopt2(eta1); + Z_photon_front = R_photon_front*sinh(eta1); + } else { // endcap + Z_photon_front = ReturnRZ_1stSampling_cscopt2(eta1); + R_photon_front = Z_photon_front/sinh(eta1); + } + + return asinh((Z_photon_front - e_diphotonZ)/R_photon_front); + +} + + +double DerivationFramework::SkimmingToolHIGG1::ReturnRZ_1stSampling_cscopt2(double eta1) const { + + float abs_eta1 = fabs(eta1); + + double radius = -99999; + if (abs_eta1 < 0.8) { + radius = 1558.859292 - 4.990838 * abs_eta1 - 21.144279 * abs_eta1 * abs_eta1; + } else if (abs_eta1 < 1.5) { + radius = 1522.775373 + 27.970192 * abs_eta1 - 21.104108 * abs_eta1 * abs_eta1; + } else { //endcap + radius = 3790.671754; + if (eta1 < 0.) radius = -radius; + } + + return radius; + +} + +bool DerivationFramework::SkimmingToolHIGG1::SubcutOnePhotonOneElectron() const { + + const xAOD::PhotonContainer *photons(0); + ATH_CHECK(evtStore()->retrieve(photons, m_photonSGKey)); + xAOD::PhotonContainer::const_iterator ph_itr(photons->begin()); + xAOD::PhotonContainer::const_iterator ph_end(photons->end()); + + const xAOD::ElectronContainer *electrons(0); + ATH_CHECK(evtStore()->retrieve(electrons, m_electronSGKey)); + xAOD::ElectronContainer::const_iterator el_itr(electrons->begin()); + xAOD::ElectronContainer::const_iterator el_end(electrons->end()); + + e_passSingleElectronPreselect = false; + + for( ; ph_itr != ph_end; ++ph_itr){ + if(PhotonPreselect(*ph_itr)){ + for( ; el_itr != el_end; ++el_itr){ + if(ElectronPreselect(*el_itr)){ + e_passSingleElectronPreselect = true; + } + } + } + } + + + if(e_passSingleElectronPreselect) n_passSingleElectronPreselect++; + return e_passSingleElectronPreselect; +} + +bool DerivationFramework::SkimmingToolHIGG1::SubcutTwoElectrons() const { + + const xAOD::ElectronContainer *electrons(0); + ATH_CHECK(evtStore()->retrieve(electrons, m_electronSGKey)); + xAOD::ElectronContainer::const_iterator el_itr(electrons->begin()); + xAOD::ElectronContainer::const_iterator el_end(electrons->end()); + + int nEle(0); + e_passDoubleElectronPreselect = false; + + for( ; el_itr != el_end; ++el_itr){ + if(ElectronPreselect(*el_itr)) + nEle++; + } + + if(nEle >=2) e_passDoubleElectronPreselect = true; + + if(e_passDoubleElectronPreselect) n_passDoubleElectronPreselect++; + return e_passDoubleElectronPreselect; +} + + +bool DerivationFramework::SkimmingToolHIGG1::SubcutOnePhotonOneMuon() const { + + const xAOD::PhotonContainer *photons(0); + ATH_CHECK(evtStore()->retrieve(photons, m_photonSGKey)); + xAOD::PhotonContainer::const_iterator ph_itr(photons->begin()); + xAOD::PhotonContainer::const_iterator ph_end(photons->end()); + + const xAOD::MuonContainer *muons(0); + ATH_CHECK(evtStore()->retrieve(muons, m_muonSGKey)); + xAOD::MuonContainer::const_iterator mu_itr(muons->begin()); + xAOD::MuonContainer::const_iterator mu_end(muons->end()); + + e_passSingleMuonPreselect = false; + + for( ; ph_itr != ph_end; ++ph_itr){ + if(PhotonPreselect(*ph_itr)){ + for( ; mu_itr != mu_end; ++mu_itr){ + if(MuonPreselect(*mu_itr)){ + e_passSingleMuonPreselect = true; + } + } + } + } + + + if(e_passSingleMuonPreselect) n_passSingleMuonPreselect++; + return e_passSingleMuonPreselect; +} + +bool DerivationFramework::SkimmingToolHIGG1::ElectronPreselect(const xAOD::Electron *el) const { + + if (!el) return false; + + bool val(false); + bool defined(false); + + if(el->isAvailable<char>("DFCommonElectronsLHLoose")){ + defined = true; + val = static_cast<bool>(el->auxdata<char>("DFCommonElectronsLHLoose")); + } + else{ + defined = el->passSelection(val, "Loose"); + } + if(!defined || !val) return false; + + double eta = fabs(el->eta()); + double pt = el->pt(); + + if (eta > m_maxEta) return false; + if (m_removeCrack && 1.37 <= eta && eta <= 1.52) return false; + if (pt <= m_minElectronPt) return false; + + return true; + +} + +bool DerivationFramework::SkimmingToolHIGG1::MuonPreselect(const xAOD::Muon *mu) const { + + if (!mu) return false; + double eta = fabs(mu->eta()); + double pt = mu->pt(); + + if (eta > m_maxMuonEta) return false; + if (pt <= m_minMuonPt) return false; + + return true; + +} + +const double DerivationFramework::SkimmingToolHIGG1::s_MZ = 91187.6*CLHEP::MeV; + + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8b3513897ba24c9978b5f10dfa569b5de038b5b5 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG2.cxx @@ -0,0 +1,820 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// SkimmingToolHIGG2.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: Susumu Oda (Susumu.Oda@cern.ch) +// Based on DerivationFramework::SkimmingToolExample + +#include "DerivationFrameworkHiggs/SkimmingToolHIGG2.h" +#include <vector> +#include <string> + +#include "CLHEP/Units/SystemOfUnits.h" + +#include "xAODEventInfo/EventInfo.h" +#include "xAODTracking/TrackingPrimitives.h" + +// Constructor +DerivationFramework::SkimmingToolHIGG2::SkimmingToolHIGG2(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t, n, p), + m_trigDecisionTool("Trig::TrigDecisionTool/TrigDecisionTool"), + m_ntot(0), + m_npass(0) +{ + declareInterface<DerivationFramework::ISkimmingTool>(this); + + declareProperty("SkipTriggerRequirement", m_skipTriggerRequirement=false); + + declareProperty("FilterType", m_filterType="2L"); + + declareProperty("ElectronContainerKey", m_electronSGKey="Electrons"); + declareProperty("MuonContainerKey", m_muonSGKey="Muons"); + declareProperty("JetContainerKey", m_jetSGKey="AntiKt4EMTopoJets"); + declareProperty("MergedJetContainerKey0", m_mergedJetSGKey[0]="AntiKt4EMTopoJets"); + declareProperty("MergedJetContainerKey1", m_mergedJetSGKey[1]="AntiKt10LCTopoJets"); + declareProperty("MergedJetContainerKey2", m_mergedJetSGKey[2]="CamKt12LCTopoJets"); + declareProperty("PhotonContainerKey", m_photonSGKey="Photons"); + declareProperty("TrackContainerKey", m_trackSGKey="InDetTrackParticles"); + + declareProperty("NumberOfLeptons", m_nLeptons=2); + declareProperty("NumberOfElectrons", m_nElectrons=0); + declareProperty("NumberOfMuons", m_nMuons=0); + declareProperty("NumberOfJets", m_nJets=0); + declareProperty("NumberOfMergedJets0", m_nMergedJets[0]=0); + declareProperty("NumberOfMergedJets1", m_nMergedJets[1]=0); + declareProperty("NumberOfMergedJets2", m_nMergedJets[2]=0); + declareProperty("NumberOfPhotons", m_nPhotons=0); + declareProperty("NumberOfTracks", m_nTracks=0); + + declareProperty("ElectronQuality", m_electronQual="any"); + declareProperty("MuonQuality", m_muonQual="inMS"); + declareProperty("TightElectronQuality", m_tightElectronQual="DFCommonElectronsLHVeryLoose"); + declareProperty("TightMuonQuality", m_tightMuonQual="DFCommonGoodMuon"); + declareProperty("JetQuality", m_jetQual="any"); + declareProperty("MergedJetQuality0", m_mergedJetQual[0]="any"); + declareProperty("MergedJetQuality1", m_mergedJetQual[1]="any"); + declareProperty("MergedJetQuality2", m_mergedJetQual[2]="any"); + declareProperty("PhotonQuality", m_photonQual="any"); + + declareProperty("PrimaryElectronQuality4L", m_primaryElectronQual4L="DFCommonElectronsLHLoose"); + + declareProperty("Trigger2L", m_trigger2L=std::vector<std::string>()); + declareProperty("TriggerTP", m_triggerTP=std::vector<std::string>()); + declareProperty("Trigger2L2Q", m_trigger2L2Q=std::vector<std::string>()); + declareProperty("TriggerJPSI", m_triggerJPSI=std::vector<std::string>()); + declareProperty("TriggerPHI", m_triggerPHI=std::vector<std::string>()); + + declareProperty("ElectronEtCut", m_electronEtCut=10.*CLHEP::GeV); + declareProperty("MuonPtCut", m_muonPtCut=10.*CLHEP::GeV); + declareProperty("TightElectronEtCut", m_tightElectronEtCut=15.*CLHEP::GeV); + declareProperty("TightMuonPtCut", m_tightMuonPtCut=15.*CLHEP::GeV); + declareProperty("JetPtCut", m_jetPtCut=15.*CLHEP::GeV); + declareProperty("MergedJetPtCut0", m_mergedJetPtCut[0]=100.*CLHEP::GeV); + declareProperty("MergedJetPtCut1", m_mergedJetPtCut[1]=150.*CLHEP::GeV); + declareProperty("MergedJetPtCut2", m_mergedJetPtCut[2]=150.*CLHEP::GeV); + declareProperty("PhotonPtCut", m_photonPtCut=15.*CLHEP::GeV); + declareProperty("TrackPtCut", m_trackPtCut=20.*CLHEP::GeV); + + declareProperty("ElectronEtaCut", m_electronEtaCut=9999.); + declareProperty("MuonEtaCut", m_muonEtaCut=9999.); + declareProperty("CaloMuonEtaCut", m_caloMuonEtaCut=0.2); + declareProperty("JetEtaCut", m_jetEtaCut=2.6); + declareProperty("MergedJetEtaCut0", m_mergedJetEtaCut[0]=2.6); + declareProperty("MergedJetEtaCut1", m_mergedJetEtaCut[1]=2.6); + declareProperty("MergedJetEtaCut2", m_mergedJetEtaCut[2]=2.6); + declareProperty("PhotonEtaCut", m_photonEtaCut=2.5); + + declareProperty("InvariantMassCut", m_invariantMassCut=0.*CLHEP::GeV); + declareProperty("InvariantMassJpsiLowCut", m_invariantMassJpsiLowCut=2.0*CLHEP::GeV); + declareProperty("InvariantMassJpsiUpCut", m_invariantMassJpsiUpCut=4.3*CLHEP::GeV); + declareProperty("InvariantMassUpsilonLowCut", m_invariantMassUpsilonLowCut=8.0*CLHEP::GeV); + declareProperty("InvariantMassUpsilonUpCut", m_invariantMassUpsilonUpCut=12.0*CLHEP::GeV); + declareProperty("InvariantMassPhiLowCut", m_invariantMassPhiLowCut=2.*s_MKplus); + declareProperty("InvariantMassPhiUpCut", m_invariantMassPhiUpCut=1.2*CLHEP::GeV); + + declareProperty("LeadingElectronEtCut", m_leadingElectronEtCut=0.*CLHEP::GeV); + declareProperty("LeadingMuonPtCut", m_leadingMuonPtCut=0.*CLHEP::GeV); + + declareProperty("DRElectronJetCut", m_dRElectronJetCut=0.05); + + declareProperty("CheckLArError", m_checkLArError=true); + declareProperty("UseDefaultElectronFourMomentum", m_defaultElectronFourMomentum=true); + + declareProperty("UseDFCommonJetFourMomentum", m_DFCommonJetFourMomentum=true); + + declareProperty("RequireTightLeptons", m_requireTightLeptons=false); +} + +// Destructor +DerivationFramework::SkimmingToolHIGG2::~SkimmingToolHIGG2() { +} + +// Athena initialize and finalize +StatusCode DerivationFramework::SkimmingToolHIGG2::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + + // if(m_defaultElectronFourMomentum==true and m_DFCommonElectronFourMomentum==true) { + // ATH_MSG_FATAL("Wrong setting both m_defaultElectronFourMomentum and m_DFCommonElectronFourMomentum are true."); + // return StatusCode::FAILURE; + // } + + // trigger decision tool + if(m_trigDecisionTool.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Retrieved tool: " << m_trigDecisionTool); + + return StatusCode::SUCCESS; +} + +StatusCode DerivationFramework::SkimmingToolHIGG2::finalize() +{ + ATH_MSG_VERBOSE("finalize() ..."); + ATH_MSG_INFO("Processed " << m_ntot << " events, " << m_npass << " events passed filter "); + return StatusCode::SUCCESS; +} + +// The filter itself +bool DerivationFramework::SkimmingToolHIGG2::eventPassesFilter() const +{ + m_ntot++; + bool acceptEvent(false); + StatusCode sc(StatusCode::SUCCESS, true); + + // Retrieve EventInfo + const xAOD::EventInfo *eventInfo(nullptr); + ATH_CHECK(evtStore()->retrieve(eventInfo)); + + // LAr error check + if(m_checkLArError) { + if(eventInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error) { + return acceptEvent; + } + } + + // Electrons + m_goodElectrons.clear(); + // m_mapElectrons.clear(); + if(m_nElectrons>0 or m_nLeptons>0) { + const xAOD::ElectronContainer *electrons(nullptr); + ATH_CHECK(evtStore()->retrieve(electrons, m_electronSGKey)); + for(auto el: *electrons) { + if(this->checkElectronQuality(el)) m_goodElectrons.push_back(el); + } + } + + // Muons + m_goodMuons.clear(); + if(m_nMuons>0 or m_nLeptons>0) { + const xAOD::MuonContainer *muons(nullptr); + ATH_CHECK(evtStore()->retrieve(muons, m_muonSGKey)); + for(auto mu: *muons) { + if(this->checkMuonQuality(mu)) m_goodMuons.push_back(mu); + } + } + + // Jets + m_goodJets.clear(); + if(m_nJets>0) { + const xAOD::JetContainer *jets(nullptr); + ATH_CHECK(evtStore()->retrieve(jets, m_jetSGKey)); + for(auto jet: *jets) { + if(this->checkJetQuality(jet)) m_goodJets.push_back(jet); + } + } + for(unsigned int type(0); type<NUMBER_OF_MERGED_JET_TYPES; type++) { + m_goodMergedJets[type].clear(); + if(m_nMergedJets[type]>0) { + const xAOD::JetContainer *jets(nullptr); + ATH_CHECK(evtStore()->retrieve(jets, m_mergedJetSGKey[type])); + for(auto jet: *jets) { + if(this->checkMergedJetQuality(jet, type)) m_goodMergedJets[type].push_back(jet); + } + } + } + + // Photons + m_goodPhotons.clear(); + if(m_nPhotons>0) { + const xAOD::PhotonContainer *photons(nullptr); + ATH_CHECK(evtStore()->retrieve(photons, m_photonSGKey)); + for(auto ph: *photons) { + if(this->checkPhotonQuality(ph)) m_goodPhotons.push_back(ph); + } + } + + // Tracks + m_goodTracks.clear(); + if(m_nTracks>0) { + const xAOD::TrackParticleContainer *tracks(nullptr); + ATH_CHECK(evtStore()->retrieve(tracks, m_trackSGKey)); + for(auto trk: *tracks) { + if(this->checkTrackQuality(trk)) m_goodTracks.push_back(trk); + } + } + + // Check conditions of filters + if(m_filterType=="2L") { + if(this->check2L()) acceptEvent = true; + } else if(m_filterType=="4L") { + if(this->check4L()) acceptEvent = true; + } else if(m_filterType=="TP") { + if(this->checkTP()) acceptEvent = true; + } else if(m_filterType=="2L2Q") { + if(this->check2L2Q()) acceptEvent = true; + } else if(m_filterType=="JPSI") { + if(this->checkJPSI() or this->checkPHI()) acceptEvent = true; + } + + if(acceptEvent) m_npass++; + return acceptEvent; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkElectronQuality(const xAOD::Electron *el, const bool isTight) const +{ + if(!el) return false; + + const std::string electronQual(isTight ? m_tightElectronQual : m_electronQual); + const double electronEtCut(isTight ? m_tightElectronEtCut : m_electronEtCut); + + if(electronQual!="any") { + bool value(false); + bool defined(false); + if(electronQual=="DFCommonElectronsLHVeryLoose" or + electronQual=="DFCommonElectronsLHLoose" or + electronQual=="DFCommonElectronsLHMedium" or + electronQual=="DFCommonElectronsLHTight" or + electronQual=="DFCommonElectronsML") { + // Use Derivation Framework variable to pickup possible new correction result + // If the same electron likelihood configuration is used in AOD creation and DAOD creation, + // DFCommonElectronsLHLoose and LHLoose are identical. + if(el->isAvailable<char>(electronQual)) { + defined = true; + value = static_cast<bool>(el->auxdata<char>(electronQual)); + } + } else { + // Electron menu is defined in http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py + defined = el->passSelection(value, electronQual); + } + if(not(value and defined)) return false; + } + + const xAOD::TrackParticle *trackParticle(el->trackParticle()); + if(!trackParticle) { + ATH_MSG_DEBUG("xAOD::TrackParticle pointer is null"); + return false; + } + uint8_t numberOfPixelHits(0); + if(!trackParticle->summaryValue(numberOfPixelHits, xAOD::numberOfPixelHits)) { + ATH_MSG_WARNING("xAOD::TrackParticle does not give summaryValue correctly for xAOD::numberOfPixelHits"); + return false; + } + uint8_t numberOfSCTHits(0); + if(!trackParticle->summaryValue(numberOfSCTHits, xAOD::numberOfSCTHits)) { + ATH_MSG_WARNING("xAOD::TrackParticle does not give summaryValue correctly for xAOD::numberOfSCTHits"); + return false; + } + if(numberOfPixelHits+numberOfSCTHits==0) return false; + + const xAOD::CaloCluster *caloCluster(el->caloCluster()); + if(!caloCluster) { + ATH_MSG_WARNING("xAOD::CaloCluster pointer is null"); + return false; + } + + double eta(trackParticle->eta()); + if(fabs(eta)>10.) return false; + double et(caloCluster->e()/cosh(eta)); + + if(et<electronEtCut) return false; + if(fabs(eta)>m_electronEtaCut) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkMuonQuality(const xAOD::Muon *mu, const bool isTight) const +{ + if(!mu) return false; + + const std::string muonQual(isTight ? m_tightMuonQual : m_muonQual); + const double muonPtCut(isTight ? m_tightMuonPtCut : m_muonPtCut); + + if(muonQual=="any") { + // do nothing + } else if(muonQual=="combined") { + if(mu->muonType()!=xAOD::Muon::Combined) return false; + } else if(muonQual=="standalone") { + if(mu->muonType()!=xAOD::Muon::MuonStandAlone) return false; + } else if(muonQual=="lowpt") { + if(mu->muonType()!=xAOD::Muon::SegmentTagged) return false; + } else if(muonQual=="combined+lowpt") { + if(mu->muonType()!=xAOD::Muon::Combined and mu->muonType()!=xAOD::Muon::SegmentTagged) return false; + } else if(muonQual=="inMS") { + if(mu->muonType()==xAOD::Muon::MuonStandAlone and fabs(fabs(mu->eta())-2.6)>0.12) return false; + } else if(muonQual=="DFCommonGoodMuon") { // Derivation Framework variable + if(!mu->isAvailable<char>("DFCommonGoodMuon") or !mu->auxdata<char>("DFCommonGoodMuon")) return false; + } else if(muonQual=="DFCommonMuonsLoose") { // Derivation Framework variable + if(!mu->isAvailable<char>("DFCommonMuonsLoose") or !mu->auxdata<char>("DFCommonMuonsLoose")) return false; + } else if(muonQual=="DFCommonMuonsMedium") { // Derivation Framework variable + if(!mu->isAvailable<char>("DFCommonMuonsMedium") or !mu->auxdata<char>("DFCommonMuonsMedium")) return false; + } else if(muonQual=="DFCommonMuonsTight") { // Derivation Framework variable + if(!mu->isAvailable<char>("DFCommonMuonsTight") or !mu->auxdata<char>("DFCommonMuonsTight")) return false; + } else { + ATH_MSG_WARNING("Muon quality " << muonQual << "is not defined"); + return false; + } + + if(mu->pt()<muonPtCut) return false; + if(fabs(mu->eta())>m_muonEtaCut) return false; + if(muonQual!="DFCommonGoodMuon" and + (mu->muonType()==xAOD::Muon::CaloTagged and fabs(mu->eta())>m_caloMuonEtaCut)) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkJetQuality(const xAOD::Jet *jet) const +{ + if(!jet) return false; + + if(m_jetQual!="any") { + // do something + } + + TLorentzVector tlv(this->jetFourMomentum(jet)); + if(tlv.Pt()<m_jetPtCut) return false; + if(fabs(tlv.Eta())>m_jetEtaCut) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkMergedJetQuality(const xAOD::Jet *jet, const unsigned int type) const +{ + if(!jet) return false; + + if(m_mergedJetQual[type]!="any") { + // do something + } + + if(jet->pt()<m_mergedJetPtCut[type]) return false; + if(fabs(jet->eta())>m_mergedJetEtaCut[type]) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkPhotonQuality(const xAOD::Photon *ph) const +{ + if(!ph) return false; + + if(m_photonQual!="any") { + bool value(false); + if(!ph->passSelection(value, m_photonQual)) { + ATH_MSG_WARNING("xAOD::Photon does not have menu of " << m_photonQual); + return false; + } + if(!value) return false; + } + + if(ph->pt()<m_photonPtCut) return false; + if(fabs(ph->eta())>m_photonEtaCut) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkTrackQuality(const xAOD::TrackParticle *trk) const +{ + if(!trk) return false; + + if(trk->pt()<m_trackPtCut) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG2::check2L() const +{ + if(!(m_nLeptons>0 and m_goodElectrons.size()+m_goodMuons.size()>=m_nLeptons)) return false; + if(!(m_goodJets.size()>=m_nJets and m_goodPhotons.size()>=m_nPhotons)) return false; + + bool isTriggerFired(m_trigger2L.size()==0 or m_skipTriggerRequirement); + for(unsigned int i(0); i<m_trigger2L.size(); i++) { + if(m_trigDecisionTool->isPassed(m_trigger2L.at(i))) { + isTriggerFired = true; + break; + } + } + if(!isTriggerFired) return false; + + unsigned int nGoodLeptons(m_goodElectrons.size()+m_goodMuons.size()); + std::vector<TLorentzVector> v_tlv(nGoodLeptons); + std::vector<bool> v_isElectron(nGoodLeptons); + std::vector<bool> v_isTight(nGoodLeptons); + + for(unsigned int el_i(0); el_i<m_goodElectrons.size(); el_i++) { + const xAOD::Electron *el(m_goodElectrons.at(el_i)); + TLorentzVector tlv(this->electronFourMomentum(el)); + v_tlv.at(el_i) = tlv; + v_isElectron.at(el_i) = true; + v_isTight.at(el_i) = this->checkElectronQuality(el, true); + } + + for(unsigned int mu_i(0); mu_i<m_goodMuons.size(); mu_i++) { + const xAOD::Muon *mu(m_goodMuons.at(mu_i)); + TLorentzVector tlv(this->muonFourMomentum(mu)); + unsigned int mu_j(m_goodElectrons.size()+mu_i); + v_tlv.at(mu_j) = tlv; + v_isElectron.at(mu_j) = false; + v_isTight.at(mu_j) = this->checkMuonQuality(mu, true); + } + + for(unsigned int i0(0); i0<nGoodLeptons; i0++) { + for(unsigned int i1(i0+1); i1<nGoodLeptons; i1++) { + if(m_requireTightLeptons and (not (v_isTight.at(i0) or v_isTight.at(i1)))) continue; + + TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1)); + // Check two lepton mass + if(tlv_2lep.M()>m_invariantMassCut) return true; + } + } + + return false; +} + +bool DerivationFramework::SkimmingToolHIGG2::check4L() const +{ + if(!(m_nLeptons>0 and m_goodElectrons.size()+m_goodMuons.size()>=m_nLeptons)) return false; + if(!(m_goodJets.size()>=m_nJets and m_goodPhotons.size()>=m_nPhotons)) return false; + + unsigned int nGoodLeptons(m_goodElectrons.size()+m_goodMuons.size()); + std::vector<TLorentzVector> v_tlv(nGoodLeptons); + std::vector<bool> v_pid(nGoodLeptons); + + for(unsigned int el_i(0); el_i<m_goodElectrons.size(); el_i++) { + const xAOD::Electron *el(m_goodElectrons.at(el_i)); + TLorentzVector tlv(this->electronFourMomentum(el)); + v_tlv.at(el_i) = tlv; + + bool value(false); + bool defined(false); + if(m_primaryElectronQual4L=="") { + // In the case of no identification requirement + defined = true; + value = true; + } else if(m_primaryElectronQual4L=="DFCommonElectronsLHVeryLoose" or + m_primaryElectronQual4L=="DFCommonElectronsLHLoose" or + m_primaryElectronQual4L=="DFCommonElectronsLHMedium" or + m_primaryElectronQual4L=="DFCommonElectronsLHTight" or + m_primaryElectronQual4L=="DFCommonElectronsML") { + // Use Derivation Framework variable to pickup possible new correction result + // If the same electron likelihood configuration is used in AOD creation and DAOD creation, + // DFCommonElectronsLHLoose and LHLoose are identical. + if(el->isAvailable<char>(m_primaryElectronQual4L)) { + defined = true; + value = static_cast<bool>(el->auxdata<char>(m_primaryElectronQual4L)); + } + } else { + // Electron menu is defined in http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Reconstruction/egamma/egammaTools/python/EMPIDBuilderBase.py + defined = el->passSelection(value, m_primaryElectronQual4L); + } + + v_pid.at(el_i) = (value and defined); + } + + for(unsigned int mu_i(0); mu_i<m_goodMuons.size(); mu_i++) { + const xAOD::Muon *mu(m_goodMuons.at(mu_i)); + TLorentzVector tlv(this->muonFourMomentum(mu)); + unsigned int mu_j(m_goodElectrons.size()+mu_i); + v_tlv.at(mu_j) = tlv; + v_pid.at(mu_j) = true; + } + + for(unsigned int i0(0); i0<nGoodLeptons; i0++) { + for(unsigned int i1(i0+1); i1<nGoodLeptons; i1++) { + for(unsigned int i2(i1+1); i2<nGoodLeptons; i2++) { + for(unsigned int i3(i2+1); i3<nGoodLeptons; i3++) { + TLorentzVector tlv_4lep(v_tlv.at(i0) + v_tlv.at(i1) + v_tlv.at(i2) + v_tlv.at(i3)); + // Check four lepton mass + if(tlv_4lep.M()<m_invariantMassCut) continue; + + // Check primary dilepton's electron PID (muon PID is always true) + if(fabs((v_tlv.at(i0)+v_tlv.at(i1)).M()-s_MZ)<fabs((v_tlv.at(i2)+v_tlv.at(i3)).M()-s_MZ)) { + if(v_pid.at(i0) and v_pid.at(i1)) return true; + } else { + if(v_pid.at(i2) and v_pid.at(i3)) return true; + } + if(fabs((v_tlv.at(i0)+v_tlv.at(i2)).M()-s_MZ)<fabs((v_tlv.at(i1)+v_tlv.at(i3)).M()-s_MZ)) { + if(v_pid.at(i0) and v_pid.at(i2)) return true; + } else { + if(v_pid.at(i1) and v_pid.at(i3)) return true; + } + if(fabs((v_tlv.at(i0)+v_tlv.at(i3)).M()-s_MZ)<fabs((v_tlv.at(i1)+v_tlv.at(i2)).M()-s_MZ)) { + if(v_pid.at(i0) and v_pid.at(i3)) return true; + } else { + if(v_pid.at(i1) and v_pid.at(i2)) return true; + } + } + } + } + } + + return false; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkTP() const +{ + if(!(m_nLeptons>0 and m_goodElectrons.size()+m_goodMuons.size()>=m_nLeptons)) return false; + + bool isTriggerFired(m_triggerTP.size()==0 or m_skipTriggerRequirement); + for(unsigned int i(0); i<m_triggerTP.size(); i++) { + if(m_trigDecisionTool->isPassed(m_triggerTP.at(i))) { + isTriggerFired = true; + break; + } + } + if(!isTriggerFired) return false; + + unsigned int nGoodLeptons(m_goodElectrons.size()+m_goodMuons.size()); + std::vector<TLorentzVector> v_tlv(nGoodLeptons); + std::vector<bool> v_isElectron(nGoodLeptons); + + for(unsigned int el_i(0); el_i<m_goodElectrons.size(); el_i++) { + const xAOD::Electron *el(m_goodElectrons.at(el_i)); + TLorentzVector tlv(this->electronFourMomentum(el)); + v_tlv.at(el_i) = tlv; + v_isElectron.at(el_i) = true; + } + + for(unsigned int mu_i(0); mu_i<m_goodMuons.size(); mu_i++) { + const xAOD::Muon *mu(m_goodMuons.at(mu_i)); + TLorentzVector tlv(this->muonFourMomentum(mu)); + unsigned int mu_j(m_goodElectrons.size()+mu_i); + v_tlv.at(mu_j) = tlv; + v_isElectron.at(mu_j) = false; + } + + for(unsigned int i0(0); i0<nGoodLeptons; i0++) { + for(unsigned int i1(i0+1); i1<nGoodLeptons; i1++) { + if(v_isElectron.at(i0)!=v_isElectron.at(i1)) continue; + + TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1)); + // Check two lepton mass + if(tlv_2lep.M()<m_invariantMassCut) continue; + + // Leading lepton ET/pT cut + if((v_tlv.at(i0).Pt()>v_tlv.at(i1).Pt() ? v_tlv.at(i0).Pt() : v_tlv.at(i1).Pt()) > (v_isElectron.at(i0) ? m_leadingElectronEtCut : m_leadingMuonPtCut)) return true; + } + } + + return false; +} + +bool DerivationFramework::SkimmingToolHIGG2::check2L2Q() const +{ + if(!(m_nLeptons>0 and m_goodElectrons.size()+m_goodMuons.size()>=m_nLeptons)) return false; + + bool isTriggerFired(m_trigger2L2Q.size()==0 or m_skipTriggerRequirement); + for(unsigned int i(0); i<m_trigger2L2Q.size(); i++) { + if(m_trigDecisionTool->isPassed(m_trigger2L2Q.at(i))) { + isTriggerFired = true; + break; + } + } + if(!isTriggerFired) return false; + + bool checkGoodJets(m_goodJets.size()>=m_nJets and m_nJets>0); + for(unsigned int type(0); type<NUMBER_OF_MERGED_JET_TYPES; type++) { + if(m_nMergedJets[type]>0) { + checkGoodJets = (checkGoodJets or (m_goodMergedJets[type].size()>=m_nMergedJets[type])); + } + } + if(!checkGoodJets) return false; + + unsigned int nGoodLeptons(m_goodElectrons.size()+m_goodMuons.size()); + std::vector<TLorentzVector> v_tlv(nGoodLeptons); + std::vector<bool> v_isElectron(nGoodLeptons); + std::vector<bool> v_isTight(nGoodLeptons); + + for(unsigned int el_i(0); el_i<m_goodElectrons.size(); el_i++) { + const xAOD::Electron *el(m_goodElectrons.at(el_i)); + TLorentzVector tlv(this->electronFourMomentum(el)); + v_tlv.at(el_i) = tlv; + v_isElectron.at(el_i) = true; + v_isTight.at(el_i) = this->checkElectronQuality(el, true); + } + + for(unsigned int mu_i(0); mu_i<m_goodMuons.size(); mu_i++) { + const xAOD::Muon *mu(m_goodMuons.at(mu_i)); + TLorentzVector tlv(this->muonFourMomentum(mu)); + unsigned int mu_j(m_goodElectrons.size()+mu_i); + v_tlv.at(mu_j) = tlv; + v_isElectron.at(mu_j) = false; + v_isTight.at(mu_j) = this->checkMuonQuality(mu, true); + } + + for(unsigned int i0(0); i0<nGoodLeptons; i0++) { + for(unsigned int i1(i0+1); i1<nGoodLeptons; i1++) { + // if(v_isElectron.at(i0)!=v_isElectron.at(i1)) continue; // Events with N(e)=1 and N(mu)=1 are kept. + if(m_requireTightLeptons and (not (v_isTight.at(i0) or v_isTight.at(i1)))) continue; + + TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1)); + // Check two lepton mass + if(tlv_2lep.M()<m_invariantMassCut) continue; + + // dR(e-jet)>0.05 is required for at least two jets + if(v_isElectron.at(i0)) { + unsigned int nGoodJetsWithDRCut(0); + unsigned int nGoodJets(m_goodJets.size()); + for(unsigned int j(0); j<nGoodJets; j++) { + const xAOD::Jet *jet(m_goodJets.at(j)); + TLorentzVector jet_tlv(this->jetFourMomentum(jet)); + + double dR_0(this->getDeltaR(v_tlv.at(i0).Eta(), v_tlv.at(i0).Phi(), jet_tlv.Eta(), jet_tlv.Phi())); + if(dR_0<m_dRElectronJetCut) continue; + + double dR_1(this->getDeltaR(v_tlv.at(i1).Eta(), v_tlv.at(i1).Phi(), jet_tlv.Eta(), jet_tlv.Phi())); + if(dR_1<m_dRElectronJetCut) continue; + + nGoodJetsWithDRCut++; + } + + bool checkGoodJetsWithDRCut(nGoodJetsWithDRCut>=m_nJets and m_nJets>0); + + for(unsigned int type(0); type<NUMBER_OF_MERGED_JET_TYPES; type++) { + if(m_nMergedJets[type]>0) { + unsigned int nGoodMergedJetsWithDRCut(0); + unsigned int nGoodMergedJets(m_goodMergedJets[type].size()); + for(unsigned int j(0); j<nGoodMergedJets; j++) { + const xAOD::Jet *jet(m_goodMergedJets[type].at(j)); + + double dR_0(this->getDeltaR(v_tlv.at(i0).Eta(), v_tlv.at(i0).Phi(), jet->eta(), jet->phi())); + if(dR_0<m_dRElectronJetCut) continue; + + double dR_1(this->getDeltaR(v_tlv.at(i1).Eta(), v_tlv.at(i1).Phi(), jet->eta(), jet->phi())); + if(dR_1<m_dRElectronJetCut) continue; + + nGoodMergedJetsWithDRCut++; + } + + checkGoodJetsWithDRCut = (checkGoodJetsWithDRCut or (nGoodMergedJetsWithDRCut>=m_nMergedJets[type])); + } + } + if(!checkGoodJetsWithDRCut) return false; + } + + // Leading lepton ET/pT cut + if((v_tlv.at(i0).Pt()>v_tlv.at(i1).Pt() ? v_tlv.at(i0).Pt() : v_tlv.at(i1).Pt()) > (v_isElectron.at(i0) ? m_leadingElectronEtCut : m_leadingMuonPtCut)) return true; + } + } + + return false; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkJPSI() const +{ + if(!(m_nMuons>0 and m_goodMuons.size()>=m_nMuons)) return false; + if(!(m_goodPhotons.size()>=m_nPhotons)) return false; + + bool isTriggerFired(m_triggerJPSI.size()==0 or m_skipTriggerRequirement); + for(unsigned int i(0); i<m_triggerJPSI.size(); i++) { + if(m_trigDecisionTool->isPassed(m_triggerJPSI.at(i))) { + isTriggerFired = true; + break; + } + } + if(!isTriggerFired) return false; + + std::vector<TLorentzVector> v_tlv(m_goodMuons.size()); + + for(unsigned int mu_i(0); mu_i<m_goodMuons.size(); mu_i++) { + const xAOD::Muon *mu(m_goodMuons.at(mu_i)); + TLorentzVector tlv(this->muonFourMomentum(mu)); + v_tlv.at(mu_i) = tlv; + } + + unsigned int nGoodLeptons(v_tlv.size()); + for(unsigned int i0(0); i0<nGoodLeptons; i0++) { + for(unsigned int i1(i0+1); i1<nGoodLeptons; i1++) { + TLorentzVector tlv_2lep(v_tlv.at(i0) + v_tlv.at(i1)); + + // Check di-muon mass + if((tlv_2lep.M()<m_invariantMassJpsiLowCut or tlv_2lep.M()>m_invariantMassJpsiUpCut) and + (tlv_2lep.M()<m_invariantMassUpsilonLowCut or tlv_2lep.M()>m_invariantMassUpsilonUpCut)) continue; + + // Check leading muon pT + if((v_tlv.at(i0).Pt()>v_tlv.at(i1).Pt() ? v_tlv.at(i0).Pt() : v_tlv.at(i1).Pt())>m_leadingMuonPtCut) return true; + } + } + + return false; +} + +bool DerivationFramework::SkimmingToolHIGG2::checkPHI() const +{ + // Check if there are candidates + if(!(m_nTracks>0 and m_goodTracks.size()>=m_nTracks)) return false; + if(!(m_goodPhotons.size()>=m_nPhotons)) return false; + + // Check if triggers are OK + bool isTriggerFired(m_triggerPHI.size()==0 or m_skipTriggerRequirement); + for(unsigned int i(0); i<m_triggerPHI.size(); i++) { + if(m_trigDecisionTool->isPassed(m_triggerPHI.at(i))) { + isTriggerFired = true; + break; + } + } + if(!isTriggerFired) return false; + + // Get 4-momentum of tracks (=charged kaons) + std::vector<TLorentzVector> v_tlv[2]; + for(unsigned int trk_i(0); trk_i<m_goodTracks.size(); trk_i++) { + const xAOD::TrackParticle *trk(m_goodTracks.at(trk_i)); + TLorentzVector tlv; + tlv.SetPtEtaPhiM(trk->pt(), trk->eta(), trk->phi(), s_MKplus); // Kaon is assumed. + v_tlv[trk->charge()>0. ? 0 : 1].push_back(tlv); // 0 is positive, 1 is negative + } + + // Check track pair mass + unsigned int nGoodTracks[2]; + nGoodTracks[0] = v_tlv[0].size(); + nGoodTracks[1] = v_tlv[1].size(); + for(unsigned int i0(0); i0<nGoodTracks[0]; i0++) { + for(unsigned int i1(0); i1<nGoodTracks[1]; i1++) { + TLorentzVector tlv_2trk(v_tlv[0].at(i0) + v_tlv[1].at(i1)); + if(tlv_2trk.M()<m_invariantMassPhiLowCut or tlv_2trk.M()>m_invariantMassPhiUpCut) continue; + return true; // One candidate is found. + } + } + + return false; // No candidate is found. +} + +TLorentzVector DerivationFramework::SkimmingToolHIGG2::electronFourMomentum(const xAOD::Electron *el) const +{ + TLorentzVector tlv; + tlv.SetPtEtaPhiE(el->pt(), el->eta(), el->phi(), el->e()); + if(m_defaultElectronFourMomentum) return tlv; + + const xAOD::TrackParticle *trackParticle(el->trackParticle()); + if(!trackParticle) { + ATH_MSG_WARNING("xAOD::TrackParticle pointer is null"); + return tlv; + } + const xAOD::CaloCluster *caloCluster(el->caloCluster()); + if(!caloCluster) { + ATH_MSG_WARNING("xAOD::CaloCluster pointer is null"); + return tlv; + } + + double eta(trackParticle->eta()); + double phi(trackParticle->phi()); + if(fabs(eta)>10.) { + ATH_MSG_WARNING("fabs(trackParticle->eta()) = " << eta << " > 10."); + return tlv; + } + double e(caloCluster->e()); + double et(e/cosh(eta)); + + tlv.SetPtEtaPhiE(et, eta, phi, e); + return tlv; +} + +TLorentzVector DerivationFramework::SkimmingToolHIGG2::muonFourMomentum(const xAOD::Muon *mu) const +{ + TLorentzVector tlv; + tlv.SetPtEtaPhiM(mu->pt(), mu->eta(), mu->phi(), mu->m()); + return tlv; +} + +TLorentzVector DerivationFramework::SkimmingToolHIGG2::jetFourMomentum(const xAOD::Jet *jet) const +{ + TLorentzVector tlv; + if(m_DFCommonJetFourMomentum) { + const float& pt =jet->auxdata<float> ("DFCommonJets_Calib_pt"); + const float& eta=jet->auxdata<float> ("DFCommonJets_Calib_eta"); + const float& phi=jet->auxdata<float> ("DFCommonJets_Calib_phi"); + const float& m =jet->auxdata<float> ("DFCommonJets_Calib_m"); + tlv.SetPtEtaPhiM(pt, eta, phi, m); + } + else + tlv.SetPtEtaPhiM(jet->pt(), jet->eta(), jet->phi(), jet->m()); + + return tlv; +} + +double DerivationFramework::SkimmingToolHIGG2::getDeltaR(const double eta1, const double phi1, const double eta2, const double phi2) const +{ + double dEta(eta1 - eta2); + double dPhi(phi1 - phi2); + if(dPhi>+M_PI) dPhi -= 2.*M_PI; + if(dPhi<-M_PI) dPhi += 2.*M_PI; + double dR(sqrt(dEta*dEta + dPhi*dPhi)); + return dR; +} + +const double DerivationFramework::SkimmingToolHIGG2::s_MZ(91187.6*CLHEP::MeV); +const double DerivationFramework::SkimmingToolHIGG2::s_MKplus(493.677*CLHEP::MeV); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx new file mode 100644 index 0000000000000000000000000000000000000000..17856a6722a4494b530cfc8e2067287ca79b29d1 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/SkimmingToolHIGG5VBF.cxx @@ -0,0 +1,207 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +///////////////////////////////////////////////////////////////// +// SkimmingToolHIGG5VBF.cxx, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Author: Yasu Okumura (yasuyuki.okumura@cern.ch) +// Based on DerivationFramework::SkimmingToolExample and DerivationFramework::SkimmingToolHIGG2 + +#include "DerivationFrameworkHiggs/SkimmingToolHIGG5VBF.h" +#include <vector> +#include <string> + +#include "CLHEP/Units/SystemOfUnits.h" + +// Constructor +DerivationFramework::SkimmingToolHIGG5VBF::SkimmingToolHIGG5VBF(const std::string& t, + const std::string& n, + const IInterface* p) : + AthAlgTool(t, n, p), + m_trigDecisionTool("Trig::TrigDecisionTool/TrigDecisionTool"), + m_ntot(0), + m_npass(0) +{ + declareInterface<DerivationFramework::ISkimmingTool>(this); + + // for jet multiplicity requirement + declareProperty("JetContainerKey", m_jetSGKey="AntiKt4EMTopoJets"); + declareProperty("CalibedJetMomentKey", m_calibedJetMomKey="DFCommonJets_Calib"); + + // for jet multiplicity + declareProperty("ReqNAllJets", m_reqNAllJets=false); + declareProperty("NumberOfAllJets", m_nAllJets=4); + declareProperty("AllJetPtCut", m_allJetPtCut=40.*CLHEP::GeV); + declareProperty("AllJetEtaCut", m_allJetEtaCut=4.9); + + declareProperty("ReqNCentralJets", m_reqNCentralJets=false); + declareProperty("NumberOfCentralJets", m_nCentralJets=2); + declareProperty("CentralJetPtCut", m_centralJetPtCut=40.*CLHEP::GeV); + declareProperty("CentralJetEtaCut", m_centralJetEtaCut=2.6); + + // for trigger requirement + declareProperty("ReqTrigger", m_reqTrigger=false); + declareProperty("Triggers", m_triggers=std::vector<std::string>()); + + // for Mjj requirement () + declareProperty("ReqVBFMjj", m_reqVbfMjj=false); // logical "ORed" with ReqPhoton + declareProperty("MjjCut", m_vbfMjjCut=0.*CLHEP::GeV); + + declareProperty("DoDebug", m_debug=false); + + // photon requirement (p. rose) + declareProperty("PhotonContainerKey", m_phSGKey="Photons"); + declareProperty("ReqPhoton", m_reqPh=false); // logical "ORed" with ReqVBFMjj + declareProperty("PhotonPtCut", m_phPtCut=0.*CLHEP::GeV); + declareProperty("CentralPhotonEtaCut", m_centralPhEtaCut=2.6); + +} + +// Destructor +DerivationFramework::SkimmingToolHIGG5VBF::~SkimmingToolHIGG5VBF() { +} + +// Athena initialize and finalize +StatusCode DerivationFramework::SkimmingToolHIGG5VBF::initialize() +{ + ATH_MSG_VERBOSE("initialize() ..."); + + // trigger decision tool + if(m_trigDecisionTool.retrieve().isFailure()) { + ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Retrieved tool: " << m_trigDecisionTool); + + return StatusCode::SUCCESS; +} + +StatusCode DerivationFramework::SkimmingToolHIGG5VBF::finalize() +{ + ATH_MSG_VERBOSE("finalize() ..."); + ATH_MSG_INFO("Processed " << m_ntot << " events, " << m_npass << " events passed filter "); + return StatusCode::SUCCESS; +} + +// The filter itself +bool DerivationFramework::SkimmingToolHIGG5VBF::eventPassesFilter() const +{ + m_ntot++; + bool acceptEvent(true); + + StatusCode sc(StatusCode::SUCCESS, true); + + bool isTriggerFired(m_triggers.size()==0); + for(unsigned int i(0); i<m_triggers.size(); i++) { + if(m_trigDecisionTool->isPassed(m_triggers.at(i))) { + isTriggerFired = true; + break; + } + } + + // (1) Count Jet Multiplicity + m_goodAllJets.clear(); + m_goodCentralJets.clear(); + + const xAOD::JetContainer *jets(0); + ATH_CHECK(evtStore()->retrieve(jets, m_jetSGKey)); + xAOD::JetContainer::const_iterator jet_itr(jets->begin()); + xAOD::JetContainer::const_iterator jet_end(jets->end()); + for(; jet_itr != jet_end; ++jet_itr) { + TLorentzVector jetP4 = getCalibedJets( (*jet_itr) ); + if(this->checkAllJetQuality(jetP4)) { m_goodAllJets.push_back(jetP4); } + if(this->checkCentralJetQuality(jetP4)) { m_goodCentralJets.push_back(jetP4); } + } + + // (2) evaluate maximum Mjj in the event + double maxM = 0.; + for(unsigned int jet_i = 0; jet_i<m_goodAllJets.size(); jet_i++) { + const TLorentzVector& iP4 = m_goodAllJets.at(jet_i); + + for(unsigned int jet_k=jet_i+1; jet_k<m_goodAllJets.size(); jet_k++) { + const TLorentzVector& kP4 = m_goodAllJets.at(jet_k); + + const TLorentzVector jjP4 = iP4 + kP4; + const double jjM = jjP4.M(); + + if (maxM<jjM) {maxM=jjM;} + } + } + + //get max pt of any photon in the event (p. rose) + double maxPhPt=0.; + if(m_reqPh){ + const xAOD::PhotonContainer *phots(0); + ATH_CHECK(evtStore()->retrieve(phots, m_phSGKey)); + for (const auto* ph : *phots){ + if(abs(ph->eta())<m_centralPhEtaCut) + if(ph->pt()>maxPhPt) maxPhPt = ph->pt(); + }//for + }//if + + + + const bool passNAllJet = (m_goodAllJets.size()>=m_nAllJets); + const bool passNCentralJet = (m_goodCentralJets.size()>=m_nCentralJets); + const bool passMjjCut = (maxM>m_vbfMjjCut); + const bool passPhPtCut = (maxPhPt>m_phPtCut); + + if (m_reqNAllJets) { if (not passNAllJet) {acceptEvent=false;} } + if (m_reqNCentralJets) { if (not passNCentralJet) {acceptEvent=false;} } + //if (m_reqVbfMjj) { if (not passMjjCut) {acceptEvent=false;} } + if (m_reqTrigger) { if (not isTriggerFired) {acceptEvent=false;} } + //vbf+gamma addition -- logical OR of mjj and phpt cut + if(m_reqVbfMjj and not m_reqPh) { if (not passMjjCut) {acceptEvent=false;} } + if(m_reqPh and not m_reqVbfMjj) { if (not passPhPtCut) {acceptEvent=false;} } + if(m_reqPh and m_reqVbfMjj) { if (not (passMjjCut or passPhPtCut) ) {acceptEvent=false;} } + + if (acceptEvent) {m_npass++;} + + if (m_debug) { + printf("dbg> L%3d : event accepted [%s] " + "(NJets=%2d [%6s], NCentralJets=%2d [%6s] Mjj=%10.1f [%6s], Trigger [%6s]) \n", + __LINE__, + acceptEvent? "Y" : "N", + (int)m_goodAllJets.size(), passNAllJet ? "PASSED" : "FAILED", + (int)m_goodCentralJets.size(), passNCentralJet ? "PASSED" : "FAILED", + maxM, passMjjCut ? "PASSED" : "FAILED", + isTriggerFired ? "PASSED" : "FAILED" + ); + } + + return acceptEvent; +} + +bool DerivationFramework::SkimmingToolHIGG5VBF::checkAllJetQuality(const TLorentzVector& jet) const +{ + if(jet.Pt()<m_allJetPtCut) return false; + if(fabs(jet.Eta())>m_allJetEtaCut) return false; + + return true; +} + +bool DerivationFramework::SkimmingToolHIGG5VBF::checkCentralJetQuality(const TLorentzVector& jet) const +{ + if(jet.Pt()<m_centralJetPtCut) return false; + if(fabs(jet.Eta())>m_centralJetEtaCut) return false; + + return true; +} + +TLorentzVector +DerivationFramework::SkimmingToolHIGG5VBF::getCalibedJets(const xAOD::Jet* jet) const +{ + TLorentzVector rc; + + if(!jet) return rc; + + const float& pt =jet->auxdata<float> (m_calibedJetMomKey+"_pt"); + const float& eta=jet->auxdata<float> (m_calibedJetMomKey+"_eta"); + const float& phi=jet->auxdata<float> (m_calibedJetMomKey+"_phi"); + const float& m =jet->auxdata<float> (m_calibedJetMomKey+"_m"); + + rc.SetPtEtaPhiM(pt, eta, phi, m); + + return rc; +} diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/components/DerivationFrameworkHiggs_entries.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/components/DerivationFrameworkHiggs_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d223d6f7c26c65f9569ac0ab055d458a69aa8d4a --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/components/DerivationFrameworkHiggs_entries.cxx @@ -0,0 +1,16 @@ +#include "GaudiKernel/DeclareFactoryEntries.h" +#include "DerivationFrameworkHiggs/SkimmingToolHIGG1.h" +#include "DerivationFrameworkHiggs/SkimmingToolHIGG2.h" +#include "DerivationFrameworkHiggs/SkimmingToolHIGG5VBF.h" +using namespace DerivationFramework; + +DECLARE_TOOL_FACTORY( SkimmingToolHIGG1 ) +DECLARE_TOOL_FACTORY( SkimmingToolHIGG2 ) +DECLARE_TOOL_FACTORY( SkimmingToolHIGG5VBF ) + +DECLARE_FACTORY_ENTRIES( DerivationFrameworkHiggs ) { + DECLARE_TOOL( SkimmingToolHIGG1 ) + DECLARE_TOOL( SkimmingToolHIGG2 ) + DECLARE_TOOL( SkimmingToolHIGG5VBF ) +} + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/components/DerivationFrameworkHiggs_load.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/components/DerivationFrameworkHiggs_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f1802eb1481909874b6fec533937f9ce9a20746c --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/src/components/DerivationFrameworkHiggs_load.cxx @@ -0,0 +1,3 @@ +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(DerivationFrameworkHiggs)