Skip to content
Snippets Groups Projects
Commit 7bb4d6a9 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'BeamCondAlgForSim_ATLASSIM-3932_master' into 'master'

Migration of Simulation code away from BeamCondSvc (ATLASSIM-3932)

See merge request atlas/athena!16358

Former-commit-id: 8e048bf4
Showing
with 90 additions and 91 deletions
......@@ -8,6 +8,7 @@ atlas_subdir( BeamEffects )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
GaudiKernel
InnerDetector/InDetConditions/BeamSpotConditionsData
PRIVATE
AtlasTest/TestTools
Control/AthenaBaseComps
......@@ -31,7 +32,7 @@ include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
atlas_add_test( BeamEffectsAlg_test
SOURCES src/*.cxx test/BeamEffectsAlg_test.cxx
INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} #${GMOCK_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel TestTools AthenaBaseComps CxxUtils StoreGateLib EventInfo GeneratorObjects ${GTEST_LIBRARIES} #${GMOCK_LIBRARIES}
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel TestTools AthenaBaseComps CxxUtils StoreGateLib EventInfo GeneratorObjects BeamSpotConditionsData ${GTEST_LIBRARIES} #${GMOCK_LIBRARIES}
EXTRA_PATTERNS "[0-9]+ ms"
)
......@@ -39,7 +40,7 @@ atlas_add_component( BeamEffects
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps CxxUtils StoreGateLib EventInfo GeneratorObjects )
LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps CxxUtils StoreGateLib EventInfo GeneratorObjects BeamSpotConditionsData )
# Install files from the package:
atlas_install_python_modules( python/*.py )
......
......@@ -31,8 +31,14 @@ def getVertexBeamCondPositioner(name="VertexBeamCondPositioner", **kwargs):
#simFlags.VertexTimeOffset.get_Value()
kwargs.setdefault('RandomSvc', simFlags.RandomSvcMT.get_Value())
# TODO This should really be with the BeamCondSvc configuration.
# Conditions sequence for Athena MT
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
if not hasattr(condSeq, "BeamSpotCondAlg"):
from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg
condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" )
from IOVDbSvc.CondDB import conddb
conddb.addFolderSplitOnline("INDET","/Indet/Onl/Beampos","/Indet/Beampos")
conddb.addFolderSplitOnline("INDET","/Indet/Onl/Beampos","/Indet/Beampos", className='AthenaAttributeList')
return CfgMgr.Simulation__VertexBeamCondPositioner(name, **kwargs)
def getLongBeamspotVertexPositioner(name="LongBeamspotVertexPositioner", **kwargs):
......@@ -40,6 +46,15 @@ def getLongBeamspotVertexPositioner(name="LongBeamspotVertexPositioner", **kwarg
#simFlags.VertexTimeOffset.get_Value()
kwargs.setdefault('LParameter', 150.0)
kwargs.setdefault('RandomSvc', simFlags.RandomSvcMT.get_Value())
# TODO This should really be with the BeamCondSvc configuration.
# Conditions sequence for Athena MT
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
if not hasattr(condSeq, "BeamSpotCondAlg"):
from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg
condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" )
from IOVDbSvc.CondDB import conddb
conddb.addFolderSplitOnline("INDET","/Indet/Onl/Beampos","/Indet/Beampos", className='AthenaAttributeList')
return CfgMgr.Simulation__LongBeamspotVertexPositioner(name, **kwargs)
def getCrabKissingVertexPositioner(name="CrabKissingVertexPositioner", **kwargs):
......@@ -47,6 +62,15 @@ def getCrabKissingVertexPositioner(name="CrabKissingVertexPositioner", **kwargs)
kwargs.setdefault('BunchLength', 75.0)
kwargs.setdefault('RandomSvc', simFlags.RandomSvcMT.get_Value())
kwargs.setdefault('BunchShape' , "GAUSS")
# TODO This should really be with the BeamCondSvc configuration.
# Conditions sequence for Athena MT
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
if not hasattr(condSeq, "BeamSpotCondAlg"):
from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg
condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" )
from IOVDbSvc.CondDB import conddb
conddb.addFolderSplitOnline("INDET","/Indet/Onl/Beampos","/Indet/Beampos", className='AthenaAttributeList')
return CfgMgr.Simulation__CrabKissingVertexPositioner(name, **kwargs)
#--------------------------------------------------------------------------------------------------
......
......@@ -30,7 +30,6 @@ namespace Simulation
const std::string& n,
const IInterface* p )
: base_class(t,n,p),
m_beamCondSvc("BeamCondSvc", n),
m_rndGenSvc("AthRNGSvc", n),
m_randomEngine(0),
m_randomEngineName("VERTEX"),
......@@ -44,7 +43,6 @@ namespace Simulation
m_thetaX(295e-6)
{
// declare properties for the configuration
declareProperty( "BeamCondSvc" , m_beamCondSvc, "" );
declareProperty( "RandomSvc" , m_rndGenSvc, "" );
declareProperty( "RandomStream" , m_randomEngineName, "Name of the random number stream" );
declareProperty( "BunchShape" , m_bunchShapeProp, "GAUSS or FLAT" );
......@@ -74,10 +72,10 @@ namespace Simulation
{
ATH_MSG_VERBOSE("Initializing ...");
// retrieve the BeamCondService
ATH_CHECK(m_beamCondSvc.retrieve());
// prepare the RandonNumber generation
ATH_CHECK(m_rndGenSvc.retrieve());
ATH_CHECK(m_beamSpotKey.initialize());
m_randomEngine = m_rndGenSvc->getEngine(this, m_randomEngineName);
if (!m_randomEngine) {
ATH_MSG_ERROR("Could not get random number engine from RandomNumberService. Abort.");
......@@ -137,12 +135,12 @@ namespace Simulation
// Prepare the random engine
m_randomEngine->setSeed( name(), Gaudi::Hive::currentContext() );
CLHEP::HepRandomEngine* randomEngine(*m_randomEngine);
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
// See jira issue ATLASSIM-497 for an explanation of why calling
// shoot outside the CLHEP::HepLorentzVector constructor is
// necessary/preferable.
double vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(0);
double vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(1);
double vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(0);
double vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(1);
double piwinski_phi = std::fabs(m_thetaX - m_alphaX) * m_bunchLength/std::sqrt(m_epsilon * m_betaStar);
double piwinski_psi = m_alphaPar * m_bunchLength / std::sqrt( m_epsilon * m_betaStar);
double vertexZ = 0;
......@@ -170,8 +168,8 @@ namespace Simulation
new CLHEP::HepLorentzVector( vertexX, vertexY, vertexZ, 0. );
// (1) code from: Simulation/G4Atlas/G4AtlasUtilities/VertexPositioner.cxx
const double tx = tan( m_beamCondSvc->beamTilt(1) );
const double ty = tan( m_beamCondSvc->beamTilt(0) );
const double tx = tan( beamSpotHandle->beamTilt(1) );
const double ty = tan( beamSpotHandle->beamTilt(0) );
const double sqrt_abc = std::sqrt(1. + tx*tx + ty*ty);
const double sqrt_fgh = std::sqrt(1. + ty*ty);
......@@ -193,16 +191,16 @@ namespace Simulation
// first rotation, then translation
HepGeom::Transform3D transform(
HepGeom::Rotate3D(from1, from2, to1, to2).getRotation(),
CLHEP::Hep3Vector( m_beamCondSvc->beamPos().x(),
m_beamCondSvc->beamPos().y(),
m_beamCondSvc->beamPos().z() )
CLHEP::Hep3Vector( beamSpotHandle->beamPos().x(),
beamSpotHandle->beamPos().y(),
beamSpotHandle->beamPos().z() )
);
ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << m_beamCondSvc->beamPos());
ATH_MSG_VERBOSE("Width is (" << m_beamCondSvc->beamSigma(0) << ", " <<
m_beamCondSvc->beamSigma(1) << ", " << m_bunchLength << ")");
ATH_MSG_VERBOSE("Tilts are " << m_beamCondSvc->beamTilt(0) << " and " <<
m_beamCondSvc->beamTilt(1));
ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << beamSpotHandle->beamPos());
ATH_MSG_VERBOSE("Width is (" << beamSpotHandle->beamSigma(0) << ", " <<
beamSpotHandle->beamSigma(1) << ", " << m_bunchLength << ")");
ATH_MSG_VERBOSE("Tilts are " << beamSpotHandle->beamTilt(0) << " and " <<
beamSpotHandle->beamTilt(1));
ATH_MSG_VERBOSE("Vertex Position before transform: " << *vertexSmearing);
// update with the tilt
......
......@@ -22,7 +22,7 @@
#include "HepMC_Interfaces/ILorentzVectorGenerator.h"
// InDetBeamSpotService
#include "InDetBeamSpotService/IBeamCondSvc.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
// Forward declarations
namespace ATHRNG {
......@@ -66,7 +66,7 @@ namespace Simulation
double getDisplacement(double bunchSize, double angle1, double angle2,
CLHEP::HepRandomEngine* rng) const;
double beamspotFunction(double displacement, double angle1, double angle2) const;
ServiceHandle<IBeamCondSvc> m_beamCondSvc;
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
ServiceHandle<IAthRNGSvc> m_rndGenSvc;
ATHRNG::RNGWrapper* m_randomEngine; //!< Slot-local RNG
std::string m_randomEngineName; //!< Name of the random number stream
......
......@@ -28,7 +28,6 @@ namespace Simulation
const std::string& n,
const IInterface* p )
: base_class(t,n,p),
m_beamCondSvc("BeamCondSvc", n),
m_rndGenSvc("AthRNGSvc", n),
m_randomEngine(0),
m_randomEngineName("BEAM"),
......@@ -50,7 +49,6 @@ namespace Simulation
m_beam2ParticleMass(CLHEP::proton_mass_c2)
{
// declare properties for the configuration
declareProperty( "BeamCondSvc" , m_beamCondSvc );
declareProperty( "RandomSvc" , m_rndGenSvc );
declareProperty( "RandomStream" , m_randomEngineName );
declareProperty( "ApplyBoost" , m_applyBoost );
......@@ -77,8 +75,6 @@ namespace Simulation
StatusCode GenEventBeamEffectBooster::initialize()
{
ATH_MSG_VERBOSE("Initializing ...");
// retrieve the BeamCondService
ATH_CHECK(m_beamCondSvc.retrieve());
// prepare the RandonNumber generation
ATH_CHECK(m_rndGenSvc.retrieve());
m_randomEngine = m_rndGenSvc->getEngine(this, m_randomEngineName);
......@@ -202,7 +198,7 @@ namespace Simulation
const CLHEP::HepLorentzRotation& transform) const
{
// Apply the same transformation for EVERY HepMC::GenParticle
const HepMC::FourVector mom = p->momentum();
const HepMC::FourVector &mom = p->momentum();
CLHEP::HepLorentzVector hv(mom.px(), mom.py(), mom.pz(), mom.e()); //TODO check units
ATH_MSG_VERBOSE("BEAMBOOST initial momentum " << hv );
hv.transform(transform);
......
......@@ -16,7 +16,6 @@
#include "HepMC_Interfaces/IGenEventManipulator.h"
// Athena headers
#include "AthenaKernel/IAthRNGSvc.h"
#include "InDetBeamSpotService/IBeamCondSvc.h"
// Gaudi headers
#include "GaudiKernel/ServiceHandle.h"
// CLHEP headers
......@@ -62,7 +61,6 @@ namespace Simulation {
/** apply boost to individual GenParticles */
void boostParticle(HepMC::GenParticle* p, const CLHEP::HepLorentzRotation& transform) const;
ServiceHandle<IBeamCondSvc> m_beamCondSvc;
ServiceHandle<IAthRNGSvc> m_rndGenSvc;
ATHRNG::RNGWrapper* m_randomEngine; //!< Slot-local RNG
std::string m_randomEngineName; //!< Name of the random number stream
......
......@@ -32,7 +32,6 @@ namespace Simulation
const IInterface* p )
: base_class(t,n,p),
m_L(150.0),// 150.0 mm
m_beamCondSvc("BeamCondSvc", n),
m_rndGenSvc("AthRNGSvc", n),
m_randomEngine(0),
m_randomEngineName("VERTEX"),
......@@ -40,7 +39,6 @@ namespace Simulation
{
// declare properties for the configuration
declareProperty( "LParameter", m_L );
declareProperty( "BeamCondSvc", m_beamCondSvc );
declareProperty( "RandomSvc", m_rndGenSvc );
declareProperty( "RandomStream", m_randomEngineName );
declareProperty( "SimpleTimeSmearing", m_timeSmearing );
......@@ -56,8 +54,7 @@ namespace Simulation
{
ATH_MSG_VERBOSE("Initializing ...");
// retrieve the BeamCondService
ATH_CHECK(m_beamCondSvc.retrieve());
ATH_CHECK(m_beamSpotKey.initialize());
// prepare the RandonNumber generation
ATH_CHECK(m_rndGenSvc.retrieve());
m_randomEngine = m_rndGenSvc->getEngine(this, m_randomEngineName);
......@@ -105,20 +102,20 @@ namespace Simulation
// Prepare the random engine
m_randomEngine->setSeed( name(), Gaudi::Hive::currentContext() );
CLHEP::HepRandomEngine* randomEngine(*m_randomEngine);
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
// See jira issue ATLASSIM-497 for an explanation of why calling
// shoot outside the CLHEP::HepLorentzVector constructor is
// necessary/preferable.
float vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(0);
float vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(1);
float vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(0);
float vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(1);
float vertexZ = getZpos(randomEngine);
// calculate the vertexSmearing
CLHEP::HepLorentzVector *vertexSmearing =
new CLHEP::HepLorentzVector( vertexX, vertexY, vertexZ, 0. );
// (1) code from: Simulation/G4Atlas/G4AtlasUtilities/VertexPositioner.cxx
const double tx = tan( m_beamCondSvc->beamTilt(1) );
const double ty = tan( m_beamCondSvc->beamTilt(0) );
const double tx = tan( beamSpotHandle->beamTilt(1) );
const double ty = tan( beamSpotHandle->beamTilt(0) );
const double sqrt_abc = sqrt(1. + tx*tx + ty*ty);
const double sqrt_fgh = sqrt(1. + ty*ty);
......@@ -140,17 +137,17 @@ namespace Simulation
// first rotation, then translation
HepGeom::Transform3D transform(
HepGeom::Rotate3D(from1, from2, to1, to2).getRotation(),
CLHEP::Hep3Vector( m_beamCondSvc->beamPos().x(),
m_beamCondSvc->beamPos().y(),
m_beamCondSvc->beamPos().z() )
CLHEP::Hep3Vector( beamSpotHandle->beamPos().x(),
beamSpotHandle->beamPos().y(),
beamSpotHandle->beamPos().z() )
);
// FIXME: don't use endl in MsgStream printouts
ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << m_beamCondSvc->beamPos() << std::endl
<< "\tWidth is (" << m_beamCondSvc->beamSigma(0)
<< ", " << m_beamCondSvc->beamSigma(1) << ", "
ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << beamSpotHandle->beamPos() << std::endl
<< "\tWidth is (" << beamSpotHandle->beamSigma(0)
<< ", " << beamSpotHandle->beamSigma(1) << ", "
<< m_L << ")" << std::endl
<< "\tTilts are " << m_beamCondSvc->beamTilt(0) << " and " << m_beamCondSvc->beamTilt(1) << std::endl
<< "\tTilts are " << beamSpotHandle->beamTilt(0) << " and " << beamSpotHandle->beamTilt(1) << std::endl
<< "\tVertex Position before transform: " << *vertexSmearing);
// update with the tilt
......
......@@ -19,9 +19,7 @@
#include "AthenaBaseComps/AthAlgTool.h"
#include "AthenaKernel/IAthRNGSvc.h"
#include "HepMC_Interfaces/ILorentzVectorGenerator.h"
// InDetBeamSpotService
#include "InDetBeamSpotService/IBeamCondSvc.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
namespace ATHRNG {
class RNGWrapper;
}
......@@ -63,7 +61,7 @@ namespace Simulation {
double getZpos(CLHEP::HepRandomEngine*) const;
double beamspotFunction(double z) const;
double m_L; //!< Parameter in the Z distribution of the beamspot
ServiceHandle<IBeamCondSvc> m_beamCondSvc;
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
ServiceHandle<IAthRNGSvc> m_rndGenSvc;
ATHRNG::RNGWrapper* m_randomEngine; //!< Slot-local RNG
......
......@@ -30,13 +30,11 @@ namespace Simulation
const std::string& n,
const IInterface* p )
: base_class(t,n,p),
m_beamCondSvc("BeamCondSvc", n),
m_rndGenSvc("AthRNGSvc", n),
m_randomEngine(0),
m_randomEngineName("VERTEX")
{
// declare properties for the configuration
declareProperty( "BeamCondSvc", m_beamCondSvc );
declareProperty( "RandomSvc", m_rndGenSvc );
declareProperty( "RandomStream", m_randomEngineName );
declareProperty( "SimpleTimeSmearing", m_timeSmearing = false );
......@@ -52,8 +50,6 @@ namespace Simulation
{
ATH_MSG_VERBOSE("Initializing ...");
// retrieve the BeamCondService
ATH_CHECK(m_beamCondSvc.retrieve());
// retrieve the random number service
ATH_CHECK(m_rndGenSvc.retrieve());
m_randomEngine = m_rndGenSvc->getEngine(this, m_randomEngineName);
......@@ -61,7 +57,7 @@ namespace Simulation
ATH_MSG_ERROR("Could not get random number engine from RandomNumberService. Abort.");
return StatusCode::FAILURE;
}
ATH_CHECK(m_beamSpotKey.initialize());
// everything set up properly
return StatusCode::SUCCESS;
}
......@@ -79,20 +75,20 @@ namespace Simulation
// Prepare the random engine
m_randomEngine->setSeed( name(), Gaudi::Hive::currentContext() );
CLHEP::HepRandomEngine* randomEngine(*m_randomEngine);
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
// See jira issue ATLASSIM-497 for an explanation of why calling
// shoot outside the CLHEP::HepLorentzVector constructor is
// necessary/preferable.
float vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(0);
float vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(1);
float vertexZ = CLHEP::RandGaussZiggurat::shoot(randomEngine)*m_beamCondSvc->beamSigma(2);
float vertexX = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(0);
float vertexY = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(1);
float vertexZ = CLHEP::RandGaussZiggurat::shoot(randomEngine)*beamSpotHandle->beamSigma(2);
// calculate the vertexSmearing
CLHEP::HepLorentzVector *vertexSmearing =
new CLHEP::HepLorentzVector( vertexX, vertexY, vertexZ, 0. );
// (1) code from: Simulation/G4Atlas/G4AtlasUtilities/VertexPositioner.cxx
const double tx = tan( m_beamCondSvc->beamTilt(1) );
const double ty = tan( m_beamCondSvc->beamTilt(0) );
const double tx = tan( beamSpotHandle->beamTilt(1) );
const double ty = tan( beamSpotHandle->beamTilt(0) );
const double sqrt_abc = sqrt(1. + tx*tx + ty*ty);
const double sqrt_fgh = sqrt(1. + ty*ty);
......@@ -114,17 +110,17 @@ namespace Simulation
// first rotation, then translation
HepGeom::Transform3D transform(
HepGeom::Rotate3D(from1, from2, to1, to2).getRotation(),
CLHEP::Hep3Vector( m_beamCondSvc->beamPos().x(),
m_beamCondSvc->beamPos().y(),
m_beamCondSvc->beamPos().z() )
CLHEP::Hep3Vector( beamSpotHandle->beamPos().x(),
beamSpotHandle->beamPos().y(),
beamSpotHandle->beamPos().z() )
);
// FIXME: don't use endl in MsgStream printouts
ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << m_beamCondSvc->beamPos() << std::endl
<< "\tWidth is (" << m_beamCondSvc->beamSigma(0)
<< ", " << m_beamCondSvc->beamSigma(1) << ", "
<< m_beamCondSvc->beamSigma(2) << ")" << std::endl
<< "\tTilts are " << m_beamCondSvc->beamTilt(0) << " and " << m_beamCondSvc->beamTilt(1) << std::endl
ATH_MSG_VERBOSE("BeamSpotSvc reported beam position as " << beamSpotHandle->beamPos() << std::endl
<< "\tWidth is (" << beamSpotHandle->beamSigma(0)
<< ", " << beamSpotHandle->beamSigma(1) << ", "
<< beamSpotHandle->beamSigma(2) << ")" << std::endl
<< "\tTilts are " << beamSpotHandle->beamTilt(0) << " and " << beamSpotHandle->beamTilt(1) << std::endl
<< "\tVertex Position before transform: " << *vertexSmearing);
// update with the tilt
......@@ -135,7 +131,7 @@ namespace Simulation
/* This is ballpark code courtesy of Brian Amadio. He provided some functions based on beam parameters.
He provided a little trick for pulling out the beam bunch width as well. Hard coding the crossing angle
parameter for the time being, as the beam spot service doesn't really provide that yet. */
double bunch_length_z = (std::sqrt(2)*m_beamCondSvc->beamSigma(2))/0.9; // 0.9 is the crossing angle reduction factor
double bunch_length_z = (std::sqrt(2)*beamSpotHandle->beamSigma(2))/0.9; // 0.9 is the crossing angle reduction factor
// double tLimit = 2.*(bunch_length_z+bunch_length_z)/Gaudi::Units::c_light;
// TF1 func = TF1("func","[0]*exp((-([3]-299792458*x)^2*[2]^2-([3]+299792458*x)^2*[1]^2)/(2*[1]^2*[2]^2))",-1*tLimit,tLimit);
// func.SetParameter(0,Gaudi::Units::c_light/(M_PI*bunch_length_z*bunch_length_z));
......
......@@ -12,16 +12,12 @@
// STL includes
#include <string>
#include <utility>
#include <vector>
#include <map>
// FrameWork includes
#include "GaudiKernel/ServiceHandle.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "AthenaKernel/IAthRNGSvc.h"
#include "HepMC_Interfaces/ILorentzVectorGenerator.h"
// InDetBeamSpotService
#include "InDetBeamSpotService/IBeamCondSvc.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
namespace ATHRNG {
class RNGWrapper;
}
......@@ -56,7 +52,7 @@ namespace Simulation {
private:
ServiceHandle<IBeamCondSvc> m_beamCondSvc;
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
ServiceHandle<IAthRNGSvc> m_rndGenSvc;
ATHRNG::RNGWrapper* m_randomEngine; //!< Slot-local RNG
......
......@@ -12,6 +12,7 @@ atlas_depends_on_subdirs( PUBLIC
Event/xAOD/xAODTracking
GaudiKernel
InnerDetector/InDetConditions/InDetBeamSpotService
InnerDetector/InDetConditions/BeamSpotConditionsData
Simulation/ISF/ISF_Core/ISF_Interfaces
Simulation/ISF/ISF_ParametricSim/ISF_ParSimInterfaces
Tracking/TrkExtrapolation/TrkExInterfaces
......
......@@ -15,8 +15,7 @@
#include "GaudiKernel/ToolHandle.h"
#include "TrkExInterfaces/IExtrapolator.h"
#include "InDetBeamSpotService/IBeamCondSvc.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
namespace ISF {
......@@ -61,9 +60,7 @@ namespace iParSim {
/** Extrapolator tool */
ToolHandle<Trk::IExtrapolator> m_extrapolator;
/** Beam Conditions Service */
ServiceHandle<IBeamCondSvc> m_beamSpotSvc;
SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
};
......
......@@ -14,9 +14,7 @@
//================ Constructor ====================================================
iParSim::ISPtoPerigeeTool::ISPtoPerigeeTool(const std::string& type,const std::string& name,const IInterface* parent):
base_class(type,name,parent),
m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"),
m_beamSpotSvc("BeamCondSvc",name)
{
m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"){
}
//================ Destructor =====================================================
iParSim::ISPtoPerigeeTool::~ISPtoPerigeeTool(){}
......@@ -29,10 +27,7 @@ StatusCode iParSim::ISPtoPerigeeTool::initialize(){
return StatusCode::FAILURE;
}
if (m_beamSpotSvc.retrieve().isFailure()){
ATH_MSG_ERROR("Could not retrieve " << m_beamSpotSvc << ". Exiting.");
return StatusCode::FAILURE;
}
ATH_CHECK(m_beamSpotKey.initialize());
ATH_MSG_VERBOSE( "initialize() successful." );
return StatusCode::SUCCESS;
......@@ -44,7 +39,8 @@ StatusCode iParSim::ISPtoPerigeeTool::finalize(){
}
const Amg::Vector3D iParSim::ISPtoPerigeeTool::getPerigee() const{
return m_beamSpotSvc->beamPos();
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
return beamSpotHandle->beamPos();
}
......@@ -54,12 +50,13 @@ const Trk::TrackParameters* iParSim::ISPtoPerigeeTool::extractTrkParameters(cons
ATH_MSG_WARNING(" ISPtoPerigeeTool is not for neutral particles!");
}
//Get the momentum from the isp particle
const Amg::Vector3D momentum = isp.momentum();
const Amg::Vector3D &momentum = isp.momentum();
//Get the position from the isp particle
const Amg::Vector3D position = isp.position();
const Amg::Vector3D &position = isp.position();
//do the rest
const Trk::CurvilinearParameters cParameters(position, momentum, isp.charge());
Trk::PerigeeSurface persf( m_beamSpotSvc->beamPos() );
SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
Trk::PerigeeSurface persf( beamSpotHandle->beamPos() );
const Trk::TrackParameters* tP = m_extrapolator->extrapolate(cParameters, persf, Trk::anyDirection, false);
return tP;
......
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