diff --git a/DataFormats/interface/ChargedCandidateFeatures.h b/DataFormats/interface/ChargedCandidateFeatures.h index 9c89106..85add3c 100644 --- a/DataFormats/interface/ChargedCandidateFeatures.h +++ b/DataFormats/interface/ChargedCandidateFeatures.h @@ -1,47 +1,142 @@ #ifndef LLPReco_DataFormats_ChargedCandidateFeatures_h #define LLPReco_DataFormats_ChargedCandidateFeatures_h +#include + namespace llpdnnx { struct ChargedCandidateFeatures { + float ptrel; + float deta; + float dphi; + float deltaR; + + float px; + float py; + float pz; + + float trackEtaRel; + float trackPtRel; + float trackPPar; + float trackDeltaR; + float trackPParRatio; + float trackPtRatio; + float trackSip2dVal; + float trackSip2dSig; + float trackSip3dVal; + float trackSip3dSig; + float trackJetDistVal; + float trackJetDistSig; + float drminsv; + int vertex_association; + float fromPV; + float puppi_weight; + float track_chi2; + float track_quality; + int track_numberOfValidPixelHits; + int track_pixelLayersWithMeasurement; + int track_numberOfValidStripHits; + int track_stripLayersWithMeasurement; + float relmassdrop; + + float trackSip2dValSV; + float trackSip2dSigSV; + float trackSip3dValSV; + float trackSip3dSigSV; + + float trackSip2dValSV_adapted; + float trackSip2dSigSV_adapted; + float trackSip3dValSV_adapted; + float trackSip3dSigSV_adapted; + + int matchedMuon; + int matchedElectron; + int matchedSV; + int matchedSV_adapted; + int track_ndof; + + float dZmin; + + ChargedCandidateFeatures(): + ptrel(-1), + deta(1), + dphi(1), + deltaR(1), + + px(0), + py(0), + pz(0), + + trackEtaRel(0), + trackPtRel(0), + trackPPar(0), + trackDeltaR(0), + trackPParRatio(0), + trackPtRatio(0), + trackSip2dVal(0), + trackSip2dSig(0), + trackSip3dVal(0), + trackSip3dSig(0), + trackJetDistVal(0), + trackJetDistSig(0), + drminsv(0), + vertex_association(0), + fromPV(0), + puppi_weight(0), + track_chi2(0), + track_quality(0), + track_numberOfValidPixelHits(0), + track_pixelLayersWithMeasurement(0), + track_numberOfValidStripHits(0), + track_stripLayersWithMeasurement(0), + relmassdrop(0), + + trackSip2dValSV(1), + trackSip2dSigSV(0), + trackSip3dValSV(1), + trackSip3dSigSV(0), + + trackSip2dValSV_adapted(1), + trackSip2dSigSV_adapted(0), + trackSip3dValSV_adapted(1), + trackSip3dSigSV_adapted(0), + + matchedMuon(0), + matchedElectron(0), + matchedSV(0), + matchedSV_adapted(0), + + track_ndof(0), + dZmin(100) + {} + + bool operator<(const ChargedCandidateFeatures& other) const + { + if (trackSip2dSig>0 and other.trackSip2dSig>0) + { + return std::fabs(trackSip2dSig)>std::fabs(other.trackSip2dSig); //sort decreasing + } + else if (trackSip2dSig<0 and other.trackSip2dSig>0) + { + return false; + } + else if (trackSip2dSig>0 and other.trackSip2dSig<0) + { + return true; + } + else if (std::fabs(drminsv-other.drminsv)>std::numeric_limits::epsilon()) + { + return drminsvother.ptrel; //sort decreasing + } + + return false; + } - int cpf_jetIdx; - float cpf_ptrel; - float cpf_deta; - float cpf_dphi; - - float cpf_trackEtaRel; - float cpf_trackPtRel; - float cpf_trackPPar; - float cpf_trackDeltaR; - float cpf_trackPParRatio; - float cpf_trackPtRatio; - float cpf_trackSip2dVal; - float cpf_trackSip2dSig; - float cpf_trackSip3dVal; - float cpf_trackSip3dSig; - float cpf_trackJetDistVal; - float cpf_trackJetDistSig; - float cpf_drminsv; - int cpf_vertex_association; - float cpf_fromPV; - float cpf_puppi_weight; - float cpf_track_chi2; - float cpf_track_quality; - int cpf_track_numberOfValidPixelHits; - int cpf_track_pixelLayersWithMeasurement; - int cpf_track_numberOfValidStripHits; - int cpf_track_stripLayersWithMeasurement; - float cpf_relmassdrop; - - int cpf_matchedMuon; - int cpf_matchedElectron; - int cpf_matchedSV; - int cpf_matchedSV_adapted; - int cpf_track_ndof; - - float cpf_dZmin; }; } diff --git a/DataFormats/interface/ElectronCandidateFeatures.h b/DataFormats/interface/ElectronCandidateFeatures.h index 76e1d35..3289e66 100644 --- a/DataFormats/interface/ElectronCandidateFeatures.h +++ b/DataFormats/interface/ElectronCandidateFeatures.h @@ -3,101 +3,217 @@ namespace llpdnnx { -class ElectronCandidateFeatures { - - public: - int elec_jetIdx; - float elec_ptrel; - float elec_jetDeltaR; - float elec_deta; - float elec_dphi; - float elec_charge; - float elec_energy; - float elec_EtFromCaloEn; - int elec_isEB; - int elec_isEE; - float elec_ecalEnergy; - int elec_isPassConversionVeto; - float elec_convDist; - int elec_convFlags; - float elec_convRadius; - float elec_hadronicOverEm; - float elec_ecalDrivenSeed; - float elec_2dIP; - float elec_2dIPSig; - float elec_3dIP; - float elec_3dIPSig; +struct ElectronCandidateFeatures { + float ptrel; + float deltaR; + float deta; + float dphi; + float px; + float py; + float pz; + float charge; + float energy; + float EtFromCaloEn; + int isEB; + int isEE; + float ecalEnergy; + int isPassConversionVeto; + float convDist; + int convFlags; + float convRadius; + float hadronicOverEm; + float ecalDrivenSeed; + float IP2d; + float IP2dSig; + float IP3d; + float IP3dSig; float elecSC_energy; float elecSC_deta; float elecSC_dphi; float elecSC_et; float elecSC_eSuperClusterOverP; - float elec_scPixCharge; - float elec_superClusterFbrem; + float scPixCharge; + float superClusterFbrem; - float elec_eSeedClusterOverP; - float elec_eSeedClusterOverPout; - float elec_eSuperClusterOverP; + float eSeedClusterOverP; + float eSeedClusterOverPout; + float eSuperClusterOverP; // shower shape - float elec_sigmaEtaEta; - float elec_sigmaIetaIeta; - float elec_sigmaIphiIphi; - float elec_e5x5; - float elec_e5x5Rel; - float elec_e1x5Overe5x5; - float elec_e2x5MaxOvere5x5; - float elec_r9; - float elec_hcalOverEcal; - float elec_hcalDepth1OverEcal; - float elec_hcalDepth2OverEcal; + float sigmaEtaEta; + float sigmaIetaIeta; + float sigmaIphiIphi; + float e5x5; + float e5x5Rel; + float e1x5Overe5x5; + float e2x5MaxOvere5x5; + float r9; + float hcalOverEcal; + float hcalDepth1OverEcal; + float hcalDepth2OverEcal; // Track-Cluster Matching Attributes - float elec_deltaEtaEleClusterTrackAtCalo; - float elec_deltaEtaSeedClusterTrackAtCalo; - float elec_deltaPhiSeedClusterTrackAtCalo; - float elec_deltaEtaSeedClusterTrackAtVtx; - float elec_deltaEtaSuperClusterTrackAtVtx; - float elec_deltaPhiEleClusterTrackAtCalo; - float elec_deltaPhiSuperClusterTrackAtVtx; + float deltaEtaEleClusterTrackAtCalo; + float deltaEtaSeedClusterTrackAtCalo; + float deltaPhiSeedClusterTrackAtCalo; + float deltaEtaSeedClusterTrackAtVtx; + float deltaEtaSuperClusterTrackAtVtx; + float deltaPhiEleClusterTrackAtCalo; + float deltaPhiSuperClusterTrackAtVtx; - float elec_sCseedEta; + float sCseedEta; // electron gsf variables. - float elec_EtaRel; - float elec_dxy; - float elec_dz; - int elec_nbOfMissingHits; - float elec_gsfCharge; - int elec_ndof; - float elec_chi2; - int elec_numberOfBrems; - float elec_trackFbrem; - float elec_fbrem; + float EtaRel; + float dxy; + float dxyError; + float dxySig; + float dz; + float dzError; + float dzSig; + int nbOfMissingHits; + float gsfCharge; + int ndof; + float chi2; + int numberOfBrems; + float fbrem; // Isolation block - float elec_neutralHadronIso; - float elec_particleIso; - float elec_photonIso; - float elec_puChargedHadronIso; - float elec_trackIso; - float elec_ecalPFClusterIso; - float elec_hcalPFClusterIso; + float neutralHadronIso; + float particleIso; + float photonIso; + float puChargedHadronIso; + float trackIso; + float ecalPFClusterIso; + float hcalPFClusterIso; - float elec_pfSumPhotonEt; - float elec_pfSumChargedHadronPt; - float elec_pfSumNeutralHadronEt; - float elec_pfSumPUPt; - - float elec_dr04TkSumPt; - float elec_dr04EcalRecHitSumEt; - float elec_dr04HcalDepth1TowerSumEt; - float elec_dr04HcalDepth1TowerSumEtBc; - float elec_dr04HcalDepth2TowerSumEt; - float elec_dr04HcalDepth2TowerSumEtBc; - float elec_dr04HcalTowerSumEt; - float elec_dr04HcalTowerSumEtBc; + float pfSumPhotonEt; + float pfSumChargedHadronPt; + float pfSumNeutralHadronEt; + float pfSumPUPt; + + float dr04TkSumPt; + float dr04EcalRecHitSumEt; + float dr04HcalDepth1TowerSumEt; + float dr04HcalDepth1TowerSumEtBc; + float dr04HcalDepth2TowerSumEt; + float dr04HcalDepth2TowerSumEtBc; + float dr04HcalTowerSumEt; + float dr04HcalTowerSumEtBc; + + + ElectronCandidateFeatures(): + ptrel(0), + deltaR(0), + deta(0), + dphi(0), + px(0), + py(0), + pz(0), + charge(0), + energy(0), + EtFromCaloEn(0), + isEB(0), + isEE(0), + ecalEnergy(0), + isPassConversionVeto(0), + convDist(0), + convFlags(0), + convRadius(0), + hadronicOverEm(0), + ecalDrivenSeed(0), + IP2d(0), + IP2dSig(0), + IP3d(0), + IP3dSig(0), + + elecSC_energy(0), + elecSC_deta(0), + elecSC_dphi(0), + elecSC_et(0), + elecSC_eSuperClusterOverP(0), + scPixCharge(0), + superClusterFbrem(0), + + eSeedClusterOverP(0), + eSeedClusterOverPout(0), + eSuperClusterOverP(0), + + // shower shape + sigmaEtaEta(0), + sigmaIetaIeta(0), + sigmaIphiIphi(0), + e5x5(0), + e5x5Rel(0), + e1x5Overe5x5(0), + e2x5MaxOvere5x5(0), + r9(0), + hcalOverEcal(0), + hcalDepth1OverEcal(0), + hcalDepth2OverEcal(0), + + // Track-Cluster Matching Attributes + deltaEtaEleClusterTrackAtCalo(0), + deltaEtaSeedClusterTrackAtCalo(0), + deltaPhiSeedClusterTrackAtCalo(0), + deltaEtaSeedClusterTrackAtVtx(0), + deltaEtaSuperClusterTrackAtVtx(0), + deltaPhiEleClusterTrackAtCalo(0), + deltaPhiSuperClusterTrackAtVtx(0), + + sCseedEta(0), + + // electron gsf variables. + EtaRel(0), + dxy(0), + dxyError(0), + dxySig(0), + dz(0), + dzError(0), + dzSig(0), + nbOfMissingHits(0), + gsfCharge(0), + ndof(0), + chi2(0), + numberOfBrems(0), + fbrem(0), + + // Isolation block + neutralHadronIso(0), + particleIso(0), + photonIso(0), + puChargedHadronIso(0), + trackIso(0), + ecalPFClusterIso(0), + hcalPFClusterIso(0), + + pfSumPhotonEt(0), + pfSumChargedHadronPt(0), + pfSumNeutralHadronEt(0), + pfSumPUPt(0), + + dr04TkSumPt(0), + dr04EcalRecHitSumEt(0), + dr04HcalDepth1TowerSumEt(0), + dr04HcalDepth1TowerSumEtBc(0), + dr04HcalDepth2TowerSumEt(0), + dr04HcalDepth2TowerSumEtBc(0), + dr04HcalTowerSumEt(0), + dr04HcalTowerSumEtBc(0) + {} + + bool operator<(const ElectronCandidateFeatures& other) const + { + if (IP2dSig>0 and other.IP2dSig>0) + { + if (std::fabs(IP2dSig-other.IP2dSig)>std::numeric_limits::epsilon()) + { + return std::fabs(IP2dSig)>std::fabs(other.IP2dSig); //sort decreasing + } + } + return ptrel>other.ptrel; //sort decreasing + } }; } diff --git a/DataFormats/interface/JetFeatures.h b/DataFormats/interface/JetFeatures.h index 2c1262d..dbefbdf 100644 --- a/DataFormats/interface/JetFeatures.h +++ b/DataFormats/interface/JetFeatures.h @@ -5,8 +5,6 @@ namespace llpdnnx { struct JetFeatures { - - int jetIdx; float pt; float eta; float phi; @@ -49,8 +47,14 @@ struct JetFeatures float eventShapeC; float eventShapeD; + int numberCpf; + int numberNpf; + int numberSv; + int numberSvAdapted; + int numberMuon; + int numberElectron; + JetFeatures(): - jetIdx(-1), pt(-1), eta(0), phi(0), @@ -91,7 +95,14 @@ struct JetFeatures circularity(-1), isotropy(-1), eventShapeC(-1), - eventShapeD(-1) + eventShapeD(-1), + + numberCpf(0), + numberNpf(0), + numberSv(0), + numberSvAdapted(0), + numberMuon(0), + numberElectron(0) { } diff --git a/DataFormats/interface/LLPLabel.h b/DataFormats/interface/LLPLabel.h index 6186ee9..8596b26 100644 --- a/DataFormats/interface/LLPLabel.h +++ b/DataFormats/interface/LLPLabel.h @@ -15,17 +15,16 @@ class LLPLabel { isPU, isB, isBB, - isGBB, isLeptonic_B, - isLeptonic_C, isC, isCC, - isGCC, + isLeptonic_C, isS, isUD, isG, isPrompt_MU, isPrompt_E, + isPrompt_PHOTON, isPrompt_TAU, isLLP_RAD, //no flavour match (likely from wide angle radiation) @@ -46,13 +45,34 @@ class LLPLabel { isLLP_TAU, isLLP_QTAU, isLLP_QQTAU, + isLLP_BTAU, + isLLP_BBTAU, + + isLLP_PHOTON, + isLLP_QPHOTON, + isLLP_QQPHOTON, + isLLP_BPHOTON, + isLLP_BBPHOTON, isUndefined }; Type type; - int jetIdx; + enum class TauDecay { + NO_TAU, //no tau decay + INVISIBLE, //tau decay but not reconstructable + E, //to electron + MU, //to muon + H, //1 charged hadron + H_1PI0, //1 charged hadron + pi0(->2gamma) + H_XPI0, //1 charged hadron + 2 or more pi0(->2gamma) + HHH, //3 charged hadrons + HHH_XPI0 //3 charged hadron + 1 or more pi0(->2gamma) + }; + + TauDecay tauDecay; + int partonFlavor; int hadronFlavor; int llpId; @@ -65,11 +85,17 @@ class LLPLabel { float decay_angle; float betagamma; + float matchedGenJetDeltaR; float matchedGenJetPt; + float sharedVertexFraction; + + float genTauMass; + float recoTauMass; LLPLabel(): type(Type::isUndefined), + tauDecay(TauDecay::NO_TAU), partonFlavor(0), hadronFlavor(0), llpId(0), @@ -81,7 +107,10 @@ class LLPLabel { decay_angle(0), betagamma(0), matchedGenJetDeltaR(-1), - matchedGenJetPt(-1) + matchedGenJetPt(-1), + sharedVertexFraction(0), + genTauMass(-1), + recoTauMass(-1) { } @@ -95,8 +124,6 @@ class LLPLabel { return "isB"; case Type::isBB: return "isBB"; - case Type::isGBB: - return "isGBB"; case Type::isLeptonic_B: return "isLeptonic_B"; case Type::isLeptonic_C: @@ -105,8 +132,6 @@ class LLPLabel { return "isC"; case Type::isCC: return "isCC"; - case Type::isGCC: - return "isGCC"; case Type::isS: return "isS"; case Type::isUD: @@ -120,6 +145,8 @@ class LLPLabel { return "isPrompt_E"; case Type::isPrompt_TAU: return "isPrompt_TAU"; + case Type::isPrompt_PHOTON: + return "isPrompt_PHOTON"; case Type::isLLP_RAD: return "isLLP_RAD"; @@ -167,6 +194,21 @@ class LLPLabel { return "isLLP_QTAU"; case Type::isLLP_QQTAU: return "isLLP_QQTAU"; + case Type::isLLP_BTAU: + return "isLLP_BTAU"; + case Type::isLLP_BBTAU: + return "isLLP_BBTAU"; + + case Type::isLLP_PHOTON: + return "isLLP_TAU"; + case Type::isLLP_QPHOTON: + return "isLLP_QTAU"; + case Type::isLLP_QQPHOTON: + return "isLLP_QQTAU"; + case Type::isLLP_BPHOTON: + return "isLLP_BTAU"; + case Type::isLLP_BBPHOTON: + return "isLLP_BBTAU"; case Type::isUndefined: return "isUndefined"; diff --git a/DataFormats/interface/MuonCandidateFeatures.h b/DataFormats/interface/MuonCandidateFeatures.h index 3b3c7f4..55e38fc 100644 --- a/DataFormats/interface/MuonCandidateFeatures.h +++ b/DataFormats/interface/MuonCandidateFeatures.h @@ -5,59 +5,130 @@ namespace llpdnnx { struct MuonCandidateFeatures { - int mu_jetIdx; - int mu_isGlobal; - int mu_isTight; - int mu_isMedium; - int mu_isLoose; - int mu_isStandAlone; - - float mu_ptrel; - float mu_deta; - float mu_dphi; - float mu_charge; - float mu_energy; - float mu_et; - float mu_jetDeltaR; - int mu_numberOfMatchedStations; - - float mu_2dIP; - float mu_2dIPSig; - float mu_3dIP; - float mu_3dIPSig; - - float mu_EtaRel; - float mu_dxy; - float mu_dxyError; - float mu_dxySig; - float mu_dz; - float mu_dzError; - int mu_numberOfValidPixelHits; - int mu_numberOfpixelLayersWithMeasurement; - int mu_numberOfstripLayersWithMeasurement; //that does not help. needs to be discussed. - - float mu_chi2; - int mu_ndof; - - float mu_caloIso; - float mu_ecalIso; - float mu_hcalIso; - - float mu_sumPfChHadronPt; - float mu_sumPfNeuHadronEt; - float mu_Pfpileup; - float mu_sumPfPhotonEt; - - float mu_sumPfChHadronPt03; - float mu_sumPfNeuHadronEt03; - float mu_Pfpileup03; - float mu_sumPfPhotonEt03; - - - float mu_timeAtIpInOut; - float mu_timeAtIpInOutErr; - float mu_timeAtIpOutIn; - + int isGlobal; + int isTight; + int isMedium; + int isLoose; + int isStandAlone; + + float ptrel; + float deta; + float dphi; + float px; + float py; + float pz; + float charge; + float energy; + float et; + float deltaR; + int numberOfMatchedStations; + + float IP2d; + float IP2dSig; + float IP3d; + float IP3dSig; + + float EtaRel; + float dxy; + float dxyError; + float dxySig; + float dz; + float dzError; + float dzSig; + int numberOfValidPixelHits; + int numberOfpixelLayersWithMeasurement; + int numberOfstripLayersWithMeasurement; //that does not help. needs to be discussed. + + float chi2; + int ndof; + + float caloIso; + float ecalIso; + float hcalIso; + + float sumPfChHadronPt; + float sumPfNeuHadronEt; + float Pfpileup; + float sumPfPhotonEt; + + float sumPfChHadronPt03; + float sumPfNeuHadronEt03; + float Pfpileup03; + float sumPfPhotonEt03; + + float timeAtIpInOut; + float timeAtIpInOutErr; + float timeAtIpOutIn; + + + MuonCandidateFeatures(): + isGlobal(-1), + isTight(-1), + isMedium(-1), + isLoose(-1), + isStandAlone(-1), + + ptrel(0), + deta(0), + dphi(0), + px(0), + py(0), + pz(0), + charge(0), + energy(0), + et(0), + deltaR(0), + numberOfMatchedStations(0), + + IP2d(0), + IP2dSig(0), + IP3d(0), + IP3dSig(0), + + EtaRel(0), + dxy(0), + dxyError(0), + dxySig(0), + dz(0), + dzError(0), + dzSig(0), + numberOfValidPixelHits(0), + numberOfpixelLayersWithMeasurement(0), + numberOfstripLayersWithMeasurement(0), //that does not help. needs to be discussed. + + chi2(0), + ndof(0), + + caloIso(0), + ecalIso(0), + hcalIso(0), + + sumPfChHadronPt(0), + sumPfNeuHadronEt(0), + Pfpileup(0), + sumPfPhotonEt(0), + + sumPfChHadronPt03(0), + sumPfNeuHadronEt03(0), + Pfpileup03(0), + sumPfPhotonEt03(0), + + timeAtIpInOut(0), + timeAtIpInOutErr(0), + timeAtIpOutIn(0) + {} + + bool operator<(const MuonCandidateFeatures& other) const + { + if (IP2dSig>0 and other.IP2dSig>0) + { + if (std::fabs(IP2dSig-other.IP2dSig)>std::numeric_limits::epsilon()) + { + return std::fabs(IP2dSig)>std::fabs(other.IP2dSig); //sort decreasing + } + } + return ptrel>other.ptrel; //sort decreasing + } }; diff --git a/DataFormats/interface/NeutralCandidateFeatures.h b/DataFormats/interface/NeutralCandidateFeatures.h index 6e448e4..c3648eb 100644 --- a/DataFormats/interface/NeutralCandidateFeatures.h +++ b/DataFormats/interface/NeutralCandidateFeatures.h @@ -1,20 +1,56 @@ #ifndef LLPReco_DataFormats_NeutralCandidateFeatures_h #define LLPReco_DataFormats_NeutralCandidateFeatures_h +#include + namespace llpdnnx { struct NeutralCandidateFeatures { - int npf_jetIdx; - float npf_ptrel; - float npf_deta; - float npf_dphi; - float npf_deltaR; - int npf_isGamma; - float npf_hcal_fraction; - float npf_drminsv; - float npf_puppi_weight; - float npf_relmassdrop; + float ptrel; + float deta; + float dphi; + float deltaR; + + float px; + float py; + float pz; + + int isGamma; + float hcal_fraction; + float drminsv; + float puppi_weight; + float relmassdrop; + + NeutralCandidateFeatures(): + ptrel(0), + deta(0), + dphi(0), + deltaR(0), + + px(0), + py(0), + pz(0), + + isGamma(0), + hcal_fraction(0), + drminsv(0), + puppi_weight(0), + relmassdrop(0) + {} + + bool operator<(const NeutralCandidateFeatures& other) const + { + if (std::fabs(drminsv-other.drminsv)>std::numeric_limits::epsilon()) + { + return drminsvother.ptrel; //sort decreasing + } + return false; + } }; } diff --git a/DataFormats/interface/SecondaryVertexFeatures.h b/DataFormats/interface/SecondaryVertexFeatures.h index aff8b28..f416072 100644 --- a/DataFormats/interface/SecondaryVertexFeatures.h +++ b/DataFormats/interface/SecondaryVertexFeatures.h @@ -1,26 +1,61 @@ #ifndef LLPReco_DataFormats_SecondaryVertexFeatures_h #define LLPReco_DataFormats_SecondaryVertexFeatures_h +#include + namespace llpdnnx { struct SecondaryVertexFeatures { - - int sv_jetIdx; - float sv_ptrel; - float sv_deta; - float sv_dphi; - float sv_deltaR; - float sv_mass; - int sv_ntracks; - float sv_chi2; - int sv_ndof; - float sv_dxy; - float sv_dxysig; - float sv_d3d; - float sv_d3dsig; - float sv_costhetasvpv; - float sv_enratio; + float ptrel; + float deta; + float dphi; + float deltaR; + float mass; + int ntracks; + float chi2; + int ndof; + float dxy; + float dxysig; + float d3d; + float d3dsig; + float costhetasvpv; + float enratio; + float vx; //vertex position if we want to make NI map + float vy; + float vz; + + SecondaryVertexFeatures(): + ptrel(0), + deta(0), + dphi(0), + deltaR(0), + mass(0), + ntracks(0), + chi2(0), + ndof(0), + dxy(0), + dxysig(0), + d3d(0), + d3dsig(0), + costhetasvpv(0), + enratio(0), + vx(0), + vy(0), + vz(0) + {} + + bool operator<(const SecondaryVertexFeatures& other) const + { + if (dxysig>0 and other.dxysig>0) + { + if (std::fabs(dxysig-other.dxysig)>std::numeric_limits::epsilon()) + { + return dxysig>other.dxysig; + } + } + return ptrel>other.ptrel; //sort decreasing + } }; diff --git a/DataFormats/interface/ShallowTagInfoFeatures.h b/DataFormats/interface/ShallowTagInfoFeatures.h index f52176f..3df3fb4 100644 --- a/DataFormats/interface/ShallowTagInfoFeatures.h +++ b/DataFormats/interface/ShallowTagInfoFeatures.h @@ -6,17 +6,29 @@ namespace llpdnnx { struct ShallowTagInfoFeatures { // jet general - int csv_jetIdx; - float csv_trackSumJetEtRatio; // ratio of track sum transverse energy over jet energy - float csv_trackSumJetDeltaR; // pseudoangular distance between jet axis and track fourvector sum - int csv_vertexCategory; // category of secondary vertex (Reco, Pseudo, No) - float csv_trackSip2dValAboveCharm; // track 2D signed impact parameter of first track lifting mass above charm - float csv_trackSip2dSigAboveCharm; // track 2D signed impact parameter significance of first track lifting mass above charm - float csv_trackSip3dValAboveCharm; // track 3D signed impact parameter of first track lifting mass above charm - float csv_trackSip3dSigAboveCharm; // track 3D signed impact parameter significance of first track lifting mass above charm + float trackSumJetEtRatio; // ratio of track sum transverse energy over jet energy + float trackSumJetDeltaR; // pseudoangular distance between jet axis and track fourvector sum + int vertexCategory; // category of secondary vertex (Reco, Pseudo, No) + float trackSip2dValAboveCharm; // track 2D signed impact parameter of first track lifting mass above charm + float trackSip2dSigAboveCharm; // track 2D signed impact parameter significance of first track lifting mass above charm + float trackSip3dValAboveCharm; // track 3D signed impact parameter of first track lifting mass above charm + float trackSip3dSigAboveCharm; // track 3D signed impact parameter significance of first track lifting mass above charm // track info - int csv_jetNTracksEtaRel; // tracks associated to jet for which trackEtaRel is calculated - int csv_jetNSelectedTracks; + int jetNTracksEtaRel; // tracks associated to jet for which trackEtaRel is calculated + int jetNSelectedTracks; + + ShallowTagInfoFeatures(): + trackSumJetEtRatio(0), // ratio of track sum transverse energy over jet energy + trackSumJetDeltaR(0), // pseudoangular distance between jet axis and track fourvector sum + vertexCategory(0), // category of secondary vertex (Reco, Pseudo, No) + trackSip2dValAboveCharm(0), // track 2D signed impact parameter of first track lifting mass above charm + trackSip2dSigAboveCharm(0), // track 2D signed impact parameter significance of first track lifting mass above charm + trackSip3dValAboveCharm(0), // track 3D signed impact parameter of first track lifting mass above charm + trackSip3dSigAboveCharm(0), // track 3D signed impact parameter significance of first track lifting mass above charm + // track info + jetNTracksEtaRel(0), // tracks associated to jet for which trackEtaRel is calculated + jetNSelectedTracks(0) + {} }; diff --git a/DataFormats/interface/XTagFeatures.h b/DataFormats/interface/XTagFeatures.h index 1eba843..cd2362c 100644 --- a/DataFormats/interface/XTagFeatures.h +++ b/DataFormats/interface/XTagFeatures.h @@ -22,7 +22,9 @@ class XTagFeatures { std::vector cpf_features; std::vector mu_features; std::vector elec_features; + std::size_t npv; + }; } diff --git a/LLPLabelProducer/plugins/BuildFile.xml b/LLPLabelProducer/plugins/BuildFile.xml index b655f6f..74d6c0d 100644 --- a/LLPLabelProducer/plugins/BuildFile.xml +++ b/LLPLabelProducer/plugins/BuildFile.xml @@ -21,4 +21,7 @@ + + + diff --git a/LLPLabelProducer/plugins/LLPLabelOldProducer.cc b/LLPLabelProducer/plugins/LLPLabelOldProducer.cc new file mode 100644 index 0000000..e7398e5 --- /dev/null +++ b/LLPLabelProducer/plugins/LLPLabelOldProducer.cc @@ -0,0 +1,473 @@ +// system include files +#include +#include +#include +// user include files + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/Exception.h" + +#include "LLPReco/DataFormats/interface/DisplacedGenVertex.h" +#include "LLPReco/DataFormats/interface/LLPLabelInfo.h" + +#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h" +#include "DataFormats/PatCandidates/interface/PackedGenParticle.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Math/interface/angle.h" + +#include "DataFormats/PatCandidates/interface/Jet.h" + +#include "LLPReco/DataFormats/interface/LLPGhostFlavourInfo.h" + +#include "TH1.h" + + +using llpdnnx::DisplacedGenVertex; +using llpdnnx::DisplacedGenVertexCollection; + +class LLPLabelOldProducer: + public edm::stream::EDProducer<> + +{ + private: + struct LLPDecay + { + const reco::GenParticle* llp; + std::vector decayProducts; + + LLPDecay(): + llp(nullptr) + { + } + }; + + //TH1D *hist; + //edm::Service fs; + + + static int getHadronFlavor(const reco::Candidate& genParticle) + { + int absPdgId = std::abs(genParticle.pdgId()); + if (absPdgId<100) + { + if (absPdgId<6) return absPdgId; //parton + return 0; //not a hadron + } + int nq3 = (absPdgId/ 10)%10; //quark content + int nq2 = (absPdgId/ 100)%10; //quark content + int nq1 = (absPdgId/ 1000)%10; //quark content + int nL = (absPdgId/ 10000)%10; + int n = (absPdgId/1000000)%10; + return std::max({nq1,nq2,nq3})+n*10000+(n>0 and nL==9)*100; + } + double tauPtThreshold_; + double quarkPtThreshold_; + double bPtThreshold_; + double muonPtThreshold_; + double electronPtThreshold_; + + std::unordered_map jetsPerLabel_; + + edm::EDGetTokenT> jetToken_; + edm::EDGetTokenT> displacedGenVertexToken_; + edm::EDGetTokenT> llpFlavourInfoToken_; + + + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; + + public: + explicit LLPLabelOldProducer(const edm::ParameterSet&); + ~LLPLabelOldProducer(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +}; + +LLPLabelOldProducer::LLPLabelOldProducer(const edm::ParameterSet& iConfig): + tauPtThreshold_(iConfig.getParameter("tauPtThreshold")), + quarkPtThreshold_(iConfig.getParameter("quarkPtThreshold")), + bPtThreshold_(iConfig.getParameter("bPtThreshold")), + muonPtThreshold_(iConfig.getParameter("muonPtThreshold")), + electronPtThreshold_(iConfig.getParameter("electronPtThreshold")), + jetToken_(consumes>(iConfig.getParameter("srcJets"))), + displacedGenVertexToken_(consumes>(iConfig.getParameter("srcVertices"))), + llpFlavourInfoToken_(consumes>(iConfig.getParameter("srcFlavourInfo"))) +{ + produces(); + //hist = fs->make("ptfrac" , "ptfrac" , 100 , 0 , 1. ); +} + + +LLPLabelOldProducer::~LLPLabelOldProducer() +{ + for (const auto& labelCountPair: jetsPerLabel_) + { + std::cout<> jetCollection; + iEvent.getByToken(jetToken_, jetCollection); + + edm::Handle> displacedGenVertexCollection; + iEvent.getByToken(displacedGenVertexToken_, displacedGenVertexCollection); + + edm::Handle> llpGhostFlavourInfoMap; + iEvent.getByToken(llpFlavourInfoToken_, llpGhostFlavourInfoMap); + + auto outputLLPLabelInfo = std::make_unique(); + + for (std::size_t ijet = 0; ijet < jetCollection->size(); ijet++) + { + const pat::Jet& jet = jetCollection->at(ijet); + edm::RefToBase jet_ref(jetCollection->refAt(ijet)); + llpdnnx::LLPLabel label; + + if (not jet.genJet()) + { + label.type = llpdnnx::LLPLabel::Type::isPU; + } + else + { + int partonFlavor = abs(jet.partonFlavour()); + int hadronFlavor = abs(jet.hadronFlavour()); + + label.partonFlavor = partonFlavor; + label.hadronFlavor = hadronFlavor; + label.matchedGenJetDeltaR = reco::deltaR(jet.p4(),jet.genJet()->p4()); + label.matchedGenJetPt = jet.genJet()->pt(); + + unsigned int nbHadrons = jet.jetFlavourInfo().getbHadrons().size(); + unsigned int ncHadrons = jet.jetFlavourInfo().getcHadrons().size(); + + unsigned int nbHadronsToLeptons = 0; + unsigned int ncHadronsToLeptons = 0; + + unsigned int nPromptElectrons = 0; + unsigned int nPromptMuons = 0; + + unsigned int nGluons = 0; + + float tauPtFrac = 0; + + float promptPtThreshold = 0.6; + + if (jet.genParton() and (partonFlavor==5 or partonFlavor==4)) + { + const reco::Candidate* mother = jet.genParton(); + //walk up + while (mother->mother() and mother->mother()->pdgId()==mother->pdgId()) + { + mother = mother->mother(); + } + //find gluon anchestor + if (mother->mother() and mother->mother()->pdgId()==21) + { + nGluons+=1; + } + } + + for (unsigned int iConst = 0; iConst < jet.genJet()->numberOfDaughters(); iConst++) + { + const reco::Candidate* constituent = jet.genJet()->daughter(iConst); + const pat::PackedGenParticle* packedConstituent = dynamic_cast(constituent); + unsigned int absId = std::abs(constituent->pdgId()); + if (not (constituent->mother())) + { + continue; + } + + if (absId == 11 or absId == 13) + { + if (packedConstituent->isPromptFinalState() or packedConstituent->isDirectPromptTauDecayProductFinalState()) + { + int hadFlavor = getHadronFlavor(*constituent->mother()); + if (hadFlavor==5) nbHadronsToLeptons+=1; + if (hadFlavor==4) ncHadronsToLeptons+=1; + + float ptFrac = constituent->pt()/jet.genJet()->pt(); + if (ptFrac > promptPtThreshold) + { + if (absId == 13){ + nPromptMuons += 1; + } + else if (absId == 11){ + nPromptElectrons += 1; + } + } + } + } + + else if (packedConstituent->isDirectPromptTauDecayProductFinalState()) + { + tauPtFrac += constituent->pt()/jet.genJet()->pt(); + } + } + + + if (tauPtFrac > promptPtThreshold) + { + //hist->Fill(tauPtFrac); + label.type = llpdnnx::LLPLabel::Type::isPrompt_TAU; + } + + else if (nPromptMuons > 0) + { + label.type = llpdnnx::LLPLabel::Type::isPrompt_MU; + } + + + else if (nPromptElectrons > 0) + { + label.type = llpdnnx::LLPLabel::Type::isPrompt_E; + } + + else if (hadronFlavor==5) + { + if (nbHadronsToLeptons==0 and ncHadronsToLeptons==0) + { + if (nbHadrons>1) + { + if (nGluons==0) + { + label.type = llpdnnx::LLPLabel::Type::isBB; + } + else + { + label.type = llpdnnx::LLPLabel::Type::isBB; + } + } + else if (nbHadrons==1) + { + label.type = llpdnnx::LLPLabel::Type::isB; + } + } + else + { + if (nbHadronsToLeptons>0) + { + label.type = llpdnnx::LLPLabel::Type::isLeptonic_B; + } + else if (nbHadronsToLeptons==0 and ncHadronsToLeptons>0) + { + label.type = llpdnnx::LLPLabel::Type::isLeptonic_C; + } + } + } + else if (hadronFlavor==4) + { + if (ncHadrons>1) + { + if (nGluons==0) + { + label.type = llpdnnx::LLPLabel::Type::isCC; + } + else + { + label.type = llpdnnx::LLPLabel::Type::isCC; + } + } + else if (ncHadrons==1) + { + label.type = llpdnnx::LLPLabel::Type::isC; + } + } + else if (partonFlavor!=0) + { + if (partonFlavor==5) label.type = llpdnnx::LLPLabel::Type::isB; + if (partonFlavor==4) label.type = llpdnnx::LLPLabel::Type::isC; + if (partonFlavor==3) label.type = llpdnnx::LLPLabel::Type::isS; + if (partonFlavor==2 or partonFlavor==1) label.type = llpdnnx::LLPLabel::Type::isUD; + if (partonFlavor==21) label.type = llpdnnx::LLPLabel::Type::isG; + } + else + { + /* + std::cout<<" jet: "<size())<<", pt="<size())<<", pt="<& list, const reco::Candidate* genParticle) + { + if (genParticle->numberOfDaughters()==0) + { + int absId = std::abs(genParticle->pdgId()); + if (absId!=12 and absId!=14 and absId!=16 and absId>6 and absId<100000) + { + list.push_back(genParticle); + } + } + else + { + for (size_t d=0; d< genParticle->numberOfDaughters(); ++d) + { + gatherVisibleDecayProducts(list, genParticle->daughter(d)); + } + } + } + + static reco::Candidate::Point getVertex(const reco::Candidate* p) + { + const auto genParticle = dynamic_cast(p); + if (genParticle) return genParticle->vertex(); + const auto packedGenParticle = dynamic_cast(p); + if (packedGenParticle) return packedGenParticle->vertex(); + return reco::Candidate::Point(0,0,0); + } + + static const reco::Candidate* findRecoConstituent(const reco::Candidate* genParticle, const std::vector& constituents) + { + double minDR2 = 1000000; + const reco::Candidate* match = nullptr; + for (const auto& constituent: constituents) + { + double ptRel = std::fabs(constituent->pt()/genParticle->pt()-1.); + if (ptRel>0.5) continue; //prevent random match + double dEta = std::fabs(genParticle->eta()-constituent->eta()); + if (dEta>0.05) continue; + double dPhi = std::fabs(reco::deltaPhi(*genParticle,*constituent)); + if (dPhi>0.1) continue; + double dR2 = dEta*dEta+0.5*dPhi*dPhi; //allow for more spread in phi + if (minDR2>dR2) + { + minDR2 = dR2; + match = constituent; + } + } + return match; + } + + static double calcFraction(const reco::Candidate::LorentzVector& p, const reco::Candidate::LorentzVector& base) + { + return p.Vect().Dot(base.Vect())/base.Vect().mag2(); + } + + static void printDecayChain(std::vector& finals, const reco::Candidate* p, int indent=1) + { + for (int i=0; i < indent; ++i) std::cout<<" - "; + std::cout<<"id="<<(p->pdgId())<<", pt="<<(p->pt())<numberOfDaughters()==0) finals.push_back(p); + for (size_t d=0; d< p->numberOfDaughters(); ++d) + { + printDecayChain(finals,p->daughter(d), indent+1); + } + } //TH1D *hist; //edm::Service fs; @@ -70,16 +146,14 @@ class LLPLabelProducer: int n = (absPdgId/1000000)%10; return std::max({nq1,nq2,nq3})+n*10000+(n>0 and nL==9)*100; } - double tauPtThreshold_; - double quarkPtThreshold_; - double bPtThreshold_; - double muonPtThreshold_; - double electronPtThreshold_; + + + std::unordered_map jetsPerLabel_; edm::EDGetTokenT> jetToken_; edm::EDGetTokenT> displacedGenVertexToken_; - edm::EDGetTokenT> llpFlavourInfoToken_; - + edm::EDGetTokenT> llpGenDecayInfoToken_; + virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override; @@ -88,30 +162,31 @@ class LLPLabelProducer: ~LLPLabelProducer(); static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + }; LLPLabelProducer::LLPLabelProducer(const edm::ParameterSet& iConfig): - tauPtThreshold_(iConfig.getParameter("tauPtThreshold")), - quarkPtThreshold_(iConfig.getParameter("quarkPtThreshold")), - bPtThreshold_(iConfig.getParameter("bPtThreshold")), - muonPtThreshold_(iConfig.getParameter("muonPtThreshold")), - electronPtThreshold_(iConfig.getParameter("electronPtThreshold")), jetToken_(consumes>(iConfig.getParameter("srcJets"))), displacedGenVertexToken_(consumes>(iConfig.getParameter("srcVertices"))), - llpFlavourInfoToken_(consumes>(iConfig.getParameter("srcFlavourInfo"))) + llpGenDecayInfoToken_(consumes>( iConfig.getParameter("srcDecayInfo") )) { produces(); - //hist = fs->make("ptfrac" , "ptfrac" , 100 , 0 , 1. ); } LLPLabelProducer::~LLPLabelProducer() { + for (const auto& labelCountPair: jetsPerLabel_) + { + std::cout<> displacedGenVertexCollection; iEvent.getByToken(displacedGenVertexToken_, displacedGenVertexCollection); - edm::Handle> llpGhostFlavourInfoMap; - iEvent.getByToken(llpFlavourInfoToken_, llpGhostFlavourInfoMap); + edm::Handle> llpGenDecayInfoCollection; + iEvent.getByToken(llpGenDecayInfoToken_, llpGenDecayInfoCollection); auto outputLLPLabelInfo = std::make_unique(); + for (std::size_t ijet = 0; ijet < jetCollection->size(); ijet++) { const pat::Jet& jet = jetCollection->at(ijet); + edm::RefToBase jet_ref(jetCollection->refAt(ijet)); llpdnnx::LLPLabel label; @@ -140,175 +217,253 @@ LLPLabelProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } else { - int partonFlavor = abs(jet.partonFlavour()); - int hadronFlavor = abs(jet.hadronFlavour()); + const auto& genJet = jet.genJet(); - label.partonFlavor = partonFlavor; - label.hadronFlavor = hadronFlavor; + label.partonFlavor = std::abs(jet.partonFlavour()); + label.hadronFlavor = std::abs(jet.hadronFlavour()); label.matchedGenJetDeltaR = reco::deltaR(jet.p4(),jet.genJet()->p4()); label.matchedGenJetPt = jet.genJet()->pt(); + + //std::cout<<"jet "<0) + label.tauDecay = llpdnnx::LLPLabel::TauDecay::INVISIBLE; + } + } + + + //assign flavour depending on found particles + if (nbHadrons>0) + { + if (nonPromptLeptonRecoMax.pt()<1e-3) //note: these thresholds are arbitrary small; what counts is if the lepton is reconstructed! + { + if (nbHadrons>1) { - label.type = llpdnnx::LLPLabel::Type::isLeptonic_B; + label.type = llpdnnx::LLPLabel::Type::isBB; } - else if (nbHadronsToLeptons==0 and ncHadronsToLeptons>0) + else { - label.type = llpdnnx::LLPLabel::Type::isLeptonic_C; + label.type = llpdnnx::LLPLabel::Type::isB; } } + else + { + label.type = llpdnnx::LLPLabel::Type::isLeptonic_B; + } } - else if (hadronFlavor==4) + else if (nbHadrons==0 and ncHadrons>0) { - if (ncHadrons>1) + if (nonPromptLeptonRecoMax.pt()<1e-3) { - if (nGluons==0) + if (ncHadrons>1) { label.type = llpdnnx::LLPLabel::Type::isCC; } else { - label.type = llpdnnx::LLPLabel::Type::isGCC; + label.type = llpdnnx::LLPLabel::Type::isC; } } - else if (ncHadrons==1) + else { - label.type = llpdnnx::LLPLabel::Type::isC; + label.type = llpdnnx::LLPLabel::Type::isLeptonic_C; } } - else if (partonFlavor!=0) + else if (calcFraction(promptRecoMax,jet.p4())>0.5) + { + if (promptRecoMaxId==11) label.type = llpdnnx::LLPLabel::Type::isPrompt_E; + else if (promptRecoMaxId==13) label.type = llpdnnx::LLPLabel::Type::isPrompt_MU; + else if (promptRecoMaxId==15) label.type = llpdnnx::LLPLabel::Type::isPrompt_TAU; + else if (promptRecoMaxId==22) label.type = llpdnnx::LLPLabel::Type::isPrompt_PHOTON; + } + else if (std::abs(jet.partonFlavour()!=0)) { - if (partonFlavor==5) label.type = llpdnnx::LLPLabel::Type::isB; - if (partonFlavor==4) label.type = llpdnnx::LLPLabel::Type::isC; + int partonFlavor = std::abs(jet.partonFlavour()); + if (partonFlavor==5) + { + if (nonPromptLeptonRecoMax.pt()<1e-3) label.type = llpdnnx::LLPLabel::Type::isLeptonic_B; + else label.type = llpdnnx::LLPLabel::Type::isB; + } + if (partonFlavor==4) + { + if (nonPromptLeptonRecoMax.pt()<1e-3) label.type = llpdnnx::LLPLabel::Type::isLeptonic_C; + else label.type = llpdnnx::LLPLabel::Type::isC; + } if (partonFlavor==3) label.type = llpdnnx::LLPLabel::Type::isS; if (partonFlavor==2 or partonFlavor==1) label.type = llpdnnx::LLPLabel::Type::isUD; if (partonFlavor==21) label.type = llpdnnx::LLPLabel::Type::isG; - } - else + } + else //no hadrons and parton flavour=0 => jet cannot be classified! { - /* - std::cout<<" jet: "<size())<<", pt="<1 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_QQ; - if (nB>1 or (nQ==1 and nB==1)) label.type = llpdnnx::LLPLabel::Type::isLLP_BB; + if (calcFraction(promptRecoMax,jet.p4())<0.1) //arbitrary threshold; reconstructed candidates count! + { + label.type=llpdnnx::LLPLabel::Type::isLLP_BB; + } + else + { + if (promptRecoMaxId==11) label.type=llpdnnx::LLPLabel::Type::isLLP_BBE; + else if (promptRecoMaxId==13) label.type=llpdnnx::LLPLabel::Type::isLLP_BBMU; + else if (promptRecoMaxId==15) label.type=llpdnnx::LLPLabel::Type::isLLP_BBTAU; + else if (promptRecoMaxId==22) label.type=llpdnnx::LLPLabel::Type::isLLP_BBPHOTON; + else throw std::runtime_error("LLPLabel not well defined"); + } } - else if (nE>=1 and nMU==0 and nTau==0) + else { - if (nQ==0 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_E; - - if (nQ==1 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_QE; - if (nQ==0 and nB==1) label.type = llpdnnx::LLPLabel::Type::isLLP_BE; - - if (nQ>1 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_QQE; - if (nB>1 or (nQ==1 and nB==1)) label.type = llpdnnx::LLPLabel::Type::isLLP_BBE; + if (calcFraction(promptRecoMax,jet.p4())<0.1) //arbitrary threshold; reconstructed candidates count! + { + if (nQuarks==0) label.type=llpdnnx::LLPLabel::Type::isLLP_RAD; + else if (nQuarks==1) label.type=llpdnnx::LLPLabel::Type::isLLP_Q; + else label.type=llpdnnx::LLPLabel::Type::isLLP_QQ; + } + else + { + if (nQuarks==0) + { + if (promptRecoMaxId==11) label.type=llpdnnx::LLPLabel::Type::isLLP_E; + else if (promptRecoMaxId==13) label.type=llpdnnx::LLPLabel::Type::isLLP_MU; + else if (promptRecoMaxId==15) label.type=llpdnnx::LLPLabel::Type::isLLP_TAU; + else if (promptRecoMaxId==22) label.type=llpdnnx::LLPLabel::Type::isLLP_PHOTON; + else throw std::runtime_error("LLPLabel not well defined"); + } + else if (nQuarks==1) + { + if (promptRecoMaxId==11) label.type=llpdnnx::LLPLabel::Type::isLLP_QE; + else if (promptRecoMaxId==13) label.type=llpdnnx::LLPLabel::Type::isLLP_QMU; + else if (promptRecoMaxId==15) label.type=llpdnnx::LLPLabel::Type::isLLP_QTAU; + else if (promptRecoMaxId==22) label.type=llpdnnx::LLPLabel::Type::isLLP_QPHOTON; + else throw std::runtime_error("LLPLabel not well defined"); + } + else + { + if (promptRecoMaxId==11) label.type=llpdnnx::LLPLabel::Type::isLLP_QQE; + else if (promptRecoMaxId==13) label.type=llpdnnx::LLPLabel::Type::isLLP_QQMU; + else if (promptRecoMaxId==15) label.type=llpdnnx::LLPLabel::Type::isLLP_QQTAU; + else if (promptRecoMaxId==22) label.type=llpdnnx::LLPLabel::Type::isLLP_QQPHOTON; + else throw std::runtime_error("LLPLabel not well defined"); + } + } } - else if (nMU>=1 and nTau==0) //accept any additional number of electrons - { - if (nQ==0 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_MU; - - if (nQ==1 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_QMU; - if (nQ==0 and nB==1) label.type = llpdnnx::LLPLabel::Type::isLLP_BMU; - - if (nQ>1 and nB==0) label.type = llpdnnx::LLPLabel::Type::isLLP_QQMU; - if (nB>1 or (nQ==1 and nB==1)) label.type = llpdnnx::LLPLabel::Type::isLLP_BBMU; - } } } } } - //std::cout<<" jet: "<size())<<", pt="< +class FlatTableFiller +{ + public: + virtual void push_back(const CLASS& obj) = 0; + virtual void fill(std::unique_ptr& flatTable) const = 0; + + virtual ~FlatTableFiller() + { + } +}; + +template +class Property +{ + public: + virtual const std::string& name() const = 0; + virtual const std::string& doc() const = 0; + virtual std::shared_ptr> createFiller() const = 0; + + virtual ~Property() + { + } +}; + + + +template +class PropertyTmpl: + public Property +{ + private: + TYPE CLASS::*memberPtr_; + std::string name_; + std::string doc_; + public: + PropertyTmpl(TYPE CLASS::*memberPtr, const std::string& name, const std::string& doc="doc"): + memberPtr_(memberPtr), + name_(name), + doc_(doc) + { + } + + virtual ~PropertyTmpl() + { + } + + TYPE get(const CLASS& obj) const + { + return obj.*memberPtr_; + } + + virtual const std::string& name() const + { + return name_; + } + + virtual const std::string& doc() const + { + return doc_; + } + + virtual std::shared_ptr> createFiller() const; +}; + + +template +void fillTable(const std::vector& data, std::unique_ptr& flatTable, const std::string& name, const std::string& doc) +{ + throw std::runtime_error(std::string("Filler not implemented for type '")+(typeid(TYPE)).name()+"'"); +} + +template<> +void fillTable(const std::vector& data, std::unique_ptr& flatTable, const std::string& name, const std::string& doc) +{ + flatTable->addColumn(name, data, doc, nanoaod::FlatTable::IntColumn); +} + +template<> +void fillTable(const std::vector& data, std::unique_ptr& flatTable, const std::string& name, const std::string& doc) +{ + flatTable->addColumn(name, data, doc, nanoaod::FlatTable::FloatColumn); +} + +template +class FlatTableFillerTmpl: + public FlatTableFiller +{ + private: + PropertyTmpl property_; + std::vector data_; + public: + FlatTableFillerTmpl(const PropertyTmpl& property): + property_(property) + { + } + + virtual void push_back(const CLASS& obj) + { + data_.push_back(property_.get(obj)); + } + + virtual void fill(std::unique_ptr& flatTable) const + { + fillTable(data_,flatTable,property_.name(),property_.doc()); + } + + virtual ~FlatTableFillerTmpl() + { + } +}; + + + +template std::shared_ptr> PropertyTmpl::createFiller() const +{ + return std::shared_ptr>(new FlatTableFillerTmpl(*this)); +} + + +template using PropertyList = std::vector>>; + +template +class FlatTableFillerList +{ + protected: + std::vector>> fillers_; + + public: + FlatTableFillerList(const PropertyList& propertyList) + { + for (const auto& property: propertyList) fillers_.push_back(property->createFiller()); + } + + void push_back(const CLASS& obj) + { + for (const auto& filler: fillers_) filler->push_back(obj); + } + + void fill(std::unique_ptr& flatTable) const + { + for (const auto& filler: fillers_) filler->fill(flatTable); + } +}; + +#define PROPERTY(class, name, doc) \ + std::shared_ptr>(new PropertyTmpl< class , decltype( class :: name )>(& class :: name , #name , doc)) + + + +#endif diff --git a/NANOProducer/plugins/NANOGenProducer.cc b/NANOProducer/plugins/NANOGenProducer.cc index 97953a1..4bbf92c 100644 --- a/NANOProducer/plugins/NANOGenProducer.cc +++ b/NANOProducer/plugins/NANOGenProducer.cc @@ -18,19 +18,29 @@ #include "DataFormats/NanoAOD/interface/FlatTable.h" #include - - +#include "FlatTableFiller.h" // // class declaration // +#define LABEL(name) \ + std::pair( #name , llpdnnx::LLPLabel::Type:: name ) + +#define TAUDECAY(name) \ + std::pair( #name , llpdnnx::LLPLabel::TauDecay:: name ) + class NANOGenProducer : public edm::stream::EDProducer<> { public: explicit NANOGenProducer(const edm::ParameterSet&); ~NANOGenProducer(); static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + std::vector> labelTypes; + std::vector> tauDecayTypes; + + PropertyList labelProperties; private: const edm::EDGetTokenT> _jet_src; @@ -45,6 +55,86 @@ NANOGenProducer::NANOGenProducer(const edm::ParameterSet& iConfig) : _label_src(consumes>(iConfig.getParameter("srcLabels"))) { + + labelTypes = { + LABEL(isPU), + LABEL(isB), + LABEL(isBB), + LABEL(isLeptonic_B), + LABEL(isC), + LABEL(isCC), + LABEL(isLeptonic_C), + LABEL(isS), + LABEL(isUD), + LABEL(isG), + LABEL(isPrompt_MU), + LABEL(isPrompt_E), + LABEL(isPrompt_PHOTON), + LABEL(isPrompt_TAU), + + LABEL(isLLP_RAD), //no flavour match (likely from wide angle radiation) + LABEL(isLLP_MU), //prompt lepton + LABEL(isLLP_E), //prompt lepton + LABEL(isLLP_Q), //single light quark + LABEL(isLLP_QMU), //single light quark + prompt lepton + LABEL(isLLP_QE), //single light quark + prompt lepton + LABEL(isLLP_QQ), //double light quark + LABEL(isLLP_QQMU), //double light quark + prompt lepton + LABEL(isLLP_QQE), //double light quark + prompt lepton + LABEL(isLLP_B), //single b/c quark + LABEL(isLLP_BMU), //single b/c quark + prompt lepton + LABEL(isLLP_BE), //single b/c quark + prompt lepton + LABEL(isLLP_BB), //double b/c quark + LABEL(isLLP_BBMU), //double b/c quark + prompt lepton + LABEL(isLLP_BBE), //double b/c quark + prompt lepton + LABEL(isLLP_TAU), + LABEL(isLLP_QTAU), + LABEL(isLLP_QQTAU), + LABEL(isLLP_BTAU), + LABEL(isLLP_BBTAU), + + LABEL(isLLP_PHOTON), + LABEL(isLLP_QPHOTON), + LABEL(isLLP_QQPHOTON), + LABEL(isLLP_BPHOTON), + LABEL(isLLP_BBPHOTON), + LABEL(isUndefined) + }; + + tauDecayTypes = { + TAUDECAY(NO_TAU), //no tau decay + TAUDECAY(INVISIBLE), //tau decay but not reconstructable + TAUDECAY(E), //to electron + TAUDECAY(MU), //to muon + TAUDECAY(H), //1 charged hadron + TAUDECAY(H_1PI0), //1 charged hadron + pi0(->2gamma) + TAUDECAY(H_XPI0), //1 charged hadron + 2 or more pi0(->2gamma) + TAUDECAY(HHH), //3 charged hadrons + TAUDECAY(HHH_XPI0) //3 charged hadron + 1 or more pi0(->2gamma) + }; + + labelProperties = { + PROPERTY(llpdnnx::LLPLabel, partonFlavor, "doc"), + PROPERTY(llpdnnx::LLPLabel, hadronFlavor, "doc"), + PROPERTY(llpdnnx::LLPLabel, llpId, "doc"), + PROPERTY(llpdnnx::LLPLabel, llp_mass, "doc"), + PROPERTY(llpdnnx::LLPLabel, llp_pt, "doc"), + + PROPERTY(llpdnnx::LLPLabel, displacement, "doc"), + PROPERTY(llpdnnx::LLPLabel, displacement_xy, "doc"), + PROPERTY(llpdnnx::LLPLabel, displacement_z, "doc"), + PROPERTY(llpdnnx::LLPLabel, decay_angle, "doc"), + PROPERTY(llpdnnx::LLPLabel, betagamma, "doc"), + + + PROPERTY(llpdnnx::LLPLabel, matchedGenJetDeltaR, "doc"), + PROPERTY(llpdnnx::LLPLabel, matchedGenJetPt, "doc"), + PROPERTY(llpdnnx::LLPLabel, sharedVertexFraction, "doc"), + + PROPERTY(llpdnnx::LLPLabel, genTauMass, "doc"), + PROPERTY(llpdnnx::LLPLabel, recoTauMass, "doc") + }; + produces("jetorigin"); } @@ -74,61 +164,16 @@ NANOGenProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) std::vector truth_jetIdx; - std::vector isPU; - std::vector isB; - std::vector isBB; - std::vector isGBB; - std::vector isLeptonic_B; - std::vector isLeptonic_C; - std::vector isC; - std::vector isCC; - std::vector isGCC; - std::vector isS; - std::vector isUD; - std::vector isG; - std::vector isPrompt_MU; - std::vector isPrompt_E; - std::vector isPrompt_TAU; - - - std::vector isLLP_RAD; //no flavour match (likely from wide angle radiation) - std::vector isLLP_MU; //prompt lepton - std::vector isLLP_E; //prompt lepton - std::vector isLLP_Q; //single light quark - std::vector isLLP_QMU; //single light quark + prompt lepton - std::vector isLLP_QE; //single light quark + prompt lepton - std::vector isLLP_QQ; //double light quark - std::vector isLLP_QQMU; //double light quark + prompt lepton - std::vector isLLP_QQE; //double light quark + prompt lepton - std::vector isLLP_B; //single b/c quark - std::vector isLLP_BMU; //single b/c quark + prompt lepton - std::vector isLLP_BE; //single b/c quark + prompt lepton - std::vector isLLP_BB; //double b/c quark - std::vector isLLP_BBMU; //double b/c quark + prompt lepton - std::vector isLLP_BBE; //double b/c quark + prompt lepton - std::vector isLLP_TAU; // hadronic tau decay - std::vector isLLP_QTAU; - std::vector isLLP_QQTAU; - - std::vector isUndefined; - - std::vector partonFlavor; - std::vector hadronFlavor; - std::vector llpId; - std::vector llp_pt; - std::vector llp_mass; - - std::vector displacement; - std::vector displacement_xy; - std::vector displacement_z; - std::vector decay_angle; - std::vector betagamma; + + std::unordered_map> labelList; + std::unordered_map> tauDecayList; - std::vector matchedGenJetDeltaR; - std::vector matchedGenJetPt; + + + FlatTableFillerList labelPropertyFillerList(labelProperties); for (std::size_t itag = 0; itag < ntruth; itag++) { - const auto& labels = label_infos->at(itag).features(); + const auto& label = label_infos->at(itag).features(); int jetIdx = -1; auto base_jet_ref = label_infos->at(itag).jet(); if (base_jet_ref.isAvailable() and base_jet_ref.isNonnull()){ @@ -144,108 +189,22 @@ NANOGenProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) truth_jetIdx.push_back(jetIdx); - isPU.push_back(labels.type == llpdnnx::LLPLabel::Type::isPU ? 1 : 0); - isB.push_back(labels.type == llpdnnx::LLPLabel::Type::isB ? 1 : 0); - isBB.push_back(labels.type == llpdnnx::LLPLabel::Type::isBB ? 1 : 0); - isGBB.push_back(labels.type == llpdnnx::LLPLabel::Type::isGBB ? 1 : 0); - isLeptonic_B.push_back(labels.type == llpdnnx::LLPLabel::Type::isLeptonic_B ? 1 : 0); - isLeptonic_C.push_back(labels.type == llpdnnx::LLPLabel::Type::isLeptonic_C ? 1 : 0); - isC.push_back(labels.type == llpdnnx::LLPLabel::Type::isC ? 1 : 0); - isCC.push_back(labels.type == llpdnnx::LLPLabel::Type::isCC ? 1 : 0); - isGCC.push_back(labels.type == llpdnnx::LLPLabel::Type::isGCC ? 1 : 0); - isS.push_back(labels.type == llpdnnx::LLPLabel::Type::isS ? 1 : 0); - isUD.push_back(labels.type == llpdnnx::LLPLabel::Type::isUD ? 1 : 0); - isG.push_back(labels.type == llpdnnx::LLPLabel::Type::isG ? 1 : 0); - isPrompt_MU.push_back(labels.type == llpdnnx::LLPLabel::Type::isPrompt_MU ? 1 : 0); - isPrompt_E.push_back(labels.type == llpdnnx::LLPLabel::Type::isPrompt_E ? 1 : 0); - isPrompt_TAU.push_back(labels.type == llpdnnx::LLPLabel::Type::isPrompt_TAU ? 1 : 0); - isLLP_RAD.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_RAD ? 1 : 0); - isLLP_MU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_MU ? 1 : 0); - isLLP_E.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_E ? 1 : 0); - isLLP_Q.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_Q ? 1 : 0); - isLLP_QMU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QMU ? 1 : 0); - isLLP_QE.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QE ? 1 : 0); - isLLP_QQ.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QQ ? 1 : 0); - isLLP_QQMU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QQMU ? 1 : 0); - isLLP_QQE.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QQE ? 1 : 0); - isLLP_B.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_B ? 1 : 0); - isLLP_BMU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_BMU ? 1 : 0); - isLLP_BE.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_BE ? 1 : 0); - isLLP_BB.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_BB ? 1 : 0); - isLLP_BBMU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_BBMU ? 1 : 0); - isLLP_BBE.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_BBE ? 1 : 0); - isLLP_TAU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_TAU ? 1 : 0); - isLLP_QTAU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QTAU ? 1 : 0); - isLLP_QQTAU.push_back(labels.type == llpdnnx::LLPLabel::Type::isLLP_QQTAU ? 1 : 0); - isUndefined.push_back(labels.type == llpdnnx::LLPLabel::Type::isUndefined ? 1 : 0); - - partonFlavor.push_back(labels.partonFlavor); - hadronFlavor.push_back(labels.hadronFlavor); - llpId.push_back(labels.llpId); - llp_pt.push_back(labels.llp_pt); - llp_mass.push_back(labels.llp_mass); - displacement.push_back(labels.displacement); - displacement_xy.push_back(labels.displacement_xy); - displacement_z.push_back(labels.displacement_z); - decay_angle.push_back(labels.decay_angle); - betagamma.push_back(labels.betagamma); - matchedGenJetDeltaR.push_back(labels.matchedGenJetDeltaR); - matchedGenJetPt.push_back(labels.matchedGenJetPt); + for (const auto& labelType: labelTypes) labelList[labelType.first].push_back(label.type == labelType.second ? 1 : 0); + for (const auto& tauDecayType: tauDecayTypes) tauDecayList[tauDecayType.first].push_back(label.tauDecay == tauDecayType.second ? 1 : 0); + + + labelPropertyFillerList.push_back(label); } jetOriginTable->addColumn("jetIdx", truth_jetIdx, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isPU", isPU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isB", isB, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isBB", isBB, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isGBB", isGBB, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLeptonic_B", isLeptonic_B, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLeptonic_C", isLeptonic_C, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isC", isC, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isCC", isCC, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isGCC", isGCC, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isS", isS, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isUD", isUD, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isG", isG, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isPrompt_MU", isPrompt_MU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isPrompt_E", isPrompt_E, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isPrompt_TAU", isPrompt_TAU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_RAD", isLLP_RAD, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_MU", isLLP_MU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_E", isLLP_E, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_Q", isLLP_Q, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QMU", isLLP_QMU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QE", isLLP_QE, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QQ", isLLP_QQ, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QQMU", isLLP_QQMU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QQE", isLLP_QQE, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_B", isLLP_B, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_BMU", isLLP_BMU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_BE", isLLP_BE, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_BB", isLLP_BB, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_BBMU", isLLP_BBMU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_BBE", isLLP_BBE, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_TAU", isLLP_TAU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QTAU", isLLP_QTAU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isLLP_QQTAU", isLLP_QQTAU, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("isUndefined", isUndefined, "doc", nanoaod::FlatTable::IntColumn); - - jetOriginTable->addColumn("partonFlavor", partonFlavor, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("hadronFlavor", hadronFlavor, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("llpId", llpId, "doc", nanoaod::FlatTable::IntColumn); - jetOriginTable->addColumn("llp_pt", llp_pt, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("llp_mass", llp_mass, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("displacement", displacement, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("displacement_xy", displacement_xy, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("displacement_z", displacement_z, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("decay_angle", decay_angle, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("betagamma", betagamma, "doc", nanoaod::FlatTable::FloatColumn); - - jetOriginTable->addColumn("matchedGenJetDeltaR", matchedGenJetDeltaR, "doc", nanoaod::FlatTable::FloatColumn); - jetOriginTable->addColumn("matchedGenJetPt", matchedGenJetPt, "doc", nanoaod::FlatTable::FloatColumn); + for (const auto& labelType: labelTypes) jetOriginTable->addColumn(labelType.first, labelList[labelType.first], "doc", nanoaod::FlatTable::IntColumn); + for (const auto& tauDecayType: tauDecayTypes) jetOriginTable->addColumn("tauDecay_"+tauDecayType.first, tauDecayList[tauDecayType.first], "doc", nanoaod::FlatTable::IntColumn); + + labelPropertyFillerList.fill(jetOriginTable); iEvent.put(std::move(jetOriginTable), "jetorigin"); } diff --git a/NANOProducer/plugins/NANOProducer.cc b/NANOProducer/plugins/NANOProducer.cc index 8089134..1876a50 100644 --- a/NANOProducer/plugins/NANOProducer.cc +++ b/NANOProducer/plugins/NANOProducer.cc @@ -18,19 +18,27 @@ #include "DataFormats/NanoAOD/interface/FlatTable.h" #include - +#include "FlatTableFiller.h" // // class declaration // class NANOProducer : public edm::stream::EDProducer<> { - public: - explicit NANOProducer(const edm::ParameterSet&); - ~NANOProducer(); - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - + public: + explicit NANOProducer(const edm::ParameterSet&); + ~NANOProducer(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + PropertyList globalProperties; + PropertyList csvProperties; + PropertyList cpfProperties; + PropertyList npfProperties; + PropertyList svProperties; + PropertyList muonProperties; + PropertyList electronProperties; + private: const edm::EDGetTokenT> _jet_src; const edm::EDGetTokenT> _tag_src; @@ -43,6 +51,321 @@ NANOProducer::NANOProducer(const edm::ParameterSet& iConfig) : _jet_src(consumes>(iConfig.getParameter("srcJets"))), _tag_src(consumes>(iConfig.getParameter("srcTags"))) { + globalProperties = { + PROPERTY(llpdnnx::JetFeatures, pt, "doc"), + PROPERTY(llpdnnx::JetFeatures, eta, "doc"), + PROPERTY(llpdnnx::JetFeatures, phi, "doc"), + PROPERTY(llpdnnx::JetFeatures, mass, "doc"), + PROPERTY(llpdnnx::JetFeatures, energy, "doc"), + + PROPERTY(llpdnnx::JetFeatures, area, "doc"), + + PROPERTY(llpdnnx::JetFeatures, beta, "doc"), + PROPERTY(llpdnnx::JetFeatures, dR2Mean, "doc"), + PROPERTY(llpdnnx::JetFeatures, frac01, "doc"), + PROPERTY(llpdnnx::JetFeatures, frac02, "doc"), + PROPERTY(llpdnnx::JetFeatures, frac03, "doc"), + PROPERTY(llpdnnx::JetFeatures, frac04, "doc"), + + PROPERTY(llpdnnx::JetFeatures, jetR, "doc"), + PROPERTY(llpdnnx::JetFeatures, jetRchg, "doc"), + + PROPERTY(llpdnnx::JetFeatures, n60, "doc"), + PROPERTY(llpdnnx::JetFeatures, n90, "doc"), + + PROPERTY(llpdnnx::JetFeatures, chargedEmEnergyFraction, "doc"), + PROPERTY(llpdnnx::JetFeatures, chargedHadronEnergyFraction, "doc"), + PROPERTY(llpdnnx::JetFeatures, chargedMuEnergyFraction, "doc"), + PROPERTY(llpdnnx::JetFeatures, electronEnergyFraction, "doc"), + + PROPERTY(llpdnnx::JetFeatures, tau1, "doc"), + PROPERTY(llpdnnx::JetFeatures, tau2, "doc"), + PROPERTY(llpdnnx::JetFeatures, tau3, "doc"), + + PROPERTY(llpdnnx::JetFeatures, relMassDropMassAK, "doc"), + PROPERTY(llpdnnx::JetFeatures, relMassDropMassCA, "doc"), + PROPERTY(llpdnnx::JetFeatures, relSoftDropMassAK, "doc"), + PROPERTY(llpdnnx::JetFeatures, relSoftDropMassCA, "doc"), + + PROPERTY(llpdnnx::JetFeatures, thrust, "doc"), + PROPERTY(llpdnnx::JetFeatures, sphericity, "doc"), + PROPERTY(llpdnnx::JetFeatures, circularity, "doc"), + PROPERTY(llpdnnx::JetFeatures, isotropy, "doc"), + PROPERTY(llpdnnx::JetFeatures, eventShapeC, "doc"), + PROPERTY(llpdnnx::JetFeatures, eventShapeD, "doc"), + + PROPERTY(llpdnnx::JetFeatures, numberCpf, "doc"), + PROPERTY(llpdnnx::JetFeatures, numberNpf, "doc"), + PROPERTY(llpdnnx::JetFeatures, numberSv, "doc"), + PROPERTY(llpdnnx::JetFeatures, numberSvAdapted, "doc"), + PROPERTY(llpdnnx::JetFeatures, numberMuon, "doc"), + PROPERTY(llpdnnx::JetFeatures, numberElectron, "doc") + + }; + + csvProperties = { + PROPERTY(llpdnnx::ShallowTagInfoFeatures, trackSumJetEtRatio, "ratio of track sum transverse energy over jet energy"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, trackSumJetDeltaR, "pseudoangular distance between jet axis and track fourvector sum"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, vertexCategory, "category of secondary vertex (Reco, Pseudo, No)"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, trackSip2dValAboveCharm, "track 2D signed impact parameter of first track lifting mass above charm"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, trackSip2dSigAboveCharm, "track 2D signed impact parameter significance of first track lifting mass above charm"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, trackSip3dValAboveCharm, "track 3D signed impact parameter of first track lifting mass above charm"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, trackSip3dSigAboveCharm, "track 3D signed impact parameter significance of first track lifting mass above charm"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, jetNTracksEtaRel, "tracks associated to jet for which trackEtaRel is calculated"), + PROPERTY(llpdnnx::ShallowTagInfoFeatures, jetNSelectedTracks, "doc") + }; + + cpfProperties = { + PROPERTY(llpdnnx::ChargedCandidateFeatures, ptrel, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, deta, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, dphi, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, deltaR, "doc"), + + PROPERTY(llpdnnx::ChargedCandidateFeatures, px, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, py, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, pz, "doc"), + + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackEtaRel, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackPtRel, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackPPar, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackDeltaR, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackPParRatio, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackPtRatio, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip2dVal, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip2dSig, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip3dVal, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip3dSig, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackJetDistVal, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackJetDistSig, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, drminsv, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, vertex_association, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, fromPV, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, puppi_weight, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_chi2, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_quality, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_numberOfValidPixelHits, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_pixelLayersWithMeasurement, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_numberOfValidStripHits, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_stripLayersWithMeasurement, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, relmassdrop, "doc"), + + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip2dValSV, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip2dSigSV, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip3dValSV, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip3dSigSV, "doc"), + + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip2dValSV_adapted, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip2dSigSV_adapted, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip3dValSV_adapted, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, trackSip3dSigSV_adapted, "doc"), + + PROPERTY(llpdnnx::ChargedCandidateFeatures, matchedMuon, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, matchedElectron, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, matchedSV, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, matchedSV_adapted, "doc"), + + PROPERTY(llpdnnx::ChargedCandidateFeatures, track_ndof, "doc"), + PROPERTY(llpdnnx::ChargedCandidateFeatures, dZmin, "doc") + }; + + + npfProperties = { + PROPERTY(llpdnnx::NeutralCandidateFeatures, ptrel, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, deta, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, dphi, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, deltaR, "doc"), + + PROPERTY(llpdnnx::NeutralCandidateFeatures, px, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, py, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, pz, "doc"), + + PROPERTY(llpdnnx::NeutralCandidateFeatures, isGamma, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, hcal_fraction, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, drminsv, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, puppi_weight, "doc"), + PROPERTY(llpdnnx::NeutralCandidateFeatures, relmassdrop, "doc") + }; + + svProperties = { + PROPERTY(llpdnnx::SecondaryVertexFeatures, ptrel, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, deta, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, dphi, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, deltaR, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, mass, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, ntracks, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, chi2, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, ndof, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, dxy, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, dxysig, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, d3d, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, d3dsig, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, costhetasvpv, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, enratio, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, vx, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, vy, "doc"), + PROPERTY(llpdnnx::SecondaryVertexFeatures, vz, "doc") + }; + + muonProperties = { + PROPERTY(llpdnnx::MuonCandidateFeatures, isGlobal, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, isTight, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, isMedium, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, isLoose, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, isStandAlone, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, ptrel, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, deta, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dphi, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, px, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, py, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, pz, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, charge, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, energy, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, et, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, deltaR, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, numberOfMatchedStations, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, IP2d, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, IP2dSig, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, IP3d, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, IP3dSig, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, EtaRel, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dxy, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dxyError, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dxySig, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dz, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dzError, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, dzSig, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, numberOfValidPixelHits, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, numberOfpixelLayersWithMeasurement, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, numberOfstripLayersWithMeasurement, "doc"), //that does not help. needs to be discussed. + + PROPERTY(llpdnnx::MuonCandidateFeatures, chi2, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, ndof, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, caloIso, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, ecalIso, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, hcalIso, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, sumPfChHadronPt, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, sumPfNeuHadronEt, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, Pfpileup, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, sumPfPhotonEt, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, sumPfChHadronPt03, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, sumPfNeuHadronEt03, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, Pfpileup03, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, sumPfPhotonEt03, "doc"), + + PROPERTY(llpdnnx::MuonCandidateFeatures, timeAtIpInOut, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, timeAtIpInOutErr, "doc"), + PROPERTY(llpdnnx::MuonCandidateFeatures, timeAtIpOutIn, "doc") + }; + + + electronProperties = { + PROPERTY(llpdnnx::ElectronCandidateFeatures, ptrel, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, deltaR, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deta, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dphi, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,px, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,py, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,pz, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,charge, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,energy, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,EtFromCaloEn, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, isEB, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, isEE, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,ecalEnergy, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, isPassConversionVeto, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,convDist, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, convFlags, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,convRadius, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,hadronicOverEm, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,ecalDrivenSeed, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,IP2d, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,IP2dSig, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,IP3d, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,IP3dSig, "doc"), + + PROPERTY(llpdnnx::ElectronCandidateFeatures,elecSC_energy, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,elecSC_deta, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,elecSC_dphi, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,elecSC_et, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,elecSC_eSuperClusterOverP, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,scPixCharge, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,superClusterFbrem, "doc"), + + PROPERTY(llpdnnx::ElectronCandidateFeatures,eSeedClusterOverP, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,eSeedClusterOverPout, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,eSuperClusterOverP, "doc"), + + // shower shape + PROPERTY(llpdnnx::ElectronCandidateFeatures,sigmaEtaEta, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,sigmaIetaIeta, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,sigmaIphiIphi, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,e5x5, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,e5x5Rel, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,e1x5Overe5x5, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,e2x5MaxOvere5x5, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,r9, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,hcalOverEcal, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,hcalDepth1OverEcal, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,hcalDepth2OverEcal, "doc"), + + // Track-Cluster Matching Attributes + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaEtaEleClusterTrackAtCalo, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaEtaSeedClusterTrackAtCalo, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaPhiSeedClusterTrackAtCalo, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaEtaSeedClusterTrackAtVtx, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaEtaSuperClusterTrackAtVtx, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaPhiEleClusterTrackAtCalo, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,deltaPhiSuperClusterTrackAtVtx, "doc"), + + PROPERTY(llpdnnx::ElectronCandidateFeatures,sCseedEta, "doc"), + + // electron gsf variables. + PROPERTY(llpdnnx::ElectronCandidateFeatures,EtaRel, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dxy, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dxyError, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dxySig, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dz, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dzError, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dzSig, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, nbOfMissingHits, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,gsfCharge, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, ndof, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,chi2, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures, numberOfBrems, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,fbrem, "doc"), + + // Isolation block + PROPERTY(llpdnnx::ElectronCandidateFeatures,neutralHadronIso, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,particleIso, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,photonIso, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,puChargedHadronIso, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,trackIso, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,ecalPFClusterIso, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,hcalPFClusterIso, "doc"), + + PROPERTY(llpdnnx::ElectronCandidateFeatures,pfSumPhotonEt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,pfSumChargedHadronPt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,pfSumNeutralHadronEt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,pfSumPUPt, "doc"), + + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04TkSumPt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04EcalRecHitSumEt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04HcalDepth1TowerSumEt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04HcalDepth1TowerSumEtBc, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04HcalDepth2TowerSumEt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04HcalDepth2TowerSumEtBc, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04HcalTowerSumEt, "doc"), + PROPERTY(llpdnnx::ElectronCandidateFeatures,dr04HcalTowerSumEtBc, "doc") + + }; + + produces("global"); produces("csv"); produces("cpf"); @@ -52,6 +375,7 @@ NANOProducer::NANOProducer(const edm::ParameterSet& iConfig) : produces("length"); produces("muon") ; produces("electron") ; + } @@ -74,6 +398,7 @@ NANOProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) unsigned int ntags = tag_infos->size(); std::vector global_jetIdx; + std::vector csv_jetIdx; std::vector cpf_jetIdx; std::vector npf_jetIdx; std::vector sv_jetIdx; @@ -91,268 +416,19 @@ NANOProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) std::vector mu_length; auto globalTable = std::make_unique(ntags, "global", false, false); - std::vector pt; - std::vector eta; - std::vector phi; - std::vector mass; - - std::vector area; - - std::vector n60; - std::vector n90; - - std::vector beta; - std::vector dR2Mean; - std::vector frac01; - std::vector frac02; - std::vector frac03; - std::vector frac04; - - std::vector jetR; - std::vector jetRchg; - - std::vector chargedEmEnergyFraction; - std::vector chargedHadronEnergyFraction; - std::vector chargedMuEnergyFraction; - std::vector electronEnergyFraction; - - std::vector tau1; - std::vector tau2; - std::vector tau3; - - std::vector relMassDropMassAK; - std::vector relMassDropMassCA; - std::vector relSoftDropMassAK; - std::vector relSoftDropMassCA; - - std::vector thrust; - std::vector sphericity; - std::vector circularity; - std::vector isotropy; - std::vector eventShapeC; - std::vector eventShapeD; + auto csvTable = std::make_unique(ntags, "csv", false, false); + - auto csvTable = std::make_unique(ntags, "csv", false, false); - std::vector trackSumJetEtRatio; - std::vector trackSumJetDeltaR; - std::vector vertexCategory; - std::vector trackSip2dValAboveCharm; - std::vector trackSip2dSigAboveCharm; - std::vector trackSip3dValAboveCharm; - std::vector trackSip3dSigAboveCharm; - std::vector jetNSelectedTracks; - std::vector jetNTracksEtaRel; - - std::vector cpf_trackEtaRel; - std::vector cpf_trackPtRel; - std::vector cpf_trackPPar; - std::vector cpf_trackDeltaR; - std::vector cpf_trackPParRatio; - std::vector cpf_trackPtRatio; - std::vector cpf_trackSip2dVal; - std::vector cpf_trackSip2dSig; - std::vector cpf_trackSip3dVal; - std::vector cpf_trackSip3dSig; - std::vector cpf_trackJetDistVal; - std::vector cpf_trackJetDistSig; - std::vector cpf_ptrel; - std::vector cpf_deta; - std::vector cpf_dphi; - std::vector cpf_drminsv; - std::vector cpf_vertex_association; - std::vector cpf_fromPV; - std::vector cpf_puppi_weight; - std::vector cpf_track_chi2; - std::vector cpf_track_quality; - std::vector cpf_relmassdrop; - std::vector cpf_track_ndof; - std::vector cpf_matchedMuon; - std::vector cpf_matchedElectron; - std::vector cpf_matchedSV; - std::vector cpf_matchedSV_adapted; - std::vector cpf_track_numberOfValidPixelHits; - std::vector cpf_track_pixelLayersWithMeasurement; - std::vector cpf_track_numberOfValidStripHits; - std::vector cpf_track_stripLayersWithMeasurement; - std::vector cpf_dZmin; - - std::vector npf_ptrel; - std::vector npf_deta; - std::vector npf_dphi; - std::vector npf_deltaR; - std::vector npf_isGamma; - std::vector npf_hcal_fraction; - std::vector npf_drminsv; - std::vector npf_puppi_weight; - std::vector npf_relmassdrop; - - std::vector sv_ptrel; - std::vector sv_deta; - std::vector sv_dphi; - std::vector sv_deltaR; - std::vector sv_mass; - std::vector sv_ntracks; - std::vector sv_chi2; - std::vector sv_ndof; - std::vector sv_dxy; - std::vector sv_dxysig; - std::vector sv_d3d; - std::vector sv_d3dsig; - std::vector sv_costhetasvpv; - std::vector sv_enratio; - - std::vector sv_adapted_ptrel; - std::vector sv_adapted_deta; - std::vector sv_adapted_dphi; - std::vector sv_adapted_deltaR; - std::vector sv_adapted_mass; - std::vector sv_adapted_ntracks; - std::vector sv_adapted_chi2; - std::vector sv_adapted_ndof; - std::vector sv_adapted_dxy; - std::vector sv_adapted_dxysig; - std::vector sv_adapted_d3d; - std::vector sv_adapted_d3dsig; - std::vector sv_adapted_costhetasvpv; - std::vector sv_adapted_enratio; - - std::vector mu_isGlobal; - std::vector mu_isTight; - std::vector mu_isMedium; - std::vector mu_isLoose; - std::vector mu_isStandAlone; - - std::vector mu_ptrel; - std::vector mu_EtaRel; - std::vector mu_deta; - std::vector mu_dphi; - std::vector mu_charge; - std::vector mu_energy; - std::vector mu_et; - std::vector mu_jetDeltaR; - std::vector mu_numberOfMatchedStations; - - std::vector mu_2dIP; - std::vector mu_2dIPSig; - std::vector mu_3dIP; - std::vector mu_3dIPSig; - - std::vector mu_dxy; - std::vector mu_dxyError; - std::vector mu_dxySig; - std::vector mu_dz; - std::vector mu_dzError; - std::vector mu_numberOfValidPixelHits; - std::vector mu_numberOfpixelLayersWithMeasurement; - std::vector mu_numberOfstripLayersWithMeasurement; - - std::vector mu_chi2; - std::vector mu_ndof; - - std::vector mu_caloIso; - std::vector mu_ecalIso; - std::vector mu_hcalIso; - - std::vector mu_sumPfChHadronPt; - std::vector mu_sumPfNeuHadronEt; - std::vector mu_Pfpileup; - std::vector mu_sumPfPhotonEt; - - std::vector mu_sumPfChHadronPt03; - std::vector mu_sumPfNeuHadronEt03; - std::vector mu_Pfpileup03; - std::vector mu_sumPfPhotonEt03; - - std::vector mu_timeAtIpInOut; - std::vector mu_timeAtIpInOutErr; - std::vector mu_timeAtIpOutIn; - - - // Electron Block - - std::vector elec_ptrel; - std::vector elec_jetDeltaR; - std::vector elec_deta; - std::vector elec_dphi; - std::vector elec_charge; - std::vector elec_energy; - std::vector elec_EtFromCaloEn; - std::vector elec_isEB; - std::vector elec_isEE; - std::vector elec_ecalEnergy; - std::vector elec_isPassConversionVeto; - std::vector elec_convDist; - std::vector elec_convFlags; - - std::vector elec_convRadius; - std::vector elec_hadronicOverEm; - std::vector elec_ecalDrivenSeed; - - std::vector elecSC_energy; - std::vector elecSC_deta; - std::vector elecSC_dphi; - std::vector elecSC_et; - std::vector elecSC_eSuperClusterOverP; - std::vector elec_scPixCharge; - std::vector elec_sigmaEtaEta; - std::vector elec_sigmaIetaIeta; - std::vector elec_sigmaIphiIphi; - std::vector elec_r9; - std::vector elec_superClusterFbrem; - - std::vector elec_2dIP; - std::vector elec_2dIPSig; - std::vector elec_3dIP; - std::vector elec_3dIPSig; - std::vector elec_eSeedClusterOverP; - std::vector elec_eSeedClusterOverPout; - std::vector elec_eSuperClusterOverP; - - std::vector elec_deltaEtaEleClusterTrackAtCalo; - std::vector elec_deltaEtaSeedClusterTrackAtCalo; - std::vector elec_deltaPhiSeedClusterTrackAtCalo; - std::vector elec_deltaEtaSeedClusterTrackAtVtx; - std::vector elec_deltaEtaSuperClusterTrackAtVtx; - std::vector elec_deltaPhiEleClusterTrackAtCalo; - std::vector elec_deltaPhiSuperClusterTrackAtVtx; - std::vector elec_sCseedEta; - - std::vector elec_EtaRel; - std::vector elec_dxy; - std::vector elec_dz; - std::vector elec_nbOfMissingHits; - std::vector elec_gsfCharge; - std::vector elec_ndof; - std::vector elec_chi2; - - std::vector elec_e2x5MaxOvere5x5; - std::vector elec_e1x5Overe5x5; - std::vector elec_e5x5; - std::vector elec_e5x5Rel; - std::vector elec_numberOfBrems; - std::vector elec_fbrem; - std::vector elec_neutralHadronIso; - std::vector elec_particleIso; - std::vector elec_photonIso; - std::vector elec_puChargedHadronIso; - std::vector elec_trackIso; - std::vector elec_hcalDepth1OverEcal; - std::vector elec_hcalDepth2OverEcal; - std::vector elec_ecalPFClusterIso; - std::vector elec_hcalPFClusterIso; - std::vector elec_pfSumPhotonEt; - std::vector elec_pfSumChargedHadronPt; - std::vector elec_pfSumNeutralHadronEt; - std::vector elec_pfSumPUPt; - std::vector elec_dr04TkSumPt; - std::vector elec_dr04EcalRecHitSumEt; - std::vector elec_dr04HcalDepth1TowerSumEt; - std::vector elec_dr04HcalDepth1TowerSumEtBc; - std::vector elec_dr04HcalDepth2TowerSumEt; - std::vector elec_dr04HcalDepth2TowerSumEtBc; - std::vector elec_dr04HcalTowerSumEt; - std::vector elec_dr04HcalTowerSumEtBc; + FlatTableFillerList globalFillerList(globalProperties); + FlatTableFillerList csvFillerList(csvProperties); + + FlatTableFillerList cpfFillerList(cpfProperties); + FlatTableFillerList npfFillerList(npfProperties); + FlatTableFillerList svFillerList(svProperties); + FlatTableFillerList svAdaptedFillerList(svProperties); + FlatTableFillerList muonFillerList(muonProperties); + FlatTableFillerList electronFillerList(electronProperties); unsigned int nmu_total = 0; unsigned int nelec_total = 0; @@ -363,7 +439,6 @@ NANOProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) for (unsigned int itag= 0; itag < ntags; itag++){ const auto& features = tag_infos->at(itag).features(); - const auto& tag_info_features = features.tag_info_features; unsigned int nmu = features.mu_features.size(); unsigned int nelec = features.elec_features.size(); @@ -398,58 +473,12 @@ NANOProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } } } - + global_jetIdx.push_back(jetIdx); - pt.push_back(features.jet_features.pt); - eta.push_back(features.jet_features.eta); - phi.push_back(features.jet_features.phi); - mass.push_back(features.jet_features.mass); - - area.push_back(features.jet_features.area); - - n60.push_back(features.jet_features.n60); - n90.push_back(features.jet_features.n90); - - beta.push_back(features.jet_features.beta); - dR2Mean.push_back(features.jet_features.dR2Mean); - frac01.push_back(features.jet_features.frac01); - frac02.push_back(features.jet_features.frac02); - frac03.push_back(features.jet_features.frac03); - frac04.push_back(features.jet_features.frac04); - - jetR.push_back(features.jet_features.jetR); - jetRchg.push_back(features.jet_features.jetRchg); - - chargedEmEnergyFraction.push_back(features.jet_features.chargedEmEnergyFraction); - chargedHadronEnergyFraction.push_back(features.jet_features.chargedHadronEnergyFraction); - chargedMuEnergyFraction.push_back(features.jet_features.chargedMuEnergyFraction); - electronEnergyFraction.push_back(features.jet_features.electronEnergyFraction); - - tau1.push_back(features.jet_features.tau1); - tau2.push_back(features.jet_features.tau2); - tau3.push_back(features.jet_features.tau3); - - relMassDropMassAK.push_back(features.jet_features.relMassDropMassAK); - relMassDropMassCA.push_back(features.jet_features.relMassDropMassCA); - relSoftDropMassAK.push_back(features.jet_features.relSoftDropMassAK); - relSoftDropMassCA.push_back(features.jet_features.relSoftDropMassCA); - - thrust.push_back(features.jet_features.thrust); - sphericity.push_back(features.jet_features.sphericity); - circularity.push_back(features.jet_features.circularity); - isotropy.push_back(features.jet_features.isotropy); - eventShapeC.push_back(features.jet_features.eventShapeC); - eventShapeD.push_back(features.jet_features.eventShapeD); - - trackSumJetEtRatio.push_back(tag_info_features.csv_trackSumJetEtRatio); - trackSumJetDeltaR.push_back(tag_info_features.csv_trackSumJetDeltaR); - trackSip2dValAboveCharm.push_back(tag_info_features.csv_trackSip2dValAboveCharm); - trackSip2dSigAboveCharm.push_back(tag_info_features.csv_trackSip2dSigAboveCharm); - trackSip3dValAboveCharm.push_back(tag_info_features.csv_trackSip3dValAboveCharm); - trackSip3dSigAboveCharm.push_back(tag_info_features.csv_trackSip3dSigAboveCharm); - jetNSelectedTracks.push_back(tag_info_features.csv_jetNSelectedTracks); - jetNTracksEtaRel.push_back(tag_info_features.csv_jetNTracksEtaRel); - vertexCategory.push_back(tag_info_features.csv_vertexCategory); + csv_jetIdx.push_back(jetIdx); + + globalFillerList.push_back(features.jet_features); + csvFillerList.push_back(features.tag_info_features); } auto muonTable = std::make_unique(nmu_total, "muon", false, false); @@ -480,524 +509,75 @@ NANOProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) for (unsigned int i = 0; i < ncpf; i++) { - const auto& cpf_features = cpf.at(i); cpf_jetIdx.push_back(jetIdx); - cpf_trackEtaRel.push_back(cpf_features.cpf_trackEtaRel); - cpf_trackPtRel.push_back(cpf_features.cpf_trackPtRel); - cpf_trackPPar.push_back(cpf_features.cpf_trackPPar); - cpf_trackDeltaR.push_back(cpf_features.cpf_trackDeltaR); - cpf_trackPParRatio.push_back(cpf_features.cpf_trackPParRatio); - cpf_trackPtRatio.push_back(cpf_features.cpf_trackPtRatio); - cpf_trackSip2dVal.push_back(cpf_features.cpf_trackSip2dVal); - cpf_trackSip2dSig.push_back(cpf_features.cpf_trackSip2dSig); - cpf_trackSip3dVal.push_back(cpf_features.cpf_trackSip3dVal); - cpf_trackSip3dSig.push_back(cpf_features.cpf_trackSip3dSig); - cpf_trackJetDistVal.push_back(cpf_features.cpf_trackJetDistVal); - cpf_trackJetDistSig.push_back(cpf_features.cpf_trackJetDistSig); - cpf_ptrel.push_back(cpf_features.cpf_ptrel); - cpf_deta.push_back(cpf_features.cpf_deta); - cpf_dphi.push_back(cpf_features.cpf_dphi); - cpf_drminsv.push_back(cpf_features.cpf_drminsv); - cpf_vertex_association.push_back(cpf_features.cpf_vertex_association); - cpf_fromPV.push_back(cpf_features.cpf_fromPV); - cpf_puppi_weight.push_back(cpf_features.cpf_puppi_weight); - cpf_track_chi2.push_back(cpf_features.cpf_track_chi2); - cpf_track_quality.push_back(cpf_features.cpf_track_quality); - cpf_relmassdrop.push_back(cpf_features.cpf_relmassdrop); - cpf_track_ndof.push_back(cpf_features.cpf_track_ndof); - cpf_matchedMuon.push_back(cpf_features.cpf_matchedMuon); - cpf_matchedElectron.push_back(cpf_features.cpf_matchedElectron); - cpf_matchedSV.push_back(cpf_features.cpf_matchedSV); - cpf_matchedSV_adapted.push_back(cpf_features.cpf_matchedSV_adapted); - cpf_track_numberOfValidPixelHits.push_back(cpf_features.cpf_track_numberOfValidPixelHits); - cpf_track_pixelLayersWithMeasurement.push_back(cpf_features.cpf_track_pixelLayersWithMeasurement); - cpf_track_numberOfValidStripHits.push_back(cpf_features.cpf_track_numberOfValidStripHits); - cpf_track_stripLayersWithMeasurement.push_back(cpf_features.cpf_track_stripLayersWithMeasurement); - cpf_dZmin.push_back(cpf_features.cpf_dZmin); + cpfFillerList.push_back(cpf.at(i)); } for (unsigned int i = 0; i < nnpf; i++) { - const auto& npf_features = npf.at(i); - npf_jetIdx.push_back(jetIdx); - npf_ptrel.push_back(npf_features.npf_ptrel); - npf_deta.push_back(npf_features.npf_deta); - npf_dphi.push_back(npf_features.npf_dphi); - npf_deltaR.push_back(npf_features.npf_deltaR); - npf_isGamma.push_back(npf_features.npf_isGamma); - npf_hcal_fraction.push_back(npf_features.npf_hcal_fraction); - npf_drminsv.push_back(npf_features.npf_drminsv); - npf_puppi_weight.push_back(npf_features.npf_puppi_weight); - npf_relmassdrop.push_back(npf_features.npf_relmassdrop); + npf_jetIdx.push_back(jetIdx); + npfFillerList.push_back(npf.at(i)); } for (unsigned int i = 0; i < nsv; i++) { - const auto& sv_features = sv.at(i); sv_jetIdx.push_back(jetIdx); - sv_ptrel.push_back(sv_features.sv_ptrel); - sv_deta.push_back(sv_features.sv_deta); - sv_dphi.push_back(sv_features.sv_dphi); - sv_deltaR.push_back(sv_features.sv_deltaR); - sv_mass.push_back(sv_features.sv_mass); - sv_ntracks.push_back(sv_features.sv_ntracks); - sv_chi2.push_back(sv_features.sv_chi2); - sv_ndof.push_back(sv_features.sv_ndof); - sv_dxy.push_back(sv_features.sv_dxy); - sv_dxysig.push_back(sv_features.sv_dxysig); - sv_d3d.push_back(sv_features.sv_d3d); - sv_d3dsig.push_back(sv_features.sv_d3dsig); - sv_costhetasvpv.push_back(sv_features.sv_costhetasvpv); - sv_enratio.push_back(sv_features.sv_enratio); + svFillerList.push_back(sv.at(i)); } for (unsigned int i = 0; i < nsv_adapted; i++) { - const auto& sv_adapted_features = sv_adapted.at(i); sv_adapted_jetIdx.push_back(jetIdx); - sv_adapted_ptrel.push_back(sv_adapted_features.sv_ptrel); - sv_adapted_deta.push_back(sv_adapted_features.sv_deta); - sv_adapted_dphi.push_back(sv_adapted_features.sv_dphi); - sv_adapted_deltaR.push_back(sv_adapted_features.sv_deltaR); - sv_adapted_mass.push_back(sv_adapted_features.sv_mass); - sv_adapted_ntracks.push_back(sv_adapted_features.sv_ntracks); - sv_adapted_chi2.push_back(sv_adapted_features.sv_chi2); - sv_adapted_ndof.push_back(sv_adapted_features.sv_ndof); - sv_adapted_dxy.push_back(sv_adapted_features.sv_dxy); - sv_adapted_dxysig.push_back(sv_adapted_features.sv_dxysig); - sv_adapted_d3d.push_back(sv_adapted_features.sv_d3d); - sv_adapted_d3dsig.push_back(sv_adapted_features.sv_d3dsig); - sv_adapted_costhetasvpv.push_back(sv_adapted_features.sv_costhetasvpv); - sv_adapted_enratio.push_back(sv_adapted_features.sv_enratio); + svAdaptedFillerList.push_back(sv_adapted.at(i)); } - for(unsigned int i = 0; i < nmu; i++) { - const auto& mu_features = mu.at(i); mu_jetIdx.push_back(jetIdx); - mu_isGlobal.push_back(mu_features.mu_isGlobal) ; - mu_isTight.push_back(mu_features.mu_isTight) ; - mu_isMedium.push_back(mu_features.mu_isMedium) ; - mu_isLoose.push_back(mu_features.mu_isLoose) ; - mu_isStandAlone.push_back(mu_features.mu_isStandAlone) ; - - - mu_ptrel.push_back(mu_features.mu_ptrel); - mu_EtaRel.push_back(mu_features.mu_EtaRel); - mu_deta.push_back(mu_features.mu_deta); - mu_dphi.push_back(mu_features.mu_dphi); - mu_charge.push_back(mu_features.mu_charge); - mu_energy.push_back(mu_features.mu_energy); - mu_et.push_back(mu_features.mu_et); - mu_jetDeltaR.push_back(mu_features.mu_jetDeltaR); - mu_numberOfMatchedStations.push_back(mu_features.mu_numberOfMatchedStations); - - mu_2dIP.push_back(mu_features.mu_2dIP); - mu_2dIPSig.push_back(mu_features.mu_2dIPSig); - mu_3dIP.push_back(mu_features.mu_3dIP); - mu_3dIPSig.push_back(mu_features.mu_3dIPSig); - - mu_dxy.push_back(mu_features.mu_dxy); - mu_dxyError.push_back(mu_features.mu_dxyError); - mu_dxySig.push_back(mu_features.mu_dxySig); - mu_dz.push_back(mu_features.mu_dz); - mu_dzError.push_back(mu_features.mu_dzError); - mu_numberOfValidPixelHits.push_back(mu_features.mu_numberOfValidPixelHits); - mu_numberOfpixelLayersWithMeasurement.push_back(mu_features.mu_numberOfpixelLayersWithMeasurement); - mu_numberOfstripLayersWithMeasurement.push_back(mu_features.mu_numberOfstripLayersWithMeasurement); - - - mu_chi2.push_back(mu_features.mu_chi2); - mu_ndof.push_back(mu_features.mu_ndof); - - mu_caloIso.push_back(mu_features.mu_caloIso); - mu_ecalIso.push_back(mu_features.mu_ecalIso); - mu_hcalIso.push_back(mu_features.mu_hcalIso); - - mu_sumPfChHadronPt.push_back(mu_features.mu_sumPfChHadronPt); - mu_sumPfNeuHadronEt.push_back(mu_features.mu_sumPfNeuHadronEt); - mu_Pfpileup.push_back(mu_features.mu_Pfpileup); - mu_sumPfPhotonEt.push_back(mu_features.mu_sumPfPhotonEt); - - mu_sumPfChHadronPt03.push_back(mu_features.mu_sumPfChHadronPt03); - mu_sumPfNeuHadronEt03.push_back(mu_features.mu_sumPfNeuHadronEt03); - mu_Pfpileup03.push_back(mu_features.mu_Pfpileup03); - mu_sumPfPhotonEt03.push_back(mu_features.mu_sumPfPhotonEt03); - - - mu_timeAtIpInOut.push_back(mu_features.mu_timeAtIpInOut) ; - mu_timeAtIpInOutErr.push_back(mu_features.mu_timeAtIpInOutErr) ; - mu_timeAtIpOutIn.push_back(mu_features.mu_timeAtIpOutIn) ; - - + muonFillerList.push_back(mu.at(i)); } for(unsigned int i = 0; i < nelec ; i++) { - - const auto& elec_features = elec.at(i); - elec_jetIdx.push_back(jetIdx); - - elec_ptrel.push_back(elec_features.elec_ptrel ); - elec_jetDeltaR.push_back(elec_features.elec_jetDeltaR ); - elec_deta.push_back(elec_features.elec_deta ); - elec_dphi.push_back(elec_features.elec_dphi ); - elec_charge.push_back(elec_features.elec_charge ); - - elec_energy.push_back(elec_features.elec_energy ); - elec_EtFromCaloEn.push_back(elec_features.elec_EtFromCaloEn ); - elec_isEB.push_back(elec_features.elec_isEB ); - elec_isEE.push_back(elec_features.elec_isEE ); - elec_ecalEnergy.push_back(elec_features.elec_ecalEnergy ); - elec_isPassConversionVeto.push_back(elec_features.elec_isPassConversionVeto ); - elec_convDist.push_back(elec_features.elec_convDist ); - elec_convFlags.push_back(elec_features.elec_convFlags ); - - elec_convRadius.push_back(elec_features.elec_convRadius ); - elec_hadronicOverEm.push_back(elec_features.elec_hadronicOverEm ); - elec_ecalDrivenSeed.push_back(elec_features.elec_ecalDrivenSeed ); - - - elecSC_energy.push_back(elec_features.elecSC_energy ); - elecSC_deta.push_back(elec_features.elecSC_deta ); - elecSC_dphi.push_back(elec_features.elecSC_dphi ); - elecSC_et.push_back(elec_features.elecSC_et ); - elecSC_eSuperClusterOverP.push_back(elec_features.elecSC_eSuperClusterOverP ); - - elec_scPixCharge.push_back(elec_features.elec_scPixCharge ); - elec_sigmaEtaEta.push_back(elec_features.elec_sigmaEtaEta ); - elec_sigmaIetaIeta.push_back(elec_features.elec_sigmaIetaIeta ); - elec_sigmaIphiIphi.push_back(elec_features.elec_sigmaIphiIphi ); - elec_r9.push_back(elec_features.elec_r9 ); - elec_superClusterFbrem.push_back(elec_features.elec_superClusterFbrem ); - - elec_2dIP.push_back(elec_features.elec_2dIP ); - elec_2dIPSig.push_back(elec_features.elec_2dIPSig ); - elec_3dIP.push_back(elec_features.elec_3dIP ); - elec_3dIPSig.push_back(elec_features.elec_3dIPSig ); - elec_eSeedClusterOverP.push_back(elec_features.elec_eSeedClusterOverP ); - elec_eSeedClusterOverPout.push_back(elec_features.elec_eSeedClusterOverPout ); - elec_eSuperClusterOverP.push_back(elec_features.elec_eSuperClusterOverP ); - - elec_deltaEtaEleClusterTrackAtCalo.push_back(elec_features.elec_deltaEtaEleClusterTrackAtCalo ); - elec_deltaEtaSeedClusterTrackAtCalo.push_back(elec_features.elec_deltaEtaSeedClusterTrackAtCalo ); - elec_deltaPhiSeedClusterTrackAtCalo.push_back(elec_features.elec_deltaPhiSeedClusterTrackAtCalo ); - elec_deltaEtaSeedClusterTrackAtVtx.push_back(elec_features.elec_deltaEtaSeedClusterTrackAtVtx ); - elec_deltaEtaSuperClusterTrackAtVtx.push_back(elec_features.elec_deltaEtaSuperClusterTrackAtVtx ); - elec_deltaPhiEleClusterTrackAtCalo.push_back(elec_features.elec_deltaPhiEleClusterTrackAtCalo ); - elec_deltaPhiSuperClusterTrackAtVtx.push_back(elec_features.elec_deltaPhiSuperClusterTrackAtVtx ); - elec_sCseedEta.push_back(elec_features.elec_sCseedEta ); - - - elec_EtaRel.push_back(elec_features.elec_EtaRel ); - elec_dxy.push_back(elec_features.elec_dxy ); - elec_dz.push_back(elec_features.elec_dz ); - elec_nbOfMissingHits.push_back(elec_features.elec_nbOfMissingHits ); - elec_gsfCharge.push_back(elec_features.elec_gsfCharge ); - elec_ndof.push_back(elec_features.elec_ndof ); - elec_chi2.push_back(elec_features.elec_chi2 ); - elec_numberOfBrems.push_back(elec_features.elec_numberOfBrems ); - elec_fbrem.push_back(elec_features.elec_fbrem ); - elec_e2x5MaxOvere5x5.push_back(elec_features.elec_e2x5MaxOvere5x5 ); - elec_e1x5Overe5x5.push_back(elec_features.elec_e1x5Overe5x5 ); - elec_e5x5.push_back(elec_features.elec_e5x5 ); - elec_e5x5Rel.push_back(elec_features.elec_e5x5Rel ); - elec_neutralHadronIso.push_back(elec_features.elec_neutralHadronIso ); - elec_particleIso .push_back(elec_features.elec_particleIso ); - elec_photonIso.push_back(elec_features.elec_photonIso ); - elec_puChargedHadronIso.push_back(elec_features.elec_puChargedHadronIso ); - elec_trackIso.push_back(elec_features.elec_trackIso ); - elec_hcalDepth1OverEcal.push_back(elec_features.elec_hcalDepth1OverEcal ); - elec_hcalDepth2OverEcal.push_back(elec_features.elec_hcalDepth2OverEcal ); - elec_ecalPFClusterIso.push_back(elec_features.elec_ecalPFClusterIso ); - elec_hcalPFClusterIso.push_back(elec_features.elec_hcalPFClusterIso ); - elec_pfSumPhotonEt.push_back(elec_features.elec_pfSumPhotonEt ); - elec_pfSumChargedHadronPt.push_back(elec_features.elec_pfSumChargedHadronPt ); - elec_pfSumNeutralHadronEt.push_back(elec_features.elec_pfSumNeutralHadronEt ); - elec_pfSumPUPt.push_back(elec_features.elec_pfSumPUPt ); - elec_dr04TkSumPt.push_back(elec_features.elec_dr04TkSumPt ); - elec_dr04EcalRecHitSumEt.push_back(elec_features.elec_dr04EcalRecHitSumEt ); - elec_dr04HcalDepth1TowerSumEt.push_back(elec_features.elec_dr04HcalDepth1TowerSumEt ); - elec_dr04HcalDepth1TowerSumEtBc.push_back(elec_features.elec_dr04HcalDepth1TowerSumEtBc ); - elec_dr04HcalDepth2TowerSumEt.push_back(elec_features.elec_dr04HcalDepth2TowerSumEt ); - elec_dr04HcalDepth2TowerSumEtBc.push_back(elec_features.elec_dr04HcalDepth2TowerSumEtBc ); - elec_dr04HcalTowerSumEt.push_back(elec_features.elec_dr04HcalTowerSumEt ); - elec_dr04HcalTowerSumEtBc.push_back(elec_features.elec_dr04HcalTowerSumEtBc ); - - + electronFillerList.push_back(elec.at(i)); } } - globalTable->addColumn("jetIdx", global_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - globalTable->addColumn("pt", pt, "global jet pt (uncorrected)", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("eta", eta, "global jet eta", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("phi", phi, "global jet phi", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("mass", mass, "global jet mass", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("area", area, "global jet area", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("n60", n60, "n60", nanoaod::FlatTable::IntColumn); - globalTable->addColumn("n90", n90, "n90", nanoaod::FlatTable::IntColumn); - globalTable->addColumn("chargedEmEnergyFraction", chargedEmEnergyFraction, "chargedEmEnergyFraction", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("chargedHadronEnergyFraction", chargedHadronEnergyFraction, "chargedHadronEnergyFraction", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("chargedMuEnergyFraction", chargedMuEnergyFraction, "chargedMuEnergyFraction", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("electronEnergyFraction", electronEnergyFraction, "electronEnergyFraction", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("tau1", tau1, "nsubjettiness 1", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("tau2", tau2, "nsubjettiness 2", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("tau3", tau3, "nsubjettiness 3", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("relMassDropMassAK", relMassDropMassAK, "mass drop mass with anti-kT", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("relMassDropMassCA", relMassDropMassCA, "mass drop mass with Cambridge/Aachen", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("relSoftDropMassAK", relSoftDropMassAK, "soft drop mass with anti-kT", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("relSoftDropMassCA", relSoftDropMassCA, "soft drop mass with Cambridge/Aachen", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("thrust", thrust, "thrust", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("sphericity", sphericity, "sphericity", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("circularity", circularity, "circularity", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("isotropy", isotropy, "isotropy", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("eventShapeC", eventShapeC, "eventShapeC", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("eventShapeD", eventShapeD, "eventShapeD", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("beta", beta, "fraction of tracks associated to the PV", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("dR2Mean", dR2Mean, "pt2 weighted average square distance of jet constituents from the jet axis", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("frac01", frac01, "fraction of constituents in the region dR < 0.1 around the jet axis", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("frac02", frac02, "fraction of constituents in the region 0.1 < dR < 0.2 around the jet axis", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("frac03", frac03, "fraction of constituents in the region 0.2 < dR < 0.3 around the jet axis", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("frac04", frac04, "fraction of constituents in the region 0.3 < dR < 0.4 around the jet axis", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("jetR", jetR, "fraction of jet pt carried by lead constituent", nanoaod::FlatTable::FloatColumn); - globalTable->addColumn("jetRchg", jetRchg, "fraction of jet pt carried by lead jet constituent", nanoaod::FlatTable::FloatColumn); - - csvTable->addColumn("trackSumJetEtRatio", trackSumJetEtRatio, "ratio of track sum transverse energy over jet energy", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("trackSumJetDeltaR", trackSumJetDeltaR, "pseudoangular distance between jet axis and track fourvector sum", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("vertexCategory", vertexCategory, "category of secondary vertex (Reco, Pseudo, No)", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("trackSip2dValAboveCharm", trackSip2dValAboveCharm, "track 2D signed impact parameter of first track lifting mass above charm", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("trackSip2dSigAboveCharm", trackSip2dSigAboveCharm, "track 2D signed impact parameter significance of first track lifting mass above charm", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("trackSip3dValAboveCharm", trackSip3dValAboveCharm, "track 3D signed impact parameter of first track lifting mass above charm", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("trackSip3dSigAboveCharm", trackSip3dSigAboveCharm, "track 3D signed impact parameter significance of first track lifting mass above charm", nanoaod::FlatTable::FloatColumn); - csvTable->addColumn("jetNSelectedTracks", jetNSelectedTracks, "tracks associated to jet", nanoaod::FlatTable::IntColumn); - csvTable->addColumn("jetNTracksEtaRel", jetNTracksEtaRel, "number of tracks for which etaRel is computed", nanoaod::FlatTable::IntColumn); - - cpfTable->addColumn("jetIdx", cpf_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("trackEtaRel", cpf_trackEtaRel, "track pseudorapidity, relative to the jet axis", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackPtRel", cpf_trackPtRel, "track transverse momentum, relative to the jet axis", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackPPar", cpf_trackPPar, "track parallel momentum, along the jet axis", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackDeltaR", cpf_trackDeltaR, "charged PF candidate track pseudoangular distance (Delta R) from the jet axis", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackPParRatio", cpf_trackPParRatio, "track parallel momentum, along the jet axis, normalized to its energy", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackPtRatio", cpf_trackPtRatio, "track transverse momentum, relative to the jet axis, normalized to its energy", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackSip2dVal", cpf_trackSip2dVal, "track 2D signed impact parameter", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackSip2dSig", cpf_trackSip2dSig, "track 2D signed impact parameter significance", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackSip3dVal", cpf_trackSip3dVal, "track 3D signed impact parameter", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackSip3dSig", cpf_trackSip3dSig, "track 3D signed impact parameter significance", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackJetDistVal", cpf_trackJetDistVal, "minimum track approach distance to jet axis", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("trackJetDistSig", cpf_trackJetDistSig, "minimum track approach distance to jet axis significance", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("ptrel", cpf_ptrel, "Charged PF candidate track transverse momentum over jet transverse momentum (uncorrelated)", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("drminsv", cpf_drminsv, "pseudoangular distance (Delta R) between the charged PF candidate track and closest secondary vertex (SV) within the jet", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("vertex_association", cpf_vertex_association, "Indicates whether the charged PF candidate track is used in the primary vertex fit", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("fromPV", cpf_fromPV, "Indicates whether the charged PF candidate track is associated to the primary vertex (PV)", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("puppi_weight", cpf_puppi_weight, "weight assigned by the PUPPI algorithm to neutral PF candidate track", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("track_chi2", cpf_track_chi2, "chi^2 of a charged PF candidate track", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("track_quality", cpf_track_quality, "Indicates charged particle track reconstruction quality", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("track_ndof", cpf_track_ndof, "Track fit number of degrees of freedom of charged PF candidate track", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("matchedMuon", cpf_matchedMuon, "flag to specify whether the track is matched to a PF muon", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("matchedElectron", cpf_matchedElectron, "flag to specify whether the track is matched to a PF electron", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("matchedSV", cpf_matchedSV, "flag to specify whether the track is matched to a PF secondary vertex", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("matchedSV_adapted", cpf_matchedSV_adapted, "flag to specify whether the track is matched to a PF secondary vertex", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("numberOfValidPixelHits", cpf_track_numberOfValidPixelHits , "number of valid pixel hits " , nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("pixelLayersWithMeasurement", cpf_track_pixelLayersWithMeasurement , "pixel layers with measurment ", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("numberOfValidStripHits" , cpf_track_numberOfValidStripHits , "nb of valid strip hits " , nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("stripLayersWithMeasurement" , cpf_track_stripLayersWithMeasurement , "nb of strip layers with measurement ", nanoaod::FlatTable::IntColumn); - cpfTable->addColumn("relmassdrop", cpf_relmassdrop, "doc", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("dzMin", cpf_dZmin, "min distance to other PV", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("deta", cpf_deta, "absolute difference between the charged PF candidate eta and jet eta", nanoaod::FlatTable::FloatColumn); - cpfTable->addColumn("dphi", cpf_dphi, "absolute difference between the charged PF candidate phi and jet phi", nanoaod::FlatTable::FloatColumn); - - npfTable->addColumn("jetIdx", npf_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - npfTable->addColumn("ptrel", npf_ptrel, "neutral PF candidate transverse momentum over jet transverse momentum (uncorrelated)", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("deta", npf_deta, "absolute difference between the neutral PF candidate eta and jet eta", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("dphi", npf_dphi, "absolute difference between the neutral PF candidate phi and jet phi", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("deltaR", npf_deltaR, "neutral PF candidate pseudoangular distance (Delta R) from the jet axis", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("isGamma", npf_isGamma, "flag for passing loose photon identification requirements", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("hcal_fraction", npf_hcal_fraction, "fraction of energy deposited in the hadronic calorimeter", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("drminsv", npf_drminsv, "pseudoangular distance (Delta R) between neutral PF candidate and closest secondary vertex (SV) within the jet", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("puppi_weight", npf_puppi_weight, "weight assigned by the PUPPI algorithm to neutral PF candidate", nanoaod::FlatTable::FloatColumn); - npfTable->addColumn("relmassdrop", npf_relmassdrop, "neutral PF candidate mass drop normalized relative to the jet", nanoaod::FlatTable::FloatColumn); - - svTable->addColumn("jetIdx", sv_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - svTable->addColumn("ptrel", sv_ptrel, "secondary vertex (SV) transverse momentum relative to the uncorrected jet energy pt", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("deta", sv_deta, "absolute difference between the secondary vertex (SV) eta and jet eta", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("dphi", sv_dphi, "absolute difference between the secondary vertex (SV) phi and jet phi", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("deltaR", sv_deltaR, "pseudoangular distance (Delta R) between jet axis and SV flight direction", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("mass", sv_mass, "invariant mass of reconstructed secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("ntracks", sv_ntracks, "number of tracks associated to the secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("chi2", sv_chi2, "chi^2 of secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("ndof", sv_ndof, "number of degrees of freedom of secondary vertex (SV) fit", nanoaod::FlatTable::IntColumn); - svTable->addColumn("dxy", sv_dxy, "transverse impact parameter of the secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("dxysig", sv_dxysig, "transverse impact parameter significance of the secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("d3d", sv_d3d, "3D impact parameter of secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("d3dsig", sv_d3dsig, "3D impact parameter significance of secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("costhetasvpv", sv_costhetasvpv, "cos(theta) of the secondary vertex (SV) with respect to the primary vertex (PV)", nanoaod::FlatTable::FloatColumn); - svTable->addColumn("enratio", sv_enratio, "ratio of secondary vertex (SV) energy with respect to the jet", nanoaod::FlatTable::FloatColumn); - - svTable_adapted->addColumn("jetIdx", sv_adapted_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - svTable_adapted->addColumn("ptrel", sv_adapted_ptrel, "secondary vertex (SV) transverse momentum relative to the uncorrected jet energy pt", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("deta", sv_adapted_deta, "absolute difference between the secondary vertex (SV) eta and jet eta", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("dphi", sv_adapted_dphi, "absolute difference between the secondary vertex (SV) phi and jet phi", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("deltaR", sv_adapted_deltaR, "pseudoangular distance (Delta R) between jet axis and SV flight direction", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("mass", sv_adapted_mass, "invariant mass of reconstructed secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("ntracks", sv_adapted_ntracks, "number of tracks associated to the secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("chi2", sv_adapted_chi2, "chi^2 of secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("ndof", sv_adapted_ndof, "number of degrees of freedom of secondary vertex (SV) fit", nanoaod::FlatTable::IntColumn); - svTable_adapted->addColumn("dxy", sv_adapted_dxy, "transverse impact parameter of the secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("dxysig", sv_adapted_dxysig, "transverse impact parameter significance of the secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("d3d", sv_adapted_d3d, "3D impact parameter of secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("d3dsig", sv_adapted_d3dsig, "3D impact parameter significance of secondary vertex (SV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("costhetasvpv", sv_adapted_costhetasvpv, "cos(theta) of the secondary vertex (SV) with respect to the primary vertex (PV)", nanoaod::FlatTable::FloatColumn); - svTable_adapted->addColumn("enratio", sv_adapted_enratio, "ratio of secondary vertex (SV) energy with respect to the jet", nanoaod::FlatTable::FloatColumn); + lengthTable->addColumn("cpf", cpf_length, "charged PF candidate track offset", nanoaod::FlatTable::IntColumn); lengthTable->addColumn("npf", npf_length, "neutral PF candidate offset", nanoaod::FlatTable::IntColumn); lengthTable->addColumn("sv", sv_length, "secondary vertex (SV) offset", nanoaod::FlatTable::IntColumn); lengthTable->addColumn("svAdapted", sv_adapted_length, "secondary vertex (SV) offset", nanoaod::FlatTable::IntColumn); lengthTable->addColumn("mu", mu_length, "muon offset", nanoaod::FlatTable::IntColumn); lengthTable->addColumn("ele", elec_length, "electron offset", nanoaod::FlatTable::IntColumn); + + + globalTable->addColumn("jetIdx", global_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + globalFillerList.fill(globalTable); + + csvTable->addColumn("jetIdx", csv_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + csvFillerList.fill(csvTable); + + cpfTable->addColumn("jetIdx", cpf_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + cpfFillerList.fill(cpfTable); - muonTable->addColumn("jetIdx", mu_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - - muonTable->addColumn("isGlobal",mu_isGlobal,"muon fitted from the tracker and muon stations",nanoaod::FlatTable::IntColumn); - muonTable->addColumn("isTight",mu_isTight,"global muon with additional muon-quality requirements.Tight Muon ID selects a subset of the Particle-Flow muons",nanoaod::FlatTable::IntColumn); - muonTable->addColumn("isMedium",mu_isMedium,"loose muon (i.e. PF muon that is either a global or an arbitrated tracker muon) with additional track-quality and muon-quality requirements.",nanoaod::FlatTable::IntColumn); - muonTable->addColumn("isLoose",mu_isLoose,"particle identified as a muon by the Particle-Flow event reconstruction, and that is also reconstructed either as a global-muon or as an arbitrated tracker-muon.",nanoaod::FlatTable::IntColumn); - muonTable->addColumn("isStandAlone",mu_isStandAlone,"particle identified as a muon by the Particle-Flow event reconstruction reconstructed only in the muon chambers", nanoaod::FlatTable::IntColumn); - - muonTable->addColumn("ptrel",mu_ptrel,"muon candidate transverse momentum relative to the uncorrected jet energy pt",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("EtaRel",mu_EtaRel,"muon candidate pseudorapidity, relative to the jet axis",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("dphi",mu_dphi,"absolute difference between the muon candidate phi and jet phi",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("deta",mu_deta,"absolute difference between the muon candidate eta and jet eta",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("charge",mu_charge,"muon candidate charge (-1 or +1)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("energy",mu_energy,"muon candidate energy",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("jetDeltaR",mu_jetDeltaR,"pseudoangular distance between jet axis and muon track fourvector",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("numberOfMatchedStations",mu_numberOfMatchedStations,"number of activated muon stations",nanoaod::FlatTable::FloatColumn); - - muonTable->addColumn("2dIP",mu_2dIP,"muon inner track transverse impact parameter relative to the primary vertex in transverse plane (2D), absolute value",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("2dIPSig",mu_2dIPSig,"muon inner track transverse impact parameter relative to the primary vertex relative to its uncertainty in transverse plane (2D)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("3dIP",mu_3dIP,"muon inner track transverse impact parameter relative to the primary vertex in 3D",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("3dIPSig",mu_3dIPSig,"muon inner track transverse impact parameter relative to the primary vertex relative to its uncertainty in 3D",nanoaod::FlatTable::FloatColumn); - -// Adding new documentation - muonTable->addColumn("dxy",mu_dxy,"transverse impact parameter of the best reconstructed muon track",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("dxyError",mu_dxyError,"error on transverse impact parameter of the best reconstructed muon track",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("dxySig",mu_dxySig,"significance of the transverse impact parameter of the best reconstructed muon track",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("dz",mu_dz,"longitudinal impact parameter of the best reconstructed muon track",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("dzError",mu_dzError,"error on the longitudinal impact parameter of the best reconstructed muon track",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("numberOfValidPixelHits",mu_numberOfValidPixelHits,"number of pixel hits by the muon track to further suppress muons from decays in flight",nanoaod::FlatTable::IntColumn); - muonTable->addColumn("numberOfpixelLayersWithMeasurement",mu_numberOfpixelLayersWithMeasurement,"number of pixel layers with valid hits by the muon track",nanoaod::FlatTable::IntColumn); - muonTable->addColumn("numberOfstripLayersWithMeasurement",mu_numberOfstripLayersWithMeasurement,"doc",nanoaod::FlatTable::IntColumn); - - muonTable->addColumn("chi2",mu_chi2,"chi^2 of muon track",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("ndof",mu_ndof,"number of degrees of freedom of muon track fit",nanoaod::FlatTable::IntColumn); - - muonTable->addColumn("caloIso",mu_caloIso,"returns the fraction of the summed transverse energy of the muon track recHits in the ECAL & HCAL in a cone of deltaR<0.3 normalized against its transverse momentum",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("ecalIso",mu_ecalIso,"returns the fraction of the transverse energy of the muon track recHits in the ECAL normalized against its transverse momentum",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("hcalIso",mu_hcalIso,"returns the fraction of the transverse energy of the muon track recHits in the HCAL normalized against its transverse momentum",nanoaod::FlatTable::FloatColumn); - - muonTable->addColumn("sumPfChHadronPt",mu_sumPfChHadronPt,"summed pt of charged hadron normalized against the muon's pt (PF based isolation of cone of 0.4 - Suggested)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("sumPfNeuHadronEt",mu_sumPfNeuHadronEt,"summed pt of neutral hadron normalized against the muon's pt (PF based isolation of cone of 0.4 - Suggested)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("Pfpileup",mu_Pfpileup,"summed pt of charged particles not from PV (for PU corrections) normalized against the muon's pt (PF based isolation of cone of 0.4 - Suggested)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("sumPfPhotonEt",mu_sumPfPhotonEt,"summed pt of PF photons normalized against the muon's pt (PF based isolation of cone of 0.4 - Suggested)",nanoaod::FlatTable::FloatColumn); - - muonTable->addColumn("sumPfChHadronPt03",mu_sumPfChHadronPt03,"summed pt of charged hadron normalized against the muon's pt (PF based isolation of cone of 0.3)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("sumPfNeuHadronEt03",mu_sumPfNeuHadronEt03,"summed pt of neutral hadron normalized against the muon's pt (PF based isolation of cone of 0.3)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("Pfpileup03",mu_Pfpileup03,"summed pt of charged particles not from PV (for PU corrections) normalized against the muon's pt (PF based isolation of cone of 0.3)",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("sumPfPhotonEt03",mu_sumPfPhotonEt03,"summed pt of PF photons normalized against the muon's pt (PF based isolation of cone of 0.3)",nanoaod::FlatTable::FloatColumn); - - muonTable->addColumn("timeAtIpInOut",mu_timeAtIpInOut,"the time at the interaction point for muons moving inside-out",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("timeAtIpInOutErr",mu_timeAtIpInOutErr,"error on the time at the interaction point for muons moving inside-out",nanoaod::FlatTable::FloatColumn); - muonTable->addColumn("timeAtIpOutIn",mu_timeAtIpOutIn,"The time at the interaction point for muons moving outside-in",nanoaod::FlatTable::FloatColumn); + npfTable->addColumn("jetIdx", npf_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + npfFillerList.fill(npfTable); + + svTable->addColumn("jetIdx", sv_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + svFillerList.fill(svTable); - electronTable->addColumn("jetIdx", elec_jetIdx, "linked jet Id", nanoaod::FlatTable::IntColumn); - electronTable->addColumn("ptrel",elec_ptrel,"electron candidate transverse momentum relative to the uncorrected jet energy pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("jetDeltaR",elec_jetDeltaR,"pseudoangular distance between jet axis and electron track fourvector",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deta",elec_deta,"absolute difference between the electron candidate eta and jet eta",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dphi",elec_dphi,"absolute difference between the electron candidate phi and jet phi",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("charge",elec_charge,"electron candidate charge (-1 or +1)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("energy",elec_energy,"electron candidate energy",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("EtFromCaloEn",elec_EtFromCaloEn,"electron transverse energy from calorimeters",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("isEB",elec_isEB,"electron energy deposited in the ECAL barrel",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("isEE",elec_isEE,"electron energy deposited in the ECAL endcap",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("ecalEnergy",elec_ecalEnergy,"electron energy deposited in the ECAL normalized against the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("isPassConversionVeto",elec_isPassConversionVeto,"vertex fit combined with missing number of hits method",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("convDist",elec_convDist,"minimum distance between conversion tracks",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("convFlags",elec_convFlags,"flag for electron coming from photon conversion",nanoaod::FlatTable::IntColumn); - - electronTable->addColumn("convRadius",elec_convRadius,"electron conversion radius",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("hadronicOverEm",elec_hadronicOverEm,"sum of hcal over ecal seed cluster energy using 1st and 2nd hcal depth (using hcal towers within a cone)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("ecalDrivenSeed",elec_ecalDrivenSeed,"ECAL driven seed",nanoaod::FlatTable::FloatColumn); - - - electronTable->addColumn("SC_energy",elecSC_energy,"electron supercluster energy normalized against the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("SC_deta",elecSC_deta,"absolute difference between the electron supercluster eta and gsfTrack electron eta",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("SC_dphi",elecSC_dphi,"absolute difference between the electron supercluster phi and gsfTrack electron phi",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("SC_et",elecSC_et,"electron supercluster transverse energy normalized against the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("SC_eSuperClusterOverP",elecSC_eSuperClusterOverP,"the electron supercluster energy / track momentum at the PCA to the beam spot",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("scPixCharge",elec_scPixCharge,"electron supercluster pixel charge",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("sigmaEtaEta",elec_sigmaEtaEta,"electron supercluster Sigma Eta Eta variable (quite unintuitive)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("sigmaIetaIeta",elec_sigmaIetaIeta,"electron supercluster Sigma iEta iEta variable (improved variable against Sigma Eta Eta to resolv issues in cracks)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("sigmaIphiIphi",elec_sigmaIphiIphi,"electron supercluster Sigma iphi iphi variable",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("r9",elec_r9,"electron supercluster r9 variable",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("superClusterFbrem",elec_superClusterFbrem,"the brem fraction from supercluster: (supercluster energy - electron cluster energy) / supercluster energy",nanoaod::FlatTable::FloatColumn); - - electronTable->addColumn("2dIP",elec_2dIP,"electron inner track transverse impact parameter relative to the primary vertex in transverse plane (2D), absolute value",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("2dIPSig",elec_2dIPSig,"electron inner track transverse impact parameter relative to the primary vertex relative to its uncertainty in transverse plane (2D)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("3dIP",elec_3dIP,"electron inner track transverse impact parameter relative to the primary vertex in 3D",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("3dIPSig",elec_3dIPSig,"electron inner track transverse impact parameter relative to the primary vertex relative to its uncertainty in 3D",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("eSeedClusterOverP",elec_eSeedClusterOverP,"the seed cluster energy / track momentum at the PCA to the beam spot",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("eSeedClusterOverPout",elec_eSeedClusterOverPout,"the seed cluster energy / track momentum at calo extrapolated from the outermost track state",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("eSuperClusterOverP",elec_eSuperClusterOverP,"the supercluster energy / track momentum at the PCA to the beam spot",nanoaod::FlatTable::FloatColumn); - - electronTable->addColumn("deltaEtaEleClusterTrackAtCalo",elec_deltaEtaEleClusterTrackAtCalo,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deltaEtaSeedClusterTrackAtCalo",elec_deltaEtaSeedClusterTrackAtCalo,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deltaPhiSeedClusterTrackAtCalo",elec_deltaPhiSeedClusterTrackAtCalo,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deltaEtaSeedClusterTrackAtVtx",elec_deltaEtaSeedClusterTrackAtVtx,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deltaEtaSuperClusterTrackAtVtx",elec_deltaEtaSuperClusterTrackAtVtx,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deltaPhiEleClusterTrackAtCalo",elec_deltaPhiEleClusterTrackAtCalo,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("deltaPhiSuperClusterTrackAtVtx",elec_deltaPhiSuperClusterTrackAtVtx,"doc",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("sCseedEta",elec_sCseedEta,"doc",nanoaod::FlatTable::FloatColumn); - - electronTable->addColumn("EtaRel",elec_EtaRel,"electron pseudorapidity, relative to the jet axis",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dxy",elec_dxy,"transverse impact parameter of the electron",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dz",elec_dz,"longitudinal impact parameter of the best reconstructed electron track",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("nbOfMissingHits",elec_nbOfMissingHits,"number of missing electron hits in its hit pattern",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("gsfCharge",elec_gsfCharge,"gsf electron charge",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("ndof",elec_ndof,"gsf electron number degree of freedom",nanoaod::FlatTable::IntColumn); - electronTable->addColumn("chi2",elec_chi2,"chi2 of the fit ",nanoaod::FlatTable::FloatColumn); - - electronTable->addColumn("numberOfBrems",elec_numberOfBrems,"number of Bremsstrahlung electrons in a shower",nanoaod::FlatTable::IntColumn); - electronTable->addColumn("fbrem",elec_fbrem,"doc",nanoaod::FlatTable::FloatColumn); - - electronTable->addColumn("e5x5",elec_e5x5,"electron energy in 5x5 ECAL block on seed",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("e5x5Rel",elec_e5x5Rel,"electron energy in 5x5 ECAL block on seed relative to the jet pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("e2x5MaxOvere5x5",elec_e2x5MaxOvere5x5,"electron energy ratio of highest energy 2x5 ECAL block containing seed over total energy in 5x5 block on seed",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("e1x5Overe5x5",elec_e1x5Overe5x5,"electron energy ratio of highest energy 1x5 ECAL block containing seed over total energy in 5x5 block on seed",nanoaod::FlatTable::FloatColumn); - - electronTable->addColumn("neutralHadronIso",elec_neutralHadronIso,"returns the isolation calculated with only the neutral hadron PFCandidates relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("particleIso",elec_particleIso,"returns the isolation calculated with all the PFCandidates relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("photonIso",elec_photonIso,"returns the isolation calculated with only the gamma PFCandidates relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("puChargedHadronIso",elec_puChargedHadronIso,"returns the isolation calculated with only the pile-up charged hadron PFCandidates relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("trackIso",elec_trackIso,"returns the tracker isolation variable that was stored in this object when produced, or -1.0 if there is none, relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("hcalDepth1OverEcal",elec_hcalDepth1OverEcal,"HCAL over ECAL seed cluster energy using 1st HCAL depth (using HCAL towers within a cone)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("hcalDepth2OverEcal",elec_hcalDepth2OverEcal,"HCAL over ECAL seed cluster energy using 2nd HCAL depth (using HCAL towers within a cone)",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("ecalPFClusterIso",elec_ecalPFClusterIso,"sum pt of isolated ECAL clusters, vetoing clusters part of electron",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("hcalPFClusterIso",elec_hcalPFClusterIso,"sum pt of isolated HCAL clusters, vetoing clusters part of electron",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("pfSumPhotonEt",elec_pfSumPhotonEt,"sum pt of PF photons // old float photonIso, relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("pfSumChargedHadronPt",elec_pfSumChargedHadronPt,"sum pt of charged hadron // old float chargedHadronIso, relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("pfSumNeutralHadronEt",elec_pfSumNeutralHadronEt,"sum transverse energy of neutral hadron // old float neutralHadronIso, relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("pfSumPUPt",elec_pfSumPUPt,"sum pt of charged particles not from PV (for PU corrections) ",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04TkSumPt",elec_dr04TkSumPt,"track iso deposit with electron footprint removed relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04EcalRecHitSumEt",elec_dr04EcalRecHitSumEt,"ECAL iso deposit with electron footprint removed relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04HcalDepth1TowerSumEt",elec_dr04HcalDepth1TowerSumEt,"HCAL depth 1 iso deposit with electron footprint removed relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04HcalDepth1TowerSumEtBc",elec_dr04HcalDepth1TowerSumEtBc,"HCAL depth 1 iso deposit without towers behind cluster relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04HcalDepth2TowerSumEt",elec_dr04HcalDepth2TowerSumEt,"HCAL depth 2 iso deposit with towers behind cluster relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04HcalDepth2TowerSumEtBc",elec_dr04HcalDepth2TowerSumEtBc,"HCAL depth 2 iso deposit without towers behind cluster relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04HcalTowerSumEt",elec_dr04HcalTowerSumEt,"HCAL depth 1+2 iso deposit with towers behind cluster relative to the electron pt",nanoaod::FlatTable::FloatColumn); - electronTable->addColumn("dr04HcalTowerSumEtBc",elec_dr04HcalTowerSumEtBc,"HCAL depth 1+2 iso deposit without towers behind cluster relative to the electron pt",nanoaod::FlatTable::FloatColumn); + svTable_adapted->addColumn("jetIdx", sv_adapted_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + svAdaptedFillerList.fill(svTable_adapted); + + muonTable->addColumn("jetIdx", mu_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + muonFillerList.fill(muonTable); + electronTable->addColumn("jetIdx", elec_jetIdx, "linked jet Idx", nanoaod::FlatTable::IntColumn); + electronFillerList.fill(electronTable); + iEvent.put(std::move(globalTable), "global"); iEvent.put(std::move(csvTable), "csv"); iEvent.put(std::move(cpfTable), "cpf"); diff --git a/NANOProducer/test/crab.py b/NANOProducer/test/crab.py index 8ccf871..31853e1 100644 --- a/NANOProducer/test/crab.py +++ b/NANOProducer/test/crab.py @@ -19,19 +19,67 @@ "year": 2018, }, + "WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM-pythia8-2016":{ - "inputDataset":"/WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM", - "year": 2016 + "inputDataset":"/WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_ext2-v2/MINIAODSIM", + "year": 2016, }, "WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8-2017":{ - "inputDataset":"/WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v3/MINIAODSIM", - "year": 2017 + "inputDataset":"/WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v2/MINIAODSIM", + "year": 2017, }, "WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8-2018":{ "inputDataset":"/WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v2/MINIAODSIM", - "year": 2018 + "year": 2018, }, + + + "QCD_Pt_15to30_TuneCUETP8M1_13TeV_pythia8-2016":{ + "inputDataset":"/QCD_Pt_15to30_TuneCUETP8M1_13TeV_pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM", + "year": 2016, + }, + "QCD_Pt_30to50_TuneCUETP8M1_13TeV_pythia8-2016":{ + "inputDataset":"/QCD_Pt_30to50_TuneCUETP8M1_13TeV_pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM", + "year": 2016, + }, + "QCD_Pt_50to80_TuneCUETP8M1_13TeV_pythia8-2016":{ + "inputDataset":"/QCD_Pt_50to80_TuneCUETP8M1_13TeV_pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM", + "year": 2016, + }, + + + + "QCD_Pt_15to30_TuneCP5_13TeV_pythia8-2017":{ + "inputDataset":"/QCD_Pt_15to30_TuneCP5_13TeV_pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v2/MINIAODSIM", + "year": 2017, + }, + "QCD_Pt_30to50_TuneCP5_13TeV_pythia8-2017":{ + "inputDataset":"/QCD_Pt_30to50_TuneCP5_13TeV_pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v2/MINIAODSIM", + "year": 2017, + }, + "QCD_Pt_50to80_TuneCP5_13TeV_pythia8-2017":{ + "inputDataset":"/QCD_Pt_50to80_TuneCP5_13TeV_pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14_ext1-v2/MINIAODSIM", + "year": 2017, + }, + + + + "QCD_Pt_15to30_TuneCP5_13TeV_pythia8-2018":{ + "inputDataset":"/QCD_Pt_15to30_TuneCP5_13TeV_pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15_ext1-v2/MINIAODSIM", + "year": 2018, + }, + "QCD_Pt_30to50_TuneCP5_13TeV_pythia8-2018":{ + "inputDataset":"/QCD_Pt_30to50_TuneCP5_13TeV_pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM", + "year": 2018, + }, + "QCD_Pt_50to80_TuneCP5_13TeV_pythia8-2018":{ + "inputDataset":"/QCD_Pt_50to80_TuneCP5_13TeV_pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15_ext1-v2/MINIAODSIM", + "year": 2018, + }, + + + "QCD_Pt-15to7000_TuneCUETP8M1_FlatP6_13TeV_pythia8-2016":{ "inputDataset":"/QCD_Pt-15to7000_TuneCUETP8M1_FlatP6_13TeV_pythia8/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3-v2/MINIAODSIM", "year": 2016 @@ -46,8 +94,24 @@ "inputDataset":"/QCD_Pt-15to7000_TuneCP5_Flat2018_13TeV_pythia8/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15_ext1-v1/MINIAODSIM", "year": 2018 }, - - + + + + "LLPGun-2016":{ + "inputDataset":"/LLPGun/mkomm-miniaod16v3_200929-53f8667ba4b240d5eafd36e71bf34742/USER", + "year": 2016, + "unitsPerJob": 15, + }, + "LLPGun-2017":{ + "inputDataset":"/LLPGun/mkomm-miniaod17v2_200929-442a7f6ea2510b243c486adb7160c528/USER", + "year": 2017, + "unitsPerJob": 15, + }, + "LLPGun-2018":{ + "inputDataset":"/LLPGun/mkomm-miniaod18_200929-c21dec93027231dc6f615dfe5c662834/USER", + "year": 2018, + "unitsPerJob": 15, + }, } myJobsAnalysis = { diff --git a/NANOProducer/test/getFiles.py b/NANOProducer/test/getFiles.py index d7c2980..2a80d20 100644 --- a/NANOProducer/test/getFiles.py +++ b/NANOProducer/test/getFiles.py @@ -6,7 +6,7 @@ from fcntl import fcntl, F_GETFL, F_SETFL from os import O_NONBLOCK, read -basepath = "srm://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/LLP/NANOX_200124" +basepath = "srm://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/HNL/NANOX_201107" def listdir(path): print "query path ... ",path diff --git a/NANOProducer/test/produceNANO.py b/NANOProducer/test/produceNANO.py index fd4f278..62387e3 100644 --- a/NANOProducer/test/produceNANO.py +++ b/NANOProducer/test/produceNANO.py @@ -24,17 +24,9 @@ "adds LHE weights of signal samples" ) -options.register( - 'addLLPInfo', - True, - VarParsing.multiplicity.singleton, - VarParsing.varType.bool, - "add LLP Info" -) - options.register( 'year', - '2017', + '2016', VarParsing.multiplicity.singleton, VarParsing.varType.string, "add year file" @@ -45,8 +37,9 @@ False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, - "test mode" + "running test" ) + options.parseArguments() if options.year == '2016': @@ -90,18 +83,29 @@ process.options = cms.untracked.PSet() files = { + 'test': { + "mc": "/store/user/kjpena/miniAODv3_08Feb2020/GluGluH_HToSSTobbbb_MH-125_MS-25_ctauS-500_TuneCUETP8M1_13TeV-powheg-pythia8_PRIVATE-MC/RunIISummer16MiniAODv3-PUMoriond17_94X_mcRun2_asymptotic_v3_MINIAODSIM/200209_212810/0000/output_1.root", + #"mc": "https://github.com/LLPDNNX/test-files/raw/master/miniaod/Moriond17_aug2018_miniAODv3_HNL.root", + }, '2016': { - #"mc": "root://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/HNL/miniaod16v3_200625/HNL_dirac_all_ctau1p0e-02_massHNL8p0_Vall2p996e-02/miniaod16v3_200625/200625_171726/0000/HNL2016_9.root", - "mc": "/store/user/mkomm/HNL/miniaod16v3_200625/LLPGun/miniaod16v3_200625/200724_114912/0001/GUN2016_1085.root", - "data": "/store/data/Run2016B/SingleElectron/MINIAOD/17Jul2018_ver2-v1/40000/6E260591-B88C-E811-AA91-001E67DBE79B.root", + #"mc":"root://xrootd.grid.hep.ph.ic.ac.uk//store/mc/RunIISummer16MiniAODv3/TTJets_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v1/40000/0A4EAAB1-9223-E911-B512-A4BF01283A8B.root", + #"mc":"root://xrootd.grid.hep.ph.ic.ac.uk//store/mc/RunIISummer16MiniAODv3/GluGluToHHTo2B2Tau_node_SM_13TeV-madgraph/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/50000/AEF4E98A-C672-E911-9FD1-AC1F6BAC7D18.root", + #"mc":"root://xrootd.grid.hep.ph.ic.ac.uk//store/mc/RunIISummer16MiniAODv3/DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/MINIAODSIM/PUMoriond17_94X_mcRun2_asymptotic_v3-v2/00000/025CA8F7-7C08-E911-8165-0242AC1C0501.root", + "mc": [ + "root://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/HNL/miniaod16v3_200929/LLPGun/miniaod16v3_200929/201007_212837/0000/GUN2016_%i.root"%(i) for i in range(1,10) + ], + #"mc": "root://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/HNL/miniaod16v3_200517/HNL_dirac_all_ctau1p0e00_massHNL6p0_Vall6p496e-03/miniaod16v3_200517/200517_004822/0000/HNL2016_140.root", #"root://maite.iihe.ac.be//store/user/tomc/heavyNeutrinoMiniAOD/Moriond17_aug2018_miniAODv3/displaced/HeavyNeutrino_lljj_M-8_V-0.004472135955_tau_Dirac_massiveAndCKM_LO/heavyNeutrino_1.root", + #"mc": "root://maite.iihe.ac.be///store/user/tomc/heavyNeutrinoMiniAOD/Moriond17_aug2018_miniAODv3/displaced/HeavyNeutrino_lljj_M-10_V-0.00112249721603_mu_Dirac_massiveAndCKM_LO/heavyNeutrino_76.root", + "data": "/store/data/Run2016H/SingleMuon/MINIAOD/17Jul2018-v1/00000/16924A85-4D8C-E811-A51C-A4BF01013F29.root", }, '2017': { - "mc": "root://gfe02.grid.hep.ph.ic.ac.uk:1097//store/user/mkomm/HNL/miniaod17v2_200625/HNL_dirac_all_ctau1p0e01_massHNL2p0_Vall4p066e-02/miniaod17v2_200625/200706_192938/0000/HNL2017_93.root", - #"mc": "/store/mc/RunIIFall17MiniAODv2/DYJetsToLL_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/10000/40375A25-3C42-E811-B3CB-008CFAC91A4C.root", + "mc": "root://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/HNL/testgun17v2/LLPGun/testgun17v2/200724_143441/0000/GUN2017_1.root", + #"mc": "root://maite.iihe.ac.be//store/user/tomc/heavyNeutrinoMiniAOD/Fall17/displaced/HeavyNeutrino_lljj_M-8_V-0.00214242852856_mu_Dirac_massiveAndCKM_LO/heavyNeutrino_10.root", "data": "/store/data/Run2017E/SingleMuon/MINIAOD/31Mar2018-v1/00000/A6325FCE-1C39-E811-BB22-0CC47A745298.root" }, '2018': { - "mc": "/store/mc/RunIIAutumn18MiniAOD/TTJets_TuneCP5_13TeV-madgraphMLM-pythia8/MINIAODSIM/102X_upgrade2018_realistic_v15-v1/280000/476F85B5-BDDA-5A4D-BB9E-199B03CE1FD7.root", + "mc":"root://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/cms/store/user/mkomm/HNL/miniaod18_200625/HNL_dirac_all_ctau1p0e-01_massHNL10p0_Vall5p262e-03/miniaod18_200625/200709_103117/0000/HNL2018_283.root", + #"mc": "root://maite.iihe.ac.be//store/user/tomc/heavyNeutrinoMiniAOD/Autumn18/displaced/HeavyNeutrino_lljj_M-8_V-0.00214242852856_mu_Dirac_massiveAndCKM_LO/heavyNeutrino_10.root", "data": "/store/data/Run2018B/SingleMuon/MINIAOD/17Sep2018-v1/60000/FF47BB90-FC1A-CC44-A635-2B8B8C64AA39.root" }, '2018D': { @@ -109,7 +113,7 @@ } } -if options.test: +if len(options.inputFiles)>0: process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(options.inputFiles) ) @@ -117,7 +121,6 @@ process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(files[options.year]['data'] if options.isData else files[options.year]['mc']) ) - # Production Info process.configurationMetadata = cms.untracked.PSet( annotation = cms.untracked.string('test102X nevts:10000'), @@ -140,6 +143,7 @@ SelectEvents = cms.vstring('llpnanoAOD_step') #only events passing this path will be saved ), fileName = cms.untracked.string('nano.root'), + #outputCommands = process.NANOAODSIMEventContent.outputCommands+cms.untracked.vstring( outputCommands = cms.untracked.vstring( 'drop *', 'keep nanoaodFlatTable_*Table_*_*', @@ -165,6 +169,8 @@ 'drop *_rivetMetTable_*_*', 'drop *_rivetProducerHTXS_*_*', + + #'drop *_rivetMetTable_*_*', ) ) @@ -175,6 +181,9 @@ outputCommands = cms.untracked.vstring(['keep *']) ) +if options.year == "test": + options.year = "2016" + if options.isData: if options.year == '2016': process.GlobalTag = GlobalTag(process.GlobalTag, '102X_dataRun2_v13', '') @@ -247,11 +256,11 @@ src = cms.InputTag("genParticlesMerged"), decays = cms.PSet( #hnl -> qql - hnl = cms.PSet( + hnl_dirac = cms.PSet( llpId = cms.int32(9990012), daughterIds = cms.vint32([1,2,3,4,5,11,13,15]) ), - antihnl = cms.PSet( + hnl_majorana = cms.PSet( llpId = cms.int32(9900012), daughterIds = cms.vint32([1,2,3,4,5,11,13,15]) ), @@ -278,20 +287,18 @@ ) ) -process.llpFlavour = cms.EDProducer( - "LLPGhostFlavourProducer", - srcJets = cms.InputTag("updatedJets"), - srcDecayInfo = cms.InputTag("llpGenDecayInfo"), - jetAlgorithm = cms.string("AntiKt"), - rParam = cms.double(0.4), - ghostRescaling = cms.double(1e-18), - relPtTolerance = cms.double(1e-3) -) process.llpLabels = cms.EDProducer( "LLPLabelProducer", srcVertices = cms.InputTag("displacedGenVertices"), srcJets = cms.InputTag("updatedJets"), + srcDecayInfo = cms.InputTag("llpGenDecayInfo"), +) +''' +process.llpLabelsOld = cms.EDProducer( + "LLPLabelOldProducer", + srcVertices = cms.InputTag("displacedGenVertices"), + srcJets = cms.InputTag("updatedJets"), srcFlavourInfo = cms.InputTag("llpFlavour"), tauPtThreshold = cms.double(1.), quarkPtThreshold = cms.double(1.), @@ -299,7 +306,7 @@ muonPtThreshold = cms.double(1.), electronPtThreshold = cms.double(1.), ) - +''' process.lheWeightsTable = cms.EDProducer( @@ -307,6 +314,9 @@ lheInfo = cms.VInputTag(cms.InputTag("externalLHEProducer"), cms.InputTag("source")), weightGroups = cms.PSet() ) +#gun parameters +process.lheWeightsTable.weightGroups.gun_ctau = cms.vstring(['ctau']) +process.lheWeightsTable.weightGroups.gun_llpmass = cms.vstring(['llpmass']) #coupling reweighting process.lheWeightsTable.weightGroups.coupling = cms.vstring() @@ -341,7 +351,6 @@ for i in scaleSet[1]: getattr(process.lheWeightsTable.weightGroups,scaleSet[0]).append("%i"%(i)) - process.load('RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff') process.load('LLPReco.NANOProducer.adaptedSV_cff') @@ -373,7 +382,7 @@ if options.isData: process.llpnanoAOD_step = cms.Path( - #process.muonFilterSequence+ + process.muonFilterSequence+ process.nanoSequence+ process.adaptedVertexing+ process.pfXTagInfos+ @@ -386,7 +395,6 @@ process.pfXTagInfos+ process.displacedGenVertexSequence+ process.llpGenDecayInfo+ - process.llpFlavour+ process.llpLabels+ process.nanoTable+ process.nanoGenTable @@ -455,12 +463,14 @@ else: print "module for removal not found: ",moduleName +#override final photons (required by object linker) so that ID evaluation is not needed +#process.finalPhotons.cut = cms.string("pt > 5") +#process.finalPhotons.src = cms.InputTag("slimmedPhotons") process.genParticleTable.variables.vertex_x = Var("vertex().x()", float, doc="vertex x position") process.genParticleTable.variables.vertex_y = Var("vertex().y()", float, doc="vertex y position") process.genParticleTable.variables.vertex_z = Var("vertex().z()", float, doc="vertex z position") - ''' process.MINIAODoutput = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('output.root'), diff --git a/NANOProducer/test/untitled.py b/NANOProducer/test/untitled.py deleted file mode 100644 index d85e8bb..0000000 --- a/NANOProducer/test/untitled.py +++ /dev/null @@ -1,64 +0,0 @@ - -process.load('RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff') -process.inclusiveCandidateVertexFinder = cms.EDProducer("InclusiveCandidateVertexFinder", - beamSpot = cms.InputTag("offlineBeamSpot"), - clusterizer = cms.PSet( - clusterMaxDistance = cms.double(0.05), - clusterMaxSignificance = cms.double(4.5), - clusterMinAngleCosine = cms.double(0.5), - distanceRatio = cms.double(20), - seedMax3DIPSignificance = cms.double(9999.0), - seedMax3DIPValue = cms.double(9999.0), - seedMin3DIPSignificance = cms.double(1.2), - seedMin3DIPValue = cms.double(0.005) - ), - fitterRatio = cms.double(0.25), - fitterSigmacut = cms.double(3), - fitterTini = cms.double(256), - maxNTracks = cms.uint32(30), - maximumLongitudinalImpactParameter = cms.double(0.3), - minHits = cms.uint32(0), - minPt = cms.double(0.8), - primaryVertices = cms.InputTag("offlineSlimmedPrimaryVertices"), - tracks = cms.InputTag("packedPFCandidates"), - useDirectVertexFitter = cms.bool(True), - useVertexReco = cms.bool(True), - vertexMinAngleCosine = cms.double(0.95), - vertexMinDLen2DSig = cms.double(2.5), - vertexMinDLenSig = cms.double(0.5), - vertexReco = cms.PSet( - finder = cms.string('avr'), - primcut = cms.double(1.0), - seccut = cms.double(3), - smoothing = cms.bool(True) - ) -) - -process.candidateVertexMerger = cms.EDProducer("CandidateVertexMerger", - maxFraction = cms.double(0.7), - minSignificance = cms.double(2), - secondaryVertices = cms.InputTag("inclusiveCandidateVertexFinder") -) - -process.candidateVertexArbitrator = cms.EDProducer("CandidateVertexArbitrator", - beamSpot = cms.InputTag("offlineBeamSpot"), - dLenFraction = cms.double(0.333), - dRCut = cms.double(0.4), - distCut = cms.double(0.04), - fitterRatio = cms.double(0.25), - fitterSigmacut = cms.double(3), - fitterTini = cms.double(256), - primaryVertices = cms.InputTag("offlineSlimmedPrimaryVertices"), - secondaryVertices = cms.InputTag("candidateVertexMerger"), - sigCut = cms.double(5), - trackMinLayers = cms.int32(4), - trackMinPixels = cms.int32(1), - trackMinPt = cms.double(0.4), - tracks = cms.InputTag("packedPFCandidates") -) - -process.slimmedSecondaryVertices = cms.EDProducer("CandidateVertexMerger", - maxFraction = cms.double(0.2), - minSignificance = cms.double(10.0), - secondaryVertices = cms.InputTag("candidateVertexArbitrator") -) diff --git a/XTagInfoProducer/interface/JetSubstructure.h b/XTagInfoProducer/interface/JetSubstructure.h index ec7b757..d9845f2 100644 --- a/XTagInfoProducer/interface/JetSubstructure.h +++ b/XTagInfoProducer/interface/JetSubstructure.h @@ -56,7 +56,7 @@ class JetSubstructure //default values from https://cmssdt.cern.ch/lxr/source/RecoJets/JetProducers/python/nJettinessAdder_cfi.py except R=0.8 -> 0.4 double nSubjettiness( - int n, + size_t n, const fastjet::contrib::AxesDefinition& axisDef = fastjet::contrib::OnePass_KT_Axes(), const fastjet::contrib::MeasureDefinition& measureDef = fastjet::contrib::NormalizedMeasure(1.0, 0.4) ) const; diff --git a/XTagInfoProducer/plugins/XTagInfoProducer.cc b/XTagInfoProducer/plugins/XTagInfoProducer.cc index 32090e1..d0d07b5 100644 --- a/XTagInfoProducer/plugins/XTagInfoProducer.cc +++ b/XTagInfoProducer/plugins/XTagInfoProducer.cc @@ -54,14 +54,14 @@ llpdnnx::SecondaryVertexFeatures fillSVFeatures(const reco::VertexCompositePtrCa float uncorrectedPt = jet.correctedP4("Uncorrected").pt(); llpdnnx::SecondaryVertexFeatures sv_features; - sv_features.sv_ptrel = sv.pt()/uncorrectedPt; - sv_features.sv_deta = sv.eta()-jet.eta(); - sv_features.sv_dphi = reco::deltaPhi(sv.phi(),jet.phi()); - sv_features.sv_deltaR = reco::deltaR(sv,jet); - sv_features.sv_mass = sv.mass(); - sv_features.sv_ntracks = sv.numberOfDaughters(); - sv_features.sv_chi2 = sv.vertexChi2(); - sv_features.sv_ndof = sv.vertexNdof(); + sv_features.ptrel = sv.pt()/uncorrectedPt; + sv_features.deta = sv.eta()-jet.eta(); + sv_features.dphi = reco::deltaPhi(sv.phi(),jet.phi()); + sv_features.deltaR = reco::deltaR(sv,jet); + sv_features.mass = sv.mass(); + sv_features.ntracks = sv.numberOfDaughters(); + sv_features.chi2 = sv.vertexChi2(); + sv_features.ndof = sv.vertexNdof(); reco::Vertex::CovarianceMatrix covsv; @@ -70,23 +70,27 @@ llpdnnx::SecondaryVertexFeatures fillSVFeatures(const reco::VertexCompositePtrCa VertexDistanceXY distXY; Measurement1D distanceXY = distXY.distance(svtx, pv); - sv_features.sv_dxy = distanceXY.value(); - sv_features.sv_dxysig = distanceXY.value()/distanceXY.error(); + sv_features.dxy = distanceXY.value(); + sv_features.dxysig = distanceXY.value()/distanceXY.error(); VertexDistance3D dist3D; Measurement1D distance3D = dist3D.distance(svtx, pv); - sv_features.sv_d3d = distance3D.value(); - sv_features.sv_d3dsig = distance3D.value()/distance3D.error(); + sv_features.d3d = distance3D.value(); + sv_features.d3dsig = distance3D.value()/distance3D.error(); - if (std::isnan(sv_features.sv_dxysig) || std::isnan(sv_features.sv_d3dsig)) - { - sv_features.sv_dxysig = 0.; - sv_features.sv_d3dsig = 0.; - } + if (std::isnan(sv_features.dxysig) || std::isnan(sv_features.d3dsig)) + { + sv_features.dxysig = 0.; + sv_features.d3dsig = 0.; + } reco::Candidate::Vector distance(sv.vx() - pv.x(), sv.vy() - pv.y(), sv.vz() - pv.z()); - sv_features.sv_costhetasvpv = sv.momentum().Unit().Dot(distance.Unit()); - sv_features.sv_enratio = sv.energy()/jet.pt(); + sv_features.costhetasvpv = sv.momentum().Unit().Dot(distance.Unit()); + sv_features.enratio = sv.energy()/jet.pt(); + + sv_features.vx = sv.vertex().x(); + sv_features.vy = sv.vertex().y(); + sv_features.vz = sv.vertex().z(); return sv_features; } @@ -281,7 +285,7 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) features.jet_features.eventShapeD = eventShapes.D(); } - + // Add CSV variables const edm::View& taginfos = *shallow_tag_infos; edm::Ptr match; @@ -300,19 +304,19 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } // will be default values otherwise reco::TaggingVariableList vars = tag_info.taggingVariables(); - features.tag_info_features.csv_trackSumJetEtRatio = vars.get(reco::btau::trackSumJetEtRatio, -1); - features.tag_info_features.csv_trackSumJetDeltaR = vars.get(reco::btau::trackSumJetDeltaR, -1); - features.tag_info_features.csv_vertexCategory = vars.get(reco::btau::vertexCategory, -1); - features.tag_info_features.csv_trackSip2dValAboveCharm = vars.get(reco::btau::trackSip2dValAboveCharm, -1); - features.tag_info_features.csv_trackSip2dSigAboveCharm = vars.get(reco::btau::trackSip2dSigAboveCharm, -1); - features.tag_info_features.csv_trackSip3dValAboveCharm = vars.get(reco::btau::trackSip3dValAboveCharm, -1); - features.tag_info_features.csv_trackSip3dSigAboveCharm = vars.get(reco::btau::trackSip3dSigAboveCharm, -1); - features.tag_info_features.csv_jetNTracksEtaRel = vars.get(reco::btau::jetNTracksEtaRel, -1); - features.tag_info_features.csv_jetNSelectedTracks = vars.get(reco::btau::jetNSelectedTracks, -1); + features.tag_info_features.trackSumJetEtRatio = vars.get(reco::btau::trackSumJetEtRatio, -1); + features.tag_info_features.trackSumJetDeltaR = vars.get(reco::btau::trackSumJetDeltaR, -1); + features.tag_info_features.vertexCategory = vars.get(reco::btau::vertexCategory, -1); + features.tag_info_features.trackSip2dValAboveCharm = vars.get(reco::btau::trackSip2dValAboveCharm, -1); + features.tag_info_features.trackSip2dSigAboveCharm = vars.get(reco::btau::trackSip2dSigAboveCharm, -1); + features.tag_info_features.trackSip3dValAboveCharm = vars.get(reco::btau::trackSip3dValAboveCharm, -1); + features.tag_info_features.trackSip3dSigAboveCharm = vars.get(reco::btau::trackSip3dSigAboveCharm, -1); + features.tag_info_features.jetNTracksEtaRel = vars.get(reco::btau::jetNTracksEtaRel, -1); + features.tag_info_features.jetNSelectedTracks = vars.get(reco::btau::jetNSelectedTracks, -1); - std::unordered_set candidatesMatchedToSV; - std::unordered_set candidatesMatchedToSVAdapted; + std::unordered_map, CandidateHash> candidatesMatchedToSV; + std::unordered_map, CandidateHash> candidatesMatchedToSVAdapted; // fill features from secondary vertices @@ -329,25 +333,22 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { if (jetConstituentSet.find(candidateFromVertex)!=jetConstituentSet.end()) { - candidatesMatchedToSV.insert(candidateFromVertex); + candidatesMatchedToSV[candidateFromVertex].push_back(&sv); matchingTrack = true; } } if (not matchingTrack) continue; - llpdnnx::SecondaryVertexFeatures sv_features = fillSVFeatures(sv, pv, jet); + llpdnnx::SecondaryVertexFeatures sv_features = fillSVFeatures(sv, pv, jet); features.sv_features.emplace_back(sv_features); } - std::stable_sort(features.sv_features.begin(),features.sv_features.end(),[](const auto& d1, const auto& d2) - { - return d1.sv_dxysig>d2.sv_dxysig; //sort decreasing - }); + std::stable_sort(features.sv_features.begin(),features.sv_features.end()); - // fill features from secondary vertices + // fill features from adapted secondary vertices for (unsigned int isv = 0; isv < svs_adapted->size(); ++isv) { @@ -362,22 +363,17 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { if (jetConstituentSet.find(candidateFromVertex)!=jetConstituentSet.end()) { - candidatesMatchedToSVAdapted.insert(candidateFromVertex); + candidatesMatchedToSVAdapted[candidateFromVertex].push_back(&sv_adapted); matchingTrack = true; } } if (not matchingTrack) continue; llpdnnx::SecondaryVertexFeatures sv_adapted_features = fillSVFeatures(sv_adapted, pv, jet); - - features.sv_adapted_features.emplace_back(sv_adapted_features); } - std::stable_sort(features.sv_adapted_features.begin(),features.sv_adapted_features.end(),[](const auto& d1, const auto& d2) - { - return d1.sv_dxysig>d2.sv_dxysig; //sort decreasing - }); + std::stable_sort(features.sv_adapted_features.begin(),features.sv_adapted_features.end()); // Fill cpf info @@ -396,49 +392,53 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) llpdnnx::ChargedCandidateFeatures cpf_features; - cpf_features.cpf_ptrel = constituent->pt()/uncorrectedPt; - cpf_features.cpf_deta = constituent->eta()-jet.eta(); - cpf_features.cpf_dphi = reco::deltaPhi(constituent->phi(),jet.phi()); + cpf_features.ptrel = constituent->pt()/uncorrectedPt; + cpf_features.deta = constituent->eta()-jet.eta(); + cpf_features.dphi = reco::deltaPhi(constituent->phi(),jet.phi()); + cpf_features.deltaR = reco::deltaR(*constituent,jet); + + cpf_features.px = constituent->px(); + cpf_features.py = constituent->py(); + cpf_features.pz = constituent->pz(); - cpf_features.cpf_drminsv = 0.4; + cpf_features.drminsv = 0.4; for (const auto& sv: *svs.product()) { float dR = reco::deltaR(sv,*constituent); - cpf_features.cpf_drminsv = std::min(cpf_features.cpf_drminsv,dR); + cpf_features.drminsv = std::min(cpf_features.drminsv,dR); } - float dZ0 = std::abs(constituent->dz(pv.position())); - float dZmin = dZ0; + float dZmin = 100; for (size_t i = 0; i < vtxs->size(); i++){ - if (i == 0) continue; auto vtx = vtxs->at(i); if (vtx.isFake() || vtx.ndof() < 4) { continue; } + if ((vtx.position()-pv.position()).mag2()<1e-3) continue; //skip PV dZmin = std::min(dZmin, std::abs(constituent->dz(vtx.position()))); } - cpf_features.cpf_dZmin = dZmin; - cpf_features.cpf_vertex_association = constituent->pvAssociationQuality(); - cpf_features.cpf_fromPV = constituent->fromPV(); - cpf_features.cpf_puppi_weight = constituent->puppiWeight(); - cpf_features.cpf_track_chi2 = constituent->pseudoTrack().chi2(); - cpf_features.cpf_track_ndof = constituent->pseudoTrack().ndof(); - cpf_features.cpf_track_quality = constituent->pseudoTrack().qualityMask(); - cpf_features.cpf_track_numberOfValidPixelHits = constituent->pseudoTrack().hitPattern().numberOfValidPixelHits(); - cpf_features.cpf_track_pixelLayersWithMeasurement = constituent->pseudoTrack().hitPattern().pixelLayersWithMeasurement(); - cpf_features.cpf_track_numberOfValidStripHits = constituent->pseudoTrack().hitPattern().numberOfValidStripHits(); - cpf_features.cpf_track_stripLayersWithMeasurement = constituent->pseudoTrack().hitPattern().stripLayersWithMeasurement(); + cpf_features.dZmin = dZmin; + cpf_features.vertex_association = constituent->pvAssociationQuality(); + cpf_features.fromPV = constituent->fromPV(); + cpf_features.puppi_weight = constituent->puppiWeight(); + cpf_features.track_chi2 = constituent->pseudoTrack().chi2(); + cpf_features.track_ndof = constituent->pseudoTrack().ndof(); + cpf_features.track_quality = constituent->pseudoTrack().qualityMask(); + cpf_features.track_numberOfValidPixelHits = constituent->pseudoTrack().hitPattern().numberOfValidPixelHits(); + cpf_features.track_pixelLayersWithMeasurement = constituent->pseudoTrack().hitPattern().pixelLayersWithMeasurement(); + cpf_features.track_numberOfValidStripHits = constituent->pseudoTrack().hitPattern().numberOfValidStripHits(); + cpf_features.track_stripLayersWithMeasurement = constituent->pseudoTrack().hitPattern().stripLayersWithMeasurement(); if (jet.mass()<1e-10) { - cpf_features.cpf_relmassdrop = -1; + cpf_features.relmassdrop = -1; } else { - cpf_features.cpf_relmassdrop = (jet.p4()-constituent->p4()).mass()/jet.mass(); + cpf_features.relmassdrop = (jet.p4()-constituent->p4()).mass()/jet.mass(); } reco::TransientTrack transientTrack = builder->build(constituent->pseudoTrack()); @@ -453,338 +453,324 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) TVector3 trackMom3(trackMom.x(),trackMom.y(),trackMom.z()); TVector3 jetDir3(jetDir.x(),jetDir.y(),jetDir.z()); - cpf_features.cpf_trackEtaRel=reco::btau::etaRel(jetDir, trackMom); - cpf_features.cpf_trackPtRel=trackMom3.Perp(jetDir3); - cpf_features.cpf_trackPPar=jetDir.Dot(trackMom); - cpf_features.cpf_trackDeltaR=reco::deltaR(trackMom, jetDir); - cpf_features.cpf_trackPtRatio=cpf_features.cpf_trackPtRel / trackMag; - cpf_features.cpf_trackPParRatio=cpf_features.cpf_trackPPar / trackMag; - - cpf_features.cpf_trackSip2dVal=meas_ip2d.value(); - cpf_features.cpf_trackSip2dSig=meas_ip2d.significance(); - cpf_features.cpf_trackSip3dVal=meas_ip3d.value(); - cpf_features.cpf_trackSip3dSig=meas_ip3d.significance(); - if (std::isnan(cpf_features.cpf_trackSip2dSig) || std::isnan(cpf_features.cpf_trackSip3dSig)) - { - cpf_features.cpf_trackSip2dSig=0.; - cpf_features.cpf_trackSip3dSig=0.; - } + cpf_features.trackEtaRel=reco::btau::etaRel(jetDir, trackMom); + cpf_features.trackPtRel=trackMom3.Perp(jetDir3); + cpf_features.trackPPar=jetDir.Dot(trackMom); + cpf_features.trackDeltaR=reco::deltaR(trackMom, jetDir); + cpf_features.trackPtRatio=cpf_features.trackPtRel / trackMag; + cpf_features.trackPParRatio=cpf_features.trackPPar / trackMag; - cpf_features.cpf_trackJetDistVal = jetdist.value(); - cpf_features.cpf_trackJetDistSig = jetdist.significance(); + cpf_features.trackSip2dVal=meas_ip2d.value(); + cpf_features.trackSip2dSig=std::isnan(meas_ip2d.significance()) ? 0 : meas_ip2d.significance(); + cpf_features.trackSip3dVal=meas_ip3d.value(); + cpf_features.trackSip3dSig=std::isnan(meas_ip3d.significance()) ? 0 : meas_ip3d.significance(); - cpf_features.cpf_matchedMuon = 0; - cpf_features.cpf_matchedElectron = 0; + cpf_features.trackJetDistVal = jetdist.value(); + cpf_features.trackJetDistSig = jetdist.significance(); + + cpf_features.matchedMuon = 0; + cpf_features.matchedElectron = 0; if (candidatesMatchedToSV.find(jet.daughterPtr(idaughter))!=candidatesMatchedToSV.end()) { - cpf_features.cpf_matchedSV = 1; + cpf_features.matchedSV = 1; + for (const auto& vertexCompositePtrCandidate: candidatesMatchedToSV[jet.daughterPtr(idaughter)]) + { + reco::Vertex svVertex(vertexCompositePtrCandidate->position(), vertexCompositePtrCandidate->error4D(),vertexCompositePtrCandidate->t()); + Measurement1D meas_sv_ip2d=IPTools::signedTransverseImpactParameter(transientTrack, jetRefTrackDir, svVertex).second; + Measurement1D meas_sv_ip3d=IPTools::signedImpactParameter3D(transientTrack, jetRefTrackDir, svVertex).second; + + if (std::fabs(meas_sv_ip3d.value())position(), vertexCompositePtrCandidate->error4D(),vertexCompositePtrCandidate->t()); + Measurement1D meas_sv_ip2d=IPTools::signedTransverseImpactParameter(transientTrack, jetRefTrackDir, svVertex).second; + Measurement1D meas_sv_ip3d=IPTools::signedImpactParameter3D(transientTrack, jetRefTrackDir, svVertex).second; + + if (std::fabs(meas_sv_ip3d.value())second; if (not muon.isGlobalMuon() || reco::deltaR(muon, jet) > 0.4) continue; - cpf_features.cpf_matchedMuon = 1; - mu_features.mu_isGlobal = muon.isGlobalMuon(); - mu_features.mu_isTight = muon.isTightMuon(pv); - mu_features.mu_isMedium = muon.isMediumMuon(); - mu_features.mu_isLoose = muon.isLooseMuon(); - mu_features.mu_isStandAlone = muon.isStandAloneMuon(); - - mu_features.mu_ptrel = muon.pt()/uncorrectedPt; - mu_features.mu_deta = muon.eta()-jet.eta(); - mu_features.mu_dphi = reco::deltaPhi(muon.phi(),jet.phi()); - mu_features.mu_charge = muon.charge(); - mu_features.mu_energy = muon.energy()/muon.pt(); - mu_features.mu_et = muon.et(); - mu_features.mu_jetDeltaR = reco::deltaR(muon, jet); - mu_features.mu_numberOfMatchedStations = muon.numberOfMatchedStations(); - - mu_features.mu_2dIP = muon.dB(); - mu_features.mu_2dIPSig = muon.dB()/muon.edB(); - mu_features.mu_3dIP = muon.dB(pat::Muon::PV3D); - mu_features.mu_3dIPSig = muon.dB(pat::Muon::PV3D)/muon.edB(pat::Muon::PV3D); - - - - cpf_features.cpf_trackSip2dVal=meas_ip2d.value(); - cpf_features.cpf_trackSip2dSig=meas_ip2d.significance(); - cpf_features.cpf_trackSip3dVal=meas_ip3d.value(); - cpf_features.cpf_trackSip3dSig=meas_ip3d.significance(); - - if (std::isnan(mu_features.mu_2dIPSig) || std::isnan(mu_features.mu_3dIPSig)) + cpf_features.matchedMuon = 1; + mu_features.isGlobal = muon.isGlobalMuon(); + mu_features.isTight = muon.isTightMuon(pv); + mu_features.isMedium = muon.isMediumMuon(); + mu_features.isLoose = muon.isLooseMuon(); + mu_features.isStandAlone = muon.isStandAloneMuon(); + + mu_features.ptrel = muon.pt()/uncorrectedPt; + mu_features.deta = muon.eta()-jet.eta(); + mu_features.dphi = reco::deltaPhi(muon.phi(),jet.phi()); + mu_features.px = muon.px(); + mu_features.py = muon.py(); + mu_features.pz = muon.pz(); + mu_features.charge = muon.charge(); + mu_features.energy = muon.energy()/muon.pt(); + mu_features.et = muon.et(); + mu_features.deltaR = reco::deltaR(muon, jet); + mu_features.numberOfMatchedStations = muon.numberOfMatchedStations(); + + mu_features.IP2d = muon.dB(); + mu_features.IP2dSig = muon.dB()/muon.edB(); + mu_features.IP3d = muon.dB(pat::Muon::PV3D); + mu_features.IP3dSig = muon.dB(pat::Muon::PV3D)/muon.edB(pat::Muon::PV3D); + + if (std::isnan(mu_features.IP2dSig) || std::isnan(mu_features.IP3dSig)) { - mu_features.mu_2dIPSig = 0.; - mu_features.mu_3dIPSig = 0.; + mu_features.IP2dSig = 0.; + mu_features.IP3dSig = 0.; } reco::Candidate::Vector muonMom = muon.bestTrack()->momentum(); - mu_features.mu_EtaRel =reco::btau::etaRel(jetDir, muonMom); - mu_features.mu_dxy = muon.bestTrack()->dxy(pv.position()); - mu_features.mu_dxyError = muon.bestTrack()->dxyError(); - mu_features.mu_dxySig = muon.bestTrack()->dxy(pv.position())/muon.bestTrack()->dxyError(); - mu_features.mu_dz = muon.bestTrack()->dz(pv.position()); - mu_features.mu_dzError = muon.bestTrack()->dzError(); - mu_features.mu_numberOfValidPixelHits = muon.bestTrack()->hitPattern().numberOfValidPixelHits(); - mu_features.mu_numberOfpixelLayersWithMeasurement = muon.bestTrack()->hitPattern().pixelLayersWithMeasurement(); - mu_features.mu_numberOfstripLayersWithMeasurement = muon.bestTrack()->hitPattern().stripLayersWithMeasurement(); + mu_features.EtaRel =reco::btau::etaRel(jetDir, muonMom); + mu_features.dxy = muon.bestTrack()->dxy(pv.position()); + mu_features.dxyError = muon.bestTrack()->dxyError(); + mu_features.dxySig = muon.bestTrack()->dxy(pv.position())/(1e-10+std::fabs(muon.bestTrack()->dxyError())); + mu_features.dz = muon.bestTrack()->dz(pv.position()); + mu_features.dzError = muon.bestTrack()->dzError(); + mu_features.dzSig = muon.bestTrack()->dz(pv.position())/(1e-10+std::fabs(muon.bestTrack()->dzError())); + mu_features.numberOfValidPixelHits = muon.bestTrack()->hitPattern().numberOfValidPixelHits(); + mu_features.numberOfpixelLayersWithMeasurement = muon.bestTrack()->hitPattern().pixelLayersWithMeasurement(); + mu_features.numberOfstripLayersWithMeasurement = muon.bestTrack()->hitPattern().stripLayersWithMeasurement(); - mu_features.mu_chi2 = muon.bestTrack()->chi2(); - mu_features.mu_ndof = muon.bestTrack()->ndof(); + mu_features.chi2 = muon.bestTrack()->chi2(); + mu_features.ndof = muon.bestTrack()->ndof(); - mu_features.mu_caloIso = muon.caloIso()/muon.pt(); - mu_features.mu_ecalIso = muon.ecalIso()/muon.pt(); - mu_features.mu_hcalIso = muon.hcalIso()/muon.pt(); + mu_features.caloIso = muon.caloIso()/muon.pt(); + mu_features.ecalIso = muon.ecalIso()/muon.pt(); + mu_features.hcalIso = muon.hcalIso()/muon.pt(); - mu_features.mu_sumPfChHadronPt = muon.pfIsolationR04().sumChargedHadronPt/muon.pt(); - mu_features.mu_sumPfNeuHadronEt = muon.pfIsolationR04().sumNeutralHadronEt/muon.pt(); - mu_features.mu_Pfpileup = muon.pfIsolationR04().sumPUPt/muon.pt(); - mu_features.mu_sumPfPhotonEt = muon.pfIsolationR04().sumPhotonEt/muon.pt(); + mu_features.sumPfChHadronPt = muon.pfIsolationR04().sumChargedHadronPt/muon.pt(); + mu_features.sumPfNeuHadronEt = muon.pfIsolationR04().sumNeutralHadronEt/muon.pt(); + mu_features.Pfpileup = muon.pfIsolationR04().sumPUPt/muon.pt(); + mu_features.sumPfPhotonEt = muon.pfIsolationR04().sumPhotonEt/muon.pt(); - mu_features.mu_sumPfChHadronPt03 = muon.pfIsolationR03().sumChargedHadronPt/muon.pt(); - mu_features.mu_sumPfNeuHadronEt03 = muon.pfIsolationR03().sumNeutralHadronEt/muon.pt(); - mu_features.mu_Pfpileup03 = muon.pfIsolationR03().sumPUPt/muon.pt(); - mu_features.mu_sumPfPhotonEt03 = muon.pfIsolationR03().sumPhotonEt/muon.pt(); + mu_features.sumPfChHadronPt03 = muon.pfIsolationR03().sumChargedHadronPt/muon.pt(); + mu_features.sumPfNeuHadronEt03 = muon.pfIsolationR03().sumNeutralHadronEt/muon.pt(); + mu_features.Pfpileup03 = muon.pfIsolationR03().sumPUPt/muon.pt(); + mu_features.sumPfPhotonEt03 = muon.pfIsolationR03().sumPhotonEt/muon.pt(); - mu_features.mu_timeAtIpInOut = muon.time().timeAtIpInOut; - mu_features.mu_timeAtIpInOutErr = muon.time().timeAtIpInOutErr; - mu_features.mu_timeAtIpOutIn = muon.time().timeAtIpOutIn; + mu_features.timeAtIpInOut = muon.time().timeAtIpInOut; + mu_features.timeAtIpInOutErr = muon.time().timeAtIpInOutErr; + mu_features.timeAtIpOutIn = muon.time().timeAtIpOutIn; features.mu_features.emplace_back(mu_features); } - std::stable_sort(features.mu_features.begin(),features.mu_features.end(),[](const auto& d1, const auto& d2) - { - if (d1.mu_2dIPSig>0 and d2.mu_2dIPSig>0) - { - if (std::fabs(d1.mu_2dIPSig-d2.mu_2dIPSig)>std::numeric_limits::epsilon()) - { - return std::fabs(d1.mu_2dIPSig)>std::fabs(d2.mu_2dIPSig); //sort decreasing - } - } - return d1.mu_ptrel>d2.mu_ptrel; //sort decreasing - }); + std::stable_sort(features.mu_features.begin(),features.mu_features.end()); //find matching electrons - llpdnnx::ElectronCandidateFeatures elec_features; auto findElectron = electronMap.find(jet.daughterPtr(idaughter)); if(findElectron!=electronMap.end()) { + llpdnnx::ElectronCandidateFeatures elec_features; const pat::Electron & electron = *findElectron->second; - cpf_features.cpf_matchedElectron = 1; + cpf_features.matchedElectron = 1; if (reco::deltaR(electron, jet) > 0.4) continue; - elec_features.elec_ptrel = electron.pt()/uncorrectedPt; - elec_features.elec_deta = electron.eta()-jet.eta(); - elec_features.elec_dphi = reco::deltaPhi(electron.phi(),jet.phi()); - elec_features.elec_charge = electron.charge(); - elec_features.elec_energy = electron.energy()/electron.pt(); - elec_features.elec_jetDeltaR = reco::deltaR(electron,jet); - elec_features.elec_EtFromCaloEn = electron.caloEnergy() * sin(electron.p4().theta())/ electron.pt(); - elec_features.elec_ecalDrivenSeed = electron.ecalDrivenSeed(); - - elec_features.elec_isEB = electron.isEB(); - elec_features.elec_isEE = electron.isEE(); - elec_features.elec_ecalEnergy = electron.ecalEnergy()/electron.pt(); - elec_features.elec_isPassConversionVeto = electron.passConversionVeto(); - if(electron.convDist() >= 0.){ - elec_features.elec_convDist = electron.convDist(); - elec_features.elec_convFlags = electron.convFlags(); - elec_features.elec_convRadius = electron.convRadius(); + elec_features.ptrel = electron.pt()/uncorrectedPt; + elec_features.deta = electron.eta()-jet.eta(); + elec_features.dphi = reco::deltaPhi(electron.phi(),jet.phi()); + elec_features.charge = electron.charge(); + elec_features.px = electron.px(); + elec_features.py = electron.py(); + elec_features.pz = electron.pz(); + + elec_features.energy = electron.energy()/electron.pt(); + elec_features.deltaR = reco::deltaR(electron,jet); + elec_features.EtFromCaloEn = electron.caloEnergy() * sin(electron.p4().theta())/ electron.pt(); + elec_features.ecalDrivenSeed = electron.ecalDrivenSeed(); + + elec_features.isEB = electron.isEB(); + elec_features.isEE = electron.isEE(); + elec_features.ecalEnergy = electron.ecalEnergy()/electron.pt(); + elec_features.isPassConversionVeto = electron.passConversionVeto(); + if(electron.convDist() >= 0.) + { + elec_features.convDist = electron.convDist(); + elec_features.convFlags = electron.convFlags(); + elec_features.convRadius = electron.convRadius(); } - else{ - elec_features.elec_convDist = -1.; - elec_features.elec_convFlags = -1.; - elec_features.elec_convRadius = -1.; + else + { + elec_features.convDist = -1.; + elec_features.convFlags = -1.; + elec_features.convRadius = -1.; } - elec_features.elec_3dIP = electron.dB(pat::Electron::PV3D); - elec_features.elec_3dIPSig = electron.dB(pat::Electron::PV3D); - elec_features.elec_2dIP = electron.dB(); - elec_features.elec_2dIPSig = electron.dB()/electron.edB(); + elec_features.IP3d = electron.dB(pat::Electron::PV3D); + elec_features.IP3dSig = electron.dB(pat::Electron::PV3D)/electron.edB(pat::Electron::PV3D); + elec_features.IP2d = electron.dB(); + elec_features.IP2dSig = electron.dB()/electron.edB(); - if (std::isnan(elec_features.elec_2dIPSig) || std::isnan(elec_features.elec_3dIPSig)) + if (std::isnan(elec_features.IP2dSig) || std::isnan(elec_features.IP3dSig)) { - elec_features.elec_2dIPSig = 0.; - elec_features.elec_3dIPSig = 0.; + elec_features.IP2dSig = 0.; + elec_features.IP3dSig = 0.; } - elec_features.elec_sCseedEta = electron.superCluster()->seed()->eta(); + elec_features.sCseedEta = electron.superCluster()->seed()->eta(); - elec_features.elec_eSeedClusterOverP = electron.eSeedClusterOverP(); - elec_features.elec_eSeedClusterOverPout = electron.eSeedClusterOverPout(); - elec_features.elec_eSuperClusterOverP = electron.eSuperClusterOverP(); - elec_features.elec_hadronicOverEm = electron.hadronicOverEm(); + elec_features.eSeedClusterOverP = electron.eSeedClusterOverP(); + elec_features.eSeedClusterOverPout = electron.eSeedClusterOverPout(); + elec_features.eSuperClusterOverP = electron.eSuperClusterOverP(); + elec_features.hadronicOverEm = electron.hadronicOverEm(); - elec_features.elec_deltaEtaEleClusterTrackAtCalo = electron.deltaEtaEleClusterTrackAtCalo(); - elec_features.elec_deltaPhiEleClusterTrackAtCalo = electron.deltaPhiEleClusterTrackAtCalo(); + elec_features.deltaEtaEleClusterTrackAtCalo = electron.deltaEtaEleClusterTrackAtCalo(); + elec_features.deltaPhiEleClusterTrackAtCalo = electron.deltaPhiEleClusterTrackAtCalo(); - elec_features.elec_deltaEtaSeedClusterTrackAtCalo = electron.deltaEtaSeedClusterTrackAtCalo(); - elec_features.elec_deltaPhiSeedClusterTrackAtCalo = electron.deltaPhiSeedClusterTrackAtCalo(); + elec_features.deltaEtaSeedClusterTrackAtCalo = electron.deltaEtaSeedClusterTrackAtCalo(); + elec_features.deltaPhiSeedClusterTrackAtCalo = electron.deltaPhiSeedClusterTrackAtCalo(); - elec_features.elec_deltaEtaSeedClusterTrackAtVtx = electron.deltaEtaSeedClusterTrackAtVtx(); - elec_features.elec_deltaEtaSuperClusterTrackAtVtx = electron.deltaEtaSuperClusterTrackAtVtx(); - elec_features.elec_deltaPhiSuperClusterTrackAtVtx = electron.deltaPhiSuperClusterTrackAtVtx(); + elec_features.deltaEtaSeedClusterTrackAtVtx = electron.deltaEtaSeedClusterTrackAtVtx(); + elec_features.deltaEtaSuperClusterTrackAtVtx = electron.deltaEtaSuperClusterTrackAtVtx(); + elec_features.deltaPhiSuperClusterTrackAtVtx = electron.deltaPhiSuperClusterTrackAtVtx(); reco::Candidate::Vector electronMom = electron.gsfTrack()->momentum(); - elec_features.elec_EtaRel = reco::btau::etaRel(jetDir, electronMom); - elec_features.elec_dxy = electron.gsfTrack()->dxy(pv.position()); - elec_features.elec_dz = electron.gsfTrack()->dz(pv.position()); - elec_features.elec_nbOfMissingHits = electron.gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS); - elec_features.elec_gsfCharge = electron.gsfTrack()->charge(); - elec_features.elec_ndof = electron.gsfTrack()->ndof(); - elec_features.elec_chi2 = electron.gsfTrack()->chi2(); + elec_features.EtaRel = reco::btau::etaRel(jetDir, electronMom); + elec_features.dxy = electron.gsfTrack()->dxy(pv.position()); + elec_features.dxyError = electron.gsfTrack()->dxyError(); + elec_features.dxySig = electron.gsfTrack()->dxy(pv.position())/(1e-10+std::fabs(electron.gsfTrack()->dxyError())); + elec_features.dz = electron.gsfTrack()->dz(pv.position()); + elec_features.dzError = electron.gsfTrack()->dzError(); + elec_features.dzSig = electron.gsfTrack()->dz(pv.position())/(1e-10+std::fabs(electron.gsfTrack()->dzError())); + + elec_features.nbOfMissingHits = electron.gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS); + elec_features.gsfCharge = electron.gsfTrack()->charge(); + elec_features.ndof = electron.gsfTrack()->ndof(); + elec_features.chi2 = electron.gsfTrack()->chi2(); elec_features.elecSC_energy = electron.superCluster()->energy()/electron.pt(); elec_features.elecSC_deta = electron.superCluster()->eta()-electron.gsfTrack()->eta(); elec_features.elecSC_dphi = reco::deltaPhi(electron.superCluster()->phi(),electron.gsfTrack()->phi()); elec_features.elecSC_et = electron.superCluster()->energy() * sin(electron.p4().theta())/electron.pt(); - elec_features.elec_scPixCharge = electron.scPixCharge(); + elec_features.scPixCharge = electron.scPixCharge(); - elec_features.elec_numberOfBrems = electron.numberOfBrems(); + elec_features.numberOfBrems = electron.numberOfBrems(); if(electron.pt() >= 5.){ - elec_features.elec_fbrem = electron.fbrem(); - elec_features.elec_sigmaEtaEta = electron.sigmaEtaEta(); - elec_features.elec_sigmaIetaIeta = electron.sigmaIetaIeta(); - elec_features.elec_sigmaIphiIphi = electron.sigmaIphiIphi(); - elec_features.elec_r9 = electron.r9(); - elec_features.elec_superClusterFbrem = electron.superClusterFbrem(); + elec_features.fbrem = electron.fbrem(); + elec_features.sigmaEtaEta = electron.sigmaEtaEta(); + elec_features.sigmaIetaIeta = electron.sigmaIetaIeta(); + elec_features.sigmaIphiIphi = electron.sigmaIphiIphi(); + elec_features.r9 = electron.r9(); + elec_features.superClusterFbrem = electron.superClusterFbrem(); } else { - elec_features.elec_fbrem = -1.; - elec_features.elec_sigmaEtaEta = -1.; - elec_features.elec_sigmaIetaIeta = -1.; - elec_features.elec_sigmaIphiIphi = -1; - elec_features.elec_superClusterFbrem = -1.; + elec_features.fbrem = -1.; + elec_features.sigmaEtaEta = -1.; + elec_features.sigmaIetaIeta = -1.; + elec_features.sigmaIphiIphi = -1; + elec_features.superClusterFbrem = -1.; } - elec_features.elec_e5x5 = electron.e5x5(); + elec_features.e5x5 = electron.e5x5(); - elec_features.elec_e5x5Rel = electron.e5x5()/jet.pt(); - elec_features.elec_e1x5Overe5x5 = electron.e1x5()/electron.e5x5(); - elec_features.elec_e2x5MaxOvere5x5 = electron.e2x5Max()/electron.e5x5(); + elec_features.e5x5Rel = electron.e5x5()/jet.pt(); + elec_features.e1x5Overe5x5 = electron.e1x5()/electron.e5x5(); + elec_features.e2x5MaxOvere5x5 = electron.e2x5Max()/electron.e5x5(); if (electron.e5x5() == 0){ - elec_features.elec_e1x5Overe5x5 = -1.; - elec_features.elec_e2x5MaxOvere5x5 = -1.; + elec_features.e1x5Overe5x5 = -1.; + elec_features.e2x5MaxOvere5x5 = -1.; } - elec_features.elec_hcalOverEcal = electron.hcalOverEcal(); - elec_features.elec_hcalDepth1OverEcal = electron.hcalDepth1OverEcal(); - elec_features.elec_hcalDepth2OverEcal = electron.hcalDepth2OverEcal(); + elec_features.hcalOverEcal = electron.hcalOverEcal(); + elec_features.hcalDepth1OverEcal = electron.hcalDepth1OverEcal(); + elec_features.hcalDepth2OverEcal = electron.hcalDepth2OverEcal(); elec_features.elecSC_eSuperClusterOverP = electron.eSuperClusterOverP(); - elec_features.elec_neutralHadronIso = electron.neutralHadronIso()/electron.pt(); - elec_features.elec_photonIso = electron.photonIso()/electron.pt(); - elec_features.elec_puChargedHadronIso = electron.puChargedHadronIso()/electron.pt(); + elec_features.neutralHadronIso = electron.neutralHadronIso()/electron.pt(); + elec_features.particleIso = electron.particleIso()/electron.pt(); + elec_features.photonIso = electron.photonIso()/electron.pt(); + elec_features.puChargedHadronIso = electron.puChargedHadronIso()/electron.pt(); - elec_features.elec_trackIso = electron.trackIso()/electron.pt(); - elec_features.elec_hcalDepth1OverEcal = electron.hcalDepth1OverEcal(); - elec_features.elec_hcalDepth2OverEcal = electron.hcalDepth2OverEcal(); - elec_features.elec_ecalPFClusterIso = electron.ecalPFClusterIso()/electron.pt(); - elec_features.elec_hcalPFClusterIso = electron.hcalPFClusterIso()/electron.pt(); + elec_features.trackIso = electron.trackIso()/electron.pt(); + elec_features.hcalDepth1OverEcal = electron.hcalDepth1OverEcal(); + elec_features.hcalDepth2OverEcal = electron.hcalDepth2OverEcal(); + elec_features.ecalPFClusterIso = electron.ecalPFClusterIso()/electron.pt(); + elec_features.hcalPFClusterIso = electron.hcalPFClusterIso()/electron.pt(); - elec_features.elec_pfSumPhotonEt = electron.pfIsolationVariables().sumPhotonEt/electron.pt(); - elec_features.elec_pfSumChargedHadronPt = electron.pfIsolationVariables().sumChargedHadronPt/electron.pt(); - elec_features.elec_pfSumNeutralHadronEt = electron.pfIsolationVariables().sumNeutralHadronEt/electron.pt(); - elec_features.elec_pfSumPUPt = electron.pfIsolationVariables().sumPUPt/electron.pt(); + elec_features.pfSumPhotonEt = electron.pfIsolationVariables().sumPhotonEt/electron.pt(); + elec_features.pfSumChargedHadronPt = electron.pfIsolationVariables().sumChargedHadronPt/electron.pt(); + elec_features.pfSumNeutralHadronEt = electron.pfIsolationVariables().sumNeutralHadronEt/electron.pt(); + elec_features.pfSumPUPt = electron.pfIsolationVariables().sumPUPt/electron.pt(); // isolation - elec_features.elec_dr04TkSumPt = electron.dr04TkSumPt()/electron.pt(); - elec_features.elec_dr04EcalRecHitSumEt = electron.dr04EcalRecHitSumEt()/electron.pt(); - elec_features.elec_dr04HcalDepth1TowerSumEt = electron.dr04HcalDepth1TowerSumEt()/electron.pt(); - elec_features.elec_dr04HcalDepth1TowerSumEtBc = electron.dr04HcalDepth1TowerSumEtBc()/electron.pt(); - elec_features.elec_dr04HcalDepth2TowerSumEt = electron.dr04HcalDepth2TowerSumEt()/electron.pt(); - elec_features.elec_dr04HcalDepth2TowerSumEtBc = electron.dr04HcalDepth2TowerSumEtBc()/electron.pt(); + elec_features.dr04TkSumPt = electron.dr04TkSumPt()/electron.pt(); + elec_features.dr04EcalRecHitSumEt = electron.dr04EcalRecHitSumEt()/electron.pt(); + elec_features.dr04HcalDepth1TowerSumEt = electron.dr04HcalDepth1TowerSumEt()/electron.pt(); + elec_features.dr04HcalDepth1TowerSumEtBc = electron.dr04HcalDepth1TowerSumEtBc()/electron.pt(); + elec_features.dr04HcalDepth2TowerSumEt = electron.dr04HcalDepth2TowerSumEt()/electron.pt(); + elec_features.dr04HcalDepth2TowerSumEtBc = electron.dr04HcalDepth2TowerSumEtBc()/electron.pt(); - elec_features.elec_dr04HcalTowerSumEt = electron.dr04HcalTowerSumEt()/electron.pt(); - elec_features.elec_dr04HcalTowerSumEtBc = electron.dr04HcalTowerSumEtBc()/electron.pt(); + elec_features.dr04HcalTowerSumEt = electron.dr04HcalTowerSumEt()/electron.pt(); + elec_features.dr04HcalTowerSumEtBc = electron.dr04HcalTowerSumEtBc()/electron.pt(); features.elec_features.emplace_back(elec_features); } - std::stable_sort(features.elec_features.begin(),features.elec_features.end(),[](const auto& d1, const auto& d2) + std::stable_sort(features.elec_features.begin(),features.elec_features.end()); - { - if (d1.elec_2dIPSig>0 and d2.elec_2dIPSig>0) - { - if (std::fabs(d1.elec_2dIPSig-d2.elec_2dIPSig)>std::numeric_limits::epsilon()) - { - return std::fabs(d1.elec_2dIPSig)>std::fabs(d2.elec_2dIPSig); //sort decreasing - } - } - return d1.elec_ptrel>d2.elec_ptrel; //sort decreasing - }); - - features.cpf_features.emplace_back(cpf_features); } //end loop over charged consistuents - std::stable_sort(features.cpf_features.begin(),features.cpf_features.end(),[](const auto& d1, const auto& d2) - { - if (d1.cpf_trackSip2dSig>0 and d2.cpf_trackSip2dSig>0) - { - return std::fabs(d1.cpf_trackSip2dSig)>std::fabs(d2.cpf_trackSip2dSig); //sort decreasing - } - else if (d1.cpf_trackSip2dSig<0 and d2.cpf_trackSip2dSig>0) - { - return false; - } - else if (d1.cpf_trackSip2dSig>0 and d2.cpf_trackSip2dSig<0) - { - return true; - } - else if (std::fabs(d1.cpf_drminsv-d2.cpf_drminsv)>std::numeric_limits::epsilon()) - { - return d1.cpf_drminsvd2.cpf_ptrel; //sort decreasing - } - - return false; - }); + std::stable_sort(features.cpf_features.begin(),features.cpf_features.end()); // Fill neutral hadron info @@ -797,53 +783,46 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } llpdnnx::NeutralCandidateFeatures npf_features; - npf_features.npf_ptrel = constituent->pt()/uncorrectedPt; - npf_features.npf_deta = constituent->eta()-jet.eta(); - npf_features.npf_dphi = reco::deltaPhi(constituent->phi(),jet.phi()); - npf_features.npf_puppi_weight = constituent->puppiWeight(); - npf_features.npf_deltaR = reco::deltaR(*constituent,jet); - npf_features.npf_isGamma = abs(constituent->pdgId())==22; - npf_features.npf_hcal_fraction = constituent->hcalFraction(); + npf_features.ptrel = constituent->pt()/uncorrectedPt; + npf_features.deta = constituent->eta()-jet.eta(); + npf_features.dphi = reco::deltaPhi(constituent->phi(),jet.phi()); + + npf_features.px = constituent->px(); + npf_features.py = constituent->py(); + npf_features.pz = constituent->pz(); + + npf_features.puppi_weight = constituent->puppiWeight(); + npf_features.deltaR = reco::deltaR(*constituent,jet); + npf_features.isGamma = abs(constituent->pdgId())==22; + npf_features.hcal_fraction = constituent->hcalFraction(); - npf_features.npf_drminsv = 0.4; + npf_features.drminsv = 0.4; for (const auto& sv: *svs.product()) { float dR = reco::deltaR(sv,*constituent); - npf_features.npf_drminsv = std::min(npf_features.npf_drminsv,dR); + npf_features.drminsv = std::min(npf_features.drminsv,dR); } if (jet.mass()<1e-10) { - npf_features.npf_relmassdrop = -1; + npf_features.relmassdrop = -1; } else { - npf_features.npf_relmassdrop = (jet.p4()- constituent->p4()).mass()/jet.mass(); + npf_features.relmassdrop = (jet.p4()- constituent->p4()).mass()/jet.mass(); } features.npf_features.emplace_back(npf_features); } - std::stable_sort(features.npf_features.begin(),features.npf_features.end(),[](const auto& d1, const auto& d2) - { - - if (std::fabs(d1.npf_drminsv-d2.npf_drminsv)>std::numeric_limits::epsilon()) - { - return d1.npf_drminsvd2.npf_ptrel; //sort decreasing - } - return false; - }); + std::stable_sort(features.npf_features.begin(),features.npf_features.end()); float jetRchg(-1), jetRntr(-1); if (features.cpf_features.size() > 0){ - jetRchg = features.cpf_features.at(0).cpf_ptrel; + jetRchg = features.cpf_features.at(0).ptrel; } if (features.npf_features.size() > 0){ - jetRntr = features.npf_features.at(0).npf_ptrel; + jetRntr = features.npf_features.at(0).ptrel; } float jetR = std::max(jetRchg, jetRntr); @@ -851,54 +830,50 @@ XTagInfoProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) features.jet_features.jetRchg = jetRchg; features.jet_features.jetR = jetR; - int beta = 0; - int frac01 = 0; - int frac02 = 0; - int frac03 = 0; - int frac04 = 0; + float beta = 0; + features.jet_features.frac01 = 0; + features.jet_features.frac02 = 0; + features.jet_features.frac03 = 0; + features.jet_features.frac04 = 0; float dR2Mean = 0; float pt2Sum = 0; for (size_t i = 0; i < features.cpf_features.size(); i++){ llpdnnx::ChargedCandidateFeatures cpf = features.cpf_features.at(i); - beta += cpf.cpf_fromPV; - dR2Mean += (cpf.cpf_ptrel*cpf.cpf_trackDeltaR) * (cpf.cpf_ptrel*cpf.cpf_trackDeltaR); - pt2Sum += (cpf.cpf_ptrel) * (cpf.cpf_ptrel); - if (cpf.cpf_trackDeltaR < 0.1) frac01 ++; - else if (cpf.cpf_trackDeltaR < 0.2) frac02 ++; - else if (cpf.cpf_trackDeltaR < 0.3) frac03 ++; - else if (cpf.cpf_trackDeltaR < 0.4) frac04 ++; + beta += cpf.fromPV; + dR2Mean += (cpf.ptrel*cpf.trackDeltaR) * (cpf.ptrel*cpf.trackDeltaR); + pt2Sum += (cpf.ptrel) * (cpf.ptrel); + if (cpf.trackDeltaR < 0.1) features.jet_features.frac01+=cpf.ptrel; + else if (cpf.trackDeltaR < 0.2) features.jet_features.frac02+=cpf.ptrel; + else if (cpf.trackDeltaR < 0.3) features.jet_features.frac03+=cpf.ptrel; + else if (cpf.trackDeltaR < 0.4) features.jet_features.frac04+=cpf.ptrel; } if (features.cpf_features.size() > 0) { - features.jet_features.beta = (float)beta/(float)features.cpf_features.size(); - + features.jet_features.beta = 1.*beta/features.cpf_features.size(); } - - for (size_t i = 0; i < features.npf_features.size(); i++){ llpdnnx::NeutralCandidateFeatures npf = features.npf_features.at(i); - dR2Mean += (npf.npf_ptrel*npf.npf_deltaR) * (npf.npf_ptrel*npf.npf_deltaR); - pt2Sum += (npf.npf_ptrel) * (npf.npf_ptrel); - if (npf.npf_deltaR < 0.1) frac01 ++; - else if (npf.npf_deltaR < 0.2) frac02 ++; - else if (npf.npf_deltaR < 0.3) frac03 ++; - else if (npf.npf_deltaR < 0.4) frac04 ++; - } - - float nCandidates = (float)features.cpf_features.size()+(float)features.npf_features.size(); - - if (nCandidates > 0.){ - features.jet_features.frac01 = (float)frac01/nCandidates; - features.jet_features.frac02 = (float)frac02/nCandidates; - features.jet_features.frac03 = (float)frac03/nCandidates; - features.jet_features.frac04 = (float)frac04/nCandidates; - features.jet_features.dR2Mean = dR2Mean/pt2Sum; + dR2Mean += (npf.ptrel*npf.deltaR) * (npf.ptrel*npf.deltaR); + pt2Sum += (npf.ptrel) * (npf.ptrel); + if (npf.deltaR < 0.1) features.jet_features.frac01+=npf.ptrel; + else if (npf.deltaR < 0.2) features.jet_features.frac02+=npf.ptrel; + else if (npf.deltaR < 0.3) features.jet_features.frac03+=npf.ptrel; + else if (npf.deltaR < 0.4) features.jet_features.frac04+=npf.ptrel; } + features.jet_features.dR2Mean = dR2Mean/pt2Sum; + + features.jet_features.numberCpf = features.cpf_features.size(); + features.jet_features.numberNpf = features.npf_features.size(); + features.jet_features.numberSv = features.sv_features.size(); + features.jet_features.numberSvAdapted = features.sv_adapted_features.size(); + features.jet_features.numberMuon = features.mu_features.size(); + features.jet_features.numberElectron = features.elec_features.size(); + output_tag_infos->emplace_back(features, jet_ref); } diff --git a/XTagInfoProducer/src/JetSubstructure.cc b/XTagInfoProducer/src/JetSubstructure.cc index 82bec6e..5865734 100644 --- a/XTagInfoProducer/src/JetSubstructure.cc +++ b/XTagInfoProducer/src/JetSubstructure.cc @@ -10,7 +10,7 @@ JetSubstructure::JetSubstructure(const reco::Jet& jet) for(unsigned int iconstituent = 0; iconstituent < jet.numberOfDaughters(); ++iconstituent) { const reco::Candidate* constituent = jet.daughter(iconstituent); - if((constituent->energy() < 1e-10) or (constituent->mass()<1e-10)) + if((constituent->energy() < 1e-10) or (constituent->energy() > 1e5) or (constituent->mass()<0) or std::fabs(constituent->eta())>1e3) { continue; } @@ -30,7 +30,7 @@ JetSubstructure::JetSubstructure(const fastjet::PseudoJet& jet) TLorentzVector jetVectorFromConsituents(0,0,0,0); for(auto const& constituent: jet.constituents()) { - if((constituent.e()<1e-10) or (constituent.m()<1e-10)) + if((constituent.e()<1e-10) or (constituent.e() > 1e5) or (constituent.m()<0) or std::fabs(constituent.eta())>1e3) { continue; } @@ -119,11 +119,12 @@ std::vector JetSubstructure::reclusterExclusive( } double JetSubstructure::nSubjettiness( - int n, + size_t n, const fastjet::contrib::AxesDefinition& axisDef, const fastjet::contrib::MeasureDefinition& measureDef ) const { + if (consituents_.size()<(n+1)) return 0; fastjet::contrib::Njettiness njettiness(axisDef,measureDef); return njettiness.getTau(n, consituents_); } @@ -217,7 +218,7 @@ double JetSubstructure::thrust(bool boostToCM) const double JetSubstructure::relMassDropMass(ClusterType type, double r, double muCut, double yCut) const { if (massFromConstituents_<1e-10) return 0; - if (consituents_.size()<2) return 0; + if (consituents_.size()<3) return 0; fastjet::ClusterSequence clusterSequence(consituents_, makeJetDefinition(type,r)); std::vector reclusteredJets = fastjet::sorted_by_pt( @@ -237,7 +238,7 @@ double JetSubstructure::relMassDropMass(ClusterType type, double r, double muCut double JetSubstructure::relSoftDropMass(ClusterType type, double r, double zCut, double beta) const { if (massFromConstituents_<1e-10) return 0; - if (consituents_.size()<2) return 0; + if (consituents_.size()<3) return 0; fastjet::ClusterSequence clusterSequence(consituents_, makeJetDefinition(type,r)); std::vector reclusteredJets = fastjet::sorted_by_pt( diff --git a/XTagProducer/src/tensor_fillers.cc b/XTagProducer/src/tensor_fillers.cc index 31636ac..165a36c 100644 --- a/XTagProducer/src/tensor_fillers.cc +++ b/XTagProducer/src/tensor_fillers.cc @@ -26,15 +26,15 @@ namespace llpdnnx { *(++ptr) = features.sv_features.size(); // variables from ShallowTagInfo const auto& tag_info_features = features.tag_info_features; - *(++ptr) = tag_info_features.csv_trackSumJetEtRatio; - *(++ptr) = tag_info_features.csv_trackSumJetDeltaR; - *(++ptr) = tag_info_features.csv_vertexCategory; - *(++ptr) = tag_info_features.csv_trackSip2dValAboveCharm; - *(++ptr) = tag_info_features.csv_trackSip2dSigAboveCharm; - *(++ptr) = tag_info_features.csv_trackSip3dValAboveCharm; - *(++ptr) = tag_info_features.csv_trackSip3dSigAboveCharm; - *(++ptr) = tag_info_features.csv_jetNSelectedTracks; - *(++ptr) = tag_info_features.csv_jetNTracksEtaRel; + *(++ptr) = tag_info_features.trackSumJetEtRatio; + *(++ptr) = tag_info_features.trackSumJetDeltaR; + *(++ptr) = tag_info_features.vertexCategory; + *(++ptr) = tag_info_features.trackSip2dValAboveCharm; + *(++ptr) = tag_info_features.trackSip2dSigAboveCharm; + *(++ptr) = tag_info_features.trackSip3dValAboveCharm; + *(++ptr) = tag_info_features.trackSip3dSigAboveCharm; + *(++ptr) = tag_info_features.jetNSelectedTracks; + *(++ptr) = tag_info_features.jetNTracksEtaRel; } void cpf_tensor_filler(tensorflow::Tensor& tensor, @@ -43,24 +43,24 @@ namespace llpdnnx { const llpdnnx::ChargedCandidateFeatures& cpf_features) { float* ptr = &tensor.tensor()(jet_n, cpf_n, 0); - *ptr = cpf_features.cpf_trackEtaRel; - *(++ptr) = cpf_features.cpf_trackPtRel; - *(++ptr) = cpf_features.cpf_trackPPar; - *(++ptr) = cpf_features.cpf_trackDeltaR; - *(++ptr) = cpf_features.cpf_trackPParRatio; - *(++ptr) = cpf_features.cpf_trackSip2dVal; - *(++ptr) = cpf_features.cpf_trackSip2dSig; - *(++ptr) = cpf_features.cpf_trackSip3dVal; - *(++ptr) = cpf_features.cpf_trackSip3dSig; - *(++ptr) = cpf_features.cpf_trackJetDistVal; - *(++ptr) = cpf_features.cpf_ptrel; - *(++ptr) = cpf_features.cpf_drminsv; - *(++ptr) = cpf_features.cpf_vertex_association; - *(++ptr) = cpf_features.cpf_fromPV; - *(++ptr) = cpf_features.cpf_puppi_weight; - *(++ptr) = cpf_features.cpf_track_chi2; - *(++ptr) = cpf_features.cpf_track_ndof; - *(++ptr) = cpf_features.cpf_track_quality; + *ptr = cpf_features.trackEtaRel; + *(++ptr) = cpf_features.trackPtRel; + *(++ptr) = cpf_features.trackPPar; + *(++ptr) = cpf_features.trackDeltaR; + *(++ptr) = cpf_features.trackPParRatio; + *(++ptr) = cpf_features.trackSip2dVal; + *(++ptr) = cpf_features.trackSip2dSig; + *(++ptr) = cpf_features.trackSip3dVal; + *(++ptr) = cpf_features.trackSip3dSig; + *(++ptr) = cpf_features.trackJetDistVal; + *(++ptr) = cpf_features.ptrel; + *(++ptr) = cpf_features.drminsv; + *(++ptr) = cpf_features.vertex_association; + *(++ptr) = cpf_features.fromPV; + *(++ptr) = cpf_features.puppi_weight; + *(++ptr) = cpf_features.track_chi2; + *(++ptr) = cpf_features.track_ndof; + *(++ptr) = cpf_features.track_quality; } void npf_tensor_filler(tensorflow::Tensor& tensor, @@ -69,12 +69,12 @@ namespace llpdnnx { const llpdnnx::NeutralCandidateFeatures& npf_features) { float* ptr = &tensor.tensor()(jet_n, npf_n, 0); - *ptr = npf_features.npf_ptrel; - *(++ptr) = npf_features.npf_deltaR; - *(++ptr) = npf_features.npf_isGamma; - *(++ptr) = npf_features.npf_hcal_fraction; - *(++ptr) = npf_features.npf_drminsv; - *(++ptr) = npf_features.npf_puppi_weight; + *ptr = npf_features.ptrel; + *(++ptr) = npf_features.deltaR; + *(++ptr) = npf_features.isGamma; + *(++ptr) = npf_features.hcal_fraction; + *(++ptr) = npf_features.drminsv; + *(++ptr) = npf_features.puppi_weight; } void sv_tensor_filler(tensorflow::Tensor& tensor, @@ -83,17 +83,17 @@ namespace llpdnnx { const llpdnnx::SecondaryVertexFeatures& sv_features) { float* ptr = &tensor.tensor()(jet_n, sv_n, 0); - *ptr = sv_features.sv_ptrel; - *(++ptr) = sv_features.sv_deltaR; - *(++ptr) = sv_features.sv_mass; - *(++ptr) = sv_features.sv_ntracks; - *(++ptr) = sv_features.sv_chi2; - *(++ptr) = sv_features.sv_ndof; - *(++ptr) = sv_features.sv_dxy; - *(++ptr) = sv_features.sv_dxysig; - *(++ptr) = sv_features.sv_d3d; - *(++ptr) = sv_features.sv_d3dsig; - *(++ptr) = sv_features.sv_costhetasvpv; - *(++ptr) = sv_features.sv_enratio; + *ptr = sv_features.ptrel; + *(++ptr) = sv_features.deltaR; + *(++ptr) = sv_features.mass; + *(++ptr) = sv_features.ntracks; + *(++ptr) = sv_features.chi2; + *(++ptr) = sv_features.ndof; + *(++ptr) = sv_features.dxy; + *(++ptr) = sv_features.dxysig; + *(++ptr) = sv_features.d3d; + *(++ptr) = sv_features.d3dsig; + *(++ptr) = sv_features.costhetasvpv; + *(++ptr) = sv_features.enratio; } }