ATLAS Offline Software
TrackContainerModule.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
6 
7 #include "StoreGate/ReadHandle.h"
9 
10 using namespace Acts;
11 using namespace MuonR4;
12 namespace MuonValR4{
13  TrackContainerModule::TrackContainerModule(MuonTesterTree& tree,
14  const std::string& inContainer,
15  MSG::Level msgLvl,
16  const std::string& collName):
17  TesterModuleBase{tree, inContainer, msgLvl},
18  m_key{inContainer},
19  m_collName{collName} {}
20 
22  return declare_dependency(m_key);
23  }
24  bool TrackContainerModule::fill(const EventContext& ctx){
25  const ActsTrk::TrackContainer* tracks{nullptr};
26  if (!SG::get(tracks, m_key, ctx)) {
27  return false;
28  }
29  for (const auto track : *tracks) {
30  const Amg::Vector3D trkP4 = ActsTrk::convertMomFromActs(track.fourMomentum()).first;
31  const double chi2 = track.chi2();
32  const int q = sign(track.qOverP());
33  const unsigned nDoF = track.nDoF();
34 
35  m_trackPt += trkP4.perp();
36  m_trackEta += trkP4.eta();
37  m_trackPhi += trkP4.phi();
38  m_trackQ += q;
39  m_trackNdoF += nDoF;
40  m_trackChi2 += chi2;
41  m_parentSeed += track.component<std::size_t, Acts::hashString("parentSeed")>();
42  }
43  return true;
44  }
45 }
ActsTrk::TrackContainer
Definition: TrackContainer.h:31
MuonValR4::TrackContainerModule::m_trackChi2
MuonVal::VectorBranch< float > & m_trackChi2
Definition: TrackContainerModule.h:29
MuonValR4::TrackContainerModule::m_key
SG::ReadHandleKey< ActsTrk::TrackContainer > m_key
Definition: TrackContainerModule.h:22
MuonValR4::TrackContainerModule::m_trackEta
MuonVal::VectorBranch< float > & m_trackEta
Definition: TrackContainerModule.h:26
tree
TChain * tree
Definition: tile_monitor.h:30
MuonValR4::TrackContainerModule::m_trackNdoF
MuonVal::VectorBranch< unsigned > & m_trackNdoF
Definition: TrackContainerModule.h:30
MuonValR4::TrackContainerModule::m_trackPhi
MuonVal::VectorBranch< float > & m_trackPhi
Definition: TrackContainerModule.h:27
MatrixUtils.h
MuonVal::MuonTesterBranch::tree
TTree * tree() override final
Returns the underlying TTree object.
Definition: MuonTesterBranch.cxx:53
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonValR4::TrackContainerModule::m_parentSeed
MuonVal::VectorBranch< unsigned > & m_parentSeed
Definition: TrackContainerModule.h:31
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
AthMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level.
Definition: AthMessaging.h:151
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
Acts
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/UtilFunctions.h:20
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition: ReadCondHandle.h:283
UnitConverters.h
MuonValR4::TrackContainerModule::fill
bool fill(const EventContext &ctx) override final
The fill method checks if enough information is provided such that the branch is cleared from the inf...
Definition: TrackContainerModule.cxx:24
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:525
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:108
ActsTrk::convertMomFromActs
std::pair< Amg::Vector3D, double > convertMomFromActs(const Acts::Vector4 &actsMom)
Converts an Acts four-momentum vector into an pair of an Athena three-momentum and the paritcle's ene...
Definition: UnitConverters.h:109
MuonValR4::TesterModuleBase
Definition: TesterModuleBase.h:15
MuonValR4
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
Definition: IPatternVisualizationTool.h:23
MuonValR4::TrackContainerModule::m_trackPt
MuonVal::VectorBranch< float > & m_trackPt
Definition: TrackContainerModule.h:25
MuonValR4::TrackContainerModule::m_trackQ
MuonVal::VectorBranch< int > & m_trackQ
Definition: TrackContainerModule.h:28
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
TrackContainerModule.h
MuonValR4::TrackContainerModule::declare_keys
bool declare_keys() override final
Definition: TrackContainerModule.cxx:21
extractSporadic.q
list q
Definition: extractSporadic.py:97
xAOD::track
@ track
Definition: TrackingPrimitives.h:513
ReadHandle.h
Handle class for reading from StoreGate.