CMS 3D CMS Logo

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

Get track history and classify it in function of their . More...

#include <VertexClassifier.h>

Inheritance diagram for VertexClassifier:
VertexCategories VertexClassifierByProxy< Collection > VertexClassifierByProxy< reco::SecondaryVertexTagInfoCollection >

Classes

struct  GeneratedPrimaryVertex
 Auxiliary class holding simulated primary vertices. More...
 

Public Types

typedef VertexCategories Categories
 Type to the associate category. More...
 
- Public Types inherited from VertexCategories
enum  Category {
  Fake = 0, Reconstructed = Fake, SignalEvent, BWeakDecay,
  CWeakDecay, TauDecay, KsDecay, LambdaDecay,
  JpsiDecay, XiDecay, OmegaDecay, SigmaPlusDecay,
  SigmaMinusDecay, LongLivedDecay, KnownProcess, UndefinedProcess,
  UnknownProcess, PrimaryProcess, HadronicProcess, DecayProcess,
  ComptonProcess, AnnihilationProcess, EIoniProcess, HIoniProcess,
  MuIoniProcess, PhotonProcess, MuPairProdProcess, ConversionsProcess,
  EBremProcess, SynchrotronRadiationProcess, MuBremProcess, MuNuclProcess,
  PrimaryVertex, SecondaryVertex, TertiaryVertex, TierciaryVertex = TertiaryVertex,
  Unknown
}
 Categories available to vertexes. More...
 
typedef std::vector< bool > Flags
 Main types associated to the class. More...
 

Public Member Functions

const VertexClassifierevaluate (reco::VertexBaseRef const &)
 Classify the RecoVertex in categories. More...
 
const VertexClassifierevaluate (reco::VertexRef const &vertex)
 Classify the RecoVertex in categories. More...
 
const VertexClassifierevaluate (TrackingVertexRef const &)
 Classify the TrackingVertex in categories. More...
 
const VertexHistoryhistory () const
 Returns a reference to the vertex history used in the classification. More...
 
virtual void newEvent (edm::Event const &, edm::EventSetup const &)
 Pre-process event information (for accessing reconstraction information) More...
 
 VertexClassifier (edm::ParameterSet const &pset, edm::ConsumesCollector &&)
 Constructor by ParameterSet. More...
 
virtual ~VertexClassifier ()
 
- Public Member Functions inherited from VertexCategories
const Flagsflags () const
 Returns flags with the category descriptions. More...
 
bool is (Category category) const
 Returns track flag for a given category. More...
 
 VertexCategories ()
 Void constructor. More...
 

Private Member Functions

void genPrimaryVertices ()
 
bool isCharged (const HepMC::GenParticle *)
 
bool isFinalstateParticle (const HepMC::GenParticle *)
 
void processesAtGenerator ()
 Get all the information related to decay process. More...
 
void processesAtSimulation ()
 Get information about conversion and other interactions. More...
 
void reconstructionInformation (reco::TrackBaseRef const &)
 Get reconstruction information. More...
 
void simulationInformation ()
 Get all the information related to the simulation details. More...
 
void vertexInformation ()
 Get geometrical information about the vertices. More...
 

Private Attributes

const G4toCMSLegacyProcTypeMap g4toCMSProcMap_
 
std::vector< GeneratedPrimaryVertexgenpvs_
 
const edm::InputTag hepMCLabel_
 
double longLivedDecayLength_
 
edm::Handle< edm::HepMCProductmcInformation_
 
edm::ESHandle< ParticleDataTableparticleDataTable_
 
VertexHistory tracer_
 
double vertexClusteringDistance_
 

Additional Inherited Members

- Static Public Attributes inherited from VertexCategories
static const char *const Names []
 Name of the different categories. More...
 
- Protected Member Functions inherited from VertexCategories
void reset ()
 Reset the categories flags. More...
 
void unknownVertex ()
 
- Protected Attributes inherited from VertexCategories
Flags flags_
 Flag containers. More...
 

Detailed Description

Get track history and classify it in function of their .

Definition at line 18 of file VertexClassifier.h.

Member Typedef Documentation

◆ Categories

Type to the associate category.

Definition at line 21 of file VertexClassifier.h.

Constructor & Destructor Documentation

◆ VertexClassifier()

VertexClassifier::VertexClassifier ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  collector 
)

Constructor by ParameterSet.

Definition at line 18 of file VertexClassifier.cc.

19  : VertexCategories(),
20  tracer_(config, std::move(collector)),
21  hepMCLabel_(config.getUntrackedParameter<edm::InputTag>("hepMC")) {
23  // Set the history depth after hadronization
24  tracer_.depth(-2);
25 
26  // Set the minimum decay length for detecting long decays
27  longLivedDecayLength_ = config.getUntrackedParameter<double>("longLivedDecayLength");
28 
29  // Set the distance for clustering vertices
30  vertexClusteringDistance_ = config.getUntrackedParameter<double>("vertexClusteringDistance");
31 }

References HistoryBase::depth(), hepMCLabel_, longLivedDecayLength_, tracer_, and vertexClusteringDistance_.

◆ ~VertexClassifier()

virtual VertexClassifier::~VertexClassifier ( )
inlinevirtual

Definition at line 26 of file VertexClassifier.h.

26 {}

Member Function Documentation

◆ evaluate() [1/3]

const VertexClassifier & VertexClassifier::evaluate ( reco::VertexBaseRef const &  vertex)

Classify the RecoVertex in categories.

Definition at line 47 of file VertexClassifier.cc.

47  {
48  // Initializing the category vector
49  reset();
50 
51  // Associate and evaluate the vertex history (check for fakes)
52  if (tracer_.evaluate(vertex)) {
53  // Get all the information related to the simulation details
55 
56  // Get all the information related to decay process
58 
59  // Get information about conversion and other interactions
61 
62  // Get geometrical information about the vertices
64 
65  // Check for unkown classification
66  unknownVertex();
67  } else
68  flags_[Fake] = true;
69 
70  return *this;
71 }

References VertexHistory::evaluate(), VertexCategories::Fake, VertexCategories::flags_, processesAtGenerator(), processesAtSimulation(), VertexCategories::reset(), simulationInformation(), tracer_, VertexCategories::unknownVertex(), bphysicsOniaDQM_cfi::vertex, and vertexInformation().

Referenced by VertexHistoryAnalyzer::analyze(), and VertexClassifierByProxy< reco::SecondaryVertexTagInfoCollection >::evaluate().

◆ evaluate() [2/3]

const VertexClassifier& VertexClassifier::evaluate ( reco::VertexRef const &  vertex)
inline

Classify the RecoVertex in categories.

Definition at line 38 of file VertexClassifier.h.

References evaluate(), and bphysicsOniaDQM_cfi::vertex.

Referenced by evaluate().

◆ evaluate() [3/3]

const VertexClassifier & VertexClassifier::evaluate ( TrackingVertexRef const &  vertex)

Classify the TrackingVertex in categories.

Definition at line 73 of file VertexClassifier.cc.

73  {
74  // Initializing the category vector
75  reset();
76 
77  // Trace the history for the given TP
79 
80  // Check for a reconstructed track
82  flags_[Reconstructed] = true;
83  else
84  flags_[Reconstructed] = false;
85 
86  // Get all the information related to the simulation details
88 
89  // Get all the information related to decay process
91 
92  // Get information about conversion and other interactions
94 
95  // Get geometrical information about the vertices
97 
98  // Check for unkown classification
99  unknownVertex();
100 
101  return *this;
102 }

References VertexHistory::evaluate(), VertexCategories::flags_, edm::RefToBase< T >::isNonnull(), processesAtGenerator(), processesAtSimulation(), VertexCategories::Reconstructed, VertexHistory::recoVertex(), VertexCategories::reset(), simulationInformation(), tracer_, VertexCategories::unknownVertex(), bphysicsOniaDQM_cfi::vertex, and vertexInformation().

◆ genPrimaryVertices()

void VertexClassifier::genPrimaryVertices ( )
private

Definition at line 381 of file VertexClassifier.cc.

381  {
382  genpvs_.clear();
383 
384  const HepMC::GenEvent *event = mcInformation_->GetEvent();
385 
386  if (event) {
387  int idx = 0;
388 
389  // Loop over the different GenVertex
390  for (HepMC::GenEvent::vertex_const_iterator ivertex = event->vertices_begin(); ivertex != event->vertices_end();
391  ++ivertex) {
392  bool hasParentVertex = false;
393 
394  // Loop over the parents looking to see if they are coming from a
395  // production vertex
396  for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(HepMC::parents);
397  iparent != (*ivertex)->particles_end(HepMC::parents);
398  ++iparent)
399  if ((*iparent)->production_vertex()) {
400  hasParentVertex = true;
401  break;
402  }
403 
404  // Reject those vertices with parent vertices
405  if (hasParentVertex)
406  continue;
407 
408  // Get the position of the vertex
409  HepMC::FourVector pos = (*ivertex)->position();
410 
411  double const mm = 0.1;
412 
413  GeneratedPrimaryVertex pv(pos.x() * mm, pos.y() * mm, pos.z() * mm);
414 
415  std::vector<GeneratedPrimaryVertex>::iterator ientry = genpvs_.begin();
416 
417  // Search for a VERY close vertex in the list
418  for (; ientry != genpvs_.end(); ++ientry) {
419  double distance = sqrt(pow(pv.x - ientry->x, 2) + pow(pv.y - ientry->y, 2) + pow(pv.z - ientry->z, 2));
421  break;
422  }
423 
424  // Check if there is not a VERY close vertex and added to the list
425  if (ientry == genpvs_.end())
426  ientry = genpvs_.insert(ientry, pv);
427 
428  // Add the vertex barcodes to the new or existent vertices
429  ientry->genVertex.push_back((*ivertex)->barcode());
430 
431  // Collect final state descendants
432  for (HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
433  idecendants != (*ivertex)->particles_end(HepMC::descendants);
434  ++idecendants) {
435  if (isFinalstateParticle(*idecendants))
436  if (find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) ==
437  ientry->finalstateParticles.end()) {
438  ientry->finalstateParticles.push_back((*idecendants)->barcode());
439  HepMC::FourVector m = (*idecendants)->momentum();
440 
441  ientry->ptot.setPx(ientry->ptot.px() + m.px());
442  ientry->ptot.setPy(ientry->ptot.py() + m.py());
443  ientry->ptot.setPz(ientry->ptot.pz() + m.pz());
444  ientry->ptot.setE(ientry->ptot.e() + m.e());
445  ientry->ptsq += m.perp() * m.perp();
446 
447  if (m.perp() > 0.8 && std::abs(m.pseudoRapidity()) < 2.5 && isCharged(*idecendants))
448  ientry->nGenTrk++;
449  }
450  }
451  idx++;
452  }
453  }
454 
455  std::sort(genpvs_.begin(), genpvs_.end());
456 }

References funct::abs(), HLT_FULL_cff::distance, spr::find(), genpvs_, edm::HepMCProduct::GetEvent(), heavyIonCSV_trainingSettings::idx, isCharged(), isFinalstateParticle(), visualization-live-secondInstance_cfg::m, mcInformation_, parents, funct::pow(), MetAnalyzer::pv(), jetUpdater_cfi::sort, mathSSE::sqrt(), and vertexClusteringDistance_.

Referenced by newEvent().

◆ history()

const VertexHistory& VertexClassifier::history ( ) const
inline

Returns a reference to the vertex history used in the classification.

Definition at line 41 of file VertexClassifier.h.

41 { return tracer_; }

References tracer_.

Referenced by VertexHistoryAnalyzer::analyze(), SVTagInfoValidationAnalyzer::analyze(), and recoBSVTagInfoValidationAnalyzer::analyze().

◆ isCharged()

bool VertexClassifier::isCharged ( const HepMC::GenParticle *  p)
private

Definition at line 371 of file VertexClassifier.cc.

371  {
372  const ParticleData *part = particleDataTable_->particle(p->pdg_id());
373  if (part)
374  return part->charge() != 0;
375  else {
376  // the new/improved particle table doesn't know anti-particles
377  return particleDataTable_->particle(-p->pdg_id()) != nullptr;
378  }
379 }

References AlCaHLTBitMon_ParallelJobs::p, and particleDataTable_.

Referenced by genPrimaryVertices().

◆ isFinalstateParticle()

bool VertexClassifier::isFinalstateParticle ( const HepMC::GenParticle *  p)
private

Definition at line 367 of file VertexClassifier.cc.

367  {
368  return !p->end_vertex() && p->status() == 1;
369 }

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by genPrimaryVertices().

◆ newEvent()

void VertexClassifier::newEvent ( edm::Event const &  event,
edm::EventSetup const &  setup 
)
virtual

Pre-process event information (for accessing reconstraction information)

Reimplemented in VertexClassifierByProxy< Collection >, and VertexClassifierByProxy< reco::SecondaryVertexTagInfoCollection >.

Definition at line 33 of file VertexClassifier.cc.

33  {
34  // Get the new event information for the tracer
36 
37  // Get hepmc of the event
38  event.getByLabel(hepMCLabel_, mcInformation_);
39 
40  // Get the partivle data table
41  setup.getData(particleDataTable_);
42 
43  // Create the list of primary vertices associated to the event
45 }

References genPrimaryVertices(), hepMCLabel_, mcInformation_, VertexHistory::newEvent(), particleDataTable_, singleTopDQM_cfi::setup, and tracer_.

Referenced by VertexHistoryAnalyzer::analyze(), and VertexClassifierByProxy< reco::SecondaryVertexTagInfoCollection >::newEvent().

◆ processesAtGenerator()

void VertexClassifier::processesAtGenerator ( )
private

Get all the information related to decay process.

Definition at line 111 of file VertexClassifier.cc.

111  {
112  // Get the generated vetices from track history
113  VertexHistory::GenVertexTrail const &genVertexTrail = tracer_.genVertexTrail();
114 
115  // Loop over the generated vertices
116  for (VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin(); ivertex != genVertexTrail.end();
117  ++ivertex) {
118  // Get the pointer to the vertex by removing the const-ness (no const methos
119  // in HepMC::GenVertex)
120  HepMC::GenVertex *vertex = const_cast<HepMC::GenVertex *>(*ivertex);
121 
122  // Loop over the sources looking for specific decays
123  for (HepMC::GenVertex::particle_iterator iparent = vertex->particles_begin(HepMC::parents);
124  iparent != vertex->particles_end(HepMC::parents);
125  ++iparent) {
126  // Collect the pdgid of the parent
127  int pdgid = std::abs((*iparent)->pdg_id());
128  // Get particle type
130 
131  // Check if the particle type is valid one
132  if (particleID.isValid()) {
133  // Get particle data
134  ParticleData const *particleData = particleDataTable_->particle(particleID);
135  // Check if the particle exist in the table
136  if (particleData) {
137  // Check if their life time is bigger than longLivedDecayLength_
138  if (particleData->lifetime() > longLivedDecayLength_) {
139  // Check for B, C weak decays and long lived decays
140  update(flags_[BWeakDecay], particleID.hasBottom());
141  update(flags_[CWeakDecay], particleID.hasCharm());
142  update(flags_[LongLivedDecay], true);
143  }
144  // Check Tau, Ks and Lambda decay
145  update(flags_[TauDecay], pdgid == 15);
146  update(flags_[KsDecay], pdgid == 310);
147  update(flags_[LambdaDecay], pdgid == 3122);
148  update(flags_[JpsiDecay], pdgid == 443);
149  update(flags_[XiDecay], pdgid == 3312);
150  update(flags_[OmegaDecay], pdgid == 3334);
151  update(flags_[SigmaPlusDecay], pdgid == 3222);
152  update(flags_[SigmaMinusDecay], pdgid == 3112);
153  }
154  }
155  }
156  }
157 }

References funct::abs(), VertexCategories::BWeakDecay, VertexCategories::CWeakDecay, VertexCategories::flags_, HistoryBase::genVertexTrail(), VertexCategories::JpsiDecay, VertexCategories::KsDecay, VertexCategories::LambdaDecay, VertexCategories::LongLivedDecay, longLivedDecayLength_, VertexCategories::OmegaDecay, parents, particleDataTable_, EgammaObjectsElectrons_cfi::particleID, LHEGenericFilter_cfi::ParticleID, EgammaValidation_cff::pdgid, VertexCategories::SigmaMinusDecay, VertexCategories::SigmaPlusDecay, tracer_, update, bphysicsOniaDQM_cfi::vertex, and VertexCategories::XiDecay.

Referenced by evaluate().

◆ processesAtSimulation()

void VertexClassifier::processesAtSimulation ( )
private

Get information about conversion and other interactions.

Definition at line 159 of file VertexClassifier.cc.

159  {
160  VertexHistory::SimVertexTrail const &simVertexTrail = tracer_.simVertexTrail();
161 
162  for (VertexHistory::SimVertexTrail::const_iterator ivertex = simVertexTrail.begin(); ivertex != simVertexTrail.end();
163  ++ivertex) {
164  // pdgid of the real source parent vertex
165  int pdgid = 0;
166 
167  // select the original source in case of combined vertices
168  bool flag = false;
170 
171  for (its = (*ivertex)->sourceTracks_begin(); its != (*ivertex)->sourceTracks_end(); ++its) {
172  for (itd = (*ivertex)->daughterTracks_begin(); itd != (*ivertex)->daughterTracks_end(); ++itd)
173  if (itd != its) {
174  flag = true;
175  break;
176  }
177  if (flag)
178  break;
179  }
180  // Collect the pdgid of the original source track
181  if (its != (*ivertex)->sourceTracks_end())
182  pdgid = std::abs((*its)->pdgId());
183  else
184  pdgid = 0;
185 
186  // Geant4 process type is selected using first Geant4 vertex assigned to
187  // the TrackingVertex
188  unsigned int processG4 = 0;
189 
190  if ((*ivertex)->nG4Vertices() > 0) {
191  processG4 = (*(*ivertex)->g4Vertices_begin()).processType();
192  }
193 
194  unsigned int process = g4toCMSProcMap_.processId(processG4);
195 
196  // Flagging all the different processes
198 
216 
217  // Loop over the simulated particles
218  for (TrackingVertex::tp_iterator iparticle = (*ivertex)->daughterTracks_begin();
219  iparticle != (*ivertex)->daughterTracks_end();
220  ++iparticle) {
221  if ((*iparticle)->numberOfTrackerLayers()) {
222  // Special treatment for decays
223  if (process == CMS::Decay) {
224  // Get particle type
226  // Check if the particle type is valid one
227  if (particleID.isValid()) {
228  // Get particle data
229  ParticleData const *particleData = particleDataTable_->particle(particleID);
230  // Check if the particle exist in the table
231  if (particleData) {
232  // Check if their life time is bigger than 1e-14
233  if (particleDataTable_->particle(particleID)->lifetime() > longLivedDecayLength_) {
234  // Check for B, C weak decays and long lived decays
235  update(flags_[BWeakDecay], particleID.hasBottom());
236  update(flags_[CWeakDecay], particleID.hasCharm());
237  update(flags_[LongLivedDecay], true);
238  }
239  // Check Tau, Ks and Lambda decay
240  update(flags_[TauDecay], pdgid == 15);
241  update(flags_[KsDecay], pdgid == 310);
242  update(flags_[LambdaDecay], pdgid == 3122);
243  update(flags_[JpsiDecay], pdgid == 443);
244  update(flags_[XiDecay], pdgid == 3312);
245  update(flags_[OmegaDecay], pdgid == 3334);
246  update(flags_[SigmaPlusDecay], pdgid == 3222);
247  update(flags_[SigmaMinusDecay], pdgid == 3112);
248  }
249  }
250  }
251  }
252  }
253  }
254 }

References funct::abs(), CMS::Annihilation, VertexCategories::AnnihilationProcess, VertexCategories::BWeakDecay, CMS::Compton, VertexCategories::ComptonProcess, CMS::Conversions, VertexCategories::ConversionsProcess, VertexCategories::CWeakDecay, CMS::Decay, VertexCategories::DecayProcess, CMS::EBrem, VertexCategories::EBremProcess, CMS::EIoni, VertexCategories::EIoniProcess, RemoveAddSevLevel::flag, VertexCategories::flags_, g4toCMSProcMap_, CMS::Hadronic, VertexCategories::HadronicProcess, CMS::HIoni, VertexCategories::HIoniProcess, VertexCategories::JpsiDecay, VertexCategories::KnownProcess, VertexCategories::KsDecay, VertexCategories::LambdaDecay, VertexCategories::LongLivedDecay, longLivedDecayLength_, CMS::MuBrem, VertexCategories::MuBremProcess, CMS::MuIoni, VertexCategories::MuIoniProcess, CMS::MuNucl, VertexCategories::MuNuclProcess, CMS::MuPairProd, VertexCategories::MuPairProdProcess, VertexCategories::OmegaDecay, particleDataTable_, EgammaObjectsElectrons_cfi::particleID, LHEGenericFilter_cfi::ParticleID, EgammaValidation_cff::pdgid, CMS::Photon, VertexCategories::PhotonProcess, CMS::Primary, VertexCategories::PrimaryProcess, LaserDQM_cfg::process, G4toCMSLegacyProcTypeMap::processId(), VertexCategories::SigmaMinusDecay, VertexCategories::SigmaPlusDecay, HistoryBase::simVertexTrail(), CMS::SynchrotronRadiation, VertexCategories::SynchrotronRadiationProcess, tracer_, CMS::Undefined, VertexCategories::UndefinedProcess, CMS::Unknown, VertexCategories::UnknownProcess, update, and VertexCategories::XiDecay.

Referenced by evaluate().

◆ reconstructionInformation()

void VertexClassifier::reconstructionInformation ( reco::TrackBaseRef const &  )
private

Get reconstruction information.

◆ simulationInformation()

void VertexClassifier::simulationInformation ( )
private

Get all the information related to the simulation details.

Definition at line 104 of file VertexClassifier.cc.

104  {
105  // Get the event id for the initial TP.
106  EncodedEventId eventId = tracer_.simVertex()->eventId();
107  // Check for signal events
108  flags_[SignalEvent] = !eventId.bunchCrossing() && !eventId.event();
109 }

References EncodedEventId::bunchCrossing(), EncodedEventId::event(), VertexCategories::flags_, VertexCategories::SignalEvent, HistoryBase::simVertex(), and tracer_.

Referenced by evaluate().

◆ vertexInformation()

void VertexClassifier::vertexInformation ( )
private

Get geometrical information about the vertices.

Definition at line 256 of file VertexClassifier.cc.

256  {
257  // Helper class for clusterization
258  typedef std::multimap<double, HepMC::ThreeVector> Clusters;
259  typedef std::pair<double, HepMC::ThreeVector> ClusterPair;
260 
262 
263  // Get the main primary vertex from the list
264  GeneratedPrimaryVertex const &genpv = genpvs_.back();
265 
266  // Get the generated history of the tracks
267  const VertexHistory::GenVertexTrail &genVertexTrail = tracer_.genVertexTrail();
268 
269  // Unit transformation from mm to cm
270  double const mm = 0.1;
271 
272  // Loop over the generated vertexes
273  for (VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin(); ivertex != genVertexTrail.end();
274  ++ivertex) {
275  // Check vertex exist
276  if (*ivertex) {
277  // Measure the distance2 respecto the primary vertex
278  HepMC::ThreeVector p = (*ivertex)->point3d();
279  double distance =
280  sqrt(pow(p.x() * mm - genpv.x, 2) + pow(p.y() * mm - genpv.y, 2) + pow(p.z() * mm - genpv.z, 2));
281 
282  // If there is not any clusters add the first vertex.
283  if (clusters.empty()) {
284  clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)));
285  continue;
286  }
287 
288  // Check if there is already a cluster in the given distance from primary
289  // vertex
290  Clusters::const_iterator icluster = clusters.lower_bound(distance - vertexClusteringDistance_);
291 
292  if (icluster == clusters.upper_bound(distance + vertexClusteringDistance_)) {
293  clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)));
294  continue;
295  }
296 
297  bool cluster = false;
298 
299  // Looping over the vertex clusters of a given distance from primary
300  // vertex
301  for (; icluster != clusters.upper_bound(distance + vertexClusteringDistance_); ++icluster) {
302  double difference = sqrt(pow(p.x() * mm - icluster->second.x(), 2) + pow(p.y() * mm - icluster->second.y(), 2) +
303  pow(p.z() * mm - icluster->second.z(), 2));
304 
305  if (difference < vertexClusteringDistance_) {
306  cluster = true;
307  break;
308  }
309  }
310 
311  if (!cluster)
312  clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)));
313  }
314  }
315 
316  const VertexHistory::SimVertexTrail &simVertexTrail = tracer_.simVertexTrail();
317 
318  // Loop over the generated particles
319  for (VertexHistory::SimVertexTrail::const_reverse_iterator ivertex = simVertexTrail.rbegin();
320  ivertex != simVertexTrail.rend();
321  ++ivertex) {
322  // Look for those with production vertex
323  TrackingVertex::LorentzVector p = (*ivertex)->position();
324 
325  double distance = sqrt(pow(p.x() - genpv.x, 2) + pow(p.y() - genpv.y, 2) + pow(p.z() - genpv.z, 2));
326 
327  // If there is not any clusters add the first vertex.
328  if (clusters.empty()) {
329  clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())));
330  continue;
331  }
332 
333  // Check if there is already a cluster in the given distance from primary
334  // vertex
335  Clusters::const_iterator icluster = clusters.lower_bound(distance - vertexClusteringDistance_);
336 
337  if (icluster == clusters.upper_bound(distance + vertexClusteringDistance_)) {
338  clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())));
339  continue;
340  }
341 
342  bool cluster = false;
343 
344  // Looping over the vertex clusters of a given distance from primary vertex
345  for (; icluster != clusters.upper_bound(distance + vertexClusteringDistance_); ++icluster) {
346  double difference = sqrt(pow(p.x() - icluster->second.x(), 2) + pow(p.y() - icluster->second.y(), 2) +
347  pow(p.z() - icluster->second.z(), 2));
348 
349  if (difference < vertexClusteringDistance_) {
350  cluster = true;
351  break;
352  }
353  }
354 
355  if (!cluster)
356  clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())));
357  }
358 
359  if (clusters.size() == 1)
360  flags_[PrimaryVertex] = true;
361  else if (clusters.size() == 2)
362  flags_[SecondaryVertex] = true;
363  else
364  flags_[TertiaryVertex] = true;
365 }

References caloTruthCellsNtuples_cff::Clusters, bsc_activity_cfg::clusters, HLT_FULL_cff::distance, VertexCategories::flags_, genpvs_, HistoryBase::genVertexTrail(), AlCaHLTBitMon_ParallelJobs::p, funct::pow(), VertexCategories::PrimaryVertex, VertexCategories::SecondaryVertex, HistoryBase::simVertexTrail(), mathSSE::sqrt(), VertexCategories::TertiaryVertex, tracer_, vertexClusteringDistance_, VertexClassifier::GeneratedPrimaryVertex::x, VertexClassifier::GeneratedPrimaryVertex::y, and VertexClassifier::GeneratedPrimaryVertex::z.

Referenced by evaluate().

Member Data Documentation

◆ g4toCMSProcMap_

const G4toCMSLegacyProcTypeMap VertexClassifier::g4toCMSProcMap_
private

Definition at line 46 of file VertexClassifier.h.

Referenced by processesAtSimulation().

◆ genpvs_

std::vector<GeneratedPrimaryVertex> VertexClassifier::genpvs_
private

Definition at line 89 of file VertexClassifier.h.

Referenced by genPrimaryVertices(), and vertexInformation().

◆ hepMCLabel_

const edm::InputTag VertexClassifier::hepMCLabel_
private

Definition at line 48 of file VertexClassifier.h.

Referenced by newEvent(), and VertexClassifier().

◆ longLivedDecayLength_

double VertexClassifier::longLivedDecayLength_
private

◆ mcInformation_

edm::Handle<edm::HepMCProduct> VertexClassifier::mcInformation_
private

Definition at line 53 of file VertexClassifier.h.

Referenced by genPrimaryVertices(), and newEvent().

◆ particleDataTable_

edm::ESHandle<ParticleDataTable> VertexClassifier::particleDataTable_
private

◆ tracer_

VertexHistory VertexClassifier::tracer_
private

◆ vertexClusteringDistance_

double VertexClassifier::vertexClusteringDistance_
private

Definition at line 51 of file VertexClassifier.h.

Referenced by genPrimaryVertices(), VertexClassifier(), and vertexInformation().

CMS::EIoni
Definition: CMSProcessTypes.h:14
VertexClassifier::longLivedDecayLength_
double longLivedDecayLength_
Definition: VertexClassifier.h:50
CMS::MuBrem
Definition: CMSProcessTypes.h:22
VertexCategories::KsDecay
Definition: VertexCategories.h:18
VertexCategories::PhotonProcess
Definition: VertexCategories.h:37
VertexCategories::OmegaDecay
Definition: VertexCategories.h:22
VertexCategories::unknownVertex
void unknownVertex()
Definition: VertexCategories.cc:42
VertexCategories::SecondaryVertex
Definition: VertexCategories.h:45
VertexCategories::TertiaryVertex
Definition: VertexCategories.h:46
VertexCategories::KnownProcess
Definition: VertexCategories.h:26
VertexHistory::recoVertex
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
Definition: VertexHistory.h:56
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
VertexCategories::SigmaPlusDecay
Definition: VertexCategories.h:23
CMS::SynchrotronRadiation
Definition: CMSProcessTypes.h:21
VertexCategories::MuIoniProcess
Definition: VertexCategories.h:36
VertexCategories::EIoniProcess
Definition: VertexCategories.h:34
VertexClassifier::processesAtGenerator
void processesAtGenerator()
Get all the information related to decay process.
Definition: VertexClassifier.cc:111
VertexCategories::AnnihilationProcess
Definition: VertexCategories.h:33
TauDecay
Definition: TauDecay.h:21
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
VertexCategories::HIoniProcess
Definition: VertexCategories.h:35
VertexCategories::UndefinedProcess
Definition: VertexCategories.h:27
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
VertexCategories::CWeakDecay
Definition: VertexCategories.h:16
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
ParticleData
HepPDT::ParticleData ParticleData
Definition: ParticleDataTable.h:9
CMS::Decay
Definition: CMSProcessTypes.h:11
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
EncodedEventId
Definition: EncodedEventId.h:11
config
Definition: config.py:1
VertexClassifier::processesAtSimulation
void processesAtSimulation()
Get information about conversion and other interactions.
Definition: VertexClassifier.cc:159
VertexClassifier::mcInformation_
edm::Handle< edm::HepMCProduct > mcInformation_
Definition: VertexClassifier.h:53
part
part
Definition: HCALResponse.h:20
CMS::EBrem
Definition: CMSProcessTypes.h:20
EgammaObjectsElectrons_cfi.particleID
particleID
Definition: EgammaObjectsElectrons_cfi.py:4
update
#define update(a, b)
Definition: VertexClassifier.cc:13
VertexCategories::LongLivedDecay
Definition: VertexCategories.h:25
CMS::Hadronic
Definition: CMSProcessTypes.h:10
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
HistoryBase::simVertexTrail
const SimVertexTrail & simVertexTrail() const
Return all the simulated vertices in the history.
Definition: HistoryBase.h:52
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HistoryBase::GenVertexTrail
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
Definition: HistoryBase.h:24
VertexClassifier::vertexClusteringDistance_
double vertexClusteringDistance_
Definition: VertexClassifier.h:51
VertexCategories::XiDecay
Definition: VertexCategories.h:21
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
VertexClassifier::simulationInformation
void simulationInformation()
Get all the information related to the simulation details.
Definition: VertexClassifier.cc:104
HistoryBase::simVertex
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
Definition: HistoryBase.h:70
VertexHistory::evaluate
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:38
VertexCategories::UnknownProcess
Definition: VertexCategories.h:28
VertexCategories::VertexCategories
VertexCategories()
Void constructor.
Definition: VertexCategories.h:58
HistoryBase::genVertexTrail
const GenVertexTrail & genVertexTrail() const
Return all generated vertex in the history.
Definition: HistoryBase.h:58
VertexCategories::ComptonProcess
Definition: VertexCategories.h:32
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
CMS::Unknown
Definition: CMSProcessTypes.h:8
CMS::Undefined
Definition: CMSProcessTypes.h:7
VertexCategories::DecayProcess
Definition: VertexCategories.h:31
CMS::Annihilation
Definition: CMSProcessTypes.h:13
CMS::HIoni
Definition: CMSProcessTypes.h:15
CMS::Photon
Definition: CMSProcessTypes.h:17
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
VertexCategories::MuPairProdProcess
Definition: VertexCategories.h:38
VertexClassifier::vertexInformation
void vertexInformation()
Get geometrical information about the vertices.
Definition: VertexClassifier.cc:256
VertexCategories::EBremProcess
Definition: VertexCategories.h:40
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
VertexCategories::SignalEvent
Definition: VertexCategories.h:14
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
VertexCategories::SynchrotronRadiationProcess
Definition: VertexCategories.h:41
VertexClassifier::tracer_
VertexHistory tracer_
Definition: VertexClassifier.h:44
EncodedEventId::event
int event() const
get the contents of the subdetector field (should be protected?)
Definition: EncodedEventId.h:30
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
VertexCategories::HadronicProcess
Definition: VertexCategories.h:30
caloTruthCellsNtuples_cff.Clusters
Clusters
Definition: caloTruthCellsNtuples_cff.py:28
VertexCategories::SigmaMinusDecay
Definition: VertexCategories.h:24
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
VertexClassifier::genPrimaryVertices
void genPrimaryVertices()
Definition: VertexClassifier.cc:381
CMS::MuPairProd
Definition: CMSProcessTypes.h:18
VertexCategories::JpsiDecay
Definition: VertexCategories.h:20
VertexCategories::BWeakDecay
Definition: VertexCategories.h:15
CMS::MuNucl
Definition: CMSProcessTypes.h:23
VertexClassifier::genpvs_
std::vector< GeneratedPrimaryVertex > genpvs_
Definition: VertexClassifier.h:89
VertexClassifier::hepMCLabel_
const edm::InputTag hepMCLabel_
Definition: VertexClassifier.h:48
eostools.move
def move(src, dest)
Definition: eostools.py:511
VertexCategories::PrimaryVertex
Definition: VertexCategories.h:44
VertexCategories::LambdaDecay
Definition: VertexCategories.h:19
VertexCategories::flags_
Flags flags_
Flag containers.
Definition: VertexCategories.h:74
VertexClassifier::isCharged
bool isCharged(const HepMC::GenParticle *)
Definition: VertexClassifier.cc:371
CMS::Compton
Definition: CMSProcessTypes.h:12
edm::RefToBase::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:301
edm::RefVectorIterator
Definition: EDProductfwd.h:33
VertexCategories::PrimaryProcess
Definition: VertexCategories.h:29
VertexClassifier::evaluate
const VertexClassifier & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
Definition: VertexClassifier.cc:47
CMS::Primary
Definition: CMSProcessTypes.h:9
G4toCMSLegacyProcTypeMap::processId
const unsigned int processId(unsigned int g4ProcessId) const
Definition: Utils.cc:59
edm::RefToBase< reco::Vertex >
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
VertexCategories::reset
void reset()
Reset the categories flags.
Definition: VertexCategories.h:68
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
VertexCategories::Fake
Definition: VertexCategories.h:12
edm::HepMCProduct
Definition: HepMCProduct.h:21
CMS::MuIoni
Definition: CMSProcessTypes.h:16
parents
TPRegexp parents
Definition: eve_filter.cc:21
event
Definition: event.py:1
EgammaValidation_cff.pdgid
pdgid
Definition: EgammaValidation_cff.py:30
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
VertexClassifier::particleDataTable_
edm::ESHandle< ParticleDataTable > particleDataTable_
Definition: VertexClassifier.h:55
VertexClassifier::isFinalstateParticle
bool isFinalstateParticle(const HepMC::GenParticle *)
Definition: VertexClassifier.cc:367
VertexHistory::newEvent
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: VertexHistory.cc:34
VertexCategories::Reconstructed
Definition: VertexCategories.h:13
VertexCategories::MuBremProcess
Definition: VertexCategories.h:42
LHEGenericFilter_cfi.ParticleID
ParticleID
Definition: LHEGenericFilter_cfi.py:6
VertexClassifier::g4toCMSProcMap_
const G4toCMSLegacyProcTypeMap g4toCMSProcMap_
Definition: VertexClassifier.h:46
edm::InputTag
Definition: InputTag.h:15
HistoryBase::depth
void depth(int d)
Set the depth of the history.
Definition: HistoryBase.h:49
EncodedEventId::bunchCrossing
int bunchCrossing() const
get the detector field from this detid
Definition: EncodedEventId.h:25
CMS::Conversions
Definition: CMSProcessTypes.h:19
VertexCategories::MuNuclProcess
Definition: VertexCategories.h:43
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
HistoryBase::SimVertexTrail
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Definition: HistoryBase.h:33
TrackingVertex::LorentzVector
math::XYZTLorentzVectorD LorentzVector
Definition: TrackingVertex.h:28
VertexCategories::ConversionsProcess
Definition: VertexCategories.h:39