CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
PFDisplacedVertexCandidateFinder Class Reference

#include <PFDisplacedVertexCandidateFinder.h>

Public Types

typedef reco::PFDisplacedVertexCandidateCollection::const_iterator IBC
 
typedef std::list< reco::TrackBaseRef >::iterator IE
 
typedef std::list< reco::TrackBaseRef >::const_iterator IEC
 
typedef std::vector< bool > Mask
 Mask used to spot if a track is free or not. More...
 

Public Member Functions

void findDisplacedVertexCandidates ()
 -----— Main function which find vertices -----— /// More...
 
 PFDisplacedVertexCandidateFinder ()
 
void setDebug (bool debug)
 sets debug printout flag More...
 
void setInput (const edm::Handle< reco::TrackCollection > &trackh, const MagneticField *magField)
 
void setParameters (double dcaCut, double primaryVertexCut, double dcaPInnerHitCut, const edm::ParameterSet &ps_trk)
 ---—— Set different algo parameters —— /// More...
 
void setPrimaryVertex (edm::Handle< reco::VertexCollection > mainVertexHandle, edm::Handle< reco::BeamSpot > beamSpotHandle)
 
std::unique_ptr< reco::PFDisplacedVertexCandidateCollectiontransferVertexCandidates ()
 
const std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > & vertexCandidates () const
 
 ~PFDisplacedVertexCandidateFinder ()
 

Private Member Functions

IE associate (IE next, IE last, reco::PFDisplacedVertexCandidate &tempVertexCandidate)
 --—— Different steps of the finder algorithm --—— /// More...
 
GlobalTrajectoryParameters getGlobalTrajectoryParameters (const reco::Track *) const
 --—— TOOLS --—— // More...
 
bool goodPtResolution (const reco::TrackBaseRef &trackref) const
 Quality Criterion on the Pt resolution to select a Track. More...
 
bool isSelected (const reco::TrackBaseRef &trackref)
 
void link (const reco::TrackBaseRef &el1, const reco::TrackBaseRef &el2, double &dist, GlobalPoint &crossing_point, reco::PFDisplacedVertexCandidate::VertexLinkTest &linktest)
 Check whether 2 elements are linked and fill the link parameters. More...
 
void packLinks (reco::PFDisplacedVertexCandidate &vertexCandidate)
 

Private Attributes

double dcaCut_
 –— Algo parameters for the vertex finder -— /// More...
 
double dcaPInnerHitCut2_
 Maximum distance between the DCA Point and the inner hit of the track. More...
 
bool debug_
 if true, debug printouts activated More...
 
double dxy_
 
std::list< reco::TrackBaseRefeventTracks_
 The track refs. More...
 
std::vector< GlobalTrajectoryParameterseventTrackTrajectories_
 
const MagneticFieldmagField_
 
double nChi2_max_
 
double primaryVertexCut2_
 Do not reconstruct vertices wich are too close to the beam pipe. More...
 
double pt_min_
 
double pt_min_prim_
 
math::XYZPoint pvtx_
 
TwoTrackMinimumDistance theMinimum_
 
edm::soa::PtEtaPhiTable track_table_
 
Mask trackMask_
 
std::unique_ptr< reco::PFDisplacedVertexCandidateCollectionvertexCandidates_
 -----— Members -----— /// More...
 
unsigned vertexCandidatesSize_
 

Friends

std::ostream & operator<< (std::ostream &, const PFDisplacedVertexCandidateFinder &)
 

Detailed Description

Definition at line 26 of file PFDisplacedVertexCandidateFinder.h.

Member Typedef Documentation

◆ IBC

typedef reco::PFDisplacedVertexCandidateCollection::const_iterator PFDisplacedVertexCandidateFinder::IBC

Definition at line 37 of file PFDisplacedVertexCandidateFinder.h.

◆ IE

Definition at line 35 of file PFDisplacedVertexCandidateFinder.h.

◆ IEC

typedef std::list<reco::TrackBaseRef>::const_iterator PFDisplacedVertexCandidateFinder::IEC

Definition at line 36 of file PFDisplacedVertexCandidateFinder.h.

◆ Mask

typedef std::vector<bool> PFDisplacedVertexCandidateFinder::Mask

Mask used to spot if a track is free or not.

Definition at line 33 of file PFDisplacedVertexCandidateFinder.h.

Constructor & Destructor Documentation

◆ PFDisplacedVertexCandidateFinder()

PFDisplacedVertexCandidateFinder::PFDisplacedVertexCandidateFinder ( )

Definition at line 17 of file PFDisplacedVertexCandidateFinder.cc.

19  dcaCut_(1000),
20  primaryVertexCut2_(0.0),
21  dcaPInnerHitCut2_(1000.0),
24  debug_(false),
25  magField_(nullptr) {}
std::vector< PFDisplacedVertexCandidate > PFDisplacedVertexCandidateCollection
collection of PFDisplacedVertexCandidate objects
double dcaCut_
–— Algo parameters for the vertex finder -— ///
std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > vertexCandidates_
-----— Members -----— ///
double primaryVertexCut2_
Do not reconstruct vertices wich are too close to the beam pipe.
double dcaPInnerHitCut2_
Maximum distance between the DCA Point and the inner hit of the track.
bool debug_
if true, debug printouts activated

◆ ~PFDisplacedVertexCandidateFinder()

PFDisplacedVertexCandidateFinder::~PFDisplacedVertexCandidateFinder ( )

Definition at line 27 of file PFDisplacedVertexCandidateFinder.cc.

References eventTracks_, and LogDebug.

27  {
28  LogDebug("PFDisplacedVertexCandidateFinder")
29  << "~PFDisplacedVertexCandidateFinder - number of remaining elements: " << eventTracks_.size();
30 }
std::list< reco::TrackBaseRef > eventTracks_
The track refs.
#define LogDebug(id)

Member Function Documentation

◆ associate()

PFDisplacedVertexCandidateFinder::IE PFDisplacedVertexCandidateFinder::associate ( IE  next,
IE  last,
reco::PFDisplacedVertexCandidate tempVertexCandidate 
)
private

--—— Different steps of the finder algorithm --—— ///

Recursive procedure to associate tracks together

Definition at line 110 of file PFDisplacedVertexCandidateFinder.cc.

References reco::PFDisplacedVertexCandidate::addElement(), reco::PFDisplacedVertexCandidate::elements(), eventTracks_, mps_fire::i, dqmdumpme::last, link(), LogDebug, LogTrace, GetRecoTauVFromDQM_MC_cff::next, trackMask_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by findDisplacedVertexCandidates().

111  {
112  LogDebug("PFDisplacedVertexCandidateFinder") << "== Start the association procedure ==";
113 
114  if (last != eventTracks_.end()) {
115  double dist = -1;
116  GlobalPoint crossingPoint(0, 0, 0);
118  link(*last, *next, dist, crossingPoint, linktest);
119 
120  if (dist < -0.5) {
121  LogDebug("PFDisplacedVertexCandidateFinder") << "link failed";
122 
123  return ++next; // association failed
124  } else {
125  // add next element to the current pflowblock
126  LogDebug("PFDisplacedVertexCandidateFinder")
127  << "adding element " << (*next).key() << " to PFDisplacedVertexCandidate with "
128  << tempVertexCandidate.elements().size() << " elements";
129  tempVertexCandidate.addElement((*next));
130  trackMask_[(*next).key()] = false;
131 
132  LogDebug("PFDisplacedVertexCandidateFinder")
133  << "link parameters "
134  << " *next = " << (*next).key() << " *last = " << (*last).key() << " dist = " << crossingPoint
135  << " P.x = " << crossingPoint.x() << " P.y = " << crossingPoint.y() << " P.z = " << crossingPoint.z();
136  }
137  } else {
138  // add next element to this eflowblock
139  LogDebug("PFDisplacedVertexCandidateFinder") << "adding to block element " << (*next).key();
140  tempVertexCandidate.addElement((*next));
141  trackMask_[(*next).key()] = false;
142  }
143 
144  // recursive call: associate next and other unused elements
145 #ifdef EDM_ML_DEBUG
146  for (unsigned i = 0; i < trackMask_.size(); i++)
147  LogTrace("PFDisplacedVertexCandidateFinder") << " Mask[" << i << "] = " << trackMask_[i];
148 #endif
149 
150  for (IE ie = eventTracks_.begin(); ie != eventTracks_.end();) {
151  if (ie == last || ie == next) {
152  ++ie;
153  continue;
154  }
155 
156  // *ie already included to a block
157  if (!trackMask_[(*ie).key()]) {
158  ++ie;
159  continue;
160  }
161 
162  LogDebug("PFDisplacedVertexCandidateFinder") << "calling associate " << (*next).key() << " & " << (*ie).key();
163  ie = associate(next, ie, tempVertexCandidate);
164  }
165 
166  LogDebug("PFDisplacedVertexCandidateFinder") << "**** removing element ";
167 
168  IE iteratorToNextFreeElement = eventTracks_.erase(next);
169 
170  LogDebug("PFDisplacedVertexCandidateFinder") << "== End the association procedure ==";
171 
172  return iteratorToNextFreeElement;
173 }
void addElement(const TrackBaseRef)
add a track Reference to the current Candidate
IE associate(IE next, IE last, reco::PFDisplacedVertexCandidate &tempVertexCandidate)
--—— Different steps of the finder algorithm --—— ///
std::list< reco::TrackBaseRef > eventTracks_
The track refs.
#define LogTrace(id)
void link(const reco::TrackBaseRef &el1, const reco::TrackBaseRef &el2, double &dist, GlobalPoint &crossing_point, reco::PFDisplacedVertexCandidate::VertexLinkTest &linktest)
Check whether 2 elements are linked and fill the link parameters.
std::list< reco::TrackBaseRef >::iterator IE
const std::vector< TrackBaseRef > & elements() const
#define LogDebug(id)

◆ findDisplacedVertexCandidates()

void PFDisplacedVertexCandidateFinder::findDisplacedVertexCandidates ( )

-----— Main function which find vertices -----— ///

Definition at line 81 of file PFDisplacedVertexCandidateFinder.cc.

References associate(), reco::PFDisplacedVertexCandidate::elements(), eventTracks_, reco::PFDisplacedVertexCandidate::isValid(), LogDebug, packLinks(), vertexCandidates_, and vertexCandidatesSize_.

Referenced by PFDisplacedVertexCandidateProducer::produce().

81  {
82  LogDebug("PFDisplacedVertexCandidateFinder") << "========= Start Finding Displaced Vertex Candidates =========";
83 
84  // The vertexCandidates have not been passed to the event, and need to be cleared
85  if (vertexCandidates_.get())
86  vertexCandidates_->clear();
87  else
88  vertexCandidates_ = std::make_unique<PFDisplacedVertexCandidateCollection>();
89 
91  for (IE ie = eventTracks_.begin(); ie != eventTracks_.end();) {
92  // Run the recursive procedure to find all tracks link together
93  // In one blob called Candidate
94 
95  PFDisplacedVertexCandidate tempVertexCandidate;
96 
97  ie = associate(eventTracks_.end(), ie, tempVertexCandidate);
98  LogDebug("PFDisplacedVertexCandidateFinder") << "elements=" << tempVertexCandidate.elements().size();
99 
100  // Build remaining links in current block
101  if (tempVertexCandidate.isValid()) {
102  packLinks(tempVertexCandidate);
103  vertexCandidates_->push_back(tempVertexCandidate);
104  }
105  }
106 
107  LogDebug("PFDisplacedVertexCandidateFinder") << "========= End Finding Displaced Vertex Candidates =========";
108 }
A block of tracks linked together.
IE associate(IE next, IE last, reco::PFDisplacedVertexCandidate &tempVertexCandidate)
--—— Different steps of the finder algorithm --—— ///
bool isValid() const
A Vertex Candidate is valid if it has at least two tracks.
std::list< reco::TrackBaseRef > eventTracks_
The track refs.
std::list< reco::TrackBaseRef >::iterator IE
std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > vertexCandidates_
-----— Members -----— ///
const std::vector< TrackBaseRef > & elements() const
void packLinks(reco::PFDisplacedVertexCandidate &vertexCandidate)
#define LogDebug(id)

◆ getGlobalTrajectoryParameters()

GlobalTrajectoryParameters PFDisplacedVertexCandidateFinder::getGlobalTrajectoryParameters ( const reco::Track track) const
private

--—— TOOLS --—— //

Allows to calculate the helix aproximation for a given track which may be then extrapolated to any point.

Definition at line 298 of file PFDisplacedVertexCandidateFinder.cc.

References magField_, position, and HLT_2022v11_cff::track.

Referenced by setInput().

298  {
299  const GlobalPoint position(track->vx(), track->vy(), track->vz());
300 
301  const GlobalVector momentum(track->momentum().x(), track->momentum().y(), track->momentum().z());
302 
303  GlobalTrajectoryParameters gtp(position, momentum, track->charge(), magField_);
304 
305  return gtp;
306 }
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ goodPtResolution()

bool PFDisplacedVertexCandidateFinder::goodPtResolution ( const reco::TrackBaseRef trackref) const
private

Quality Criterion on the Pt resolution to select a Track.

Definition at line 309 of file PFDisplacedVertexCandidateFinder.cc.

References funct::abs(), PVValHelper::dxy, reco::TrackBase::dxy(), dxy_, LogDebug, nChi2_max_, reco::TrackBase::normalizedChi2(), DiDispStaMuonMonitor_cfi::pt, reco::TrackBase::pt(), pt_min_, pt_min_prim_, reco::TrackBase::ptError(), and pvtx_.

Referenced by isSelected().

309  {
310  double nChi2 = trackref->normalizedChi2();
311  double pt = trackref->pt();
312  double dpt = trackref->ptError();
313  double dxy = trackref->dxy(pvtx_);
314 
315  double pt_error = dpt / pt * 100;
316 
317  LogDebug("PFDisplacedVertexCandidateFinder")
318  << " PFDisplacedVertexFinder: PFrecTrack->Track Pt= " << pt << " dPt/Pt = " << pt_error << "% nChi2 = " << nChi2;
319  if (nChi2 > nChi2_max_ || pt < pt_min_) {
320  LogDebug("PFDisplacedVertexCandidateFinder") << " PFBlockAlgo: skip badly measured or low pt track"
321  << " nChi2_cut = " << 5 << " pt_cut = " << 0.2;
322  return false;
323  }
324  // cout << "dxy = " << dxy << endl;
325  if (std::abs(dxy) < dxy_ && pt < pt_min_prim_)
326  return false;
327  // if (fabs(dxy) < 0.2 && pt < 0.8) return false;
328 
329  return true;
330 }
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:754
double pt() const
track transverse momentum
Definition: TrackBase.h:637
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:593
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608
#define LogDebug(id)

◆ isSelected()

bool PFDisplacedVertexCandidateFinder::isSelected ( const reco::TrackBaseRef trackref)
inlineprivate

A function which gather the information if a track is available for vertexing

Definition at line 103 of file PFDisplacedVertexCandidateFinder.h.

References goodPtResolution().

Referenced by setInput().

103 { return goodPtResolution(trackref); }
bool goodPtResolution(const reco::TrackBaseRef &trackref) const
Quality Criterion on the Pt resolution to select a Track.

◆ link()

void PFDisplacedVertexCandidateFinder::link ( const reco::TrackBaseRef el1,
const reco::TrackBaseRef el2,
double &  dist,
GlobalPoint crossing_point,
reco::PFDisplacedVertexCandidate::VertexLinkTest linktest 
)
private

Check whether 2 elements are linked and fill the link parameters.

Definition at line 175 of file PFDisplacedVertexCandidateFinder.cc.

References funct::abs(), TwoTrackMinimumDistance::calculate(), TwoTrackMinimumDistance::crossingPoint(), dcaCut_, TwoTrackMinimumDistance::distance(), HLT_2022v11_cff::eta1, HLT_2022v11_cff::eta2, eventTrackTrajectories_, edm::RefToBase< T >::key(), LogDebug, primaryVertexCut2_, HLT_2022v11_cff::pt1, HLT_2022v11_cff::pt2, theMinimum_, track_table_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by associate(), and packLinks().

179  {
180  using namespace edm::soa::col;
181  const auto iel1 = el1.key();
182  const auto iel2 = el2.key();
183  const auto pt1 = track_table_.get<Pt>(iel1);
184  const auto pt2 = track_table_.get<Pt>(iel2);
185  const auto eta1 = track_table_.get<Eta>(iel1);
186  const auto eta2 = track_table_.get<Eta>(iel2);
187  const auto phi1 = track_table_.get<Phi>(iel1);
188  const auto phi2 = track_table_.get<Phi>(iel2);
189 
190  if (std::abs(eta1 - eta2) > 1) {
191  dist = -1;
192  return;
193  }
194  if (pt1 > 2 && pt2 > 2 && std::abs(phi1 - phi2) > 1) {
195  dist = -1;
196  return;
197  }
198 
201 
202  // Closest approach
203  theMinimum_.calculate(gt1, gt2);
204 
205  // Fill the parameters
206  dist = theMinimum_.distance();
207  LogDebug("PFDisplacedVertexCandidateFinder") << "link iel1=" << iel1 << " iel2=" << iel2 << " dist=" << dist;
208  crossingPoint = theMinimum_.crossingPoint();
209 
210  vertexLinkTest = PFDisplacedVertexCandidate::LINKTEST_DCA; //rechit by default
211 
212  // Check if the link test fails
213  if (dist > dcaCut_) {
214  dist = -1;
215  return;
216  }
217 
218  // Check if the closses approach point is too close to the primary vertex/beam pipe
219  double rho2 = crossingPoint.x() * crossingPoint.x() + crossingPoint.y() * crossingPoint.y();
220 
221  if (rho2 < primaryVertexCut2_) {
222  dist = -1;
223  return;
224  }
225 
226  // Check if the closses approach point is out of range of the tracker
227 
228  double tob_rho_limit2 = 10000;
229  double tec_z_limit = 270;
230 
231  if (rho2 > tob_rho_limit2) {
232  dist = -1;
233  return;
234  }
235  if (std::abs(crossingPoint.z()) > tec_z_limit) {
236  dist = -1;
237  return;
238  }
239 
240  return;
241 
242  /*
243  // Check if the inner hit of one of the tracks is not too far away from the vertex
244  double dx = el1->innerPosition().x()-P.x();
245  double dy = el1->innerPosition().y()-P.y();
246  double dz = el1->innerPosition().z()-P.z();
247  double dist2 = dx*dx+dy*dy+dz*dz;
248 
249  if (dist2 > dcaPInnerHitCut2_) {
250  dist = -1;
251  if (debug_) cout << "track " << el1.key() << " dist to vertex " << sqrt(dist2) << endl;
252  return;
253  }
254 
255  dx = el2->innerPosition().x()-P.x();
256  dy = el2->innerPosition().y()-P.y();
257  dz = el2->innerPosition().z()-P.z();
258  dist2 = dx*dx+dy*dy+dz*dz;
259 
260  if (dist2 > dcaPInnerHitCut2_) {
261  dist = -1;
262  if (debug_) cout << "track " << el2.key() << " dist to vertex " << sqrt(dist2) << endl;
263  return;
264  }
265  */
266 }
GlobalPoint crossingPoint() const override
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
T x() const
Definition: PV3DBase.h:59
double dcaCut_
–— Algo parameters for the vertex finder -— ///
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< GlobalTrajectoryParameters > eventTrackTrajectories_
size_t key() const
Definition: RefToBase.h:219
double primaryVertexCut2_
Do not reconstruct vertices wich are too close to the beam pipe.
float distance() const override
#define LogDebug(id)

◆ packLinks()

void PFDisplacedVertexCandidateFinder::packLinks ( reco::PFDisplacedVertexCandidate vertexCandidate)
private

Compute missing links in the displacedVertexCandidates (the recursive procedure does not build all links)

Definition at line 270 of file PFDisplacedVertexCandidateFinder.cc.

References reco::PFDisplacedVertexCandidate::elements(), testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, link(), LogDebug, and reco::PFDisplacedVertexCandidate::setLink().

Referenced by findDisplacedVertexCandidates().

270  {
271  const vector<TrackBaseRef>& els = vertexCandidate.elements();
272 
273  //First Loop: update all link data
274  for (unsigned i1 = 0; i1 < els.size(); i1++) {
275  for (unsigned i2 = i1 + 1; i2 < els.size(); i2++) {
276  // no reflexive link
277  if (i1 == i2)
278  continue;
279 
280  double dist = -1;
281  GlobalPoint crossingPoint(0, 0, 0);
283 
284  link(els[i1], els[i2], dist, crossingPoint, linktest);
285  LogDebug("PFDisplacedVertexCandidateFinder")
286  << "Setting link between elements " << i1 << " key " << els[i1].key() << " and " << i2 << " key "
287  << els[i2].key() << " of dist =" << dist << " computed from link test " << linktest;
288 
289  if (dist > -0.5)
290  vertexCandidate.setLink(i1, i2, dist, crossingPoint, linktest);
291  }
292  }
293 }
void link(const reco::TrackBaseRef &el1, const reco::TrackBaseRef &el2, double &dist, GlobalPoint &crossing_point, reco::PFDisplacedVertexCandidate::VertexLinkTest &linktest)
Check whether 2 elements are linked and fill the link parameters.
void setLink(unsigned i1, unsigned i2, const float dist, const GlobalPoint &dcaPoint, const VertexLinkTest test=LINKTEST_DCA)
const std::vector< TrackBaseRef > & elements() const
#define LogDebug(id)

◆ setDebug()

void PFDisplacedVertexCandidateFinder::setDebug ( bool  debug)
inline

sets debug printout flag

Definition at line 53 of file PFDisplacedVertexCandidateFinder.h.

References debug, and debug_.

Referenced by PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer().

53 { debug_ = debug; }
#define debug
Definition: HDRShower.cc:19
bool debug_
if true, debug printouts activated

◆ setInput()

void PFDisplacedVertexCandidateFinder::setInput ( const edm::Handle< reco::TrackCollection > &  trackh,
const MagneticField magField 
)

Set the imput collection of tracks and calculate their trajectory parameters the Global Trajectory Parameters

Definition at line 49 of file PFDisplacedVertexCandidateFinder.cc.

References eventTracks_, eventTrackTrajectories_, edm::Ref< C, T, F >::get(), getGlobalTrajectoryParameters(), mps_fire::i, isSelected(), edm::HandleBase::isValid(), magField_, track_table_, and trackMask_.

Referenced by PFDisplacedVertexCandidateProducer::produce().

50  {
51  magField_ = magField;
52  trackMask_.clear();
53  trackMask_.resize(trackh->size());
55  eventTrackTrajectories_.resize(trackh->size());
56 
57  for (unsigned i = 0; i < trackMask_.size(); i++)
58  trackMask_[i] = true;
59 
60  eventTracks_.clear();
61  if (trackh.isValid()) {
62  for (unsigned i = 0; i < trackh->size(); i++) {
63  TrackRef tref(trackh, i);
64  TrackBaseRef tbref(tref);
65 
66  if (!isSelected(tbref)) {
67  trackMask_[i] = false;
68  continue;
69  }
70 
71  const Track* trk = tref.get();
72  eventTracks_.push_back(tbref);
74  }
75  }
77 }
GlobalTrajectoryParameters getGlobalTrajectoryParameters(const reco::Track *) const
--—— TOOLS --—— //
std::list< reco::TrackBaseRef > eventTracks_
The track refs.
edm::soa::AddColumns_t< EtaPhiTable, std::tuple< col::Pt > > PtEtaPhiTable
std::vector< GlobalTrajectoryParameters > eventTrackTrajectories_
bool isValid() const
Definition: HandleBase.h:70
bool isSelected(const reco::TrackBaseRef &trackref)

◆ setParameters()

void PFDisplacedVertexCandidateFinder::setParameters ( double  dcaCut,
double  primaryVertexCut,
double  dcaPInnerHitCut,
const edm::ParameterSet ps_trk 
)
inline

---—— Set different algo parameters —— ///

Sets algo parameters for the vertex candidate finder

Definition at line 42 of file PFDisplacedVertexCandidateFinder.h.

References particleFlowDisplacedVertexCandidate_cfi::dcaCut, dcaCut_, particleFlowDisplacedVertexCandidate_cfi::dcaPInnerHitCut, dcaPInnerHitCut2_, dxy_, edm::ParameterSet::getParameter(), nChi2_max_, particleFlowDisplacedVertex_cfi::primaryVertexCut, primaryVertexCut2_, pt_min_, and pt_min_prim_.

Referenced by PFDisplacedVertexCandidateProducer::PFDisplacedVertexCandidateProducer().

42  {
43  dcaCut_ = dcaCut;
46  nChi2_max_ = ps_trk.getParameter<double>("nChi2_max");
47  pt_min_ = ps_trk.getParameter<double>("pt_min");
48  pt_min_prim_ = ps_trk.getParameter<double>("pt_min_prim");
49  dxy_ = ps_trk.getParameter<double>("dxy");
50  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double dcaCut_
–— Algo parameters for the vertex finder -— ///
double primaryVertexCut2_
Do not reconstruct vertices wich are too close to the beam pipe.
double dcaPInnerHitCut2_
Maximum distance between the DCA Point and the inner hit of the track.

◆ setPrimaryVertex()

void PFDisplacedVertexCandidateFinder::setPrimaryVertex ( edm::Handle< reco::VertexCollection mainVertexHandle,
edm::Handle< reco::BeamSpot beamSpotHandle 
)

Definition at line 32 of file PFDisplacedVertexCandidateFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, edm::HandleBase::isValid(), pvtx_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

Referenced by PFDisplacedVertexCandidateProducer::produce().

33  {
34  const math::XYZPoint beamSpot = beamSpotHandle.isValid()
35  ? math::XYZPoint(beamSpotHandle->x0(), beamSpotHandle->y0(), beamSpotHandle->z0())
36  : math::XYZPoint(0, 0, 0);
37 
38  // The primary vertex is taken from the refitted list,
39  // if does not exist from the average offline beam spot position
40  // if does not exist (0,0,0) is used
41  pvtx_ = mainVertexHandle.isValid()
43  mainVertexHandle->begin()->x(), mainVertexHandle->begin()->y(), mainVertexHandle->begin()->z())
44  : beamSpot;
45 }
double x0() const
x coordinate
Definition: BeamSpot.h:61
double y0() const
y coordinate
Definition: BeamSpot.h:63
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool isValid() const
Definition: HandleBase.h:70
double z0() const
z coordinate
Definition: BeamSpot.h:65

◆ transferVertexCandidates()

std::unique_ptr<reco::PFDisplacedVertexCandidateCollection> PFDisplacedVertexCandidateFinder::transferVertexCandidates ( )
inline
Returns
auto_ptr to collection of DisplacedVertexCandidates

Definition at line 60 of file PFDisplacedVertexCandidateFinder.h.

References eostools::move(), and vertexCandidates_.

Referenced by PFDisplacedVertexCandidateProducer::produce().

60  {
62  }
std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > vertexCandidates_
-----— Members -----— ///
def move(src, dest)
Definition: eostools.py:511

◆ vertexCandidates()

const std::unique_ptr<reco::PFDisplacedVertexCandidateCollection>& PFDisplacedVertexCandidateFinder::vertexCandidates ( ) const
inline

Definition at line 64 of file PFDisplacedVertexCandidateFinder.h.

References eostools::move(), and vertexCandidates_.

Referenced by operator<<().

64  {
66  }
std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > vertexCandidates_
-----— Members -----— ///
def move(src, dest)
Definition: eostools.py:511

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const PFDisplacedVertexCandidateFinder a 
)
friend

Definition at line 332 of file PFDisplacedVertexCandidateFinder.cc.

332  {
333  if (!out)
334  return out;
335 
336  out << "====== Particle Flow Block Algorithm ======= ";
337  out << endl;
338  out << "number of unassociated elements : " << a.eventTracks_.size() << endl;
339  out << endl;
340 
341  out << " Tracks selection based on " << std::endl;
342  out << " pvtx_ = " << a.pvtx_ << std::endl;
343  out << " std::abs(dxy) < " << a.dxy_ << " and pt < " << a.pt_min_prim_ << std::endl;
344  out << " nChi2 < " << a.nChi2_max_ << " and pt < " << a.pt_min_ << std::endl;
345 
346  out << endl;
347 
348  for (PFDisplacedVertexCandidateFinder::IEC ie = a.eventTracks_.begin(); ie != a.eventTracks_.end(); ie++) {
349  double pt = (*ie).get()->pt();
350 
351  math::XYZPoint Pi = (*ie).get()->innerPosition();
352  math::XYZPoint Po = (*ie).get()->outerPosition();
353 
354  double innermost_radius = sqrt(Pi.x() * Pi.x() + Pi.y() * Pi.y() + Pi.z() * Pi.z());
355  double outermost_radius = sqrt(Po.x() * Po.x() + Po.y() * Po.y() + Po.z() * Po.z());
356  double innermost_rho = sqrt(Pi.x() * Pi.x() + Pi.y() * Pi.y());
357  double outermost_rho = sqrt(Po.x() * Po.x() + Po.y() * Po.y());
358 
359  out << "ie = " << (*ie).key() << " pt = " << pt << " innermost hit radius = " << innermost_radius
360  << " rho = " << innermost_rho << " outermost hit radius = " << outermost_radius << " rho = " << outermost_rho
361  << endl;
362  }
363 
364  const std::unique_ptr<reco::PFDisplacedVertexCandidateCollection>& vertexCandidates = std::move(a.vertexCandidates());
365 
366  if (!vertexCandidates.get()) {
367  out << "vertexCandidates already transfered" << endl;
368  } else {
369  out << "number of vertexCandidates : " << vertexCandidates->size() << endl;
370  out << endl;
371 
373  ib->Dump();
374  }
375 
376  return out;
377 }
const double Pi
const std::unique_ptr< reco::PFDisplacedVertexCandidateCollection > & vertexCandidates() const
T sqrt(T t)
Definition: SSEVec.h:19
reco::PFDisplacedVertexCandidateCollection::const_iterator IBC
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::list< reco::TrackBaseRef >::const_iterator IEC
double a
Definition: hdecay.h:119
def move(src, dest)
Definition: eostools.py:511
ib
Definition: cuy.py:661

Member Data Documentation

◆ dcaCut_

double PFDisplacedVertexCandidateFinder::dcaCut_
private

–— Algo parameters for the vertex finder -— ///

Distance of minimal approach below which two tracks are considered as linked together

Definition at line 126 of file PFDisplacedVertexCandidateFinder.h.

Referenced by link(), and setParameters().

◆ dcaPInnerHitCut2_

double PFDisplacedVertexCandidateFinder::dcaPInnerHitCut2_
private

Maximum distance between the DCA Point and the inner hit of the track.

Definition at line 130 of file PFDisplacedVertexCandidateFinder.h.

Referenced by setParameters().

◆ debug_

bool PFDisplacedVertexCandidateFinder::debug_
private

if true, debug printouts activated

Definition at line 151 of file PFDisplacedVertexCandidateFinder.h.

Referenced by setDebug().

◆ dxy_

double PFDisplacedVertexCandidateFinder::dxy_
private

Definition at line 139 of file PFDisplacedVertexCandidateFinder.h.

Referenced by goodPtResolution(), and setParameters().

◆ eventTracks_

std::list<reco::TrackBaseRef> PFDisplacedVertexCandidateFinder::eventTracks_
private

◆ eventTrackTrajectories_

std::vector<GlobalTrajectoryParameters> PFDisplacedVertexCandidateFinder::eventTrackTrajectories_
private

The Trajectories vector allow to calculate snd to store only once the track trajectory parameters

Definition at line 120 of file PFDisplacedVertexCandidateFinder.h.

Referenced by link(), and setInput().

◆ magField_

const MagneticField* PFDisplacedVertexCandidateFinder::magField_
private

Definition at line 154 of file PFDisplacedVertexCandidateFinder.h.

Referenced by getGlobalTrajectoryParameters(), and setInput().

◆ nChi2_max_

double PFDisplacedVertexCandidateFinder::nChi2_max_
private

Tracks preselection to reduce the combinatorics in PFDisplacedVertexCandidates this cuts are repeated then in a smarter way in the PFDisplacedVertexFinder be sure you are consistent between them

Definition at line 135 of file PFDisplacedVertexCandidateFinder.h.

Referenced by goodPtResolution(), and setParameters().

◆ primaryVertexCut2_

double PFDisplacedVertexCandidateFinder::primaryVertexCut2_
private

Do not reconstruct vertices wich are too close to the beam pipe.

Definition at line 128 of file PFDisplacedVertexCandidateFinder.h.

Referenced by link(), and setParameters().

◆ pt_min_

double PFDisplacedVertexCandidateFinder::pt_min_
private

Definition at line 136 of file PFDisplacedVertexCandidateFinder.h.

Referenced by goodPtResolution(), and setParameters().

◆ pt_min_prim_

double PFDisplacedVertexCandidateFinder::pt_min_prim_
private

Definition at line 138 of file PFDisplacedVertexCandidateFinder.h.

Referenced by goodPtResolution(), and setParameters().

◆ pvtx_

math::XYZPoint PFDisplacedVertexCandidateFinder::pvtx_
private

Definition at line 148 of file PFDisplacedVertexCandidateFinder.h.

Referenced by goodPtResolution(), and setPrimaryVertex().

◆ theMinimum_

TwoTrackMinimumDistance PFDisplacedVertexCandidateFinder::theMinimum_
private

Definition at line 146 of file PFDisplacedVertexCandidateFinder.h.

Referenced by link().

◆ track_table_

edm::soa::PtEtaPhiTable PFDisplacedVertexCandidateFinder::track_table_
private

Definition at line 156 of file PFDisplacedVertexCandidateFinder.h.

Referenced by link(), and setInput().

◆ trackMask_

Mask PFDisplacedVertexCandidateFinder::trackMask_
private

The trackMask allows to keep the information on the tracks which are still free and those which are already used or disabled.

Definition at line 117 of file PFDisplacedVertexCandidateFinder.h.

Referenced by associate(), and setInput().

◆ vertexCandidates_

std::unique_ptr<reco::PFDisplacedVertexCandidateCollection> PFDisplacedVertexCandidateFinder::vertexCandidates_
private

-----— Members -----— ///

Definition at line 109 of file PFDisplacedVertexCandidateFinder.h.

Referenced by findDisplacedVertexCandidates(), transferVertexCandidates(), and vertexCandidates().

◆ vertexCandidatesSize_

unsigned PFDisplacedVertexCandidateFinder::vertexCandidatesSize_
private

Max number of expected vertexCandidates in the event Used to allocate the memory and avoid multiple copy

Definition at line 143 of file PFDisplacedVertexCandidateFinder.h.

Referenced by findDisplacedVertexCandidates().