CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

VertexClassifier const & evaluate (reco::VertexBaseRef const &)
 Classify the RecoVertex in categories. More...
 
VertexClassifier const & evaluate (TrackingVertexRef const &)
 Classify the TrackingVertex in categories. More...
 
VertexClassifier const & evaluate (reco::VertexRef const &vertex)
 Classify the RecoVertex in categories. More...
 
VertexHistory const & history () 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
< GeneratedPrimaryVertex
genpvs_
 
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

Type to the associate category.

Definition at line 24 of file VertexClassifier.h.

Constructor & Destructor Documentation

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

Constructor by ParameterSet.

Definition at line 17 of file VertexClassifier.cc.

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

18  :
20  tracer_(config,std::move(collector)),
21  hepMCLabel_( config.getUntrackedParameter<edm::InputTag>("hepMC") )
22 {
24  // Set the history depth after hadronization
25  tracer_.depth(-2);
26 
27  // Set the minimum decay length for detecting long decays
28  longLivedDecayLength_ = config.getUntrackedParameter<double>("longLivedDecayLength");
29 
30  // Set the distance for clustering vertices
31  vertexClusteringDistance_ = config.getUntrackedParameter<double>("vertexClusteringDistance");
32 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
VertexHistory tracer_
const edm::InputTag hepMCLabel_
def move
Definition: eostools.py:508
double longLivedDecayLength_
void depth(int d)
Set the depth of the history.
Definition: HistoryBase.h:47
double vertexClusteringDistance_
VertexCategories()
Void constructor.
virtual VertexClassifier::~VertexClassifier ( )
inlinevirtual

Definition at line 30 of file VertexClassifier.h.

30 {}

Member Function Documentation

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

Classify the RecoVertex in categories.

Definition at line 51 of file VertexClassifier.cc.

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

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

52 {
53  // Initializing the category vector
54  reset();
55 
56  // Associate and evaluate the vertex history (check for fakes)
57  if ( tracer_.evaluate(vertex) )
58  {
59  // Get all the information related to the simulation details
61 
62  // Get all the information related to decay process
64 
65  // Get information about conversion and other interactions
67 
68  // Get geometrical information about the vertices
70 
71  // Check for unkown classification
72  unknownVertex();
73  }
74  else
75  flags_[Fake] = true;
76 
77  return *this;
78 }
VertexHistory tracer_
void vertexInformation()
Get geometrical information about the vertices.
void reset()
Reset the categories flags.
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:42
Flags flags_
Flag containers.
void processesAtGenerator()
Get all the information related to decay process.
void processesAtSimulation()
Get information about conversion and other interactions.
void simulationInformation()
Get all the information related to the simulation details.
VertexClassifier const & VertexClassifier::evaluate ( TrackingVertexRef const &  vertex)

Classify the TrackingVertex in categories.

Definition at line 81 of file VertexClassifier.cc.

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

82 {
83  // Initializing the category vector
84  reset();
85 
86  // Trace the history for the given TP
87  tracer_.evaluate(vertex);
88 
89  // Check for a reconstructed track
90  if ( tracer_.recoVertex().isNonnull() )
91  flags_[Reconstructed] = true;
92  else
93  flags_[Reconstructed] = false;
94 
95  // Get all the information related to the simulation details
97 
98  // Get all the information related to decay process
100 
101  // Get information about conversion and other interactions
103 
104  // Get geometrical information about the vertices
106 
107  // Check for unkown classification
108  unknownVertex();
109 
110  return *this;
111 }
VertexHistory tracer_
void vertexInformation()
Get geometrical information about the vertices.
void reset()
Reset the categories flags.
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:279
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
Definition: VertexHistory.h:64
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:42
Flags flags_
Flag containers.
void processesAtGenerator()
Get all the information related to decay process.
void processesAtSimulation()
Get information about conversion and other interactions.
void simulationInformation()
Get all the information related to the simulation details.
VertexClassifier const& VertexClassifier::evaluate ( reco::VertexRef const &  vertex)
inline

Classify the RecoVertex in categories.

Definition at line 42 of file VertexClassifier.h.

References evaluate().

43  {
44  return evaluate( reco::VertexBaseRef(vertex) );
45  }
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
void VertexClassifier::genPrimaryVertices ( )
private

Definition at line 457 of file VertexClassifier.cc.

References funct::abs(), HLT_25ns14e33_v1_cff::distance, event(), spr::find(), genpvs_, customizeTrackingMonitorSeedNumber::idx, isCharged(), isFinalstateParticle(), visualization-live-secondInstance_cfg::m, mcInformation_, parents, funct::pow(), MetAnalyzer::pv(), python.multivaluedict::sort(), mathSSE::sqrt(), and vertexClusteringDistance_.

Referenced by newEvent().

458 {
459  genpvs_.clear();
460 
461  const HepMC::GenEvent * event = mcInformation_->GetEvent();
462 
463  if (event)
464  {
465  int idx = 0;
466 
467  // Loop over the different GenVertex
468  for ( HepMC::GenEvent::vertex_const_iterator ivertex = event->vertices_begin(); ivertex != event->vertices_end(); ++ivertex )
469  {
470  bool hasParentVertex = false;
471 
472  // Loop over the parents looking to see if they are coming from a production vertex
473  for (
474  HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(HepMC::parents);
475  iparent != (*ivertex)->particles_end(HepMC::parents);
476  ++iparent
477  )
478  if ( (*iparent)->production_vertex() )
479  {
480  hasParentVertex = true;
481  break;
482  }
483 
484  // Reject those vertices with parent vertices
485  if (hasParentVertex) continue;
486 
487  // Get the position of the vertex
488  HepMC::FourVector pos = (*ivertex)->position();
489 
490  double const mm = 0.1;
491 
492  GeneratedPrimaryVertex pv(pos.x()*mm, pos.y()*mm, pos.z()*mm);
493 
494  std::vector<GeneratedPrimaryVertex>::iterator ientry = genpvs_.begin();
495 
496  // Search for a VERY close vertex in the list
497  for (; ientry != genpvs_.end(); ++ientry)
498  {
499  double distance = sqrt( pow(pv.x - ientry->x, 2) + pow(pv.y - ientry->y, 2) + pow(pv.z - ientry->z, 2) );
500  if ( distance < vertexClusteringDistance_ )
501  break;
502  }
503 
504  // Check if there is not a VERY close vertex and added to the list
505  if (ientry == genpvs_.end())
506  ientry = genpvs_.insert(ientry,pv);
507 
508  // Add the vertex barcodes to the new or existent vertices
509  ientry->genVertex.push_back((*ivertex)->barcode());
510 
511  // Collect final state descendants
512  for (
513  HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
514  idecendants != (*ivertex)->particles_end(HepMC::descendants);
515  ++idecendants
516  )
517  {
518  if (isFinalstateParticle(*idecendants))
519  if ( find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) == ientry->finalstateParticles.end() )
520  {
521  ientry->finalstateParticles.push_back((*idecendants)->barcode());
522  HepMC::FourVector m = (*idecendants)->momentum();
523 
524  ientry->ptot.setPx(ientry->ptot.px() + m.px());
525  ientry->ptot.setPy(ientry->ptot.py() + m.py());
526  ientry->ptot.setPz(ientry->ptot.pz() + m.pz());
527  ientry->ptot.setE(ientry->ptot.e() + m.e());
528  ientry->ptsq += m.perp() * m.perp();
529 
530  if ( m.perp() > 0.8 && std::abs(m.pseudoRapidity()) < 2.5 && isCharged(*idecendants) ) ientry->nGenTrk++;
531  }
532  }
533  idx++;
534  }
535  }
536 
537  std::sort(genpvs_.begin(), genpvs_.end());
538 }
edm::Handle< edm::HepMCProduct > mcInformation_
TPRegexp parents
Definition: eve_filter.cc:24
std::vector< GeneratedPrimaryVertex > genpvs_
bool isCharged(const HepMC::GenParticle *)
bool isFinalstateParticle(const HepMC::GenParticle *)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double vertexClusteringDistance_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
VertexHistory const& VertexClassifier::history ( ) const
inline

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

Definition at line 48 of file VertexClassifier.h.

References tracer_.

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

49  {
50  return tracer_;
51  }
VertexHistory tracer_
bool VertexClassifier::isCharged ( const HepMC::GenParticle *  p)
private

Definition at line 444 of file VertexClassifier.cc.

References particleDataTable_.

Referenced by genPrimaryVertices().

445 {
446  const ParticleData * part = particleDataTable_->particle( p->pdg_id() );
447  if (part)
448  return part->charge()!=0;
449  else
450  {
451  // the new/improved particle table doesn't know anti-particles
452  return particleDataTable_->particle( -p->pdg_id() ) != 0;
453  }
454 }
edm::ESHandle< ParticleDataTable > particleDataTable_
HepPDT::ParticleData ParticleData
part
Definition: HCALResponse.h:20
bool VertexClassifier::isFinalstateParticle ( const HepMC::GenParticle *  p)
private

Definition at line 438 of file VertexClassifier.cc.

Referenced by genPrimaryVertices().

439 {
440  return !p->end_vertex() && p->status() == 1;
441 }
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 35 of file VertexClassifier.cc.

References genPrimaryVertices(), edm::EventSetup::getData(), hepMCLabel_, mcInformation_, VertexHistory::newEvent(), particleDataTable_, and tracer_.

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

36 {
37  // Get the new event information for the tracer
39 
40  // Get hepmc of the event
41  event.getByLabel(hepMCLabel_, mcInformation_);
42 
43  // Get the partivle data table
44  setup.getData(particleDataTable_);
45 
46  // Create the list of primary vertices associated to the event
48 }
edm::Handle< edm::HepMCProduct > mcInformation_
VertexHistory tracer_
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
const edm::InputTag hepMCLabel_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::ESHandle< ParticleDataTable > particleDataTable_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void VertexClassifier::processesAtGenerator ( )
private

Get all the information related to decay process.

Definition at line 123 of file VertexClassifier.cc.

References funct::abs(), VertexCategories::BWeakDecay, VertexCategories::CWeakDecay, VertexCategories::flags_, HistoryBase::genVertexTrail(), VertexCategories::JpsiDecay, VertexCategories::KsDecay, VertexCategories::LambdaDecay, VertexCategories::LongLivedDecay, longLivedDecayLength_, VertexCategories::OmegaDecay, parents, particleDataTable_, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, VertexCategories::SigmaMinusDecay, VertexCategories::SigmaPlusDecay, tracer_, update, and VertexCategories::XiDecay.

Referenced by evaluate().

124 {
125  // Get the generated vetices from track history
126  VertexHistory::GenVertexTrail const & genVertexTrail = tracer_.genVertexTrail();
127 
128  // Loop over the generated vertices
129  for (
130  VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin();
131  ivertex != genVertexTrail.end();
132  ++ivertex
133  )
134  {
135  // Get the pointer to the vertex by removing the const-ness (no const methos in HepMC::GenVertex)
136  HepMC::GenVertex * vertex = const_cast<HepMC::GenVertex *>(*ivertex);
137 
138  // Loop over the sources looking for specific decays
139  for (
140  HepMC::GenVertex::particle_iterator iparent = vertex->particles_begin(HepMC::parents);
141  iparent != vertex->particles_end(HepMC::parents);
142  ++iparent
143  )
144  {
145  // Collect the pdgid of the parent
146  int pdgid = std::abs((*iparent)->pdg_id());
147  // Get particle type
148  HepPDT::ParticleID particleID(pdgid);
149 
150  // Check if the particle type is valid one
151  if (particleID.isValid())
152  {
153  // Get particle data
154  ParticleData const * particleData = particleDataTable_->particle(particleID);
155  // Check if the particle exist in the table
156  if (particleData)
157  {
158  // Check if their life time is bigger than longLivedDecayLength_
159  if ( particleData->lifetime() > longLivedDecayLength_ )
160  {
161  // Check for B, C weak decays and long lived decays
162  update(flags_[BWeakDecay], particleID.hasBottom());
163  update(flags_[CWeakDecay], particleID.hasCharm());
164  update(flags_[LongLivedDecay], true);
165  }
166  // Check Tau, Ks and Lambda decay
167  update(flags_[TauDecay], pdgid == 15);
168  update(flags_[KsDecay], pdgid == 310);
169  update(flags_[LambdaDecay], pdgid == 3122);
170  update(flags_[JpsiDecay], pdgid == 443);
171  update(flags_[XiDecay], pdgid == 3312);
172  update(flags_[OmegaDecay], pdgid == 3334);
173  update(flags_[SigmaPlusDecay], pdgid == 3222);
174  update(flags_[SigmaMinusDecay], pdgid == 3112);
175  }
176  }
177  }
178  }
179 }
VertexHistory tracer_
TPRegexp parents
Definition: eve_filter.cc:24
Flags flags_
Flag containers.
double longLivedDecayLength_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
Definition: HistoryBase.h:21
edm::ESHandle< ParticleDataTable > particleDataTable_
HepPDT::ParticleData ParticleData
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
Definition: HistoryBase.h:65
#define update(a, b)
void VertexClassifier::processesAtSimulation ( )
private

Get information about conversion and other interactions.

Definition at line 182 of file VertexClassifier.cc.

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, archive::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_, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, 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().

183 {
184  VertexHistory::SimVertexTrail const & simVertexTrail = tracer_.simVertexTrail();
185 
186  for (
187  VertexHistory::SimVertexTrail::const_iterator ivertex = simVertexTrail.begin();
188  ivertex != simVertexTrail.end();
189  ++ivertex
190  )
191  {
192  // pdgid of the real source parent vertex
193  int pdgid = 0;
194 
195  // select the original source in case of combined vertices
196  bool flag = false;
198 
199  for (its = (*ivertex)->sourceTracks_begin(); its != (*ivertex)->sourceTracks_end(); ++its)
200  {
201  for (itd = (*ivertex)->daughterTracks_begin(); itd != (*ivertex)->daughterTracks_end(); ++itd)
202  if (itd != its)
203  {
204  flag = true;
205  break;
206  }
207  if (flag)
208  break;
209  }
210  // Collect the pdgid of the original source track
211  if ( its != (*ivertex)->sourceTracks_end() )
212  pdgid = std::abs((*its)->pdgId());
213  else
214  pdgid = 0;
215 
216  // Geant4 process type is selected using first Geant4 vertex assigned to
217  // the TrackingVertex
218  unsigned int processG4 = 0;
219 
220  if((*ivertex)->nG4Vertices() > 0) {
221  processG4 = (*(*ivertex)->g4Vertices_begin()).processType();
222  }
223 
224  unsigned int process = g4toCMSProcMap_.processId(processG4);
225 
226  // Flagging all the different processes
227  update(
229  process != CMS::Undefined &&
230  process != CMS::Unknown &&
231  process != CMS::Primary
232  );
233 
238  update(flags_[DecayProcess], process == CMS::Decay);
241  update(flags_[EIoniProcess], process == CMS::EIoni);
242  update(flags_[HIoniProcess], process == CMS::HIoni);
243  update(flags_[MuIoniProcess], process == CMS::MuIoni);
244  update(flags_[PhotonProcess], process == CMS::Photon);
247  update(flags_[EBremProcess], process == CMS::EBrem);
249  update(flags_[MuBremProcess], process == CMS::MuBrem);
250  update(flags_[MuNuclProcess], process == CMS::MuNucl);
251 
252 
253  // Loop over the simulated particles
254  for (
255  TrackingVertex::tp_iterator iparticle = (*ivertex)->daughterTracks_begin();
256  iparticle != (*ivertex)->daughterTracks_end();
257  ++iparticle
258  )
259  {
260 
261  if ( (*iparticle)->numberOfTrackerLayers() )
262  {
263 
264  // Special treatment for decays
265  if (process == CMS::Decay)
266  {
267  // Get particle type
268  HepPDT::ParticleID particleID(pdgid);
269  // Check if the particle type is valid one
270  if (particleID.isValid())
271  {
272  // Get particle data
273  ParticleData const * particleData = particleDataTable_->particle(particleID);
274  // Check if the particle exist in the table
275  if (particleData)
276  {
277  // Check if their life time is bigger than 1e-14
278  if ( particleDataTable_->particle(particleID)->lifetime() > longLivedDecayLength_ )
279  {
280  // Check for B, C weak decays and long lived decays
281  update(flags_[BWeakDecay], particleID.hasBottom());
282  update(flags_[CWeakDecay], particleID.hasCharm());
283  update(flags_[LongLivedDecay], true);
284  }
285  // Check Tau, Ks and Lambda decay
286  update(flags_[TauDecay], pdgid == 15);
287  update(flags_[KsDecay], pdgid == 310);
288  update(flags_[LambdaDecay], pdgid == 3122);
289  update(flags_[JpsiDecay], pdgid == 443);
290  update(flags_[XiDecay], pdgid == 3312);
291  update(flags_[OmegaDecay], pdgid == 3334);
292  update(flags_[SigmaPlusDecay], pdgid == 3222);
293  update(flags_[SigmaMinusDecay], pdgid == 3112);
294  }
295  }
296  }
297  }
298  }
299  }
300 }
VertexHistory tracer_
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
Definition: HistoryBase.h:53
Flags flags_
Flag containers.
double longLivedDecayLength_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESHandle< ParticleDataTable > particleDataTable_
const G4toCMSLegacyProcTypeMap g4toCMSProcMap_
const unsigned int processId(unsigned int g4ProcessId) const
Definition: Utils.cc:59
HepPDT::ParticleData ParticleData
tuple process
Definition: LaserDQM_cfg.py:3
#define update(a, b)
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Definition: HistoryBase.h:30
void VertexClassifier::reconstructionInformation ( reco::TrackBaseRef const &  )
private

Get reconstruction information.

void VertexClassifier::simulationInformation ( )
private

Get all the information related to the simulation details.

Definition at line 114 of file VertexClassifier.cc.

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

Referenced by evaluate().

115 {
116  // Get the event id for the initial TP.
117  EncodedEventId eventId = tracer_.simVertex()->eventId();
118  // Check for signal events
119  flags_[SignalEvent] = !eventId.bunchCrossing() && !eventId.event();
120 }
VertexHistory tracer_
int event() const
get the contents of the subdetector field (should be protected?)
Flags flags_
Flag containers.
int bunchCrossing() const
get the detector field from this detid
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
Definition: HistoryBase.h:83
void VertexClassifier::vertexInformation ( )
private

Get geometrical information about the vertices.

Definition at line 303 of file VertexClassifier.cc.

References HLT_25ns14e33_v1_cff::clusters, HLT_25ns14e33_v1_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().

304 {
305  // Helper class for clusterization
306  typedef std::multimap<double, HepMC::ThreeVector> Clusters;
307  typedef std::pair<double, HepMC::ThreeVector> ClusterPair;
308 
309  Clusters clusters;
310 
311  // Get the main primary vertex from the list
312  GeneratedPrimaryVertex const & genpv = genpvs_.back();
313 
314  // Get the generated history of the tracks
316 
317  // Unit transformation from mm to cm
318  double const mm = 0.1;
319 
320  // Loop over the generated vertexes
321  for (
322  VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin();
323  ivertex != genVertexTrail.end();
324  ++ivertex
325  )
326  {
327  // Check vertex exist
328  if (*ivertex)
329  {
330  // Measure the distance2 respecto the primary vertex
331  HepMC::ThreeVector p = (*ivertex)->point3d();
332  double distance = sqrt( pow(p.x() * mm - genpv.x, 2) + pow(p.y() * mm - genpv.y, 2) + pow(p.z() * mm - genpv.z, 2) );
333 
334  // If there is not any clusters add the first vertex.
335  if ( clusters.empty() )
336  {
337  clusters.insert( ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)) );
338  continue;
339  }
340 
341  // Check if there is already a cluster in the given distance from primary vertex
342  Clusters::const_iterator icluster = clusters.lower_bound(distance - vertexClusteringDistance_);
343 
344  if ( icluster == clusters.upper_bound(distance + vertexClusteringDistance_) )
345  {
346  clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)) );
347  continue;
348  }
349 
350  bool cluster = false;
351 
352  // Looping over the vertex clusters of a given distance from primary vertex
353  for (;
354  icluster != clusters.upper_bound(distance + vertexClusteringDistance_);
355  ++icluster
356  )
357  {
358  double difference = sqrt (
359  pow(p.x() * mm - icluster->second.x(), 2) +
360  pow(p.y() * mm - icluster->second.y(), 2) +
361  pow(p.z() * mm - icluster->second.z(), 2)
362  );
363 
364  if ( difference < vertexClusteringDistance_ )
365  {
366  cluster = true;
367  break;
368  }
369  }
370 
371  if (!cluster) clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)) );
372  }
373  }
374 
376 
377  // Loop over the generated particles
378  for (
379  VertexHistory::SimVertexTrail::reverse_iterator ivertex = simVertexTrail.rbegin();
380  ivertex != simVertexTrail.rend();
381  ++ivertex
382  )
383  {
384  // Look for those with production vertex
385  TrackingVertex::LorentzVector p = (*ivertex)->position();
386 
387  double distance = sqrt( pow(p.x() - genpv.x, 2) + pow(p.y() - genpv.y, 2) + pow(p.z() - genpv.z, 2) );
388 
389  // If there is not any clusters add the first vertex.
390  if ( clusters.empty() )
391  {
392  clusters.insert( ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())) );
393  continue;
394  }
395 
396  // Check if there is already a cluster in the given distance from primary vertex
397  Clusters::const_iterator icluster = clusters.lower_bound(distance - vertexClusteringDistance_);
398 
399  if ( icluster == clusters.upper_bound(distance + vertexClusteringDistance_) )
400  {
401  clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())) );
402  continue;
403  }
404 
405  bool cluster = false;
406 
407  // Looping over the vertex clusters of a given distance from primary vertex
408  for (;
409  icluster != clusters.upper_bound(distance + vertexClusteringDistance_);
410  ++icluster
411  )
412  {
413  double difference = sqrt (
414  pow(p.x() - icluster->second.x(), 2) +
415  pow(p.y() - icluster->second.y(), 2) +
416  pow(p.z() - icluster->second.z(), 2)
417  );
418 
419  if ( difference < vertexClusteringDistance_ )
420  {
421  cluster = true;
422  break;
423  }
424  }
425 
426  if (!cluster) clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())) );
427  }
428 
429  if ( clusters.size() == 1 )
430  flags_[PrimaryVertex] = true;
431  else if ( clusters.size() == 2 )
432  flags_[SecondaryVertex] = true;
433  else
434  flags_[TertiaryVertex] = true;
435 }
VertexHistory tracer_
std::vector< GeneratedPrimaryVertex > genpvs_
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
Definition: HistoryBase.h:53
math::XYZTLorentzVectorD LorentzVector
Flags flags_
Flag containers.
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
Definition: HistoryBase.h:21
double vertexClusteringDistance_
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
Definition: HistoryBase.h:65
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Definition: HistoryBase.h:30
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

const G4toCMSLegacyProcTypeMap VertexClassifier::g4toCMSProcMap_
private

Definition at line 57 of file VertexClassifier.h.

Referenced by processesAtSimulation().

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

Definition at line 104 of file VertexClassifier.h.

Referenced by genPrimaryVertices(), and vertexInformation().

const edm::InputTag VertexClassifier::hepMCLabel_
private

Definition at line 59 of file VertexClassifier.h.

Referenced by newEvent(), and VertexClassifier().

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

Definition at line 64 of file VertexClassifier.h.

Referenced by genPrimaryVertices(), and newEvent().

edm::ESHandle<ParticleDataTable> VertexClassifier::particleDataTable_
private
VertexHistory VertexClassifier::tracer_
private
double VertexClassifier::vertexClusteringDistance_
private

Definition at line 62 of file VertexClassifier.h.

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