Commit 9903d583 authored by Andrii Verbytskyi's avatar Andrii Verbytskyi Committed by Frank Winklmeier
Browse files

Revert "Reverted the change in AddFlowByShift.cxx and updated CR year"

This reverts commit 84d28a23.
parent a883ebcb
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#include "AthenaKernel/errorcheck.h"
......@@ -54,7 +54,7 @@ StatusCode HepMCTruthReader::execute() {
if (cntr>0) ATH_MSG_INFO("Printing pileup events...");
if (cntr==0) {
HepMC::GenVertex* signalProcessVtx = genEvt->signal_process_vertex();
auto signalProcessVtx = genEvt->signal_process_vertex();
ATH_MSG_INFO("Signal process vertex position: (" << (signalProcessVtx?signalProcessVtx->position().x():0)
<< ", " << (signalProcessVtx?signalProcessVtx->position().y():0)
<< ", " << (signalProcessVtx?signalProcessVtx->position().z():0)
......
......@@ -259,7 +259,7 @@ namespace xAODMaker {
// Check signal process vertex
// If this is a disconnected vertex, add it manually or won't be added from the loop over particles below.
HepMC::GenVertex* disconnectedSignalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
auto disconnectedSignalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
if (disconnectedSignalProcessVtx) {
if (disconnectedSignalProcessVtx->particles_in_size() == 0 &&
disconnectedSignalProcessVtx->particles_out_size() == 0 ) {
......@@ -295,7 +295,7 @@ namespace xAODMaker {
}
}
// (d) Particle's production vertex
HepMC::GenVertex* productionVertex = (*pitr)->production_vertex();
auto productionVertex = (*pitr)->production_vertex();
if (productionVertex) {
VertexParticles& parts = vertexMap[productionVertex];
if (parts.incoming.empty() && parts.outgoing.empty())
......@@ -307,7 +307,7 @@ namespace xAODMaker {
// else maybe want to keep track that this is the production vertex
//
// (e) Particle's decay vertex
HepMC::GenVertex* decayVertex = (*pitr)->end_vertex();
auto decayVertex = (*pitr)->end_vertex();
if (decayVertex) {
VertexParticles& parts = vertexMap[decayVertex];
if (parts.incoming.empty() && parts.outgoing.empty())
......@@ -319,8 +319,8 @@ namespace xAODMaker {
} // end of loop over particles
// (3) Loop over the map
HepMC::GenVertex* signalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
for (const HepMC::GenVertex* vertex : vertices) {
auto signalProcessVtx = genEvt->signal_process_vertex(); // Get the signal process vertex
for (auto vertex : vertices) {
const auto& parts = vertexMap[vertex];
// (a) create TruthVertex
xAOD::TruthVertex* xTruthVertex = new xAOD::TruthVertex();
......
......@@ -210,7 +210,7 @@ StatusCode BeamHaloGeneratorAlg::callGenerator() {
for (hepmc_part_itr = m_evt.particles_begin();
hepmc_part_itr != m_evt.particles_end();
hepmc_part_itr++) {
HepMC::GenVertex* prodVertex = (*hepmc_part_itr)->production_vertex();
auto prodVertex = (*hepmc_part_itr)->production_vertex();
if(!prodVertex) continue;
// Store the values for use in the if conditions that follow
......
......@@ -237,7 +237,7 @@ StatusCode EvtInclusiveDecay::execute() {
int loopCounter(0);
while( !eventPassesCuts && loopCounter < m_maxNRepeatedDecays ) {
for (std::set<int>::iterator itb = toBeDecayed.begin(); itb!=toBeDecayed.end(); ++itb) {
HepMC::GenParticle* p = hepMC->barcode_to_particle(*itb);
auto p = hepMC->barcode_to_particle(*itb);
if (p==0) {
msg(MSG::ERROR ) << "Overlapping decay tree encountered for barcode " << *itb << endmsg;
return StatusCode::FAILURE;
......@@ -334,7 +334,7 @@ StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticle* p,
// decay, even if it has several mothers.
}
}
HepMC::GenVertex* v = p->end_vertex();
auto v = p->end_vertex();
if (v) {
if (visited.insert(v).second) {
if ( isToBeRemoved && (v->particles_in_size()>1) && m_checkDecayTree ) {
......@@ -366,7 +366,7 @@ StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticle* p,
// Remove an existing decay tree
//
void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticle* p) {
HepMC::GenVertex* v = p->end_vertex();
auto v = p->end_vertex();
if (v) {
std::set<int> vtxBarCodesToDelete;
vtxBarCodesToDelete.insert(v->barcode());
......@@ -375,7 +375,7 @@ void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPartic
++itv)
vtxBarCodesToDelete.insert((*itv)->barcode());
for (std::set<int>::iterator itb = vtxBarCodesToDelete.begin(); itb != vtxBarCodesToDelete.end(); ++itb) {
HepMC::GenVertex* vdel = hepMC->barcode_to_vertex(*itb);
auto vdel = hepMC->barcode_to_vertex(*itb);
hepMC->remove_vertex(vdel);
delete vdel;
}
......@@ -446,7 +446,7 @@ void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPar
double y=(evtPart->getDaug(0)->get4Pos()).get(2)+treeStart.get(2);
double z=(evtPart->getDaug(0)->get4Pos()).get(3)+treeStart.get(3);
HepMC::GenVertex* end_vtx = new HepMC::GenVertex(CLHEP::HepLorentzVector(x,y,z,ct));
HepMC::GenVertex* end_vtx = new HepMC::GenVertex(HepMC::FourVector(x,y,z,ct));
hepMC->add_vertex(end_vtx);
end_vtx->add_particle_in(part);
......@@ -459,7 +459,7 @@ void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPar
int id=EvtPDL::getStdHep(evtPart->getDaug(it)->getId());
int status=1;
if(evtPart->getDaug(it)->getNDaug() != 0) status=m_decayedStatus;
HepMC::GenParticle* daughter = new HepMC::GenParticle(CLHEP::HepLorentzVector(px,py,pz,e),id,status);
HepMC::GenParticle* daughter = new HepMC::GenParticle(HepMC::FourVector(px,py,pz,e),id,status);
end_vtx->add_particle_out(daughter);
addEvtGenDecayTree(hepMC, daughter, evtPart->getDaug(it), treeStart, momentumScaleFactor);
}
......@@ -478,7 +478,7 @@ bool EvtInclusiveDecay::isToBeDecayed(const HepMC::GenParticle* p, bool doCrossC
int id = p->pdg_id();
int stat = p->status();
int nDaughters = 0;
HepMC::GenVertex* v = p->end_vertex();
auto v = p->end_vertex();
if (v) nDaughters = v->particles_out_size();
// Ignore documentation lines
......@@ -578,8 +578,8 @@ bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) {
muons->push_back(p);
}
for (std::vector<HepMC::GenParticle*>::iterator muItr1 = muons->begin(); muItr1 != muons->end(); ++muItr1) {
for (std::vector<HepMC::GenParticle*>::iterator muItr2 = muItr1+1; muItr2 != muons->end(); ++muItr2) {
for (auto muItr1 = muons->begin(); muItr1 != muons->end(); ++muItr1) {
for (auto muItr2 = muItr1+1; muItr2 != muons->end(); ++muItr2) {
if( m_userSelRequireOppositeSignedMu && (*muItr1)->pdg_id() * (*muItr2)->pdg_id() > 0)
continue;
if( !( (*muItr1)->momentum().perp() > m_userSelMu1MinPt && fabs((*muItr1)->momentum().pseudoRapidity()) < m_userSelMu1MaxEta &&
......@@ -646,7 +646,7 @@ unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticle* p,
unsigned int nParticlesVisited = 1;
for (int i=0; i<level; i++) std::cout << " ";
std::cout << pdgName(p,m_printHepMCHighlighted,barcodeList);
HepMC::GenVertex* v = p->end_vertex();
auto v = p->end_vertex();
if (v) {
if (v->particles_in_size() > 1)
std::cout << " [interaction: " << v->particles_in_size() << " particles, barcode " << v->barcode() << "] --> ";
......
......@@ -244,7 +244,7 @@ StatusCode AddFlowByShifting::execute() {
//std::cout << std::endl;
HepMC::GenVertex* mainvtx =(*itr)->barcode_to_vertex(-1);
auto mainvtx =(*itr)->barcode_to_vertex(-1);
if(m_flow_fluctuations) Set_EbE_Fluctuation_Multipliers(mainvtx,hijing_pars->get_b());
int particles_in_event = (*itr)->particles_size();
......@@ -332,7 +332,7 @@ double AddFlowByShifting::SetParentToRanPhi(HepMC::GenParticle* parent)
phishift = ranphi - phi;
momentum.setPhi(ranphi*Gaudi::Units::rad);
parent->set_momentum( momentum );
parent->set_momentum( HepMC::FourVector(momentum.px(),momentum.py(),momentum.pz(),momentum.e()) );
ATH_MSG_INFO("Parent phi randomized = " << momentum.phi());
......@@ -348,7 +348,7 @@ void AddFlowByShifting::MoveDescendantsToParent
{
// Move the branch of descendant vertices and particles
// by phishift to parent particle position
HepMC::GenVertex *endvtx = parent->end_vertex();
auto endvtx = parent->end_vertex();
if ( endvtx ) {
ATH_MSG_DEBUG("Processing branch of parent particle "<< parent->barcode());
......@@ -357,7 +357,7 @@ void AddFlowByShifting::MoveDescendantsToParent
descvtxit = endvtx->vertices_begin(HepMC::descendants);
descvtxit != endvtx->vertices_end(HepMC::descendants);
++descvtxit) {
HepMC::GenVertex *descvtx = (*descvtxit);
auto descvtx = (*descvtxit);
ATH_MSG_DEBUG("Processing vertex " << descvtx->barcode());
// rotate vertex
......@@ -375,7 +375,7 @@ void AddFlowByShifting::MoveDescendantsToParent
= descvtx->particles_begin(HepMC::children);
descpartit != descvtx->particles_end(HepMC::children);
++descpartit ) {
HepMC::GenParticle* descpart = (*descpartit);
auto descpart = (*descpartit);
CLHEP::HepLorentzVector momentum(descpart->momentum().px(),
descpart->momentum().py(),
descpart->momentum().pz(),
......
......@@ -270,7 +270,6 @@ StatusCode PDFReweightTool::execute() {
//StatusCode PDFReweightTool::Reweight(const HepMC::GenEvent* evt_orig) {
StatusCode PDFReweightTool::Reweight(HepMC::GenEvent* evt) {
msg(MSG::DEBUG) << " Reweight PDF " << endmsg;
......@@ -283,7 +282,7 @@ StatusCode PDFReweightTool::Reweight(HepMC::GenEvent* evt) {
return StatusCode::SUCCESS;
}
HepMC::PdfInfo* pdf_info = evt->pdf_info();
auto pdf_info = evt->pdf_info();
//safety check
if (pdf_info) {
......
......@@ -106,7 +106,7 @@ void GenEventCnv_p1::persToTrans( const GenEvent_p1* persObj,
for ( ParticlesMap_t::iterator p = partToEndVtx.begin();
p != endItr;
++p ) {
HepMC::GenVertex* decayVtx = transObj->barcode_to_vertex( p->second );
auto decayVtx = transObj->barcode_to_vertex( p->second );
if ( decayVtx ) {
decayVtx->add_particle_in( p->first );
} else {
......
......@@ -144,7 +144,7 @@ void McEventCollectionCnv_p2::persToTrans( const McEventCollection_p2* persObj,
for ( ParticlesMap_t::iterator p = partToEndVtx.begin();
p != endItr;
++p ) {
HepMC::GenVertex* decayVtx = genEvt->barcode_to_vertex( p->second );
auto decayVtx = genEvt->barcode_to_vertex( p->second );
if ( decayVtx ) {
decayVtx->add_particle_in( p->first );
} else {
......
......@@ -149,7 +149,7 @@ void McEventCollectionCnv_p3::persToTrans( const McEventCollection_p3* persObj,
endItr = partToEndVtx.end();
p != endItr;
++p ) {
HepMC::GenVertex* decayVtx = genEvt->barcode_to_vertex( p->second );
auto decayVtx = genEvt->barcode_to_vertex( p->second );
if ( decayVtx ) {
decayVtx->add_particle_in( p->first );
} else {
......
......@@ -190,7 +190,7 @@ void McEventCollectionCnv_p4::persToTrans( const McEventCollection_p4* persObj,
p != endItr;
++p )
{
HepMC::GenVertex* decayVtx = genEvt->barcode_to_vertex( p->second );
auto decayVtx = genEvt->barcode_to_vertex( p->second );
if ( decayVtx )
{
decayVtx->add_particle_in( p->first );
......
......@@ -222,7 +222,7 @@ void McEventCollectionCnv_p5::persToTrans( const McEventCollection_p5* persObj,
endItr = partToEndVtx.end();
p != endItr;
++p ) {
HepMC::GenVertex* decayVtx = genEvt->barcode_to_vertex( p->second );
auto decayVtx = genEvt->barcode_to_vertex( p->second );
if ( decayVtx ) {
decayVtx->add_particle_in( p->first );
} else {
......
......@@ -340,7 +340,7 @@ void HforTool::findHFQuarks() {
ATH_MSG_DEBUG(" b/c parton with a b/c quark/hadron parent") ;
// find the decay vertex and children
HepMC::GenVertex * decayvtx = bcpart->end_vertex() ;
auto decayvtx = bcpart->end_vertex() ;
bool hasbcquarkdaughter(false) ;
if ( !hasbchadronparent && decayvtx ) {
ATH_MSG_DEBUG(" decay vtx: " << *decayvtx);
......@@ -387,7 +387,7 @@ void HforTool::findHFQuarks() {
// only in DEBUG mode
if ( msgLvl(MSG::DEBUG) && finalstate_q.size() ) {
ATH_MSG_DEBUG("print out vertex -5") ;
HepMC::GenVertex * vtx5(evt->barcode_to_vertex(-5)) ;
auto vtx5(evt->barcode_to_vertex(-5)) ;
if (vtx5) {
for ( HepMC::GenVertex::particle_iterator pin =
vtx5->particles_begin(HepMC::parents) ;
......@@ -430,7 +430,7 @@ void HforTool::findHFQuarksHerwig
// second loop over the final state quarks
for ( auto bcpart: ipdg.second) {
ATH_MSG_DEBUG("final state b/c " << *bcpart);
HepMC::GenVertex * prodvtx(bcpart->production_vertex()) ;
auto prodvtx(bcpart->production_vertex()) ;
bool isMPI(false) ;
bool isGS(false) ;
bool isME(false) ;
......@@ -574,7 +574,7 @@ void HforTool::findHFQuarksPythia
MEParton.insert(bcpart) ;
// if there is a direct stat=3 ancestor with the same flavour,
// then there is PDF parton too (eg, qc->q'Wc)
HepMC::GenVertex * prodvtx(bcpart->production_vertex()) ;
auto prodvtx(bcpart->production_vertex()) ;
if ( prodvtx ) {
HepMC::GenVertex::particle_iterator pin =
prodvtx->particles_begin(HepMC::parents) ;
......@@ -603,7 +603,7 @@ void HforTool::findHFQuarksPythia
if ( bcpart->status() != 3 ) {
ATH_MSG_DEBUG("final state b/c " << *bcpart
<< ", m = " << bcpart->momentum().m() );
HepMC::GenVertex * prodvtx(bcpart->production_vertex()) ;
auto prodvtx(bcpart->production_vertex()) ;
bool isTopDecay(false) ;
bool isWDecay(false) ; // subset of top-decays, for hadronic top-decays
bool iscquarkfromb(false) ;
......
......@@ -521,7 +521,7 @@ StatusCode ParticleDecayer::DFTwoBodyDecay( HepMC::GenParticle* genpart, int Pol
//Add the daughters to the pool file
ATH_MSG_DEBUG("ParticleDecayer::fillEvt: -- Add the daughters to the pool file");
HepMC::GenVertex* end_vtx = genpart->end_vertex();
auto end_vtx = genpart->end_vertex();
auto v0=daughterLVs.at(0).vect();
addParticle(end_vtx, ModeOfDecay, HepMC::FourVector(v0.x(),v0.y(),v0.z(),0.0), 1);
auto v1=daughterLVs.at(1).vect();
......
......@@ -278,7 +278,7 @@ TruthIsolationTool::computeIso( const GenParticles_t& particles,
// Correction for tau (as was done in the old tool for the time being)
double pxv = 0.*GeV;
double pyv = 0.*GeV;
HepMC::GenVertex *decVtx = part->end_vertex();
auto decVtx = part->end_vertex();
if (ida == 15 && decVtx) {
HepMC::GenVertex::particle_iterator child = decVtx->particles_begin(HepMC::children);
HepMC::GenVertex::particle_iterator childE = decVtx->particles_end(HepMC::children);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment