Commit eeb8e41d authored by Edson Carquin Lopez's avatar Edson Carquin Lopez
Browse files

Merge branch 'master' of https://gitlab.cern.ch:8443/atlas/athena into tauCaloFix

parents eaadd060 6dc6fe2d
......@@ -26,7 +26,7 @@ EXTPROJECT=""
PLATFORM=""
RPMDIR=""
BUILDTYPE="Release"
EXTRACMAKE=""
EXTRACMAKE=()
while getopts ":s:b:i:e:p:f:r:t:x:h" opt; do
case $opt in
s)
......@@ -54,7 +54,7 @@ while getopts ":s:b:i:e:p:f:r:t:x:h" opt; do
BUILDTYPE=$OPTARG
;;
x)
EXTRACMAKE=$OPTARG
EXTRACMAKE+=($OPTARG)
;;
h)
usage
......@@ -98,7 +98,7 @@ rm -f CMakeCache.txt
rm -rf * # Remove the full build temporarily, to fix GAUDI-1315
cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \
-DGAUDI_ATLAS:BOOL=TRUE -DGAUDI_ATLAS_BASE_PROJECT:STRING=${EXTPROJECT} \
-DCMAKE_INSTALL_PREFIX:PATH=/InstallArea/${PLATFORM} ${EXTRACMAKE} \
-DCMAKE_INSTALL_PREFIX:PATH=/InstallArea/${PLATFORM} ${EXTRACMAKE[@]} \
${SOURCEDIR} || touch $error_stamp
} 2>&1 | tee cmake_config.log
test -f $error_stamp && ((ERROR_COUNT++))
......
......@@ -14,7 +14,7 @@ set -o pipefail
# Function printing the usage information for the script
usage() {
echo "Usage: build_atlasexternals.sh <-s source dir> <-b build dir> " \
"<-i install dir> [-p project] [-r RPM dir] [-t build type] [-d (debug output)]" \
"<-i install dir> [-p project] [-r RPM dir] [-t build type] " \
"[-x extra CMake arguments]"
}
......@@ -26,9 +26,8 @@ PROJECT="AthenaExternals"
RPMDIR=""
BUILDTYPE="Release"
PROJECTVERSION=""
DEBUGCMAKE=""
EXTRACMAKE=""
while getopts ":s:b:i:p:r:t:v:h:x:d" opt; do
EXTRACMAKE=()
while getopts ":s:b:i:p:r:t:v:hx:" opt; do
case $opt in
s)
SOURCEDIR=$OPTARG
......@@ -49,15 +48,15 @@ while getopts ":s:b:i:p:r:t:v:h:x:d" opt; do
BUILDTYPE=$OPTARG
;;
x)
EXTRACMAKE=$OPTARG
;;
d)
DEBUGCMAKE="--trace"
echo "Using the '--trace' option to debug the CMake configuration --> Verbose output!"
EXTRACMAKE+=($OPTARG)
;;
v)
PROJECTVERSION=$OPTARG
;;
h)
usage
exit 0
;;
:)
echo "Argument -$OPTARG requires a parameter!"
usage
......@@ -96,9 +95,8 @@ fi
error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp
{
rm -f CMakeCache.txt
cmake ${DEBUGCMAKE} -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \
${EXTRACONF} \
${EXTRACMAKE} \
cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \
${EXTRACONF} ${EXTRACMAKE[@]} \
${SOURCEDIR}/Projects/${PROJECT}/ || touch $error_stamp
} 2>&1 | tee cmake_config.log
test -f $error_stamp && ((ERROR_COUNT++))
......
......@@ -42,7 +42,10 @@ _propsToUnify={"GeoModelSvc.DetectorTools":unifySet,
"TagInfoMgr.ExtraTagValuePairs":unifySetOfPairs,
"AthenaOutputStream.ItemList":unifySet,
"AthenaPoolCnvSvc.PoolAttributes":unifySet,
"*.HypoTools": unifySet
"*.HypoTools": unifySet,
"AtDSFMTGenSvc.Seeds": unifySet,
"AtRanluxGenSvc.Seeds": unifySet,
"AtRndmGenSvc.Seeds": unifySet,
}
def matchPropName(propname):
......
File mode changed from 100644 to 100755
......@@ -69,6 +69,9 @@ atlas_add_test( RNGWrapper_test
LINK_LIBRARIES ${CLHEP_LIBRARIES} TestTools AthenaKernel StoreGateLib
GaudiKernel AtlasCLHEP_RandomGenerators )
atlas_add_test( RandomServices_test
SCRIPT python/RandomServices_test.py )
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
"""Define functions to construct random number services
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from RngComps.RngCompsConf import (
AtDSFMTGenSvc,
AtRanluxGenSvc,
AtRndmGenSvc,
AthRNGSvc,
)
# Translate between names in AthRNGSvc and elsewhere
AthEngines = {
"dSFMT" : "AtDSFMTGenSvc",
"Ranlux64" : "AtRanluxGenSvc",
"Ranecu" : "AtRndmGenSvc",
}
def dSFMT(seed, name="AtDSFMTGenSvc"):
"""Return a ComponentAccumulator containing an AtDSFMTGenSvc with seed"""
acc = ComponentAccumulator(name)
service = AtDSFMTGenSvc()
service.Seeds.append(seed)
acc.addService(service)
return acc
def Ranlux64(seed, name="AtRanluxGenSvc"):
"""Return a ComponentAccumulator containing an AtRanluxGenSvc with seed"""
acc = ComponentAccumulator()
service = AtRanluxGenSvc(name)
service.Seeds.append(seed)
acc.addService(service)
return acc
def Ranecu(seed, name="AtRndmGenSvc"):
"""Return a ComponentAccumulator containing an AtRndmGenSvc with seed"""
acc = ComponentAccumulator()
service = AtRndmGenSvc(name)
service.Seeds.append(seed)
acc.addService(service)
return acc
def RNG(engine="dSFMT", name="AthRNGSvc"):
"""Return a ComponentAccumulator containing an AthRNGSvc"""
acc = ComponentAccumulator()
service = AthRNGSvc(name)
service.EngineType = engine
acc.addService(service)
return acc
#!/usr/bin/env python
"""Run unit tests on RandomServices.py
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
"""
from AthenaCommon.Logging import log
from AthenaCommon.Constants import DEBUG
from AthenaCommon.Configurable import Configurable
from RandomServices import dSFMT, Ranlux64, Ranecu, RNG
# Set up logging and new style config
log.setLevel(DEBUG)
Configurable.configurableRun3Behavior = True
# Make each
t1 = dSFMT("TestSeed1")
t2 = Ranlux64("TestSeed2")
t3 = Ranecu("TestSeed3")
# Make RNG with all three agruments and none
t4 = RNG(name="RNGdSFMT1")
t5 = RNG("dSFMT", name="RNGdSFMT2")
t6 = RNG("Ranlux64", name="RNGRanlux64")
t7 = RNG("Ranecu", name="RNGRanecu")
# Merge
t1.mergeAll((dSFMT("test_seed7"), t2, t3, t4, t5, t6, t7,))
# Flag as merged to prevent error on destruction
t1._wasMerged = True
......@@ -76,3 +76,9 @@ atlas_add_test( LUCID_SimHitCnv_p1_test
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib AthenaPoolUtilities LUCID_RawEvent LUCID_SimEvent GeneratorObjectsTPCnv TestTools Identifier GaudiKernel LUCID_EventTPCnv )
atlas_add_test( LUCID_SimHitCnv_p2_test
SOURCES
test/LUCID_SimHitCnv_p2_test.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib AthenaPoolUtilities LUCID_RawEvent LUCID_SimEvent GeneratorObjectsTPCnv TestTools Identifier GaudiKernel LUCID_EventTPCnv )
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
......@@ -10,13 +10,13 @@
void LUCID_SimHitCnv_p1::persToTrans(const LUCID_SimHit_p1* persObj, LUCID_SimHit* transObj, MsgStream& log) {
log << MSG::DEBUG << "LUCID_SimHitCnv_p1::persToTrans called " << endmsg;
// redundant with m_track.
//HepMcParticleLinkCnv_p1 HepMcPLCnv;
//HepMcPLCnv.persToTrans(&(persObj->m_partLink),&(transObj->m_partLink), log);
HepMcParticleLinkCnv_p1 HepMcPLCnv;
HepMcParticleLink link;
HepMcPLCnv.persToTrans(&(persObj->m_partLink),&(link), log);
*transObj = LUCID_SimHit (persObj->m_tubeID,
persObj->m_pdgCode,
persObj->m_track,
link,
persObj->m_genVolume,
persObj->m_stepStartPosX,
persObj->m_stepStartPosY,
......
......@@ -11,12 +11,12 @@ void LUCID_SimHitCnv_p2::persToTrans(const LUCID_SimHit_p2* persObj, LUCID_SimHi
log << MSG::DEBUG << "LUCID_SimHitCnv_p2::persToTrans called " << endmsg;
// redundant with m_track.
//HepMcParticleLinkCnv_p2 HepMcPLCnv;
//HepMcPLCnv.persToTrans(&(persObj->m_partLink),&(transObj->m_partLink), log);
HepMcParticleLinkCnv_p2 HepMcPLCnv;
HepMcParticleLink link;
HepMcPLCnv.persToTrans(&(persObj->m_partLink),&(link), log);
*transObj = LUCID_SimHit (persObj->m_tubeID,
persObj->m_pdgCode,
persObj->m_track,
link,
persObj->m_genVolume,
persObj->m_stepStartPosX,
persObj->m_stepStartPosY,
......@@ -30,6 +30,26 @@ void LUCID_SimHitCnv_p2::persToTrans(const LUCID_SimHit_p2* persObj, LUCID_SimHi
persObj->m_energy);
}
void LUCID_SimHitCnv_p2::transToPers(const LUCID_SimHit*, LUCID_SimHit_p2*, MsgStream& /*log*/) {
throw std::runtime_error("LUCID_SimHitCnv_p2::transToPers is not supported in this release!");
void LUCID_SimHitCnv_p2::transToPers(const LUCID_SimHit* transObj, LUCID_SimHit_p2* persObj, MsgStream& log) {
log << MSG::DEBUG << "LUCID_SimHitCnv_p2::transToPers called " << endmsg;
HepMcParticleLinkCnv_p2 HepMcPLCnv;
persObj->m_tubeID = transObj->GetTubeID();
persObj->m_track = transObj->GetTrack();
persObj->m_pdgCode = transObj->GetPdgCode();
persObj->m_genVolume = transObj->GetGenVolume();
persObj->m_stepStartPosX = transObj->GetX();
persObj->m_stepStartPosY = transObj->GetY();
persObj->m_stepStartPosZ = transObj->GetZ();
persObj->m_stepEndPosX = transObj->GetEPX();
persObj->m_stepEndPosY = transObj->GetEPY();
persObj->m_stepEndPosZ = transObj->GetEPZ();
persObj->m_preStepTime = transObj->GetPreStepTime();
persObj->m_postStepTime = transObj->GetPostStepTime();
persObj->m_wavelength = transObj->GetWavelength();
persObj->m_energy = transObj->GetEnergy();
HepMcPLCnv.transToPers(&(transObj->particleLink()),&(persObj->m_partLink), log);
}
......@@ -73,12 +73,13 @@ 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);
HepMcParticleLink dummyHMPL(particle->barcode(),particle->parent_event()->event_number());
assert(dummyHMPL.cptr()==particle);
Athena_test::Leakcheck check;
const HepMC::GenParticle *pGenParticle = genPartVector.at(0);
LUCID_SimHit trans1 (1, pGenParticle->pdg_id(), pGenParticle->barcode(), 4,
HepMcParticleLink trkLink(pGenParticle->barcode(),pGenParticle->parent_event()->event_number());
LUCID_SimHit trans1 (1, pGenParticle->pdg_id(), trkLink, 4,
5.5, 6.5, 7.5,
8.5, 9.5, 10.5,
11.5, 12.5, 13.5, 14.5);
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
/**
* @file LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
* @date Feb, 2018
* @brief Tests for LUCID_SimHitCnv_p2.
*/
#undef NDEBUG
#include "LUCID_EventTPCnv/LUCID_SimHitCnv_p2.h"
#include "TestTools/leakcheck.h"
#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)
{
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());
assert (p1.GetY() == p2.GetY());
assert (p1.GetZ() == p2.GetZ());
assert (p1.GetEPX() == p2.GetEPX());
assert (p1.GetEPY() == p2.GetEPY());
assert (p1.GetEPZ() == p2.GetEPZ());
assert (p1.GetPreStepTime() == p2.GetPreStepTime());
assert (p1.GetPostStepTime() == p2.GetPostStepTime());
assert (p1.GetWavelength() == p2.GetWavelength());
assert (p1.GetEnergy() == p2.GetEnergy());
}
void testit (const LUCID_SimHit& trans1)
{
MsgStream log (0, "test");
LUCID_SimHitCnv_p2 cnv;
LUCID_SimHit_p2 pers;
cnv.transToPers (&trans1, &pers, log);
LUCID_SimHit trans2;
cnv.persToTrans (&pers, &trans2, log);
compare (trans1, trans2);
}
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(),particle->parent_event()->event_number());
assert(dummyHMPL.cptr()==particle);
Athena_test::Leakcheck check;
HepMcParticleLink trkLink(genPartVector.at(0)->barcode(),genPartVector.at(0)->parent_event()->event_number());
LUCID_SimHit trans1 (1, genPartVector.at(0)->pdg_id(), trkLink, 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()
{
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;
}
......@@ -13,62 +13,76 @@
#include "AthenaKernel/IAtRndmGenSvc.h"
// LUCID_SimHit hold all information needed by the digitization algorithms
// to construct raw data objects.
// to construct raw data objects.
class LUCID_SimHit {
public:
LUCID_SimHit();
LUCID_SimHit(const LUCID_SimHit&);
LUCID_SimHit(short tubeID,
int pdgCode,
int track,
int genVolume,
float stepStartPosX,
float stepStartPosY,
float stepStartPosZ,
float stepEndPosX,
float stepEndPosY,
float stepEndPosZ,
float preStepTime,
float postStepTime,
float wavelength,
float energy);
LUCID_SimHit(short tubeID,
int pdgCode,
int track,
int genVolume,
float stepStartPosX,
float stepStartPosY,
float stepStartPosZ,
float stepEndPosX,
float stepEndPosY,
float stepEndPosZ,
float preStepTime,
float postStepTime,
float wavelength,
float energy);
LUCID_SimHit(short tubeID,
int pdgCode,
HepMcParticleLink partLink,
int genVolume,
float stepStartPosX,
float stepStartPosY,
float stepStartPosZ,
float stepEndPosX,
float stepEndPosY,
float stepEndPosZ,
float preStepTime,
float postStepTime,
float wavelength,
float energy);
std::string print() const;
int GetTrackID() const;
const LUCID_SimHit& operator=(const LUCID_SimHit& t);
int operator == (const LUCID_SimHit&) const;
bool operator < (const LUCID_SimHit&) const;
const HepMcParticleLink& particleLink() const;
inline float GetX() const { return m_stepStartPosX; }
inline float GetY() const { return m_stepStartPosY; }
inline float GetZ() const { return m_stepStartPosZ; }
inline float GetEPX() const { return m_stepEndPosX; }
inline float GetEPY() const { return m_stepEndPosY; }
inline float GetEPZ() const { return m_stepEndPosZ; }
inline short GetTubeID () const { return m_tubeID; }
inline short GetTubeID () const { return m_tubeID; }
inline int GetTrack () const { return m_track; }
inline int GetPdgCode () const { return m_pdgCode; }
inline int GetGenVolume () const { return m_genVolume; }
inline float GetPreStepTime () const { return m_preStepTime; }
inline float GetPostStepTime() const { return m_postStepTime; }
inline float GetWavelength () const { return m_wavelength; }
inline float GetPreStepTime () const { return m_preStepTime; }
inline float GetPostStepTime() const { return m_postStepTime; }
inline float GetWavelength () const { return m_wavelength; }
inline float GetEnergy () const { return m_energy; }
bool isDetected(CLHEP::HepRandomEngine* rndEngine) const;
private:
private:
short m_tubeID;
short m_tubeID;
int m_pdgCode;
int m_track;
HepMcParticleLink m_partLink; // link to the particle generating the hit
......@@ -76,12 +90,12 @@ class LUCID_SimHit {
float m_stepStartPosX;
float m_stepStartPosY;
float m_stepStartPosZ;
float m_stepEndPosX;
float m_stepEndPosY;
float m_stepEndPosX;
float m_stepEndPosY;
float m_stepEndPosZ;
float m_preStepTime;
float m_postStepTime;
float m_wavelength;
float m_preStepTime;
float m_postStepTime;
float m_wavelength;
float m_energy;
};
......
......@@ -8,43 +8,74 @@
LUCID_SimHit::LUCID_SimHit(): m_partLink() {
m_tubeID = 0;
m_tubeID = 0;
m_pdgCode = 0;
m_track = 0;
m_genVolume = 0;
m_stepStartPosX = 0;
m_stepStartPosY = 0;
m_stepStartPosZ = 0;
m_stepEndPosX = 0;
m_stepEndPosY = 0;
m_stepEndPosX = 0;
m_stepEndPosY = 0;
m_stepEndPosZ = 0;
m_preStepTime = 0;
m_postStepTime = 0;
m_wavelength = 0;
m_preStepTime = 0;
m_postStepTime = 0;
m_wavelength = 0;
m_energy = 0;
}
LUCID_SimHit::LUCID_SimHit(const LUCID_SimHit& simhit) { *this = simhit; }
LUCID_SimHit::LUCID_SimHit(short tubeID,
int pdgCode,
int track,
int genVolume,
float stepStartPosX,
float stepStartPosY,
float stepStartPosZ,
float stepEndPosX,
float stepEndPosY,
float stepEndPosZ,
float preStepTime,
float postStepTime,
float wavelength,
float energy):
int pdgCode,
int track,
int genVolume,
float stepStartPosX,
float stepStartPosY,
float stepStartPosZ,
float stepEndPosX,
float stepEndPosY,
float stepEndPosZ,
float preStepTime,
float postStepTime,
float wavelength,
float energy):