29 namespace reco {
namespace tau {
56 corrLevel_(cfg.getParameter<unsigned>(
"corrLevel")),
57 lev1PhiWindow_(cfg.getParameter<double>(
"lev1PhiWindow")),
58 lev1EtaWindow_(cfg.getParameter<double>(
"lev1EtaWindow"))
75 if ( vertices->size() >= 1 ) {
96 signalPFCandidate != signalPFCandidates.
end(); ++signalPFCandidate ) {
97 if ( pfJetConstituent.
key() == signalPFCandidate->key() ) retVal =
true;
110 double tauEnergyCorr = 0.;
114 bool needsCorrLevel1 =
false;
116 std::vector<reco::PFCandidatePtr> pfJetConstituents = tau.
jetRef()->getPFConstituents();
117 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfJetConstituent = pfJetConstituents.begin();
118 pfJetConstituent != pfJetConstituents.end(); ++pfJetConstituent ) {
128 if ( needsCorrLevel1 ) {
129 std::vector<reco::PFCandidatePtr> pfJetConstituents = tau.
jetRef()->getPFConstituents();
130 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfJetConstituent = pfJetConstituents.begin();
131 pfJetConstituent != pfJetConstituents.end(); ++pfJetConstituent ) {
135 tauEnergyCorr += (*pfJetConstituent)->energy();
138 double caloEn = (*pfJetConstituent)->ecalEnergy() + (*pfJetConstituent)->hcalEnergy();
139 tauEnergyCorr += caloEn;
149 double leadTrackMom = 0.;
150 double leadTrackMomErr = 0.;
151 double jetCaloEn = 0.;
153 std::vector<reco::PFCandidatePtr> pfJetConstituents = tau.
jetRef()->getPFConstituents();
154 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfJetConstituent = pfJetConstituents.begin();
155 pfJetConstituent != pfJetConstituents.end(); ++pfJetConstituent ) {
159 double trackPtErr = track->
ptError();
162 (trackPt - 3.*trackPtErr) > (*pfJetConstituent)->pt() && trackPt < (3.*tau.
jetRef()->pt()) ) {
163 if ( track->
p() > leadTrackMom ) {
164 leadTrackMom = track->
p();
165 leadTrackMomErr = leadTrackMom*(trackPtErr/
trackPt);
170 double caloEn = (*pfJetConstituent)->ecalEnergy() + (*pfJetConstituent)->hcalEnergy();
174 if ( leadTrackMom > tau.
p() ) {
175 const double chargedPionMass = 0.13957;
177 double jetCaloEnErr = 1.00*
sqrt(
std::max(jetCaloEn, leadTrackEn));
178 double combEn = ((1./
square(jetCaloEnErr))*jetCaloEn + (1./
square(leadTrackMomErr))*leadTrackEn)/
179 ((1./
square(jetCaloEnErr)) + (1./
square(leadTrackMomErr)));
184 if ( tau.
energy() > 0. ) {
185 double tauEnergy_corrected = tau.
energy() + tauEnergyCorr;
186 double scaleFactor = tauEnergy_corrected/tau.
energy();
187 double tauPx_corrected = scaleFactor*tau.
px();
188 double tauPy_corrected = scaleFactor*tau.
py();
189 double tauPz_corrected = scaleFactor*tau.
pz();
199 "RecoTauEnergyRecoveryPlugin");
double p() const
momentum vector magnitude
virtual double energy() const GCC11_FINAL
energy
T getParameter(std::string const &) const
RecoTauEnergyRecoveryPlugin(const edm::ParameterSet &)
const PFJetRef & jetRef() const
virtual double p() const GCC11_FINAL
magnitude of momentum vector
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
virtual ~RecoTauEnergyRecoveryPlugin()
edm::InputTag srcVertices_
bool filter(const reco::PFCandidate &cand) const
Filter a single PFCandidate.
const_iterator end() const
Termination of iteration.
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
const Point & position() const
position
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
const PFCandidateRefVector & signalPFCands() const
PFCandidates in signal region.
const_iterator begin() const
Initialize an iterator over the RefVector.
const reco::Vertex * theEventVertex_
reco::TrackRef trackRef() const
bool isNonnull() const
Checks for non-null.
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
const T & max(const T &a, const T &b)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
bool isTauSignalPFCandidate(const reco::PFTau &tau, const reco::PFCandidatePtr &pfJetConstituent)
double pt() const
track transverse momentum
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
void operator()(PFTau &) const
const edm::Event * evt() const
virtual void beginEvent()
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
RecoTauQualityCuts * qcuts_
reco::GsfTrackRef gsfTrackRef() const
const reco::TrackBaseRef getTrack(const reco::PFCandidate &cand)
int numberOfValidPixelHits() const
void setalternatLorentzVect(math::XYZTLorentzVector)
#define DEFINE_EDM_PLUGIN(factory, type, name)
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
bool isNonnull() const
Checks for non-null.