CMS 3D CMS Logo

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

#include <MultiVertexFitter.h>

Public Types

typedef std::map< int, double > SeedToWeightMap
 
typedef std::map< reco::TransientTrack, SeedToWeightMapTrackAndSeedToWeightMap
 
typedef std::pair< reco::TransientTrack, float > TrackAndWeight
 

Public Member Functions

 MultiVertexFitter (const AnnealingSchedule &sched=DefaultMVFAnnealing(), const LinearizationPointFinder &seeder=DefaultLinearizationPointFinder(), float revive_below=-1.)
 
 MultiVertexFitter (const MultiVertexFitter &)
 
std::vector< CachingVertex< 5 > > vertices (const std::vector< CachingVertex< 5 > > &, const std::vector< reco::TransientTrack > &primaries=std::vector< reco::TransientTrack >())
 
std::vector< CachingVertex< 5 > > vertices (const std::vector< std::vector< reco::TransientTrack > > &, const std::vector< reco::TransientTrack > &primaries=std::vector< reco::TransientTrack >())
 
std::vector< CachingVertex< 5 > > vertices (const std::vector< std::vector< TrackAndWeight > > &, const std::vector< reco::TransientTrack > &primaries=std::vector< reco::TransientTrack >())
 
std::vector< CachingVertex< 5 > > vertices (const std::vector< TransientVertex > &, const std::vector< reco::TransientTrack > &primaries=std::vector< reco::TransientTrack >())
 
 ~MultiVertexFitter ()
 

Private Types

typedef ReferenceCountingPointer< LinearizedTrackState< 5 > > RefCountedLinearizedTrackState
 
typedef CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
 

Private Member Functions

void clear ()
 
void createPrimaries (const std::vector< reco::TransientTrack > &tracks)
 
void createSeed (const std::vector< reco::TransientTrack > &tracks)
 
void createSeed (const std::vector< TrackAndWeight > &tracks)
 
std::vector< CachingVertex< 5 > > fit ()
 
void lostVertexClaimer ()
 
void printSeeds () const
 
void printWeights () const
 
void printWeights (const reco::TransientTrack &) const
 
void resetSeedNr ()
 
int seedNr ()
 
bool updateSeeds ()
 
void updateWeights ()
 

Private Attributes

AnnealingScheduletheAssComp
 
LinTrackCache theCache
 
std::set< reco::TransientTrackthePrimaries
 
float theReviveBelow
 
LinearizationPointFindertheSeeder
 
std::vector< reco::TransientTracktheTracks
 
int theVertexStateNr
 
std::vector< std::pair< int, CachingVertex< 5 > > > theVertexStates
 
TrackAndSeedToWeightMap theWeights
 

Detailed Description

fits n vertices in parallel, associating weights for every track-vertex std::pair. The special constructor's arguments take precedence over the SimpleConfigurables.

SimpleConfigurables:

MultiVertexFitter:Debug = 0 MultiVertexFitter:DisplacementLimit = 0.00001 MultiVertexFitter:MaxIterations = 30 MultiVertexFitter:ClaimLostVertices = true MultiVertexFitter:MinimumWeightFraction = 1e-6 MultiVertexFitter:ReviveBelow = 0.3 MultiVertexFitter:DiscardLightWeights = true

Definition at line 15 of file MultiVertexFitter.h.

Member Typedef Documentation

◆ RefCountedLinearizedTrackState

Definition at line 100 of file MultiVertexFitter.h.

◆ RefCountedVertexTrack

Definition at line 99 of file MultiVertexFitter.h.

◆ SeedToWeightMap

typedef std::map<int, double> MultiVertexFitter::SeedToWeightMap

Definition at line 42 of file MultiVertexFitter.h.

◆ TrackAndSeedToWeightMap

Definition at line 43 of file MultiVertexFitter.h.

◆ TrackAndWeight

Definition at line 41 of file MultiVertexFitter.h.

Constructor & Destructor Documentation

◆ MultiVertexFitter() [1/2]

MultiVertexFitter::MultiVertexFitter ( const AnnealingSchedule sched = DefaultMVFAnnealing(),
const LinearizationPointFinder seeder = DefaultLinearizationPointFinder(),
float  revive_below = -1. 
)

Definition at line 266 of file MultiVertexFitter.cc.

269  : theVertexStateNr(0), theReviveBelow(revive_below), theAssComp(ann.clone()), theSeeder(seeder.clone()) {}

◆ MultiVertexFitter() [2/2]

MultiVertexFitter::MultiVertexFitter ( const MultiVertexFitter o)

Definition at line 271 of file MultiVertexFitter.cc.

272  : theVertexStateNr(o.theVertexStateNr),
273  theReviveBelow(o.theReviveBelow),
274  theAssComp(o.theAssComp->clone()),
275  theSeeder(o.theSeeder->clone()) {}

◆ ~MultiVertexFitter()

MultiVertexFitter::~MultiVertexFitter ( )

Definition at line 277 of file MultiVertexFitter.cc.

277  {
278  delete theAssComp;
279  delete theSeeder;
280 }

References theAssComp, and theSeeder.

Member Function Documentation

◆ clear()

void MultiVertexFitter::clear ( void  )
private

Definition at line 79 of file MultiVertexFitter.cc.

79  {
81  theTracks.clear();
82  thePrimaries.clear();
83  theVertexStates.clear();
84  theWeights.clear();
85  theCache.clear();
86 }

◆ createPrimaries()

void MultiVertexFitter::createPrimaries ( const std::vector< reco::TransientTrack > &  tracks)
private

Definition at line 103 of file MultiVertexFitter.cc.

103  {
104  // cout << "[MultiVertexFitter] creating primaries: ";
105  for (vector<reco::TransientTrack>::const_iterator i = tracks.begin(); i != tracks.end(); ++i) {
106  thePrimaries.insert(*i);
107  // cout << i->id() << " ";
108  }
109  // cout << endl;
110 }

References mps_fire::i, and tracks.

◆ createSeed() [1/2]

void MultiVertexFitter::createSeed ( const std::vector< reco::TransientTrack > &  tracks)
private

Definition at line 91 of file MultiVertexFitter.cc.

91  {
92  if (tracks.size() > 1) {
94  int snr = seedNr();
95  theVertexStates.push_back(pair<int, CachingVertex<5> >(snr, vtx));
96  for (vector<TransientTrack>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
97  theWeights[*track][snr] = 1.;
98  theTracks.push_back(*track);
99  };
100  };
101 }

References HLT_FULL_cff::track, tracks, and extraflags_cff::vtx.

◆ createSeed() [2/2]

void MultiVertexFitter::createSeed ( const std::vector< TrackAndWeight > &  tracks)
private

Definition at line 116 of file MultiVertexFitter.cc.

116  {
117  // create initial seed for every bundle
118  vector<RefCountedVertexTrack> newTracks;
119 
120  for (vector<TrackAndWeight>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
121  double weight = validWeight(track->second);
122  const GlobalPoint &pos = track->first.impactPointState().globalPosition();
123  GlobalError err; // FIXME
124  VertexState realseed(pos, err);
125 
127 
128  VertexTrackFactory<5> vTrackFactory;
129  RefCountedVertexTrack vTrData = vTrackFactory.vertexTrack(lTrData, realseed, weight);
130  newTracks.push_back(vTrData);
131  };
132 
133  if (newTracks.size() > 1) {
135  int snr = seedNr();
136  theVertexStates.push_back(pair<int, CachingVertex<5> >(snr, vtx));
137 
138  // We initialise the weights with the original
139  // user supplied weights.
140  for (vector<TrackAndWeight>::const_iterator track = tracks.begin(); track != tracks.end(); ++track) {
141  if (thePrimaries.count(track->first)) {
142  /*
143  cout << "[MultiVertexFitter] " << track->first.id() << " is a primary."
144  << " setting weight for state " << theVertexStates[0].first
145  << " to " << track->second
146  << endl;
147  */
148  theWeights[track->first][theVertexStates[0].first] = track->second;
149  continue;
150  };
151  float weight = track->second;
152  if (weight > 1.0) {
153  cout << "[MultiVertexFitter] error weight " << weight << " > 1.0 given." << endl;
154  cout << "[MultiVertexFitter] will revert to 1.0" << endl;
155  weight = 1.0;
156  };
157  if (weight < 0.0) {
158  cout << "[MultiVertexFitter] error weight " << weight << " < 0.0 given." << endl;
159  cout << "[MultiVertexFitter] will revert to 0.0" << endl;
160  weight = 0.0;
161  };
162  theWeights[track->first][snr] = weight;
163  theTracks.push_back(track->first);
164  };
165  };
166 
167  // this thing will actually have to discard tracks
168  // that have been submitted - attached to a different vertex - already.
169  // sort ( theTracks.begin(), theTracks.end(), CompareRaveTracks() );
170  sort(theTracks.begin(), theTracks.end());
171  for (vector<TransientTrack>::iterator i = theTracks.begin(); i < theTracks.end(); ++i) {
172  if (i != theTracks.begin()) {
173  if ((*i) == (*(i - 1))) {
174  theTracks.erase(i);
175  };
176  };
177  };
178 }

References gather_cfg::cout, submitPVResolutionJobs::err, mps_fire::i, jetUpdater_cfi::sort, HLT_FULL_cff::track, tracks, KalmanVertexFitter::vertex(), VertexTrackFactory< N >::vertexTrack(), extraflags_cff::vtx, and mps_merge::weight.

◆ fit()

vector< CachingVertex< 5 > > MultiVertexFitter::fit ( void  )
private

Definition at line 474 of file MultiVertexFitter.cc.

474  {
475  if (verbose() & 2)
476  printWeights();
477  int ctr = 1;
478  static const int ctr_max = 50; /* SimpleConfigurable<int>(100,
479  "MultiVertexFitter:MaxIterations").value(); */
480  while (updateSeeds() || !(theAssComp->isAnnealed())) {
481  if (++ctr >= ctr_max)
482  break;
483  theAssComp->anneal();
484  // lostVertexClaimer(); // was a silly(?) idea to "revive" vertex candidates.
485  resetSeedNr();
486  };
487 
488  if (verbose()) {
489  cout << "[MultiVertexFitter] number of iterations: " << ctr << endl;
490  cout << "[MultiVertexFitter] remaining seeds: " << theVertexStates.size() << endl;
491  printWeights();
492  };
493 
494  vector<CachingVertex<5> > ret;
495  for (vector<pair<int, CachingVertex<5> > >::const_iterator i = theVertexStates.begin(); i != theVertexStates.end();
496  ++i) {
497  ret.push_back(i->second);
498  };
499 
500  return ret;
501 }

References AnnealingSchedule::anneal(), gather_cfg::cout, dqmiodatasetharvest::ctr, mps_fire::i, AnnealingSchedule::isAnnealed(), printWeights(), resetSeedNr(), runTheMatrix::ret, theAssComp, theVertexStates, updateSeeds(), trackerHitRTTI::vector, and verbose.

Referenced by trackingPlots.Iteration::modules().

◆ lostVertexClaimer()

void MultiVertexFitter::lostVertexClaimer ( )
private

Definition at line 541 of file MultiVertexFitter.cc.

541  {
542  if (!(theReviveBelow < 0.))
543  return;
544  // this experimental method is used to get almost lost vertices
545  // back into the play by upweighting vertices with very low total weights
546 
547  bool has_revived = false;
548  // find out about total weight
549  for (vector<pair<int, CachingVertex<5> > >::const_iterator i = theVertexStates.begin(); i != theVertexStates.end();
550  ++i) {
551  double totweight = 0.;
552  for (vector<TransientTrack>::const_iterator trk = theTracks.begin(); trk != theTracks.end(); ++trk) {
553  totweight += theWeights[*trk][i->first];
554  };
555 
556  /*
557  cout << "[MultiVertexFitter] vertex seed " << TransientVertexNamer().name(*i)
558  << " total weight=" << totweight << endl;*/
559 
560  if (totweight < theReviveBelow && totweight > 0.0) {
561  cout << "[MultiVertexFitter] now trying to revive vertex"
562  << " revive_below=" << theReviveBelow << endl;
563  has_revived = true;
564  for (vector<TransientTrack>::const_iterator trk = theTracks.begin(); trk != theTracks.end(); ++trk) {
565  theWeights[*trk][i->first] /= totweight;
566  };
567  };
568  };
569  if (has_revived && verbose())
570  printWeights();
571 }

References gather_cfg::cout, mps_fire::i, printWeights(), theReviveBelow, theTracks, theVertexStates, theWeights, trackerHitRTTI::vector, and verbose.

◆ printSeeds()

void MultiVertexFitter::printSeeds ( ) const
private

Definition at line 530 of file MultiVertexFitter.cc.

530  {
531  cout << endl << "Seed table: " << endl << "=====================" << endl;
532  /*
533  for ( vector < pair < int, CachingVertex<5> > >::const_iterator seed=theVertexStates.begin();
534  seed!=theVertexStates.end(); ++seed )
535  {
536  cout << " Vertex[" << TransientVertexNamer().name(seed->second) << "] at "
537  << seed->second.position() << endl;
538  };*/
539 }

References gather_cfg::cout.

Referenced by updateSeeds().

◆ printWeights() [1/2]

void MultiVertexFitter::printWeights ( ) const
private

Definition at line 520 of file MultiVertexFitter.cc.

520  {
521  cout << endl << "Weight table: " << endl << "=================" << endl;
522  for (set<TransientTrack>::const_iterator trk = thePrimaries.begin(); trk != thePrimaries.end(); ++trk) {
523  printWeights(*trk);
524  };
525  for (vector<TransientTrack>::const_iterator trk = theTracks.begin(); trk != theTracks.end(); ++trk) {
526  printWeights(*trk);
527  };
528 }

References gather_cfg::cout, thePrimaries, and theTracks.

Referenced by fit(), lostVertexClaimer(), and updateWeights().

◆ printWeights() [2/2]

void MultiVertexFitter::printWeights ( const reco::TransientTrack t) const
private

Definition at line 503 of file MultiVertexFitter.cc.

503  {
504  // cout << "Trk " << t.id();
505  for (vector<pair<int, CachingVertex<5> > >::const_iterator seed = theVertexStates.begin();
506  seed != theVertexStates.end();
507  ++seed) {
508  double val = 0;
509  auto a = theWeights.find(t);
510  if (a != theWeights.end()) {
511  auto b = a->second.find(seed->first);
512  if (b != a->second.end())
513  val = b->second;
514  }
515  cout << " -- Vertex[" << seed->first << "] with " << setw(12) << setprecision(3) << val;
516  };
517  cout << endl;
518 }

References a, b, gather_cfg::cout, fileCollector::seed, submitPVValidationJobs::t, theVertexStates, theWeights, heppy_batch::val, and trackerHitRTTI::vector.

◆ resetSeedNr()

void MultiVertexFitter::resetSeedNr ( )
private

Definition at line 114 of file MultiVertexFitter.cc.

114 { theVertexStateNr = 0; }

Referenced by fit().

◆ seedNr()

int MultiVertexFitter::seedNr ( )
private

Definition at line 112 of file MultiVertexFitter.cc.

112 { return theVertexStateNr++; }

Referenced by updateSeeds().

◆ updateSeeds()

bool MultiVertexFitter::updateSeeds ( )
private

Definition at line 356 of file MultiVertexFitter.cc.

356  {
357  double max_disp = 0.;
358  // need to fit with the right weights.
359  // also trigger an updateWeights.
360  // if the seeds dont move much we return true
361 
362  vector<pair<int, CachingVertex<5> > > newSeeds;
363 
364  for (vector<pair<int, CachingVertex<5> > >::const_iterator seed = theVertexStates.begin();
365  seed != theVertexStates.end();
366  ++seed) {
367  // for each seed get the tracks with the right weights.
368  // TransientVertex rv = seed->second;
369  // const GlobalPoint & seedpos = seed->second.position();
370  int snr = seed->first;
371  VertexState realseed(seed->second.position(), seed->second.error());
372 
373  double totweight = 0.;
374  for (vector<TransientTrack>::const_iterator track = theTracks.begin(); track != theTracks.end(); ++track) {
375  totweight += theWeights[*track][snr];
376  };
377 
378  int nr_good_trks = 0; // how many tracks above weight limit
379  // we count those tracks, because that way
380  // we can discard lightweights if there are enough tracks
381  // and not discard the lightweights if that would give us
382  // fewer than two tracks ( we would loose a seed, then ).
383  if (discardLightWeights()) {
384  for (vector<TransientTrack>::const_iterator track = theTracks.begin(); track != theTracks.end(); ++track) {
385  if (theWeights[*track][snr] > totweight * minWeightFraction()) {
386  nr_good_trks++;
387  };
388  };
389  };
390 
391  vector<RefCountedVertexTrack> newTracks;
392  for (vector<TransientTrack>::const_iterator track = theTracks.begin(); track != theTracks.end(); ++track) {
393  double weight = validWeight(theWeights[*track][snr]);
394  // Now we add a track, if
395  // a. we consider all tracks or
396  // b. we discard the lightweights but the track's weight is high enough or
397  // c. we discard the lightweights but there arent enough good tracks,
398  // so we add all lightweights again (too expensive to figure out
399  // which lightweights are the most important)
400  if (!discardLightWeights() || weight > minWeightFraction() * totweight || nr_good_trks < 2) {
401  // if the linearization point didnt move too much,
402  // we take the old LinTrackState.
403  // Otherwise we relinearize.
404 
405  RefCountedLinearizedTrackState lTrData = theCache.linTrack(seed->second.position(), *track);
406 
407  VertexTrackFactory<5> vTrackFactory;
408  RefCountedVertexTrack vTrData = vTrackFactory.vertexTrack(lTrData, realseed, weight);
409  newTracks.push_back(vTrData);
410  };
411  };
412 
413  for (set<TransientTrack>::const_iterator track = thePrimaries.begin(); track != thePrimaries.end(); ++track) {
414  double weight = validWeight(theWeights[*track][snr]);
415 
416  RefCountedLinearizedTrackState lTrData = theCache.linTrack(seed->second.position(), *track);
417 
418  VertexTrackFactory<5> vTrackFactory;
419  RefCountedVertexTrack vTrData = vTrackFactory.vertexTrack(lTrData, realseed, weight);
420  newTracks.push_back(vTrData);
421  };
422 
423  try {
424  if (newTracks.size() < 2) {
425  throw VertexException("less than two tracks in vector");
426  };
427 
428  if (verbose()) {
429  cout << "[MultiVertexFitter] now fitting with Kalman: ";
430  for (vector<RefCountedVertexTrack>::const_iterator i = newTracks.begin(); i != newTracks.end(); ++i) {
431  cout << (**i).weight() << " ";
432  };
433  cout << endl;
434  };
435 
436  if (newTracks.size() > 1) {
437  KalmanVertexFitter fitter;
438  // warning! first track determines lin pt!
439  CachingVertex<5> newVertex = fitter.vertex(newTracks);
440  int snr = seedNr();
441  double disp = (newVertex.position() - seed->second.position()).mag();
442  if (disp > max_disp)
443  max_disp = disp;
444  newSeeds.push_back(pair<int, CachingVertex<5> >(snr, newVertex));
445  };
446  } catch (exception &e) {
447  cout << "[MultiVertexFitter] exception: " << e.what() << endl;
448  }
449  };
450 
451  // now discard all old seeds and weights, compute new ones.
452  theVertexStates.clear();
453  theWeights.clear();
454  theVertexStates = newSeeds;
455 #ifdef MVFHarvestingDebug
456  for (vector<CachingVertex<5> >::const_iterator i = theVertexStates.begin(); i != theVertexStates.end(); ++i)
457  PrimitivesHarvester::file()->save(*i);
458 #endif
459  updateWeights();
460 
461  static const double disp_limit = 1e-4; /* SimpleConfigurable<double>
462  (0.0001, "MultiVertexFitter:DisplacementLimit" ).value(); */
463 
464  if (verbose() & 2) {
465  printSeeds();
466  cout << "[MultiVertexFitter] max displacement in this iteration: " << max_disp << endl;
467  };
468  if (max_disp < disp_limit)
469  return false;
470  return true;
471 }

References gather_cfg::cout, MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, FrontierConditions_GlobalTag_cff::file, mps_fire::i, LinTrackCache::linTrack(), mag(), CachingVertex< N >::position(), printSeeds(), fileCollector::seed, seedNr(), theCache, thePrimaries, theTracks, theVertexStates, theWeights, HLT_FULL_cff::track, updateWeights(), trackerHitRTTI::vector, verbose, KalmanVertexFitter::vertex(), and VertexTrackFactory< N >::vertexTrack().

Referenced by fit().

◆ updateWeights()

void MultiVertexFitter::updateWeights ( )
private

add the primary only tracks to primary vertex only.

now add "free tracks" to all vertices

Definition at line 282 of file MultiVertexFitter.cc.

282  {
283  theWeights.clear();
284  if (verbose() & 4) {
285  cout << "[MultiVertexFitter] Start weight update." << endl;
286  };
287 
289 
293  for (set<TransientTrack>::const_iterator trk = thePrimaries.begin(); trk != thePrimaries.end(); ++trk) {
294  int seednr = theVertexStates[0].first;
296  pair<bool, double> result = theComp.estimate(seed, theCache.linTrack(seed.position(), *trk));
297  double weight = 0.;
298  if (result.first)
299  weight = theAssComp->phi(result.second);
300  theWeights[*trk][seednr] = weight; // FIXME maybe "hard" 1.0 or "soft" weight?
301  }
302 
306  for (vector<TransientTrack>::const_iterator trk = theTracks.begin(); trk != theTracks.end(); ++trk) {
307  double tot_weight = theAssComp->phi(theAssComp->cutoff() * theAssComp->cutoff());
308 
309  for (vector<pair<int, CachingVertex<5> > >::const_iterator seed = theVertexStates.begin();
310  seed != theVertexStates.end();
311  ++seed) {
312  pair<bool, double> result = theComp.estimate(seed->second, theCache.linTrack(seed->second.position(), *trk));
313  double weight = 0.;
314  if (result.first)
315  weight = theAssComp->phi(result.second);
316  tot_weight += weight;
317  theWeights[*trk][seed->first] = weight;
318  /* cout << "[MultiVertexFitter] w[" << TransientTrackNamer().name(*trk)
319  << "," << seed->position() << "] = " << weight << endl;*/
320  };
321 
322  // normalize to sum of all weights of one track equals 1.
323  // (if we include the "cutoff", as well)
324  if (tot_weight > 0.0) {
325  for (vector<pair<int, CachingVertex<5> > >::const_iterator seed = theVertexStates.begin();
326  seed != theVertexStates.end();
327  ++seed) {
328  double normedweight = theWeights[*trk][seed->first] / tot_weight;
329  if (normedweight > 1.0) {
330  cout << "[MultiVertexFitter] he? w[" // << TransientTrackNamer().name(*trk)
331  << "," << seed->second.position() << "] = " << normedweight << " totw=" << tot_weight << endl;
332  normedweight = 1.0;
333  };
334  if (normedweight < 0.0) {
335  cout << "[MultiVertexFitter] he? weight=" << normedweight << " totw=" << tot_weight << endl;
336  normedweight = 0.0;
337  };
338  theWeights[*trk][seed->first] = normedweight;
339  };
340  } else {
341  // total weight equals zero? restart, with uniform distribution!
342  cout << "[MultiVertexFitter] track found with no assignment - ";
343  cout << "will assign uniformly." << endl;
344  float w = .5 / (float)theVertexStates.size();
345  for (vector<pair<int, CachingVertex<5> > >::const_iterator seed = theVertexStates.begin();
346  seed != theVertexStates.end();
347  ++seed) {
348  theWeights[*trk][seed->first] = w;
349  };
350  };
351  };
352  if (verbose() & 2)
353  printWeights();
354 }

References gather_cfg::cout, AnnealingSchedule::cutoff(), KalmanVertexTrackCompatibilityEstimator< N >::estimate(), dqmMemoryStats::float, LinTrackCache::linTrack(), AnnealingSchedule::phi(), printWeights(), mps_fire::result, fileCollector::seed, theAssComp, theCache, thePrimaries, theTracks, theVertexStates, theWeights, trackerHitRTTI::vector, verbose, w, and mps_merge::weight.

Referenced by updateSeeds().

◆ vertices() [1/4]

vector< CachingVertex< 5 > > MultiVertexFitter::vertices ( const std::vector< CachingVertex< 5 > > &  initials,
const std::vector< reco::TransientTrack > &  primaries = std::vector<reco::TransientTrack>() 
)

Supply full CachingVertices; CachingVertices are the first seeds. \paramname primaries: supply tracks which are hard coded to the primary vertex.

Definition at line 202 of file MultiVertexFitter.cc.

203  {
204  clear();
205  createPrimaries(primaries);
206  // FIXME if initials size < 1 return sth that includes the primaries
207  if (initials.empty())
208  return initials;
209  for (vector<CachingVertex<5> >::const_iterator vtx = initials.begin(); vtx != initials.end(); ++vtx) {
210  int snr = seedNr();
211  theVertexStates.push_back(pair<int, CachingVertex<5> >(snr, *vtx));
212  TransientVertex rvtx = *vtx;
213  const vector<TransientTrack> &trks = rvtx.originalTracks();
214  for (vector<TransientTrack>::const_iterator trk = trks.begin(); trk != trks.end(); ++trk) {
215  if (!(thePrimaries.count(*trk))) {
216  // cout << "[MultiVertexFitter] free track " << trk->id() << endl;
217  theTracks.push_back(*trk);
218  } else {
219  // cout << "[MultiVertexFitter " << trk->id() << " is not free." << endl;
220  }
221  cout << "[MultiVertexFitter] error! track weight currently set to one"
222  << " FIXME!!!" << endl;
223  theWeights[*trk][snr] = 1.0;
224  };
225  };
226 #ifdef MVFHarvestingDebug
227  for (vector<CachingVertex<5> >::const_iterator i = theVertexStates.begin(); i != theVertexStates.end(); ++i)
228  PrimitivesHarvester::file()->save(*i);
229 #endif
230  return fit();
231 }

References clear(), gather_cfg::cout, FrontierConditions_GlobalTag_cff::file, L1TowerCalibrationProducer_cfi::fit, mps_fire::i, TransientVertex::originalTracks(), hltEgammaHLTExtra_cfi::trks, trackerHitRTTI::vector, and extraflags_cff::vtx.

◆ vertices() [2/4]

vector< CachingVertex< 5 > > MultiVertexFitter::vertices ( const std::vector< std::vector< reco::TransientTrack > > &  tracks,
const std::vector< reco::TransientTrack > &  primaries = std::vector<reco::TransientTrack>() 
)

Supply simple clusters of reco::TransientTracks. \paramname primaries: supply tracks which are hard coded to the primary vertex.

Definition at line 233 of file MultiVertexFitter.cc.

234  {
235  clear();
236  createPrimaries(primaries);
237 
238  for (vector<vector<TransientTrack> >::const_iterator cluster = tracks.begin(); cluster != tracks.end(); ++cluster) {
239  createSeed(*cluster);
240  };
241  if (verbose()) {
242  printSeeds();
243  };
244 #ifdef MVFHarvestingDebug
245  for (vector<CachingVertex<5> >::const_iterator i = theVertexStates.begin(); i != theVertexStates.end(); ++i)
246  PrimitivesHarvester::file()->save(*i);
247 #endif
248  return fit();
249 }

References clear(), FrontierConditions_GlobalTag_cff::file, L1TowerCalibrationProducer_cfi::fit, mps_fire::i, tracks, trackerHitRTTI::vector, and verbose.

Referenced by MultiVertexReconstructor::vertices().

◆ vertices() [3/4]

vector< CachingVertex< 5 > > MultiVertexFitter::vertices ( const std::vector< std::vector< TrackAndWeight > > &  tracks,
const std::vector< reco::TransientTrack > &  primaries = std::vector<reco::TransientTrack>() 
)

Supply clusters of tracks with weights, association weights of the other vertices is considered zero. FIXME weights are currently ignored. \paramname primaries: supply tracks which are hard coded to the primary vertex.

Definition at line 251 of file MultiVertexFitter.cc.

252  {
253  clear();
254  createPrimaries(primaries);
255 
256  for (vector<vector<TrackAndWeight> >::const_iterator cluster = tracks.begin(); cluster != tracks.end(); ++cluster) {
257  createSeed(*cluster);
258  };
259  if (verbose()) {
260  printSeeds();
261  };
262 
263  return fit();
264 }

References clear(), L1TowerCalibrationProducer_cfi::fit, tracks, trackerHitRTTI::vector, and verbose.

◆ vertices() [4/4]

vector< CachingVertex< 5 > > MultiVertexFitter::vertices ( const std::vector< TransientVertex > &  vtces,
const std::vector< reco::TransientTrack > &  primaries = std::vector<reco::TransientTrack>() 
)

Same as above.

Definition at line 180 of file MultiVertexFitter.cc.

181  {
182  // FIXME if vtces.size < 1 return sth that includes the primaries
183  if (vtces.empty()) {
184  return vector<CachingVertex<5> >();
185  };
186  vector<vector<TrackAndWeight> > bundles;
187  for (vector<TransientVertex>::const_iterator vtx = vtces.begin(); vtx != vtces.end(); ++vtx) {
188  vector<TransientTrack> trks = vtx->originalTracks();
189  vector<TrackAndWeight> tnws;
190  for (vector<TransientTrack>::const_iterator trk = trks.begin(); trk != trks.end(); ++trk) {
191  float w = vtx->trackWeight(*trk);
192  if (w > 1e-5) {
193  TrackAndWeight tmp(*trk, w);
194  tnws.push_back(tmp);
195  };
196  };
197  bundles.push_back(tnws);
198  };
199  return vertices(bundles, primaries);
200 }

References MillePedeFileConverter_cfg::e, createJobs::tmp, hltEgammaHLTExtra_cfi::trks, pwdgSkimBPark_cfi::vertices, extraflags_cff::vtx, and w.

Member Data Documentation

◆ theAssComp

AnnealingSchedule* MultiVertexFitter::theAssComp
private

Definition at line 110 of file MultiVertexFitter.h.

Referenced by fit(), updateWeights(), and ~MultiVertexFitter().

◆ theCache

LinTrackCache MultiVertexFitter::theCache
private

Definition at line 113 of file MultiVertexFitter.h.

Referenced by updateSeeds(), and updateWeights().

◆ thePrimaries

std::set<reco::TransientTrack> MultiVertexFitter::thePrimaries
private

Definition at line 109 of file MultiVertexFitter.h.

Referenced by printWeights(), updateSeeds(), and updateWeights().

◆ theReviveBelow

float MultiVertexFitter::theReviveBelow
private

Definition at line 107 of file MultiVertexFitter.h.

Referenced by lostVertexClaimer().

◆ theSeeder

LinearizationPointFinder* MultiVertexFitter::theSeeder
private

Definition at line 111 of file MultiVertexFitter.h.

Referenced by ~MultiVertexFitter().

◆ theTracks

std::vector<reco::TransientTrack> MultiVertexFitter::theTracks
private

Definition at line 108 of file MultiVertexFitter.h.

Referenced by lostVertexClaimer(), printWeights(), updateSeeds(), and updateWeights().

◆ theVertexStateNr

int MultiVertexFitter::theVertexStateNr
private

Definition at line 106 of file MultiVertexFitter.h.

◆ theVertexStates

std::vector<std::pair<int, CachingVertex<5> > > MultiVertexFitter::theVertexStates
private

Definition at line 105 of file MultiVertexFitter.h.

Referenced by fit(), lostVertexClaimer(), printWeights(), updateSeeds(), and updateWeights().

◆ theWeights

TrackAndSeedToWeightMap MultiVertexFitter::theWeights
private

Definition at line 112 of file MultiVertexFitter.h.

Referenced by lostVertexClaimer(), printWeights(), updateSeeds(), and updateWeights().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
MultiVertexFitter::printSeeds
void printSeeds() const
Definition: MultiVertexFitter.cc:530
KalmanVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
Definition: KalmanVertexFitter.h:49
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
MultiVertexFitter::theSeeder
LinearizationPointFinder * theSeeder
Definition: MultiVertexFitter.h:111
VertexException
Common base class.
Definition: VertexException.h:12
MultiVertexFitter::theReviveBelow
float theReviveBelow
Definition: MultiVertexFitter.h:107
CachingVertex< 5 >
mps_merge.weight
weight
Definition: mps_merge.py:88
MultiVertexFitter::thePrimaries
std::set< reco::TransientTrack > thePrimaries
Definition: MultiVertexFitter.h:109
AnnealingSchedule::isAnnealed
virtual bool isAnnealed() const =0
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MultiVertexFitter::updateWeights
void updateWeights()
Definition: MultiVertexFitter.cc:282
pos
Definition: PixelAliasList.h:18
MultiVertexFitter::theWeights
TrackAndSeedToWeightMap theWeights
Definition: MultiVertexFitter.h:112
MultiVertexFitter::updateSeeds
bool updateSeeds()
Definition: MultiVertexFitter.cc:356
MultiVertexFitter::theCache
LinTrackCache theCache
Definition: MultiVertexFitter.h:113
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
MultiVertexFitter::vertices
std::vector< CachingVertex< 5 > > vertices(const std::vector< std::vector< reco::TransientTrack > > &, const std::vector< reco::TransientTrack > &primaries=std::vector< reco::TransientTrack >())
Definition: MultiVertexFitter.cc:233
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
fileCollector.seed
seed
Definition: fileCollector.py:127
MultiVertexFitter::createPrimaries
void createPrimaries(const std::vector< reco::TransientTrack > &tracks)
Definition: MultiVertexFitter.cc:103
MultiVertexFitter::theVertexStates
std::vector< std::pair< int, CachingVertex< 5 > > > theVertexStates
Definition: MultiVertexFitter.h:105
w
const double w
Definition: UKUtility.cc:23
KalmanVertexTrackCompatibilityEstimator
Definition: KalmanVertexTrackCompatibilityEstimator.h:24
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
AnnealingSchedule::phi
virtual double phi(double chi2) const =0
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
MultiVertexFitter::seedNr
int seedNr()
Definition: MultiVertexFitter.cc:112
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
MultiVertexFitter::resetSeedNr
void resetSeedNr()
Definition: MultiVertexFitter.cc:114
a
double a
Definition: hdecay.h:119
VertexTrackFactory< 5 >
MultiVertexFitter::fit
std::vector< CachingVertex< 5 > > fit()
Definition: MultiVertexFitter.cc:474
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
dqmiodatasetharvest.ctr
ctr
Definition: dqmiodatasetharvest.py:191
CachingVertex::position
GlobalPoint position() const
Definition: CachingVertex.cc:308
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
LinTrackCache::linTrack
RefCountedLinearizedTrackState linTrack(const GlobalPoint &, const reco::TransientTrack &)
Definition: LinTrackCache.cc:16
LinTrackCache::clear
void clear()
Definition: LinTrackCache.cc:54
KalmanVertexTrackCompatibilityEstimator::estimate
BDpair estimate(const CachingVertex< N > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const override
Definition: KalmanVertexTrackCompatibilityEstimator.cc:8
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
GlobalErrorBase< double, ErrorMatrixTag >
TransientVertex
Definition: TransientVertex.h:18
MultiVertexFitter::theTracks
std::vector< reco::TransientTrack > theTracks
Definition: MultiVertexFitter.h:108
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
MultiVertexFitter::TrackAndWeight
std::pair< reco::TransientTrack, float > TrackAndWeight
Definition: MultiVertexFitter.h:41
MultiVertexFitter::theAssComp
AnnealingSchedule * theAssComp
Definition: MultiVertexFitter.h:110
LinearizationPointFinder::clone
virtual LinearizationPointFinder * clone() const =0
VertexTrackFactory::vertexTrack
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Definition: VertexTrackFactory.h:27
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
heppy_batch.val
val
Definition: heppy_batch.py:351
MultiVertexFitter::theVertexStateNr
int theVertexStateNr
Definition: MultiVertexFitter.h:106
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
MultiVertexFitter::clear
void clear()
Definition: MultiVertexFitter.cc:79
MultiVertexFitter::RefCountedLinearizedTrackState
ReferenceCountingPointer< LinearizedTrackState< 5 > > RefCountedLinearizedTrackState
Definition: MultiVertexFitter.h:100
MultiVertexFitter::printWeights
void printWeights() const
Definition: MultiVertexFitter.cc:520
VertexState
Definition: VertexState.h:13
AnnealingSchedule::anneal
virtual void anneal()=0
TransientVertex::originalTracks
std::vector< reco::TransientTrack > const & originalTracks() const
Definition: TransientVertex.h:200
AnnealingSchedule::cutoff
virtual double cutoff() const =0
LinearizationPointFinder::getLinearizationPoint
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
hltEgammaHLTExtra_cfi.trks
trks
Definition: hltEgammaHLTExtra_cfi.py:43
mps_fire.result
result
Definition: mps_fire.py:311
MultiVertexFitter::createSeed
void createSeed(const std::vector< reco::TransientTrack > &tracks)
Definition: MultiVertexFitter.cc:91
AnnealingSchedule::resetAnnealing
virtual void resetAnnealing()=0
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MultiVertexFitter::RefCountedVertexTrack
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
Definition: MultiVertexFitter.h:99
weight
Definition: weight.py:1
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
KalmanVertexFitter
Definition: KalmanVertexFitter.h:22