Skip to content

Commit

Permalink
Split plugins into multiple files.
Browse files Browse the repository at this point in the history
  • Loading branch information
hqucms committed Apr 22, 2024
1 parent 7e564e8 commit e4328e7
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 95 deletions.
98 changes: 4 additions & 94 deletions PhysicsTools/NanoAOD/plugins/SimpleFlatTableProducerPlugins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,15 @@ typedef SimpleFlatTableProducer<reco::Track> SimpleTrackFlatTableProducer;
#include "DataFormats/JetReco/interface/PFJet.h"
typedef SimpleFlatTableProducer<reco::PFJet> SimplePFJetFlatTableProducer;

#include "DataFormats/VertexReco/interface/Vertex.h"
typedef SimpleFlatTableProducer<reco::Vertex> SimpleVertexFlatTableProducer;

#include "DataFormats/Candidate/interface/VertexCompositePtrCandidate.h"
typedef SimpleFlatTableProducer<reco::VertexCompositePtrCandidate> SimpleSecondaryVertexFlatTableProducer;

#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
typedef SimpleFlatTableProducer<reco::GenParticle> SimpleGenParticleFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Electron.h"
typedef SimpleFlatTableProducer<pat::Electron> SimplePATElectronFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Muon.h"
typedef SimpleFlatTableProducer<pat::Muon> SimplePATMuonFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Tau.h"
typedef SimpleFlatTableProducer<pat::Tau> SimplePATTauFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Photon.h"
typedef SimpleFlatTableProducer<pat::Photon> SimplePATPhotonFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Jet.h"
typedef SimpleFlatTableProducer<pat::Jet> SimplePATJetFlatTableProducer;

#include "DataFormats/PatCandidates/interface/IsolatedTrack.h"
typedef SimpleFlatTableProducer<pat::IsolatedTrack> SimplePATIsolatedTrackFlatTableProducer;

#include "DataFormats/PatCandidates/interface/GenericParticle.h"
typedef SimpleFlatTableProducer<pat::GenericParticle> SimplePATGenericParticleFlatTableProducer;

#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
typedef SimpleFlatTableProducer<pat::PackedCandidate> SimplePATCandidateFlatTableProducer;

#include "DataFormats/PatCandidates/interface/MET.h"
typedef SimpleFlatTableProducer<pat::MET> SimplePATMETFlatTableProducer;

typedef SimpleTypedExternalFlatTableProducer<reco::Candidate, reco::Candidate>
SimpleCandidate2CandidateFlatTableProducer;

Expand Down Expand Up @@ -69,64 +45,13 @@ typedef EventSingletonSimpleFlatTableProducer<OnlineLuminosityRecord> SimpleOnli
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
typedef EventSingletonSimpleFlatTableProducer<reco::BeamSpot> SimpleBeamspotFlatTableProducer;

#include "DataFormats/L1Trigger/interface/EGamma.h"
typedef BXVectorSimpleFlatTableProducer<l1t::EGamma> SimpleTriggerL1EGFlatTableProducer;

#include "DataFormats/L1Trigger/interface/Jet.h"
typedef BXVectorSimpleFlatTableProducer<l1t::Jet> SimpleTriggerL1JetFlatTableProducer;

#include "DataFormats/L1Trigger/interface/Tau.h"
typedef BXVectorSimpleFlatTableProducer<l1t::Tau> SimpleTriggerL1TauFlatTableProducer;

#include "DataFormats/L1Trigger/interface/Muon.h"
typedef BXVectorSimpleFlatTableProducer<l1t::Muon> SimpleTriggerL1MuonFlatTableProducer;

#include "DataFormats/L1Trigger/interface/EtSum.h"
typedef BXVectorSimpleFlatTableProducer<l1t::EtSum> SimpleTriggerL1EtSumFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingVertex.h"
typedef SimpleFlatTableProducer<Run3ScoutingVertex> SimpleRun3ScoutingVertexFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
typedef SimpleFlatTableProducer<Run3ScoutingPhoton> SimpleRun3ScoutingPhotonFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingMuon.h"
typedef SimpleFlatTableProducer<Run3ScoutingMuon> SimpleRun3ScoutingMuonFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
typedef SimpleFlatTableProducer<Run3ScoutingElectron> SimpleRun3ScoutingElectronFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingTrack.h"
typedef SimpleFlatTableProducer<Run3ScoutingTrack> SimpleRun3ScoutingTrackFlatTableProducer;

#include "DataFormats/VertexReco/interface/Vertex.h"
typedef SimpleFlatTableProducer<reco::Vertex> SimpleVertexFlatTableProducer;

#include "DataFormats/VertexReco/interface/TrackTimeLifeInfo.h"
typedef SimpleTypedExternalFlatTableProducer<reco::Candidate, TrackTimeLifeInfo>
SimpleCandidate2TrackTimeLifeInfoFlatTableProducer;
typedef SimpleTypedExternalFlatTableProducer<pat::Electron, TrackTimeLifeInfo>
SimplePATElectron2TrackTimeLifeInfoFlatTableProducer;
typedef SimpleTypedExternalFlatTableProducer<pat::Muon, TrackTimeLifeInfo>
SimplePATMuon2TrackTimeLifeInfoFlatTableProducer;
typedef SimpleTypedExternalFlatTableProducer<pat::Tau, TrackTimeLifeInfo>
SimplePATTau2TrackTimeLifeInfoFlatTableProducer;

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SimpleCandidateFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimplePFJetFlatTableProducer);
DEFINE_FWK_MODULE(SimpleVertexFlatTableProducer);
DEFINE_FWK_MODULE(SimpleSecondaryVertexFlatTableProducer);
DEFINE_FWK_MODULE(SimpleGenParticleFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATElectronFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATMuonFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATTauFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATPhotonFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATJetFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATIsolatedTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATGenericParticleFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATCandidateFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATMETFlatTableProducer);
DEFINE_FWK_MODULE(SimpleCandidate2CandidateFlatTableProducer);
DEFINE_FWK_MODULE(SimpleGenEventFlatTableProducer);
DEFINE_FWK_MODULE(SimpleGenFilterFlatTableProducerLumi);
Expand All @@ -136,18 +61,3 @@ DEFINE_FWK_MODULE(SimpleLocalTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimpleXYZPointFlatTableProducer);
DEFINE_FWK_MODULE(SimpleOnlineLuminosityFlatTableProducer);
DEFINE_FWK_MODULE(SimpleBeamspotFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1EGFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1JetFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1MuonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1TauFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1EtSumFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingVertexFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingPhotonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingMuonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingElectronFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimpleVertexFlatTableProducer);
DEFINE_FWK_MODULE(SimpleCandidate2TrackTimeLifeInfoFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATElectron2TrackTimeLifeInfoFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATMuon2TrackTimeLifeInfoFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATTau2TrackTimeLifeInfoFlatTableProducer);
24 changes: 24 additions & 0 deletions PhysicsTools/NanoAOD/plugins/SimpleL1TFlatTableProducerPlugins.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h"

#include "DataFormats/L1Trigger/interface/EGamma.h"
typedef BXVectorSimpleFlatTableProducer<l1t::EGamma> SimpleTriggerL1EGFlatTableProducer;

#include "DataFormats/L1Trigger/interface/Jet.h"
typedef BXVectorSimpleFlatTableProducer<l1t::Jet> SimpleTriggerL1JetFlatTableProducer;

#include "DataFormats/L1Trigger/interface/Tau.h"
typedef BXVectorSimpleFlatTableProducer<l1t::Tau> SimpleTriggerL1TauFlatTableProducer;

#include "DataFormats/L1Trigger/interface/Muon.h"
typedef BXVectorSimpleFlatTableProducer<l1t::Muon> SimpleTriggerL1MuonFlatTableProducer;

#include "DataFormats/L1Trigger/interface/EtSum.h"
typedef BXVectorSimpleFlatTableProducer<l1t::EtSum> SimpleTriggerL1EtSumFlatTableProducer;

#include "FWCore/Framework/interface/MakerMacros.h"

DEFINE_FWK_MODULE(SimpleTriggerL1EGFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1JetFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1MuonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1TauFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1EtSumFlatTableProducer);
50 changes: 50 additions & 0 deletions PhysicsTools/NanoAOD/plugins/SimplePATFlatTableProducerPlugins.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h"

#include "DataFormats/PatCandidates/interface/Electron.h"
typedef SimpleFlatTableProducer<pat::Electron> SimplePATElectronFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Muon.h"
typedef SimpleFlatTableProducer<pat::Muon> SimplePATMuonFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Tau.h"
typedef SimpleFlatTableProducer<pat::Tau> SimplePATTauFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Photon.h"
typedef SimpleFlatTableProducer<pat::Photon> SimplePATPhotonFlatTableProducer;

#include "DataFormats/PatCandidates/interface/Jet.h"
typedef SimpleFlatTableProducer<pat::Jet> SimplePATJetFlatTableProducer;

#include "DataFormats/PatCandidates/interface/IsolatedTrack.h"
typedef SimpleFlatTableProducer<pat::IsolatedTrack> SimplePATIsolatedTrackFlatTableProducer;

#include "DataFormats/PatCandidates/interface/GenericParticle.h"
typedef SimpleFlatTableProducer<pat::GenericParticle> SimplePATGenericParticleFlatTableProducer;

#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
typedef SimpleFlatTableProducer<pat::PackedCandidate> SimplePATCandidateFlatTableProducer;

#include "DataFormats/PatCandidates/interface/MET.h"
typedef SimpleFlatTableProducer<pat::MET> SimplePATMETFlatTableProducer;

#include "DataFormats/VertexReco/interface/TrackTimeLifeInfo.h"
typedef SimpleTypedExternalFlatTableProducer<pat::Electron, TrackTimeLifeInfo>
SimplePATElectron2TrackTimeLifeInfoFlatTableProducer;
typedef SimpleTypedExternalFlatTableProducer<pat::Muon, TrackTimeLifeInfo>
SimplePATMuon2TrackTimeLifeInfoFlatTableProducer;
typedef SimpleTypedExternalFlatTableProducer<pat::Tau, TrackTimeLifeInfo>
SimplePATTau2TrackTimeLifeInfoFlatTableProducer;

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SimplePATElectronFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATMuonFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATTauFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATPhotonFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATJetFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATIsolatedTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATGenericParticleFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATCandidateFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATMETFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATElectron2TrackTimeLifeInfoFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATMuon2TrackTimeLifeInfoFlatTableProducer);
DEFINE_FWK_MODULE(SimplePATTau2TrackTimeLifeInfoFlatTableProducer);
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h"

#include "DataFormats/Scouting/interface/Run3ScoutingVertex.h"
typedef SimpleFlatTableProducer<Run3ScoutingVertex> SimpleRun3ScoutingVertexFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingPhoton.h"
typedef SimpleFlatTableProducer<Run3ScoutingPhoton> SimpleRun3ScoutingPhotonFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingMuon.h"
typedef SimpleFlatTableProducer<Run3ScoutingMuon> SimpleRun3ScoutingMuonFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingElectron.h"
typedef SimpleFlatTableProducer<Run3ScoutingElectron> SimpleRun3ScoutingElectronFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingTrack.h"
typedef SimpleFlatTableProducer<Run3ScoutingTrack> SimpleRun3ScoutingTrackFlatTableProducer;

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SimpleRun3ScoutingVertexFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingPhotonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingMuonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingElectronFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingTrackFlatTableProducer);
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/custom_muon_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ def AddVariablesForMuon(proc):
proc.muonTable.variables.innerTrackExtraIdx = Var('? innerTrack().isNonnull() ? innerTrack().extra().key() : -99', 'int', precision=-1, doc='Index of the innerTrack TrackExtra in the original collection')

#Jet Related Variables
# lazyEval=True: userCand() returns the base type `reco::CandidatePtr`, needs to be dynamically casted to pat::Jet to call the userFloat() / bDiscriminator() methods
proc.muonTable.variables.jetPtRatio = Var("?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1.0/(1.0+(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt)", float, doc="ptRatio using the LepAware JEC approach, for muon MVA", lazyEval=True)
proc.muonTable.variables.jetDF = Var("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0",float,doc="b-tagging discriminator of the jet matched to the lepton, for muon MVA", lazyEval=True)
proc.muonTable.variables.jetCSVv2 = Var("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfCombinedSecondaryVertexV2BJetTags'),0.0):0.0",float,doc="CSVv2 b-tagging discriminator of the jet matched to the lepton, for muon MVA", lazyEval=True)


#nSegments
proc.muonTable.variables.nsegments = Var("userInt('nsegments')", int, doc = "nsegments as of Spark-tool")
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/NanoAOD/python/taus_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def _tauIdWPMask(pattern, choices, doc="", from_raw=False, wp_thrs=None):
leadTkDeltaEta = Var("?leadChargedHadrCand.isNonnull()?(leadChargedHadrCand.eta - eta):0",float, doc="eta of the leading track, minus tau eta",precision=8),
leadTkDeltaPhi = Var("?leadChargedHadrCand.isNonnull()?deltaPhi(leadChargedHadrCand.phi, phi):0",float, doc="phi of the leading track, minus tau phi",precision=8),

# lazyEval=True: leadChargedHadrCand() returns the base type `reco::CandidatePtr`, needs to be dynamically casted to PackedCandidate to call dxy() / dz()
dxy = Var("?leadChargedHadrCand.isNonnull()?leadChargedHadrCand().dxy():0",float, doc="d_{xy} of lead track with respect to PV, in cm (with sign)",precision=10, lazyEval=True),
dz = Var("?leadChargedHadrCand.isNonnull()?leadChargedHadrCand().dz():0",float, doc="d_{z} of lead track with respect to PV, in cm (with sign)",precision=14, lazyEval=True),

Expand Down

0 comments on commit e4328e7

Please sign in to comment.