9 #include "HepPDT/ParticleID.hh"
14 #define update(a, b) do { (a) = (a) | (b); } while(0)
18 hepMCLabel_( config.getUntrackedParameter<edm::InputTag>(
"hepMC") )
126 VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin();
127 ivertex != genVertexTrail.end();
132 HepMC::GenVertex * vertex =
const_cast<HepMC::GenVertex *
>(*ivertex);
136 HepMC::GenVertex::particle_iterator iparent = vertex->particles_begin(
HepMC::parents);
142 int pdgid =
std::abs((*iparent)->pdg_id());
147 if (particleID.isValid())
183 VertexHistory::SimVertexTrail::const_iterator ivertex = simVertexTrail.begin();
184 ivertex != simVertexTrail.end();
195 for (its = (*ivertex)->sourceTracks_begin(); its != (*ivertex)->sourceTracks_end(); ++its)
197 for (itd = (*ivertex)->daughterTracks_begin(); itd != (*ivertex)->daughterTracks_end(); ++itd)
207 if ( its != (*ivertex)->sourceTracks_end() )
215 if((*ivertex)->nG4Vertices() > 0) {
216 process = (*(*ivertex)->g4Vertices_begin()).processType();
248 iparticle != (*ivertex)->daughterTracks_end();
253 if ( (*iparticle)->numberOfTrackerLayers() )
262 if (particleID.isValid())
298 typedef std::multimap<double, HepMC::ThreeVector> Clusters;
299 typedef std::pair<double, HepMC::ThreeVector> ClusterPair;
310 double const mm = 0.1;
314 VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin();
315 ivertex != genVertexTrail.end();
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) );
327 if ( clusters.empty() )
329 clusters.insert( ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)) );
338 clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)) );
342 bool cluster =
false;
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)
363 if (!cluster) clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)) );
371 VertexHistory::SimVertexTrail::reverse_iterator ivertex = simVertexTrail.rbegin();
372 ivertex != simVertexTrail.rend();
379 double distance =
sqrt(
pow(p.x() - genpv.
x, 2) +
pow(p.y() - genpv.
y, 2) +
pow(p.z() - genpv.
z, 2) );
382 if ( clusters.empty() )
384 clusters.insert( ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())) );
393 clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())) );
397 bool cluster =
false;
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)
418 if (!cluster) clusters.insert ( ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())) );
421 if ( clusters.size() == 1 )
423 else if ( clusters.size() == 2 )
432 return !p->end_vertex() && p->status() == 1;
440 return part->charge()!=0;
460 for ( HepMC::GenEvent::vertex_const_iterator ivertex =
event->vertices_begin(); ivertex !=
event->vertices_end(); ++ivertex )
462 bool hasParentVertex =
false;
466 HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
470 if ( (*iparent)->production_vertex() )
472 hasParentVertex =
true;
477 if (hasParentVertex)
continue;
480 HepMC::FourVector pos = (*ivertex)->position();
482 double const mm = 0.1;
486 std::vector<GeneratedPrimaryVertex>::iterator ientry =
genpvs_.begin();
489 for (; ientry !=
genpvs_.end(); ++ientry)
491 double distance =
sqrt(
pow(
pv.x - ientry->x, 2) +
pow(
pv.y - ientry->y, 2) +
pow(
pv.z - ientry->z, 2) );
501 ientry->genVertex.push_back((*ivertex)->barcode());
505 HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
506 idecendants != (*ivertex)->particles_end(HepMC::descendants);
511 if (
find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) == ientry->finalstateParticles.end() )
513 ientry->finalstateParticles.push_back((*idecendants)->barcode());
514 HepMC::FourVector
m = (*idecendants)->momentum();
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();
522 if ( m.perp() > 0.8 &&
std::abs(m.pseudoRapidity()) < 2.5 &&
isCharged(*idecendants) ) ientry->nGenTrk++;
edm::Handle< edm::HepMCProduct > mcInformation_
T getUntrackedParameter(std::string const &, T const &) const
int event() const
get the contents of the subdetector field (should be protected?)
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
void vertexInformation()
Get geometrical information about the vertices.
std::vector< GeneratedPrimaryVertex > genpvs_
const edm::InputTag hepMCLabel_
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
bool isCharged(const HepMC::GenParticle *)
Get track history and classify it in function of their .
void reset()
Reset the categories flags.
bool isNonnull() const
Checks for non-null.
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
bool isFinalstateParticle(const HepMC::GenParticle *)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void genPrimaryVertices()
void getData(T &iHolder) const
math::XYZTLorentzVectorD LorentzVector
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
VertexClassifier(edm::ParameterSet const &pset)
Constructor by ParameterSet.
Flags flags_
Flag containers.
int bunchCrossing() const
get the detector field from this detid
double longLivedDecayLength_
Abs< T >::type abs(const T &t)
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
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_
HepPDT::ParticleData ParticleData
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
void processesAtGenerator()
Get all the information related to decay process.
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
void depth(int d)
Set the depth of the history.
double vertexClusteringDistance_
virtual void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
void processesAtSimulation()
Get information about conversion and other interactions.
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Auxiliary class holding simulated primary vertices.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)
void simulationInformation()
Get all the information related to the simulation details.