6 #include "HepPDT/ParticleID.hh" 10 #define update(a, b) do { (a) = (a) | (b); } while(0) 14 hepMCLabel_( config.getUntrackedParameter<
edm::InputTag>(
"hepMC") ),
15 beamSpotLabel_( config.getUntrackedParameter<
edm::InputTag>(
"beamSpot") ),
16 tracer_(config,
std::
move(collector)),
17 quality_(config, collector)
166 const SimTrack * assocTrack = &(*tpr->g4Track_begin());
196 double dxySim = -v.
x()*
sin(p.phi()) + v.
y()*
cos(p.phi());
199 double dzSim = v.
z() - (v.
x()*p.x() + v.
y()*p.y())*p.z()/p.perp2();
248 for (
unsigned int j = 0; j < layer.
hits.size(); j++)
274 flags_[
Light] = !
pid.hasCharm() && !
pid.hasBottom();
288 for (TrackHistory::RecoGenParticleTrail::const_iterator iparticle = recoGenParticleTrail.begin(); iparticle != recoGenParticleTrail.end(); ++iparticle)
290 pdgid =
std::abs((*iparticle)->pdgId());
295 if (particleID.isValid())
309 std::set<int> daughterIds;
310 size_t ndau = (*iparticle)->numberOfDaughters();
311 for(
size_t i = 0;
i < ndau; ++
i ){
312 daughterIds.insert((*iparticle)->daughter(
i)->pdgId());
342 TrackHistory::SimParticleTrail::const_iterator iparticle = simParticleTrail.begin();
343 iparticle != simParticleTrail.end();
360 for (its = parentVertex->sourceTracks_begin(); its != parentVertex->sourceTracks_end(); ++its)
362 for (itd = parentVertex->daughterTracks_begin(); itd != parentVertex->daughterTracks_end(); ++itd)
373 if ( its != parentVertex->sourceTracks_end() )
379 unsigned int processG4 = 0;
382 if(parentVertex->nG4Vertices() > 0) {
383 processG4 = (*(parentVertex->g4Vertices_begin())).processType();
418 if (particleID.isValid())
437 int daughtId =
abs((*iparticle)->pdgId());
474 double const mm = 0.1;
476 double oldX = genpv.
x;
477 double oldY = genpv.
y;
478 double oldZ = genpv.
z;
482 TrackHistory::GenParticleTrail::const_reverse_iterator iparticle = genParticleTrail.rbegin();
483 iparticle != genParticleTrail.rend();
488 HepMC::GenVertex *
parent = (*iparticle)->production_vertex();
491 HepMC::ThreeVector
p = parent->point3d();
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);
513 TrackHistory::SimParticleTrail::const_reverse_iterator iparticle = simParticleTrail.rbegin();
514 iparticle != simParticleTrail.rend();
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);
538 else if ( counter == 1 )
547 return !p->end_vertex() && p->status() == 1;
555 return part->charge()!=0;
575 for ( HepMC::GenEvent::vertex_const_iterator ivertex =
event->vertices_begin(); ivertex !=
event->vertices_end(); ++ivertex )
577 bool hasParentVertex =
false;
581 HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
585 if ( (*iparent)->production_vertex() )
587 hasParentVertex =
true;
592 if (hasParentVertex)
continue;
595 HepMC::FourVector
pos = (*ivertex)->position();
597 double const mm = 0.1;
601 std::vector<GeneratedPrimaryVertex>::iterator ientry =
genpvs_.begin();
604 for (; ientry !=
genpvs_.end(); ++ientry)
606 double distance2 =
pow(
pv.x - ientry->x, 2) +
pow(
pv.y - ientry->y, 2) +
pow(
pv.z - ientry->z, 2);
616 ientry->genVertex.push_back((*ivertex)->barcode());
620 HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
621 idecendants != (*ivertex)->particles_end(HepMC::descendants);
626 if (
find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) == ientry->finalstateParticles.end() )
628 ientry->finalstateParticles.push_back((*idecendants)->barcode());
629 HepMC::FourVector
m = (*idecendants)->momentum();
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();
637 if ( m.perp() > 0.8 &&
std::abs(m.pseudoRapidity()) < 2.5 &&
isCharged(*idecendants) ) ientry->nGenTrk++;
unsigned int numberOfLayers() const
Return the number of layers with simulated and/or reconstructed hits.
int pdgId() const final
PDG identifier.
double z0() const
z coordinate
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag beamSpotLabel_
const edm::InputTag hepMCLabel_
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
bool isNonnull() const
Checks for non-null.
int event() const
get the contents of the subdetector field (should be protected?)
const FreeTrajectoryState & theState() const
double dxyError() const
error on dxy
const reco::GenParticle * recoGenParticle() const
Returns a pointer to most primitive status 1 or 2 particle in the recoGenParticleTrail_.
const G4toCMSLegacyProcTypeMap g4toCMSProcMap_
const TrackingParticleRef & simParticle() const
Return the initial tracking particle from the history.
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
edm::Handle< edm::HepMCProduct > mcInformation_
const TrackerTopology * tTopo_
def setup(process, global_tag, zero_tesla=False)
unsigned int numberOfInnerLayers_
bool isNonnull() const
Checks for non-null.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int minTrackerSimHits_
std::vector< GeneratedPrimaryVertex > genpvs_
void processesAtSimulation()
Get information about conversion and other interactions.
std::vector< const HepMC::GenParticle * > GenParticleTrail
HepMC::GenParticle trail type.
math::XYZPointD Point
point in the space
bool getData(T &iHolder) const
void simulationInformation()
Get all the information related to the simulation details.
std::vector< const reco::GenParticle * > RecoGenParticleTrail
reco::GenParticle trail type.
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.
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
TrackClassifier(edm::ParameterSet const &, edm::ConsumesCollector &&)
Constructor by ParameterSet.
bool isCharged(const HepMC::GenParticle *)
edm::ESHandle< TransientTrackBuilder > transientTrackBuilder_
void evaluate(SimParticleTrail const &, reco::TrackBaseRef const &, const TrackerTopology *tTopo)
Compute information about the track reconstruction quality.
Auxiliary class holding simulated primary vertices.
int bunchCrossing() const
get the detector field from this detid
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
math::XYZPoint Point
point in the space
void hadronFlavor()
Get hadron flavor of the initial hadron.
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
const unsigned int processId(unsigned int g4ProcessId) const
const Layer & layer(unsigned int index) const
Return information about the given layer by index.
edm::Handle< reco::BeamSpot > beamSpot_
HepPDT::ParticleData ParticleData
GlobalVector momentum() const
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
double dzError() const
error on dz
GlobalPoint position() const
Get track history and classify it in function of their .
const HepMC::GenEvent * GetEvent() const
bool isFinalstateParticle(const HepMC::GenParticle *)
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
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.
void depth(int d)
Set the depth of the history.
edm::ESHandle< MagneticField > magneticField_
const math::XYZTLorentzVectorD & momentum() const
double y0() const
y coordinate
Flags flags_
Flag containers.
int charge() const
track electric charge
const reco::TrackBaseRef & recoTrack() const
Return a reference to the reconstructed track.
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
double longLivedDecayLength_
void reset()
Reset the categories flags.
double vertexClusteringSqDistance_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
RecoGenParticleTrail const & recoGenParticleTrail() const
Return all reco::GenParticle in the history.
edm::ESHandle< ParticleDataTable > particleDataTable_
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)
void genPrimaryVertices()
GenParticleTrail const & genParticleTrail() const
Return all generated particle (HepMC::GenParticle) in the history.
Global3DVector GlobalVector
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.
double x0() const
x coordinate