CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoTauTag/RecoTau/plugins/RecoTauImpactParameterSignificancePlugin.cc

Go to the documentation of this file.
00001 /*
00002  * =============================================================================
00003  *       Filename:  RecoTauImpactParameterSignificancePlugin.cc
00004  *
00005  *    Description:  Add the IP significance of the lead track w.r.t to the PV.
00006  *                  to a PFTau.
00007  *        Created:  10/31/2010 13:32:14
00008  *
00009  *         Authors:  Evan K. Friis (UC Davis), evan.klose.friis@cern.ch,
00010  *                   Simone Gennai, Ludovic Houchu
00011  *
00012  * =============================================================================
00013  */
00014 
00015 #include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h"
00016 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00017 #include "DataFormats/VertexReco/interface/Vertex.h"
00018 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00019 
00020 #include "FWCore/Framework/interface/ESHandle.h"
00021 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00022 
00023 #include "TrackingTools/IPTools/interface/IPTools.h"
00024 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
00025 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00026 
00027 namespace reco { namespace tau {
00028 
00029 class RecoTauImpactParameterSignificancePlugin : public RecoTauModifierPlugin {
00030   public:
00031     explicit RecoTauImpactParameterSignificancePlugin(
00032         const edm::ParameterSet& pset);
00033     virtual ~RecoTauImpactParameterSignificancePlugin() {}
00034     void operator()(PFTau& tau) const;
00035     virtual void beginEvent();
00036   private:
00037     RecoTauVertexAssociator vertexAssociator_;
00038     const TransientTrackBuilder *builder_;
00039 };
00040 
00041 RecoTauImpactParameterSignificancePlugin
00042 ::RecoTauImpactParameterSignificancePlugin(const edm::ParameterSet& pset)
00043   :RecoTauModifierPlugin(pset),
00044   vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts")){}
00045 
00046 void RecoTauImpactParameterSignificancePlugin::beginEvent() {
00047   vertexAssociator_.setEvent(*evt());
00048   // Get tranisent track builder.
00049   edm::ESHandle<TransientTrackBuilder> myTransientTrackBuilder;
00050   evtSetup()->get<TransientTrackRecord>().get("TransientTrackBuilder",
00051                                               myTransientTrackBuilder);
00052   builder_= myTransientTrackBuilder.product();
00053 }
00054 
00055 void RecoTauImpactParameterSignificancePlugin::operator()(PFTau& tau) const {
00056   // Get the transient lead track
00057   if (tau.leadPFChargedHadrCand().isNonnull()) {
00058     TrackRef leadTrack = tau.leadPFChargedHadrCand()->trackRef();
00059     if (leadTrack.isNonnull()) {
00060       const TransientTrack track = builder_->build(leadTrack);
00061       GlobalVector direction(tau.jetRef()->px(), tau.jetRef()->py(),
00062                              tau.jetRef()->pz());
00063       VertexRef pv = vertexAssociator_.associatedVertex(tau);
00064       // Compute the significance
00065       std::pair<bool,Measurement1D> ipsig =
00066           IPTools::signedImpactParameter3D(track, direction, *pv);
00067       if (ipsig.first)
00068         tau.setleadPFChargedHadrCandsignedSipt(ipsig.second.significance());
00069     }
00070   }
00071 }
00072 
00073 }} // end namespace reco::tau
00074 #include "FWCore/Framework/interface/MakerMacros.h"
00075 DEFINE_EDM_PLUGIN(RecoTauModifierPluginFactory,
00076     reco::tau::RecoTauImpactParameterSignificancePlugin,
00077     "RecoTauImpactParameterSignificancePlugin");