StatusCode Analyse::execute() { // always check if the units are converted properly !! const ParticleMCAssociationCollection* associations = m_partassociationhandle.get(); info()<<" START ANALYSIS"<<endmsg; for(const auto& assoc : *associations) { const MCParticleHandle mcpart = assoc.read().Sim; const ParticleHandle part = assoc.read().Rec; const BareParticle& mccore = mcpart.read().Core; const BareParticle& core = part.read().Core; if( core.P4.Px-mccore.P4.Px < 0.00001 && core.P4.Py-mccore.P4.Py < 0.00001 && core.P4.Pz-mccore.P4.Pz < 0.00001 ) { info()<<"PARTICLES SIM AND REC ARE IDENTICAL !!!!"<<endmsg; info()<<"\t"<<core.P4.Px<<"\t"<<core.P4.Py<<"\t"<<core.P4.Pz<<"\t"<<endmsg; } else { info()<<"CHANGE IN MOMENTUM !!!!"<<endmsg; info()<<"original:\t"<<core.P4.Px<<"\t"<<core.P4.Py<<"\t"<<core.P4.Pz<<"\t"<<endmsg; info()<<"now :\t"<<mccore.P4.Px<<"\t"<<mccore.P4.Py<<"\t"<<mccore.P4.Pz<<"\t"<<endmsg; } } info()<<" END ANALYSIS"<<endmsg; return StatusCode::SUCCESS; }
void DelphesSimulation::ConvertHT( TObjArray * Input , ParticleCollection * coll ){ Candidate * cand; for(int j = 0; j < Input->GetEntries(); ++j) { cand = static_cast<Candidate *>(Input->At(j)); ParticleHandle outptc = coll->create(); BareParticle& core = outptc.mod().Core; core.P4.Px = (double ) cand->Momentum.X(); core.P4.Py = (double ) cand->Momentum.Y(); } }
StatusCode DummySimulation::execute() { const MCParticleCollection* inparticles = m_genphandle.get(); ParticleCollection* particles = new ParticleCollection(); for(auto ipart=inparticles->begin(); ipart!=inparticles->end(); ++ipart) { const MCParticle ptc = (*ipart).read(); if(ptc.Core.Status==1) { ParticleHandle outptc = particles->create(); outptc.mod().Core = ptc.Core; } } m_recphandle.put(particles); return StatusCode::SUCCESS; }
void DelphesSimulation::ConvertParticle( TObjArray * Input , ParticleCollection * coll ){ Candidate * cand; for(int j = 0; j < Input->GetEntries(); ++j) { cand = static_cast<Candidate *>(Input->At(j)); ParticleHandle outptc = coll->create(); BareParticle& core = outptc.mod().Core; if (cand->Momentum.Pt()!=0) { // protection against the boring message Warning in <TVector3::PseudoRapidity>: transvers momentum = 0! return +/- 10e10 core.Type = cand->PID; core.Status = cand->Status; core.P4.Px = (double ) cand->Momentum.X(); core.P4.Py = (double ) cand->Momentum.Y(); core.P4.Pz = (double ) cand->Momentum.Z(); core.P4.Mass = (double) cand->Mass ; core.Vertex.X = (double) cand->Position.X() ; core.Vertex.Y = (double) cand->Position.Y() ; core.Vertex.Z = (double) cand->Position.Z() ; } } }
void Explosion::Update(float dt) { this->elapsedLifetime -= dt; if (this->elapsedLifetime < 0.0f) { this->exists = false; std::cout << "КОНЕЦ ВЗРЫВА!\n"; } // Обработка взрыва //float currRadius = ((totalLifetime - elapsedLifetime) / totalLifetime) * this->maxRadius; for (int i = 0; i < owner->GetParticleSystem()->GetParticlesCount(); i++) { ParticleHandle<ParticleInfo> blockParticle = owner->GetParticleSystem()->GetParticle(size_t(i)); Vector3f distance = blockParticle.GetPos() - this->pos; //if (distance.Length() <= currRadius) { //this->force = desc.force; //float force = 1.0f; float a = distance.Length(); float offset = force / (a * a * a); Vector3f resultAcceleration = blockParticle.GetAcceleration() + offset * distance.GetNorm(); blockParticle.SetAcceleration(resultAcceleration); //} } }