CMS 3D CMS Logo

RecoTauImpactParameterSignificancePlugin.cc
Go to the documentation of this file.
1 /*
2  * =============================================================================
3  * Filename: RecoTauImpactParameterSignificancePlugin.cc
4  *
5  * Description: Add the IP significance of the lead track w.r.t to the PV.
6  * to a PFTau.
7  * Created: 10/31/2010 13:32:14
8  *
9  * Authors: Evan K. Friis (UC Davis), evan.klose.friis@cern.ch,
10  * Simone Gennai, Ludovic Houchu
11  *
12  * =============================================================================
13  */
14 
20 
23 
27 
28 namespace reco {
29  namespace tau {
30 
32  public:
35  void operator()(PFTau& tau) const override;
36  void beginEvent() override;
37 
38  private:
41  };
42 
46  vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts"), std::move(iC)) {}
47 
50  // Get tranisent track builder.
51  edm::ESHandle<TransientTrackBuilder> myTransientTrackBuilder;
52  evtSetup()->get<TransientTrackRecord>().get("TransientTrackBuilder", myTransientTrackBuilder);
53  builder_ = myTransientTrackBuilder.product();
54  }
55 
56  namespace {
57  inline const reco::Track* getTrack(const Candidate& cand) {
58  const PFCandidate* pfCandPtr = dynamic_cast<const PFCandidate*>(&cand);
59  if (pfCandPtr) {
60  if (pfCandPtr->trackRef().isNonnull())
61  return pfCandPtr->trackRef().get();
62  else
63  return nullptr;
64  }
65 
66  const pat::PackedCandidate* packedCand = dynamic_cast<const pat::PackedCandidate*>(&cand);
67  if (packedCand && packedCand->hasTrackDetails())
68  return &packedCand->pseudoTrack();
69 
70  return nullptr;
71  }
72  } // namespace
73 
75  // Get the transient lead track
76  if (tau.leadChargedHadrCand().isNonnull()) {
77  const reco::Track* leadTrack = getTrack(*tau.leadChargedHadrCand());
78  if (leadTrack != nullptr) {
80  GlobalVector direction(tau.jetRef()->px(), tau.jetRef()->py(), tau.jetRef()->pz());
82  // Compute the significance
83  std::pair<bool, Measurement1D> ipsig = IPTools::signedImpactParameter3D(track, direction, *pv);
84  if (ipsig.first)
85  tau.setleadPFChargedHadrCandsignedSipt(ipsig.second.significance());
86  }
87  }
88  }
89 
90  } // namespace tau
91 } // namespace reco
95  "RecoTauImpactParameterSignificancePlugin");
reco::PFCandidate::trackRef
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:408
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
pat::PackedCandidate::hasTrackDetails
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
Definition: PackedCandidate.h:788
reco::tau::RecoTauEventHolderPlugin::evt
const edm::Event * evt() const
Definition: RecoTauPluginsCommon.cc:16
reco::tau::RecoTauImpactParameterSignificancePlugin::~RecoTauImpactParameterSignificancePlugin
~RecoTauImpactParameterSignificancePlugin() override
Definition: RecoTauImpactParameterSignificancePlugin.cc:34
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
ESHandle.h
metsig::tau
Definition: SignAlgoResolutions.h:49
PFCandidate.h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
reco::PFTau
Definition: PFTau.h:36
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
TransientTrack.h
reco::tau::RecoTauImpactParameterSignificancePlugin::vertexAssociator_
RecoTauVertexAssociator vertexAssociator_
Definition: RecoTauImpactParameterSignificancePlugin.cc:39
edm::Ref< VertexCollection >
MakerMacros.h
singlePfTauSkim_cff.leadTrack
leadTrack
Definition: singlePfTauSkim_cff.py:22
reco::tau::RecoTauVertexAssociator
Definition: RecoTauVertexAssociator.h:50
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
IPTools::signedImpactParameter3D
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:81
TransientTrackRecord
Definition: TransientTrackRecord.h:11
reco::Track
Definition: Track.h:27
edm::ESHandle< TransientTrackBuilder >
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
reco::tau::RecoTauImpactParameterSignificancePlugin::beginEvent
void beginEvent() override
Definition: RecoTauImpactParameterSignificancePlugin.cc:48
Vertex.h
pat::PackedCandidate::pseudoTrack
virtual const reco::Track & pseudoTrack() const
Definition: PackedCandidate.h:773
TransientTrackBuilder.h
reco::tau::RecoTauVertexAssociator::associatedVertex
reco::VertexRef associatedVertex(const Jet &jet) const
Definition: RecoTauVertexAssociator.cc:378
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
pat::PackedCandidate
Definition: PackedCandidate.h:22
edmplugin::PluginFactory
Definition: PluginFactory.h:34
PackedCandidate.h
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
math::GlobalVector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:28
cand
Definition: decayParser.h:32
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
TransientTrackBuilder
Definition: TransientTrackBuilder.h:16
TransientTrackRecord.h
reco::tau::RecoTauVertexAssociator::setEvent
void setEvent(const edm::Event &evt)
Load the vertices from the event.
Definition: RecoTauVertexAssociator.cc:242
reco::get
T get(const Candidate &c)
Definition: component.h:60
reco::Candidate
Definition: Candidate.h:27
RecoTauBuilderPlugins.h
VertexFwd.h
getTrack
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
Definition: GhostTrackState.cc:49
reco::tau::RecoTauImpactParameterSignificancePlugin::operator()
void operator()(PFTau &tau) const override
Definition: RecoTauImpactParameterSignificancePlugin.cc:74
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
IPTools.h
reco::TransientTrack
Definition: TransientTrack.h:19
reco::tau::RecoTauImpactParameterSignificancePlugin::RecoTauImpactParameterSignificancePlugin
RecoTauImpactParameterSignificancePlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
Definition: RecoTauImpactParameterSignificancePlugin.cc:43
reco::tau::RecoTauModifierPlugin
Definition: RecoTauBuilderPlugins.h:104
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
reco::tau::RecoTauEventHolderPlugin::evtSetup
const edm::EventSetup * evtSetup() const
Definition: RecoTauPluginsCommon.cc:18
reco::tau::RecoTauImpactParameterSignificancePlugin
Definition: RecoTauImpactParameterSignificancePlugin.cc:31
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::tau::RecoTauImpactParameterSignificancePlugin::builder_
const TransientTrackBuilder * builder_
Definition: RecoTauImpactParameterSignificancePlugin.cc:40
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27