ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecTools
ZWindowRoISeedTool
src
RandomRoISeedTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2020-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// Implementation file for class RandomRoISeedTool
8
// (c) ATLAS Detector software
10
11
12
#include "
ZWindowRoISeedTool/RandomRoISeedTool.h
"
13
#include "
AthenaKernel/RNGWrapper.h
"
14
15
#include "TVector2.h"
16
#include "CLHEP/Random/RandGauss.h"
17
18
#include <map>
19
20
22
// Constructor
24
25
InDet::RandomRoISeedTool::RandomRoISeedTool
26
(
const
std::string& t,
const
std::string& n,
const
IInterface* p)
27
: base_class(t,n,p)
28
{
29
}
30
32
// Initialization
34
35
StatusCode
InDet::RandomRoISeedTool::initialize
()
36
{
37
StatusCode
sc
= AlgTool::initialize();
38
39
ATH_CHECK
(
m_beamSpotKey
.initialize() );
40
41
return
sc
;
42
}
43
45
// Compute RoI
47
48
std::vector<InDet::IZWindowRoISeedTool::ZWindow>
InDet::RandomRoISeedTool::getRoIs
(
const
EventContext& ctx)
const
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
}
82
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
RNGWrapper.h
RandomRoISeedTool.h
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition
RNGWrapper.h:56
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition
RNGWrapper.h:154
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition
RNGWrapper.h:108
InDet::IZWindowRoISeedTool::ZWindow
Definition
IZWindowRoISeedTool.h:46
InDet::IZWindowRoISeedTool::ZWindow::zReference
float zReference
Definition
IZWindowRoISeedTool.h:51
InDet::IZWindowRoISeedTool::ZWindow::zWindow
float zWindow[2]
Definition
IZWindowRoISeedTool.h:49
InDet::RandomRoISeedTool::RandomRoISeedTool
RandomRoISeedTool()=delete
InDet::RandomRoISeedTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition
RandomRoISeedTool.h:64
InDet::RandomRoISeedTool::m_z0Window
FloatProperty m_z0Window
Definition
RandomRoISeedTool.h:63
InDet::RandomRoISeedTool::m_atRndmSvc
ServiceHandle< IAthRNGSvc > m_atRndmSvc
Definition
RandomRoISeedTool.h:65
InDet::RandomRoISeedTool::initialize
virtual StatusCode initialize() override
Definition
RandomRoISeedTool.cxx:35
InDet::RandomRoISeedTool::m_rndmEngineName
std::string m_rndmEngineName
Definition
RandomRoISeedTool.h:67
InDet::RandomRoISeedTool::getRoIs
virtual std::vector< ZWindow > getRoIs(const EventContext &ctx) const override
Compute RoI.
Definition
RandomRoISeedTool.cxx:48
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:204
Generated on
for ATLAS Offline Software by
1.17.0