ATLAS Offline Software
T2VertexBeamSpot.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 //============================================================
5 //
6 // T2VertexBeamSpot.cxx, (c) ATLAS Detector software
7 // Trigger/TrigAlgorithms/TrigT2BeamSpot/T2VertexBeamSpot
8 //
9 // Online beam spot measurement and monitoring using
10 // L2 recontructed primary vertices.
11 //
12 // Authors : David W. Miller, Rainer Bartoldus,
13 // Su Dong
14 //============================================================
15 
16 #include "T2VertexBeamSpot.h"
17 
18 // General ATHENA/Trigger stuff
19 #include "GaudiKernel/StatusCode.h"
21 
22 using namespace PESA;
23 
24 // Constructor
25 T2VertexBeamSpot::T2VertexBeamSpot( const std::string& name, ISvcLocator* pSvcLocator )
26  : AthReentrantAlgorithm(name, pSvcLocator)
27 {
28  declareProperty("doTrackBeamSpot", m_doTrackBeamSpot = true);
29 }
30 
32 
33  ATH_CHECK(m_beamSpotTool.retrieve());
34  ATH_CHECK(m_trackBSTool.retrieve());
35  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
36 
37  ATH_CHECK( m_trackCollectionKey.initialize() );
38 
39  return StatusCode::SUCCESS;
40 }
41 
42 StatusCode T2VertexBeamSpot::execute(const EventContext& ctx) const{
43  // Start the overall timer
44  auto tTotal = Monitored::Timer("TIME_TotalTime");
45 
46  // Retrieve tracks
48  ATH_CHECK(trackCollection.isValid());
49  const TrackCollection* tracks = trackCollection.cptr();
50 
51  // call track-based tool
52  if (m_doTrackBeamSpot) {
53  m_trackBSTool->updateBS(*tracks, ctx.eventID());
54  }
55 
56  // call vertex-based tool
57  m_beamSpotTool->updateBS(*tracks, ctx);
58 
59  //What should go as an output? SelectedTrackCollection and Vertices?
60  //Atm just try add vertex
61  //TODO: adding split vertices as well, will need an array
62 
63  auto mon = Monitored::Group(m_monTool, tTotal);
64 
65  return StatusCode::SUCCESS;
66 }
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
PESA::T2VertexBeamSpot::initialize
virtual StatusCode initialize() override final
Initialize the beamspot algorithm for Run3 Athena MT configuration, initialize all the handles and re...
Definition: T2VertexBeamSpot.cxx:31
PESA::T2VertexBeamSpot::m_beamSpotTool
ToolHandle< T2VertexBeamSpotTool > m_beamSpotTool
Definition: T2VertexBeamSpot.h:76
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PESA::T2VertexBeamSpot::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: T2VertexBeamSpot.h:78
PESA::T2VertexBeamSpot::m_doTrackBeamSpot
bool m_doTrackBeamSpot
Definition: T2VertexBeamSpot.h:73
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
PESA
Local tools.
Definition: T2BeamSpot.cxx:13
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition: TrackCollection.h:19
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
PESA::T2VertexBeamSpot::m_trackCollectionKey
SG::ReadHandleKey< TrackCollection > m_trackCollectionKey
Definition: T2VertexBeamSpot.h:80
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
PESA::T2VertexBeamSpot::m_trackBSTool
ToolHandle< T2TrackBeamSpotTool > m_trackBSTool
Definition: T2VertexBeamSpot.h:77
T2VertexBeamSpot.h
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
PESA::T2VertexBeamSpot::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Loop over events, selecting tracks and reconstructing vertices out of these tracks
Definition: T2VertexBeamSpot.cxx:42
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
PESA::T2VertexBeamSpot::T2VertexBeamSpot
T2VertexBeamSpot(const std::string &name, ISvcLocator *pSvcLocator)
std Gaudi Algorithm constructor
Definition: T2VertexBeamSpot.cxx:25