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  G4
 
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)
 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

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 * 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 16 of file VertexClassifier.h.

Member Typedef Documentation

Type to the associate category.

Definition at line 22 of file VertexClassifier.h.

Constructor & Destructor Documentation

VertexClassifier::VertexClassifier ( edm::ParameterSet const &  pset)

Constructor by ParameterSet.

Definition at line 17 of file VertexClassifier.cc.

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

18  hepMCLabel_( config.getUntrackedParameter<edm::InputTag>("hepMC") )
19 {
20  // Set the history depth after hadronization
21  tracer_.depth(-2);
22 
23  // Set the minimum decay length for detecting long decays
24  longLivedDecayLength_ = config.getUntrackedParameter<double>("longLivedDecayLength");
25 
26  // Set the distance for clustering vertices
27  vertexClusteringDistance_ = config.getUntrackedParameter<double>("vertexClusteringDistance");
28 }
VertexHistory tracer_
const edm::InputTag hepMCLabel_
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 27 of file VertexClassifier.h.

27 {}

Member Function Documentation

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

Classify the RecoVertex in categories.

Definition at line 47 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().

48 {
49  // Initializing the category vector
50  reset();
51 
52  // Associate and evaluate the vertex history (check for fakes)
53  if ( tracer_.evaluate(vertex) )
54  {
55  // Get all the information related to the simulation details
57 
58  // Get all the information related to decay process
60 
61  // Get information about conversion and other interactions
63 
64  // Get geometrical information about the vertices
66 
67  // Check for unkown classification
68  unknownVertex();
69  }
70  else
71  flags_[Fake] = true;
72 
73  return *this;
74 }
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:40
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 77 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().

78 {
79  // Initializing the category vector
80  reset();
81 
82  // Trace the history for the given TP
83  tracer_.evaluate(vertex);
84 
85  // Check for a reconstructed track
86  if ( tracer_.recoVertex().isNonnull() )
87  flags_[Reconstructed] = true;
88  else
89  flags_[Reconstructed] = false;
90 
91  // Get all the information related to the simulation details
93 
94  // Get all the information related to decay process
96 
97  // Get information about conversion and other interactions
99 
100  // Get geometrical information about the vertices
102 
103  // Check for unkown classification
104  unknownVertex();
105 
106  return *this;
107 }
VertexHistory tracer_
void vertexInformation()
Get geometrical information about the vertices.
void reset()
Reset the categories flags.
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
Definition: VertexHistory.h:62
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Definition: VertexHistory.h:40
Flags flags_
Flag containers.
void processesAtGenerator()
Get all the information related to decay process.
void processesAtSimulation()
Get information about conversion and other interactions.
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:279
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 39 of file VertexClassifier.h.

References evaluate().

40  {
41  return evaluate( reco::VertexBaseRef(vertex) );
42  }
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
void VertexClassifier::genPrimaryVertices ( )
private

Definition at line 449 of file VertexClassifier.cc.

References funct::abs(), event(), spr::find(), genpvs_, customizeTrackingMonitorSeedNumber::idx, isCharged(), isFinalstateParticle(), m, mcInformation_, parents, funct::pow(), python.multivaluedict::sort(), mathSSE::sqrt(), and vertexClusteringDistance_.

Referenced by newEvent().

450 {
451  genpvs_.clear();
452 
453  const HepMC::GenEvent * event = mcInformation_->GetEvent();
454 
455  if (event)
456  {
457  int idx = 0;
458 
459  // Loop over the different GenVertex
460  for ( HepMC::GenEvent::vertex_const_iterator ivertex = event->vertices_begin(); ivertex != event->vertices_end(); ++ivertex )
461  {
462  bool hasParentVertex = false;
463 
464  // Loop over the parents looking to see if they are coming from a production vertex
465  for (
466  HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(HepMC::parents);
467  iparent != (*ivertex)->particles_end(HepMC::parents);
468  ++iparent
469  )
470  if ( (*iparent)->production_vertex() )
471  {
472  hasParentVertex = true;
473  break;
474  }
475 
476  // Reject those vertices with parent vertices
477  if (hasParentVertex) continue;
478 
479  // Get the position of the vertex
480  HepMC::FourVector pos = (*ivertex)->position();
481 
482  double const mm = 0.1;
483 
484  GeneratedPrimaryVertex pv(pos.x()*mm, pos.y()*mm, pos.z()*mm);
485 
486  std::vector<GeneratedPrimaryVertex>::iterator ientry = genpvs_.begin();
487 
488  // Search for a VERY close vertex in the list
489  for (; ientry != genpvs_.end(); ++ientry)
490  {
491  double distance = sqrt( pow(pv.x - ientry->x, 2) + pow(pv.y - ientry->y, 2) + pow(pv.z - ientry->z, 2) );
492  if ( distance < vertexClusteringDistance_ )
493  break;
494  }
495 
496  // Check if there is not a VERY close vertex and added to the list
497  if (ientry == genpvs_.end())
498  ientry = genpvs_.insert(ientry,pv);
499 
500  // Add the vertex barcodes to the new or existent vertices
501  ientry->genVertex.push_back((*ivertex)->barcode());
502 
503  // Collect final state descendants
504  for (
505  HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
506  idecendants != (*ivertex)->particles_end(HepMC::descendants);
507  ++idecendants
508  )
509  {
510  if (isFinalstateParticle(*idecendants))
511  if ( find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) == ientry->finalstateParticles.end() )
512  {
513  ientry->finalstateParticles.push_back((*idecendants)->barcode());
514  HepMC::FourVector m = (*idecendants)->momentum();
515 
516  ientry->ptot.setPx(ientry->ptot.px() + m.px());
517  ientry->ptot.setPy(ientry->ptot.py() + m.py());
518  ientry->ptot.setPz(ientry->ptot.pz() + m.pz());
519  ientry->ptot.setE(ientry->ptot.e() + m.e());
520  ientry->ptsq += m.perp() * m.perp();
521 
522  if ( m.perp() > 0.8 && std::abs(m.pseudoRapidity()) < 2.5 && isCharged(*idecendants) ) ientry->nGenTrk++;
523  }
524  }
525  idx++;
526  }
527  }
528 
529  std::sort(genpvs_.begin(), genpvs_.end());
530 }
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 45 of file VertexClassifier.h.

References tracer_.

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

46  {
47  return tracer_;
48  }
VertexHistory tracer_
bool VertexClassifier::isCharged ( const HepMC::GenParticle *  p)
private

Definition at line 436 of file VertexClassifier.cc.

References particleDataTable_.

Referenced by genPrimaryVertices().

437 {
438  const ParticleData * part = particleDataTable_->particle( p->pdg_id() );
439  if (part)
440  return part->charge()!=0;
441  else
442  {
443  // the new/improved particle table doesn't know anti-particles
444  return particleDataTable_->particle( -p->pdg_id() ) != 0;
445  }
446 }
edm::ESHandle< ParticleDataTable > particleDataTable_
HepPDT::ParticleData ParticleData
part
Definition: HCALResponse.h:20
bool VertexClassifier::isFinalstateParticle ( const HepMC::GenParticle *  p)
private

Definition at line 430 of file VertexClassifier.cc.

Referenced by genPrimaryVertices().

431 {
432  return !p->end_vertex() && p->status() == 1;
433 }
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 31 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().

32 {
33  // Get the new event information for the tracer
35 
36  // Get hepmc of the event
37  event.getByLabel(hepMCLabel_, mcInformation_);
38 
39  // Get the partivle data table
40  setup.getData(particleDataTable_);
41 
42  // Create the list of primary vertices associated to the event
44 }
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 119 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().

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

References funct::abs(), VertexClassifier::G4::Annihilation, VertexCategories::AnnihilationProcess, VertexCategories::BWeakDecay, VertexClassifier::G4::Compton, VertexCategories::ComptonProcess, VertexClassifier::G4::Conversions, VertexCategories::ConversionsProcess, VertexCategories::CWeakDecay, VertexClassifier::G4::Decay, VertexCategories::DecayProcess, VertexClassifier::G4::EBrem, VertexCategories::EBremProcess, VertexClassifier::G4::EIoni, VertexCategories::EIoniProcess, VertexCategories::flags_, VertexClassifier::G4::Hadronic, VertexCategories::HadronicProcess, VertexClassifier::G4::HIoni, VertexCategories::HIoniProcess, VertexCategories::JpsiDecay, VertexCategories::KnownProcess, VertexCategories::KsDecay, VertexCategories::LambdaDecay, VertexCategories::LongLivedDecay, longLivedDecayLength_, VertexClassifier::G4::MuBrem, VertexCategories::MuBremProcess, VertexClassifier::G4::MuIoni, VertexCategories::MuIoniProcess, VertexClassifier::G4::MuNucl, VertexCategories::MuNuclProcess, VertexClassifier::G4::MuPairProd, VertexCategories::MuPairProdProcess, VertexCategories::OmegaDecay, particleDataTable_, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, VertexClassifier::G4::Photon, VertexCategories::PhotonProcess, VertexClassifier::G4::Primary, VertexCategories::PrimaryProcess, LaserDQM_cfg::process, VertexCategories::SigmaMinusDecay, VertexCategories::SigmaPlusDecay, HistoryBase::simVertexTrail(), VertexClassifier::G4::SynchrotronRadiation, VertexCategories::SynchrotronRadiationProcess, tracer_, VertexClassifier::G4::Undefined, VertexCategories::UndefinedProcess, VertexClassifier::G4::Unknown, VertexCategories::UnknownProcess, update, and VertexCategories::XiDecay.

Referenced by evaluate().

179 {
180  VertexHistory::SimVertexTrail const & simVertexTrail = tracer_.simVertexTrail();
181 
182  for (
183  VertexHistory::SimVertexTrail::const_iterator ivertex = simVertexTrail.begin();
184  ivertex != simVertexTrail.end();
185  ++ivertex
186  )
187  {
188  // pdgid of the real source parent vertex
189  int pdgid = 0;
190 
191  // select the original source in case of combined vertices
192  bool flag = false;
194 
195  for (its = (*ivertex)->sourceTracks_begin(); its != (*ivertex)->sourceTracks_end(); ++its)
196  {
197  for (itd = (*ivertex)->daughterTracks_begin(); itd != (*ivertex)->daughterTracks_end(); ++itd)
198  if (itd != its)
199  {
200  flag = true;
201  break;
202  }
203  if (flag)
204  break;
205  }
206  // Collect the pdgid of the original source track
207  if ( its != (*ivertex)->sourceTracks_end() )
208  pdgid = std::abs((*its)->pdgId());
209  else
210  pdgid = 0;
211 
212  // Geant4 process type is selected using first Geant4 vertex assigned to
213  // the TrackingVertex
214  unsigned short process = 0;
215  if((*ivertex)->nG4Vertices() > 0) {
216  process = (*(*ivertex)->g4Vertices_begin()).processType();
217  }
218  // Flagging all the different processes
219  update(
221  process != G4::Undefined &&
222  process != G4::Unknown &&
223  process != G4::Primary
224  );
225 
227  update(flags_[UnknownProcess], process == G4::Unknown);
228  update(flags_[PrimaryProcess], process == G4::Primary);
230  update(flags_[DecayProcess], process == G4::Decay);
231  update(flags_[ComptonProcess], process == G4::Compton);
233  update(flags_[EIoniProcess], process == G4::EIoni);
234  update(flags_[HIoniProcess], process == G4::HIoni);
235  update(flags_[MuIoniProcess], process == G4::MuIoni);
236  update(flags_[PhotonProcess], process == G4::Photon);
239  update(flags_[EBremProcess], process == G4::EBrem);
241  update(flags_[MuBremProcess], process == G4::MuBrem);
242  update(flags_[MuNuclProcess], process == G4::MuNucl);
243 
244 
245  // Loop over the simulated particles
246  for (
247  TrackingVertex::tp_iterator iparticle = (*ivertex)->daughterTracks_begin();
248  iparticle != (*ivertex)->daughterTracks_end();
249  ++iparticle
250  )
251  {
252 
253  if ( (*iparticle)->numberOfTrackerLayers() )
254  {
255 
256  // Special treatment for decays
257  if (process == G4::Decay)
258  {
259  // Get particle type
260  HepPDT::ParticleID particleID(pdgid);
261  // Check if the particle type is valid one
262  if (particleID.isValid())
263  {
264  // Get particle data
265  ParticleData const * particleData = particleDataTable_->particle(particleID);
266  // Check if the particle exist in the table
267  if (particleData)
268  {
269  // Check if their life time is bigger than 1e-14
270  if ( particleDataTable_->particle(particleID)->lifetime() > longLivedDecayLength_ )
271  {
272  // Check for B, C weak decays and long lived decays
273  update(flags_[BWeakDecay], particleID.hasBottom());
274  update(flags_[CWeakDecay], particleID.hasCharm());
275  update(flags_[LongLivedDecay], true);
276  }
277  // Check Tau, Ks and Lambda decay
278  update(flags_[TauDecay], pdgid == 15);
279  update(flags_[KsDecay], pdgid == 310);
280  update(flags_[LambdaDecay], pdgid == 3122);
281  update(flags_[JpsiDecay], pdgid == 443);
282  update(flags_[XiDecay], pdgid == 3312);
283  update(flags_[OmegaDecay], pdgid == 3334);
284  update(flags_[SigmaPlusDecay], pdgid == 3222);
285  update(flags_[SigmaMinusDecay], pdgid == 3112);
286  }
287  }
288  }
289  }
290  }
291  }
292 }
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_
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 110 of file VertexClassifier.cc.

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

Referenced by evaluate().

111 {
112  // Get the event id for the initial TP.
113  EncodedEventId eventId = tracer_.simVertex()->eventId();
114  // Check for signal events
115  flags_[SignalEvent] = !eventId.bunchCrossing() && !eventId.event();
116 }
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 295 of file VertexClassifier.cc.

References 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().

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

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

Definition at line 123 of file VertexClassifier.h.

Referenced by genPrimaryVertices(), and vertexInformation().

const edm::InputTag VertexClassifier::hepMCLabel_
private

Definition at line 54 of file VertexClassifier.h.

Referenced by newEvent().

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

Definition at line 83 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 57 of file VertexClassifier.h.

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