CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes
JetPlusTrackCorrector Class Reference

Jet energy correction algorithm using tracks. More...

#include <JetPlusTrackCorrector.h>

Public Types

typedef math::XYZTLorentzVector P4
 
typedef math::PtEtaPhiELorentzVectorD PtEtaPhiE
 
typedef math::PtEtaPhiMLorentzVectorD PtEtaPhiM
 

Public Member Functions

bool canCorrect (const reco::Jet &) const
 Can jet be JPT-corrected? More...
 
double correctAA (const reco::Jet &, const reco::TrackRefVector &, double &, const reco::TrackRefVector &, const reco::TrackRefVector &, double, const reco::TrackRefVector &) const
 For AA - correct in tracker. More...
 
double correction (const P4 &) const
 Correction method (not used) More...
 
double correction (const reco::Jet &) const
 Correction method (not used) More...
 
double correction (const reco::Jet &, const reco::Jet &, const edm::Event &, const edm::EventSetup &, const reco::TrackRefVector &tracksinvert, const reco::TrackRefVector &tracksincalo, P4 &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs)
 
double correction (const reco::Jet &, const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs, bool &validMatches)
 Scalar correction method. More...
 
double correction (const reco::Jet &, const reco::Jet &, const edm::Event &, const edm::EventSetup &, P4 &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs, bool &validMatches)
 Vectorial correction method (corrected 4-momentum passed by reference) More...
 
P4 elecCorrection (const P4 &jet, const jpt::MatchedTracks &elecs) const
 Calculates correction to be applied using electrons. More...
 
bool eventRequired () const
 Returns true. More...
 
double getResponseOfChargedWithEff ()
 Get responses/sumPT/SumEnergy with and without Efficiency correction. More...
 
double getResponseOfChargedWithoutEff ()
 
double getSumEnergyWithEff ()
 
double getSumEnergyWithoutEff ()
 
double getSumPtForBeta ()
 
double getSumPtWithEff ()
 
double getSumPtWithoutEff ()
 
 JetPlusTrackCorrector (const edm::ParameterSet &iPS, edm::ConsumesCollector &&iC)
 Constructor. More...
 
void matchTracks (const reco::Jet &, const edm::Event &, const edm::EventSetup &, const reco::TrackRefVector &tracksinvert, const reco::TrackRefVector &tracksincalo, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs)
 
bool matchTracks (const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs)
 Matches tracks to different particle types. More...
 
P4 muonCorrection (const P4 &jet, const jpt::MatchedTracks &muons)
 Calculates correction to be applied using muons. More...
 
P4 pionCorrection (const P4 &jet, const jpt::MatchedTracks &pions)
 Calculates corrections to be applied using pions. More...
 
bool vectorialCorrection () const
 Returns value of configurable. More...
 
virtual ~JetPlusTrackCorrector ()
 Destructor. More...
 

Protected Types

typedef reco::JetTracksAssociation::Container JetTracksAssociations
 
typedef edm::ValueMap< float > RecoElectronIds
 
typedef reco::GsfElectronCollection RecoElectrons
 
typedef reco::MuonCollection RecoMuons
 Get reponses. More...
 
typedef reco::TrackRefVector TrackRefs
 

Protected Member Functions

P4 calculateCorr (const P4 &jet, const TrackRefs &, jpt::Efficiency &, bool in_cone_at_vertex, bool in_cone_at_calo_face, double mass, bool is_pion, double mip)
 Generic method to calculates 4-momentum correction to be applied. More...
 
double checkScale (const P4 &jet, P4 &corrected) const
 Check corrected 4-momentum does not give negative scale. More...
 
const jpt::MapefficiencyMap () const
 
P4 elecCorrection (const P4 &jet, const TrackRefs &elecs, bool in_cone_at_vertex, bool in_cone_at_calo_face)
 Calculates individual electron corrections. More...
 
void excludeJta (const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, const TrackRefs &excluded) const
 Exclude jet-track association. More...
 
bool failTrackQuality (TrackRefs::const_iterator &) const
 Check on track quality. More...
 
bool findTrack (const jpt::JetTracks &, TrackRefs::const_iterator &, TrackRefs::iterator &) const
 Find track in JetTracks collection. More...
 
bool findTrack (const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &electrons, TrackRefs::const_iterator &) const
 Find track in MatchedTracks collections. More...
 
bool getElectrons (const edm::Event &, edm::Handle< pat::ElectronCollection > &) const
 
bool getElectrons (const edm::Event &, edm::Handle< RecoElectrons > &, edm::Handle< RecoElectronIds > &) const
 Get RECO electrons. More...
 
bool getMuons (const edm::Event &, edm::Handle< pat::MuonCollection > &) const
 
bool getMuons (const edm::Event &, edm::Handle< RecoMuons > &) const
 Get RECO muons. More...
 
P4 jetDirFromTracks (const P4 &jet, const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const
 Calculates vectorial correction using total track 3-momentum. More...
 
 JetPlusTrackCorrector ()
 Default constructor. More...
 
virtual bool jetTrackAssociation (const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::JetTracks &) const
 Associates tracks to jets (overriden in derived class) More...
 
bool jtaUsingEventData (const reco::Jet &, const edm::Event &, jpt::JetTracks &) const
 JTA using collections from event. More...
 
const jpt::MapleakageMap () const
 
bool matchElectrons (TrackRefs::const_iterator &, const edm::Handle< pat::ElectronCollection > &) const
 
bool matchElectrons (TrackRefs::const_iterator &, const edm::Handle< RecoElectrons > &, const edm::Handle< RecoElectronIds > &) const
 Matches tracks to RECO electrons. More...
 
bool matchMuons (TrackRefs::const_iterator &, const edm::Handle< pat::MuonCollection > &) const
 
bool matchMuons (TrackRefs::const_iterator &, const edm::Handle< RecoMuons > &) const
 Matches tracks to RECO muons. More...
 
virtual void matchTracks (const jpt::JetTracks &, const edm::Event &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs)
 Matches tracks to different particle types (overriden in derived class) More...
 
P4 muonCorrection (const P4 &jet, const TrackRefs &muons, bool in_cone_at_vertex, bool in_cone_at_calo_face)
 Calculates individual muons corrections. More...
 
P4 pionCorrection (const P4 &jet, const TrackRefs &pions, jpt::Efficiency &, bool in_cone_at_vertex, bool in_cone_at_calo_face)
 Calculates individual pion corrections. More...
 
P4 pionEfficiency (const P4 &jet, const jpt::Efficiency &, bool in_cone_at_calo_face)
 Correction to be applied using tracking efficiency. More...
 
void rebuildJta (const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, TrackRefs &excluded) const
 Rebuild jet-track association. More...
 
const jpt::MapresponseMap () const
 
bool tracksInCalo (const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const
 Determines if any tracks in cone at CaloFace. More...
 

Protected Attributes

double dzVertexCut_
 
const jpt::Map efficiency_
 
double elecMass_
 
double electronDRmatch_
 
edm::InputTag electronIds_
 
edm::InputTag electrons_
 
int jetSplitMerge_
 
edm::InputTag jetTracksAtCalo_
 
edm::InputTag jetTracksAtVertex_
 
const jpt::Map leakage_
 
double maxEta_
 
double muonEtamatch_
 
double muonMass_
 
double muonPhimatch_
 
double muonPtmatch_
 
edm::InputTag muons_
 
jpt::Efficiency not_used {response_, efficiency_, leakage_}
 
edm::InputTag patelectrons_
 
edm::InputTag patmuons_
 
double pionMass_
 
double ptErrorQuality_
 
const jpt::Map response_
 
edm::InputTag srcPVs_
 
float theResponseOfChargedWithEff
 
float theResponseOfChargedWithoutEff
 
float theSumEnergyWithEff
 
float theSumEnergyWithoutEff
 
float theSumPtForBeta
 
float theSumPtWithEff
 
float theSumPtWithoutEff
 
reco::TrackBase::TrackQuality trackQuality_
 
bool useEff_
 
bool useElecs_
 
bool useInConeTracks_
 
bool useMuons_
 
bool useOutOfConeTracks_
 
bool useOutOfVertexTracks_
 
bool usePAT_
 
bool usePions_
 
bool useTrackQuality_
 
bool vecResponse_
 
bool vectorial_
 
bool verbose_
 
reco::Particle::Point vertex_
 

Private Attributes

edm::EDGetTokenT< reco::JetTracksAssociation::Containerinput_jetTracksAtCalo_token_
 
edm::EDGetTokenT< reco::JetTracksAssociation::Containerinput_jetTracksAtVertex_token_
 
edm::EDGetTokenT< pat::ElectronCollectioninput_pat_elecs_token_
 
edm::EDGetTokenT< pat::MuonCollectioninput_pat_muons_token_
 
edm::EDGetTokenT< reco::VertexCollectioninput_pvCollection_token_
 
edm::EDGetTokenT< RecoElectronIdsinput_reco_elec_ids_token_
 
edm::EDGetTokenT< RecoElectronsinput_reco_elecs_token_
 
edm::EDGetTokenT< RecoMuonsinput_reco_muons_token_
 

Detailed Description

Jet energy correction algorithm using tracks.

Definition at line 171 of file JetPlusTrackCorrector.h.

Member Typedef Documentation

◆ JetTracksAssociations

Definition at line 296 of file JetPlusTrackCorrector.h.

◆ P4

Definition at line 182 of file JetPlusTrackCorrector.h.

◆ PtEtaPhiE

Definition at line 183 of file JetPlusTrackCorrector.h.

◆ PtEtaPhiM

Definition at line 184 of file JetPlusTrackCorrector.h.

◆ RecoElectronIds

Definition at line 295 of file JetPlusTrackCorrector.h.

◆ RecoElectrons

Definition at line 294 of file JetPlusTrackCorrector.h.

◆ RecoMuons

Get reponses.

Definition at line 293 of file JetPlusTrackCorrector.h.

◆ TrackRefs

Definition at line 297 of file JetPlusTrackCorrector.h.

Constructor & Destructor Documentation

◆ JetPlusTrackCorrector() [1/2]

JetPlusTrackCorrector::JetPlusTrackCorrector ( const edm::ParameterSet iPS,
edm::ConsumesCollector &&  iC 
)

Constructor.

Definition at line 24 of file JetPlusTrackCorrector.cc.

25  : verbose_(pset.getParameter<bool>("Verbose")),
26  usePAT_(pset.getParameter<bool>("UsePAT")),
27  vectorial_(pset.getParameter<bool>("VectorialCorrection")),
28  vecResponse_(pset.getParameter<bool>("UseResponseInVecCorr")),
29  useInConeTracks_(pset.getParameter<bool>("UseInConeTracks")),
30  useOutOfConeTracks_(pset.getParameter<bool>("UseOutOfConeTracks")),
31  useOutOfVertexTracks_(pset.getParameter<bool>("UseOutOfVertexTracks")),
32  usePions_(pset.getParameter<bool>("UsePions")),
33  useEff_(pset.getParameter<bool>("UseEfficiency")),
34  useMuons_(pset.getParameter<bool>("UseMuons")),
35  useElecs_(pset.getParameter<bool>("UseElectrons")),
36  useTrackQuality_(pset.getParameter<bool>("UseTrackQuality")),
37  jetTracksAtVertex_(pset.getParameter<edm::InputTag>("JetTracksAssociationAtVertex")),
38  jetTracksAtCalo_(pset.getParameter<edm::InputTag>("JetTracksAssociationAtCaloFace")),
39  jetSplitMerge_(pset.getParameter<int>("JetSplitMerge")),
40  srcPVs_(pset.getParameter<edm::InputTag>("srcPVs")),
41  ptErrorQuality_(pset.getParameter<double>("PtErrorQuality")),
42  dzVertexCut_(pset.getParameter<double>("DzVertexCut")),
43  muons_(pset.getParameter<edm::InputTag>("Muons")),
44  electrons_(pset.getParameter<edm::InputTag>("Electrons")),
45  electronIds_(pset.getParameter<edm::InputTag>("ElectronIds")),
46  patmuons_(pset.getParameter<edm::InputTag>("PatMuons")),
47  patelectrons_(pset.getParameter<edm::InputTag>("PatElectrons")),
48  trackQuality_(reco::TrackBase::qualityByName(pset.getParameter<std::string>("TrackQuality"))),
49  response_(Map(pset.getParameter<std::string>("ResponseMap"), verbose_)),
50  efficiency_(Map(pset.getParameter<std::string>("EfficiencyMap"), verbose_)),
51  leakage_(Map(pset.getParameter<std::string>("LeakageMap"), verbose_)),
52  muonPtmatch_(pset.getParameter<double>("muonPtmatch")),
53  muonEtamatch_(pset.getParameter<double>("muonEtamatch")),
54  muonPhimatch_(pset.getParameter<double>("muonPhimatch")),
55  electronDRmatch_(pset.getParameter<double>("electronDRmatch")),
56  pionMass_(0.140),
57  muonMass_(0.105),
58  elecMass_(0.000511),
59  maxEta_(pset.getParameter<double>("MaxJetEta")) {
60  if (verbose_) {
61  std::stringstream ss;
62  ss << "[JetPlusTrackCorrector::" << __func__ << "] Configuration for JPT corrector: " << std::endl
63  << " Particles" << std::endl
64  << " UsePions : " << (usePions_ ? "true" : "false") << std::endl
65  << " UseMuons : " << (useMuons_ ? "true" : "false") << std::endl
66  << " UseElecs : " << (useElecs_ ? "true" : "false") << std::endl
67  << " Corrections" << std::endl
68  << " UseInConeTracks : " << (useInConeTracks_ ? "true" : "false") << std::endl
69  << " UseOutOfConeTracks : " << (useOutOfConeTracks_ ? "true" : "false") << std::endl
70  << " UseOutOfVertexTracks : " << (useOutOfVertexTracks_ ? "true" : "false") << std::endl
71  << " ResponseMap : " << pset.getParameter<std::string>("ResponseMap") << std::endl
72  << " Efficiency" << std::endl
73  << " UsePionEfficiency : " << (useEff_ ? "true" : "false") << std::endl
74  << " EfficiencyMap : " << pset.getParameter<std::string>("EfficiencyMap") << std::endl
75  << " LeakageMap : " << pset.getParameter<std::string>("LeakageMap") << std::endl
76  << " Tracks" << std::endl
77  << " JetTracksAtVertex : " << jetTracksAtVertex_ << std::endl
78  << " JetTracksAtCalo : " << jetTracksAtCalo_ << std::endl
79  << " JetSplitMerge : " << jetSplitMerge_ << std::endl
80  << " UseTrackQuality : " << (useTrackQuality_ ? "true" : "false") << std::endl
81  << " Collections" << std::endl
82  << " Muons : " << muons_ << std::endl
83  << " Electrons : " << electrons_ << std::endl
84  << " Vectorial" << std::endl
85  << " UseTracksAndResponse : " << ((vectorial_ && vecResponse_) ? "true" : "false") << std::endl
86  << " UseTracksOnly : " << ((vectorial_ && !vecResponse_) ? "true" : "false");
87  edm::LogInfo("JetPlusTrackCorrector") << ss.str();
88  }
89 
91  std::stringstream ss;
92  ss << "[JetPlusTrackCorrector::" << __func__ << "]"
93  << " You are using JPT algorithm in a non-standard way!" << std::endl
94  << " UseInConeTracks : " << (useInConeTracks_ ? "true" : "false") << std::endl
95  << " UseOutOfConeTracks : " << (useOutOfConeTracks_ ? "true" : "false") << std::endl
96  << " UseOutOfVertexTracks : " << (useOutOfVertexTracks_ ? "true" : "false");
97  edm::LogWarning("JetPlusTrackCorrector") << ss.str();
98  }
99 
103 
107  if (usePAT_) {
110  }
111 }

References electronIds_, electrons_, input_jetTracksAtCalo_token_, input_jetTracksAtVertex_token_, input_pat_elecs_token_, input_pat_muons_token_, input_pvCollection_token_, input_reco_elec_ids_token_, input_reco_elecs_token_, input_reco_muons_token_, jetSplitMerge_, jetTracksAtCalo_, jetTracksAtVertex_, muons_, patelectrons_, patmuons_, muonDTDigis_cfi::pset, srcPVs_, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, useEff_, useElecs_, useInConeTracks_, useMuons_, useOutOfConeTracks_, useOutOfVertexTracks_, usePAT_, usePions_, useTrackQuality_, vecResponse_, vectorial_, and verbose_.

◆ ~JetPlusTrackCorrector()

JetPlusTrackCorrector::~JetPlusTrackCorrector ( )
virtual

Destructor.

Definition at line 115 of file JetPlusTrackCorrector.cc.

115 { ; }

◆ JetPlusTrackCorrector() [2/2]

JetPlusTrackCorrector::JetPlusTrackCorrector ( )
inlineprotected

Default constructor.

Definition at line 392 of file JetPlusTrackCorrector.h.

392 { ; }

Member Function Documentation

◆ calculateCorr()

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::calculateCorr ( const P4 jet,
const TrackRefs tracks,
jpt::Efficiency eff,
bool  in_cone_at_vertex,
bool  in_cone_at_calo_face,
double  mass,
bool  is_pion,
double  mip 
)
protected

Generic method to calculates 4-momentum correction to be applied.

Definition at line 879 of file JetPlusTrackCorrector.cc.

886  {
887  // Correction to be applied to jet 4-momentum
888  P4 correction;
889 
890  // Reset efficiency container
891  eff.reset();
892 
893  double theSumResp = 0;
894  double theSumPt = 0;
895  double theSumEnergy = 0;
896 
897  // Iterate through tracks
898  if (!tracks.empty()) {
899  TrackRefs::iterator itrk = tracks.begin();
900  TrackRefs::iterator jtrk = tracks.end();
901 
902  for (; itrk != jtrk; ++itrk) {
903  // Ignore high-pt tracks (only when in-cone and not a mip)
904  if (in_cone_at_calo_face && is_pion && (*itrk)->pt() >= 50.) {
905  continue;
906  }
907 
908  // Inner track 4-momentum
909  P4 inner;
910  if (vectorial_ && vecResponse_) {
911  inner = PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), mass);
912  } else {
913  double energy = sqrt((*itrk)->px() * (*itrk)->px() + (*itrk)->py() * (*itrk)->py() +
914  (*itrk)->pz() * (*itrk)->pz() + mass * mass);
915  inner = (jet.energy() > 0. ? energy / jet.energy() : 1.) * jet;
916  }
917 
918  // Add track momentum (if in-cone at vertex)
919  if (in_cone_at_vertex) {
920  correction += inner;
921  }
922 
923  // Find appropriate eta/pt bin for given track
924  double eta = fabs((*itrk)->eta());
925  double pt = fabs((*itrk)->pt());
926  uint32_t ieta = response_.etaBin(eta);
927  uint32_t ipt = response_.ptBin(pt);
928 
929  // Check bins (not for mips)
930  if (is_pion && (ieta == response_.nEtaBins() || ipt == response_.nPtBins())) {
931  continue;
932  }
933 
934  // Outer track 4-momentum
935  P4 outer;
936  if (in_cone_at_calo_face) {
937  if (vectorial_ && vecResponse_) {
938  // Build 4-momentum from outer track (SHOULD USE IMPACT POINT?!)
939  double outer_pt = (*itrk)->pt();
940  double outer_eta = (*itrk)->eta();
941  double outer_phi = (*itrk)->phi();
942  if ((*itrk)->extra().isNonnull()) {
943  outer_pt = (*itrk)->pt();
944  outer_eta = (*itrk)->outerPosition().eta(); //@@ outerMomentum().eta()
945  outer_phi = (*itrk)->outerPosition().phi(); //@@ outerMomentum().phi()
946  }
947  outer = PtEtaPhiM(outer_pt, outer_eta, outer_phi, mass);
948  // Check if mip or not
949  if (!is_pion) {
950  outer *= (outer.energy() > 0. ? mip / outer.energy() : 1.);
951  } //@@ Scale to mip energy
952  else {
953  outer *= (outer.energy() > 0. ? inner.energy() / outer.energy() : 1.);
954  } //@@ Scale to inner track energy
955  } else {
956  // Check if mip or not
957  if (!is_pion) {
958  outer = (jet.energy() > 0. ? mip / jet.energy() : 1.) * jet;
959  } //@@ Jet 4-mom scaled by mip energy
960  else {
961  outer = inner;
962  } //@@ Set to inner track 4-momentum
963  }
964  if (is_pion) {
965  outer *= response_.value(ieta, ipt);
966  } //@@ Scale by pion response
967  correction -= outer; //@@ Subtract
968 
969  // Calculate the sum of responses
970  theSumResp += response_.value(ieta, ipt);
971  }
972 
973  // Calculate the sum of pt and energies
974  theSumPt += inner.pt();
975  theSumEnergy += inner.energy();
976 
977  // Record inner track energy for pion efficiency correction
978  if (is_pion) {
979  eff.addE(ieta, ipt, inner.energy());
980  }
981 
982  // Debug
983  if (verbose_ && edm::isDebugEnabled()) {
984  std::stringstream temp;
985  temp << " Response[" << ieta << "," << ipt << "]";
986  std::stringstream ss;
987  ss << "[JetPlusTrackCorrector::" << __func__ << "]" << std::endl
988  << " Track eta / pt : " << eta << " / " << pt << std::endl
989  << temp.str() << std::setw(21 - temp.str().size()) << " : " << response_.value(ieta, ipt) << std::endl
990  << " Track momentum added : " << inner.energy() << std::endl
991  << " Response subtracted : " << outer.energy() << std::endl
992  << " Energy correction : " << correction.energy();
993  LogDebug("JetPlusTrackCorrector") << ss.str();
994  }
995 
996  } // loop through tracks
997  } // ntracks != 0
998 
999  if (in_cone_at_vertex) {
1000  theResponseOfChargedWithEff += theSumResp;
1001  theResponseOfChargedWithoutEff += theSumResp;
1002  theSumPtWithEff += theSumPt;
1003  theSumPtWithoutEff += theSumPt;
1004  theSumEnergyWithEff += theSumEnergy;
1005  theSumEnergyWithoutEff += theSumEnergy;
1006  }
1007  return correction;
1008 }

References jpt::Efficiency::addE(), correction(), HCALHighEnergyHPDFilter_cfi::energy, PVValHelper::eta, jpt::Map::etaBin(), LEDCalibrationChannels::ieta, SurfaceOrientation::inner, edm::isDebugEnabled(), metsig::jet, LogDebug, EgHLTOffHistBins_cfi::mass, jpt::Map::nEtaBins(), jpt::Map::nPtBins(), SurfaceOrientation::outer, DiDispStaMuonMonitor_cfi::pt, jpt::Map::ptBin(), jpt::Efficiency::reset(), response_, mathSSE::sqrt(), contentValuesCheck::ss, groupFilesInBlocks::temp, theResponseOfChargedWithEff, theResponseOfChargedWithoutEff, theSumEnergyWithEff, theSumEnergyWithoutEff, theSumPtWithEff, theSumPtWithoutEff, tracks, jpt::Map::value(), vecResponse_, vectorial_, and verbose_.

Referenced by elecCorrection(), muonCorrection(), and pionCorrection().

◆ canCorrect()

bool JetPlusTrackCorrector::canCorrect ( const reco::Jet jet) const
inline

Can jet be JPT-corrected?

Definition at line 486 of file JetPlusTrackCorrector.h.

486 { return (fabs(jet.eta()) <= maxEta_); }

References metsig::jet, and maxEta_.

Referenced by correction().

◆ checkScale()

double JetPlusTrackCorrector::checkScale ( const P4 jet,
P4 corrected 
) const
inlineprotected

Check corrected 4-momentum does not give negative scale.

Definition at line 507 of file JetPlusTrackCorrector.h.

507  {
508  if (jet.energy() > 0. && (corrected.energy() / jet.energy()) < 0.) {
509  corrected = jet;
510  }
511  return corrected.energy() / jet.energy();
512 }

References metsig::jet.

Referenced by correction().

◆ correctAA()

double JetPlusTrackCorrector::correctAA ( const reco::Jet fJet,
const reco::TrackRefVector trBgOutOfVertex,
double &  mConeSize,
const reco::TrackRefVector pioninin,
const reco::TrackRefVector pioninout,
double  ja,
const reco::TrackRefVector trBgOutOfCalo 
) const

For AA - correct in tracker.

Definition at line 1263 of file JetPlusTrackCorrector.cc.

1269  {
1270  double mScale = 1.;
1271  double NewResponse = fJet.energy();
1272 
1273  if (trBgOutOfVertex.empty())
1274  return mScale;
1275  double EnergyOfBackgroundCharged = 0.;
1276  double ResponseOfBackgroundCharged = 0.;
1277 
1278  //
1279  // calculate the mean response
1280  //
1281 
1282  //================= EnergyOfBackgroundCharged ==================>
1283  for (reco::TrackRefVector::iterator iBgtV = trBgOutOfVertex.begin(); iBgtV != trBgOutOfVertex.end(); iBgtV++) {
1284  double eta = fabs((**iBgtV).eta());
1285  double pt = fabs((**iBgtV).pt());
1286  uint32_t ieta = response_.etaBin(eta);
1287  uint32_t ipt = response_.ptBin(pt);
1288 
1289  if (fabs(fJet.eta() - (**iBgtV).eta()) > mConeSize)
1290  continue;
1291 
1292  double echarBg = sqrt((**iBgtV).px() * (**iBgtV).px() + (**iBgtV).py() * (**iBgtV).py() +
1293  (**iBgtV).pz() * (**iBgtV).pz() + 0.14 * 0.14);
1294 
1295  EnergyOfBackgroundCharged += echarBg / efficiency_.value(ieta, ipt);
1296 
1297  } // Energy BG tracks
1298 
1299  //============= ResponseOfBackgroundCharged =======================>
1300 
1301  for (reco::TrackRefVector::iterator iBgtC = trBgOutOfCalo.begin(); iBgtC != trBgOutOfCalo.end(); iBgtC++) {
1302  double eta = fabs((**iBgtC).eta());
1303  double pt = fabs((**iBgtC).pt());
1304  uint32_t ieta = response_.etaBin(eta);
1305  uint32_t ipt = response_.ptBin(pt);
1306 
1307  if (fabs(fJet.eta() - (**iBgtC).eta()) > mConeSize)
1308  continue;
1309 
1310  // Check bins (not for mips)
1311  if (ieta >= response_.nEtaBins()) {
1312  continue;
1313  }
1314  if (ipt >= response_.nPtBins()) {
1315  ipt = response_.nPtBins() - 1;
1316  }
1317 
1318  double echarBg = sqrt((**iBgtC).px() * (**iBgtC).px() + (**iBgtC).py() * (**iBgtC).py() +
1319  (**iBgtC).pz() * (**iBgtC).pz() + 0.14 * 0.14);
1320 
1321  ResponseOfBackgroundCharged += echarBg * response_.value(ieta, ipt) / efficiency_.value(ieta, ipt);
1322 
1323  } // Response of BG tracks
1324 
1325  //=================================================================>
1326 
1327  //=================================================================>
1328  // Look for in-out tracks
1329 
1330  double en = 0.;
1331  double px = 0.;
1332  double py = 0.;
1333  double pz = 0.;
1334 
1335  for (reco::TrackRefVector::const_iterator it = pioninout.begin(); it != pioninout.end(); it++) {
1336  px += (*it)->px();
1337  py += (*it)->py();
1338  pz += (*it)->pz();
1339  en += sqrt((*it)->p() * (*it)->p() + 0.14 * 0.14);
1340  }
1341 
1342  // Look for in-in tracks
1343 
1344  double en_in = 0.;
1345  double px_in = 0.;
1346  double py_in = 0.;
1347  double pz_in = 0.;
1348 
1349  for (reco::TrackRefVector::const_iterator it = pioninin.begin(); it != pioninin.end(); it++) {
1350  px_in += (*it)->px();
1351  py_in += (*it)->py();
1352  pz_in += (*it)->pz();
1353  en_in += sqrt((*it)->p() * (*it)->p() + 0.14 * 0.14);
1354  }
1355 
1356  //===================================================================>
1357 
1358  //=>
1359  double SquareEtaRingWithoutJets = ja;
1360 
1361  EnergyOfBackgroundCharged = EnergyOfBackgroundCharged / SquareEtaRingWithoutJets;
1362  ResponseOfBackgroundCharged = ResponseOfBackgroundCharged / SquareEtaRingWithoutJets;
1363 
1364  EnergyOfBackgroundCharged = M_PI * mConeSize * mConeSize * EnergyOfBackgroundCharged;
1365  ResponseOfBackgroundCharged = M_PI * mConeSize * mConeSize * ResponseOfBackgroundCharged;
1366 
1367  NewResponse = NewResponse - EnergyOfBackgroundCharged + ResponseOfBackgroundCharged;
1368 
1369  mScale = NewResponse / fJet.energy();
1370  if (mScale < 0.)
1371  mScale = 0.;
1372  return mScale;
1373 }

References edm::RefVector< C, T, F >::begin(), efficiency_, edm::RefVector< C, T, F >::empty(), edm::RefVector< C, T, F >::end(), reco::LeafCandidate::energy(), PVValHelper::eta, reco::LeafCandidate::eta(), jpt::Map::etaBin(), LEDCalibrationChannels::ieta, M_PI, jpt::Map::nEtaBins(), jpt::Map::nPtBins(), DiDispStaMuonMonitor_cfi::pt, jpt::Map::ptBin(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, response_, mathSSE::sqrt(), and jpt::Map::value().

◆ correction() [1/5]

double JetPlusTrackCorrector::correction ( const P4 jet) const

Correction method (not used)

Definition at line 245 of file JetPlusTrackCorrector.cc.

245  {
246  edm::LogError("JetPlusTrackCorrector") << "JetPlusTrackCorrector can be run on entire event only";
247  return 1.;
248 }

◆ correction() [2/5]

double JetPlusTrackCorrector::correction ( const reco::Jet jet) const

Correction method (not used)

Definition at line 238 of file JetPlusTrackCorrector.cc.

238  {
239  edm::LogError("JetPlusTrackCorrector") << "JetPlusTrackCorrector can be run on entire event only";
240  return 1.;
241 }

◆ correction() [3/5]

double JetPlusTrackCorrector::correction ( const reco::Jet fJet,
const reco::Jet fJetcalo,
const edm::Event event,
const edm::EventSetup setup,
const reco::TrackRefVector tracksinvert,
const reco::TrackRefVector tracksincalo,
P4 corrected,
jpt::MatchedTracks pions,
jpt::MatchedTracks muons,
jpt::MatchedTracks elecs 
)

Definition at line 119 of file JetPlusTrackCorrector.cc.

128  {
129  double scale = 1.;
130  corrected = fJet.p4();
131  matchTracks(fJetcalo, event, setup, tracksinvert, tracksincalo, pions, muons, elecs);
132  if (!usePAT_) {
133  if (usePions_) {
134  corrected += pionCorrection(fJet.p4(), pions);
135  }
136  if (useMuons_) {
137  corrected += muonCorrection(fJet.p4(), muons);
138  }
139  if (useElecs_) {
140  corrected += elecCorrection(fJet.p4(), elecs);
141  }
142  } else {
143  corrected += fJetcalo.p4();
144  }
145  scale = checkScale(fJet.p4(), corrected);
146  return scale;
147 }

References checkScale(), elecCorrection(), singleTopDQM_cfi::elecs, matchTracks(), muonCorrection(), PDWG_BPHSkim_cff::muons, reco::LeafCandidate::p4(), pionCorrection(), L1EGammaCrystalsEmulatorProducer_cfi::scale, singleTopDQM_cfi::setup, useElecs_, useMuons_, usePAT_, and usePions_.

◆ correction() [4/5]

double JetPlusTrackCorrector::correction ( const reco::Jet fJet,
const reco::Jet fJetcalo,
const edm::Event event,
const edm::EventSetup setup,
jpt::MatchedTracks pions,
jpt::MatchedTracks muons,
jpt::MatchedTracks elecs,
bool &  validMatches 
)
inline

Scalar correction method.

Definition at line 472 of file JetPlusTrackCorrector.h.

479  {
480  P4 not_used_for_scalar_correction;
481  return correction(fJet, fJetcalo, event, setup, not_used_for_scalar_correction, pions, muons, elecs, validMatches);
482 }

References correction(), singleTopDQM_cfi::elecs, PDWG_BPHSkim_cff::muons, and singleTopDQM_cfi::setup.

◆ correction() [5/5]

double JetPlusTrackCorrector::correction ( const reco::Jet fJet,
const reco::Jet fJetcalo,
const edm::Event event,
const edm::EventSetup setup,
P4 corrected,
jpt::MatchedTracks pions,
jpt::MatchedTracks muons,
jpt::MatchedTracks elecs,
bool &  validMatches 
)

Vectorial correction method (corrected 4-momentum passed by reference)

Definition at line 151 of file JetPlusTrackCorrector.cc.

159  {
162  theSumPtWithEff = 0.;
163  theSumPtWithoutEff = 0.;
164  theSumEnergyWithEff = 0.;
166  theSumPtForBeta = 0.;
167 
168  // Corrected 4-momentum for jet
169  corrected = fJet.p4();
170 
171  // Match tracks to different particle types
172  validMatches = matchTracks(fJetcalo, event, setup, pions, muons, elecs);
173  if (!validMatches) {
174  return 1.;
175  }
176 
177  // Check if jet can be JPT-corrected
178  if (!canCorrect(fJet)) {
179  return 1.;
180  }
181 
182  // Debug
183  if (verbose_) {
184  edm::LogInfo("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
185  << " Applying JPT corrections...";
186  }
187 
188  // Pion corrections (both scalar and vectorial)
189  if (usePions_) {
190  corrected += pionCorrection(fJet.p4(), pions);
191  }
192 
193  // Muon corrections (both scalar and vectorial)
194  if (useMuons_) {
195  corrected += muonCorrection(fJet.p4(), muons);
196  }
197 
198  // Electrons corrections (both scalar and vectorial)
199  if (useElecs_) {
200  corrected += elecCorrection(fJet.p4(), elecs);
201  }
202 
203  // Define jet direction using total 3-momentum of tracks (overrides above)
204  if (vectorial_ && !vecResponse_) {
205  if (fabs(corrected.eta()) < 2.) {
206  corrected = jetDirFromTracks(corrected, pions, muons, elecs);
207  }
208  }
209 
210  // Check if corrected 4-momentum gives negative scale
211  double scale = checkScale(fJet.p4(), corrected);
212 
213  // Debug
214  if (verbose_) {
215  std::stringstream ss;
216  ss << "Total correction:" << std::endl
217  << std::fixed << std::setprecision(6) << " Uncorrected (Px,Py,Pz,E) : "
218  << "(" << fJet.px() << "," << fJet.py() << "," << fJet.pz() << "," << fJet.energy() << ")" << std::endl
219  << " Corrected (Px,Py,Pz,E) : "
220  << "(" << corrected.px() << "," << corrected.py() << "," << corrected.pz() << "," << corrected.energy() << ")"
221  << std::endl
222  << " Uncorrected (Pt,Eta,Phi,M) : "
223  << "(" << fJet.pt() << "," << fJet.eta() << "," << fJet.phi() << "," << fJet.mass() << ")" << std::endl
224  << " Corrected (Pt,Eta,Phi,M) : "
225  << "(" << corrected.pt() << "," << corrected.eta() << "," << corrected.phi() << "," << corrected.mass() << ")"
226  << std::endl
227  << " Scalar correction to E : " << scale << std::endl
228  << " Scalar correction to Et : " << (fJet.et() > 0. ? corrected.Et() / fJet.et() : 1.); // << std::endl
229  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
230  }
231 
232  // Return energy correction
233  return scale;
234 }

References canCorrect(), checkScale(), elecCorrection(), singleTopDQM_cfi::elecs, reco::LeafCandidate::energy(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), alignBH_cfg::fixed, jetDirFromTracks(), reco::LeafCandidate::mass(), matchTracks(), muonCorrection(), PDWG_BPHSkim_cff::muons, reco::LeafCandidate::p4(), reco::LeafCandidate::phi(), pionCorrection(), reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), L1EGammaCrystalsEmulatorProducer_cfi::scale, singleTopDQM_cfi::setup, contentValuesCheck::ss, theResponseOfChargedWithEff, theResponseOfChargedWithoutEff, theSumEnergyWithEff, theSumEnergyWithoutEff, theSumPtForBeta, theSumPtWithEff, theSumPtWithoutEff, useElecs_, useMuons_, usePions_, vecResponse_, vectorial_, and verbose_.

Referenced by calculateCorr(), correction(), and pionEfficiency().

◆ efficiencyMap()

const jpt::Map & JetPlusTrackCorrector::efficiencyMap ( ) const
inlineprotected

Definition at line 515 of file JetPlusTrackCorrector.h.

515 { return efficiency_; }

References efficiency_.

Referenced by pionCorrection().

◆ elecCorrection() [1/2]

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::elecCorrection ( const P4 jet,
const jpt::MatchedTracks elecs 
) const

Calculates correction to be applied using electrons.

Definition at line 776 of file JetPlusTrackCorrector.cc.

776  {
777  P4 null; //@@ null 4-momentum
778 
779  if (verbose_) {
780  std::stringstream ss;
781  ss << " Electron corrections:" << std::endl
782  << " In/In : "
783  << "(" << elecs.inVertexInCalo_.size() << ") " << null.energy() << std::endl
784  << " In/Out : "
785  << "(" << elecs.inVertexOutOfCalo_.size() << ") " << null.energy() << std::endl
786  << " Out/In : "
787  << "(" << elecs.outOfVertexInCalo_.size() << ") " << null.energy();
788  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
789  }
790 
791  return null; //@@ to be implemented
792 }

References singleTopDQM_cfi::elecs, contentValuesCheck::ss, and verbose_.

Referenced by correction().

◆ elecCorrection() [2/2]

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::elecCorrection ( const P4 jet,
const TrackRefs elecs,
bool  in_cone_at_vertex,
bool  in_cone_at_calo_face 
)
inlineprotected

Calculates individual electron corrections.

Definition at line 500 of file JetPlusTrackCorrector.h.

503  {
504  return calculateCorr(jet, elecs, not_used, in_cone_at_vertex, in_cone_at_calo_face, elecMass_, false, 0.);
505 }

References calculateCorr(), elecMass_, singleTopDQM_cfi::elecs, metsig::jet, and not_used.

◆ eventRequired()

bool JetPlusTrackCorrector::eventRequired ( ) const
inline

Returns true.

Definition at line 484 of file JetPlusTrackCorrector.h.

484 { return true; }

◆ excludeJta()

void JetPlusTrackCorrector::excludeJta ( const reco::Jet fJet,
const JetTracksAssociations jtV0,
TrackRefs included,
const TrackRefs excluded 
) const
protected

Exclude jet-track association.

Definition at line 1238 of file JetPlusTrackCorrector.cc.

1241  {
1242  tracksthis = reco::JetTracksAssociation::getValue(jtV0, fJet);
1243  if (Excl.empty())
1244  return;
1245  if (jetSplitMerge_ < 0)
1246  return;
1247 
1248  TrackRefs tracks = tracksthis;
1249  tracksthis.clear();
1250 
1251  for (TrackRefs::iterator it = tracks.begin(); it != tracks.end(); it++) {
1252  TrackRefs::iterator itold = find(Excl.begin(), Excl.end(), (*it));
1253  if (itold == Excl.end()) {
1254  tracksthis.push_back(*it);
1255  }
1256  }
1257 
1258  return;
1259 }

References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::clear(), edm::RefVector< C, T, F >::empty(), edm::RefVector< C, T, F >::end(), spr::find(), reco::JetTracksAssociation::getValue(), jetSplitMerge_, edm::RefVector< C, T, F >::push_back(), and tracks.

Referenced by jtaUsingEventData().

◆ failTrackQuality()

bool JetPlusTrackCorrector::failTrackQuality ( TrackRefs::const_iterator itrk) const
protected

Check on track quality.

Definition at line 608 of file JetPlusTrackCorrector.cc.

608  {
609  bool retcode = false;
610 
611  if (useTrackQuality_ && !(*itrk)->quality(trackQuality_)) {
612  retcode = true;
613  return retcode;
614  }
615  if (((*itrk)->ptError() / (*itrk)->pt()) > ptErrorQuality_) {
616  retcode = true;
617  return retcode;
618  }
619  if (fabs((*itrk)->dz(vertex_)) > dzVertexCut_) {
620  retcode = true;
621  return retcode;
622  }
623 
624  return retcode;
625 }

References dzVertexCut_, ptErrorQuality_, trackQuality_, useTrackQuality_, and vertex_.

Referenced by matchTracks().

◆ findTrack() [1/2]

bool JetPlusTrackCorrector::findTrack ( const jpt::JetTracks jet_tracks,
TrackRefs::const_iterator itrk,
TrackRefs::iterator it 
) const
protected

Find track in JetTracks collection.

Definition at line 629 of file JetPlusTrackCorrector.cc.

631  {
632  it = find(jet_tracks.caloFace_.begin(), jet_tracks.caloFace_.end(), *itrk);
633  if (it != jet_tracks.caloFace_.end()) {
634  return true;
635  } else {
636  return false;
637  }
638 }

References edm::RefVector< C, T, F >::begin(), jpt::JetTracks::caloFace_, edm::RefVector< C, T, F >::end(), and spr::find().

Referenced by matchTracks().

◆ findTrack() [2/2]

bool JetPlusTrackCorrector::findTrack ( const jpt::MatchedTracks pions,
const jpt::MatchedTracks muons,
const jpt::MatchedTracks electrons,
TrackRefs::const_iterator itrk 
) const
protected

Find track in MatchedTracks collections.

Definition at line 642 of file JetPlusTrackCorrector.cc.

645  {
646  TrackRefs::iterator ip = find(pions.inVertexInCalo_.begin(), pions.inVertexInCalo_.end(), *itrk);
647  TrackRefs::iterator im = find(muons.inVertexInCalo_.begin(), muons.inVertexInCalo_.end(), *itrk);
648  TrackRefs::iterator ie = find(elecs.inVertexInCalo_.begin(), elecs.inVertexInCalo_.end(), *itrk);
649  if (ip == pions.inVertexInCalo_.end() && im == muons.inVertexInCalo_.end() && ie == elecs.inVertexInCalo_.end()) {
650  return false;
651  } else {
652  return true;
653  }
654 }

References edm::RefVector< C, T, F >::begin(), singleTopDQM_cfi::elecs, edm::RefVector< C, T, F >::end(), spr::find(), jpt::MatchedTracks::inVertexInCalo_, and PDWG_BPHSkim_cff::muons.

◆ getElectrons() [1/2]

bool JetPlusTrackCorrector::getElectrons ( const edm::Event event,
edm::Handle< pat::ElectronCollection > &  pat_elecs 
) const
protected

Definition at line 600 of file JetPlusTrackCorrector.cc.

601  {
602  event.getByToken(input_pat_elecs_token_, pat_elecs);
603  return true;
604 }

References input_pat_elecs_token_.

◆ getElectrons() [2/2]

bool JetPlusTrackCorrector::getElectrons ( const edm::Event event,
edm::Handle< RecoElectrons > &  reco_elecs,
edm::Handle< RecoElectronIds > &  reco_elec_ids 
) const
protected

Get RECO electrons.

Definition at line 592 of file JetPlusTrackCorrector.cc.

594  {
595  event.getByToken(input_reco_elecs_token_, reco_elecs);
596  event.getByToken(input_reco_elec_ids_token_, reco_elec_ids);
597  return true;
598 }

References input_reco_elec_ids_token_, and input_reco_elecs_token_.

Referenced by matchTracks().

◆ getMuons() [1/2]

bool JetPlusTrackCorrector::getMuons ( const edm::Event ,
edm::Handle< pat::MuonCollection > &   
) const
protected

◆ getMuons() [2/2]

bool JetPlusTrackCorrector::getMuons ( const edm::Event event,
edm::Handle< RecoMuons > &  reco_muons 
) const
protected

Get RECO muons.

Definition at line 385 of file JetPlusTrackCorrector.cc.

385  {
386  event.getByToken(input_reco_muons_token_, reco_muons);
387  return true;
388 }

References input_reco_muons_token_.

Referenced by matchTracks().

◆ getResponseOfChargedWithEff()

double JetPlusTrackCorrector::getResponseOfChargedWithEff ( )
inline

Get responses/sumPT/SumEnergy with and without Efficiency correction.

Definition at line 244 of file JetPlusTrackCorrector.h.

244 { return theResponseOfChargedWithEff; }

References theResponseOfChargedWithEff.

◆ getResponseOfChargedWithoutEff()

double JetPlusTrackCorrector::getResponseOfChargedWithoutEff ( )
inline

Definition at line 245 of file JetPlusTrackCorrector.h.

References theResponseOfChargedWithoutEff.

◆ getSumEnergyWithEff()

double JetPlusTrackCorrector::getSumEnergyWithEff ( )
inline

Definition at line 248 of file JetPlusTrackCorrector.h.

248 { return theSumEnergyWithEff; }

References theSumEnergyWithEff.

◆ getSumEnergyWithoutEff()

double JetPlusTrackCorrector::getSumEnergyWithoutEff ( )
inline

Definition at line 249 of file JetPlusTrackCorrector.h.

249 { return theSumEnergyWithoutEff; }

References theSumEnergyWithoutEff.

◆ getSumPtForBeta()

double JetPlusTrackCorrector::getSumPtForBeta ( )
inline

Definition at line 250 of file JetPlusTrackCorrector.h.

250 { return theSumPtForBeta; }

References theSumPtForBeta.

◆ getSumPtWithEff()

double JetPlusTrackCorrector::getSumPtWithEff ( )
inline

Definition at line 246 of file JetPlusTrackCorrector.h.

246 { return theSumPtWithEff; }

References theSumPtWithEff.

◆ getSumPtWithoutEff()

double JetPlusTrackCorrector::getSumPtWithoutEff ( )
inline

Definition at line 247 of file JetPlusTrackCorrector.h.

247 { return theSumPtWithoutEff; }

References theSumPtWithoutEff.

◆ jetDirFromTracks()

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::jetDirFromTracks ( const P4 jet,
const jpt::MatchedTracks pions,
const jpt::MatchedTracks muons,
const jpt::MatchedTracks elecs 
) const
protected

Calculates vectorial correction using total track 3-momentum.

Definition at line 796 of file JetPlusTrackCorrector.cc.

799  {
800  // Correction to be applied to jet 4-momentum
801  P4 corr;
802 
803  // bool tracks_present = false;
804  bool tracks_present_inin = false;
805 
806  // Correct using pions in-cone at vertex
807 
808  if (!pions.inVertexInCalo_.empty()) {
810  TrackRefs::iterator jtrk = pions.inVertexInCalo_.end();
811  for (; itrk != jtrk; ++itrk) {
812  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
813  tracks_present_inin = true;
814  }
815  }
816 
817  if (!pions.inVertexOutOfCalo_.empty()) {
820  for (; itrk != jtrk; ++itrk) {
821  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
822  }
823  }
824 
825  // Correct using muons in-cone at vertex
826 
827  if (!muons.inVertexInCalo_.empty()) {
828  TrackRefs::iterator itrk = muons.inVertexInCalo_.begin();
829  TrackRefs::iterator jtrk = muons.inVertexInCalo_.end();
830  for (; itrk != jtrk; ++itrk) {
831  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
832  // tracks_present = true;
833  }
834  }
835 
836  if (!muons.inVertexOutOfCalo_.empty()) {
837  TrackRefs::iterator itrk = muons.inVertexOutOfCalo_.begin();
838  TrackRefs::iterator jtrk = muons.inVertexOutOfCalo_.end();
839  for (; itrk != jtrk; ++itrk) {
840  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
841  // tracks_present = true;
842  }
843  }
844 
845  // Correct using electrons in-cone at vertex
846 
847  if (!elecs.inVertexInCalo_.empty()) {
848  TrackRefs::iterator itrk = elecs.inVertexInCalo_.begin();
849  TrackRefs::iterator jtrk = elecs.inVertexInCalo_.end();
850  for (; itrk != jtrk; ++itrk) {
851  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
852  // tracks_present = true;
853  }
854  }
855 
856  if (!elecs.inVertexOutOfCalo_.empty()) {
857  TrackRefs::iterator itrk = elecs.inVertexOutOfCalo_.begin();
858  TrackRefs::iterator jtrk = elecs.inVertexOutOfCalo_.end();
859  for (; itrk != jtrk; ++itrk) {
860  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
861  // tracks_present = true;
862  }
863  }
864 
865  // Adjust direction if in cone tracks are present
866 
867  if (!tracks_present_inin) {
868  corr = corrected;
869  } else {
870  corr *= (corr.P() > 0. ? corrected.P() / corr.P() : 1.);
871  corr = P4(corr.px(), corr.py(), corr.pz(), corrected.energy());
872  }
873 
874  return corr;
875 }

References edm::RefVector< C, T, F >::begin(), alignCSCRings::corr, singleTopDQM_cfi::elecs, edm::RefVector< C, T, F >::empty(), edm::RefVector< C, T, F >::end(), jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, and PDWG_BPHSkim_cff::muons.

Referenced by correction().

◆ jetTrackAssociation()

bool JetPlusTrackCorrector::jetTrackAssociation ( const reco::Jet fJet,
const edm::Event event,
const edm::EventSetup setup,
jpt::JetTracks trks 
) const
protectedvirtual

Associates tracks to jets (overriden in derived class)

Definition at line 299 of file JetPlusTrackCorrector.cc.

302  {
303  // Some init
304  trks.clear();
305 
306  // Check if labels are given
307  if (!jetTracksAtVertex_.label().empty() && !jetTracksAtCalo_.label().empty()) {
308  return jtaUsingEventData(fJet, event, trks);
309  } else {
310  edm::LogWarning("PatJPTCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
311  << " Empty label for the reco::JetTracksAssociation::Containers" << std::endl
312  << " InputTag for JTA \"at vertex\" (label:instance:process) \""
313  << jetTracksAtVertex_.label() << ":" << jetTracksAtVertex_.instance() << ":"
314  << jetTracksAtVertex_.process() << "\"" << std::endl
315  << " InputTag for JTA \"at calo face\" (label:instance:process) \""
316  << jetTracksAtCalo_.label() << ":" << jetTracksAtCalo_.instance() << ":"
317  << jetTracksAtCalo_.process() << "\"";
318  return false;
319  }
320 }

References edm::InputTag::instance(), jetTracksAtCalo_, jetTracksAtVertex_, jtaUsingEventData(), edm::InputTag::label(), edm::InputTag::process(), and hltEgammaHLTExtra_cfi::trks.

Referenced by matchTracks().

◆ jtaUsingEventData()

bool JetPlusTrackCorrector::jtaUsingEventData ( const reco::Jet fJet,
const edm::Event event,
jpt::JetTracks trks 
) const
protected

JTA using collections from event.

Definition at line 324 of file JetPlusTrackCorrector.cc.

324  {
325  // Get Jet-track association at Vertex
327  event.getByToken(input_jetTracksAtVertex_token_, jetTracksAtVertex);
328 
329  if (!jetTracksAtVertex.isValid() || jetTracksAtVertex.failedToGet()) {
330  if (verbose_ && edm::isDebugEnabled()) {
331  edm::LogWarning("JetPlusTrackCorrector")
332  << "[JetPlusTrackCorrector::" << __func__ << "]"
333  << " Invalid handle to reco::JetTracksAssociation::Container (for Vertex)"
334  << " with InputTag (label:instance:process) \"" << jetTracksAtVertex_.label() << ":"
335  << jetTracksAtVertex_.instance() << ":" << jetTracksAtVertex_.process() << "\"";
336  }
337  return false;
338  }
339 
340  // Retrieve jet-tracks association for given jet
341  const reco::JetTracksAssociation::Container jtV = *(jetTracksAtVertex.product());
342  TrackRefs excluded;
343  TrackRefs relocate;
344  if (jetSplitMerge_ < 0) {
345  trks.vertex_ = reco::JetTracksAssociation::getValue(jtV, fJet);
346  } else {
347  rebuildJta(fJet, jtV, trks.vertex_, excluded);
348  rebuildJta(fJet, jtV, relocate, excluded);
349  trks.vertex_ = relocate;
350  }
351 
352  // Check if any tracks are associated to jet at vertex
353  if (trks.vertex_.empty()) {
354  return false;
355  }
356 
357  // Get Jet-track association at Calo
359  event.getByToken(input_jetTracksAtCalo_token_, jetTracksAtCalo);
360 
361  if (!jetTracksAtCalo.isValid() || jetTracksAtCalo.failedToGet()) {
362  if (verbose_ && edm::isDebugEnabled()) {
363  edm::LogWarning("JetPlusTrackCorrector")
364  << "[JetPlusTrackCorrector::" << __func__ << "]"
365  << " Invalid handle to reco::JetTracksAssociation::Container (for CaloFace)"
366  << " with InputTag (label:instance:process) \"" << jetTracksAtCalo_.label() << ":"
367  << jetTracksAtCalo_.instance() << ":" << jetTracksAtCalo_.process() << "\"";
368  }
369  return false;
370  }
371 
372  // Retrieve jet-tracks association for given jet
373  const reco::JetTracksAssociation::Container jtC = *(jetTracksAtCalo.product());
374  if (jetSplitMerge_ < 0) {
375  trks.caloFace_ = reco::JetTracksAssociation::getValue(jtC, fJet);
376  } else {
377  excludeJta(fJet, jtC, trks.caloFace_, excluded);
378  }
379 
380  return true;
381 }

References excludeJta(), edm::HandleBase::failedToGet(), reco::JetTracksAssociation::getValue(), input_jetTracksAtCalo_token_, input_jetTracksAtVertex_token_, edm::InputTag::instance(), edm::isDebugEnabled(), edm::HandleBase::isValid(), jetSplitMerge_, jetTracksAtCalo_, jetTracksAtVertex_, edm::InputTag::label(), edm::InputTag::process(), edm::Handle< T >::product(), rebuildJta(), hltEgammaHLTExtra_cfi::trks, and verbose_.

Referenced by jetTrackAssociation().

◆ leakageMap()

const jpt::Map & JetPlusTrackCorrector::leakageMap ( ) const
inlineprotected

Definition at line 516 of file JetPlusTrackCorrector.h.

516 { return leakage_; }

References leakage_.

Referenced by pionCorrection().

◆ matchElectrons() [1/2]

bool JetPlusTrackCorrector::matchElectrons ( TrackRefs::const_iterator itrk,
const edm::Handle< pat::ElectronCollection > &  elecs 
) const
protected

Definition at line 1153 of file JetPlusTrackCorrector.cc.

1154  {
1155  if (elecs->empty()) {
1156  return false;
1157  }
1158 
1159  double deltaRMIN = 999.;
1160  for (auto const& ielec : *elecs) {
1161  auto dR2 = deltaR2(ielec, **itrk);
1162  if (dR2 < deltaRMIN) {
1163  deltaRMIN = dR2;
1164  }
1165  }
1166  return deltaRMIN < electronDRmatch_ * electronDRmatch_;
1167 }

References HLTMuonOfflineAnalyzer_cfi::deltaR2, singleTopDQM_cfi::elecs, and electronDRmatch_.

◆ matchElectrons() [2/2]

bool JetPlusTrackCorrector::matchElectrons ( TrackRefs::const_iterator itrk,
const edm::Handle< RecoElectrons > &  elecs,
const edm::Handle< RecoElectronIds > &  elec_ids 
) const
protected

Matches tracks to RECO electrons.

Definition at line 1126 of file JetPlusTrackCorrector.cc.

1128  {
1129  if (elecs->empty()) {
1130  return false;
1131  }
1132 
1133  double deltaRMIN = 999.;
1134 
1135  uint32_t electron_index = 0;
1136  for (auto const& ielec : *elecs) {
1137  edm::Ref<RecoElectrons> electron_ref(elecs, electron_index);
1138  electron_index++;
1139 
1140  if ((*elec_ids)[electron_ref] < 1.e-6) {
1141  continue;
1142  } //@@ Check for null value
1143 
1144  // DR matching b/w electron and track
1145  auto dR2 = deltaR2(ielec, **itrk);
1146  if (dR2 < deltaRMIN) {
1147  deltaRMIN = dR2;
1148  }
1149  }
1150  return deltaRMIN < electronDRmatch_ * electronDRmatch_;
1151 }

References HLTMuonOfflineAnalyzer_cfi::deltaR2, MillePedeFileConverter_cfg::e, singleTopDQM_cfi::elecs, and electronDRmatch_.

Referenced by matchTracks().

◆ matchMuons() [1/2]

bool JetPlusTrackCorrector::matchMuons ( TrackRefs::const_iterator ,
const edm::Handle< pat::MuonCollection > &   
) const
protected

◆ matchMuons() [2/2]

bool JetPlusTrackCorrector::matchMuons ( TrackRefs::const_iterator itrk,
const edm::Handle< RecoMuons > &  muons 
) const
protected

Matches tracks to RECO muons.

Definition at line 1076 of file JetPlusTrackCorrector.cc.

1076  {
1077  if (muons->empty()) {
1078  return false;
1079  }
1080 
1081  RecoMuons::const_iterator imuon = muons->begin();
1082  RecoMuons::const_iterator jmuon = muons->end();
1083  for (; imuon != jmuon; ++imuon) {
1084  if (imuon->innerTrack().isNull() || !muon::isGoodMuon(*imuon, muon::TMLastStationTight) ||
1085  imuon->innerTrack()->pt() < 3.0) {
1086  continue;
1087  }
1088 
1089  if (itrk->id() != imuon->innerTrack().id()) {
1090  edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
1091  << "Product id of the tracks associated to the jet " << itrk->id()
1092  << " is different from the product id of the inner track used for muons "
1093  << imuon->innerTrack().id() << "!" << std::endl
1094  << "Cannot compare tracks from different collection. Configuration Error!";
1095  return false;
1096  }
1097 
1098  if (*itrk == imuon->innerTrack())
1099  return true;
1100  }
1101 
1102  return false;
1103 }

References edm::Ref< C, T, F >::id(), muon::isGoodMuon(), PDWG_BPHSkim_cff::muons, and muon::TMLastStationTight.

Referenced by matchTracks().

◆ matchTracks() [1/3]

void JetPlusTrackCorrector::matchTracks ( const jpt::JetTracks jet_tracks,
const edm::Event event,
jpt::MatchedTracks pions,
jpt::MatchedTracks muons,
jpt::MatchedTracks elecs 
)
protectedvirtual

Matches tracks to different particle types (overriden in derived class)

Definition at line 397 of file JetPlusTrackCorrector.cc.

401  {
402  // Some init
403  pions.clear();
404  muons.clear();
405  elecs.clear();
406 
407  // Need vertex for track cleaning
408 
409  vertex_ = reco::Particle::Point(0, 0, 0);
411  event.getByToken(input_pvCollection_token_, pvCollection);
412  if (pvCollection.isValid() && !pvCollection->empty())
413  vertex_ = pvCollection->begin()->position();
414 
415  // Get RECO muons
416  edm::Handle<RecoMuons> reco_muons;
418  bool found_reco_muons = true;
419  bool found_pat_muons = true;
420  if (useMuons_) {
421  if (!usePAT_) {
422  getMuons(event, reco_muons);
423  } else {
424  getMuons(event, pat_muons);
425  found_reco_muons = false;
426  }
427  }
428 
429  // Get RECO electrons and their ids
430  edm::Handle<RecoElectrons> reco_elecs;
432  edm::Handle<RecoElectronIds> reco_elec_ids;
433  bool found_reco_elecs = true;
434  bool found_pat_elecs = true;
435  if (useElecs_) {
436  if (!usePAT_) {
437  getElectrons(event, reco_elecs, reco_elec_ids);
438  } else {
439  getElectrons(event, pat_elecs);
440  found_reco_elecs = false;
441  }
442  }
443 
444  // Check RECO products found
445  if (!found_reco_muons || !found_reco_elecs) {
446  if (!found_pat_muons || !found_pat_elecs) {
447  edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
448  << " Unable to access RECO collections for muons and electrons";
449  return;
450  }
451  }
452 
453  // Identify pions/muons/electrons that are "in/in" and "in/out"
454  {
455  TrackRefs::const_iterator itrk = jet_tracks.vertex_.begin();
456  TrackRefs::const_iterator jtrk = jet_tracks.vertex_.end();
457 
458  double theSumPtForBetaOld = theSumPtForBeta;
459 
460  for (; itrk != jtrk; ++itrk) {
461  if (useTrackQuality_ && (*itrk)->quality(trackQuality_) && theSumPtForBetaOld <= 0.)
462  theSumPtForBeta += (**itrk).pt();
463  //
464  // Track either belongs to PV or do not belong to any vertex
465 
466  const reco::TrackBaseRef ttr1(*itrk);
467 
468  int numpv = 0;
469 
470  int itrack_belong = -1;
471 
472  for (reco::VertexCollection::const_iterator iv = pvCollection->begin(); iv != pvCollection->end(); iv++) {
473  numpv++;
474  std::vector<reco::TrackBaseRef>::const_iterator rr = find((*iv).tracks_begin(), (*iv).tracks_end(), ttr1);
475  if (rr != (*iv).tracks_end()) {
476  itrack_belong++;
477  break;
478  }
479 
480  } // all vertices
481 
482  if (numpv > 1 && itrack_belong == 0) {
483  continue;
484  }
485 
486  if (failTrackQuality(itrk)) {
487  continue;
488  }
489 
490  TrackRefs::iterator it = jet_tracks.caloFace_.end();
491  bool found = findTrack(jet_tracks, itrk, it);
492  bool muaccept = false;
493  bool eleaccept = false;
494  if (found_reco_muons)
495  muaccept = matchMuons(itrk, reco_muons);
496  else if (found_pat_muons) {
497  muaccept = matchMuons(itrk, pat_muons);
498  }
499  if (found_reco_elecs)
500  eleaccept = matchElectrons(itrk, reco_elecs, reco_elec_ids);
501  else if (found_pat_elecs) {
502  eleaccept = matchElectrons(itrk, pat_elecs);
503  }
504 
505  bool is_muon = useMuons_ && muaccept;
506  bool is_ele = useElecs_ && eleaccept;
507 
508  if (found) {
509  if (is_muon) {
510  muons.inVertexInCalo_.push_back(*it);
511  } else if (is_ele) {
512  elecs.inVertexInCalo_.push_back(*it);
513  } else {
514  pions.inVertexInCalo_.push_back(*it);
515  }
516  } else {
517  if (is_muon) {
518  muons.inVertexOutOfCalo_.push_back(*itrk);
519  } else if (is_ele) {
520  elecs.inVertexOutOfCalo_.push_back(*itrk);
521  } else {
522  pions.inVertexOutOfCalo_.push_back(*itrk);
523  }
524  }
525  }
526  }
527 
528  // Identify pions/muons/electrons that are "out/in"
529  {
530  TrackRefs::iterator itrk = jet_tracks.caloFace_.begin();
531  TrackRefs::iterator jtrk = jet_tracks.caloFace_.end();
532  for (; itrk != jtrk; ++itrk) {
533  if (failTrackQuality(itrk)) {
534  continue;
535  }
536 
537  if (!tracksInCalo(pions, muons, elecs)) {
538  continue;
539  }
540 
541  bool found = findTrack(pions, muons, elecs, itrk);
542 
543  if (!found) {
544  bool muaccept = false;
545  bool eleaccept = false;
546  if (found_reco_muons)
547  muaccept = matchMuons(itrk, reco_muons);
548  else if (found_pat_muons) {
549  muaccept = matchMuons(itrk, pat_muons);
550  }
551  if (found_reco_elecs)
552  eleaccept = matchElectrons(itrk, reco_elecs, reco_elec_ids);
553  else if (found_pat_elecs) {
554  eleaccept = matchElectrons(itrk, pat_elecs);
555  }
556 
557  bool is_muon = useMuons_ && muaccept;
558  bool is_ele = useElecs_ && eleaccept;
559 
560  if (is_muon) {
561  muons.outOfVertexInCalo_.push_back(*itrk);
562  } else if (is_ele) {
563  elecs.outOfVertexInCalo_.push_back(*itrk);
564  } else {
565  pions.outOfVertexInCalo_.push_back(*itrk);
566  }
567  }
568  }
569  }
570 
571  if (verbose_ && edm::isDebugEnabled()) {
572  std::stringstream ss;
573  ss << "[JetPlusTrackCorrector::" << __func__ << "] Number of tracks:" << std::endl
574  << " In-cone at Vertex and in-cone at CaloFace:" << std::endl
575  << " Pions : " << pions.inVertexInCalo_.size() << std::endl
576  << " Muons : " << muons.inVertexInCalo_.size() << std::endl
577  << " Electrons : " << elecs.inVertexInCalo_.size() << std::endl
578  << " In-cone at Vertex and out-of-cone at CaloFace:" << std::endl
579  << " Pions : " << pions.inVertexOutOfCalo_.size() << std::endl
580  << " Muons : " << muons.inVertexOutOfCalo_.size() << std::endl
581  << " Electrons : " << elecs.inVertexOutOfCalo_.size() << std::endl
582  << " Out-of-cone at Vertex and in-cone at CaloFace:" << std::endl
583  << " Pions : " << pions.outOfVertexInCalo_.size() << std::endl
584  << " Muons : " << muons.outOfVertexInCalo_.size() << std::endl
585  << " Electrons : " << elecs.outOfVertexInCalo_.size() << std::endl;
586  LogTrace("JetPlusTrackCorrector") << ss.str();
587  }
588 }

References edm::RefVector< C, T, F >::begin(), jpt::JetTracks::caloFace_, jpt::MatchedTracks::clear(), singleTopDQM_cfi::elecs, edm::RefVector< C, T, F >::end(), failTrackQuality(), spr::find(), findTrack(), newFWLiteAna::found, getElectrons(), getMuons(), input_pvCollection_token_, jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, edm::isDebugEnabled(), gpuVertexFinder::iv, LogTrace, matchElectrons(), matchMuons(), PDWG_BPHSkim_cff::muons, jpt::MatchedTracks::outOfVertexInCalo_, edm::RefVector< C, T, F >::push_back(), anotherprimaryvertexanalyzer_cfi::pvCollection, findQualityFiles::rr, edm::RefVector< C, T, F >::size(), contentValuesCheck::ss, theSumPtForBeta, trackQuality_, tracksInCalo(), useElecs_, useMuons_, usePAT_, useTrackQuality_, verbose_, jpt::JetTracks::vertex_, and vertex_.

◆ matchTracks() [2/3]

void JetPlusTrackCorrector::matchTracks ( const reco::Jet fJet,
const edm::Event event,
const edm::EventSetup setup,
const reco::TrackRefVector tracksinvert,
const reco::TrackRefVector tracksincalo,
jpt::MatchedTracks pions,
jpt::MatchedTracks muons,
jpt::MatchedTracks elecs 
)

Definition at line 252 of file JetPlusTrackCorrector.cc.

259  {
260  JetTracks jet_tracks;
261  jet_tracks.vertex_ = tracksinvert;
262  jet_tracks.caloFace_ = tracksincalo;
263  matchTracks(jet_tracks, event, pions, muons, elecs);
264 
265  return;
266 }

References jpt::JetTracks::caloFace_, singleTopDQM_cfi::elecs, matchTracks(), PDWG_BPHSkim_cff::muons, and jpt::JetTracks::vertex_.

Referenced by matchTracks().

◆ matchTracks() [3/3]

bool JetPlusTrackCorrector::matchTracks ( const reco::Jet fJet,
const edm::Event event,
const edm::EventSetup setup,
jpt::MatchedTracks pions,
jpt::MatchedTracks muons,
jpt::MatchedTracks elecs 
)

Matches tracks to different particle types.

Definition at line 268 of file JetPlusTrackCorrector.cc.

273  {
274  // Associate tracks to jet at both the Vertex and CaloFace
275  JetTracks jet_tracks;
276  bool ok = jetTrackAssociation(fJet, event, setup, jet_tracks);
277 
278  if (!ok) {
279  return false;
280  }
281 
282  // Track collections propagated to Vertex and CaloFace for "pions", muons and electrons
283  matchTracks(jet_tracks, event, pions, muons, elecs);
284 
285  // Debug
286  if (verbose_) {
287  std::stringstream ss;
288  ss << "Number of tracks:" << std::endl
289  << " In-cone at Vertex : " << jet_tracks.vertex_.size() << std::endl
290  << " In-cone at CaloFace : " << jet_tracks.caloFace_.size();
291  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
292  }
293 
294  return true;
295 }

References jpt::JetTracks::caloFace_, singleTopDQM_cfi::elecs, jetTrackAssociation(), PDWG_BPHSkim_cff::muons, convertSQLiteXML::ok, singleTopDQM_cfi::setup, edm::RefVector< C, T, F >::size(), contentValuesCheck::ss, verbose_, and jpt::JetTracks::vertex_.

Referenced by correction().

◆ muonCorrection() [1/2]

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::muonCorrection ( const P4 jet,
const jpt::MatchedTracks muons 
)

Calculates correction to be applied using muons.

Definition at line 737 of file JetPlusTrackCorrector.cc.

737  {
738  P4 corr_muons;
739 
740  P4 corr_muons_in_cone;
741  P4 corr_muons_out_of_cone;
742  P4 corr_muons_out_of_vertex;
743 
744  if (useInConeTracks_) {
745  corr_muons_in_cone = muonCorrection(jet, muons.inVertexInCalo_, true, true);
746  corr_muons += corr_muons_in_cone;
747  }
748 
749  if (useOutOfConeTracks_) {
750  corr_muons_out_of_cone = muonCorrection(jet, muons.inVertexOutOfCalo_, true, false);
751  corr_muons += corr_muons_out_of_cone;
752  }
753 
754  if (useOutOfVertexTracks_) {
755  corr_muons_out_of_vertex = muonCorrection(jet, muons.outOfVertexInCalo_, false, true);
756  corr_muons += corr_muons_out_of_vertex;
757  }
758 
759  if (verbose_) {
760  std::stringstream ss;
761  ss << " Muon corrections:" << std::endl
762  << " In/In : "
763  << "(" << muons.inVertexInCalo_.size() << ") " << corr_muons_in_cone.energy() << std::endl
764  << " In/Out : "
765  << "(" << muons.inVertexOutOfCalo_.size() << ") " << corr_muons_out_of_cone.energy() << std::endl
766  << " Out/In : "
767  << "(" << muons.outOfVertexInCalo_.size() << ") " << corr_muons_out_of_vertex.energy();
768  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
769  }
770 
771  return corr_muons;
772 }

References metsig::jet, PDWG_BPHSkim_cff::muons, contentValuesCheck::ss, useInConeTracks_, useOutOfConeTracks_, useOutOfVertexTracks_, and verbose_.

Referenced by correction().

◆ muonCorrection() [2/2]

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::muonCorrection ( const P4 jet,
const TrackRefs muons,
bool  in_cone_at_vertex,
bool  in_cone_at_calo_face 
)
inlineprotected

Calculates individual muons corrections.

Definition at line 493 of file JetPlusTrackCorrector.h.

496  {
497  return calculateCorr(jet, muons, not_used, in_cone_at_vertex, in_cone_at_calo_face, muonMass_, false, 2.);
498 }

References calculateCorr(), metsig::jet, muonMass_, PDWG_BPHSkim_cff::muons, and not_used.

◆ pionCorrection() [1/2]

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::pionCorrection ( const P4 jet,
const jpt::MatchedTracks pions 
)

Calculates corrections to be applied using pions.

Definition at line 670 of file JetPlusTrackCorrector.cc.

670  {
671  P4 corr_pions;
672 
673  // In-cone
674 
675  P4 corr_pions_in_cone;
676  P4 corr_pions_eff_in_cone;
678 
679  if (useInConeTracks_) {
680  corr_pions_in_cone = pionCorrection(jet, pions.inVertexInCalo_, in_cone, true, true);
681  corr_pions += corr_pions_in_cone;
682  if (useEff_) {
683  corr_pions_eff_in_cone = pionEfficiency(jet, in_cone, true);
684  corr_pions += corr_pions_eff_in_cone;
685  }
686  }
687 
688  // Out-of-cone
689 
690  P4 corr_pions_out_of_cone;
691  P4 corr_pions_eff_out_of_cone;
692  Efficiency out_of_cone(responseMap(), efficiencyMap(), leakageMap());
693 
694  if (useOutOfConeTracks_) {
695  corr_pions_out_of_cone = pionCorrection(jet, pions.inVertexOutOfCalo_, out_of_cone, true, false);
696  corr_pions += corr_pions_out_of_cone;
697  if (useEff_) {
698  corr_pions_eff_out_of_cone = pionEfficiency(jet, out_of_cone, false);
699  corr_pions += corr_pions_eff_out_of_cone;
700  }
701  }
702 
703  // Out-of-vertex
704 
705  P4 corr_pions_out_of_vertex;
707 
708  if (useOutOfVertexTracks_) {
709  corr_pions_out_of_vertex = pionCorrection(jet, pions.outOfVertexInCalo_, not_used, false, true);
710  corr_pions += corr_pions_out_of_vertex;
711  }
712 
713  if (verbose_) {
714  std::stringstream ss;
715  ss << " Pion corrections:" << std::endl
716  << " In/In : "
717  << "(" << pions.inVertexInCalo_.size() << ") " << corr_pions_in_cone.energy() << std::endl
718  << " In/Out : "
719  << "(" << pions.inVertexOutOfCalo_.size() << ") " << corr_pions_out_of_cone.energy() << std::endl
720  << " Out/In : "
721  << "(" << pions.outOfVertexInCalo_.size() << ") " << corr_pions_out_of_vertex.energy() << std::endl;
722  if (useEff_) {
723  ss << " Pion efficiency corrections:" << std::endl
724  << " In/In : "
725  << "(" << pions.inVertexInCalo_.size() << ") " << corr_pions_eff_in_cone.energy() << std::endl
726  << " In/Out : "
727  << "(" << pions.inVertexOutOfCalo_.size() << ") " << corr_pions_eff_out_of_cone.energy();
728  }
729  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
730  }
731 
732  return corr_pions;
733 }

References efficiencyMap(), jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, metsig::jet, leakageMap(), not_used, jpt::MatchedTracks::outOfVertexInCalo_, pionEfficiency(), responseMap(), edm::RefVector< C, T, F >::size(), contentValuesCheck::ss, useEff_, useInConeTracks_, useOutOfConeTracks_, useOutOfVertexTracks_, and verbose_.

Referenced by correction().

◆ pionCorrection() [2/2]

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::pionCorrection ( const P4 jet,
const TrackRefs pions,
jpt::Efficiency eff,
bool  in_cone_at_vertex,
bool  in_cone_at_calo_face 
)
inlineprotected

Calculates individual pion corrections.

Definition at line 488 of file JetPlusTrackCorrector.h.

489  {
490  return calculateCorr(jet, pions, eff, in_cone_at_vertex, in_cone_at_calo_face, pionMass_, true, -1.);
491 }

References calculateCorr(), metsig::jet, and pionMass_.

◆ pionEfficiency()

JetPlusTrackCorrector::P4 JetPlusTrackCorrector::pionEfficiency ( const P4 jet,
const jpt::Efficiency eff,
bool  in_cone_at_calo_face 
)
protected

Correction to be applied using tracking efficiency.

Definition at line 1012 of file JetPlusTrackCorrector.cc.

1014  {
1015  // Total correction to be applied
1016  P4 correction;
1017 
1018  double theSumResp = 0;
1019  double theSumPt = 0;
1020  double theSumEnergy = 0;
1021 
1022  // Iterate through eta/pt bins
1023  for (uint32_t ieta = 0; ieta < response_.nEtaBins() - 1; ++ieta) {
1024  for (uint32_t ipt = 0; ipt < response_.nPtBins() - 1; ++ipt) {
1025  // Check tracks are found in this eta/pt bin
1026  if (!eff.nTrks(ieta, ipt)) {
1027  continue;
1028  }
1029 
1030  for (uint16_t ii = 0; ii < 2; ++ii) {
1031  // Check which correction should be applied
1032  double corr = 0.;
1033  if (ii == 0) {
1034  corr = eff.outOfConeCorr(ieta, ipt);
1035  } else if (ii == 1 && in_cone_at_calo_face) {
1036  corr = eff.inConeCorr(ieta, ipt);
1037  } else {
1038  continue;
1039  }
1040 
1041  // Calculate correction to be applied
1042  P4 corr_p4;
1043  if (vectorial_ && vecResponse_) {
1044  double corr_eta = response_.binCenterEta(ieta);
1045  double corr_phi = jet.phi(); //@@ jet phi!
1046  double corr_pt = response_.binCenterPt(ipt);
1047  corr_p4 =
1048  PtEtaPhiM(corr_pt, corr_eta, corr_phi, pionMass_); //@@ E^2 = p^2 + m_pion^2, |p| calc'ed from pt bin
1049  corr_p4 *= (corr_p4.energy() > 0. ? corr / corr_p4.energy() : 1.); //@@ p4 scaled up by mean energy for bin
1050  } else {
1051  corr_p4 = (jet.energy() > 0. ? corr / jet.energy() : 1.) * jet;
1052  }
1053 
1054  // Apply correction
1055  if (ii == 0) {
1056  correction += corr_p4;
1057  theSumPt += corr_p4.pt();
1058  theSumEnergy += corr_p4.energy();
1059  } //@@ Add out-of-cone
1060  else if (ii == 1) {
1061  correction -= corr_p4;
1062  theSumResp += corr_p4.energy();
1063  } //@@ Subtract in-cone
1064  }
1065  }
1066  }
1067 
1068  theResponseOfChargedWithEff += theSumResp;
1069  theSumPtWithEff += theSumPt;
1070  theSumEnergyWithEff += theSumEnergy;
1071  return correction;
1072 }

References jpt::Map::binCenterEta(), jpt::Map::binCenterPt(), alignCSCRings::corr, correction(), LEDCalibrationChannels::ieta, cuy::ii, jpt::Efficiency::inConeCorr(), metsig::jet, jpt::Map::nEtaBins(), jpt::Map::nPtBins(), jpt::Efficiency::nTrks(), jpt::Efficiency::outOfConeCorr(), pionMass_, response_, theResponseOfChargedWithEff, theSumEnergyWithEff, theSumPtWithEff, vecResponse_, and vectorial_.

Referenced by pionCorrection().

◆ rebuildJta()

void JetPlusTrackCorrector::rebuildJta ( const reco::Jet fJet,
const JetTracksAssociations jtV0,
TrackRefs included,
TrackRefs excluded 
) const
protected

Rebuild jet-track association.

Definition at line 1171 of file JetPlusTrackCorrector.cc.

1174  {
1175  tracksthis = reco::JetTracksAssociation::getValue(jtV0, fJet);
1176 
1177  if (jetSplitMerge_ < 0)
1178  return;
1179 
1180  typedef std::vector<reco::JetBaseRef>::iterator JetBaseRefIterator;
1181  std::vector<reco::JetBaseRef> theJets = reco::JetTracksAssociation::allJets(jtV0);
1182 
1183  TrackRefs tracks = tracksthis;
1184  tracksthis.clear();
1185 
1186  int tr = 0;
1187 
1188  double jetEta = fJet.eta();
1189  double jetPhi = fJet.phi();
1190  double jetEtIn = 1.0 / fJet.et();
1191 
1192  for (TrackRefs::iterator it = tracks.begin(); it != tracks.end(); it++) {
1193  double trkEta = (**it).eta();
1194  double trkPhi = (**it).phi();
1195  double dR2this = deltaR2(jetEta, jetPhi, trkEta, trkPhi);
1196  // double dfi = fabs(fJet.phi()-(**it).phi());
1197  // if(dfi>4.*atan(1.))dfi = 8.*atan(1.)-dfi;
1198  // double deta = fJet.eta() - (**it).eta();
1199  // double dR2check = sqrt(dfi*dfi+deta*deta);
1200 
1201  double scalethis = dR2this;
1202  if (jetSplitMerge_ == 0)
1203  scalethis = 1. * jetEtIn;
1204  if (jetSplitMerge_ == 2)
1205  scalethis = dR2this * jetEtIn;
1206  tr++;
1207  int flag = 1;
1208  for (JetBaseRefIterator ii = theJets.begin(); ii != theJets.end(); ii++) {
1209  if (&(**ii) == &fJet) {
1210  continue;
1211  }
1212  double dR2 = deltaR2((*ii)->eta(), (*ii)->phi(), trkEta, trkPhi);
1213  double scale = dR2;
1214  if (jetSplitMerge_ == 0)
1215  scale = 1. / (**ii).et();
1216  if (jetSplitMerge_ == 2)
1217  scale = dR2 / (**ii).et();
1218  if (scale < scalethis)
1219  flag = 0;
1220 
1221  if (flag == 0) {
1222  break;
1223  }
1224  }
1225 
1226  if (flag == 1) {
1227  tracksthis.push_back(*it);
1228  } else {
1229  Excl.push_back(*it);
1230  }
1231  }
1232 
1233  return;
1234 }

References reco::JetTracksAssociation::allJets(), edm::RefVector< C, T, F >::clear(), HLTMuonOfflineAnalyzer_cfi::deltaR2, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), RemoveAddSevLevel::flag, reco::JetTracksAssociation::getValue(), cuy::ii, reco::btau::jetEta, reco::btau::jetPhi, jetSplitMerge_, reco::LeafCandidate::phi(), edm::RefVector< C, T, F >::push_back(), L1EGammaCrystalsEmulatorProducer_cfi::scale, and tracks.

Referenced by jtaUsingEventData().

◆ responseMap()

const jpt::Map & JetPlusTrackCorrector::responseMap ( ) const
inlineprotected

Definition at line 514 of file JetPlusTrackCorrector.h.

514 { return response_; }

References response_.

Referenced by pionCorrection().

◆ tracksInCalo()

bool JetPlusTrackCorrector::tracksInCalo ( const jpt::MatchedTracks pions,
const jpt::MatchedTracks muons,
const jpt::MatchedTracks elecs 
) const
protected

Determines if any tracks in cone at CaloFace.

Definition at line 658 of file JetPlusTrackCorrector.cc.

660  {
661  if (!pions.inVertexInCalo_.empty() || !muons.inVertexInCalo_.empty() || !elecs.inVertexInCalo_.empty()) {
662  return true;
663  } else {
664  return false;
665  }
666 }

References singleTopDQM_cfi::elecs, edm::RefVector< C, T, F >::empty(), jpt::MatchedTracks::inVertexInCalo_, and PDWG_BPHSkim_cff::muons.

Referenced by matchTracks().

◆ vectorialCorrection()

bool JetPlusTrackCorrector::vectorialCorrection ( ) const
inline

Returns value of configurable.

Definition at line 485 of file JetPlusTrackCorrector.h.

485 { return vectorial_; }

References vectorial_.

Member Data Documentation

◆ dzVertexCut_

double JetPlusTrackCorrector::dzVertexCut_
protected

Definition at line 417 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality().

◆ efficiency_

const jpt::Map JetPlusTrackCorrector::efficiency_
protected

Definition at line 432 of file JetPlusTrackCorrector.h.

Referenced by correctAA(), and efficiencyMap().

◆ elecMass_

double JetPlusTrackCorrector::elecMass_
protected

Definition at line 444 of file JetPlusTrackCorrector.h.

Referenced by elecCorrection().

◆ electronDRmatch_

double JetPlusTrackCorrector::electronDRmatch_
protected

Definition at line 439 of file JetPlusTrackCorrector.h.

Referenced by matchElectrons().

◆ electronIds_

edm::InputTag JetPlusTrackCorrector::electronIds_
protected

Definition at line 423 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ electrons_

edm::InputTag JetPlusTrackCorrector::electrons_
protected

Definition at line 422 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ input_jetTracksAtCalo_token_

edm::EDGetTokenT<reco::JetTracksAssociation::Container> JetPlusTrackCorrector::input_jetTracksAtCalo_token_
private

Definition at line 461 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), and jtaUsingEventData().

◆ input_jetTracksAtVertex_token_

edm::EDGetTokenT<reco::JetTracksAssociation::Container> JetPlusTrackCorrector::input_jetTracksAtVertex_token_
private

Definition at line 460 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), and jtaUsingEventData().

◆ input_pat_elecs_token_

edm::EDGetTokenT<pat::ElectronCollection> JetPlusTrackCorrector::input_pat_elecs_token_
private

Definition at line 467 of file JetPlusTrackCorrector.h.

Referenced by getElectrons(), and JetPlusTrackCorrector().

◆ input_pat_muons_token_

edm::EDGetTokenT<pat::MuonCollection> JetPlusTrackCorrector::input_pat_muons_token_
private

Definition at line 466 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ input_pvCollection_token_

edm::EDGetTokenT<reco::VertexCollection> JetPlusTrackCorrector::input_pvCollection_token_
private

Definition at line 463 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), and matchTracks().

◆ input_reco_elec_ids_token_

edm::EDGetTokenT<RecoElectronIds> JetPlusTrackCorrector::input_reco_elec_ids_token_
private

Definition at line 465 of file JetPlusTrackCorrector.h.

Referenced by getElectrons(), and JetPlusTrackCorrector().

◆ input_reco_elecs_token_

edm::EDGetTokenT<RecoElectrons> JetPlusTrackCorrector::input_reco_elecs_token_
private

Definition at line 464 of file JetPlusTrackCorrector.h.

Referenced by getElectrons(), and JetPlusTrackCorrector().

◆ input_reco_muons_token_

edm::EDGetTokenT<RecoMuons> JetPlusTrackCorrector::input_reco_muons_token_
private

Definition at line 462 of file JetPlusTrackCorrector.h.

Referenced by getMuons(), and JetPlusTrackCorrector().

◆ jetSplitMerge_

int JetPlusTrackCorrector::jetSplitMerge_
protected

◆ jetTracksAtCalo_

edm::InputTag JetPlusTrackCorrector::jetTracksAtCalo_
protected

◆ jetTracksAtVertex_

edm::InputTag JetPlusTrackCorrector::jetTracksAtVertex_
protected

◆ leakage_

const jpt::Map JetPlusTrackCorrector::leakage_
protected

Definition at line 433 of file JetPlusTrackCorrector.h.

Referenced by leakageMap().

◆ maxEta_

double JetPlusTrackCorrector::maxEta_
protected

Definition at line 447 of file JetPlusTrackCorrector.h.

Referenced by canCorrect().

◆ muonEtamatch_

double JetPlusTrackCorrector::muonEtamatch_
protected

Definition at line 437 of file JetPlusTrackCorrector.h.

◆ muonMass_

double JetPlusTrackCorrector::muonMass_
protected

Definition at line 443 of file JetPlusTrackCorrector.h.

Referenced by muonCorrection().

◆ muonPhimatch_

double JetPlusTrackCorrector::muonPhimatch_
protected

Definition at line 438 of file JetPlusTrackCorrector.h.

◆ muonPtmatch_

double JetPlusTrackCorrector::muonPtmatch_
protected

Definition at line 436 of file JetPlusTrackCorrector.h.

◆ muons_

edm::InputTag JetPlusTrackCorrector::muons_
protected

Definition at line 421 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ not_used

jpt::Efficiency JetPlusTrackCorrector::not_used {response_, efficiency_, leakage_}
protected

Definition at line 455 of file JetPlusTrackCorrector.h.

Referenced by elecCorrection(), muonCorrection(), and pionCorrection().

◆ patelectrons_

edm::InputTag JetPlusTrackCorrector::patelectrons_
protected

Definition at line 425 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ patmuons_

edm::InputTag JetPlusTrackCorrector::patmuons_
protected

Definition at line 424 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ pionMass_

double JetPlusTrackCorrector::pionMass_
protected

Definition at line 442 of file JetPlusTrackCorrector.h.

Referenced by pionCorrection(), and pionEfficiency().

◆ ptErrorQuality_

double JetPlusTrackCorrector::ptErrorQuality_
protected

Definition at line 416 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality().

◆ response_

const jpt::Map JetPlusTrackCorrector::response_
protected

Definition at line 431 of file JetPlusTrackCorrector.h.

Referenced by calculateCorr(), correctAA(), pionEfficiency(), and responseMap().

◆ srcPVs_

edm::InputTag JetPlusTrackCorrector::srcPVs_
protected

Definition at line 415 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector().

◆ theResponseOfChargedWithEff

float JetPlusTrackCorrector::theResponseOfChargedWithEff
protected

◆ theResponseOfChargedWithoutEff

float JetPlusTrackCorrector::theResponseOfChargedWithoutEff
protected

◆ theSumEnergyWithEff

float JetPlusTrackCorrector::theSumEnergyWithEff
protected

◆ theSumEnergyWithoutEff

float JetPlusTrackCorrector::theSumEnergyWithoutEff
protected

Definition at line 453 of file JetPlusTrackCorrector.h.

Referenced by calculateCorr(), correction(), and getSumEnergyWithoutEff().

◆ theSumPtForBeta

float JetPlusTrackCorrector::theSumPtForBeta
protected

Definition at line 454 of file JetPlusTrackCorrector.h.

Referenced by correction(), getSumPtForBeta(), and matchTracks().

◆ theSumPtWithEff

float JetPlusTrackCorrector::theSumPtWithEff
protected

◆ theSumPtWithoutEff

float JetPlusTrackCorrector::theSumPtWithoutEff
protected

Definition at line 451 of file JetPlusTrackCorrector.h.

Referenced by calculateCorr(), correction(), and getSumPtWithoutEff().

◆ trackQuality_

reco::TrackBase::TrackQuality JetPlusTrackCorrector::trackQuality_
protected

Definition at line 428 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality(), and matchTracks().

◆ useEff_

bool JetPlusTrackCorrector::useEff_
protected

Definition at line 406 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), and pionCorrection().

◆ useElecs_

bool JetPlusTrackCorrector::useElecs_
protected

Definition at line 408 of file JetPlusTrackCorrector.h.

Referenced by correction(), JetPlusTrackCorrector(), and matchTracks().

◆ useInConeTracks_

bool JetPlusTrackCorrector::useInConeTracks_
protected

Definition at line 402 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), muonCorrection(), and pionCorrection().

◆ useMuons_

bool JetPlusTrackCorrector::useMuons_
protected

Definition at line 407 of file JetPlusTrackCorrector.h.

Referenced by correction(), JetPlusTrackCorrector(), and matchTracks().

◆ useOutOfConeTracks_

bool JetPlusTrackCorrector::useOutOfConeTracks_
protected

Definition at line 403 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), muonCorrection(), and pionCorrection().

◆ useOutOfVertexTracks_

bool JetPlusTrackCorrector::useOutOfVertexTracks_
protected

Definition at line 404 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), muonCorrection(), and pionCorrection().

◆ usePAT_

bool JetPlusTrackCorrector::usePAT_
protected

Definition at line 399 of file JetPlusTrackCorrector.h.

Referenced by correction(), JetPlusTrackCorrector(), and matchTracks().

◆ usePions_

bool JetPlusTrackCorrector::usePions_
protected

Definition at line 405 of file JetPlusTrackCorrector.h.

Referenced by correction(), and JetPlusTrackCorrector().

◆ useTrackQuality_

bool JetPlusTrackCorrector::useTrackQuality_
protected

Definition at line 409 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality(), JetPlusTrackCorrector(), and matchTracks().

◆ vecResponse_

bool JetPlusTrackCorrector::vecResponse_
protected

◆ vectorial_

bool JetPlusTrackCorrector::vectorial_
protected

◆ verbose_

bool JetPlusTrackCorrector::verbose_
protected

◆ vertex_

reco::Particle::Point JetPlusTrackCorrector::vertex_
protected

Definition at line 418 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality(), and matchTracks().

JetPlusTrackCorrector::useOutOfVertexTracks_
bool useOutOfVertexTracks_
Definition: JetPlusTrackCorrector.h:404
JetPlusTrackCorrector::jetDirFromTracks
P4 jetDirFromTracks(const P4 &jet, const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const
Calculates vectorial correction using total track 3-momentum.
Definition: JetPlusTrackCorrector.cc:796
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
JetPlusTrackCorrector::tracksInCalo
bool tracksInCalo(const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const
Determines if any tracks in cone at CaloFace.
Definition: JetPlusTrackCorrector.cc:658
JetPlusTrackCorrector::response_
const jpt::Map response_
Definition: JetPlusTrackCorrector.h:431
JetPlusTrackCorrector::dzVertexCut_
double dzVertexCut_
Definition: JetPlusTrackCorrector.h:417
JetPlusTrackCorrector::input_jetTracksAtCalo_token_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > input_jetTracksAtCalo_token_
Definition: JetPlusTrackCorrector.h:461
jpt::Efficiency::nTrks
uint16_t nTrks(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1641
JetPlusTrackCorrector::useInConeTracks_
bool useInConeTracks_
Definition: JetPlusTrackCorrector.h:402
JetPlusTrackCorrector::findTrack
bool findTrack(const jpt::JetTracks &, TrackRefs::const_iterator &, TrackRefs::iterator &) const
Find track in JetTracks collection.
Definition: JetPlusTrackCorrector.cc:629
JetPlusTrackCorrector::muons_
edm::InputTag muons_
Definition: JetPlusTrackCorrector.h:421
edm::Handle::product
T const * product() const
Definition: Handle.h:70
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
jpt::Map::nEtaBins
uint32_t nEtaBins() const
Definition: JetPlusTrackCorrector.h:85
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
JetPlusTrackCorrector::RecoMuons
reco::MuonCollection RecoMuons
Get reponses.
Definition: JetPlusTrackCorrector.h:293
JetPlusTrackCorrector::calculateCorr
P4 calculateCorr(const P4 &jet, const TrackRefs &, jpt::Efficiency &, bool in_cone_at_vertex, bool in_cone_at_calo_face, double mass, bool is_pion, double mip)
Generic method to calculates 4-momentum correction to be applied.
Definition: JetPlusTrackCorrector.cc:879
JetPlusTrackCorrector::rebuildJta
void rebuildJta(const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, TrackRefs &excluded) const
Rebuild jet-track association.
Definition: JetPlusTrackCorrector.cc:1171
pat::ElectronCollection
std::vector< Electron > ElectronCollection
Definition: Electron.h:36
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
jpt::MatchedTracks::inVertexOutOfCalo_
reco::TrackRefVector inVertexOutOfCalo_
Definition: JetPlusTrackCorrector.h:151
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
JetPlusTrackCorrector::input_reco_elec_ids_token_
edm::EDGetTokenT< RecoElectronIds > input_reco_elec_ids_token_
Definition: JetPlusTrackCorrector.h:465
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
edm::RefVector< TrackCollection >::const_iterator
iterator const_iterator
Definition: RefVector.h:38
gpuVertexFinder::iv
int32_t *__restrict__ iv
Definition: gpuClusterTracksDBSCAN.h:42
edm::RefVector< TrackCollection >::iterator
refhelper::RefVectorTrait< TrackCollection, typename refhelper::ValueTrait< TrackCollection >::value, typename refhelper::FindTrait< TrackCollection, typename refhelper::ValueTrait< TrackCollection >::value >::value >::iterator_type iterator
Definition: RefVector.h:37
JetPlusTrackCorrector::checkScale
double checkScale(const P4 &jet, P4 &corrected) const
Check corrected 4-momentum does not give negative scale.
Definition: JetPlusTrackCorrector.h:507
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::RefVector::begin
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
JetPlusTrackCorrector::jetTracksAtCalo_
edm::InputTag jetTracksAtCalo_
Definition: JetPlusTrackCorrector.h:413
jpt::Efficiency
Generic container class.
Definition: JetPlusTrackCorrector.h:89
JetPlusTrackCorrector::useTrackQuality_
bool useTrackQuality_
Definition: JetPlusTrackCorrector.h:409
jpt::Efficiency::outOfConeCorr
double outOfConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1625
JetPlusTrackCorrector::muonPhimatch_
double muonPhimatch_
Definition: JetPlusTrackCorrector.h:438
JetPlusTrackCorrector::input_reco_muons_token_
edm::EDGetTokenT< RecoMuons > input_reco_muons_token_
Definition: JetPlusTrackCorrector.h:462
edm::InputTag::process
std::string const & process() const
Definition: InputTag.h:40
JetPlusTrackCorrector::matchTracks
bool matchTracks(const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs)
Matches tracks to different particle types.
Definition: JetPlusTrackCorrector.cc:268
muon::TMLastStationTight
Definition: MuonSelectors.h:27
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
jpt::MatchedTracks::inVertexInCalo_
reco::TrackRefVector inVertexInCalo_
Definition: JetPlusTrackCorrector.h:149
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
JetPlusTrackCorrector::pionEfficiency
P4 pionEfficiency(const P4 &jet, const jpt::Efficiency &, bool in_cone_at_calo_face)
Correction to be applied using tracking efficiency.
Definition: JetPlusTrackCorrector.cc:1012
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
reco::JetTracksAssociation::allJets
std::vector< reco::JetBaseRef > allJets(const Container &)
fill list of all jets associated with values. Return # of jets in the list
Definition: JetTracksAssociation.cc:56
edm::Ref
Definition: AssociativeIterator.h:58
JetPlusTrackCorrector::theResponseOfChargedWithEff
float theResponseOfChargedWithEff
Definition: JetPlusTrackCorrector.h:448
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
edm::RefVector::end
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
JetPlusTrackCorrector::correction
double correction(const reco::Jet &, const reco::Jet &, const edm::Event &, const edm::EventSetup &, P4 &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs, bool &validMatches)
Vectorial correction method (corrected 4-momentum passed by reference)
Definition: JetPlusTrackCorrector.cc:151
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:649
jpt::Efficiency::reset
void reset()
Definition: JetPlusTrackCorrector.cc:1700
jpt::Map::binCenterPt
double binCenterPt(uint32_t) const
Definition: JetPlusTrackCorrector.cc:1504
jpt::Map::ptBin
uint32_t ptBin(double pt) const
Definition: JetPlusTrackCorrector.cc:1531
edm::RefVector::empty
bool empty() const
Is the RefVector empty.
Definition: RefVector.h:99
JetPlusTrackCorrector::input_jetTracksAtVertex_token_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > input_jetTracksAtVertex_token_
Definition: JetPlusTrackCorrector.h:460
jpt::Map::nPtBins
uint32_t nPtBins() const
Definition: JetPlusTrackCorrector.h:86
JetPlusTrackCorrector::theResponseOfChargedWithoutEff
float theResponseOfChargedWithoutEff
Definition: JetPlusTrackCorrector.h:449
reco::LeafCandidate::py
double py() const final
y coordinate of momentum vector
Definition: LeafCandidate.h:142
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
PVValHelper::eta
Definition: PVValidationHelpers.h:70
JetPlusTrackCorrector::useMuons_
bool useMuons_
Definition: JetPlusTrackCorrector.h:407
SurfaceOrientation::inner
Definition: Surface.h:19
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
JetPlusTrackCorrector::jtaUsingEventData
bool jtaUsingEventData(const reco::Jet &, const edm::Event &, jpt::JetTracks &) const
JTA using collections from event.
Definition: JetPlusTrackCorrector.cc:324
JetPlusTrackCorrector::responseMap
const jpt::Map & responseMap() const
Definition: JetPlusTrackCorrector.h:514
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
pat::MuonCollection
std::vector< Muon > MuonCollection
Definition: Muon.h:35
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
anotherprimaryvertexanalyzer_cfi.pvCollection
pvCollection
Definition: anotherprimaryvertexanalyzer_cfi.py:4
JetPlusTrackCorrector::patmuons_
edm::InputTag patmuons_
Definition: JetPlusTrackCorrector.h:424
JetPlusTrackCorrector::P4
math::XYZTLorentzVector P4
Definition: JetPlusTrackCorrector.h:182
jpt::MatchedTracks::clear
void clear()
Definition: JetPlusTrackCorrector.cc:1585
JetPlusTrackCorrector::jetSplitMerge_
int jetSplitMerge_
Definition: JetPlusTrackCorrector.h:414
JetPlusTrackCorrector::matchMuons
bool matchMuons(TrackRefs::const_iterator &, const edm::Handle< RecoMuons > &) const
Matches tracks to RECO muons.
Definition: JetPlusTrackCorrector.cc:1076
JetPlusTrackCorrector::maxEta_
double maxEta_
Definition: JetPlusTrackCorrector.h:447
jpt::Map
Container class for response & efficiency maps.
Definition: JetPlusTrackCorrector.h:43
edm::AssociationVector
Definition: AssociationVector.h:67
JetPlusTrackCorrector::canCorrect
bool canCorrect(const reco::Jet &) const
Can jet be JPT-corrected?
Definition: JetPlusTrackCorrector.h:486
JetPlusTrackCorrector::srcPVs_
edm::InputTag srcPVs_
Definition: JetPlusTrackCorrector.h:415
JetPlusTrackCorrector::electronIds_
edm::InputTag electronIds_
Definition: JetPlusTrackCorrector.h:423
JetPlusTrackCorrector::pionMass_
double pionMass_
Definition: JetPlusTrackCorrector.h:442
JetPlusTrackCorrector::failTrackQuality
bool failTrackQuality(TrackRefs::const_iterator &) const
Check on track quality.
Definition: JetPlusTrackCorrector.cc:608
reco::btau::jetPhi
Definition: TaggingVariable.h:36
JetPlusTrackCorrector::useEff_
bool useEff_
Definition: JetPlusTrackCorrector.h:406
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
reco::btau::jetEta
Definition: TaggingVariable.h:34
JetPlusTrackCorrector::theSumPtWithEff
float theSumPtWithEff
Definition: JetPlusTrackCorrector.h:450
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
JetPlusTrackCorrector::jetTrackAssociation
virtual bool jetTrackAssociation(const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::JetTracks &) const
Associates tracks to jets (overriden in derived class)
Definition: JetPlusTrackCorrector.cc:299
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
jpt::Map::value
double value(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1543
JetPlusTrackCorrector::RecoElectrons
reco::GsfElectronCollection RecoElectrons
Definition: JetPlusTrackCorrector.h:294
reco::LeafCandidate::mass
double mass() const final
mass
Definition: LeafCandidate.h:131
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
JetPlusTrackCorrector::verbose_
bool verbose_
Definition: JetPlusTrackCorrector.h:398
JetPlusTrackCorrector::muonMass_
double muonMass_
Definition: JetPlusTrackCorrector.h:443
JetPlusTrackCorrector::vectorial_
bool vectorial_
Definition: JetPlusTrackCorrector.h:400
JetPlusTrackCorrector::input_pat_elecs_token_
edm::EDGetTokenT< pat::ElectronCollection > input_pat_elecs_token_
Definition: JetPlusTrackCorrector.h:467
JetPlusTrackCorrector::usePions_
bool usePions_
Definition: JetPlusTrackCorrector.h:405
jpt::Map::binCenterEta
double binCenterEta(uint32_t) const
Definition: JetPlusTrackCorrector.cc:1489
JetPlusTrackCorrector::pionCorrection
P4 pionCorrection(const P4 &jet, const jpt::MatchedTracks &pions)
Calculates corrections to be applied using pions.
Definition: JetPlusTrackCorrector.cc:670
JetPlusTrackCorrector::ptErrorQuality_
double ptErrorQuality_
Definition: JetPlusTrackCorrector.h:416
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
JetPlusTrackCorrector::matchElectrons
bool matchElectrons(TrackRefs::const_iterator &, const edm::Handle< RecoElectrons > &, const edm::Handle< RecoElectronIds > &) const
Matches tracks to RECO electrons.
Definition: JetPlusTrackCorrector.cc:1126
JetPlusTrackCorrector::input_pat_muons_token_
edm::EDGetTokenT< pat::MuonCollection > input_pat_muons_token_
Definition: JetPlusTrackCorrector.h:466
jpt::Map::etaBin
uint32_t etaBin(double eta) const
Definition: JetPlusTrackCorrector.cc:1519
jpt::JetTracks::vertex_
reco::TrackRefVector vertex_
Definition: JetPlusTrackCorrector.h:139
JetPlusTrackCorrector::theSumEnergyWithoutEff
float theSumEnergyWithoutEff
Definition: JetPlusTrackCorrector.h:453
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
JetPlusTrackCorrector::useOutOfConeTracks_
bool useOutOfConeTracks_
Definition: JetPlusTrackCorrector.h:403
JetPlusTrackCorrector::elecMass_
double elecMass_
Definition: JetPlusTrackCorrector.h:444
JetPlusTrackCorrector::usePAT_
bool usePAT_
Definition: JetPlusTrackCorrector.h:399
JetPlusTrackCorrector::theSumPtWithoutEff
float theSumPtWithoutEff
Definition: JetPlusTrackCorrector.h:451
JetPlusTrackCorrector::electronDRmatch_
double electronDRmatch_
Definition: JetPlusTrackCorrector.h:439
JetPlusTrackCorrector::theSumEnergyWithEff
float theSumEnergyWithEff
Definition: JetPlusTrackCorrector.h:452
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
JetPlusTrackCorrector::electrons_
edm::InputTag electrons_
Definition: JetPlusTrackCorrector.h:422
jpt::Efficiency::addE
void addE(uint32_t eta_bin, uint32_t pt_bin, double energy)
Definition: JetPlusTrackCorrector.cc:1676
JetPlusTrackCorrector::muonPtmatch_
double muonPtmatch_
Definition: JetPlusTrackCorrector.h:436
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
JetPlusTrackCorrector::patelectrons_
edm::InputTag patelectrons_
Definition: JetPlusTrackCorrector.h:425
JetPlusTrackCorrector::input_reco_elecs_token_
edm::EDGetTokenT< RecoElectrons > input_reco_elecs_token_
Definition: JetPlusTrackCorrector.h:464
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
jpt::JetTracks::caloFace_
reco::TrackRefVector caloFace_
Definition: JetPlusTrackCorrector.h:140
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
reco::LeafCandidate::et
double et() const final
transverse energy
Definition: LeafCandidate.h:127
JetPlusTrackCorrector::muonEtamatch_
double muonEtamatch_
Definition: JetPlusTrackCorrector.h:437
JetPlusTrackCorrector::getElectrons
bool getElectrons(const edm::Event &, edm::Handle< RecoElectrons > &, edm::Handle< RecoElectronIds > &) const
Get RECO electrons.
Definition: JetPlusTrackCorrector.cc:592
reco::JetTracksAssociation::getValue
const reco::TrackRefVector & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
Definition: JetTracksAssociation.cc:47
jpt::MatchedTracks::outOfVertexInCalo_
reco::TrackRefVector outOfVertexInCalo_
Definition: JetPlusTrackCorrector.h:150
JetPlusTrackCorrector::input_pvCollection_token_
edm::EDGetTokenT< reco::VertexCollection > input_pvCollection_token_
Definition: JetPlusTrackCorrector.h:463
JetPlusTrackCorrector::not_used
jpt::Efficiency not_used
Definition: JetPlusTrackCorrector.h:455
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
jpt::Efficiency::inConeCorr
double inConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1615
JetPlusTrackCorrector::TrackRefs
reco::TrackRefVector TrackRefs
Definition: JetPlusTrackCorrector.h:297
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
metsig::jet
Definition: SignAlgoResolutions.h:47
JetPlusTrackCorrector::vecResponse_
bool vecResponse_
Definition: JetPlusTrackCorrector.h:401
edm::RefVectorIterator
Definition: EDProductfwd.h:33
JetPlusTrackCorrector::useElecs_
bool useElecs_
Definition: JetPlusTrackCorrector.h:408
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
jpt::JetTracks
Tracks associated to jets that are in-cone at Vertex and CaloFace.
Definition: JetPlusTrackCorrector.h:134
JetPlusTrackCorrector::elecCorrection
P4 elecCorrection(const P4 &jet, const jpt::MatchedTracks &elecs) const
Calculates correction to be applied using electrons.
Definition: JetPlusTrackCorrector.cc:776
JetPlusTrackCorrector::efficiency_
const jpt::Map efficiency_
Definition: JetPlusTrackCorrector.h:432
edm::RefToBase< reco::Track >
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
JetPlusTrackCorrector::trackQuality_
reco::TrackBase::TrackQuality trackQuality_
Definition: JetPlusTrackCorrector.h:428
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:12
JetPlusTrackCorrector::jetTracksAtVertex_
edm::InputTag jetTracksAtVertex_
Definition: JetPlusTrackCorrector.h:412
JetPlusTrackCorrector::leakageMap
const jpt::Map & leakageMap() const
Definition: JetPlusTrackCorrector.h:516
hltEgammaHLTExtra_cfi.trks
trks
Definition: hltEgammaHLTExtra_cfi.py:43
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
JetPlusTrackCorrector::efficiencyMap
const jpt::Map & efficiencyMap() const
Definition: JetPlusTrackCorrector.h:515
JetPlusTrackCorrector::theSumPtForBeta
float theSumPtForBeta
Definition: JetPlusTrackCorrector.h:454
JetPlusTrackCorrector::PtEtaPhiM
math::PtEtaPhiMLorentzVectorD PtEtaPhiM
Definition: JetPlusTrackCorrector.h:184
JetPlusTrackCorrector::RecoElectronIds
edm::ValueMap< float > RecoElectronIds
Definition: JetPlusTrackCorrector.h:295
SurfaceOrientation::outer
Definition: Surface.h:19
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
edm::RefVector::size
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
reco::LeafCandidate::px
double px() const final
x coordinate of momentum vector
Definition: LeafCandidate.h:140
reco::LeafCandidate::pz
double pz() const final
z coordinate of momentum vector
Definition: LeafCandidate.h:144
JetPlusTrackCorrector::muonCorrection
P4 muonCorrection(const P4 &jet, const jpt::MatchedTracks &muons)
Calculates correction to be applied using muons.
Definition: JetPlusTrackCorrector.cc:737
JetPlusTrackCorrector::leakage_
const jpt::Map leakage_
Definition: JetPlusTrackCorrector.h:433
cuy.ii
ii
Definition: cuy.py:589
JetPlusTrackCorrector::getMuons
bool getMuons(const edm::Event &, edm::Handle< RecoMuons > &) const
Get RECO muons.
Definition: JetPlusTrackCorrector.cc:385
edm::InputTag
Definition: InputTag.h:15
JetPlusTrackCorrector::vertex_
reco::Particle::Point vertex_
Definition: JetPlusTrackCorrector.h:418
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117
JetPlusTrackCorrector::excludeJta
void excludeJta(const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, const TrackRefs &excluded) const
Exclude jet-track association.
Definition: JetPlusTrackCorrector.cc:1238
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37