ATLAS Offline Software
SegmentVariables.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
6 #include <StoreGate/ReadHandle.h>
7 
8 namespace MuonPRDTest {
10  const std::string& containerKey,
11  const std::string& outName,
12  MSG::Level msglvl) :
13  PrdTesterModule(tree, "Segments"+ containerKey+outName, msglvl),
14  m_key{containerKey},
15  m_name{outName}{}
16 
17  bool SegmentVariables::fill(const EventContext& ctx) {
19  if(!readHandle.isPresent()) {
20  ATH_MSG_FATAL("Failed to retrieve "<<m_key.fullKey());
21  return false;
22  }
23  if (!m_filterMode) {
24  for (const xAOD::MuonSegment* segment : *readHandle){
25  fill(*segment);
26  }
27  }
28  m_idxLookUp.clear();
29  return true;
30  }
32  return declare_dependency(m_key);
33  }
35  m_filterMode = true;
36  return fill(segment);
37  }
39  auto insert_itr = m_idxLookUp.insert(std::make_pair(&segment, m_idxLookUp.size()));
40  if (!insert_itr.second) {
41  return insert_itr.first->second;
42  }
43  m_pos.push_back(segment.x(), segment.y(), segment.z());
44  m_dir.push_back(segment.px(), segment.py(), segment.pz());
45  m_etaIdx += segment.etaIndex();
46  m_sector += segment.sector();
47  m_chamberIdx +=segment.chamberIndex();
48  m_chi2 +=segment.chiSquared();
49  m_nDoF +=segment.numberDoF();
50 
51  m_nPrecHits += segment.nPrecisionHits();
52  m_nTrigEtaLayers += segment.nTrigEtaLayers();
53  m_nTrigPhiLayers += segment.nPhiLayers();
54 
55  return insert_itr.first->second;
56  }
57 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::SegmentVariables::m_nTrigEtaLayers
VectorBranch< uint8_t > & m_nTrigEtaLayers
Definition: SegmentVariables.h:41
MuonPRDTest::SegmentVariables::push_back
unsigned int push_back(const xAOD::MuonSegment &segment)
Definition: SegmentVariables.cxx:34
MuonPRDTest::SegmentVariables::m_idxLookUp
std::unordered_map< const xAOD::MuonSegment *, unsigned int > m_idxLookUp
Definition: SegmentVariables.h:45
MuonPRDTest::SegmentVariables::declare_keys
bool declare_keys() override final
Definition: SegmentVariables.cxx:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonPRDTest::SegmentVariables::m_filterMode
bool m_filterMode
Definition: SegmentVariables.h:44
MuonPRDTest::SegmentVariables::m_key
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_key
Definition: SegmentVariables.h:26
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
MuonPRDTest::SegmentVariables::m_sector
VectorBranch< uint8_t > & m_sector
Definition: SegmentVariables.h:34
MuonPRDTest::SegmentVariables::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: SegmentVariables.cxx:17
MuonPRDTest::SegmentVariables::m_nDoF
VectorBranch< unsigned int > & m_nDoF
Definition: SegmentVariables.h:38
MuonVal::MuonTesterBranch::declare_dependency
bool declare_dependency(Key &key)
Declares the ReadHandle/ ReadCondHandleKey as data dependency of the algorithm.
MuonPRDTest::SegmentVariables::m_chamberIdx
VectorBranch< uint8_t > & m_chamberIdx
Definition: SegmentVariables.h:36
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
MuonPRDTest::PrdTesterModule
Definition: PrdTesterModule.h:15
MuonPRDTest::SegmentVariables::m_etaIdx
VectorBranch< char > & m_etaIdx
Definition: SegmentVariables.h:33
MuonPRDTest::SegmentVariables::SegmentVariables
SegmentVariables(MuonTesterTree &tree, const std::string &containerKey, const std::string &outName, MSG::Level msglvl)
Definition: SegmentVariables.cxx:9
MuonPRDTest::SegmentVariables::m_dir
ThreeVectorBranch m_dir
Definition: SegmentVariables.h:31
TestSUSYToolsAlg.outName
string outName
Definition: TestSUSYToolsAlg.py:173
MuonPRDTest::SegmentVariables::m_pos
ThreeVectorBranch m_pos
Definition: SegmentVariables.h:30
MuonPRDTest::SegmentVariables::m_chi2
VectorBranch< float > & m_chi2
Definition: SegmentVariables.h:37
MuonPRDTest
Definition: CSCDigitVariables.h:10
SegmentVariables.h
ReadHandle.h
Handle class for reading from StoreGate.
MuonPRDTest::SegmentVariables::m_nPrecHits
VectorBranch< uint8_t > & m_nPrecHits
Definition: SegmentVariables.h:40
MuonPRDTest::SegmentVariables::m_nTrigPhiLayers
VectorBranch< uint8_t > & m_nTrigPhiLayers
Definition: SegmentVariables.h:42
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5