ATLAS Offline Software
MuEntryVariables.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
9 #include "CLHEP/Vector/ThreeVector.h"
11 
12 namespace MuonPRDTest{
13  MuEntryVariables::MuEntryVariables(MuonTesterTree& tree, const std::string& container_name, MSG::Level msglvl):
14  PrdTesterModule(tree, "MuEntryVariables", msglvl), m_key{container_name} {}
16 
17  bool MuEntryVariables::fill(const EventContext& ctx) {
18  ATH_MSG_DEBUG("do fillNSWMuEntryVariables()");
19  const MuonGM::MuonDetectorManager* MuonDetMgr = getDetMgr(ctx);
20  if (!MuonDetMgr) { return false; }
21  SG::ReadHandle<TrackRecordCollection> trackRecordCollection{m_key, ctx};
22  if (!trackRecordCollection.isValid()) {
23  ATH_MSG_FATAL("Failed to retrieve track collection container " << m_key.fullKey());
24  return false;
25  }
26  m_MuEntry_nParticles = trackRecordCollection->size();
27  for(const auto& it : *trackRecordCollection ) {
29  m_MuEntry_particleBarcode.push_back(it.barcode()); // FIXME barcode-based
30  const Amg::Vector3D threeMom = Amg::Hep3VectorToEigen(it.GetMomentum());
31  m_MuEntry_mom.push_back(threeMom.perp(), threeMom.eta(), threeMom.phi(), it.GetEnergy());
33  }
34  return true;
35  }
36 }
37 
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::MuEntryVariables::m_key
SG::ReadHandleKey< TrackRecordCollection > m_key
Definition: MuEntryVariables.h:23
MuonPRDTest::MuEntryVariables::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: MuEntryVariables.cxx:17
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
tree
TChain * tree
Definition: tile_monitor.h:30
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MuonPRDTest::PrdTesterModule::getDetMgr
const MuonGM::MuonDetectorManager * getDetMgr(const EventContext &ctx) const
Definition: PrdTesterModule.cxx:16
Amg::Hep3VectorToEigen
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
Definition: CLHEPtoEigenConverter.h:137
MuEntryVariables.h
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonVal::ThreeVectorBranch::push_back
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
Definition: ThreeVectorBranch.cxx:23
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonPRDTest::MuEntryVariables::m_MuEntry_mom
PtEtaPhiEBranch m_MuEntry_mom
Definition: MuEntryVariables.h:25
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::MuEntryVariables::declare_keys
bool declare_keys() override final
Definition: MuEntryVariables.cxx:15
MuonVal::VectorBranch::push_back
void push_back(const T &value)
Adds a new element at the end of the vector.
CLHEPtoEigenConverter.h
TrackRecordCollection.h
MuonVal::PtEtaPhiEBranch::push_back
void push_back(const TLorentzVector &vec)
Definition: FourVectorBranch.cxx:20
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonPRDTest::MuEntryVariables::m_MuEntry_particleBarcode
VectorBranch< int > & m_MuEntry_particleBarcode
Definition: MuEntryVariables.h:28
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
MuonPRDTest
Definition: CSCDigitVariables.h:10
MuonPRDTest::MuEntryVariables::m_MuEntry_pos
ThreeVectorBranch m_MuEntry_pos
Definition: MuEntryVariables.h:26
MuonPRDTest::MuEntryVariables::MuEntryVariables
MuEntryVariables(MuonTesterTree &tree, const std::string &container_name, MSG::Level msglvl)
Definition: MuEntryVariables.cxx:13
MuonPRDTest::MuEntryVariables::m_MuEntry_particlePdg_id
VectorBranch< int > & m_MuEntry_particlePdg_id
Definition: MuEntryVariables.h:27
MuonPRDTest::MuEntryVariables::m_MuEntry_nParticles
ScalarBranch< unsigned int > & m_MuEntry_nParticles
Definition: MuEntryVariables.h:24