ATLAS Offline Software
EstimatedTrackParamsAnalysisAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace ActsTrk {
8 
10  ISvcLocator* pSvcLocator)
11  : AthMonitorAlgorithm(name, pSvcLocator)
12  {}
13 
15  ATH_MSG_INFO("Initializing " << name() << " ...");
16 
18 
19  ATH_MSG_DEBUG("Monitoring settings ...");
21 
23  }
24 
26  ATH_MSG_DEBUG( "Filling Histograms for " << name() << " ... " );
27 
29  ATH_CHECK( trackParamsHandle.isValid() );
30  const ActsTrk::BoundTrackParametersContainer *trackParams = trackParamsHandle.get();
31  ATH_MSG_DEBUG( "Retrieved " << trackParams->size() << " input parameters with key " << m_inputTrackParamsColletionKey.key() );
32 
33  auto monitor_nparams = Monitored::Scalar<int>("Nparams", trackParams->size());
34  fill(m_monGroupName.value(), monitor_nparams);
35 
36  auto monitor_pt = Monitored::Collection("track_param_pt", *trackParams,
37  [] (const auto* param) -> double
38  { return param->transverseMomentum(); });
39  auto monitor_eta = Monitored::Collection("track_param_eta", *trackParams,
40  [] (const auto* param) -> double
41  { return -std::log( std::tan(0.5 * param->parameters()[Acts::eBoundTheta]) ); });
42  auto monitor_loc0 = Monitored::Collection("track_param_loc0", *trackParams,
43  [] (const auto* param) -> double
44  { return param->parameters()[Acts::eBoundLoc0]; });
45  auto monitor_loc1 = Monitored::Collection("track_param_loc1", *trackParams,
46  [] (const auto* param) -> double
47  { return param->parameters()[Acts::eBoundLoc1]; });
48  auto monitor_phi = Monitored::Collection("track_param_phi", *trackParams,
49  [] (const auto* param) -> double
50  { return param->parameters()[Acts::eBoundPhi]; });
51  auto monitor_theta = Monitored::Collection("track_param_theta", *trackParams,
52  [] (const auto* param) -> double
53  { return param->parameters()[Acts::eBoundTheta]; });
54  auto monitor_qOverP = Monitored::Collection("track_param_qoverp", *trackParams,
55  [] (const auto* param) -> double
56  { return param->parameters()[Acts::eBoundQOverP]; });
57  auto monitor_time = Monitored::Collection("track_param_time", *trackParams,
58  [] (const auto* param) -> double
59  { return param->parameters()[Acts::eBoundTime]; });
60 
61  auto monitor_charge = Monitored::Collection("track_param_charge", *trackParams,
62  [] (const auto* param) -> int
63  { return param->charge(); });
64 
65  fill(m_monGroupName.value(),
66  monitor_pt, monitor_eta,
67  monitor_loc0, monitor_loc1,
68  monitor_phi, monitor_theta,
69  monitor_qOverP,
70  monitor_time,
71  monitor_charge);
72 
73  return StatusCode::SUCCESS;
74  }
75 
76 }
ActsTrk::EstimatedTrackParamsAnalysisAlg::EstimatedTrackParamsAnalysisAlg
EstimatedTrackParamsAnalysisAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: EstimatedTrackParamsAnalysisAlg.cxx:9
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
ActsTrk::EstimatedTrackParamsAnalysisAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: EstimatedTrackParamsAnalysisAlg.cxx:14
ActsTrk::EstimatedTrackParamsAnalysisAlg::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: EstimatedTrackParamsAnalysisAlg.cxx:25
EstimatedTrackParamsAnalysisAlg.h
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
ActsTrk::EstimatedTrackParamsAnalysisAlg::m_monGroupName
Gaudi::Property< std::string > m_monGroupName
Definition: EstimatedTrackParamsAnalysisAlg.h:28
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ActsTrk::EstimatedTrackParamsAnalysisAlg::m_inputTrackParamsColletionKey
SG::ReadHandleKey< ActsTrk::BoundTrackParametersContainer > m_inputTrackParamsColletionKey
Definition: EstimatedTrackParamsAnalysisAlg.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:49
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.