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? | |
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. | |
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) const |
Scalar correction method. | |
double | correction (const reco::Jet &) const |
Correction method (not used) | |
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) const |
Vectorial correction method (corrected 4-momentum passed by reference) | |
double | correction (const P4 &) const |
Correction method (not used) | |
P4 | elecCorrection (const P4 &jet, const jpt::MatchedTracks &elecs) const |
Calculates correction to be applied using electrons. | |
bool | eventRequired () const |
Returns true. | |
double | getResponseOfChargedWithEff () |
Get responses/sumPT/SumEnergy with and without Efficiency correction. | |
double | getResponseOfChargedWithoutEff () |
double | getSumEnergyWithEff () |
double | getSumEnergyWithoutEff () |
double | getSumPtForBeta () |
double | getSumPtWithEff () |
double | getSumPtWithoutEff () |
JetPlusTrackCorrector (const edm::ParameterSet &) | |
Constructor. | |
bool | matchTracks (const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs) const |
Matches tracks to different particle types. | |
P4 | muonCorrection (const P4 &jet, const jpt::MatchedTracks &muons) const |
Calculates correction to be applied using muons. | |
P4 | pionCorrection (const P4 &jet, const jpt::MatchedTracks &pions) const |
Calculates corrections to be applied using pions. | |
bool | vectorialCorrection () const |
Returns value of configurable. | |
virtual | ~JetPlusTrackCorrector () |
Destructor. | |
Protected Types | |
typedef reco::JetTracksAssociation::Container | JetTracksAssociations |
typedef edm::ValueMap< float > | RecoElectronIds |
typedef reco::GsfElectronCollection | RecoElectrons |
typedef reco::MuonCollection | RecoMuons |
Get reponses. | |
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) const |
Generic method to calculates 4-momentum correction to be applied. | |
double | checkScale (const P4 &jet, P4 &corrected) const |
Check corrected 4-momentum does not give negative scale. | |
const jpt::Map & | efficiencyMap () const |
P4 | elecCorrection (const P4 &jet, const TrackRefs &elecs, bool in_cone_at_vertex, bool in_cone_at_calo_face) const |
Calculates individual electron corrections. | |
void | excludeJta (const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, const TrackRefs &excluded) const |
Exclude jet-track association. | |
bool | failTrackQuality (TrackRefs::const_iterator) const |
Check on track quality. | |
bool | findTrack (const jpt::JetTracks &, TrackRefs::const_iterator, TrackRefs::iterator &) const |
Find track in JetTracks collection. | |
bool | findTrack (const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &electrons, TrackRefs::const_iterator) const |
Find track in MatchedTracks collections. | |
bool | getElectrons (const edm::Event &, edm::Handle< RecoElectrons > &, edm::Handle< RecoElectronIds > &) const |
Get RECO electrons. | |
bool | getMuons (const edm::Event &, edm::Handle< RecoMuons > &) const |
Get RECO muons. | |
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. | |
JetPlusTrackCorrector () | |
Default constructor. | |
virtual bool | jetTrackAssociation (const reco::Jet &, const edm::Event &, const edm::EventSetup &, jpt::JetTracks &) const |
Associates tracks to jets (overriden in derived class) | |
bool | jtaUsingEventData (const reco::Jet &, const edm::Event &, jpt::JetTracks &) const |
JTA using collections from event. | |
const jpt::Map & | leakageMap () const |
bool | matchElectrons (TrackRefs::const_iterator, const edm::Handle< RecoElectrons > &, const edm::Handle< RecoElectronIds > &) const |
Matches tracks to RECO electrons. | |
bool | matchMuons (TrackRefs::const_iterator, const edm::Handle< RecoMuons > &) const |
Matches tracks to RECO muons. | |
virtual void | matchTracks (const jpt::JetTracks &, const edm::Event &, jpt::MatchedTracks &pions, jpt::MatchedTracks &muons, jpt::MatchedTracks &elecs) const |
Matches tracks to different particle types (overriden in derived class) | |
P4 | muonCorrection (const P4 &jet, const TrackRefs &muons, bool in_cone_at_vertex, bool in_cone_at_calo_face) const |
Calculates individual muons corrections. | |
P4 | pionCorrection (const P4 &jet, const TrackRefs &pions, jpt::Efficiency &, bool in_cone_at_vertex, bool in_cone_at_calo_face) const |
Calculates individual pion corrections. | |
P4 | pionEfficiency (const P4 &jet, const jpt::Efficiency &, bool in_cone_at_calo_face) const |
Correction to be applied using tracking efficiency. | |
void | rebuildJta (const reco::Jet &, const JetTracksAssociations &, TrackRefs &included, TrackRefs &excluded) const |
Rebuild jet-track association. | |
const jpt::Map & | responseMap () const |
bool | tracksInCalo (const jpt::MatchedTracks &pions, const jpt::MatchedTracks &muons, const jpt::MatchedTracks &elecs) const |
Determines if any tracks in cone at CaloFace. | |
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_ |
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_ |
Jet energy correction algorithm using tracks.
Definition at line 176 of file JetPlusTrackCorrector.h.
typedef reco::JetTracksAssociation::Container JetPlusTrackCorrector::JetTracksAssociations [protected] |
Definition at line 276 of file JetPlusTrackCorrector.h.
Definition at line 189 of file JetPlusTrackCorrector.h.
Definition at line 190 of file JetPlusTrackCorrector.h.
Definition at line 191 of file JetPlusTrackCorrector.h.
typedef edm::ValueMap<float> JetPlusTrackCorrector::RecoElectronIds [protected] |
Definition at line 275 of file JetPlusTrackCorrector.h.
typedef reco::GsfElectronCollection JetPlusTrackCorrector::RecoElectrons [protected] |
Definition at line 274 of file JetPlusTrackCorrector.h.
typedef reco::MuonCollection JetPlusTrackCorrector::RecoMuons [protected] |
Get reponses.
Definition at line 273 of file JetPlusTrackCorrector.h.
typedef reco::TrackRefVector JetPlusTrackCorrector::TrackRefs [protected] |
Definition at line 277 of file JetPlusTrackCorrector.h.
JetPlusTrackCorrector::JetPlusTrackCorrector | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 22 of file JetPlusTrackCorrector.cc.
References electrons_, edm::ParameterSet::getParameter(), jetSplitMerge_, jetTracksAtCalo_, jetTracksAtVertex_, muons_, useEff_, useElecs_, useInConeTracks_, useMuons_, useOutOfConeTracks_, useOutOfVertexTracks_, usePions_, useTrackQuality_, vecResponse_, vectorial_, and verbose_.
: verbose_( pset.getParameter<bool>("Verbose") ), vectorial_( pset.getParameter<bool>("VectorialCorrection") ), vecResponse_( pset.getParameter<bool>("UseResponseInVecCorr") ), useInConeTracks_( pset.getParameter<bool>("UseInConeTracks") ), useOutOfConeTracks_( pset.getParameter<bool>("UseOutOfConeTracks") ), useOutOfVertexTracks_( pset.getParameter<bool>("UseOutOfVertexTracks") ), usePions_( pset.getParameter<bool>("UsePions") ), useEff_( pset.getParameter<bool>("UseEfficiency") ), useMuons_( pset.getParameter<bool>("UseMuons") ), useElecs_( pset.getParameter<bool>("UseElectrons") ), useTrackQuality_( pset.getParameter<bool>("UseTrackQuality") ), jetTracksAtVertex_( pset.getParameter<edm::InputTag>("JetTracksAssociationAtVertex") ), jetTracksAtCalo_( pset.getParameter<edm::InputTag>("JetTracksAssociationAtCaloFace") ), jetSplitMerge_( pset.getParameter<int>("JetSplitMerge") ), srcPVs_(pset.getParameter<edm::InputTag>("srcPVs") ), ptErrorQuality_( pset.getParameter<double>("PtErrorQuality") ), dzVertexCut_( pset.getParameter<double>("DzVertexCut") ), muons_( pset.getParameter<edm::InputTag>("Muons") ), electrons_( pset.getParameter<edm::InputTag>("Electrons") ), electronIds_( pset.getParameter<edm::InputTag>("ElectronIds") ), trackQuality_( reco::TrackBase::qualityByName( pset.getParameter<std::string>("TrackQuality") ) ), response_( Map( pset.getParameter<std::string>("ResponseMap"), verbose_ ) ), efficiency_( Map( pset.getParameter<std::string>("EfficiencyMap"), verbose_ ) ), leakage_( Map( pset.getParameter<std::string>("LeakageMap"), verbose_ ) ), pionMass_(0.140), muonMass_(0.105), elecMass_(0.000511), maxEta_( pset.getParameter<double>("MaxJetEta") ) { if ( verbose_ ) { std::stringstream ss; ss << "[JetPlusTrackCorrector::" << __func__ << "] Configuration for JPT corrector: " << std::endl << " Particles" << std::endl << " UsePions : " << ( usePions_ ? "true" : "false" ) << std::endl << " UseMuons : " << ( useMuons_ ? "true" : "false" ) << std::endl << " UseElecs : " << ( useElecs_ ? "true" : "false" ) << std::endl << " Corrections" << std::endl << " UseInConeTracks : " << ( useInConeTracks_ ? "true" : "false" ) << std::endl << " UseOutOfConeTracks : " << ( useOutOfConeTracks_ ? "true" : "false" ) << std::endl << " UseOutOfVertexTracks : " << ( useOutOfVertexTracks_ ? "true" : "false" ) << std::endl << " ResponseMap : " << pset.getParameter<std::string>("ResponseMap") << std::endl << " Efficiency" << std::endl << " UsePionEfficiency : " << ( useEff_ ? "true" : "false" ) << std::endl << " EfficiencyMap : " << pset.getParameter<std::string>("EfficiencyMap") << std::endl << " LeakageMap : " << pset.getParameter<std::string>("LeakageMap") << std::endl << " Tracks" << std::endl << " JetTracksAtVertex : " << jetTracksAtVertex_ << std::endl << " JetTracksAtCalo : " << jetTracksAtCalo_ << std::endl << " JetSplitMerge : " << jetSplitMerge_ << std::endl << " UseTrackQuality : " << ( useTrackQuality_ ? "true" : "false" ) << std::endl << " Collections" << std::endl << " Muons : " << muons_ << std::endl << " Electrons : " << electrons_ << std::endl << " Vectorial" << std::endl << " UseTracksAndResponse : " << ( ( vectorial_ && vecResponse_ ) ? "true" : "false" ) << std::endl << " UseTracksOnly : " << ( ( vectorial_ && !vecResponse_ ) ? "true" : "false" ); edm::LogInfo("JetPlusTrackCorrector") << ss.str(); } if ( !useInConeTracks_ || !useOutOfConeTracks_ || !useOutOfVertexTracks_ ) { std::stringstream ss; ss << "[JetPlusTrackCorrector::" << __func__ << "]" << " You are using JPT algorithm in a non-standard way!" << std::endl << " UseInConeTracks : " << ( useInConeTracks_ ? "true" : "false" ) << std::endl << " UseOutOfConeTracks : " << ( useOutOfConeTracks_ ? "true" : "false" ) << std::endl << " UseOutOfVertexTracks : " << ( useOutOfVertexTracks_ ? "true" : "false" ); edm::LogWarning("JetPlusTrackCorrector") << ss.str(); } }
JetPlusTrackCorrector::~JetPlusTrackCorrector | ( | ) | [virtual] |
JetPlusTrackCorrector::JetPlusTrackCorrector | ( | ) | [inline, protected] |
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 | ||
) | const [protected] |
Generic method to calculates 4-momentum correction to be applied.
Definition at line 854 of file JetPlusTrackCorrector.cc.
References jpt::Efficiency::addE(), edm::RefVector< C, T, F >::begin(), correction(), edm::RefVector< C, T, F >::empty(), edm::RefVector< C, T, F >::end(), relval_parameters_module::energy, eta(), jpt::Map::etaBin(), SurfaceOrientation::inner, edm::isDebugEnabled(), LogDebug, scaleCards::mass, jpt::Map::nEtaBins(), jpt::Map::nPtBins(), SurfaceOrientation::outer, jpt::Map::ptBin(), jpt::Efficiency::reset(), response_, mathSSE::sqrt(), groupFilesInBlocks::temp, theResponseOfChargedWithEff, theResponseOfChargedWithoutEff, theSumEnergyWithEff, theSumEnergyWithoutEff, theSumPtWithEff, theSumPtWithoutEff, jpt::Map::value(), vecResponse_, vectorial_, and verbose_.
Referenced by elecCorrection(), muonCorrection(), and pionCorrection().
{ // Correction to be applied to jet 4-momentum P4 correction; /* std::cout<<" >>>>> Jet "<<jet.pt()<<" "<<jet.eta()<<" "<<jet.phi()<<" Number of tracks "<<tracks.size()<<" Pions? "<<is_pion<<" InVert "<<in_cone_at_vertex<< " InCalo "<<in_cone_at_calo_face<<std::endl; std::cout<<" calculateCorr Start::Corrections for jet "<< theResponseOfChargedWithEff <<" "<< theResponseOfChargedWithoutEff <<" "<< theSumPtWithEff <<" "<< theSumPtWithoutEff <<" "<< theSumEnergyWithEff <<" "<< theSumEnergyWithoutEff <<std::endl; */ // Reset efficiency container eff.reset(); double theSumResp = 0; double theSumPt = 0; double theSumEnergy = 0; // Iterate through tracks if ( !tracks.empty() ) { TrackRefs::iterator itrk = tracks.begin(); TrackRefs::iterator jtrk = tracks.end(); for ( ; itrk != jtrk; ++itrk ) { // Ignore high-pt tracks (only when in-cone and not a mip) if ( in_cone_at_calo_face && is_pion && (*itrk)->pt() >= 50. ) { continue; } // Inner track 4-momentum P4 inner; if ( vectorial_ && vecResponse_ ) { inner = PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), mass ); } else { double energy = sqrt( (*itrk)->px() * (*itrk)->px() + (*itrk)->py() * (*itrk)->py() + (*itrk)->pz() * (*itrk)->pz() + mass * mass ); inner = ( jet.energy() > 0. ? energy / jet.energy() : 1. ) * jet; } // Add track momentum (if in-cone at vertex) if ( in_cone_at_vertex ) { correction += inner; } // Find appropriate eta/pt bin for given track double eta = fabs( (*itrk)->eta() ); double pt = fabs( (*itrk)->pt() ); uint32_t ieta = response_.etaBin( eta ); uint32_t ipt = response_.ptBin( pt ); // Check bins (not for mips) if ( is_pion && ( ieta == response_.nEtaBins() || ipt == response_.nPtBins() ) ) { continue; } // Outer track 4-momentum P4 outer; if ( in_cone_at_calo_face ) { if ( vectorial_ && vecResponse_ ) { // Build 4-momentum from outer track (SHOULD USE IMPACT POINT?!) double outer_pt = (*itrk)->pt(); double outer_eta = (*itrk)->eta(); double outer_phi = (*itrk)->phi(); if ( (*itrk)->extra().isNonnull() ) { outer_pt = (*itrk)->pt(); outer_eta = (*itrk)->outerPosition().eta(); //@@ outerMomentum().eta() outer_phi = (*itrk)->outerPosition().phi(); //@@ outerMomentum().phi() } outer = PtEtaPhiM( outer_pt, outer_eta, outer_phi, mass ); // Check if mip or not if ( !is_pion ) { outer *= ( outer.energy() > 0. ? mip / outer.energy() : 1. ); } //@@ Scale to mip energy else { outer *= ( outer.energy() > 0. ? inner.energy() / outer.energy() : 1. ); } //@@ Scale to inner track energy } else { // Check if mip or not if ( !is_pion ) { outer = ( jet.energy() > 0. ? mip / jet.energy() : 1. ) * jet; } //@@ Jet 4-mom scaled by mip energy else { outer = inner; } //@@ Set to inner track 4-momentum } if ( is_pion ) { outer *= response_.value(ieta,ipt); } //@@ Scale by pion response correction -= outer; //@@ Subtract // Calculate the sum of responses theSumResp += response_.value(ieta,ipt); } // Calculate the sum of pt and energies theSumPt += inner.pt(); theSumEnergy += inner.energy(); // Record inner track energy for pion efficiency correction if ( is_pion ) { eff.addE( ieta, ipt, inner.energy() ); } // Debug if ( verbose_ && edm::isDebugEnabled() ) { std::stringstream temp; temp << " Response[" << ieta << "," << ipt << "]"; std::stringstream ss; ss << "[JetPlusTrackCorrector::" << __func__ << "]" << std::endl << " Track eta / pt : " << eta << " / " << pt << std::endl << temp.str() << std::setw(21-temp.str().size()) << " : " << response_.value(ieta,ipt) << std::endl << " Track momentum added : " << inner.energy() << std::endl << " Response subtracted : " << outer.energy() << std::endl << " Energy correction : " << correction.energy(); LogDebug("JetPlusTrackCorrector") << ss.str(); } } // loop through tracks } // ntracks != 0 if( in_cone_at_vertex ) { theResponseOfChargedWithEff += theSumResp; theResponseOfChargedWithoutEff += theSumResp; theSumPtWithEff += theSumPt; theSumPtWithoutEff += theSumPt; theSumEnergyWithEff += theSumEnergy; theSumEnergyWithoutEff += theSumEnergy; } /* std::cout<<" calculateCorr End::Corrections for jet "<< theResponseOfChargedWithEff <<" "<< theResponseOfChargedWithoutEff <<" "<< theSumPtWithEff <<" "<< theSumPtWithoutEff <<" "<< theSumEnergyWithEff <<" "<< theSumEnergyWithoutEff <<std::endl; */ return correction; }
bool JetPlusTrackCorrector::canCorrect | ( | const reco::Jet & | jet | ) | const [inline] |
Can jet be JPT-corrected?
Definition at line 466 of file JetPlusTrackCorrector.h.
References reco::LeafCandidate::eta(), and maxEta_.
Referenced by correction().
double JetPlusTrackCorrector::checkScale | ( | const P4 & | jet, |
P4 & | corrected | ||
) | const [inline, protected] |
Check corrected 4-momentum does not give negative scale.
Definition at line 492 of file JetPlusTrackCorrector.h.
References metsig::jet.
Referenced by correction().
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 1236 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::begin(), efficiency_, edm::RefVector< C, T, F >::end(), reco::LeafCandidate::energy(), eta(), reco::LeafCandidate::eta(), jpt::Map::etaBin(), M_PI, jpt::Map::nEtaBins(), jpt::Map::nPtBins(), jpt::Map::ptBin(), response_, edm::RefVector< C, T, F >::size(), mathSSE::sqrt(), and jpt::Map::value().
{ double mScale = 1.; double NewResponse = fJet.energy(); //std::cout<<"---JetPlusTrackCorrector::correctAA, Jet initial: NewResponse="<<NewResponse <<" et = "<<fJet.et() // <<" pt= "<<fJet.pt()<<" eta="<<fJet.eta()<<" phi="<<fJet.phi() <<" ja="<<ja // <<" trBgOutOfVertex="<<trBgOutOfVertex.size()<< " trBgOutOfCalo="<<trBgOutOfCalo.size()<<std::endl; if( trBgOutOfVertex.size() == 0 ) return mScale; double EnergyOfBackgroundCharged = 0.; double ResponseOfBackgroundCharged = 0.; double NumberOfBackgroundChargedVertex = 0.; double NumberOfBackgroundChargedCalo = 0.; // // calculate the mean response // // double MeanResponseOfBackgroundCharged = 0.; // double MeanEnergyOfBackgroundCharged = 0.; //================= EnergyOfBackgroundCharged ==================> for( reco::TrackRefVector::iterator iBgtV = trBgOutOfVertex.begin(); iBgtV != trBgOutOfVertex.end(); iBgtV++) { // Temporary solution>>>>>> Remove tracks with pt>50 GeV // if( (**iBgtV).pt() >= 50. ) continue; //response_.value(ieta,ipt); double eta = fabs( (**iBgtV).eta() ); double pt = fabs( (**iBgtV).pt() ); uint32_t ieta = response_.etaBin( eta ); uint32_t ipt = response_.ptBin( pt ); if(fabs(fJet.eta() -(**iBgtV).eta()) > mConeSize) continue; // // Check bins (not for mips) // if ( ieta >= response_.nEtaBins() ) { continue; } // if ( ipt >= response_.nPtBins() ) { ipt = response_.nPtBins() - 1; } double echarBg=sqrt((**iBgtV).px()*(**iBgtV).px()+(**iBgtV).py()*(**iBgtV).py()+(**iBgtV).pz()*(**iBgtV).pz()+0.14*0.14); // ResponseOfBackgroundCharged += echarBg*response_.value(ieta,ipt)/efficiency_.value(ieta,ipt); // std::cout<<" Efficiency of bg tracks "<<efficiency_.value(ieta,ipt)<<std::endl; EnergyOfBackgroundCharged += echarBg/efficiency_.value(ieta,ipt); NumberOfBackgroundChargedVertex++; } // Energy BG tracks // std::cout<<" JetPlusTrackCorrector.cc, NumberOfBackgroundChargedVertex ="<<NumberOfBackgroundChargedVertex<<std::endl; //============= ResponseOfBackgroundCharged =======================> for( reco::TrackRefVector::iterator iBgtC = trBgOutOfCalo.begin(); iBgtC != trBgOutOfCalo.end(); iBgtC++) { // Temporary solution>>>>>> Remove tracks with pt>50 GeV // if( (**iBgtC).pt() >= 50. ) continue; //response_.value(ieta,ipt); double eta = fabs( (**iBgtC).eta() ); double pt = fabs( (**iBgtC).pt() ); uint32_t ieta = response_.etaBin( eta ); uint32_t ipt = response_.ptBin( pt ); if(fabs(fJet.eta() -(**iBgtC).eta()) > mConeSize) continue; // Check bins (not for mips) if ( ieta >= response_.nEtaBins() ) { continue; } if ( ipt >= response_.nPtBins() ) { ipt = response_.nPtBins() - 1; } double echarBg=sqrt((**iBgtC).px()*(**iBgtC).px()+(**iBgtC).py()*(**iBgtC).py()+(**iBgtC).pz()*(**iBgtC).pz()+0.14*0.14); ResponseOfBackgroundCharged += echarBg*response_.value(ieta,ipt)/efficiency_.value(ieta,ipt); // std::cout<<" Efficiency of bg tracks "<<efficiency_.value(ieta,ipt)<<std::endl; NumberOfBackgroundChargedCalo++; } // Response of BG tracks // std::cout<<" JetPlusTrackCorrector.cc, NumberOfBackgroundChargedCalo ="<<NumberOfBackgroundChargedCalo<<std::endl; //=================================================================> //=================================================================> // Look for in-out tracks double en = 0.; double px = 0.; double py = 0.; double pz = 0.; for(reco::TrackRefVector::const_iterator it = pioninout.begin(); it != pioninout.end(); it++) { // std::cout<<" Track in out, size= "<<pioninout.size()<<" p= "<<(*it)->p()<<" pt= "<<(*it)->pt() // <<" eta= "<<(*it)->eta()<<" phi= "<<(*it)->phi()<<std::endl; px+=(*it)->px(); py+=(*it)->py(); pz+=(*it)->pz(); en+=sqrt((*it)->p()*(*it)->p()+0.14*0.14); } // Look for in-in tracks double en_in = 0.; double px_in = 0.; double py_in = 0.; double pz_in = 0.; for(reco::TrackRefVector::const_iterator it = pioninin.begin(); it != pioninin.end(); it++) { // std::cout<<" Track in in, size= "<<pioninin.size()<<" p= "<<(*it)->p()<<" pt= "<<(*it)->pt() // <<" eta= "<<(*it)->eta()<<" phi= "<<(*it)->phi()<<std::endl; px_in+=(*it)->px(); py_in+=(*it)->py(); pz_in+=(*it)->pz(); en_in+=sqrt((*it)->p()*(*it)->p()+0.14*0.14); } //===================================================================> //=> // double SquareEtaRingWithoutJets = 4*(M_PI*mConeSize - mConeSize*mConeSize); double SquareEtaRingWithoutJets = ja; // std::cout<<"---SquareEtaRingWithoutJets="<<SquareEtaRingWithoutJets<<std::endl; EnergyOfBackgroundCharged = EnergyOfBackgroundCharged/SquareEtaRingWithoutJets; ResponseOfBackgroundCharged = ResponseOfBackgroundCharged/SquareEtaRingWithoutJets; NumberOfBackgroundChargedVertex = NumberOfBackgroundChargedVertex/SquareEtaRingWithoutJets; NumberOfBackgroundChargedCalo = NumberOfBackgroundChargedCalo/SquareEtaRingWithoutJets; // NumberOfBackgroundCharged = NumberOfBackgroundCharged/SquareEtaRingWithoutJets; EnergyOfBackgroundCharged = M_PI*mConeSize*mConeSize*EnergyOfBackgroundCharged; ResponseOfBackgroundCharged = M_PI*mConeSize*mConeSize*ResponseOfBackgroundCharged; NumberOfBackgroundChargedVertex = M_PI*mConeSize*mConeSize*NumberOfBackgroundChargedVertex; NumberOfBackgroundChargedCalo = M_PI*mConeSize*mConeSize*NumberOfBackgroundChargedCalo; // NumberOfBackgroundCharged = M_PI*mConeSize*mConeSize*NumberOfBackgroundCharged; NewResponse = NewResponse - EnergyOfBackgroundCharged + ResponseOfBackgroundCharged; // std::cout<<"====JetPlusTrackCorrector, Old response=fJet.energy()"<<fJet.energy() // <<" EnergyOfBackgroundCharged="<<EnergyOfBackgroundCharged // <<" ResponseOfBackgroundCharged="<<ResponseOfBackgroundCharged // <<" NewResponse="<<NewResponse<<" NumberOfBackgroundChargedVertex="<<NumberOfBackgroundChargedVertex // <<" NumberOfBackgroundChargedCalo="<<NumberOfBackgroundChargedCalo<<std::endl; mScale = NewResponse/fJet.energy(); if(mScale <0.) mScale=0.; return mScale; }
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 | ||
) | const |
Vectorial correction method (corrected 4-momentum passed by reference)
Definition at line 102 of file JetPlusTrackCorrector.cc.
References canCorrect(), checkScale(), elecCorrection(), reco::LeafCandidate::energy(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), jetDirFromTracks(), reco::LeafCandidate::mass(), matchTracks(), muonCorrection(), patZpeak::muons, reco::LeafCandidate::p4(), reco::LeafCandidate::phi(), pionCorrection(), reco::LeafCandidate::pt(), reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::LeafCandidate::pz(), pileupReCalc_HLTpaths::scale, theResponseOfChargedWithEff, theResponseOfChargedWithoutEff, theSumEnergyWithEff, theSumEnergyWithoutEff, theSumPtForBeta, theSumPtWithEff, theSumPtWithoutEff, useElecs_, useMuons_, usePions_, vecResponse_, vectorial_, and verbose_.
Referenced by calculateCorr(), correction(), and pionEfficiency().
{ // std::cout<<" JetPlusTrackCorrector::correction "<<std::endl; theResponseOfChargedWithEff = 0.; theResponseOfChargedWithoutEff = 0.; theSumPtWithEff = 0.; theSumPtWithoutEff = 0.; theSumEnergyWithEff = 0.; theSumEnergyWithoutEff = 0.; theSumPtForBeta = 0.; // Corrected 4-momentum for jet corrected = fJet.p4(); // Match tracks to different particle types validMatches = matchTracks( fJetcalo, event, setup, pions, muons, elecs ); if ( !validMatches ) { return 1.; } // Check if jet can be JPT-corrected if ( !canCorrect(fJet) ) { return 1.; } // std::cout<<" Jet can be corrected "<<std::endl; // std::cout<<" Tracks are matched "<<std::endl; // Debug if ( verbose_ ) { edm::LogInfo("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Applying JPT corrections..."; } // Pion corrections (both scalar and vectorial) if ( usePions_ ) { corrected += pionCorrection( fJet.p4(), pions ); } // Muon corrections (both scalar and vectorial) if ( useMuons_ ) { corrected += muonCorrection( fJet.p4(), muons ); } // Electrons corrections (both scalar and vectorial) if ( useElecs_ ) { corrected += elecCorrection( fJet.p4(), elecs ); } // Define jet direction using total 3-momentum of tracks (overrides above) if ( vectorial_ && !vecResponse_ ) { if( fabs(corrected.eta()) < 2. ) {corrected = jetDirFromTracks( corrected, pions, muons, elecs );} } // Check if corrected 4-momentum gives negative scale double scale = checkScale( fJet.p4(), corrected ); // Debug if ( verbose_ ) { std::stringstream ss; ss << "Total correction:" << std::endl << std::fixed << std::setprecision(6) << " Uncorrected (Px,Py,Pz,E) : " << "(" << fJet.px() << "," << fJet.py() << "," << fJet.pz() << "," << fJet.energy() << ")" << std::endl << " Corrected (Px,Py,Pz,E) : " << "(" << corrected.px() << "," << corrected.py() << "," << corrected.pz() << "," << corrected.energy() << ")" << std::endl << " Uncorrected (Pt,Eta,Phi,M) : " << "(" << fJet.pt() << "," << fJet.eta() << "," << fJet.phi() << "," << fJet.mass() << ")" << std::endl << " Corrected (Pt,Eta,Phi,M) : " << "(" << corrected.pt() << "," << corrected.eta() << "," << corrected.phi() << "," << corrected.mass() << ")" << std::endl << " Scalar correction to E : " << scale << std::endl << " Scalar correction to Et : " << ( fJet.et() > 0. ? corrected.Et() / fJet.et() : 1. );// << std::endl edm::LogVerbatim("JetPlusTrackCorrector") << ss.str(); } // std::cout << " mScale= " << scale // << " NewResponse " << corrected.energy() // << " Jet energy " << fJet.energy() // << " event " << event.id().event() << std::endl; /* std::cout<<" Correction::Corrections for jet "<< theResponseOfChargedWithEff <<" "<< theResponseOfChargedWithoutEff <<" "<< theSumPtWithEff <<" "<< theSumPtWithoutEff <<" "<< theSumEnergyWithEff <<" "<< theSumEnergyWithoutEff <<std::endl; */ // Return energy correction return scale; }
double JetPlusTrackCorrector::correction | ( | const P4 & | jet | ) | const |
Correction method (not used)
Definition at line 223 of file JetPlusTrackCorrector.cc.
{ edm::LogError("JetPlusTrackCorrector") << "JetPlusTrackCorrector can be run on entire event only"; return 1.; }
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 | ||
) | const [inline] |
Scalar correction method.
Definition at line 453 of file JetPlusTrackCorrector.h.
References correction().
{ P4 not_used_for_scalar_correction; return correction( fJet, fJetcalo, event, setup, not_used_for_scalar_correction,pions,muons,elecs,validMatches ); }
double JetPlusTrackCorrector::correction | ( | const reco::Jet & | jet | ) | const |
Correction method (not used)
Definition at line 215 of file JetPlusTrackCorrector.cc.
{ edm::LogError("JetPlusTrackCorrector") << "JetPlusTrackCorrector can be run on entire event only"; return 1.; }
const jpt::Map & JetPlusTrackCorrector::efficiencyMap | ( | ) | const [inline, protected] |
Definition at line 500 of file JetPlusTrackCorrector.h.
References efficiency_.
Referenced by elecCorrection(), muonCorrection(), and pionCorrection().
{ return efficiency_; }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::elecCorrection | ( | const P4 & | jet, |
const jpt::MatchedTracks & | elecs | ||
) | const |
Calculates correction to be applied using electrons.
Definition at line 748 of file JetPlusTrackCorrector.cc.
References jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, jpt::MatchedTracks::outOfVertexInCalo_, edm::RefVector< C, T, F >::size(), and verbose_.
Referenced by correction().
{ P4 null; //@@ null 4-momentum if ( verbose_ ) { std::stringstream ss; ss << " Electron corrections:" << std::endl << " In/In : " << "(" << elecs.inVertexInCalo_.size() << ") " << null.energy() << std::endl << " In/Out : " << "(" << elecs.inVertexOutOfCalo_.size() << ") " << null.energy() << std::endl << " Out/In : " << "(" << elecs.outOfVertexInCalo_.size() << ") " << null.energy(); edm::LogVerbatim("JetPlusTrackCorrector") << ss.str(); } return null; //@@ to be implemented }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::elecCorrection | ( | const P4 & | jet, |
const TrackRefs & | elecs, | ||
bool | in_cone_at_vertex, | ||
bool | in_cone_at_calo_face | ||
) | const [inline, protected] |
Calculates individual electron corrections.
Definition at line 484 of file JetPlusTrackCorrector.h.
References calculateCorr(), efficiencyMap(), elecMass_, leakageMap(), and responseMap().
{ static jpt::Efficiency not_used( responseMap(), efficiencyMap(), leakageMap() ); return calculateCorr( jet, elecs, not_used, in_cone_at_vertex, in_cone_at_calo_face, elecMass_, false, 0. ); }
bool JetPlusTrackCorrector::eventRequired | ( | ) | const [inline] |
void JetPlusTrackCorrector::excludeJta | ( | const reco::Jet & | fJet, |
const JetTracksAssociations & | jtV0, | ||
TrackRefs & | included, | ||
const TrackRefs & | excluded | ||
) | const [protected] |
Exclude jet-track association.
Definition at line 1199 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::clear(), edm::RefVector< C, T, F >::end(), spr::find(), reco::JetExtendedAssociation::getValue(), jetSplitMerge_, edm::RefVector< C, T, F >::push_back(), edm::RefVector< C, T, F >::size(), and testEve_cfg::tracks.
Referenced by jtaUsingEventData().
{ //std::cout<<" NEW2" << std::endl; tracksthis = reco::JetTracksAssociation::getValue(jtV0,fJet); if(Excl.size() == 0) return; if(jetSplitMerge_<0) return; TrackRefs tracks = tracksthis; tracksthis.clear(); //std::cout<<" Size of initial vector "<<tracks.size()<<" "<<fJet.et()<<" "<<fJet.eta()<<" "<<fJet.phi()<<std::endl; for(TrackRefs::iterator it = tracks.begin(); it != tracks.end(); it++ ) { //std::cout<<" Track at calo surface " //<<" Track "<<(**it).eta()<<" "<<(**it).phi()<<std::endl; TrackRefs::iterator itold = find(Excl.begin(),Excl.end(),(*it)); if(itold == Excl.end()) { tracksthis.push_back (*it); } //else { std::cout<<"Exclude "<<(**it).eta()<<" "<<(**it).phi()<<std::endl; } } //std::cout<<" Size of calo tracks "<<tracksthis.size()<<std::endl; return; }
bool JetPlusTrackCorrector::failTrackQuality | ( | TrackRefs::const_iterator | itrk | ) | const [protected] |
Check on track quality.
Definition at line 571 of file JetPlusTrackCorrector.cc.
References dzVertexCut_, ptErrorQuality_, trackQuality_, useTrackQuality_, and vertex_.
Referenced by matchTracks().
{ // if ( useTrackQuality_ && !(*itrk)->quality(trackQuality_) ) { return true; } // else { return false; } bool retcode = false; if ( useTrackQuality_ && !(*itrk)->quality(trackQuality_) ) { retcode = true; return retcode; } if(((*itrk)->ptError()/(*itrk)->pt()) > ptErrorQuality_) { retcode = true; return retcode; } if(fabs((*itrk)->dz(vertex_)) > dzVertexCut_) { retcode = true; return retcode; } return retcode; }
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 592 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::begin(), jpt::JetTracks::caloFace_, edm::RefVector< C, T, F >::end(), and spr::find().
Referenced by matchTracks().
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 604 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::end(), spr::find(), and jpt::MatchedTracks::inVertexInCalo_.
{ TrackRefs::iterator ip = find( pions.inVertexInCalo_.begin(), pions.inVertexInCalo_.end(), *itrk ); TrackRefs::iterator im = find( muons.inVertexInCalo_.begin(), muons.inVertexInCalo_.end(), *itrk ); TrackRefs::iterator ie = find( elecs.inVertexInCalo_.begin(), elecs.inVertexInCalo_.end(), *itrk ); if ( ip == pions.inVertexInCalo_.end() && im == muons.inVertexInCalo_.end() && ie == elecs.inVertexInCalo_.end() ) { return false; } else { return true; } }
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 541 of file JetPlusTrackCorrector.cc.
References electronIds_, electrons_, edm::HandleBase::failedToGet(), edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), and edm::InputTag::process().
Referenced by matchTracks().
{ event.getByLabel( electrons_, reco_elecs ); if ( !reco_elecs.isValid() || reco_elecs.failedToGet() ) { edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Invalid handle to reco::GsfElectron collection" << " with InputTag (label:instance:process) \"" << electrons_.label() << ":" << electrons_.instance() << ":" << electrons_.process() << "\""; return false; } event.getByLabel( electronIds_, reco_elec_ids ); if ( !reco_elec_ids.isValid() || reco_elec_ids.failedToGet() ) { edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Invalid handle to reco::GsfElectron collection" << " with InputTag (label:instance:process) \"" << electronIds_.label() << ":" << electronIds_.instance() << ":" << electronIds_.process() << "\""; return false; } return true; }
bool JetPlusTrackCorrector::getMuons | ( | const edm::Event & | event, |
edm::Handle< RecoMuons > & | reco_muons | ||
) | const [protected] |
Get RECO muons.
Definition at line 364 of file JetPlusTrackCorrector.cc.
References edm::HandleBase::failedToGet(), edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), muons_, and edm::InputTag::process().
Referenced by matchTracks().
{ event.getByLabel( muons_, reco_muons ); if ( !reco_muons.isValid() || reco_muons.failedToGet() ) { edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Invalid handle to reco::Muon collection" << " with InputTag (label:instance:process) \"" << muons_.label() << ":" << muons_.instance() << ":" << muons_.process() << "\""; return false; } return true; }
double JetPlusTrackCorrector::getResponseOfChargedWithEff | ( | ) | [inline] |
Get responses/sumPT/SumEnergy with and without Efficiency correction.
Definition at line 231 of file JetPlusTrackCorrector.h.
References theResponseOfChargedWithEff.
{return theResponseOfChargedWithEff;}
double JetPlusTrackCorrector::getResponseOfChargedWithoutEff | ( | ) | [inline] |
Definition at line 232 of file JetPlusTrackCorrector.h.
References theResponseOfChargedWithoutEff.
{return theResponseOfChargedWithoutEff;}
double JetPlusTrackCorrector::getSumEnergyWithEff | ( | ) | [inline] |
Definition at line 235 of file JetPlusTrackCorrector.h.
References theSumEnergyWithEff.
{return theSumEnergyWithEff;}
double JetPlusTrackCorrector::getSumEnergyWithoutEff | ( | ) | [inline] |
Definition at line 236 of file JetPlusTrackCorrector.h.
References theSumEnergyWithoutEff.
{return theSumEnergyWithoutEff;}
double JetPlusTrackCorrector::getSumPtForBeta | ( | ) | [inline] |
Definition at line 237 of file JetPlusTrackCorrector.h.
References theSumPtForBeta.
{return theSumPtForBeta;}
double JetPlusTrackCorrector::getSumPtWithEff | ( | ) | [inline] |
Definition at line 233 of file JetPlusTrackCorrector.h.
References theSumPtWithEff.
{return theSumPtWithEff;}
double JetPlusTrackCorrector::getSumPtWithoutEff | ( | ) | [inline] |
Definition at line 234 of file JetPlusTrackCorrector.h.
References theSumPtWithoutEff.
{return theSumPtWithoutEff;}
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 768 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::begin(), corr, edm::RefVector< C, T, F >::empty(), edm::RefVector< C, T, F >::end(), jpt::MatchedTracks::inVertexInCalo_, and jpt::MatchedTracks::inVertexOutOfCalo_.
Referenced by correction().
{ // Correction to be applied to jet 4-momentum P4 corr; // bool tracks_present = false; bool tracks_present_inin = false; // Correct using pions in-cone at vertex if ( !pions.inVertexInCalo_.empty() ) { TrackRefs::iterator itrk = pions.inVertexInCalo_.begin(); TrackRefs::iterator jtrk = pions.inVertexInCalo_.end(); for ( ; itrk != jtrk; ++itrk ) { corr += PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. ); // tracks_present = true; tracks_present_inin = true; } } if ( !pions.inVertexOutOfCalo_.empty() ) { TrackRefs::iterator itrk = pions.inVertexOutOfCalo_.begin(); TrackRefs::iterator jtrk = pions.inVertexOutOfCalo_.end(); for ( ; itrk != jtrk; ++itrk ) { corr += PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. ); // tracks_present = true; } } // Correct using muons in-cone at vertex if ( !muons.inVertexInCalo_.empty() ) { TrackRefs::iterator itrk = muons.inVertexInCalo_.begin(); TrackRefs::iterator jtrk = muons.inVertexInCalo_.end(); for ( ; itrk != jtrk; ++itrk ) { corr += PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. ); // tracks_present = true; } } if ( !muons.inVertexOutOfCalo_.empty() ) { TrackRefs::iterator itrk = muons.inVertexOutOfCalo_.begin(); TrackRefs::iterator jtrk = muons.inVertexOutOfCalo_.end(); for ( ; itrk != jtrk; ++itrk ) { corr += PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. ); // tracks_present = true; } } // Correct using electrons in-cone at vertex if ( !elecs.inVertexInCalo_.empty() ) { TrackRefs::iterator itrk = elecs.inVertexInCalo_.begin(); TrackRefs::iterator jtrk = elecs.inVertexInCalo_.end(); for ( ; itrk != jtrk; ++itrk ) { corr += PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. ); // tracks_present = true; } } if ( !elecs.inVertexOutOfCalo_.empty() ) { TrackRefs::iterator itrk = elecs.inVertexOutOfCalo_.begin(); TrackRefs::iterator jtrk = elecs.inVertexOutOfCalo_.end(); for ( ; itrk != jtrk; ++itrk ) { corr += PtEtaPhiM( (*itrk)->pt(), (*itrk)->eta(), (*itrk)->phi(), 0. ); // tracks_present = true; } } // Adjust direction if in cone tracks are present if ( !tracks_present_inin ) { corr = corrected; } else { corr *= ( corr.P() > 0. ? corrected.P() / corr.P() : 1. ); corr = P4( corr.px(), corr.py(), corr.pz(), corrected.energy() ); } return corr; }
bool JetPlusTrackCorrector::jetTrackAssociation | ( | const reco::Jet & | fJet, |
const edm::Event & | event, | ||
const edm::EventSetup & | setup, | ||
jpt::JetTracks & | trks | ||
) | const [protected, virtual] |
Associates tracks to jets (overriden in derived class)
Definition at line 264 of file JetPlusTrackCorrector.cc.
References jpt::JetTracks::clear(), edm::InputTag::instance(), jetTracksAtCalo_, jetTracksAtVertex_, jtaUsingEventData(), edm::InputTag::label(), and edm::InputTag::process().
Referenced by matchTracks().
{ // Some init trks.clear(); // Check if labels are given if ( !jetTracksAtVertex_.label().empty() && !jetTracksAtCalo_.label().empty() ) { //std::cout<<" Try to associate with splitting "<< std::endl; return jtaUsingEventData( fJet, event, trks ); } else { edm::LogWarning("PatJPTCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Empty label for the reco::JetTracksAssociation::Containers" << std::endl << " InputTag for JTA \"at vertex\" (label:instance:process) \"" << jetTracksAtVertex_.label() << ":" << jetTracksAtVertex_.instance() << ":" << jetTracksAtVertex_.process() << "\"" << std::endl << " InputTag for JTA \"at calo face\" (label:instance:process) \"" << jetTracksAtCalo_.label() << ":" << jetTracksAtCalo_.instance() << ":" << jetTracksAtCalo_.process() << "\""; return false; } }
bool JetPlusTrackCorrector::jtaUsingEventData | ( | const reco::Jet & | fJet, |
const edm::Event & | event, | ||
jpt::JetTracks & | trks | ||
) | const [protected] |
JTA using collections from event.
Definition at line 300 of file JetPlusTrackCorrector.cc.
References jpt::JetTracks::caloFace_, edm::RefVector< C, T, F >::empty(), excludeJta(), edm::HandleBase::failedToGet(), reco::JetExtendedAssociation::getValue(), edm::InputTag::instance(), edm::isDebugEnabled(), edm::HandleBase::isValid(), jetSplitMerge_, jetTracksAtCalo_, jetTracksAtVertex_, edm::InputTag::label(), edm::InputTag::process(), edm::Handle< T >::product(), rebuildJta(), verbose_, and jpt::JetTracks::vertex_.
Referenced by jetTrackAssociation().
{ // Get Jet-track association at Vertex edm::Handle<reco::JetTracksAssociation::Container> jetTracksAtVertex; event.getByLabel( jetTracksAtVertex_, jetTracksAtVertex ); if ( !jetTracksAtVertex.isValid() || jetTracksAtVertex.failedToGet() ) { if ( verbose_ && edm::isDebugEnabled() ) { edm::LogWarning("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Invalid handle to reco::JetTracksAssociation::Container (for Vertex)" << " with InputTag (label:instance:process) \"" << jetTracksAtVertex_.label() << ":" << jetTracksAtVertex_.instance() << ":" << jetTracksAtVertex_.process() << "\""; } return false; } // std::cout<<" JetPlusTrackCorrector::jtaUsingEventData::here "<<jetSplitMerge_<<std::endl; // Retrieve jet-tracks association for given jet const reco::JetTracksAssociation::Container jtV = *( jetTracksAtVertex.product() ); TrackRefs excluded; if ( jetSplitMerge_ < 0 ) { trks.vertex_ = reco::JetTracksAssociation::getValue( jtV, fJet ); } else { rebuildJta( fJet, jtV, trks.vertex_, excluded ); } // Check if any tracks are associated to jet at vertex if ( trks.vertex_.empty() ) { return false; } // Get Jet-track association at Calo edm::Handle<reco::JetTracksAssociation::Container> jetTracksAtCalo; event.getByLabel( jetTracksAtCalo_, jetTracksAtCalo ); if ( !jetTracksAtCalo.isValid() || jetTracksAtCalo.failedToGet() ) { if ( verbose_ && edm::isDebugEnabled() ) { edm::LogWarning("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Invalid handle to reco::JetTracksAssociation::Container (for CaloFace)" << " with InputTag (label:instance:process) \"" << jetTracksAtCalo_.label() << ":" << jetTracksAtCalo_.instance() << ":" << jetTracksAtCalo_.process() << "\""; } return false; } // Retrieve jet-tracks association for given jet const reco::JetTracksAssociation::Container jtC = *( jetTracksAtCalo.product() ); if ( jetSplitMerge_ < 0 ) { trks.caloFace_ = reco::JetTracksAssociation::getValue( jtC, fJet ); } else { excludeJta( fJet, jtC, trks.caloFace_, excluded ); } // std::cout<<" JTA:Tracks in vertex "<<trks.vertex_.size()<<" in calo "<<trks.caloFace_.size()<<std::endl; // Successful return true; }
const jpt::Map & JetPlusTrackCorrector::leakageMap | ( | ) | const [inline, protected] |
Definition at line 501 of file JetPlusTrackCorrector.h.
References leakage_.
Referenced by elecCorrection(), muonCorrection(), and pionCorrection().
{ return leakage_; }
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 1095 of file JetPlusTrackCorrector.cc.
References abs, deltaR(), alignCSCRings::e, funct::pow(), and mathSSE::sqrt().
Referenced by matchTracks().
{ if ( elecs->empty() ) { return false; } double deltaR = 999.; double deltaRMIN = 999.; uint32_t electron_index = 0; RecoElectrons::const_iterator ielec = elecs->begin(); RecoElectrons::const_iterator jelec = elecs->end(); for ( ; ielec != jelec; ++ielec ) { edm::Ref<RecoElectrons> electron_ref( elecs, electron_index ); electron_index++; if ( (*elec_ids)[electron_ref] < 1.e-6 ) { continue; } //@@ Check for null value // DR matching b/w electron and track double deltaphi = fabs( ielec->phi() - (*itrk)->momentum().phi() ); if ( deltaphi > 6.283185308 ) deltaphi -= 6.283185308; if ( deltaphi > 3.141592654 ) deltaphi = 6.283185308 - deltaphi; deltaR = abs( sqrt( pow( (ielec->eta() - (*itrk)->momentum().eta()), 2 ) + pow( deltaphi , 2 ) ) ); if ( deltaR < deltaRMIN ) { deltaRMIN = deltaR; } } if ( deltaR < 0.02 ) return true; else return false; }
bool JetPlusTrackCorrector::matchMuons | ( | TrackRefs::const_iterator | itrk, |
const edm::Handle< RecoMuons > & | muons | ||
) | const [protected] |
Matches tracks to RECO muons.
Definition at line 1063 of file JetPlusTrackCorrector.cc.
References muon::isGoodMuon(), and muon::TMLastStationTight.
Referenced by matchTracks().
{ if ( muons->empty() ) { return false; } RecoMuons::const_iterator imuon = muons->begin(); RecoMuons::const_iterator jmuon = muons->end(); for ( ; imuon != jmuon; ++imuon ) { if ( imuon->innerTrack().isNull() || !muon::isGoodMuon(*imuon,muon::TMLastStationTight) || imuon->innerTrack()->pt() < 3.0 ) { continue; } if ( itrk->id() != imuon->innerTrack().id() ) { edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << "Product id of the tracks associated to the jet " << itrk->id() <<" is different from the product id of the inner track used for muons " << imuon->innerTrack().id() << "!" << std::endl << "Cannot compare tracks from different collection. Configuration Error!"; return false; } if ( *itrk == imuon->innerTrack() ) { return true; } } return false; }
bool JetPlusTrackCorrector::matchTracks | ( | const reco::Jet & | fJet, |
const edm::Event & | event, | ||
const edm::EventSetup & | setup, | ||
jpt::MatchedTracks & | pions, | ||
jpt::MatchedTracks & | muons, | ||
jpt::MatchedTracks & | elecs | ||
) | const |
Matches tracks to different particle types.
Definition at line 231 of file JetPlusTrackCorrector.cc.
References jpt::JetTracks::caloFace_, jetTrackAssociation(), convertSQLiteXML::ok, edm::RefVector< C, T, F >::size(), verbose_, and jpt::JetTracks::vertex_.
Referenced by correction().
{ // Associate tracks to jet at both the Vertex and CaloFace JetTracks jet_tracks; bool ok = jetTrackAssociation( fJet, event, setup, jet_tracks ); // std::cout<<"JetPlusTrackCorrector::matchTracks, JetTrackAssociation ok="<<ok<<std::endl; if ( !ok ) { return false; } // Track collections propagated to Vertex and CaloFace for "pions", muons and electrons matchTracks( jet_tracks, event, pions, muons, elecs ); // Debug if ( verbose_ ) { std::stringstream ss; ss << "Number of tracks:" << std::endl << " In-cone at Vertex : " << jet_tracks.vertex_.size() << std::endl << " In-cone at CaloFace : " << jet_tracks.caloFace_.size(); edm::LogVerbatim("JetPlusTrackCorrector") << ss.str(); } return true; }
void JetPlusTrackCorrector::matchTracks | ( | const jpt::JetTracks & | jet_tracks, |
const edm::Event & | event, | ||
jpt::MatchedTracks & | pions, | ||
jpt::MatchedTracks & | muons, | ||
jpt::MatchedTracks & | elecs | ||
) | const [protected, virtual] |
Matches tracks to different particle types (overriden in derived class)
Definition at line 381 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::begin(), jpt::JetTracks::caloFace_, jpt::MatchedTracks::clear(), edm::RefVector< C, T, F >::end(), failTrackQuality(), spr::find(), findTrack(), newFWLiteAna::found, getElectrons(), getMuons(), jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, edm::isDebugEnabled(), edm::HandleBase::isValid(), LogTrace, matchElectrons(), matchMuons(), jpt::MatchedTracks::outOfVertexInCalo_, edm::RefVector< C, T, F >::push_back(), findQualityFiles::rr, edm::RefVector< C, T, F >::size(), srcPVs_, theSumPtForBeta, trackQuality_, tracksInCalo(), useElecs_, useMuons_, useTrackQuality_, verbose_, vertex_, and jpt::JetTracks::vertex_.
{ // Some init pions.clear(); muons.clear(); elecs.clear(); // Need vertex for track cleaning vertex_=reco::Particle::Point(0,0,0); edm::Handle<reco::VertexCollection> pvCollection; event.getByLabel(srcPVs_,pvCollection); if ( pvCollection.isValid() && pvCollection->size()>0 ) vertex_=pvCollection->begin()->position(); // Get RECO muons edm::Handle<RecoMuons> reco_muons; bool found_reco_muons = true; if ( useMuons_ ) { getMuons( event, reco_muons ); } // Get RECO electrons and their ids edm::Handle<RecoElectrons> reco_elecs; edm::Handle<RecoElectronIds> reco_elec_ids; bool found_reco_elecs = true; if ( useElecs_ ) { getElectrons( event, reco_elecs, reco_elec_ids ); } // Check RECO products found if ( !found_reco_muons || !found_reco_elecs ) { edm::LogError("JetPlusTrackCorrector") << "[JetPlusTrackCorrector::" << __func__ << "]" << " Unable to access RECO collections for muons and electrons"; return; } // Identify pions/muons/electrons that are "in/in" and "in/out" { TrackRefs::const_iterator itrk = jet_tracks.vertex_.begin(); TrackRefs::const_iterator jtrk = jet_tracks.vertex_.end(); // std::cout<<" Print theSumPtForBeta "<<theSumPtForBeta<<std::endl; double theSumPtForBetaOld = theSumPtForBeta; for ( ; itrk != jtrk; ++itrk ) { if ( useTrackQuality_ && (*itrk)->quality(trackQuality_) && theSumPtForBetaOld<=0. ) theSumPtForBeta += (**itrk).pt(); // // Track either belongs to PV or do not belong to any vertex const reco::TrackBaseRef ttr1(*itrk); // std::cout<<" Size of PV "<<pvCollection->size()<<std::endl; int numpv=0; int itrack_belong = -1; for( reco::VertexCollection::const_iterator iv = pvCollection->begin(); iv != pvCollection->end(); iv++) { numpv++; std::vector<reco::TrackBaseRef>::const_iterator rr = find((*iv).tracks_begin(), (*iv).tracks_end(), ttr1); if( rr != (*iv).tracks_end() ) { itrack_belong++; // std::cout<<" Numpv "<<numpv<<std::endl; break; } } // all vertices // std::cout<<" Track in PV "<<itrack_belong<<" "<<numpv<<std::endl; if( numpv > 1 && itrack_belong == 0 ) { // std::cout<<" Drop track "<<std::endl; continue; } // std::cout<<" we take it "<<numpv<<" "<<itrack_belong<<std::endl; if ( failTrackQuality(itrk) ) { continue; } // std::cout<<" Track accepted "<<std::endl; TrackRefs::iterator it = jet_tracks.caloFace_.end(); bool found = findTrack( jet_tracks, itrk, it ); // std::cout<<"JetPlusTrackCorrector::matchTracks: jet_tracks.caloFace_.size()="<<jet_tracks.caloFace_.size() // <<" found = "<<found<<std::endl; bool is_muon = useMuons_ && matchMuons( itrk, reco_muons ); bool is_ele = useElecs_ && matchElectrons( itrk, reco_elecs, reco_elec_ids ); if ( found ) { if ( is_muon ) { muons.inVertexInCalo_.push_back(*it); } else if ( is_ele ) { elecs.inVertexInCalo_.push_back(*it); } else { pions.inVertexInCalo_.push_back(*it); } } else { if ( is_muon ) { muons.inVertexOutOfCalo_.push_back(*itrk); } else if ( is_ele ) { elecs.inVertexOutOfCalo_.push_back(*itrk); } else { pions.inVertexOutOfCalo_.push_back(*itrk); // std::cout<<"JetPlusTrackCorrector::matchTracks: pions.inVertexOutOfCalo_.push_back(*itrk), size=" // <<pions.inVertexOutOfCalo_.size() <<std::endl; } } } } // Identify pions/muons/electrons that are "out/in" { TrackRefs::iterator itrk = jet_tracks.caloFace_.begin(); TrackRefs::iterator jtrk = jet_tracks.caloFace_.end(); for ( ; itrk != jtrk; ++itrk ) { if ( failTrackQuality(itrk) ) { continue; } if ( !tracksInCalo( pions, muons, elecs ) ) { continue; } bool found = findTrack( pions, muons, elecs, itrk ); if ( !found ) { bool is_muon = useMuons_ && matchMuons( itrk, reco_muons ); bool is_ele = useElecs_ && matchElectrons( itrk, reco_elecs, reco_elec_ids ); if ( is_muon ) { muons.outOfVertexInCalo_.push_back(*itrk); } else if ( is_ele ) { elecs.outOfVertexInCalo_.push_back(*itrk); } else { pions.outOfVertexInCalo_.push_back(*itrk); } } } } if ( verbose_ && edm::isDebugEnabled() ) { std::stringstream ss; ss << "[JetPlusTrackCorrector::" << __func__ << "] Number of tracks:" << std::endl << " In-cone at Vertex and in-cone at CaloFace:" << std::endl << " Pions : " << pions.inVertexInCalo_.size() << std::endl << " Muons : " << muons.inVertexInCalo_.size() << std::endl << " Electrons : " << elecs.inVertexInCalo_.size() << std::endl << " In-cone at Vertex and out-of-cone at CaloFace:" << std::endl << " Pions : " << pions.inVertexOutOfCalo_.size() << std::endl << " Muons : " << muons.inVertexOutOfCalo_.size() << std::endl << " Electrons : " << elecs.inVertexOutOfCalo_.size() << std::endl << " Out-of-cone at Vertex and in-cone at CaloFace:" << std::endl << " Pions : " << pions.outOfVertexInCalo_.size() << std::endl << " Muons : " << muons.outOfVertexInCalo_.size() << std::endl << " Electrons : " << elecs.outOfVertexInCalo_.size() << std::endl; LogTrace("JetPlusTrackCorrector") << ss.str(); } }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::muonCorrection | ( | const P4 & | jet, |
const jpt::MatchedTracks & | muons | ||
) | const |
Calculates correction to be applied using muons.
Definition at line 709 of file JetPlusTrackCorrector.cc.
References jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, jpt::MatchedTracks::outOfVertexInCalo_, edm::RefVector< C, T, F >::size(), useInConeTracks_, useOutOfConeTracks_, useOutOfVertexTracks_, and verbose_.
Referenced by correction().
{ P4 corr_muons; P4 corr_muons_in_cone; P4 corr_muons_out_of_cone; P4 corr_muons_out_of_vertex; if ( useInConeTracks_ ) { corr_muons_in_cone = muonCorrection( jet, muons.inVertexInCalo_, true, true ); corr_muons += corr_muons_in_cone; } if ( useOutOfConeTracks_ ) { corr_muons_out_of_cone = muonCorrection( jet, muons.inVertexOutOfCalo_, true, false ); corr_muons += corr_muons_out_of_cone; } if ( useOutOfVertexTracks_ ) { corr_muons_out_of_vertex = muonCorrection( jet, muons.outOfVertexInCalo_, false, true ); corr_muons += corr_muons_out_of_vertex; } if ( verbose_ ) { std::stringstream ss; ss << " Muon corrections:" << std::endl << " In/In : " << "(" << muons.inVertexInCalo_.size() << ") " << corr_muons_in_cone.energy() << std::endl << " In/Out : " << "(" << muons.inVertexOutOfCalo_.size() << ") " << corr_muons_out_of_cone.energy() << std::endl << " Out/In : " << "(" << muons.outOfVertexInCalo_.size() << ") " << corr_muons_out_of_vertex.energy(); edm::LogVerbatim("JetPlusTrackCorrector") << ss.str(); } return corr_muons; }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::muonCorrection | ( | const P4 & | jet, |
const TrackRefs & | muons, | ||
bool | in_cone_at_vertex, | ||
bool | in_cone_at_calo_face | ||
) | const [inline, protected] |
Calculates individual muons corrections.
Definition at line 476 of file JetPlusTrackCorrector.h.
References calculateCorr(), efficiencyMap(), leakageMap(), muonMass_, and responseMap().
{ static jpt::Efficiency not_used( responseMap(), efficiencyMap(), leakageMap() ); return calculateCorr( jet, muons, not_used, in_cone_at_vertex, in_cone_at_calo_face, muonMass_, false, 2. ); }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::pionCorrection | ( | const P4 & | jet, |
const jpt::MatchedTracks & | pions | ||
) | const |
Calculates corrections to be applied using pions.
Definition at line 636 of file JetPlusTrackCorrector.cc.
References efficiencyMap(), jpt::MatchedTracks::inVertexInCalo_, jpt::MatchedTracks::inVertexOutOfCalo_, leakageMap(), jpt::MatchedTracks::outOfVertexInCalo_, pionEfficiency(), responseMap(), edm::RefVector< C, T, F >::size(), useEff_, useInConeTracks_, useOutOfConeTracks_, useOutOfVertexTracks_, and verbose_.
Referenced by correction().
{ P4 corr_pions; /* std::cout<<" pionCorrection::Corrections for jet "<< theResponseOfChargedWithEff <<" "<< theResponseOfChargedWithoutEff <<" "<< theSumPtWithEff <<" "<< theSumPtWithoutEff <<" "<< theSumEnergyWithEff <<" "<< theSumEnergyWithoutEff <<std::endl; */ // In-cone P4 corr_pions_in_cone; P4 corr_pions_eff_in_cone; Efficiency in_cone( responseMap(), efficiencyMap(), leakageMap() ); if ( useInConeTracks_ ) { corr_pions_in_cone = pionCorrection( jet, pions.inVertexInCalo_, in_cone, true, true ); corr_pions += corr_pions_in_cone; if ( useEff_ ) { corr_pions_eff_in_cone = pionEfficiency( jet, in_cone, true ); corr_pions += corr_pions_eff_in_cone; } } // Out-of-cone P4 corr_pions_out_of_cone; P4 corr_pions_eff_out_of_cone; Efficiency out_of_cone( responseMap(), efficiencyMap(), leakageMap() ); if ( useOutOfConeTracks_ ) { corr_pions_out_of_cone = pionCorrection( jet, pions.inVertexOutOfCalo_, out_of_cone, true, false ); corr_pions += corr_pions_out_of_cone; if ( useEff_ ) { corr_pions_eff_out_of_cone = pionEfficiency( jet, out_of_cone, false ); corr_pions += corr_pions_eff_out_of_cone; } } // Out-of-vertex P4 corr_pions_out_of_vertex; Efficiency not_used( responseMap(), efficiencyMap(), leakageMap() ); if ( useOutOfVertexTracks_ ) { corr_pions_out_of_vertex = pionCorrection( jet, pions.outOfVertexInCalo_, not_used, false, true ); corr_pions += corr_pions_out_of_vertex; } if ( verbose_ ) { std::stringstream ss; ss << " Pion corrections:" << std::endl << " In/In : " << "(" << pions.inVertexInCalo_.size() << ") " << corr_pions_in_cone.energy() << std::endl << " In/Out : " << "(" << pions.inVertexOutOfCalo_.size() << ") " << corr_pions_out_of_cone.energy() << std::endl << " Out/In : " << "(" << pions.outOfVertexInCalo_.size() << ") " << corr_pions_out_of_vertex.energy() << std::endl; if ( useEff_ ) { ss << " Pion efficiency corrections:" << std::endl << " In/In : " << "(" << pions.inVertexInCalo_.size() << ") " << corr_pions_eff_in_cone.energy() << std::endl << " In/Out : " << "(" << pions.inVertexOutOfCalo_.size() << ") " << corr_pions_eff_out_of_cone.energy(); } edm::LogVerbatim("JetPlusTrackCorrector") << ss.str(); } return corr_pions; }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::pionCorrection | ( | const P4 & | jet, |
const TrackRefs & | pions, | ||
jpt::Efficiency & | eff, | ||
bool | in_cone_at_vertex, | ||
bool | in_cone_at_calo_face | ||
) | const [inline, protected] |
Calculates individual pion corrections.
Definition at line 468 of file JetPlusTrackCorrector.h.
References calculateCorr(), and pionMass_.
{ return calculateCorr( jet, pions, eff, in_cone_at_vertex, in_cone_at_calo_face, pionMass_, true, -1. ); }
JetPlusTrackCorrector::P4 JetPlusTrackCorrector::pionEfficiency | ( | const P4 & | jet, |
const jpt::Efficiency & | eff, | ||
bool | in_cone_at_calo_face | ||
) | const [protected] |
Correction to be applied using tracking efficiency.
Definition at line 999 of file JetPlusTrackCorrector.cc.
References jpt::Map::binCenterEta(), jpt::Map::binCenterPt(), corr, correction(), jpt::Efficiency::inConeCorr(), jpt::Map::nEtaBins(), jpt::Map::nPtBins(), jpt::Efficiency::nTrks(), jpt::Efficiency::outOfConeCorr(), pionMass_, response_, theResponseOfChargedWithEff, theSumEnergyWithEff, theSumPtWithEff, vecResponse_, and vectorial_.
Referenced by pionCorrection().
{ // Total correction to be applied P4 correction; double theSumResp = 0; double theSumPt = 0; double theSumEnergy = 0; // Iterate through eta/pt bins for ( uint32_t ieta = 0; ieta < response_.nEtaBins()-1; ++ieta ) { for ( uint32_t ipt = 0; ipt < response_.nPtBins()-1; ++ipt ) { // Check tracks are found in this eta/pt bin if ( !eff.nTrks(ieta,ipt) ) { continue; } for ( uint16_t ii = 0; ii < 2; ++ii ) { // Check which correction should be applied double corr = 0.; if ( ii == 0 ) { corr = eff.outOfConeCorr( ieta, ipt );} else if ( ii == 1 && in_cone_at_calo_face ) { corr = eff.inConeCorr( ieta, ipt );} else { continue; } // Calculate correction to be applied P4 corr_p4; if ( vectorial_ && vecResponse_ ) { double corr_eta = response_.binCenterEta(ieta); double corr_phi = jet.phi(); //@@ jet phi! double corr_pt = response_.binCenterPt(ipt); corr_p4 = PtEtaPhiM( corr_pt, corr_eta, corr_phi, pionMass_ ); //@@ E^2 = p^2 + m_pion^2, |p| calc'ed from pt bin corr_p4 *= ( corr_p4.energy() > 0. ? corr / corr_p4.energy() : 1. ); //@@ p4 scaled up by mean energy for bin } else { corr_p4 = ( jet.energy() > 0. ? corr / jet.energy() : 1. ) * jet; } // Apply correction if ( ii == 0 ) { correction += corr_p4; theSumPt += corr_p4.pt(); theSumEnergy += corr_p4.energy();} //@@ Add out-of-cone else if ( ii == 1 ) { correction -= corr_p4; theSumResp += corr_p4.energy();} //@@ Subtract in-cone } } } theResponseOfChargedWithEff += theSumResp; theSumPtWithEff += theSumPt; theSumEnergyWithEff += theSumEnergy; /* std::cout<<" Efficiency correction End::Corrections for jet "<< theResponseOfChargedWithEff <<" "<< theResponseOfChargedWithoutEff <<" "<< theSumPtWithEff <<" "<< theSumPtWithoutEff <<" "<< theSumEnergyWithEff <<" "<< theSumEnergyWithoutEff <<std::endl; */ return correction; }
void JetPlusTrackCorrector::rebuildJta | ( | const reco::Jet & | fJet, |
const JetTracksAssociations & | jtV0, | ||
TrackRefs & | included, | ||
TrackRefs & | excluded | ||
) | const [protected] |
Rebuild jet-track association.
Definition at line 1131 of file JetPlusTrackCorrector.cc.
References reco::JetExtendedAssociation::allJets(), edm::RefVector< C, T, F >::begin(), edm::RefVector< C, T, F >::clear(), Geom::deltaR2(), edm::RefVector< C, T, F >::end(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), reco::JetExtendedAssociation::getValue(), reco::btau::jetEta, reco::btau::jetPhi, jetSplitMerge_, reco::LeafCandidate::phi(), edm::RefVector< C, T, F >::push_back(), pileupReCalc_HLTpaths::scale, and testEve_cfg::tracks.
Referenced by jtaUsingEventData().
{ // std::cout<<" NEW1 Merge/Split schema "<<jetSplitMerge_<<std::endl; tracksthis = reco::JetTracksAssociation::getValue(jtV0,fJet); if(jetSplitMerge_<0) return; typedef std::vector<reco::JetBaseRef>::iterator JetBaseRefIterator; std::vector<reco::JetBaseRef> theJets = reco::JetTracksAssociation::allJets(jtV0); TrackRefs tracks = tracksthis; tracksthis.clear(); // std::cout<<" Size of initial vector "<<tracks.size()<<" "<<fJet.et()<<" "<<fJet.eta()<<" "<<fJet.phi()<<std::endl; int tr=0; double jetEta=fJet.eta(); double jetPhi=fJet.phi(); double jetEtIn=1.0/fJet.et(); for(TrackRefs::iterator it = tracks.begin(); it != tracks.end(); it++ ) { double trkEta=(**it).eta(); double trkPhi=(**it).phi(); double dR2this = deltaR2( jetEta, jetPhi, trkEta, trkPhi ); // double dfi = fabs(fJet.phi()-(**it).phi()); // if(dfi>4.*atan(1.))dfi = 8.*atan(1.)-dfi; // double deta = fJet.eta() - (**it).eta(); // double dR2check = sqrt(dfi*dfi+deta*deta); double scalethis = dR2this; if(jetSplitMerge_ == 0) scalethis = 1.*jetEtIn; if(jetSplitMerge_ == 2) scalethis = dR2this*jetEtIn; tr++; int flag = 1; for(JetBaseRefIterator ii = theJets.begin(); ii != theJets.end(); ii++) { if(&(**ii) == &fJet ) {continue;} double dR2 = deltaR2( (*ii)->eta(), (*ii)->phi(), trkEta, trkPhi ); double scale = dR2; if(jetSplitMerge_ == 0) scale = 1.*jetEtIn; if(jetSplitMerge_ == 2) scale = dR2*jetEtIn; if(scale < scalethis) flag = 0; if(flag == 0) { //std::cout<<" Track belong to another jet also "<<dR2<<" "<< //(*ii)->et()<<" "<<(*ii)->eta()<<" "<< (*ii)->phi()<<" Track "<<(**it).eta()<<" "<<(**it).phi()<<" "<<scalethis<<" "<<scale<<" "<<flag<<std::endl; break; } } //std::cout<<" Track "<<tr<<" "<<flag<<" "<<dR2this<<" "<<dR2check<<" Jet "<<fJet.eta()<<" "<< fJet.phi()<<" Track "<<(**it).eta()<<" "<<(**it).phi()<<std::endl; if(flag == 1) {tracksthis.push_back (*it);}else{Excl.push_back (*it);} } //std::cout<<" The new size of tracks "<<tracksthis.size()<<" Excludede "<<Excl.size()<<std::endl; return; }
const jpt::Map & JetPlusTrackCorrector::responseMap | ( | ) | const [inline, protected] |
Definition at line 499 of file JetPlusTrackCorrector.h.
References response_.
Referenced by elecCorrection(), muonCorrection(), and pionCorrection().
{ return response_; }
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 625 of file JetPlusTrackCorrector.cc.
References edm::RefVector< C, T, F >::empty(), and jpt::MatchedTracks::inVertexInCalo_.
Referenced by matchTracks().
{ if ( !pions.inVertexInCalo_.empty() || !muons.inVertexInCalo_.empty() || !elecs.inVertexInCalo_.empty() ) { return true; } else { return false; } }
bool JetPlusTrackCorrector::vectorialCorrection | ( | ) | const [inline] |
Returns value of configurable.
Definition at line 465 of file JetPlusTrackCorrector.h.
References vectorial_.
{ return vectorial_; }
double JetPlusTrackCorrector::dzVertexCut_ [protected] |
Definition at line 418 of file JetPlusTrackCorrector.h.
Referenced by failTrackQuality().
const jpt::Map JetPlusTrackCorrector::efficiency_ [protected] |
Definition at line 431 of file JetPlusTrackCorrector.h.
Referenced by correctAA(), and efficiencyMap().
double JetPlusTrackCorrector::elecMass_ [protected] |
Definition at line 437 of file JetPlusTrackCorrector.h.
Referenced by elecCorrection().
edm::InputTag JetPlusTrackCorrector::electronIds_ [protected] |
Definition at line 424 of file JetPlusTrackCorrector.h.
Referenced by getElectrons().
edm::InputTag JetPlusTrackCorrector::electrons_ [protected] |
Definition at line 423 of file JetPlusTrackCorrector.h.
Referenced by getElectrons(), and JetPlusTrackCorrector().
int JetPlusTrackCorrector::jetSplitMerge_ [protected] |
Definition at line 415 of file JetPlusTrackCorrector.h.
Referenced by excludeJta(), JetPlusTrackCorrector(), jtaUsingEventData(), and rebuildJta().
edm::InputTag JetPlusTrackCorrector::jetTracksAtCalo_ [protected] |
Definition at line 414 of file JetPlusTrackCorrector.h.
Referenced by JetPlusTrackCorrector(), jetTrackAssociation(), and jtaUsingEventData().
Definition at line 413 of file JetPlusTrackCorrector.h.
Referenced by JetPlusTrackCorrector(), jetTrackAssociation(), and jtaUsingEventData().
const jpt::Map JetPlusTrackCorrector::leakage_ [protected] |
Definition at line 432 of file JetPlusTrackCorrector.h.
Referenced by leakageMap().
double JetPlusTrackCorrector::maxEta_ [protected] |
Definition at line 440 of file JetPlusTrackCorrector.h.
Referenced by canCorrect().
double JetPlusTrackCorrector::muonMass_ [protected] |
Definition at line 436 of file JetPlusTrackCorrector.h.
Referenced by muonCorrection().
edm::InputTag JetPlusTrackCorrector::muons_ [protected] |
Definition at line 422 of file JetPlusTrackCorrector.h.
Referenced by getMuons(), and JetPlusTrackCorrector().
double JetPlusTrackCorrector::pionMass_ [protected] |
Definition at line 435 of file JetPlusTrackCorrector.h.
Referenced by pionCorrection(), and pionEfficiency().
double JetPlusTrackCorrector::ptErrorQuality_ [protected] |
Definition at line 417 of file JetPlusTrackCorrector.h.
Referenced by failTrackQuality().
const jpt::Map JetPlusTrackCorrector::response_ [protected] |
Definition at line 430 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correctAA(), pionEfficiency(), and responseMap().
edm::InputTag JetPlusTrackCorrector::srcPVs_ [protected] |
Definition at line 416 of file JetPlusTrackCorrector.h.
Referenced by matchTracks().
float JetPlusTrackCorrector::theResponseOfChargedWithEff [mutable, protected] |
Definition at line 441 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), getResponseOfChargedWithEff(), and pionEfficiency().
float JetPlusTrackCorrector::theResponseOfChargedWithoutEff [mutable, protected] |
Definition at line 442 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), and getResponseOfChargedWithoutEff().
float JetPlusTrackCorrector::theSumEnergyWithEff [mutable, protected] |
Definition at line 445 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), getSumEnergyWithEff(), and pionEfficiency().
float JetPlusTrackCorrector::theSumEnergyWithoutEff [mutable, protected] |
Definition at line 446 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), and getSumEnergyWithoutEff().
float JetPlusTrackCorrector::theSumPtForBeta [mutable, protected] |
Definition at line 447 of file JetPlusTrackCorrector.h.
Referenced by correction(), getSumPtForBeta(), and matchTracks().
float JetPlusTrackCorrector::theSumPtWithEff [mutable, protected] |
Definition at line 443 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), getSumPtWithEff(), and pionEfficiency().
float JetPlusTrackCorrector::theSumPtWithoutEff [mutable, protected] |
Definition at line 444 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), and getSumPtWithoutEff().
Definition at line 427 of file JetPlusTrackCorrector.h.
Referenced by failTrackQuality(), and matchTracks().
bool JetPlusTrackCorrector::useEff_ [protected] |
Definition at line 407 of file JetPlusTrackCorrector.h.
Referenced by JetPlusTrackCorrector(), and pionCorrection().
bool JetPlusTrackCorrector::useElecs_ [protected] |
Definition at line 409 of file JetPlusTrackCorrector.h.
Referenced by correction(), JetPlusTrackCorrector(), and matchTracks().
bool JetPlusTrackCorrector::useInConeTracks_ [protected] |
Definition at line 403 of file JetPlusTrackCorrector.h.
Referenced by JetPlusTrackCorrector(), muonCorrection(), and pionCorrection().
bool JetPlusTrackCorrector::useMuons_ [protected] |
Definition at line 408 of file JetPlusTrackCorrector.h.
Referenced by correction(), JetPlusTrackCorrector(), and matchTracks().
bool JetPlusTrackCorrector::useOutOfConeTracks_ [protected] |
Definition at line 404 of file JetPlusTrackCorrector.h.
Referenced by JetPlusTrackCorrector(), muonCorrection(), and pionCorrection().
bool JetPlusTrackCorrector::useOutOfVertexTracks_ [protected] |
Definition at line 405 of file JetPlusTrackCorrector.h.
Referenced by JetPlusTrackCorrector(), muonCorrection(), and pionCorrection().
bool JetPlusTrackCorrector::usePions_ [protected] |
Definition at line 406 of file JetPlusTrackCorrector.h.
Referenced by correction(), and JetPlusTrackCorrector().
bool JetPlusTrackCorrector::useTrackQuality_ [protected] |
Definition at line 410 of file JetPlusTrackCorrector.h.
Referenced by failTrackQuality(), JetPlusTrackCorrector(), and matchTracks().
bool JetPlusTrackCorrector::vecResponse_ [protected] |
Definition at line 402 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), JetPlusTrackCorrector(), and pionEfficiency().
bool JetPlusTrackCorrector::vectorial_ [protected] |
Definition at line 401 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), JetPlusTrackCorrector(), pionEfficiency(), and vectorialCorrection().
bool JetPlusTrackCorrector::verbose_ [protected] |
Definition at line 400 of file JetPlusTrackCorrector.h.
Referenced by calculateCorr(), correction(), elecCorrection(), JetPlusTrackCorrector(), jtaUsingEventData(), matchTracks(), muonCorrection(), and pionCorrection().
reco::Particle::Point JetPlusTrackCorrector::vertex_ [mutable, protected] |
Definition at line 419 of file JetPlusTrackCorrector.h.
Referenced by failTrackQuality(), and matchTracks().