Skip to content
Snippets Groups Projects
Commit dab88dc7 authored by James Beacham's avatar James Beacham Committed by John Chapman
Browse files

Merge branch 'HMPLCnvRelatedUnitTests_21.0' into '21.0'

Updating unit tests for SimHit and SDO TP Converters

See merge request atlas/athena!9151


Former-commit-id: 3e015fa310e3e1f2a5a0eb1ede90c1690a316d39
parent d4cac489
No related branches found
No related tags found
No related merge requests found
Showing
with 434 additions and 46 deletions
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v4r1)
running on lxplus008.cern.ch on Fri Feb 9 16:59:26 2018
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
ClassIDSvc INFO getRegistryEntries: read 1130 CLIDRegistry entries for module ALL
ProxyProviderSvc INFO Initializing ProxyProviderSvc - package version SGComps-00-00-00
ClassIDSvc INFO getRegistryEntries: read 869 CLIDRegistry entries for module ALL
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
......@@ -17,6 +17,21 @@
#include <cassert>
#include <iostream>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenEvent.h"
#include "HepMC/GenParticle.h"
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const LUCID_SimHit& p1,
const LUCID_SimHit& p2)
......@@ -24,6 +39,7 @@ void compare (const LUCID_SimHit& p1,
assert (p1.GetTubeID() == p2.GetTubeID());
assert (p1.GetPdgCode() == p2.GetPdgCode());
assert (p1.GetTrack() == p2.GetTrack());
compare (p1.particleLink(), p2.particleLink());
assert (p1.particleLink() == p2.particleLink());
assert (p1.GetGenVolume() == p2.GetGenVolume());
assert (p1.GetX() == p2.GetX());
......@@ -52,22 +68,34 @@ void testit (const LUCID_SimHit& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
Athena_test::Leakcheck check;
LUCID_SimHit trans1 (1, 2, 3, 4,
const HepMC::GenParticle *pGenParticle = genPartVector.at(0);
LUCID_SimHit trans1 (1, pGenParticle->pdg_id(), pGenParticle->barcode(), 4,
5.5, 6.5, 7.5,
8.5, 9.5, 10.5,
11.5, 12.5, 13.5, 14.5);
testit (trans1);
}
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
......@@ -26,8 +26,8 @@ atlas_add_tpcnv_library( GeneratorObjectsTPCnv
src/*.cxx
PUBLIC_HEADERS GeneratorObjectsTPCnv
INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel TestTools )
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel TestTools )
atlas_add_dictionary( GeneratorObjectsTPCnvDict
GeneratorObjectsTPCnv/GeneratorObjectsTPCnvDict.h
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef GENERATOROBJECTSTPCNV_INITMCEVENTCOLLECTION_H
# define GENERATOROBJECTSTPCNV_INITMCEVENTCOLLECTION_H
/** @file initMcEventCollection.h
* @brief minimal gaudi initialization and record an McEventCollection in StoreGate
*
**/
#include <string>
#include <vector>
#include "HepMC/GenParticle.h"
#undef NDEBUG
class ISvcLocator;
namespace HepMC {
class GenEvent;
}
namespace Athena_test {
/** @fn bool initGaudi(ISvcLocator*& pSvcLoc, HepMC::GenParticle*& pGenParticle)
* @brief minimal gaudi initialization and record an McEventCollection in StoreGate
* @param pSvcLoc returns a pointer to the Gaudi ServiceLocator
* @param genPartVector returns a vector of pointers to GenParticle objects for use in HepMcParticleLink creation
*/
bool initMcEventCollection(ISvcLocator*& pSvcLoc, std::vector<HepMC::GenParticle*>& genPartVector);
/** @fn HepMC::GenParticle* populateGenEvent(HepMC::GenEvent & ge)
* @brief fills a HepMC::GenEvent with some dummy GenParticle and GenVertex objects
* @param pSvcLoc returns a pointer to the Gaudi ServiceLocator
* @param genPartVector returns a vector of pointers to GenParticle objects for use in HepMcParticleLink creation
*/
void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartVector);
}
#endif // GENERATOROBJECTSTPCNV_INITMCEVENTCOLLECTION_H
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
// HepMC includes
#include "HepMC/GenEvent.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenVertex.h"
// CLHEP includes
#include "CLHEP/Vector/LorentzVector.h"
#include "CLHEP/Units/SystemOfUnits.h"
#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p1.h"
#include "StoreGate/WriteHandle.h"
#include "GeneratorObjects/McEventCollection.h"
#include "TestTools/initGaudi.h"
namespace Athena_test {
bool initMcEventCollection(ISvcLocator*& pSvcLoc, std::vector<HepMC::GenParticle*>& genPartList)
{
if (!Athena_test::initGaudi(pSvcLoc)) {
std::cerr << "This test can not be run" << std::endl;
return false;
}
// create dummy input McEventCollection with a name that
// HepMcParticleLink knows about
SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
inputTestDataHandle = std::make_unique<McEventCollection>();
// Add a dummy GenEvent
const int process_id1(20);
const int event_number1(17);
inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
populateGenEvent(ge1,-11,11,genPartList);
populateGenEvent(ge1,-13,13,genPartList);
populateGenEvent(ge1,-11,11,genPartList);
populateGenEvent(ge1,-13,13,genPartList);
populateGenEvent(ge1,-11,11,genPartList);
populateGenEvent(ge1,22,22,genPartList);
return true;
}
void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<HepMC::GenParticle*>& genPartList)
{
CLHEP::HepLorentzVector myPos( 0.0, 0.0, 0.0, 0.0);
HepMC::GenVertex *myVertex = new HepMC::GenVertex( myPos, -1 );
HepMC::FourVector fourMomentum1( 0.0, 0.0, 1.0, 1.0*CLHEP::TeV);
HepMC::GenParticle* inParticle1 = new HepMC::GenParticle(fourMomentum1, pdgid1, 2);
myVertex->add_particle_in(inParticle1);
HepMC::FourVector fourMomentum2( 0.0, 0.0, -1.0, 1.0*CLHEP::TeV);
HepMC::GenParticle* inParticle2 = new HepMC::GenParticle(fourMomentum2, pdgid2, 2);
myVertex->add_particle_in(inParticle2);
HepMC::FourVector fourMomentum3( 0.0, 1.0, 0.0, 1.0*CLHEP::TeV);
HepMC::GenParticle* inParticle3 = new HepMC::GenParticle(fourMomentum3, pdgid1, 1);
myVertex->add_particle_out(inParticle3);
genPartList.push_back(inParticle3);
HepMC::FourVector fourMomentum4( 0.0, -1.0, 0.0, 1.0*CLHEP::TeV);
HepMC::GenParticle* inParticle4 = new HepMC::GenParticle(fourMomentum4, pdgid2, 1);
myVertex->add_particle_out(inParticle4);
genPartList.push_back(inParticle4);
ge.add_vertex( myVertex );
ge.set_signal_process_vertex( myVertex );
ge.set_beam_particles(inParticle1,inParticle2);
}
}
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v4r1)
running on lxplus008.cern.ch on Fri Feb 9 16:59:26 2018
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
ClassIDSvc INFO getRegistryEntries: read 1130 CLIDRegistry entries for module ALL
ProxyProviderSvc INFO Initializing ProxyProviderSvc - package version SGComps-00-00-00
ClassIDSvc INFO getRegistryEntries: read 869 CLIDRegistry entries for module ALL
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
Athena::getMessageSvc: WARNING MessageSvc not found, will use std::cout
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
......@@ -17,6 +17,20 @@
#include <cassert>
#include <iostream>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenEvent.h"
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const SiHit& p1,
const SiHit& p2)
......@@ -25,6 +39,7 @@ void compare (const SiHit& p1,
assert (p1.localEndPosition() == p2.localEndPosition());
assert (p1.energyLoss() == p2.energyLoss());
assert (p1.meanTime() == p2.meanTime());
compare(p1.particleLink(), p2.particleLink());
assert (p1.particleLink() == p2.particleLink());
assert (p1.identify() == p2.identify());
}
......@@ -43,24 +58,37 @@ void testit (const SiHit& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
Athena_test::Leakcheck check;
const HepMC::GenParticle *pGenParticle = genPartVector.at(0);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
SiHit trans1 (HepGeom::Point3D<double> (10.5, 11.5, 12.5),
HepGeom::Point3D<double> (13.5, 14.5, 15.5),
16.5,
17.5,
18,
trkLink,
19);
testit (trans1);
}
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
......@@ -17,6 +17,20 @@
#include <cassert>
#include <iostream>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenEvent.h"
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const SiHit& p1,
const SiHit& p2)
......@@ -25,6 +39,7 @@ void compare (const SiHit& p1,
assert (p1.localEndPosition() == p2.localEndPosition());
assert (p1.energyLoss() == p2.energyLoss());
assert (p1.meanTime() == p2.meanTime());
compare(p1.particleLink(), p2.particleLink());
assert (p1.particleLink() == p2.particleLink());
assert (p1.identify() == p2.identify());
}
......@@ -53,31 +68,44 @@ void testit (const SiHitCollection& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
// Create DVL info outside of leak check.
SiHitCollection dum ("coll");
Athena_test::Leakcheck check;
SiHitCollection trans1 ("coll");
for (int i=0; i < 10; i++) {
const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
int o = i*100;
trans1.Emplace (HepGeom::Point3D<double> (10.5+o, 11.5+o, 12.5+o),
HepGeom::Point3D<double> (13.5+o, 14.5+o, 15.5+o),
16.5+o,
17.5+o,
18+o,
trkLink,
19+o);
}
testit (trans1);
}
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
......@@ -17,11 +17,25 @@
#include <cassert>
#include <iostream>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenEvent.h"
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const TRTUncompressedHit& p1,
const TRTUncompressedHit& p2)
{
assert (p1.GetHitID() == p2.GetHitID());
compare(p1.particleLink(), p2.particleLink());
assert (p1.particleLink() == p2.particleLink());
assert (p1.GetParticleEncoding() == p2.GetParticleEncoding());
assert (p1.GetKineticEnergy() == p2.GetKineticEnergy());
......@@ -49,23 +63,36 @@ void testit (const TRTUncompressedHit& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
Athena_test::Leakcheck check;
TRTUncompressedHit trans1 (101, 102, 103,
const HepMC::GenParticle *pGenParticle = genPartVector.at(0);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
TRTUncompressedHit trans1 (101, trkLink, pGenParticle->pdg_id(),
104.5, 105.5,
106.5, 107.5, 108.5,
106.5, 107.5, 108.5,
109.5, 110.5, 111.5,
112.5);
testit (trans1);
}
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
......@@ -17,11 +17,25 @@
#include <cassert>
#include <iostream>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenEvent.h"
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const TRTUncompressedHit& p1,
const TRTUncompressedHit& p2)
{
assert (p1.GetHitID() == p2.GetHitID());
compare(p1.particleLink(), p2.particleLink());
assert (p1.particleLink() == p2.particleLink());
assert (p1.GetParticleEncoding() == p2.GetParticleEncoding());
assert (p1.GetKineticEnergy() == p2.GetKineticEnergy());
......@@ -59,9 +73,13 @@ void testit (const TRTUncompressedHitCollection& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
// Create DVL info outside of leak check.
TRTUncompressedHitCollection dum ("coll");
Athena_test::Leakcheck check;
......@@ -69,24 +87,36 @@ void test1()
TRTUncompressedHitCollection trans1 ("coll");
for (int i=0; i < 10; i++) {
int o = i*100;
trans1.Emplace (101+o, 102+o, 20+o,
const HepMC::GenParticle* pGenParticle = genPartVector.at(0);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
trans1.Emplace (101+o, trkLink, pGenParticle->pdg_id(),
104.5+o, 105.5+o,
(106.5+o)/1000, (107.5+o)/1000, 108.5+o,
(106.5+o)/1000, (107.5+o)/1000, 108.5+o,
(109.5+o)/1000, (110.5+o)/1000, 111.5+o,
112.5+o);
}
trans1.Emplace (131, 132, 22,
// Special case for photons
const HepMC::GenParticle* pGenParticle = genPartVector.at(10);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
trans1.Emplace (131, trkLink, 22,
134.5, 135.5,
10, 3, 138.5,
3, 10, 148.5,
142.5);
testit (trans1);
}
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
......@@ -19,15 +19,29 @@
#include <iostream>
#include <cmath>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenEvent.h"
using Athena_test::isEqual;
using std::atan2;
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const TRTUncompressedHit& p1,
const TRTUncompressedHit& p2)
{
assert (p1.GetHitID() == p2.GetHitID());
compare(p1.particleLink(), p2.particleLink());
assert (p1.particleLink() == p2.particleLink());
assert (p1.GetParticleEncoding() == p2.GetParticleEncoding());
assert (isEqual (p1.GetKineticEnergy(), p2.GetKineticEnergy(), 5e-4));
......@@ -79,9 +93,13 @@ void testit (const TRTUncompressedHitCollection& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
// Create DVL info outside of leak check.
TRTUncompressedHitCollection dum ("coll");
Athena_test::Leakcheck check;
......@@ -89,24 +107,36 @@ void test1()
TRTUncompressedHitCollection trans1 ("coll");
for (int i=0; i < 10; i++) {
int o = i*100;
trans1.Emplace (101+o, 102+o, 20+o,
const HepMC::GenParticle* pGenParticle = genPartVector.at(0);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
trans1.Emplace (101+o, trkLink, 20+o,
104.5+o, 105.5+o,
(106.5+o)/1000, (107.5+o)/1000, 108.5+o,
(106.5+o)/1000, (107.5+o)/1000, 108.5+o,
(109.5+o)/1000, (110.5+o)/1000, 111.5+o,
112.5+o);
}
trans1.Emplace (131, 132, 22,
// Special case for photons
const HepMC::GenParticle* pGenParticle = genPartVector.at(10);
HepMcParticleLink trkLink(pGenParticle->barcode(),0);
trans1.Emplace (131, trkLink, 22,
134.5, 135.5,
10, 3, 138.5,
3, 10, 148.5,
142.5);
testit (trans1);
}
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v4r1)
running on lxplus008.cern.ch on Fri Feb 9 16:59:26 2018
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
ClassIDSvc INFO getRegistryEntries: read 1130 CLIDRegistry entries for module ALL
ProxyProviderSvc INFO Initializing ProxyProviderSvc - package version SGComps-00-00-00
ClassIDSvc INFO getRegistryEntries: read 869 CLIDRegistry entries for module ALL
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
ApplicationMgr Ready
test1
HepMcParticleLink INFO find_hostkey: Using TruthEvent as McEventCollection key for this job
......@@ -17,6 +17,21 @@
#include <cassert>
#include <iostream>
#include "GeneratorObjectsTPCnv/initMcEventCollection.h"
#include "HepMC/GenEvent.h"
#include "HepMC/GenParticle.h"
void compare (const HepMcParticleLink& p1,
const HepMcParticleLink& p2)
{
assert ( p1.isValid() == p2.isValid() );
assert ( p1.barcode() == p2.barcode() );
assert ( p1.eventIndex() == p2.eventIndex() );
assert ( p1.cptr() == p2.cptr() );
assert ( p1 == p2 );
}
void compare (const CscMcData& p1,
const CscMcData& p2)
......@@ -36,6 +51,7 @@ void compare (const CscSimData& p1,
const std::vector< CscSimData::Deposit >& dep2 = p2.getdeposits();
assert (dep1.size() == dep2.size());
for (size_t i = 0; i < dep1.size(); i++) {
compare (dep1[i].first, dep2[i].first);
assert (dep1[i].first == dep2[i].first);
compare (dep1[i].second, dep2[i].second);
}
......@@ -55,15 +71,22 @@ void testit (const CscSimData& trans1)
}
void test1()
void test1(std::vector<HepMC::GenParticle*>& genPartVector)
{
std::cout << "test1\n";
const HepMC::GenParticle *particle = genPartVector.at(0);
// Create HepMcParticleLink outside of leak check.
HepMcParticleLink dummyHMPL(particle->barcode(),0);
assert(dummyHMPL.cptr()==particle);
Athena_test::Leakcheck check;
std::vector<CscSimData::Deposit> deps;
deps.emplace_back (123, CscMcData ( 2.5, 3.5, 4.5));
deps.emplace_back (223, CscMcData (12.5, 13.5, 14.5));
deps.emplace_back (323, CscMcData (22.5, 23.5, 24.5));
HepMcParticleLink trkLink1(genPartVector.at(0)->barcode(),0);
deps.emplace_back (trkLink1, CscMcData ( 2.5, 3.5, 4.5));
HepMcParticleLink trkLink2(genPartVector.at(1)->barcode(),0);
deps.emplace_back (trkLink2, CscMcData (12.5, 13.5, 14.5));
HepMcParticleLink trkLink3(genPartVector.at(2)->barcode(),0);
deps.emplace_back (trkLink3, CscMcData (22.5, 23.5, 24.5));
deps[0].second.setCharge ( 5.5);
deps[1].second.setCharge (15.5);
deps[2].second.setCharge (25.5);
......@@ -74,6 +97,13 @@ void test1()
int main()
{
test1();
ISvcLocator* pSvcLoc = nullptr;
std::vector<HepMC::GenParticle*> genPartVector;
if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
std::cerr << "This test can not be run" << std::endl;
return 0;
}
test1(genPartVector);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment