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 { namespace tau {
29 
31  public:
35  void operator()(PFTau& tau) const override;
36  void beginEvent() override;
37  private:
40 };
41 
44  :RecoTauModifierPlugin(pset,std::move(iC)),
45  vertexAssociator_(pset.getParameter<edm::ParameterSet>("qualityCuts"),std::move(iC)){}
46 
49  // Get tranisent track builder.
50  edm::ESHandle<TransientTrackBuilder> myTransientTrackBuilder;
51  evtSetup()->get<TransientTrackRecord>().get("TransientTrackBuilder",
52  myTransientTrackBuilder);
53  builder_= myTransientTrackBuilder.product();
54 }
55 
56 namespace
57 {
58  inline const reco::Track* getTrack(const Candidate& cand)
59  {
60  const PFCandidate* pfCandPtr = dynamic_cast<const PFCandidate*>(&cand);
61  if (pfCandPtr) {
62  if (pfCandPtr->trackRef().isNonnull())
63  return pfCandPtr->trackRef().get();
64  else
65  return nullptr;
66  }
67 
68  const pat::PackedCandidate* packedCand = dynamic_cast<const pat::PackedCandidate*>(&cand);
69  if (packedCand && packedCand->hasTrackDetails())
70  return &packedCand->pseudoTrack();
71 
72  return nullptr;
73  }
74 }
75 
77  // Get the transient lead track
78  if (tau.leadChargedHadrCand().isNonnull()) {
80  if (leadTrack != nullptr) {
81  const TransientTrack track = builder_->build(leadTrack);
82  GlobalVector direction(tau.jetRef()->px(), tau.jetRef()->py(),
83  tau.jetRef()->pz());
85  // Compute the significance
86  std::pair<bool,Measurement1D> ipsig =
87  IPTools::signedImpactParameter3D(track, direction, *pv);
88  if (ipsig.first)
89  tau.setleadPFChargedHadrCandsignedSipt(ipsig.second.significance());
90  }
91  }
92 }
93 
94 }} // end namespace reco::tau
98  "RecoTauImpactParameterSignificancePlugin");
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
reco::TransientTrack build(const reco::Track *p) const
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:71
void setEvent(const edm::Event &evt)
Load the vertices from the event.
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:442
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:67
const JetBaseRef & jetRef() const
Definition: PFTau.cc:58
def pv(vc)
Definition: MetAnalyzer.py:7
virtual const reco::Track & pseudoTrack() const
void setleadPFChargedHadrCandsignedSipt(const float &)
Definition: PFTau.cc:76
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:243
const edm::EventSetup * evtSetup() const
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:27
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
RecoTauImpactParameterSignificancePlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
HLT enums.
reco::VertexRef associatedVertex(const Jet &jet) const
T get() const
Definition: EventSetup.h:71
#define DEFINE_EDM_PLUGIN(factory, type, name)
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511