ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Trk::DummyVertexSelectionTool Class Reference

#include <DummyVertexSelectionTool.h>

Inheritance diagram for Trk::DummyVertexSelectionTool:
Collaboration diagram for Trk::DummyVertexSelectionTool:

Public Member Functions

virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 EndOfInitialize. More...
 
 DummyVertexSelectionTool (const std::string &t, const std::string &n, const IInterface *p)
 constructor More...
 
virtual ~DummyVertexSelectionTool ()
 destructor More...
 
virtual unsigned int findVertexInContainer (const xAOD::VertexContainer *) const override
 

Private Attributes

ServiceHandle< IAthRNGSvcm_randomSvc { this, "RndmSvc", "AthRNGSvc", ""}
 Pointer to the random number generator service. More...
 
std::string m_randomEngineName
 Name of the random number stream. More...
 

Detailed Description

Author
Kirill Prokofiev, January 2012 A test class, meant to be an example of correct implementation for the veretx selector.

Changes:

David Shope david.nosp@m..ric.nosp@m.hard..nosp@m.shop.nosp@m.e@cer.nosp@m.n.ch (2016-06-01)

EDM Migration to xAOD - replace VxContainer with xAOD::VertexContainer

Definition at line 36 of file DummyVertexSelectionTool.h.

Constructor & Destructor Documentation

◆ DummyVertexSelectionTool()

Trk::DummyVertexSelectionTool::DummyVertexSelectionTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

constructor

Definition at line 14 of file DummyVertexSelectionTool.cxx.

15  : base_class ( t,n,p ),m_randomEngineName("VertexRnd")
16  {
17  declareProperty("RandomStreamName", m_randomEngineName, "Name of the random number stream");
18  }

◆ ~DummyVertexSelectionTool()

Trk::DummyVertexSelectionTool::~DummyVertexSelectionTool ( )
virtualdefault

destructor

Member Function Documentation

◆ finalize()

StatusCode Trk::DummyVertexSelectionTool::finalize ( )
overridevirtual

EndOfInitialize.

Definition at line 30 of file DummyVertexSelectionTool.cxx.

31  {
32  return StatusCode::SUCCESS;
33  }

◆ findVertexInContainer()

unsigned int Trk::DummyVertexSelectionTool::findVertexInContainer ( const xAOD::VertexContainer vertexContainer) const
overridevirtual

Definition at line 35 of file DummyVertexSelectionTool.cxx.

36  {
37  if(vertexContainer->size()>2)
38  {
39 
40  // Get the RNG engine. Reseed if a new event.
41  const EventContext& ctx = Gaudi::Hive::currentContext();
42  ATHRNG::RNGWrapper* wrapper = m_randomSvc->getEngine(this, m_randomEngineName);
43  if (wrapper->evtSeeded (ctx) != ctx.evt()) {
44  wrapper->setSeed (name(), ctx);
45  }
46  CLHEP::HepRandomEngine* engine = wrapper->getEngine (ctx);
47 
48 //only do anything if >1 real vertex is actually present
49  if( CLHEP::RandFlat::shoot(engine)>0.9)
50  {
51 //and only in 10% of cases let us randomize the vertex choice
52  unsigned int ivtx = (unsigned int)( CLHEP::RandFlat::shoot(engine) * vertexContainer->size());
53 
54  ATH_MSG_VERBOSE("Vertex Selection changed to " << ivtx << "!");
55  return ivtx;
56 
57  }//end of random selection
58  ATH_MSG_VERBOSE("Vertex Selection unchanged!");
59 
60  }//end of VertexContainer size check
61 
62 //nothing happened, return the default primary vertex position
63  return 0;
64  }

◆ initialize()

StatusCode Trk::DummyVertexSelectionTool::initialize ( )
overridevirtual

Definition at line 24 of file DummyVertexSelectionTool.cxx.

25  {
26  ATH_CHECK( m_randomSvc.retrieve() );
27  return StatusCode::SUCCESS;
28  }

Member Data Documentation

◆ m_randomEngineName

std::string Trk::DummyVertexSelectionTool::m_randomEngineName
private

Name of the random number stream.

Definition at line 62 of file DummyVertexSelectionTool.h.

◆ m_randomSvc

ServiceHandle<IAthRNGSvc> Trk::DummyVertexSelectionTool::m_randomSvc { this, "RndmSvc", "AthRNGSvc", ""}
private

Pointer to the random number generator service.

< Random Svc

Definition at line 60 of file DummyVertexSelectionTool.h.


The documentation for this class was generated from the following files:
ATHRNG::RNGWrapper::setSeed
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Definition: RNGWrapper.h:169
Trk::DummyVertexSelectionTool::m_randomEngineName
std::string m_randomEngineName
Name of the random number stream.
Definition: DummyVertexSelectionTool.h:62
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
beamspotman.n
n
Definition: beamspotman.py:731
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ATHRNG::RNGWrapper
A wrapper class for event-slot-local random engines.
Definition: RNGWrapper.h:56
ATHRNG::RNGWrapper::getEngine
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
Definition: RNGWrapper.h:134
ATHRNG::RNGWrapper::evtSeeded
EventContext::ContextEvt_t evtSeeded() const
Return the event count at which the current slot was last seeded.
Definition: RNGWrapper.h:139
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Trk::DummyVertexSelectionTool::m_randomSvc
ServiceHandle< IAthRNGSvc > m_randomSvc
Pointer to the random number generator service.
Definition: DummyVertexSelectionTool.h:61