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 &, 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...
 
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< RecoElectrons > &, edm::Handle< RecoElectronIds > &) const
 Get RECO electrons. More...
 
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< RecoElectrons > &, const edm::Handle< RecoElectronIds > &) const
 Matches tracks to RECO electrons. More...
 
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_
 
edm::InputTag electronIds_
 
edm::InputTag electrons_
 
int jetSplitMerge_
 
edm::InputTag jetTracksAtCalo_
 
edm::InputTag jetTracksAtVertex_
 
const jpt::Map leakage_
 
double maxEta_
 
double muonMass_
 
edm::InputTag muons_
 
jpt::Efficiency not_used {response_, efficiency_, leakage_}
 
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 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< reco::VertexCollectioninput_pvCollection_token_
 
edm::EDGetTokenT< RecoElectronIdsinput_reco_elec_ids_token_
 
edm::EDGetTokenT< RecoElectronsinput_reco_elecs_token_
 
edm::EDGetTokenT< RecoMuonsinut_reco_muons_token_
 

Detailed Description

Jet energy correction algorithm using tracks.

Definition at line 168 of file JetPlusTrackCorrector.h.

Member Typedef Documentation

◆ JetTracksAssociations

Definition at line 274 of file JetPlusTrackCorrector.h.

◆ P4

Definition at line 179 of file JetPlusTrackCorrector.h.

◆ PtEtaPhiE

Definition at line 180 of file JetPlusTrackCorrector.h.

◆ PtEtaPhiM

Definition at line 181 of file JetPlusTrackCorrector.h.

◆ RecoElectronIds

Definition at line 273 of file JetPlusTrackCorrector.h.

◆ RecoElectrons

Definition at line 272 of file JetPlusTrackCorrector.h.

◆ RecoMuons

Get reponses.

Definition at line 271 of file JetPlusTrackCorrector.h.

◆ TrackRefs

Definition at line 275 of file JetPlusTrackCorrector.h.

Constructor & Destructor Documentation

◆ JetPlusTrackCorrector() [1/2]

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

Constructor.

Definition at line 22 of file JetPlusTrackCorrector.cc.

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

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

◆ ~JetPlusTrackCorrector()

JetPlusTrackCorrector::~JetPlusTrackCorrector ( )
virtual

Destructor.

Definition at line 101 of file JetPlusTrackCorrector.cc.

101 { ; }

◆ JetPlusTrackCorrector() [2/2]

JetPlusTrackCorrector::JetPlusTrackCorrector ( )
inlineprotected

Default constructor.

Definition at line 364 of file JetPlusTrackCorrector.h.

364 { ; }

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 842 of file JetPlusTrackCorrector.cc.

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

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, PDWG_EXOHSCP_cff::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 447 of file JetPlusTrackCorrector.h.

447 { 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 468 of file JetPlusTrackCorrector.h.

468  {
469  if (jet.energy() > 0. && (corrected.energy() / jet.energy()) < 0.) {
470  corrected = jet;
471  }
472  return corrected.energy() / jet.energy();
473 }

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 1249 of file JetPlusTrackCorrector.cc.

1255  {
1256  double mScale = 1.;
1257  double NewResponse = fJet.energy();
1258 
1259  //std::cout<<"---JetPlusTrackCorrector::correctAA, Jet initial: NewResponse="<<NewResponse <<" et = "<<fJet.et()
1260  // <<" pt= "<<fJet.pt()<<" eta="<<fJet.eta()<<" phi="<<fJet.phi() <<" ja="<<ja
1261  // <<" trBgOutOfVertex="<<trBgOutOfVertex.size()<< " trBgOutOfCalo="<<trBgOutOfCalo.size()<<std::endl;
1262 
1263  if (trBgOutOfVertex.empty())
1264  return mScale;
1265  double EnergyOfBackgroundCharged = 0.;
1266  double ResponseOfBackgroundCharged = 0.;
1267 
1268  //
1269  // calculate the mean response
1270  //
1271  // double MeanResponseOfBackgroundCharged = 0.;
1272  // double MeanEnergyOfBackgroundCharged = 0.;
1273 
1274  //================= EnergyOfBackgroundCharged ==================>
1275  for (reco::TrackRefVector::iterator iBgtV = trBgOutOfVertex.begin(); iBgtV != trBgOutOfVertex.end(); iBgtV++) {
1276  // Temporary solution>>>>>> Remove tracks with pt>50 GeV
1277  // if( (**iBgtV).pt() >= 50. ) continue;
1278  //response_.value(ieta,ipt);
1279  double eta = fabs((**iBgtV).eta());
1280  double pt = fabs((**iBgtV).pt());
1281  uint32_t ieta = response_.etaBin(eta);
1282  uint32_t ipt = response_.ptBin(pt);
1283 
1284  if (fabs(fJet.eta() - (**iBgtV).eta()) > mConeSize)
1285  continue;
1286 
1287  // // Check bins (not for mips)
1288  // if ( ieta >= response_.nEtaBins() ) { continue; }
1289  // if ( ipt >= response_.nPtBins() ) { ipt = response_.nPtBins() - 1; }
1290 
1291  double echarBg = sqrt((**iBgtV).px() * (**iBgtV).px() + (**iBgtV).py() * (**iBgtV).py() +
1292  (**iBgtV).pz() * (**iBgtV).pz() + 0.14 * 0.14);
1293 
1294  // ResponseOfBackgroundCharged += echarBg*response_.value(ieta,ipt)/efficiency_.value(ieta,ipt);
1295 
1296  // std::cout<<" Efficiency of bg tracks "<<efficiency_.value(ieta,ipt)<<std::endl;
1297 
1298  EnergyOfBackgroundCharged += echarBg / efficiency_.value(ieta, ipt);
1299 
1300  } // Energy BG tracks
1301 
1302  //============= ResponseOfBackgroundCharged =======================>
1303 
1304  for (reco::TrackRefVector::iterator iBgtC = trBgOutOfCalo.begin(); iBgtC != trBgOutOfCalo.end(); iBgtC++) {
1305  // Temporary solution>>>>>> Remove tracks with pt>50 GeV
1306  // if( (**iBgtC).pt() >= 50. ) continue;
1307  //response_.value(ieta,ipt);
1308  double eta = fabs((**iBgtC).eta());
1309  double pt = fabs((**iBgtC).pt());
1310  uint32_t ieta = response_.etaBin(eta);
1311  uint32_t ipt = response_.ptBin(pt);
1312 
1313  if (fabs(fJet.eta() - (**iBgtC).eta()) > mConeSize)
1314  continue;
1315 
1316  // Check bins (not for mips)
1317  if (ieta >= response_.nEtaBins()) {
1318  continue;
1319  }
1320  if (ipt >= response_.nPtBins()) {
1321  ipt = response_.nPtBins() - 1;
1322  }
1323 
1324  double echarBg = sqrt((**iBgtC).px() * (**iBgtC).px() + (**iBgtC).py() * (**iBgtC).py() +
1325  (**iBgtC).pz() * (**iBgtC).pz() + 0.14 * 0.14);
1326 
1327  ResponseOfBackgroundCharged += echarBg * response_.value(ieta, ipt) / efficiency_.value(ieta, ipt);
1328 
1329  // std::cout<<" Efficiency of bg tracks "<<efficiency_.value(ieta,ipt)<<std::endl;
1330 
1331  } // Response of BG tracks
1332 
1333  //=================================================================>
1334 
1335  //=================================================================>
1336  // Look for in-out tracks
1337 
1338  double en = 0.;
1339  double px = 0.;
1340  double py = 0.;
1341  double pz = 0.;
1342 
1343  for (reco::TrackRefVector::const_iterator it = pioninout.begin(); it != pioninout.end(); it++) {
1344  // std::cout<<" Track in out, size= "<<pioninout.size()<<" p= "<<(*it)->p()<<" pt= "<<(*it)->pt()
1345  // <<" eta= "<<(*it)->eta()<<" phi= "<<(*it)->phi()<<std::endl;
1346 
1347  px += (*it)->px();
1348  py += (*it)->py();
1349  pz += (*it)->pz();
1350  en += sqrt((*it)->p() * (*it)->p() + 0.14 * 0.14);
1351  }
1352 
1353  // Look for in-in tracks
1354 
1355  double en_in = 0.;
1356  double px_in = 0.;
1357  double py_in = 0.;
1358  double pz_in = 0.;
1359 
1360  for (reco::TrackRefVector::const_iterator it = pioninin.begin(); it != pioninin.end(); it++) {
1361  // std::cout<<" Track in in, size= "<<pioninin.size()<<" p= "<<(*it)->p()<<" pt= "<<(*it)->pt()
1362  // <<" eta= "<<(*it)->eta()<<" phi= "<<(*it)->phi()<<std::endl;
1363 
1364  px_in += (*it)->px();
1365  py_in += (*it)->py();
1366  pz_in += (*it)->pz();
1367  en_in += sqrt((*it)->p() * (*it)->p() + 0.14 * 0.14);
1368  }
1369 
1370  //===================================================================>
1371 
1372  //=>
1373  // double SquareEtaRingWithoutJets = 4*(M_PI*mConeSize - mConeSize*mConeSize);
1374  double SquareEtaRingWithoutJets = ja;
1375 
1376  // std::cout<<"---SquareEtaRingWithoutJets="<<SquareEtaRingWithoutJets<<std::endl;
1377 
1378  EnergyOfBackgroundCharged = EnergyOfBackgroundCharged / SquareEtaRingWithoutJets;
1379  ResponseOfBackgroundCharged = ResponseOfBackgroundCharged / SquareEtaRingWithoutJets;
1380  // NumberOfBackgroundCharged = NumberOfBackgroundCharged/SquareEtaRingWithoutJets;
1381 
1382  EnergyOfBackgroundCharged = M_PI * mConeSize * mConeSize * EnergyOfBackgroundCharged;
1383  ResponseOfBackgroundCharged = M_PI * mConeSize * mConeSize * ResponseOfBackgroundCharged;
1384  // NumberOfBackgroundCharged = M_PI*mConeSize*mConeSize*NumberOfBackgroundCharged;
1385 
1386  NewResponse = NewResponse - EnergyOfBackgroundCharged + ResponseOfBackgroundCharged;
1387 
1388  // std::cout<<"====JetPlusTrackCorrector, Old response=fJet.energy()"<<fJet.energy()
1389  // <<" EnergyOfBackgroundCharged="<<EnergyOfBackgroundCharged
1390  // <<" ResponseOfBackgroundCharged="<<ResponseOfBackgroundCharged
1391 
1392  mScale = NewResponse / fJet.energy();
1393  if (mScale < 0.)
1394  mScale = 0.;
1395  return mScale;
1396 }

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/4]

double JetPlusTrackCorrector::correction ( const P4 jet) const

Correction method (not used)

Definition at line 219 of file JetPlusTrackCorrector.cc.

219  {
220  edm::LogError("JetPlusTrackCorrector") << "JetPlusTrackCorrector can be run on entire event only";
221  return 1.;
222 }

◆ correction() [2/4]

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

Correction method (not used)

Definition at line 212 of file JetPlusTrackCorrector.cc.

212  {
213  edm::LogError("JetPlusTrackCorrector") << "JetPlusTrackCorrector can be run on entire event only";
214  return 1.;
215 }

◆ correction() [3/4]

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 433 of file JetPlusTrackCorrector.h.

440  {
441  P4 not_used_for_scalar_correction;
442  return correction(fJet, fJetcalo, event, setup, not_used_for_scalar_correction, pions, muons, elecs, validMatches);
443 }

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

◆ correction() [4/4]

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 105 of file JetPlusTrackCorrector.cc.

113  {
114  // std::cout<<" JetPlusTrackCorrector::correction "<<std::endl;
115 
118  theSumPtWithEff = 0.;
119  theSumPtWithoutEff = 0.;
120  theSumEnergyWithEff = 0.;
122  theSumPtForBeta = 0.;
123 
124  // Corrected 4-momentum for jet
125  corrected = fJet.p4();
126 
127  // Match tracks to different particle types
128  validMatches = matchTracks(fJetcalo, event, setup, pions, muons, elecs);
129  if (!validMatches) {
130  return 1.;
131  }
132 
133  // Check if jet can be JPT-corrected
134  if (!canCorrect(fJet)) {
135  return 1.;
136  }
137 
138  // std::cout<<" Jet can be corrected "<<std::endl;
139 
140  // std::cout<<" Tracks are matched "<<std::endl;
141 
142  // Debug
143  if (verbose_) {
144  edm::LogInfo("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
145  << " Applying JPT corrections...";
146  }
147 
148  // Pion corrections (both scalar and vectorial)
149  if (usePions_) {
150  corrected += pionCorrection(fJet.p4(), pions);
151  }
152 
153  // Muon corrections (both scalar and vectorial)
154  if (useMuons_) {
155  corrected += muonCorrection(fJet.p4(), muons);
156  }
157 
158  // Electrons corrections (both scalar and vectorial)
159  if (useElecs_) {
160  corrected += elecCorrection(fJet.p4(), elecs);
161  }
162 
163  // Define jet direction using total 3-momentum of tracks (overrides above)
164  if (vectorial_ && !vecResponse_) {
165  if (fabs(corrected.eta()) < 2.) {
166  corrected = jetDirFromTracks(corrected, pions, muons, elecs);
167  }
168  }
169 
170  // Check if corrected 4-momentum gives negative scale
171  double scale = checkScale(fJet.p4(), corrected);
172 
173  // Debug
174  if (verbose_) {
175  std::stringstream ss;
176  ss << "Total correction:" << std::endl
177  << std::fixed << std::setprecision(6) << " Uncorrected (Px,Py,Pz,E) : "
178  << "(" << fJet.px() << "," << fJet.py() << "," << fJet.pz() << "," << fJet.energy() << ")" << std::endl
179  << " Corrected (Px,Py,Pz,E) : "
180  << "(" << corrected.px() << "," << corrected.py() << "," << corrected.pz() << "," << corrected.energy() << ")"
181  << std::endl
182  << " Uncorrected (Pt,Eta,Phi,M) : "
183  << "(" << fJet.pt() << "," << fJet.eta() << "," << fJet.phi() << "," << fJet.mass() << ")" << std::endl
184  << " Corrected (Pt,Eta,Phi,M) : "
185  << "(" << corrected.pt() << "," << corrected.eta() << "," << corrected.phi() << "," << corrected.mass() << ")"
186  << std::endl
187  << " Scalar correction to E : " << scale << std::endl
188  << " Scalar correction to Et : " << (fJet.et() > 0. ? corrected.Et() / fJet.et() : 1.); // << std::endl
189  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
190  }
191 
192  // std::cout << " mScale= " << scale
193  // << " NewResponse " << corrected.energy()
194  // << " Jet energy " << fJet.energy()
195  // << " event " << event.id().event() << std::endl;
196 
197  /*
198  std::cout<<" Correction::Corrections for jet "<< theResponseOfChargedWithEff <<" "<<
199  theResponseOfChargedWithoutEff <<" "<<
200  theSumPtWithEff <<" "<<
201  theSumPtWithoutEff <<" "<<
202  theSumEnergyWithEff <<" "<<
203  theSumEnergyWithoutEff <<std::endl;
204 */
205 
206  // Return energy correction
207  return scale;
208 }

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(), Scenarios_cff::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 476 of file JetPlusTrackCorrector.h.

476 { 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 737 of file JetPlusTrackCorrector.cc.

737  {
738  P4 null; //@@ null 4-momentum
739 
740  if (verbose_) {
741  std::stringstream ss;
742  ss << " Electron corrections:" << std::endl
743  << " In/In : "
744  << "(" << elecs.inVertexInCalo_.size() << ") " << null.energy() << std::endl
745  << " In/Out : "
746  << "(" << elecs.inVertexOutOfCalo_.size() << ") " << null.energy() << std::endl
747  << " Out/In : "
748  << "(" << elecs.outOfVertexInCalo_.size() << ") " << null.energy();
749  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
750  }
751 
752  return null; //@@ to be implemented
753 }

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 461 of file JetPlusTrackCorrector.h.

464  {
465  return calculateCorr(jet, elecs, not_used, in_cone_at_vertex, in_cone_at_calo_face, elecMass_, false, 0.);
466 }

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

◆ eventRequired()

bool JetPlusTrackCorrector::eventRequired ( ) const
inline

Returns true.

Definition at line 445 of file JetPlusTrackCorrector.h.

445 { 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 1215 of file JetPlusTrackCorrector.cc.

1218  {
1219  //std::cout<<" NEW2" << std::endl;
1220 
1221  tracksthis = reco::JetTracksAssociation::getValue(jtV0, fJet);
1222  if (Excl.empty())
1223  return;
1224  if (jetSplitMerge_ < 0)
1225  return;
1226 
1227  TrackRefs tracks = tracksthis;
1228  tracksthis.clear();
1229 
1230  //std::cout<<" Size of initial vector "<<tracks.size()<<" "<<fJet.et()<<" "<<fJet.eta()<<" "<<fJet.phi()<<std::endl;
1231 
1232  for (TrackRefs::iterator it = tracks.begin(); it != tracks.end(); it++) {
1233  //std::cout<<" Track at calo surface "
1234  //<<" Track "<<(**it).eta()<<" "<<(**it).phi()<<std::endl;
1235  TrackRefs::iterator itold = find(Excl.begin(), Excl.end(), (*it));
1236  if (itold == Excl.end()) {
1237  tracksthis.push_back(*it);
1238  }
1239  //else { std::cout<<"Exclude "<<(**it).eta()<<" "<<(**it).phi()<<std::endl; }
1240  }
1241 
1242  //std::cout<<" Size of calo tracks "<<tracksthis.size()<<std::endl;
1243 
1244  return;
1245 }

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 PDWG_EXOHSCP_cff::tracks.

Referenced by jtaUsingEventData().

◆ failTrackQuality()

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

Check on track quality.

Definition at line 558 of file JetPlusTrackCorrector.cc.

558  {
559  // if ( useTrackQuality_ && !(*itrk)->quality(trackQuality_) ) { return true; }
560  // else { return false; }
561 
562  bool retcode = false;
563 
564  if (useTrackQuality_ && !(*itrk)->quality(trackQuality_)) {
565  retcode = true;
566  return retcode;
567  }
568  if (((*itrk)->ptError() / (*itrk)->pt()) > ptErrorQuality_) {
569  retcode = true;
570  return retcode;
571  }
572  if (fabs((*itrk)->dz(vertex_)) > dzVertexCut_) {
573  retcode = true;
574  return retcode;
575  }
576 
577  return retcode;
578 }

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 582 of file JetPlusTrackCorrector.cc.

584  {
585  it = find(jet_tracks.caloFace_.begin(), jet_tracks.caloFace_.end(), *itrk);
586  if (it != jet_tracks.caloFace_.end()) {
587  return true;
588  } else {
589  return false;
590  }
591 }

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 595 of file JetPlusTrackCorrector.cc.

598  {
599  TrackRefs::iterator ip = find(pions.inVertexInCalo_.begin(), pions.inVertexInCalo_.end(), *itrk);
600  TrackRefs::iterator im = find(muons.inVertexInCalo_.begin(), muons.inVertexInCalo_.end(), *itrk);
601  TrackRefs::iterator ie = find(elecs.inVertexInCalo_.begin(), elecs.inVertexInCalo_.end(), *itrk);
602  if (ip == pions.inVertexInCalo_.end() && im == muons.inVertexInCalo_.end() && ie == elecs.inVertexInCalo_.end()) {
603  return false;
604  } else {
605  return true;
606  }
607 }

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()

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 534 of file JetPlusTrackCorrector.cc.

536  {
537  event.getByToken(input_reco_elecs_token_, reco_elecs);
538  if (!reco_elecs.isValid() || reco_elecs.failedToGet()) {
539  edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
540  << " Invalid handle to reco::GsfElectron collection"
541  << " with InputTag (label:instance:process) \"" << electrons_.label() << ":"
542  << electrons_.instance() << ":" << electrons_.process() << "\"";
543  return false;
544  }
545  event.getByToken(input_reco_elec_ids_token_, reco_elec_ids);
546  if (!reco_elec_ids.isValid() || reco_elec_ids.failedToGet()) {
547  edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
548  << " Invalid handle to reco::GsfElectron collection"
549  << " with InputTag (label:instance:process) \"" << electronIds_.label()
550  << ":" << electronIds_.instance() << ":" << electronIds_.process() << "\"";
551  return false;
552  }
553  return true;
554 }

References electronIds_, electrons_, edm::HandleBase::failedToGet(), input_reco_elec_ids_token_, input_reco_elecs_token_, edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), and edm::InputTag::process().

Referenced by matchTracks().

◆ getMuons()

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

Get RECO muons.

Definition at line 349 of file JetPlusTrackCorrector.cc.

349  {
350  event.getByToken(inut_reco_muons_token_, reco_muons);
351  if (!reco_muons.isValid() || reco_muons.failedToGet()) {
352  edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
353  << " Invalid handle to reco::Muon collection"
354  << " with InputTag (label:instance:process) \"" << muons_.label() << ":"
355  << muons_.instance() << ":" << muons_.process() << "\"";
356  return false;
357  }
358  return true;
359 }

References edm::HandleBase::failedToGet(), edm::InputTag::instance(), inut_reco_muons_token_, edm::HandleBase::isValid(), edm::InputTag::label(), muons_, and edm::InputTag::process().

Referenced by matchTracks().

◆ getResponseOfChargedWithEff()

double JetPlusTrackCorrector::getResponseOfChargedWithEff ( )
inline

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

Definition at line 231 of file JetPlusTrackCorrector.h.

231 { return theResponseOfChargedWithEff; }

References theResponseOfChargedWithEff.

◆ getResponseOfChargedWithoutEff()

double JetPlusTrackCorrector::getResponseOfChargedWithoutEff ( )
inline

Definition at line 232 of file JetPlusTrackCorrector.h.

References theResponseOfChargedWithoutEff.

◆ getSumEnergyWithEff()

double JetPlusTrackCorrector::getSumEnergyWithEff ( )
inline

Definition at line 235 of file JetPlusTrackCorrector.h.

235 { return theSumEnergyWithEff; }

References theSumEnergyWithEff.

◆ getSumEnergyWithoutEff()

double JetPlusTrackCorrector::getSumEnergyWithoutEff ( )
inline

Definition at line 236 of file JetPlusTrackCorrector.h.

236 { return theSumEnergyWithoutEff; }

References theSumEnergyWithoutEff.

◆ getSumPtForBeta()

double JetPlusTrackCorrector::getSumPtForBeta ( )
inline

Definition at line 237 of file JetPlusTrackCorrector.h.

237 { return theSumPtForBeta; }

References theSumPtForBeta.

◆ getSumPtWithEff()

double JetPlusTrackCorrector::getSumPtWithEff ( )
inline

Definition at line 233 of file JetPlusTrackCorrector.h.

233 { return theSumPtWithEff; }

References theSumPtWithEff.

◆ getSumPtWithoutEff()

double JetPlusTrackCorrector::getSumPtWithoutEff ( )
inline

Definition at line 234 of file JetPlusTrackCorrector.h.

234 { 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 757 of file JetPlusTrackCorrector.cc.

760  {
761  // Correction to be applied to jet 4-momentum
762  P4 corr;
763 
764  // bool tracks_present = false;
765  bool tracks_present_inin = false;
766 
767  // Correct using pions in-cone at vertex
768 
769  if (!pions.inVertexInCalo_.empty()) {
771  TrackRefs::iterator jtrk = pions.inVertexInCalo_.end();
772  for (; itrk != jtrk; ++itrk) {
773  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
774  // tracks_present = true;
775  tracks_present_inin = true;
776  }
777  }
778 
779  if (!pions.inVertexOutOfCalo_.empty()) {
782  for (; itrk != jtrk; ++itrk) {
783  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
784  // tracks_present = true;
785  }
786  }
787 
788  // Correct using muons in-cone at vertex
789 
790  if (!muons.inVertexInCalo_.empty()) {
791  TrackRefs::iterator itrk = muons.inVertexInCalo_.begin();
792  TrackRefs::iterator jtrk = muons.inVertexInCalo_.end();
793  for (; itrk != jtrk; ++itrk) {
794  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
795  // tracks_present = true;
796  }
797  }
798 
799  if (!muons.inVertexOutOfCalo_.empty()) {
800  TrackRefs::iterator itrk = muons.inVertexOutOfCalo_.begin();
801  TrackRefs::iterator jtrk = muons.inVertexOutOfCalo_.end();
802  for (; itrk != jtrk; ++itrk) {
803  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
804  // tracks_present = true;
805  }
806  }
807 
808  // Correct using electrons in-cone at vertex
809 
810  if (!elecs.inVertexInCalo_.empty()) {
811  TrackRefs::iterator itrk = elecs.inVertexInCalo_.begin();
812  TrackRefs::iterator jtrk = elecs.inVertexInCalo_.end();
813  for (; itrk != jtrk; ++itrk) {
814  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
815  // tracks_present = true;
816  }
817  }
818 
819  if (!elecs.inVertexOutOfCalo_.empty()) {
820  TrackRefs::iterator itrk = elecs.inVertexOutOfCalo_.begin();
821  TrackRefs::iterator jtrk = elecs.inVertexOutOfCalo_.end();
822  for (; itrk != jtrk; ++itrk) {
823  corr += PtEtaPhiM((*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0.);
824  // tracks_present = true;
825  }
826  }
827 
828  // Adjust direction if in cone tracks are present
829 
830  if (!tracks_present_inin) {
831  corr = corrected;
832  } else {
833  corr *= (corr.P() > 0. ? corrected.P() / corr.P() : 1.);
834  corr = P4(corr.px(), corr.py(), corr.pz(), corrected.energy());
835  }
836 
837  return corr;
838 }

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 259 of file JetPlusTrackCorrector.cc.

262  {
263  // Some init
264  trks.clear();
265 
266  // Check if labels are given
267  if (!jetTracksAtVertex_.label().empty() && !jetTracksAtCalo_.label().empty()) {
268  //std::cout<<" Try to associate with splitting "<< std::endl;
269 
270  return jtaUsingEventData(fJet, event, trks);
271  } else {
272  edm::LogWarning("PatJPTCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
273  << " Empty label for the reco::JetTracksAssociation::Containers" << std::endl
274  << " InputTag for JTA \"at vertex\" (label:instance:process) \""
275  << jetTracksAtVertex_.label() << ":" << jetTracksAtVertex_.instance() << ":"
276  << jetTracksAtVertex_.process() << "\"" << std::endl
277  << " InputTag for JTA \"at calo face\" (label:instance:process) \""
278  << jetTracksAtCalo_.label() << ":" << jetTracksAtCalo_.instance() << ":"
279  << jetTracksAtCalo_.process() << "\"";
280  return false;
281  }
282 }

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 286 of file JetPlusTrackCorrector.cc.

286  {
287  // Get Jet-track association at Vertex
289  event.getByToken(input_jetTracksAtVertex_token_, jetTracksAtVertex);
290 
291  if (!jetTracksAtVertex.isValid() || jetTracksAtVertex.failedToGet()) {
292  if (verbose_ && edm::isDebugEnabled()) {
293  edm::LogWarning("JetPlusTrackCorrector")
294  << "[JetPlusTrackCorrector::" << __func__ << "]"
295  << " Invalid handle to reco::JetTracksAssociation::Container (for Vertex)"
296  << " with InputTag (label:instance:process) \"" << jetTracksAtVertex_.label() << ":"
297  << jetTracksAtVertex_.instance() << ":" << jetTracksAtVertex_.process() << "\"";
298  }
299  return false;
300  }
301 
302  // std::cout<<" JetPlusTrackCorrector::jtaUsingEventData::here "<<jetSplitMerge_<<std::endl;
303 
304  // Retrieve jet-tracks association for given jet
305  const reco::JetTracksAssociation::Container jtV = *(jetTracksAtVertex.product());
306  TrackRefs excluded;
307  if (jetSplitMerge_ < 0) {
308  trks.vertex_ = reco::JetTracksAssociation::getValue(jtV, fJet);
309  } else {
310  rebuildJta(fJet, jtV, trks.vertex_, excluded);
311  }
312 
313  // Check if any tracks are associated to jet at vertex
314  if (trks.vertex_.empty()) {
315  return false;
316  }
317 
318  // Get Jet-track association at Calo
320  event.getByToken(input_jetTracksAtCalo_token_, jetTracksAtCalo);
321 
322  if (!jetTracksAtCalo.isValid() || jetTracksAtCalo.failedToGet()) {
323  if (verbose_ && edm::isDebugEnabled()) {
324  edm::LogWarning("JetPlusTrackCorrector")
325  << "[JetPlusTrackCorrector::" << __func__ << "]"
326  << " Invalid handle to reco::JetTracksAssociation::Container (for CaloFace)"
327  << " with InputTag (label:instance:process) \"" << jetTracksAtCalo_.label() << ":"
328  << jetTracksAtCalo_.instance() << ":" << jetTracksAtCalo_.process() << "\"";
329  }
330  return false;
331  }
332 
333  // Retrieve jet-tracks association for given jet
334  const reco::JetTracksAssociation::Container jtC = *(jetTracksAtCalo.product());
335  if (jetSplitMerge_ < 0) {
336  trks.caloFace_ = reco::JetTracksAssociation::getValue(jtC, fJet);
337  } else {
338  excludeJta(fJet, jtC, trks.caloFace_, excluded);
339  }
340 
341  // std::cout<<" JTA:Tracks in vertex "<<trks.vertex_.size()<<" in calo "<<trks.caloFace_.size()<<std::endl;
342 
343  // Successful
344  return true;
345 }

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 477 of file JetPlusTrackCorrector.h.

477 { return leakage_; }

References leakage_.

Referenced by pionCorrection().

◆ matchElectrons()

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 1099 of file JetPlusTrackCorrector.cc.

1101  {
1102  if (elecs->empty()) {
1103  return false;
1104  }
1105 
1106  double deltaR = 999.;
1107  double deltaRMIN = 999.;
1108 
1109  uint32_t electron_index = 0;
1110  RecoElectrons::const_iterator ielec = elecs->begin();
1111  RecoElectrons::const_iterator jelec = elecs->end();
1112  for (; ielec != jelec; ++ielec) {
1113  edm::Ref<RecoElectrons> electron_ref(elecs, electron_index);
1114  electron_index++;
1115 
1116  if ((*elec_ids)[electron_ref] < 1.e-6) {
1117  continue;
1118  } //@@ Check for null value
1119 
1120  // DR matching b/w electron and track
1121  double deltaphi = fabs(ielec->phi() - (*itrk)->momentum().phi());
1122  if (deltaphi > 6.283185308)
1123  deltaphi -= 6.283185308;
1124  if (deltaphi > 3.141592654)
1125  deltaphi = 6.283185308 - deltaphi;
1126  deltaR = abs(sqrt(pow((ielec->eta() - (*itrk)->momentum().eta()), 2) + pow(deltaphi, 2)));
1127  if (deltaR < deltaRMIN) {
1128  deltaRMIN = deltaR;
1129  }
1130  }
1131 
1132  if (deltaR < 0.02)
1133  return true;
1134  else
1135  return false;
1136 }

References funct::abs(), PbPb_ZMuSkimMuonDPG_cff::deltaR, MillePedeFileConverter_cfg::e, singleTopDQM_cfi::elecs, funct::pow(), and mathSSE::sqrt().

Referenced by matchTracks().

◆ matchMuons()

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

Matches tracks to RECO muons.

Definition at line 1067 of file JetPlusTrackCorrector.cc.

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

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

Referenced by matchTracks().

◆ matchTracks() [1/2]

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 363 of file JetPlusTrackCorrector.cc.

367  {
368  // Some init
369  pions.clear();
370  muons.clear();
371  elecs.clear();
372 
373  // Need vertex for track cleaning
374 
375  vertex_ = reco::Particle::Point(0, 0, 0);
377  event.getByToken(input_pvCollection_token_, pvCollection);
378  if (pvCollection.isValid() && !pvCollection->empty())
379  vertex_ = pvCollection->begin()->position();
380 
381  // Get RECO muons
382  edm::Handle<RecoMuons> reco_muons;
383  bool found_reco_muons = true;
384  if (useMuons_) {
385  getMuons(event, reco_muons);
386  }
387 
388  // Get RECO electrons and their ids
389  edm::Handle<RecoElectrons> reco_elecs;
390  edm::Handle<RecoElectronIds> reco_elec_ids;
391  bool found_reco_elecs = true;
392  if (useElecs_) {
393  getElectrons(event, reco_elecs, reco_elec_ids);
394  }
395 
396  // Check RECO products found
397  if (!found_reco_muons || !found_reco_elecs) {
398  edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]"
399  << " Unable to access RECO collections for muons and electrons";
400  return;
401  }
402 
403  // Identify pions/muons/electrons that are "in/in" and "in/out"
404  {
405  TrackRefs::const_iterator itrk = jet_tracks.vertex_.begin();
406  TrackRefs::const_iterator jtrk = jet_tracks.vertex_.end();
407 
408  // std::cout<<" Print theSumPtForBeta "<<theSumPtForBeta<<std::endl;
409 
410  double theSumPtForBetaOld = theSumPtForBeta;
411 
412  for (; itrk != jtrk; ++itrk) {
413  if (useTrackQuality_ && (*itrk)->quality(trackQuality_) && theSumPtForBetaOld <= 0.)
414  theSumPtForBeta += (**itrk).pt();
415  //
416  // Track either belongs to PV or do not belong to any vertex
417 
418  const reco::TrackBaseRef ttr1(*itrk);
419 
420  // std::cout<<" Size of PV "<<pvCollection->size()<<std::endl;
421 
422  int numpv = 0;
423 
424  int itrack_belong = -1;
425 
426  for (reco::VertexCollection::const_iterator iv = pvCollection->begin(); iv != pvCollection->end(); iv++) {
427  numpv++;
428  std::vector<reco::TrackBaseRef>::const_iterator rr = find((*iv).tracks_begin(), (*iv).tracks_end(), ttr1);
429  if (rr != (*iv).tracks_end()) {
430  itrack_belong++;
431  // std::cout<<" Numpv "<<numpv<<std::endl;
432  break;
433  }
434 
435  } // all vertices
436 
437  // std::cout<<" Track in PV "<<itrack_belong<<" "<<numpv<<std::endl;
438 
439  if (numpv > 1 && itrack_belong == 0) {
440  // std::cout<<" Drop track "<<std::endl;
441  continue;
442  }
443 
444  // std::cout<<" we take it "<<numpv<<" "<<itrack_belong<<std::endl;
445 
446  if (failTrackQuality(itrk)) {
447  continue;
448  }
449 
450  // std::cout<<" Track accepted "<<std::endl;
451 
452  TrackRefs::iterator it = jet_tracks.caloFace_.end();
453  bool found = findTrack(jet_tracks, itrk, it);
454 
455  // std::cout<<"JetPlusTrackCorrector::matchTracks: jet_tracks.caloFace_.size()="<<jet_tracks.caloFace_.size()
456  // <<" found = "<<found<<std::endl;
457 
458  bool is_muon = useMuons_ && matchMuons(itrk, reco_muons);
459  bool is_ele = useElecs_ && matchElectrons(itrk, reco_elecs, reco_elec_ids);
460 
461  if (found) {
462  if (is_muon) {
463  muons.inVertexInCalo_.push_back(*it);
464  } else if (is_ele) {
465  elecs.inVertexInCalo_.push_back(*it);
466  } else {
467  pions.inVertexInCalo_.push_back(*it);
468  }
469  } else {
470  if (is_muon) {
471  muons.inVertexOutOfCalo_.push_back(*itrk);
472  } else if (is_ele) {
473  elecs.inVertexOutOfCalo_.push_back(*itrk);
474  } else {
475  pions.inVertexOutOfCalo_.push_back(*itrk);
476  // std::cout<<"JetPlusTrackCorrector::matchTracks: pions.inVertexOutOfCalo_.push_back(*itrk), size="
477  // <<pions.inVertexOutOfCalo_.size() <<std::endl;
478  }
479  }
480  }
481  }
482 
483  // Identify pions/muons/electrons that are "out/in"
484  {
485  TrackRefs::iterator itrk = jet_tracks.caloFace_.begin();
486  TrackRefs::iterator jtrk = jet_tracks.caloFace_.end();
487  for (; itrk != jtrk; ++itrk) {
488  if (failTrackQuality(itrk)) {
489  continue;
490  }
491 
492  if (!tracksInCalo(pions, muons, elecs)) {
493  continue;
494  }
495 
496  bool found = findTrack(pions, muons, elecs, itrk);
497 
498  if (!found) {
499  bool is_muon = useMuons_ && matchMuons(itrk, reco_muons);
500  bool is_ele = useElecs_ && matchElectrons(itrk, reco_elecs, reco_elec_ids);
501 
502  if (is_muon) {
503  muons.outOfVertexInCalo_.push_back(*itrk);
504  } else if (is_ele) {
505  elecs.outOfVertexInCalo_.push_back(*itrk);
506  } else {
507  pions.outOfVertexInCalo_.push_back(*itrk);
508  }
509  }
510  }
511  }
512 
513  if (verbose_ && edm::isDebugEnabled()) {
514  std::stringstream ss;
515  ss << "[JetPlusTrackCorrector::" << __func__ << "] Number of tracks:" << std::endl
516  << " In-cone at Vertex and in-cone at CaloFace:" << std::endl
517  << " Pions : " << pions.inVertexInCalo_.size() << std::endl
518  << " Muons : " << muons.inVertexInCalo_.size() << std::endl
519  << " Electrons : " << elecs.inVertexInCalo_.size() << std::endl
520  << " In-cone at Vertex and out-of-cone at CaloFace:" << std::endl
521  << " Pions : " << pions.inVertexOutOfCalo_.size() << std::endl
522  << " Muons : " << muons.inVertexOutOfCalo_.size() << std::endl
523  << " Electrons : " << elecs.inVertexOutOfCalo_.size() << std::endl
524  << " Out-of-cone at Vertex and in-cone at CaloFace:" << std::endl
525  << " Pions : " << pions.outOfVertexInCalo_.size() << std::endl
526  << " Muons : " << muons.outOfVertexInCalo_.size() << std::endl
527  << " Electrons : " << elecs.outOfVertexInCalo_.size() << std::endl;
528  LogTrace("JetPlusTrackCorrector") << ss.str();
529  }
530 }

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(), 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_, useTrackQuality_, verbose_, jpt::JetTracks::vertex_, and vertex_.

◆ matchTracks() [2/2]

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 226 of file JetPlusTrackCorrector.cc.

231  {
232  // Associate tracks to jet at both the Vertex and CaloFace
233  JetTracks jet_tracks;
234  bool ok = jetTrackAssociation(fJet, event, setup, jet_tracks);
235 
236  // std::cout<<"JetPlusTrackCorrector::matchTracks, JetTrackAssociation ok="<<ok<<std::endl;
237 
238  if (!ok) {
239  return false;
240  }
241 
242  // Track collections propagated to Vertex and CaloFace for "pions", muons and electrons
243  matchTracks(jet_tracks, event, pions, muons, elecs);
244 
245  // Debug
246  if (verbose_) {
247  std::stringstream ss;
248  ss << "Number of tracks:" << std::endl
249  << " In-cone at Vertex : " << jet_tracks.vertex_.size() << std::endl
250  << " In-cone at CaloFace : " << jet_tracks.caloFace_.size();
251  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
252  }
253 
254  return true;
255 }

References jpt::JetTracks::caloFace_, singleTopDQM_cfi::elecs, jetTrackAssociation(), matchTracks(), 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(), and matchTracks().

◆ muonCorrection() [1/2]

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

Calculates correction to be applied using muons.

Definition at line 698 of file JetPlusTrackCorrector.cc.

698  {
699  P4 corr_muons;
700 
701  P4 corr_muons_in_cone;
702  P4 corr_muons_out_of_cone;
703  P4 corr_muons_out_of_vertex;
704 
705  if (useInConeTracks_) {
706  corr_muons_in_cone = muonCorrection(jet, muons.inVertexInCalo_, true, true);
707  corr_muons += corr_muons_in_cone;
708  }
709 
710  if (useOutOfConeTracks_) {
711  corr_muons_out_of_cone = muonCorrection(jet, muons.inVertexOutOfCalo_, true, false);
712  corr_muons += corr_muons_out_of_cone;
713  }
714 
715  if (useOutOfVertexTracks_) {
716  corr_muons_out_of_vertex = muonCorrection(jet, muons.outOfVertexInCalo_, false, true);
717  corr_muons += corr_muons_out_of_vertex;
718  }
719 
720  if (verbose_) {
721  std::stringstream ss;
722  ss << " Muon corrections:" << std::endl
723  << " In/In : "
724  << "(" << muons.inVertexInCalo_.size() << ") " << corr_muons_in_cone.energy() << std::endl
725  << " In/Out : "
726  << "(" << muons.inVertexOutOfCalo_.size() << ") " << corr_muons_out_of_cone.energy() << std::endl
727  << " Out/In : "
728  << "(" << muons.outOfVertexInCalo_.size() << ") " << corr_muons_out_of_vertex.energy();
729  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
730  }
731 
732  return corr_muons;
733 }

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 454 of file JetPlusTrackCorrector.h.

457  {
458  return calculateCorr(jet, muons, not_used, in_cone_at_vertex, in_cone_at_calo_face, muonMass_, false, 2.);
459 }

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 623 of file JetPlusTrackCorrector.cc.

623  {
624  P4 corr_pions;
625  /*
626  std::cout<<" pionCorrection::Corrections for jet "<< theResponseOfChargedWithEff <<" "<<
627  theResponseOfChargedWithoutEff <<" "<<
628  theSumPtWithEff <<" "<<
629  theSumPtWithoutEff <<" "<<
630  theSumEnergyWithEff <<" "<<
631  theSumEnergyWithoutEff <<std::endl;
632 */
633 
634  // In-cone
635 
636  P4 corr_pions_in_cone;
637  P4 corr_pions_eff_in_cone;
639 
640  if (useInConeTracks_) {
641  corr_pions_in_cone = pionCorrection(jet, pions.inVertexInCalo_, in_cone, true, true);
642  corr_pions += corr_pions_in_cone;
643  if (useEff_) {
644  corr_pions_eff_in_cone = pionEfficiency(jet, in_cone, true);
645  corr_pions += corr_pions_eff_in_cone;
646  }
647  }
648 
649  // Out-of-cone
650 
651  P4 corr_pions_out_of_cone;
652  P4 corr_pions_eff_out_of_cone;
653  Efficiency out_of_cone(responseMap(), efficiencyMap(), leakageMap());
654 
655  if (useOutOfConeTracks_) {
656  corr_pions_out_of_cone = pionCorrection(jet, pions.inVertexOutOfCalo_, out_of_cone, true, false);
657  corr_pions += corr_pions_out_of_cone;
658  if (useEff_) {
659  corr_pions_eff_out_of_cone = pionEfficiency(jet, out_of_cone, false);
660  corr_pions += corr_pions_eff_out_of_cone;
661  }
662  }
663 
664  // Out-of-vertex
665 
666  P4 corr_pions_out_of_vertex;
668 
669  if (useOutOfVertexTracks_) {
670  corr_pions_out_of_vertex = pionCorrection(jet, pions.outOfVertexInCalo_, not_used, false, true);
671  corr_pions += corr_pions_out_of_vertex;
672  }
673 
674  if (verbose_) {
675  std::stringstream ss;
676  ss << " Pion corrections:" << std::endl
677  << " In/In : "
678  << "(" << pions.inVertexInCalo_.size() << ") " << corr_pions_in_cone.energy() << std::endl
679  << " In/Out : "
680  << "(" << pions.inVertexOutOfCalo_.size() << ") " << corr_pions_out_of_cone.energy() << std::endl
681  << " Out/In : "
682  << "(" << pions.outOfVertexInCalo_.size() << ") " << corr_pions_out_of_vertex.energy() << std::endl;
683  if (useEff_) {
684  ss << " Pion efficiency corrections:" << std::endl
685  << " In/In : "
686  << "(" << pions.inVertexInCalo_.size() << ") " << corr_pions_eff_in_cone.energy() << std::endl
687  << " In/Out : "
688  << "(" << pions.inVertexOutOfCalo_.size() << ") " << corr_pions_eff_out_of_cone.energy();
689  }
690  edm::LogVerbatim("JetPlusTrackCorrector") << ss.str();
691  }
692 
693  return corr_pions;
694 }

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 449 of file JetPlusTrackCorrector.h.

450  {
451  return calculateCorr(jet, pions, eff, in_cone_at_vertex, in_cone_at_calo_face, pionMass_, true, -1.);
452 }

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 995 of file JetPlusTrackCorrector.cc.

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

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 1140 of file JetPlusTrackCorrector.cc.

1143  {
1144  // std::cout<<" NEW1 Merge/Split schema "<<jetSplitMerge_<<std::endl;
1145 
1146  tracksthis = reco::JetTracksAssociation::getValue(jtV0, fJet);
1147 
1148  if (jetSplitMerge_ < 0)
1149  return;
1150 
1151  typedef std::vector<reco::JetBaseRef>::iterator JetBaseRefIterator;
1152  std::vector<reco::JetBaseRef> theJets = reco::JetTracksAssociation::allJets(jtV0);
1153 
1154  TrackRefs tracks = tracksthis;
1155  tracksthis.clear();
1156 
1157  // std::cout<<" Size of initial vector "<<tracks.size()<<" "<<fJet.et()<<" "<<fJet.eta()<<" "<<fJet.phi()<<std::endl;
1158 
1159  int tr = 0;
1160 
1161  double jetEta = fJet.eta();
1162  double jetPhi = fJet.phi();
1163  double jetEtIn = 1.0 / fJet.et();
1164 
1165  for (TrackRefs::iterator it = tracks.begin(); it != tracks.end(); it++) {
1166  double trkEta = (**it).eta();
1167  double trkPhi = (**it).phi();
1168  double dR2this = deltaR2(jetEta, jetPhi, trkEta, trkPhi);
1169  // double dfi = fabs(fJet.phi()-(**it).phi());
1170  // if(dfi>4.*atan(1.))dfi = 8.*atan(1.)-dfi;
1171  // double deta = fJet.eta() - (**it).eta();
1172  // double dR2check = sqrt(dfi*dfi+deta*deta);
1173 
1174  double scalethis = dR2this;
1175  if (jetSplitMerge_ == 0)
1176  scalethis = 1. * jetEtIn;
1177  if (jetSplitMerge_ == 2)
1178  scalethis = dR2this * jetEtIn;
1179  tr++;
1180  int flag = 1;
1181  for (JetBaseRefIterator ii = theJets.begin(); ii != theJets.end(); ii++) {
1182  if (&(**ii) == &fJet) {
1183  continue;
1184  }
1185  double dR2 = deltaR2((*ii)->eta(), (*ii)->phi(), trkEta, trkPhi);
1186  double scale = dR2;
1187  if (jetSplitMerge_ == 0)
1188  scale = 1. / (**ii).et();
1189  if (jetSplitMerge_ == 2)
1190  scale = dR2 / (**ii).et();
1191  if (scale < scalethis)
1192  flag = 0;
1193 
1194  if (flag == 0) {
1195  //std::cout<<" Track belong to another jet also "<<dR2<<" "<<
1196  //(*ii)->et()<<" "<<(*ii)->eta()<<" "<< (*ii)->phi()<<" Track "<<(**it).eta()<<" "<<(**it).phi()<<" "<<scalethis<<" "<<scale<<" "<<flag<<std::endl;
1197  break;
1198  }
1199  }
1200 
1201  //std::cout<<" Track "<<tr<<" "<<flag<<" "<<dR2this<<" "<<dR2check<<" Jet "<<fJet.eta()<<" "<< fJet.phi()<<" Track "<<(**it).eta()<<" "<<(**it).phi()<<std::endl;
1202  if (flag == 1) {
1203  tracksthis.push_back(*it);
1204  } else {
1205  Excl.push_back(*it);
1206  }
1207  }
1208 
1209  //std::cout<<" The new size of tracks "<<tracksthis.size()<<" Excludede "<<Excl.size()<<std::endl;
1210  return;
1211 }

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(), Scenarios_cff::scale, and PDWG_EXOHSCP_cff::tracks.

Referenced by jtaUsingEventData().

◆ responseMap()

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

Definition at line 475 of file JetPlusTrackCorrector.h.

475 { 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 611 of file JetPlusTrackCorrector.cc.

613  {
614  if (!pions.inVertexInCalo_.empty() || !muons.inVertexInCalo_.empty() || !elecs.inVertexInCalo_.empty()) {
615  return true;
616  } else {
617  return false;
618  }
619 }

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 446 of file JetPlusTrackCorrector.h.

446 { return vectorial_; }

References vectorial_.

Member Data Documentation

◆ dzVertexCut_

double JetPlusTrackCorrector::dzVertexCut_
protected

Definition at line 388 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality().

◆ efficiency_

const jpt::Map JetPlusTrackCorrector::efficiency_
protected

Definition at line 401 of file JetPlusTrackCorrector.h.

Referenced by correctAA(), and efficiencyMap().

◆ elecMass_

double JetPlusTrackCorrector::elecMass_
protected

Definition at line 407 of file JetPlusTrackCorrector.h.

Referenced by elecCorrection().

◆ electronIds_

edm::InputTag JetPlusTrackCorrector::electronIds_
protected

Definition at line 394 of file JetPlusTrackCorrector.h.

Referenced by getElectrons(), and JetPlusTrackCorrector().

◆ electrons_

edm::InputTag JetPlusTrackCorrector::electrons_
protected

Definition at line 393 of file JetPlusTrackCorrector.h.

Referenced by getElectrons(), and JetPlusTrackCorrector().

◆ input_jetTracksAtCalo_token_

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

Definition at line 424 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 423 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), and jtaUsingEventData().

◆ input_pvCollection_token_

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

Definition at line 426 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 428 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 427 of file JetPlusTrackCorrector.h.

Referenced by getElectrons(), and JetPlusTrackCorrector().

◆ inut_reco_muons_token_

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

Definition at line 425 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 402 of file JetPlusTrackCorrector.h.

Referenced by leakageMap().

◆ maxEta_

double JetPlusTrackCorrector::maxEta_
protected

Definition at line 410 of file JetPlusTrackCorrector.h.

Referenced by canCorrect().

◆ muonMass_

double JetPlusTrackCorrector::muonMass_
protected

Definition at line 406 of file JetPlusTrackCorrector.h.

Referenced by muonCorrection().

◆ muons_

edm::InputTag JetPlusTrackCorrector::muons_
protected

Definition at line 392 of file JetPlusTrackCorrector.h.

Referenced by getMuons(), and JetPlusTrackCorrector().

◆ not_used

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

Definition at line 418 of file JetPlusTrackCorrector.h.

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

◆ pionMass_

double JetPlusTrackCorrector::pionMass_
protected

Definition at line 405 of file JetPlusTrackCorrector.h.

Referenced by pionCorrection(), and pionEfficiency().

◆ ptErrorQuality_

double JetPlusTrackCorrector::ptErrorQuality_
protected

Definition at line 387 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality().

◆ response_

const jpt::Map JetPlusTrackCorrector::response_
protected

Definition at line 400 of file JetPlusTrackCorrector.h.

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

◆ srcPVs_

edm::InputTag JetPlusTrackCorrector::srcPVs_
protected

Definition at line 386 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 416 of file JetPlusTrackCorrector.h.

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

◆ theSumPtForBeta

float JetPlusTrackCorrector::theSumPtForBeta
protected

Definition at line 417 of file JetPlusTrackCorrector.h.

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

◆ theSumPtWithEff

float JetPlusTrackCorrector::theSumPtWithEff
protected

◆ theSumPtWithoutEff

float JetPlusTrackCorrector::theSumPtWithoutEff
protected

Definition at line 414 of file JetPlusTrackCorrector.h.

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

◆ trackQuality_

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

Definition at line 397 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality(), and matchTracks().

◆ useEff_

bool JetPlusTrackCorrector::useEff_
protected

Definition at line 377 of file JetPlusTrackCorrector.h.

Referenced by JetPlusTrackCorrector(), and pionCorrection().

◆ useElecs_

bool JetPlusTrackCorrector::useElecs_
protected

Definition at line 379 of file JetPlusTrackCorrector.h.

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

◆ useInConeTracks_

bool JetPlusTrackCorrector::useInConeTracks_
protected

Definition at line 373 of file JetPlusTrackCorrector.h.

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

◆ useMuons_

bool JetPlusTrackCorrector::useMuons_
protected

Definition at line 378 of file JetPlusTrackCorrector.h.

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

◆ useOutOfConeTracks_

bool JetPlusTrackCorrector::useOutOfConeTracks_
protected

Definition at line 374 of file JetPlusTrackCorrector.h.

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

◆ useOutOfVertexTracks_

bool JetPlusTrackCorrector::useOutOfVertexTracks_
protected

Definition at line 375 of file JetPlusTrackCorrector.h.

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

◆ usePions_

bool JetPlusTrackCorrector::usePions_
protected

Definition at line 376 of file JetPlusTrackCorrector.h.

Referenced by correction(), and JetPlusTrackCorrector().

◆ useTrackQuality_

bool JetPlusTrackCorrector::useTrackQuality_
protected

Definition at line 380 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 389 of file JetPlusTrackCorrector.h.

Referenced by failTrackQuality(), and matchTracks().

JetPlusTrackCorrector::useOutOfVertexTracks_
bool useOutOfVertexTracks_
Definition: JetPlusTrackCorrector.h:375
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:757
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:611
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
JetPlusTrackCorrector::response_
const jpt::Map response_
Definition: JetPlusTrackCorrector.h:400
JetPlusTrackCorrector::dzVertexCut_
double dzVertexCut_
Definition: JetPlusTrackCorrector.h:388
JetPlusTrackCorrector::input_jetTracksAtCalo_token_
edm::EDGetTokenT< reco::JetTracksAssociation::Container > input_jetTracksAtCalo_token_
Definition: JetPlusTrackCorrector.h:424
jpt::Efficiency::nTrks
uint16_t nTrks(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1664
JetPlusTrackCorrector::useInConeTracks_
bool useInConeTracks_
Definition: JetPlusTrackCorrector.h:373
JetPlusTrackCorrector::findTrack
bool findTrack(const jpt::JetTracks &, TrackRefs::const_iterator &, TrackRefs::iterator &) const
Find track in JetTracks collection.
Definition: JetPlusTrackCorrector.cc:582
JetPlusTrackCorrector::muons_
edm::InputTag muons_
Definition: JetPlusTrackCorrector.h:392
edm::Handle::product
T const * product() const
Definition: Handle.h:70
jpt::Map::nEtaBins
uint32_t nEtaBins() const
Definition: JetPlusTrackCorrector.h:82
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
JetPlusTrackCorrector::RecoMuons
reco::MuonCollection RecoMuons
Get reponses.
Definition: JetPlusTrackCorrector.h:271
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:842
JetPlusTrackCorrector::inut_reco_muons_token_
edm::EDGetTokenT< RecoMuons > inut_reco_muons_token_
Definition: JetPlusTrackCorrector.h:425
JetPlusTrackCorrector::rebuildJta
void rebuildJta(const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, TrackRefs &excluded) const
Rebuild jet-track association.
Definition: JetPlusTrackCorrector.cc:1140
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
jpt::MatchedTracks::inVertexOutOfCalo_
reco::TrackRefVector inVertexOutOfCalo_
Definition: JetPlusTrackCorrector.h:148
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:428
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
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:468
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
edm::LogInfo
Definition: MessageLogger.h:254
JetPlusTrackCorrector::jetTracksAtCalo_
edm::InputTag jetTracksAtCalo_
Definition: JetPlusTrackCorrector.h:384
jpt::Efficiency
Generic container class.
Definition: JetPlusTrackCorrector.h:86
JetPlusTrackCorrector::useTrackQuality_
bool useTrackQuality_
Definition: JetPlusTrackCorrector.h:380
jpt::Efficiency::outOfConeCorr
double outOfConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1648
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:226
muon::TMLastStationTight
Definition: MuonSelectors.h:28
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
jpt::MatchedTracks::inVertexInCalo_
reco::TrackRefVector inVertexInCalo_
Definition: JetPlusTrackCorrector.h:146
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:995
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:411
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:105
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:664
jpt::Efficiency::reset
void reset()
Definition: JetPlusTrackCorrector.cc:1723
jpt::Map::binCenterPt
double binCenterPt(uint32_t) const
Definition: JetPlusTrackCorrector.cc:1527
jpt::Map::ptBin
uint32_t ptBin(double pt) const
Definition: JetPlusTrackCorrector.cc:1554
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:423
jpt::Map::nPtBins
uint32_t nPtBins() const
Definition: JetPlusTrackCorrector.h:83
JetPlusTrackCorrector::theResponseOfChargedWithoutEff
float theResponseOfChargedWithoutEff
Definition: JetPlusTrackCorrector.h:412
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:69
JetPlusTrackCorrector::useMuons_
bool useMuons_
Definition: JetPlusTrackCorrector.h:378
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:286
JetPlusTrackCorrector::responseMap
const jpt::Map & responseMap() const
Definition: JetPlusTrackCorrector.h:475
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
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::P4
math::XYZTLorentzVector P4
Definition: JetPlusTrackCorrector.h:179
jpt::MatchedTracks::clear
void clear()
Definition: JetPlusTrackCorrector.cc:1608
JetPlusTrackCorrector::jetSplitMerge_
int jetSplitMerge_
Definition: JetPlusTrackCorrector.h:385
JetPlusTrackCorrector::matchMuons
bool matchMuons(TrackRefs::const_iterator &, const edm::Handle< RecoMuons > &) const
Matches tracks to RECO muons.
Definition: JetPlusTrackCorrector.cc:1067
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
JetPlusTrackCorrector::maxEta_
double maxEta_
Definition: JetPlusTrackCorrector.h:410
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
jpt::Map
Container class for response & efficiency maps.
Definition: JetPlusTrackCorrector.h:40
edm::AssociationVector
Definition: AssociationVector.h:67
JetPlusTrackCorrector::canCorrect
bool canCorrect(const reco::Jet &) const
Can jet be JPT-corrected?
Definition: JetPlusTrackCorrector.h:447
JetPlusTrackCorrector::srcPVs_
edm::InputTag srcPVs_
Definition: JetPlusTrackCorrector.h:386
edm::LogWarning
Definition: MessageLogger.h:141
JetPlusTrackCorrector::electronIds_
edm::InputTag electronIds_
Definition: JetPlusTrackCorrector.h:394
JetPlusTrackCorrector::pionMass_
double pionMass_
Definition: JetPlusTrackCorrector.h:405
JetPlusTrackCorrector::failTrackQuality
bool failTrackQuality(TrackRefs::const_iterator &) const
Check on track quality.
Definition: JetPlusTrackCorrector.cc:558
reco::btau::jetPhi
Definition: TaggingVariable.h:36
JetPlusTrackCorrector::useEff_
bool useEff_
Definition: JetPlusTrackCorrector.h:377
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
reco::btau::jetEta
Definition: TaggingVariable.h:34
JetPlusTrackCorrector::theSumPtWithEff
float theSumPtWithEff
Definition: JetPlusTrackCorrector.h:413
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:259
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
jpt::Map::value
double value(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1566
JetPlusTrackCorrector::RecoElectrons
reco::GsfElectronCollection RecoElectrons
Definition: JetPlusTrackCorrector.h:272
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
JetPlusTrackCorrector::verbose_
bool verbose_
Definition: JetPlusTrackCorrector.h:370
JetPlusTrackCorrector::muonMass_
double muonMass_
Definition: JetPlusTrackCorrector.h:406
JetPlusTrackCorrector::vectorial_
bool vectorial_
Definition: JetPlusTrackCorrector.h:371
JetPlusTrackCorrector::usePions_
bool usePions_
Definition: JetPlusTrackCorrector.h:376
jpt::Map::binCenterEta
double binCenterEta(uint32_t) const
Definition: JetPlusTrackCorrector.cc:1512
JetPlusTrackCorrector::pionCorrection
P4 pionCorrection(const P4 &jet, const jpt::MatchedTracks &pions)
Calculates corrections to be applied using pions.
Definition: JetPlusTrackCorrector.cc:623
JetPlusTrackCorrector::ptErrorQuality_
double ptErrorQuality_
Definition: JetPlusTrackCorrector.h:387
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:1099
jpt::Map::etaBin
uint32_t etaBin(double eta) const
Definition: JetPlusTrackCorrector.cc:1542
jpt::JetTracks::vertex_
reco::TrackRefVector vertex_
Definition: JetPlusTrackCorrector.h:136
JetPlusTrackCorrector::theSumEnergyWithoutEff
float theSumEnergyWithoutEff
Definition: JetPlusTrackCorrector.h:416
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
edm::LogVerbatim
Definition: MessageLogger.h:297
JetPlusTrackCorrector::useOutOfConeTracks_
bool useOutOfConeTracks_
Definition: JetPlusTrackCorrector.h:374
JetPlusTrackCorrector::elecMass_
double elecMass_
Definition: JetPlusTrackCorrector.h:407
JetPlusTrackCorrector::theSumPtWithoutEff
float theSumPtWithoutEff
Definition: JetPlusTrackCorrector.h:414
JetPlusTrackCorrector::theSumEnergyWithEff
float theSumEnergyWithEff
Definition: JetPlusTrackCorrector.h:415
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:393
jpt::Efficiency::addE
void addE(uint32_t eta_bin, uint32_t pt_bin, double energy)
Definition: JetPlusTrackCorrector.cc:1699
JetPlusTrackCorrector::input_reco_elecs_token_
edm::EDGetTokenT< RecoElectrons > input_reco_elecs_token_
Definition: JetPlusTrackCorrector.h:427
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
jpt::JetTracks::caloFace_
reco::TrackRefVector caloFace_
Definition: JetPlusTrackCorrector.h:137
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::getElectrons
bool getElectrons(const edm::Event &, edm::Handle< RecoElectrons > &, edm::Handle< RecoElectronIds > &) const
Get RECO electrons.
Definition: JetPlusTrackCorrector.cc:534
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:147
JetPlusTrackCorrector::input_pvCollection_token_
edm::EDGetTokenT< reco::VertexCollection > input_pvCollection_token_
Definition: JetPlusTrackCorrector.h:426
JetPlusTrackCorrector::not_used
jpt::Efficiency not_used
Definition: JetPlusTrackCorrector.h:418
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:1638
JetPlusTrackCorrector::TrackRefs
reco::TrackRefVector TrackRefs
Definition: JetPlusTrackCorrector.h:275
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
metsig::jet
Definition: SignAlgoResolutions.h:47
JetPlusTrackCorrector::vecResponse_
bool vecResponse_
Definition: JetPlusTrackCorrector.h:372
edm::RefVectorIterator
Definition: EDProductfwd.h:33
JetPlusTrackCorrector::useElecs_
bool useElecs_
Definition: JetPlusTrackCorrector.h:379
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:131
JetPlusTrackCorrector::elecCorrection
P4 elecCorrection(const P4 &jet, const jpt::MatchedTracks &elecs) const
Calculates correction to be applied using electrons.
Definition: JetPlusTrackCorrector.cc:737
JetPlusTrackCorrector::efficiency_
const jpt::Map efficiency_
Definition: JetPlusTrackCorrector.h:401
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:397
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:71
JetPlusTrackCorrector::jetTracksAtVertex_
edm::InputTag jetTracksAtVertex_
Definition: JetPlusTrackCorrector.h:383
JetPlusTrackCorrector::leakageMap
const jpt::Map & leakageMap() const
Definition: JetPlusTrackCorrector.h:477
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
hltEgammaHLTExtra_cfi.trks
trks
Definition: hltEgammaHLTExtra_cfi.py:43
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
JetPlusTrackCorrector::efficiencyMap
const jpt::Map & efficiencyMap() const
Definition: JetPlusTrackCorrector.h:476
JetPlusTrackCorrector::theSumPtForBeta
float theSumPtForBeta
Definition: JetPlusTrackCorrector.h:417
JetPlusTrackCorrector::PtEtaPhiM
math::PtEtaPhiMLorentzVectorD PtEtaPhiM
Definition: JetPlusTrackCorrector.h:181
JetPlusTrackCorrector::RecoElectronIds
edm::ValueMap< float > RecoElectronIds
Definition: JetPlusTrackCorrector.h:273
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:698
JetPlusTrackCorrector::leakage_
const jpt::Map leakage_
Definition: JetPlusTrackCorrector.h:402
cuy.ii
ii
Definition: cuy.py:590
JetPlusTrackCorrector::getMuons
bool getMuons(const edm::Event &, edm::Handle< RecoMuons > &) const
Get RECO muons.
Definition: JetPlusTrackCorrector.cc:349
edm::InputTag
Definition: InputTag.h:15
JetPlusTrackCorrector::vertex_
reco::Particle::Point vertex_
Definition: JetPlusTrackCorrector.h:389
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
JetPlusTrackCorrector::excludeJta
void excludeJta(const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, const TrackRefs &excluded) const
Exclude jet-track association.
Definition: JetPlusTrackCorrector.cc:1215
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37