5 using EVENT::MCParticle;
6 using EVENT::ReconstructedParticle;
7 using IMPL::VertexImpl;
8 using IMPL::ReconstructedParticleImpl;
9 using EVENT::LCCollection;
10 using UTIL::LCRelationNavigator;
11 namespace TTbarAnalysis
19 if (!chain || chain->
GetSize() == 0)
24 vector< Vertex * > * result =
new vector< Vertex * >();
25 const double * ip = chain->
Get(0)->getVertex();
26 for (
int i = 1; i < chain->
GetSize(); i++)
30 for (
unsigned int i = 0; i < result->size(); i++)
42 const double * initial;
43 initial = particle->getVertex();
45 result->setPrimary(
false);
46 result->setAlgorithmType(
"VertexMCOperator");
48 result->setPosition(initial[0], initial[1], initial[2]);
49 result->addParameter (distance);
50 result->addParameter (pdg);
51 result->addParameter (number);
57 if (!vertex || particles.size() == 0)
59 streamlog_out(DEBUG) <<
"ERRORMC: argument is null!\n";
62 ReconstructedParticle * reco = vertex->getAssociatedParticle();
63 for (
unsigned int i = 0; i < particles.size(); i++)
65 ReconstructedParticle * prong =(usingRelation)?
getReco(particles[i]) :
translate(particles[i]);
68 reco->addParticle(prong);
72 streamlog_out(DEBUG) <<
"ERROR: Corrupted vertex!\n";
83 if (!vertex || !particle)
85 streamlog_out(DEBUG) <<
"ERRORMC: argument is null!\n";
88 ReconstructedParticle * reco =
translate(particle);
89 VertexImpl * ivertex =
static_cast<VertexImpl*
>(vertex);
90 ivertex->setAssociatedParticle(reco);
95 int nvtx = navigator.getRelatedFromObjects(particle).size();
96 streamlog_out(DEBUG) <<
"Particles: " << nvtx <<
'\n';
97 ReconstructedParticle * reco = NULL;
100 const vector< float > weights = navigator.getRelatedFromWeights(particle);
103 for (
int i = 0; i < nvtx; i++)
105 if (weights[i] > weight)
111 reco =
dynamic_cast<ReconstructedParticle*
>(navigator.getRelatedFromObjects(particle)[winner]);
118 ReconstructedParticleImpl * reco =
new ReconstructedParticleImpl();
119 reco->setType(particle->getPDG());
120 reco->setMass(particle->getMass());
121 reco->setCharge(particle->getCharge());
122 reco->setMomentum(particle->getMomentum());
123 reco->setEnergy(particle->getEnergy());
VertexMCOperator(EVENT::LCCollection *rel)
EVENT::ReconstructedParticle * translate(EVENT::MCParticle *particle)
void addParticle(EVENT::Vertex *vertex, EVENT::MCParticle *particle)
EVENT::LCCollection * myRelCollection
void __SetMCParticles(const std::vector< EVENT::MCParticle * > particles)
EVENT::Vertex * construct(EVENT::MCParticle *particle, const double *ip, int pdg, int number)
std::vector< EVENT::Vertex * > * Construct(DecayChain *chain)
static float getDistance(const double *start, const double *end)
EVENT::ReconstructedParticle * getReco(EVENT::MCParticle *particle)
EVENT::MCParticle * Get(int i)
void AddProngs(EVENT::Vertex *vertex, std::vector< EVENT::MCParticle * > &particles, bool usingRelation=false)