diff --git a/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx index a6532e9c29caefdee1c8cc48f7fd363fb8a20d18..fd88e5a0df015142d516e9f9590c70de59ced464 100755 --- a/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/GenEventCnv_p1.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // GenEventCnv_p1.cxx @@ -36,11 +36,6 @@ void GenEventCnv_p1::setDataPool( HepMC::DataPool* pool ) m_pool = pool; } -/////////////////////////////////////////////////////////////////// -/// Const methods: -/////////////////////////////////////////////////////////////////// - - void GenEventCnv_p1::persToTrans( const GenEvent_p1* persObj, HepMC::GenEvent* transObj, MsgStream& msg ) diff --git a/Generators/GeneratorObjectsTPCnv/src/GeneratorObjectsTPCnv.cxx b/Generators/GeneratorObjectsTPCnv/src/GeneratorObjectsTPCnv.cxx index 16b881e69b21d97279f9f51447d0e50135aa6295..51f6d535ee08d3a62ff14908bd4bf5aea5fa5cad 100644 --- a/Generators/GeneratorObjectsTPCnv/src/GeneratorObjectsTPCnv.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/GeneratorObjectsTPCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // generate the T/P converter entries diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx index 06809d4a80289174a0cf6b1a94e53e48783a2688..ed2856312598d988f440b3a3e5af01b8d1e7a558 100755 --- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx @@ -17,9 +17,6 @@ /// Public methods: /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////// -/// Const methods: -/////////////////////////////////////////////////////////////////// // In the 21.0 branch an eventIndex of zero means that the transient // HepMcParticleLink looks at the first event in the @@ -74,6 +71,3 @@ void HepMcParticleLinkCnv_p1::transToPers( const HepMcParticleLink* transObj, return; } -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx index d448d8cca25e65c1ab378bd32c247b658633cd76..d2a6262ace93273d25243a97345916ef5478fdd2 100755 --- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx @@ -9,17 +9,8 @@ #include "GaudiKernel/ThreadLocalContext.h" #include "AthenaKernel/ExtendedEventContext.h" -// GeneratorObjectsAthenaPool includes #include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p2.h" -/////////////////////////////////////////////////////////////////// -/// Public methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -/// Const methods: -/////////////////////////////////////////////////////////////////// - void HepMcParticleLinkCnv_p2::persToTrans( const HepMcParticleLink_p2* persObj, HepMcParticleLink* transObj, @@ -69,6 +60,3 @@ void HepMcParticleLinkCnv_p2::transToPers( const HepMcParticleLink* transObj, return; } -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p1.cxx index ebf282b741487ee49fe59fa96e551913c4962abd..028db5415a7d4477c70aea162a07f06a49cc0509 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p1.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p1.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // McEventCollectionCnv_p1.cxx @@ -19,11 +19,9 @@ #include "HepMcDataPool.h" /////////////////////////////////////////////////////////////////// -// Public methods: +// Constructors /////////////////////////////////////////////////////////////////// -// Constructors -//////////////// McEventCollectionCnv_p1::McEventCollectionCnv_p1() : Base_t( ) {} @@ -41,16 +39,14 @@ McEventCollectionCnv_p1::operator=( const McEventCollectionCnv_p1& rhs ) return *this; } +/////////////////////////////////////////////////////////////////// // Destructor -/////////////// +/////////////////////////////////////////////////////////////////// McEventCollectionCnv_p1::~McEventCollectionCnv_p1() { } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// void McEventCollectionCnv_p1::persToTrans( const McEventCollection_p1* persObj, McEventCollection* transObj, @@ -110,11 +106,3 @@ void McEventCollectionCnv_p1::transToPers( const McEventCollection*, throw std::runtime_error( "Retired McEventCollectionCnv_p1::transToPers() !!" ); return; } - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx index db91483e3fd011b891f63000db0e019af406573b..aa4cb45c00dbb945f9cd656f8af3697abc3f0e2d 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p2.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // McEventCollectionCnv_p2.cxx @@ -17,33 +17,11 @@ #include "GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h" #include "HepMcDataPool.h" -#if 0 -namespace { - // helper method to compute the number of particles and vertices in a - // whole McEventCollection - std::pair<unsigned int,unsigned int> - nbrParticlesAndVertices( const McEventCollection* mcEvents ) { - unsigned int nParts = 0; - unsigned int nVerts = 0; - const McEventCollection::const_iterator itrEnd = mcEvents->end(); - for ( McEventCollection::const_iterator itr = mcEvents->begin(); - itr != itrEnd; - ++itr ) { - nParts += (*itr)->particles_size(); - nVerts += (*itr)->vertices_size(); - } - - return std::make_pair( nParts, nVerts ); - } -} -#endif /////////////////////////////////////////////////////////////////// -// Public methods: +// Constructors /////////////////////////////////////////////////////////////////// -// Constructors -//////////////// McEventCollectionCnv_p2::McEventCollectionCnv_p2() : Base_t( ) {} @@ -61,16 +39,14 @@ McEventCollectionCnv_p2::operator=( const McEventCollectionCnv_p2& rhs ) return *this; } +/////////////////////////////////////////////////////////////////// // Destructor -/////////////// +/////////////////////////////////////////////////////////////////// McEventCollectionCnv_p2::~McEventCollectionCnv_p2() { } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// void McEventCollectionCnv_p2::persToTrans( const McEventCollection_p2* persObj, McEventCollection* transObj, @@ -178,13 +154,6 @@ void McEventCollectionCnv_p2::transToPers( const McEventCollection*, return; } -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// HepMC::GenVertexPtr McEventCollectionCnv_p2::createGenVertex( const McEventCollection_p2& persEvt, diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx index 20ada766f826c36a688c536ac3c27050108dc715..6a6383de3e96a53b8e55811a10f839a4a427ae42 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p3.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // McEventCollectionCnv_p3.cxx @@ -18,33 +18,11 @@ #include "GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h" #include "HepMcDataPool.h" -#if 0 -namespace { - // helper method to compute the number of particles and vertices in a - // whole McEventCollection - std::pair<unsigned int,unsigned int> - nbrParticlesAndVertices( const McEventCollection* mcEvents ) { - unsigned int nParts = 0; - unsigned int nVerts = 0; - const McEventCollection::const_iterator itrEnd = mcEvents->end(); - for ( McEventCollection::const_iterator itr = mcEvents->begin(); - itr != itrEnd; - ++itr ) { - nParts += (*itr)->particles_size(); - nVerts += (*itr)->vertices_size(); - } - - return std::make_pair( nParts, nVerts ); - } -} -#endif /////////////////////////////////////////////////////////////////// -// Public methods: +// Constructors /////////////////////////////////////////////////////////////////// -// Constructors -//////////////// McEventCollectionCnv_p3::McEventCollectionCnv_p3() : Base_t( ) @@ -63,16 +41,14 @@ McEventCollectionCnv_p3::operator=( const McEventCollectionCnv_p3& rhs ) return *this; } +/////////////////////////////////////////////////////////////////// // Destructor -/////////////// +/////////////////////////////////////////////////////////////////// McEventCollectionCnv_p3::~McEventCollectionCnv_p3() { } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// void McEventCollectionCnv_p3::persToTrans( const McEventCollection_p3* persObj, McEventCollection* transObj, @@ -180,13 +156,6 @@ void McEventCollectionCnv_p3::transToPers( const McEventCollection* /*transObj*/ return; } -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// HepMC::GenVertexPtr McEventCollectionCnv_p3::createGenVertex( const McEventCollection_p3& persEvt, diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx index 75a8fa2a8bf48362fe979f4916dfe1f1ee35ed8c..db580216dada75be74dcccb20254b414ee99b4e3 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p4.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // McEventCollectionCnv_p4.cxx @@ -21,34 +21,12 @@ #include "GenInterfaces/IHepMCWeightSvc.h" -namespace -{ - // helper method to compute the number of particles and vertices in a - // whole McEventCollection - std::pair<unsigned int,unsigned int> - nbrParticlesAndVertices( const McEventCollection* mcEvents ) - { - unsigned int nParts = 0; - unsigned int nVerts = 0; - const McEventCollection::const_iterator itrEnd = mcEvents->end(); - for ( McEventCollection::const_iterator itr = mcEvents->begin(); - itr != itrEnd; - ++itr ) - { - nParts += (*itr)->particles_size(); - nVerts += (*itr)->vertices_size(); - } - - return std::make_pair( nParts, nVerts ); - } -} +#include "McEventCollectionCnv_utils.h" /////////////////////////////////////////////////////////////////// -// Public methods: +// Constructors /////////////////////////////////////////////////////////////////// -// Constructors -//////////////// McEventCollectionCnv_p4::McEventCollectionCnv_p4() : Base_t( ), @@ -280,13 +258,6 @@ void McEventCollectionCnv_p4::transToPers( const McEventCollection* transObj, return; } -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// HepMC::GenVertexPtr McEventCollectionCnv_p4::createGenVertex( const McEventCollection_p4& persEvt, @@ -465,9 +436,6 @@ int McEventCollectionCnv_p4::writeGenParticle( const HepMC::GenParticle& p, (m2 < 0) && // isSpacelike !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene); // !isLightlike - // const bool useP2M2 = !isTimelike () && - // mom.isSpacelike() && - // !mom.isLightlike(); const short recoMethod = ( !useP2M2 ? 0 : ( ene >= 0. //*GeV diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx index 8b8666049429568c12fc0a6ad070d0cd9e72a8f9..a769cb98d3f46c7388ceee45f2456fd7345b0ab1 100755 --- a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_p5.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // McEventCollectionCnv_p5.cxx @@ -17,34 +17,13 @@ // GeneratorObjectsTPCnv includes #include "GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h" #include "HepMcDataPool.h" - #include "GenInterfaces/IHepMCWeightSvc.h" +#include "McEventCollectionCnv_utils.h" -namespace { - // helper method to compute the number of particles and vertices in a - // whole McEventCollection - std::pair<unsigned int,unsigned int> - nbrParticlesAndVertices( const McEventCollection* mcEvents ) { - unsigned int nParts = 0; - unsigned int nVerts = 0; - const McEventCollection::const_iterator itrEnd = mcEvents->end(); - for ( McEventCollection::const_iterator itr = mcEvents->begin(); - itr != itrEnd; - ++itr ) { - nParts += (*itr)->particles_size(); - nVerts += (*itr)->vertices_size(); - } - - return std::make_pair( nParts, nVerts ); - } -} /////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// - // Constructors -//////////////// +/////////////////////////////////////////////////////////////////// McEventCollectionCnv_p5::McEventCollectionCnv_p5() : Base_t( ), @@ -66,16 +45,14 @@ McEventCollectionCnv_p5::operator=( const McEventCollectionCnv_p5& rhs ) return *this; } +/////////////////////////////////////////////////////////////////// // Destructor -/////////////// +/////////////////////////////////////////////////////////////////// McEventCollectionCnv_p5::~McEventCollectionCnv_p5() { } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// void McEventCollectionCnv_p5::persToTrans( const McEventCollection_p5* persObj, McEventCollection* transObj, @@ -365,13 +342,6 @@ void McEventCollectionCnv_p5::transToPers( const McEventCollection* transObj, return; } -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// HepMC::GenVertexPtr McEventCollectionCnv_p5::createGenVertex( const McEventCollection_p5& persEvt, @@ -444,10 +414,6 @@ McEventCollectionCnv_p5::createGenParticle( const GenParticle_p5& persPart, // optimization. (If this is a performance issue for platforms // other than x86, one could change to double for those platforms.) if ( 0 == persPart.m_recoMethod ) { - // p->m_momentum.setVectM(Hep4Vector( persPart.m_px, - // persPart.m_py, - // persPart.m_pz ), - // persPart.m_m ); p->m_momentum.setPx( persPart.m_px); p->m_momentum.setPy( persPart.m_py); @@ -535,9 +501,6 @@ int McEventCollectionCnv_p5::writeGenParticle( const HepMC::GenParticle& p, (m2 < 0) && // isSpacelike !(std::abs(m2) < 2.0*DBL_EPSILON*ene*ene); // !isLightlike - // const bool useP2M2 = !isTimelike () && - // mom.isSpacelike() && - // !mom.isLightlike(); const short recoMethod = ( !useP2M2 ? 0 : ( ene >= 0. //*GeV diff --git a/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..982693b593a129840e17b67c1fff8b903b97b974 --- /dev/null +++ b/Generators/GeneratorObjectsTPCnv/src/McEventCollectionCnv_utils.h @@ -0,0 +1,23 @@ +namespace { + // helper method to compute the number of particles and vertices in a + // whole McEventCollection + std::pair<unsigned int,unsigned int> + nbrParticlesAndVertices( const McEventCollection* mcEvents ) { + unsigned int nParts = 0; + unsigned int nVerts = 0; + const McEventCollection::const_iterator itrEnd = mcEvents->end(); + for ( McEventCollection::const_iterator itr = mcEvents->begin(); + itr != itrEnd; + ++itr ) { +#ifdef HEPMC3 + nParts += (*itr)->particles().size(); + nVerts += (*itr)->vertices().size(); +#else + nParts += (*itr)->particles_size(); + nVerts += (*itr)->vertices_size(); +#endif + } + + return std::make_pair( nParts, nVerts ); + } +} \ No newline at end of file