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
TrackClassifier Class Reference

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

#include <TrackClassifier.h>

Inheritance diagram for TrackClassifier:
TrackCategories TrackClassifierByProxy< Collection >

Classes

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

Public Types

typedef TrackCategories Categories
 Type to the associate category. More...
 
- Public Types inherited from TrackCategories
enum  Category {
  Fake = 0, Reconstructed = Fake, Bad, BadInnerHits,
  SharedInnerHits, SignalEvent, Bottom, Charm,
  Light, Muon, TrackerSimHits, BWeakDecay,
  CWeakDecay, ChargePionDecay, ChargeKaonDecay, 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, FromBWeakDecayMuon, FromCWeakDecayMuon,
  DecayOnFlightMuon, FromChargePionMuon, FromChargeKaonMuon, PrimaryVertex,
  SecondaryVertex, TertiaryVertex, TierciaryVertex = TertiaryVertex, Unknown
}
 Categories available to vertex. More...
 
typedef std::vector< bool > Flags
 Main types associated to the class. More...
 

Public Member Functions

TrackClassifier const & evaluate (reco::TrackBaseRef const &)
 Classify the RecoTrack in categories. More...
 
TrackClassifier const & evaluate (TrackingParticleRef const &)
 Classify the TrackingParticle in categories. More...
 
TrackClassifier const & evaluate (reco::TrackRef const &track)
 Classify the RecoTrack in categories. More...
 
TrackHistory const & history () const
 Returns a reference to the track history used in the classification. More...
 
void newEvent (edm::Event const &, edm::EventSetup const &)
 Pre-process event information (for accessing reconstraction information) More...
 
TrackQuality const & quality () const
 Returns a reference to the track quality used in the classification. More...
 
 TrackClassifier (edm::ParameterSet const &)
 Constructor by ParameterSet. More...
 
- Public Member Functions inherited from TrackCategories
const Flagsflags () const
 Returns flags with the category descriptions. More...
 
bool is (Category category) const
 Returns track flag for a given category. More...
 
 TrackCategories ()
 Void constructor. More...
 

Private Member Functions

void genPrimaryVertices ()
 
void hadronFlavor ()
 Get hadron flavor of the initial hadron. More...
 
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 qualityInformation (reco::TrackBaseRef const &)
 Classify all the tracks by their reconstruction quality. More...
 
void reconstructionInformation (reco::TrackBaseRef const &)
 Classify all the tracks by their association and 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

double badPull_
 
edm::Handle< reco::BeamSpotbeamSpot_
 
const edm::InputTag beamSpotLabel_
 
std::vector
< GeneratedPrimaryVertex
genpvs_
 
const edm::InputTag hepMCLabel_
 
double longLivedDecayLength_
 
edm::ESHandle< MagneticFieldmagneticField_
 
edm::Handle< edm::HepMCProductmcInformation_
 
unsigned int minTrackerSimHits_
 
unsigned int numberOfInnerLayers_
 
edm::ESHandle< ParticleDataTableparticleDataTable_
 
TrackQuality quality_
 
TrackHistory tracer_
 
edm::ESHandle
< TransientTrackBuilder
transientTrackBuilder_
 
double vertexClusteringSqDistance_
 

Additional Inherited Members

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

Detailed Description

Get track history and classify it in function of their .

Definition at line 26 of file TrackClassifier.h.

Member Typedef Documentation

Type to the associate category.

Definition at line 32 of file TrackClassifier.h.

Constructor & Destructor Documentation

TrackClassifier::TrackClassifier ( edm::ParameterSet const &  config)

Constructor by ParameterSet.

Definition at line 12 of file TrackClassifier.cc.

References badPull_, HistoryBase::depth(), edm::ParameterSet::getUntrackedParameter(), longLivedDecayLength_, minTrackerSimHits_, numberOfInnerLayers_, tracer_, and vertexClusteringSqDistance_.

12  : TrackCategories(),
13  hepMCLabel_( config.getUntrackedParameter<edm::InputTag>("hepMC") ),
14  beamSpotLabel_( config.getUntrackedParameter<edm::InputTag>("beamSpot") ),
15  tracer_(config),
17 {
18  // Set the history depth after hadronization
19  tracer_.depth(-2);
20 
21  // Set the maximum d0pull for the bad category
22  badPull_ = config.getUntrackedParameter<double>("badPull");
23 
24  // Set the minimum decay length for detecting long decays
25  longLivedDecayLength_ = config.getUntrackedParameter<double>("longLivedDecayLength");
26 
27  // Set the distance for clustering vertices
28  float vertexClusteringDistance = config.getUntrackedParameter<double>("vertexClusteringDistance");
29  vertexClusteringSqDistance_ = vertexClusteringDistance * vertexClusteringDistance;
30 
31  // Set the number of innermost layers to check for bad hits
32  numberOfInnerLayers_ = config.getUntrackedParameter<unsigned int>("numberOfInnerLayers");
33 
34  // Set the minimum number of simhits in the tracker
35  minTrackerSimHits_ = config.getUntrackedParameter<unsigned int>("minTrackerSimHits");
36 }
const edm::InputTag beamSpotLabel_
const edm::InputTag hepMCLabel_
unsigned int numberOfInnerLayers_
unsigned int minTrackerSimHits_
TrackQuality quality_
TrackCategories()
Void constructor.
void depth(int d)
Set the depth of the history.
Definition: HistoryBase.h:47
double longLivedDecayLength_
double vertexClusteringSqDistance_
TrackHistory tracer_

Member Function Documentation

TrackClassifier const & TrackClassifier::evaluate ( reco::TrackBaseRef const &  track)

Classify the RecoTrack in categories.

Definition at line 67 of file TrackClassifier.cc.

References TrackHistory::evaluate(), TrackCategories::Fake, TrackCategories::flags_, hadronFlavor(), processesAtGenerator(), processesAtSimulation(), qualityInformation(), reconstructionInformation(), TrackCategories::reset(), simulationInformation(), tracer_, TrackCategories::unknownTrack(), and vertexInformation().

Referenced by TrackCategoriesAnalyzer::analyze(), TrackingParticleCategoriesAnalyzer::analyze(), TrackHistoryAnalyzer::analyze(), TrackClassifierByProxy< Collection >::evaluate(), evaluate(), QualityCutsAnalyzer::LoopOverJetTracksAssociation(), and JetVetoedTracksAssociationDRVertex::produce().

68 {
69  // Initializing the category vector
70  reset();
71 
72  // Associate and evaluate the track history (check for fakes)
73  if ( tracer_.evaluate(track) )
74  {
75  // Classify all the tracks by their association and reconstruction information
77 
78  // Get all the information related to the simulation details
80 
81  // Analyse the track reconstruction quality
82  qualityInformation(track);
83 
84  // Get hadron flavor of the initial hadron
85  hadronFlavor();
86 
87  // Get all the information related to decay process
89 
90  // Get information about conversion and other interactions
92 
93  // Get geometrical information about the vertices
95 
96  // Check for unkown classification
97  unknownTrack();
98  }
99  else
100  flags_[Fake] = true;
101 
102  return *this;
103 }
void processesAtSimulation()
Get information about conversion and other interactions.
void simulationInformation()
Get all the information related to the simulation details.
void qualityInformation(reco::TrackBaseRef const &)
Classify all the tracks by their reconstruction quality.
void reconstructionInformation(reco::TrackBaseRef const &)
Classify all the tracks by their association and reconstruction information.
void hadronFlavor()
Get hadron flavor of the initial hadron.
void vertexInformation()
Get geometrical information about the vertices.
void processesAtGenerator()
Get all the information related to decay process.
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:39
Flags flags_
Flag containers.
void reset()
Reset the categories flags.
TrackHistory tracer_
TrackClassifier const & TrackClassifier::evaluate ( TrackingParticleRef const &  track)

Classify the TrackingParticle in categories.

Definition at line 106 of file TrackClassifier.cc.

References TrackHistory::evaluate(), TrackCategories::flags_, hadronFlavor(), edm::RefToBase< T >::isNonnull(), processesAtGenerator(), processesAtSimulation(), qualityInformation(), TrackCategories::Reconstructed, reconstructionInformation(), Reconstruction_cff::recotrack, TrackHistory::recoTrack(), TrackCategories::reset(), simulationInformation(), tracer_, TrackCategories::unknownTrack(), and vertexInformation().

107 {
108  // Initializing the category vector
109  reset();
110 
111  // Trace the history for the given TP
112  tracer_.evaluate(track);
113 
114  // Collect the associated reco track
116 
117  // If there is a reco truck then evaluate the simulated history
118  if ( recotrack.isNonnull() )
119  {
120  flags_[Reconstructed] = true;
121  // Classify all the tracks by their association and reconstruction information
122  reconstructionInformation(recotrack);
123  // Analyse the track reconstruction quality
124  qualityInformation(recotrack);
125  }
126  else
127  flags_[Reconstructed] = false;
128 
129  // Get all the information related to the simulation details
131 
132  // Get hadron flavor of the initial hadron
133  hadronFlavor();
134 
135  // Get all the information related to decay process
137 
138  // Get information about conversion and other interactions
140 
141  // Get geometrical information about the vertices
143 
144  // Check for unkown classification
145  unknownTrack();
146 
147  return *this;
148 }
void processesAtSimulation()
Get information about conversion and other interactions.
void simulationInformation()
Get all the information related to the simulation details.
void qualityInformation(reco::TrackBaseRef const &)
Classify all the tracks by their reconstruction quality.
void reconstructionInformation(reco::TrackBaseRef const &)
Classify all the tracks by their association and reconstruction information.
void hadronFlavor()
Get hadron flavor of the initial hadron.
void vertexInformation()
Get geometrical information about the vertices.
void processesAtGenerator()
Get all the information related to decay process.
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: TrackHistory.h:39
Flags flags_
Flag containers.
const reco::TrackBaseRef & recoTrack() const
Return a reference to the reconstructed track.
Definition: TrackHistory.h:60
void reset()
Reset the categories flags.
bool isNonnull() const
Checks for non-null.
Definition: RefToBase.h:279
TrackHistory tracer_
TrackClassifier const& TrackClassifier::evaluate ( reco::TrackRef const &  track)
inline

Classify the RecoTrack in categories.

Definition at line 47 of file TrackClassifier.h.

References evaluate().

48  {
49  return evaluate( reco::TrackBaseRef(track) );
50  }
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
void TrackClassifier::genPrimaryVertices ( )
private

Definition at line 564 of file TrackClassifier.cc.

References abs, event(), spr::find(), genpvs_, isCharged(), isFinalstateParticle(), m, mcInformation_, parents, pos, funct::pow(), python.multivaluedict::sort(), and vertexClusteringSqDistance_.

Referenced by newEvent().

565 {
566  genpvs_.clear();
567 
568  const HepMC::GenEvent * event = mcInformation_->GetEvent();
569 
570  if (event)
571  {
572  int idx = 0;
573 
574  // Loop over the different GenVertex
575  for ( HepMC::GenEvent::vertex_const_iterator ivertex = event->vertices_begin(); ivertex != event->vertices_end(); ++ivertex )
576  {
577  bool hasParentVertex = false;
578 
579  // Loop over the parents looking to see if they are coming from a production vertex
580  for (
581  HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(HepMC::parents);
582  iparent != (*ivertex)->particles_end(HepMC::parents);
583  ++iparent
584  )
585  if ( (*iparent)->production_vertex() )
586  {
587  hasParentVertex = true;
588  break;
589  }
590 
591  // Reject those vertices with parent vertices
592  if (hasParentVertex) continue;
593 
594  // Get the position of the vertex
595  HepMC::FourVector pos = (*ivertex)->position();
596 
597  double const mm = 0.1;
598 
599  GeneratedPrimaryVertex pv(pos.x()*mm, pos.y()*mm, pos.z()*mm);
600 
601  std::vector<GeneratedPrimaryVertex>::iterator ientry = genpvs_.begin();
602 
603  // Search for a VERY close vertex in the list
604  for (; ientry != genpvs_.end(); ++ientry)
605  {
606  double distance2 = pow(pv.x - ientry->x, 2) + pow(pv.y - ientry->y, 2) + pow(pv.z - ientry->z, 2);
607  if ( distance2 < vertexClusteringSqDistance_ )
608  break;
609  }
610 
611  // Check if there is not a VERY close vertex and added to the list
612  if (ientry == genpvs_.end())
613  ientry = genpvs_.insert(ientry,pv);
614 
615  // Add the vertex barcodes to the new or existent vertices
616  ientry->genVertex.push_back((*ivertex)->barcode());
617 
618  // Collect final state descendants
619  for (
620  HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
621  idecendants != (*ivertex)->particles_end(HepMC::descendants);
622  ++idecendants
623  )
624  {
625  if (isFinalstateParticle(*idecendants))
626  if ( find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) == ientry->finalstateParticles.end() )
627  {
628  ientry->finalstateParticles.push_back((*idecendants)->barcode());
629  HepMC::FourVector m = (*idecendants)->momentum();
630 
631  ientry->ptot.setPx(ientry->ptot.px() + m.px());
632  ientry->ptot.setPy(ientry->ptot.py() + m.py());
633  ientry->ptot.setPz(ientry->ptot.pz() + m.pz());
634  ientry->ptot.setE(ientry->ptot.e() + m.e());
635  ientry->ptsq += m.perp() * m.perp();
636 
637  if ( m.perp() > 0.8 && std::abs(m.pseudoRapidity()) < 2.5 && isCharged(*idecendants) ) ientry->nGenTrk++;
638  }
639  }
640  idx++;
641  }
642  }
643 
644  std::sort(genpvs_.begin(), genpvs_.end());
645 }
TPRegexp parents
Definition: eve_filter.cc:24
edm::Handle< edm::HepMCProduct > mcInformation_
#define abs(x)
Definition: mlp_lapack.h:159
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< GeneratedPrimaryVertex > genpvs_
bool isCharged(const HepMC::GenParticle *)
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
bool isFinalstateParticle(const HepMC::GenParticle *)
double vertexClusteringSqDistance_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void TrackClassifier::hadronFlavor ( )
private

Get hadron flavor of the initial hadron.

Definition at line 254 of file TrackClassifier.cc.

References TrackCategories::Bottom, TrackCategories::Charm, TrackCategories::flags_, configurableAnalysis::GenParticle, HistoryBase::genParticle(), TrackCategories::Light, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, evf::utils::pid, and tracer_.

Referenced by evaluate().

255 {
256  // Get the initial hadron
257  const HepMC::GenParticle * particle = tracer_.genParticle();
258 
259  // Check for the initial hadron
260  if (particle)
261  {
262  HepPDT::ParticleID pid(particle->pdg_id());
263  flags_[Bottom] = pid.hasBottom();
264  flags_[Charm] = pid.hasCharm();
265  flags_[Light] = !pid.hasCharm() && !pid.hasBottom();
266  }
267 }
Flags flags_
Flag containers.
TrackHistory tracer_
const HepMC::GenParticle * genParticle() const
Returns a pointer to most primitive status 1 or 2 particle.
Definition: HistoryBase.h:89
TrackHistory const& TrackClassifier::history ( ) const
inline

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

Definition at line 53 of file TrackClassifier.h.

References tracer_.

Referenced by TrackHistoryAnalyzer::analyze().

54  {
55  return tracer_;
56  }
TrackHistory tracer_
bool TrackClassifier::isCharged ( const HepMC::GenParticle *  p)
private

Definition at line 551 of file TrackClassifier.cc.

References particleDataTable_.

Referenced by genPrimaryVertices().

552 {
553  const ParticleData * part = particleDataTable_->particle( p->pdg_id() );
554  if (part)
555  return part->charge()!=0;
556  else
557  {
558  // the new/improved particle table doesn't know anti-particles
559  return particleDataTable_->particle( -p->pdg_id() ) != 0;
560  }
561 }
HepPDT::ParticleData ParticleData
part
Definition: HCALResponse.h:21
edm::ESHandle< ParticleDataTable > particleDataTable_
bool TrackClassifier::isFinalstateParticle ( const HepMC::GenParticle *  p)
private

Definition at line 545 of file TrackClassifier.cc.

Referenced by genPrimaryVertices().

546 {
547  return !p->end_vertex() && p->status() == 1;
548 }
void TrackClassifier::newEvent ( edm::Event const &  event,
edm::EventSetup const &  setup 
)

Pre-process event information (for accessing reconstraction information)

Definition at line 39 of file TrackClassifier.cc.

References beamSpot_, beamSpotLabel_, genPrimaryVertices(), edm::EventSetup::get(), edm::EventSetup::getData(), hepMCLabel_, magneticField_, mcInformation_, TrackHistory::newEvent(), TrackQuality::newEvent(), particleDataTable_, quality_, tracer_, and transientTrackBuilder_.

Referenced by TrackCategoriesAnalyzer::analyze(), TrackingParticleCategoriesAnalyzer::analyze(), TrackHistoryAnalyzer::analyze(), QualityCutsAnalyzer::analyze(), TrackClassifierByProxy< Collection >::newEvent(), and JetVetoedTracksAssociatorAtVertex::produce().

40 {
41  // Get the new event information for the tracer
43 
44  // Get the new event information for the track quality analyser
46 
47  // Get hepmc of the event
48  event.getByLabel(hepMCLabel_, mcInformation_);
49 
50  // Magnetic field
52 
53  // Get the partivle data table
54  setup.getData(particleDataTable_);
55 
56  // get the beam spot
57  event.getByLabel(beamSpotLabel_, beamSpot_);
58 
59  // Transient track builder
60  setup.get<TransientTrackRecord>().get("TransientTrackBuilder", transientTrackBuilder_);
61 
62  // Create the list of primary vertices associated to the event
64 }
const edm::InputTag beamSpotLabel_
const edm::InputTag hepMCLabel_
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
Definition: TrackHistory.cc:32
edm::Handle< edm::HepMCProduct > mcInformation_
edm::ESHandle< TransientTrackBuilder > transientTrackBuilder_
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::Handle< reco::BeamSpot > beamSpot_
TrackQuality quality_
edm::ESHandle< MagneticField > magneticField_
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
edm::ESHandle< ParticleDataTable > particleDataTable_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
TrackHistory tracer_
void TrackClassifier::processesAtGenerator ( )
private

Get all the information related to decay process.

Definition at line 270 of file TrackClassifier.cc.

References abs, TrackCategories::BWeakDecay, TrackCategories::ChargeKaonDecay, TrackCategories::ChargePionDecay, TrackCategories::CWeakDecay, TrackCategories::DecayOnFlightMuon, TrackCategories::flags_, TrackCategories::FromBWeakDecayMuon, TrackCategories::FromChargeKaonMuon, TrackCategories::FromChargePionMuon, TrackCategories::FromCWeakDecayMuon, HistoryBase::genParticleTrail(), TrackCategories::JpsiDecay, TrackCategories::KsDecay, TrackCategories::LambdaDecay, TrackCategories::LongLivedDecay, longLivedDecayLength_, TrackCategories::Muon, particleDataTable_, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, TrackCategories::SigmaMinusDecay, TrackCategories::SigmaPlusDecay, tracer_, update, and TrackCategories::XiDecay.

Referenced by evaluate().

271 {
272  // pdgid of the "in" particle to the production vertex
273  int pdgid = 0;
274 
275  // Get the generated particles from track history
276  TrackHistory::GenParticleTrail const & genParticleTrail = tracer_.genParticleTrail();
277 
278  // Loop over the generated particles
279  for (TrackHistory::GenParticleTrail::const_iterator iparticle = genParticleTrail.begin(); iparticle != genParticleTrail.end(); ++iparticle)
280  {
281  // Get the source vertex for the particle
282  HepMC::GenVertex * productionVertex = (*iparticle)->production_vertex();
283 
284  // Get the pointer to the vertex by removing the const-ness (no const methos in HepMC::GenVertex)
285  // HepMC::GenVertex * vertex = const_cast<HepMC::GenVertex *>(*ivertex);
286 
287  // Check for a non-null pointer to the production vertex
288  if (productionVertex)
289  {
290  // Only case track history will navegate (one in or source particle per vertex)
291  if ( productionVertex->particles_in_size() == 1 )
292  {
293  // Look at the pdgid of the first "in" particle to the vertex
294  pdgid = std::abs((*productionVertex->particles_in_const_begin())->pdg_id());
295  // Get particle type
296  HepPDT::ParticleID particleID(pdgid);
297 
298  // Check if the particle type is valid one
299  if (particleID.isValid())
300  {
301  // Get particle data
302  ParticleData const * particleData = particleDataTable_->particle(particleID);
303  // Check if the particle exist in the table
304  if (particleData)
305  {
306  // Check if their life time is bigger than longLivedDecayLength_
307  if ( particleData->lifetime() > longLivedDecayLength_ )
308  update(flags_[LongLivedDecay], true);
309  // Check for B and C weak decays
310  update(flags_[BWeakDecay], particleID.hasBottom());
311  update(flags_[CWeakDecay], particleID.hasCharm());
312  // Check for B and C pure leptonic decay
313  int daughterId = abs((*iparticle)->pdg_id());
314  update(flags_[FromBWeakDecayMuon], particleID.hasBottom() && daughterId == 13);
315  update(flags_[FromCWeakDecayMuon], particleID.hasCharm() && daughterId == 13);
316  }
317  // Check Tau, Ks and Lambda decay
318  update(flags_[ChargePionDecay], pdgid == 211);
319  update(flags_[ChargeKaonDecay], pdgid == 321);
320  update(flags_[TauDecay], pdgid == 15);
321  update(flags_[KsDecay], pdgid == 310);
322  update(flags_[LambdaDecay], pdgid == 3122);
323  update(flags_[JpsiDecay], pdgid == 443);
324  update(flags_[XiDecay], pdgid == 3312);
325  update(flags_[SigmaPlusDecay], pdgid == 3222);
326  update(flags_[SigmaMinusDecay], pdgid == 3112);
327  }
328  }
329  }
330  }
331  // Decays in flight
335 }
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< const HepMC::GenParticle * > GenParticleTrail
GenParticle trail type.
Definition: HistoryBase.h:18
HepPDT::ParticleData ParticleData
#define update(a, b)
Flags flags_
Flag containers.
double longLivedDecayLength_
edm::ESHandle< ParticleDataTable > particleDataTable_
GenParticleTrail const & genParticleTrail() const
Return all generated particle in the history.
Definition: HistoryBase.h:71
TrackHistory tracer_
void TrackClassifier::processesAtSimulation ( )
private

Get information about conversion and other interactions.

Definition at line 338 of file TrackClassifier.cc.

References abs, TrackClassifier::G4::Annihilation, TrackCategories::AnnihilationProcess, TrackCategories::BWeakDecay, TrackCategories::ChargeKaonDecay, TrackCategories::ChargePionDecay, TrackClassifier::G4::Compton, TrackCategories::ComptonProcess, TrackClassifier::G4::Conversions, TrackCategories::ConversionsProcess, TrackCategories::CWeakDecay, TrackClassifier::G4::Decay, TrackCategories::DecayOnFlightMuon, TrackCategories::DecayProcess, TrackClassifier::G4::EBrem, TrackCategories::EBremProcess, TrackClassifier::G4::EIoni, TrackCategories::EIoniProcess, TrackCategories::flags_, TrackCategories::FromBWeakDecayMuon, TrackCategories::FromChargeKaonMuon, TrackCategories::FromChargePionMuon, TrackCategories::FromCWeakDecayMuon, TrackClassifier::G4::Hadronic, TrackCategories::HadronicProcess, TrackClassifier::G4::HIoni, TrackCategories::HIoniProcess, edm::Ref< C, T, F >::isNonnull(), TrackCategories::JpsiDecay, TrackCategories::KnownProcess, TrackCategories::KsDecay, TrackCategories::LambdaDecay, TrackCategories::LongLivedDecay, longLivedDecayLength_, TrackClassifier::G4::MuBrem, TrackCategories::MuBremProcess, TrackClassifier::G4::MuIoni, TrackCategories::MuIoniProcess, TrackClassifier::G4::MuNucl, TrackCategories::MuNuclProcess, TrackCategories::Muon, TrackClassifier::G4::MuPairProd, TrackCategories::MuPairProdProcess, TrackCategories::OmegaDecay, particleDataTable_, RecoTau_DiTaus_pt_20-420_cfg::ParticleID, TrackClassifier::G4::Photon, TrackCategories::PhotonProcess, TrackClassifier::G4::Primary, TrackCategories::PrimaryProcess, LaserDQM_cfg::process, TrackCategories::SigmaMinusDecay, TrackCategories::SigmaPlusDecay, HistoryBase::simParticleTrail(), TrackClassifier::G4::SynchrotronRadiation, TrackCategories::SynchrotronRadiationProcess, tracer_, TrackClassifier::G4::Undefined, TrackCategories::UndefinedProcess, TrackClassifier::G4::Unknown, TrackCategories::UnknownProcess, update, and TrackCategories::XiDecay.

Referenced by evaluate().

339 {
340  TrackHistory::SimParticleTrail const & simParticleTrail = tracer_.simParticleTrail();
341 
342  // Loop over the simulated particles
343  for (
344  TrackHistory::SimParticleTrail::const_iterator iparticle = simParticleTrail.begin();
345  iparticle != simParticleTrail.end();
346  ++iparticle
347  )
348  {
349  // pdgid of the real source parent vertex
350  int pdgid = 0;
351 
352  // Get a reference to the TP's parent vertex
353  TrackingVertexRef const & parentVertex = (*iparticle)->parentVertex();
354 
355  // Look for the original source track
356  if ( parentVertex.isNonnull() )
357  {
358  // select the original source in case of combined vertices
359  bool flag = false;
361 
362  for (its = parentVertex->sourceTracks_begin(); its != parentVertex->sourceTracks_end(); ++its)
363  {
364  for (itd = parentVertex->daughterTracks_begin(); itd != parentVertex->daughterTracks_end(); ++itd)
365  if (itd != its)
366  {
367  flag = true;
368  break;
369  }
370  if (flag)
371  break;
372  }
373 
374  // Collect the pdgid of the original source track
375  if ( its != parentVertex->sourceTracks_end() )
376  pdgid = std::abs((*its)->pdgId());
377  else
378  pdgid = 0;
379  }
380 
381  // Check for the number of psimhit if different from zero
382  if ((*iparticle)->trackPSimHit().empty()) continue;
383 
384  // Collect the G4 process of the first psimhit (it should be the same for all of them)
385  unsigned short process = (*iparticle)->pSimHit_begin()->processType();
386 
387  // Flagging all the different processes
388 
389  update(
391  process != G4::Undefined &&
392  process != G4::Unknown &&
393  process != G4::Primary
394  );
395 
397  update(flags_[UnknownProcess], process == G4::Unknown);
398  update(flags_[PrimaryProcess], process == G4::Primary);
400  update(flags_[DecayProcess], process == G4::Decay);
401  update(flags_[ComptonProcess], process == G4::Compton);
403  update(flags_[EIoniProcess], process == G4::EIoni);
404  update(flags_[HIoniProcess], process == G4::HIoni);
405  update(flags_[MuIoniProcess], process == G4::MuIoni);
406  update(flags_[PhotonProcess], process == G4::Photon);
409  update(flags_[EBremProcess], process == G4::EBrem);
411  update(flags_[MuBremProcess], process == G4::MuBrem);
412  update(flags_[MuNuclProcess], process == G4::MuNucl);
413 
414  // Get particle type
415  HepPDT::ParticleID particleID(pdgid);
416 
417  // Check if the particle type is valid one
418  if (particleID.isValid())
419  {
420  // Get particle data
421  ParticleData const * particleData = particleDataTable_->particle(particleID);
422  // Special treatment for decays
423  if (process == G4::Decay)
424  {
425  // Check if the particle exist in the table
426  if (particleData)
427  {
428  // Check if their life time is bigger than 1e-14
429  if ( particleDataTable_->particle(particleID)->lifetime() > longLivedDecayLength_ )
430  update(flags_[LongLivedDecay], true);
431 
432  // Check for B and C weak decays
433  update(flags_[BWeakDecay], particleID.hasBottom());
434  update(flags_[CWeakDecay], particleID.hasCharm());
435 
436  // Check for B or C pure leptonic decays
437  int daughtId = abs((*iparticle)->pdgId());
438  update(flags_[FromBWeakDecayMuon], particleID.hasBottom() && daughtId == 13);
439  update(flags_[FromCWeakDecayMuon], particleID.hasCharm() && daughtId == 13);
440  }
441  // Check decays
442  update(flags_[ChargePionDecay], pdgid == 211);
443  update(flags_[ChargeKaonDecay], pdgid == 321);
444  update(flags_[TauDecay], pdgid == 15);
445  update(flags_[KsDecay], pdgid == 310);
446  update(flags_[LambdaDecay], pdgid == 3122);
447  update(flags_[JpsiDecay], pdgid == 443);
448  update(flags_[XiDecay], pdgid == 3312);
449  update(flags_[OmegaDecay], pdgid == 3334);
450  update(flags_[SigmaPlusDecay], pdgid == 3222);
451  update(flags_[SigmaMinusDecay], pdgid == 3112);
452  }
453  }
454  }
455  // Decays in flight
459 }
long int flag
Definition: mlp_lapack.h:47
#define abs(x)
Definition: mlp_lapack.h:159
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
HepPDT::ParticleData ParticleData
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
Definition: HistoryBase.h:59
#define update(a, b)
Flags flags_
Flag containers.
double longLivedDecayLength_
tuple process
Definition: LaserDQM_cfg.py:3
edm::ESHandle< ParticleDataTable > particleDataTable_
TrackHistory tracer_
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.
Definition: HistoryBase.h:27
TrackQuality const& TrackClassifier::quality ( void  ) const
inline

Returns a reference to the track quality used in the classification.

Definition at line 59 of file TrackClassifier.h.

References quality_.

60  {
61  return quality_;
62  }
TrackQuality quality_
void TrackClassifier::qualityInformation ( reco::TrackBaseRef const &  track)
private

Classify all the tracks by their reconstruction quality.

Definition at line 226 of file TrackClassifier.cc.

References TrackCategories::BadInnerHits, TrackQuality::evaluate(), TrackCategories::flags_, TrackQuality::Layer::hits, i, j, TrackQuality::layer(), min, TrackQuality::Layer::Misassoc, TrackQuality::Layer::Noise, numberOfInnerLayers_, TrackQuality::numberOfLayers(), quality_, TrackQuality::Layer::Shared, TrackCategories::SharedInnerHits, HistoryBase::simParticleTrail(), TrackQuality::Layer::Hit::state, and tracer_.

Referenced by evaluate().

227 {
228  // run the hit-by-hit reconstruction quality analysis
230 
231  unsigned int maxLayers = std::min(numberOfInnerLayers_, quality_.numberOfLayers());
232 
233  // check the innermost layers for bad hits
234  for (unsigned int i = 0; i < maxLayers; i++)
235  {
236  const TrackQuality::Layer &layer = quality_.layer(i);
237 
238  // check all hits in that layer
239  for (unsigned int j = 0; j < layer.hits.size(); j++)
240  {
241  const TrackQuality::Layer::Hit &hit = layer.hits[j];
242 
243  // In those cases the bad hit was used by track reconstruction
244  if (hit.state == TrackQuality::Layer::Noise ||
246  flags_[BadInnerHits] = true;
247  else if (hit.state == TrackQuality::Layer::Shared)
248  flags_[SharedInnerHits] = true;
249  }
250  }
251 }
unsigned int numberOfLayers() const
Return the number of layers with simulated and/or reconstructed hits.
Definition: TrackQuality.h:79
int i
Definition: DBlmapReader.cc:9
void evaluate(SimParticleTrail const &, reco::TrackBaseRef const &)
Compute information about the track reconstruction quality.
unsigned int numberOfInnerLayers_
#define min(a, b)
Definition: mlp_lapack.h:161
int j
Definition: DBlmapReader.cc:9
const Layer & layer(unsigned int index) const
Return information about the given layer by index.
Definition: TrackQuality.h:85
TrackQuality quality_
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
Definition: HistoryBase.h:59
std::vector< Hit > hits
Definition: TrackQuality.h:61
Flags flags_
Flag containers.
TrackHistory tracer_
void TrackClassifier::reconstructionInformation ( reco::TrackBaseRef const &  track)
private

Classify all the tracks by their association and reconstruction information.

Definition at line 151 of file TrackClassifier.cc.

References abs, TrackCategories::Bad, badPull_, beamSpot_, reco::TrackBase::charge(), funct::cos(), reco::TrackBase::dxy(), reco::TrackBase::dxyError(), reco::TrackBase::dz(), reco::TrackBase::dzError(), cppFunctionSkipper::exception, TrackCategories::flags_, magneticField_, CoreSimTrack::momentum(), FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), edm::ESHandle< class >::product(), HistoryBase::simParticle(), funct::sin(), TrajectoryStateClosestToPoint::theState(), tracer_, v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by evaluate().

152 {
154 
155  // Compute tracking particle parameters at point of closest approach to the beamline
156 
157  const SimTrack * assocTrack = &(*tpr->g4Track_begin());
158 
159  FreeTrajectoryState ftsAtProduction(
160  GlobalPoint(
161  tpr->vertex().x(),
162  tpr->vertex().y(),
163  tpr->vertex().z()
164  ),
165  GlobalVector(
166  assocTrack->momentum().x(),
167  assocTrack->momentum().y(),
168  assocTrack->momentum().z()
169  ),
170  TrackCharge(track->charge()),
172  );
173 
174  try
175  {
176  TSCPBuilderNoMaterial tscpBuilder;
177  TrajectoryStateClosestToPoint tsAtClosestApproach = tscpBuilder(
178  ftsAtProduction,
179  GlobalPoint(beamSpot_->x0(), beamSpot_->y0(), beamSpot_->z0())
180  );
181 
182  GlobalVector v = tsAtClosestApproach.theState().position()
183  - GlobalPoint(beamSpot_->x0(), beamSpot_->y0(), beamSpot_->z0());
184  GlobalVector p = tsAtClosestApproach.theState().momentum();
185 
186  // Simulated dxy
187  double dxySim = -v.x()*sin(p.phi()) + v.y()*cos(p.phi());
188 
189  // Simulated dz
190  double dzSim = v.z() - (v.x()*p.x() + v.y()*p.y())*p.z()/p.perp2();
191 
192  // Calculate the dxy pull
193  double dxyPull = std::abs(
194  track->dxy( reco::TrackBase::Point(beamSpot_->x0(), beamSpot_->y0(), beamSpot_->z0()) ) - dxySim
195  ) / track->dxyError();
196 
197  // Calculate the dx pull
198  double dzPull = std::abs(
199  track->dz( reco::TrackBase::Point(beamSpot_->x0(), beamSpot_->y0(), beamSpot_->z0()) ) - dzSim
200  ) / track->dzError();
201 
202  // Return true if d0Pull > badD0Pull sigmas
203  flags_[Bad] = (dxyPull > badPull_ || dzPull > badPull_);
204 
205  }
206  catch (cms::Exception exception)
207  {
208  flags_[Bad] = true;
209  }
210 }
const FreeTrajectoryState & theState() const
const TrackingParticleRef & simParticle() const
Return the initial tracking particle from the history.
Definition: HistoryBase.h:77
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
int TrackCharge
Definition: TrackCharge.h:4
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZPoint Point
point in the space
Definition: TrackBase.h:76
edm::Handle< reco::BeamSpot > beamSpot_
GlobalVector momentum() const
GlobalPoint position() const
T const * product() const
Definition: ESHandle.h:62
edm::ESHandle< MagneticField > magneticField_
const math::XYZTLorentzVectorD & momentum() const
particle info...
Definition: CoreSimTrack.h:36
Flags flags_
Flag containers.
T x() const
Definition: PV3DBase.h:61
mathSSE::Vec4< T > v
TrackHistory tracer_
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void TrackClassifier::simulationInformation ( )
private

Get all the information related to the simulation details.

Definition at line 213 of file TrackClassifier.cc.

References abs, EncodedEventId::bunchCrossing(), EncodedEventId::event(), TrackCategories::flags_, minTrackerSimHits_, TrackCategories::Muon, TrackCategories::SignalEvent, HistoryBase::simParticle(), tracer_, and TrackCategories::TrackerSimHits.

Referenced by evaluate().

214 {
215  // Get the event id for the initial TP.
216  EncodedEventId eventId = tracer_.simParticle()->eventId();
217  // Check for signal events
218  flags_[SignalEvent] = !eventId.bunchCrossing() && !eventId.event();
219  // Check for muons
220  flags_[Muon] = (abs(tracer_.simParticle()->pdgId()) == 13);
221  // Check for the number of psimhit in tracker
222  flags_[TrackerSimHits] = tracer_.simParticle()->matchedHit() >= (int)minTrackerSimHits_;
223 }
int event() const
get the contents of the subdetector field (should be protected?)
const TrackingParticleRef & simParticle() const
Return the initial tracking particle from the history.
Definition: HistoryBase.h:77
#define abs(x)
Definition: mlp_lapack.h:159
unsigned int minTrackerSimHits_
int bunchCrossing() const
get the detector field from this detid
Flags flags_
Flag containers.
TrackHistory tracer_
void TrackClassifier::vertexInformation ( )
private

Get geometrical information about the vertices.

Definition at line 462 of file TrackClassifier.cc.

References TrackCategories::flags_, HistoryBase::genParticleTrail(), genpvs_, AlCaHLTBitMon_ParallelJobs::p, dbtoconf::parent, funct::pow(), TrackCategories::PrimaryVertex, TrackCategories::SecondaryVertex, HistoryBase::simParticleTrail(), TrackCategories::TertiaryVertex, tracer_, vertexClusteringSqDistance_, TrackClassifier::GeneratedPrimaryVertex::x, TrackClassifier::GeneratedPrimaryVertex::y, and TrackClassifier::GeneratedPrimaryVertex::z.

Referenced by evaluate().

463 {
464  // Get the main primary vertex from the list
465  GeneratedPrimaryVertex const & genpv = genpvs_.back();
466 
467  // Get the generated history of the tracks
469 
470  // Vertex counter
471  int counter = 0;
472 
473  // Unit transformation from mm to cm
474  double const mm = 0.1;
475 
476  double oldX = genpv.x;
477  double oldY = genpv.y;
478  double oldZ = genpv.z;
479 
480  // Loop over the generated particles
481  for (
482  TrackHistory::GenParticleTrail::reverse_iterator iparticle = genParticleTrail.rbegin();
483  iparticle != genParticleTrail.rend();
484  ++iparticle
485  )
486  {
487  // Look for those with production vertex
488  HepMC::GenVertex * parent = (*iparticle)->production_vertex();
489  if (parent)
490  {
491  HepMC::ThreeVector p = parent->point3d();
492 
493  double distance2 = pow(p.x() * mm - genpv.x, 2) + pow(p.y() * mm - genpv.y, 2) + pow(p.z() * mm - genpv.z, 2);
494  double difference2 = pow(p.x() * mm - oldX, 2) + pow(p.y() * mm - oldY, 2) + pow(p.z() * mm - oldZ, 2);
495 
496  // std::cout << "Distance2 : " << distance2 << " (" << p.x() * mm << "," << p.y() * mm << "," << p.z() * mm << ")" << std::endl;
497  // std::cout << "Difference2 : " << difference2 << std::endl;
498 
499  if ( difference2 > vertexClusteringSqDistance_ )
500  {
501  if ( distance2 > vertexClusteringSqDistance_ ) counter++;
502  oldX = p.x() * mm;
503  oldY = p.y() * mm;
504  oldZ = p.z() * mm;
505  }
506  }
507  }
508 
510 
511  // Loop over the generated particles
512  for (
513  TrackHistory::SimParticleTrail::reverse_iterator iparticle = simParticleTrail.rbegin();
514  iparticle != simParticleTrail.rend();
515  ++iparticle
516  )
517  {
518  // Look for those with production vertex
519  TrackingParticle::Point p = (*iparticle)->vertex();
520 
521  double distance2 = pow(p.x() - genpv.x, 2) + pow(p.y() - genpv.y, 2) + pow(p.z() - genpv.z, 2);
522  double difference2 = pow(p.x() - oldX, 2) + pow(p.y() - oldY, 2) + pow(p.z() - oldZ, 2);
523 
524  // std::cout << "Distance2 : " << distance2 << " (" << p.x() << "," << p.y() << "," << p.z() << ")" << std::endl;
525  // std::cout << "Difference2 : " << difference2 << std::endl;
526 
527  if ( difference2 > vertexClusteringSqDistance_ )
528  {
529  if ( distance2 > vertexClusteringSqDistance_ ) counter++;
530  oldX = p.x();
531  oldY = p.y();
532  oldZ = p.z();
533  }
534  }
535 
536  if ( !counter )
537  flags_[PrimaryVertex] = true;
538  else if ( counter == 1 )
539  flags_[SecondaryVertex] = true;
540  else
541  flags_[TertiaryVertex] = true;
542 }
list parent
Definition: dbtoconf.py:74
std::vector< GeneratedPrimaryVertex > genpvs_
std::vector< const HepMC::GenParticle * > GenParticleTrail
GenParticle trail type.
Definition: HistoryBase.h:18
math::XYZPointD Point
point in the space
Definition: ParticleBase.h:28
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
Definition: HistoryBase.h:59
Flags flags_
Flag containers.
double vertexClusteringSqDistance_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
GenParticleTrail const & genParticleTrail() const
Return all generated particle in the history.
Definition: HistoryBase.h:71
TrackHistory tracer_
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.
Definition: HistoryBase.h:27

Member Data Documentation

double TrackClassifier::badPull_
private

Definition at line 69 of file TrackClassifier.h.

Referenced by reconstructionInformation(), and TrackClassifier().

edm::Handle<reco::BeamSpot> TrackClassifier::beamSpot_
private

Definition at line 111 of file TrackClassifier.h.

Referenced by newEvent(), and reconstructionInformation().

const edm::InputTag TrackClassifier::beamSpotLabel_
private

Definition at line 67 of file TrackClassifier.h.

Referenced by newEvent().

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

Definition at line 156 of file TrackClassifier.h.

Referenced by genPrimaryVertices(), and vertexInformation().

const edm::InputTag TrackClassifier::hepMCLabel_
private

Definition at line 66 of file TrackClassifier.h.

Referenced by newEvent().

double TrackClassifier::longLivedDecayLength_
private

Definition at line 70 of file TrackClassifier.h.

Referenced by processesAtGenerator(), processesAtSimulation(), and TrackClassifier().

edm::ESHandle<MagneticField> TrackClassifier::magneticField_
private

Definition at line 103 of file TrackClassifier.h.

Referenced by newEvent(), and reconstructionInformation().

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

Definition at line 105 of file TrackClassifier.h.

Referenced by genPrimaryVertices(), and newEvent().

unsigned int TrackClassifier::minTrackerSimHits_
private

Definition at line 73 of file TrackClassifier.h.

Referenced by simulationInformation(), and TrackClassifier().

unsigned int TrackClassifier::numberOfInnerLayers_
private

Definition at line 72 of file TrackClassifier.h.

Referenced by qualityInformation(), and TrackClassifier().

edm::ESHandle<ParticleDataTable> TrackClassifier::particleDataTable_
private
TrackQuality TrackClassifier::quality_
private

Definition at line 101 of file TrackClassifier.h.

Referenced by newEvent(), quality(), and qualityInformation().

TrackHistory TrackClassifier::tracer_
private
edm::ESHandle<TransientTrackBuilder> TrackClassifier::transientTrackBuilder_
private

Definition at line 109 of file TrackClassifier.h.

Referenced by newEvent().

double TrackClassifier::vertexClusteringSqDistance_
private

Definition at line 71 of file TrackClassifier.h.

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