ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::RandomRoISeedTool Class Referencefinal

#include <RandomRoISeedTool.h>

Inheritance diagram for InDet::RandomRoISeedTool:
Collaboration diagram for InDet::RandomRoISeedTool:

Public Member Functions

 RandomRoISeedTool (const std::string &, const std::string &, const IInterface *)
virtual ~RandomRoISeedTool ()=default
virtual StatusCode initialize () override
virtual std::vector< ZWindow > getRoIs (const EventContext &ctx) const override
 Compute RoI.

Disallow default instantiation, copy, assignment

FloatProperty m_z0Window {this, "TrackZ0Window", 1.0, "width of z0 window"}
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"}
ServiceHandle< IAthRNGSvcm_atRndmSvc {this, "RndmGenSvc", "AthRNGSvc", "multi-thread safe random number generator"}
std::string m_rndmEngineName {"SINGLE"}
 RandomRoISeedTool ()=delete
 RandomRoISeedTool (const RandomRoISeedTool &)=delete
RandomRoISeedTooloperator= (const RandomRoISeedTool &)=delete

Detailed Description

Definition at line 31 of file RandomRoISeedTool.h.

Constructor & Destructor Documentation

◆ RandomRoISeedTool() [1/3]

InDet::RandomRoISeedTool::RandomRoISeedTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 25 of file RandomRoISeedTool.cxx.

27 : base_class(t,n,p)
28{
29}

◆ ~RandomRoISeedTool()

virtual InDet::RandomRoISeedTool::~RandomRoISeedTool ( )
virtualdefault

◆ RandomRoISeedTool() [2/3]

InDet::RandomRoISeedTool::RandomRoISeedTool ( )
protecteddelete

◆ RandomRoISeedTool() [3/3]

InDet::RandomRoISeedTool::RandomRoISeedTool ( const RandomRoISeedTool & )
protecteddelete

Member Function Documentation

◆ getRoIs()

std::vector< InDet::IZWindowRoISeedTool::ZWindow > InDet::RandomRoISeedTool::getRoIs ( const EventContext & ctx) const
overridevirtual

Compute RoI.

Definition at line 48 of file RandomRoISeedTool.cxx.

49{
50
51 // Prepare output
52 std::vector<InDet::IZWindowRoISeedTool::ZWindow> listRoIs;
53 listRoIs.clear();
54
55 // Retrieve beamspot information
56 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{m_beamSpotKey, ctx};
57 if (not beamSpotHandle.isValid()) {
58 ATH_MSG_ERROR("Cannot retrieve beam spot data. Bailing out with empty RoI list.");
59 return listRoIs;
60 }
61 float bsSigZ = 0.0;
62 bsSigZ = beamSpotHandle->beamSigma(2);
63 ATH_MSG_DEBUG("Beam spot data available!");
64
65 // Initialize random engine and find z-value of RoI
66 ATHRNG::RNGWrapper *rndmEngine = m_atRndmSvc->getEngine(this, m_rndmEngineName);
67 rndmEngine->setSeed (name(), ctx);
68 CLHEP::HepRandomEngine* engine = rndmEngine->getEngine (ctx);
69 float zVal;
70 zVal = CLHEP::RandGauss::shoot(engine, 0.0, 1.0) * bsSigZ; //This effectively samples from a beamspot with the correct beamspot sigma_z
71
72 InDet::IZWindowRoISeedTool::ZWindow RoI;
73 RoI.zReference = zVal;
74 RoI.zWindow[0] = RoI.zReference - m_z0Window;
75 RoI.zWindow[1] = RoI.zReference + m_z0Window;
76 listRoIs.push_back(RoI);
77 ATH_MSG_DEBUG("Random RoI: " << RoI.zReference << " [" << RoI.zWindow[0] << ", " << RoI.zWindow[1] << "]");
78
79 return listRoIs;
80
81}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition RNGWrapper.h:169
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition RNGWrapper.h:134
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
ServiceHandle< IAthRNGSvc > m_atRndmSvc

◆ initialize()

StatusCode InDet::RandomRoISeedTool::initialize ( )
overridevirtual

Definition at line 35 of file RandomRoISeedTool.cxx.

36{
37 StatusCode sc = AlgTool::initialize();
38
39 ATH_CHECK( m_beamSpotKey.initialize() );
40
41 return sc;
42}
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ operator=()

RandomRoISeedTool & InDet::RandomRoISeedTool::operator= ( const RandomRoISeedTool & )
protecteddelete

Member Data Documentation

◆ m_atRndmSvc

ServiceHandle<IAthRNGSvc> InDet::RandomRoISeedTool::m_atRndmSvc {this, "RndmGenSvc", "AthRNGSvc", "multi-thread safe random number generator"}
protected

Definition at line 65 of file RandomRoISeedTool.h.

65{this, "RndmGenSvc", "AthRNGSvc", "multi-thread safe random number generator"};

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> InDet::RandomRoISeedTool::m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"}
protected

Definition at line 64 of file RandomRoISeedTool.h.

64{this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};

◆ m_rndmEngineName

std::string InDet::RandomRoISeedTool::m_rndmEngineName {"SINGLE"}
protected

Definition at line 67 of file RandomRoISeedTool.h.

67{"SINGLE"};// name of random engine

◆ m_z0Window

FloatProperty InDet::RandomRoISeedTool::m_z0Window {this, "TrackZ0Window", 1.0, "width of z0 window"}
protected

Definition at line 63 of file RandomRoISeedTool.h.

63{this, "TrackZ0Window", 1.0, "width of z0 window"};

The documentation for this class was generated from the following files: