Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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) {
18  SG::ReadHandle readHandle{m_key, 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  }
38  bool SegmentVariables::addVariable(std::shared_ptr<IAuxElementDecorationBranch> br) {
39  m_addBranches.push_back(br);
40  return parent().addBranch(br);
41  }
43  auto insert_itr = m_idxLookUp.insert(std::make_pair(&segment, m_idxLookUp.size()));
44  if (!insert_itr.second) {
45  return insert_itr.first->second;
46  }
47  m_pos.push_back(segment.position());
48  m_dir.push_back(segment.direction());
49  m_etaIdx += segment.etaIndex();
50  m_sector += segment.sector();
51  m_chamberIdx +=segment.chamberIndex();
52  m_chi2 +=segment.chiSquared();
53  m_nDoF +=segment.numberDoF();
54 
55  m_nPrecHits += segment.nPrecisionHits();
56  m_nTrigEtaLayers += segment.nTrigEtaLayers();
57  m_nTrigPhiLayers += segment.nPhiLayers();
58  for(const auto& br : m_addBranches){
59  br->push_back(segment);
60  }
61 
62  return insert_itr.first->second;
63  }
64 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonPRDTest::SegmentVariables::m_nTrigEtaLayers
VectorBranch< uint8_t > & m_nTrigEtaLayers
Number of trigger hits, i.e.
Definition: SegmentVariables.h:54
MuonPRDTest::SegmentVariables::push_back
unsigned int push_back(const xAOD::MuonSegment &segment)
push back a particuar segment
Definition: SegmentVariables.cxx:34
MuonPRDTest::SegmentVariables::m_idxLookUp
std::unordered_map< const xAOD::MuonSegment *, unsigned int > m_idxLookUp
Definition: SegmentVariables.h:60
MuonPRDTest::SegmentVariables::m_addBranches
std::vector< std::shared_ptr< IAuxElementDecorationBranch > > m_addBranches
Definition: SegmentVariables.h:58
MuonPRDTest::SegmentVariables::declare_keys
bool declare_keys() override final
Definition: SegmentVariables.cxx:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
MuonPRDTest::SegmentVariables::m_filterMode
bool m_filterMode
Definition: SegmentVariables.h:59
MuonPRDTest::SegmentVariables::m_key
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_key
Store gate key of the segment container.
Definition: SegmentVariables.h:34
tree
TChain * tree
Definition: tile_monitor.h:30
xAOD::MuonSegment_v1
Class describing a MuonSegment.
Definition: MuonSegment_v1.h:33
MuonPRDTest::SegmentVariables::addVariable
bool addVariable(std::shared_ptr< IAuxElementDecorationBranch > br)
Definition: SegmentVariables.cxx:38
m_name
std::string m_name
Definition: ColumnarPhysliteTest.cxx:53
MuonPRDTest::SegmentVariables::m_sector
VectorBranch< uint8_t > & m_sector
MS-sector of the segment's precision hits.
Definition: SegmentVariables.h:44
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
number of degrees of freedom
Definition: SegmentVariables.h:50
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
MS station of the segment.
Definition: SegmentVariables.h:46
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
Station-eta index of the segment's precision hits.
Definition: SegmentVariables.h:42
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
Global direction of the segment.
Definition: SegmentVariables.h:40
TestSUSYToolsAlg.outName
string outName
Definition: TestSUSYToolsAlg.py:173
MuonVal::MuonTesterBranch::parent
MuonTesterTree & parent()
Returns the reference to the MuonTesterTree parent.
Definition: MuonTesterBranch.cxx:38
MuonPRDTest::SegmentVariables::m_pos
ThreeVectorBranch m_pos
Global position of the segment.
Definition: SegmentVariables.h:38
MuonPRDTest::SegmentVariables::m_chi2
VectorBranch< float > & m_chi2
chi 2 of the segment fit
Definition: SegmentVariables.h:48
MuonPRDTest
Definition: MuonHitTesterAlg.h:15
SegmentVariables.h
ReadHandle.h
Handle class for reading from StoreGate.
MuonPRDTest::SegmentVariables::m_nPrecHits
VectorBranch< uint8_t > & m_nPrecHits
Number of precision hits i.e.
Definition: SegmentVariables.h:52
MuonPRDTest::SegmentVariables::m_nTrigPhiLayers
VectorBranch< uint8_t > & m_nTrigPhiLayers
Number of trigger hits, i.e.
Definition: SegmentVariables.h:56
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
MuonVal::MuonTesterTree::addBranch
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
Definition: MuonTesterTree.cxx:61
PlotCalibFromCool.br
br
Definition: PlotCalibFromCool.py:355