ATLAS Offline Software
EventHandler.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MuonCalibExtrTreeEvent_EventHandler_h
6 #define MuonCalibExtrTreeEvent_EventHandler_h
7 
8 #include <map>
9 #include <memory>
10 #include <string>
11 #include <vector>
12 
17 
18 namespace MuonCalib {
19 
20  class MuonCalibExtendedTrack;
21  class MuonCalibExtendedSegment;
22 
23  class EventHandler {
24  public:
25  struct AuthorIndices {
26  AuthorIndices(int s, int t) : segment{s}, track{t} {}
27  int segment;
28  int track;
29  };
30 
31  public:
34 
40 
41  using TrackVec = std::vector<ExtendedTrackPtr>;
42  using AuthorTrackVecMap = std::map<int, TrackVec>;
43 
44  using SegmentVec = std::vector<ExtendedSegmentPtr>;
45  using AuthorSegmentVecMap = std::map<int, SegmentVec>;
47  using AuthorSegmentVecCit = AuthorSegmentVecMap::const_iterator;
48 
49  public:
51  EventHandler();
52 
54  ~EventHandler();
55 
57  void clear();
58 
60  void setEvent(std::shared_ptr<const MuonCalibEvent_E> event);
61 
63  const TrackVec& extendedTracks(int author) const;
64 
66  const SegmentVec& extendedSegments(int author) const;
67 
70 
72  const MuonCalibEvent_E& event() const;
73 
75  const AuthorIndices& mooreIndices() const;
76 
78  const AuthorIndices& muonboyIndices() const;
79 
81  std::string dumpRawHits() const;
82  std::string dumpTracks() const;
83  std::string dumpTracks(const TrackVec& tracks) const;
84  std::string dumpSegments(const SegmentVec& segments) const;
85  std::string dumpSegments() const;
86  std::string dumpEvent() const;
87  void setdbg(const bool dbg_on);
88 
89  private:
91  void createExtendedTracks();
92 
95 
98 
100  void createExtendedRawHits();
101 
103  void associateSegmentsWithTracks(SegmentVec& segments, TrackVec& tracks);
104 
107 
109  int segmentOverlap(const MuonCalibExtendedSegment& segment1, const MuonCalibExtendedSegment& segment2);
110 
112  void linkTracks(int referenceIndex);
113 
115  void match(const MuonCalibExtendedTrack& reference, TrackVec& tracks);
116 
117  // data members
118  std::shared_ptr<const MuonCalibEvent_E> m_event;
122 
123  // author indices of segment and tracks in ntuple
126  bool m_debug;
127 
129  template <typename T> void split_along_barcode(const std::vector<T>& container, std::map<int, std::set<T>>& barcode_map);
130 
131  std::shared_ptr<MuonCalibTrack_E> transform_to_trk(const TruthPtr& truth_part, const std::map<int, std::set<TruthMdtPtr>>& mdt_hits,
132  const std::map<int, std::set<TruthCscPtr>>& csc_hits,
133  const std::map<int, std::set<TruthRpcPtr>>& rpc_hits,
134  const std::map<int, std::set<TruthTgcPtr>>& tgc_hits);
135  };
136 
137 } // namespace MuonCalib
138 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MuonCalib::MuonCalibExtendedRawHits::ExtendedTrkPtr
std::shared_ptr< MuonCalibExtendedTrack > ExtendedTrkPtr
Definition: MuonCalibExtendedRawHits.h:37
MuonCalib::EventHandler::m_mooreIndices
AuthorIndices m_mooreIndices
Definition: EventHandler.h:124
MuonCalib::EventHandler::match
void match(const MuonCalibExtendedTrack &reference, TrackVec &tracks)
find best match of tracks with reference
Definition: EventHandler.cxx:557
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MuonCalib::EventHandler::createExtendedTruthTracks
void createExtendedTruthTracks()
create extended tracks for event
Definition: EventHandler.cxx:245
MuonCalib::EventHandler::SegmentVec
std::vector< ExtendedSegmentPtr > SegmentVec
Definition: EventHandler.h:44
MuonCalib::EventHandler::setEvent
void setEvent(std::shared_ptr< const MuonCalibEvent_E > event)
set a new event (will call clear on the previous)
Definition: EventHandler.cxx:73
MuonCalib::EventHandler::muonboyIndices
const AuthorIndices & muonboyIndices() const
get author indices for Muonboy
Definition: EventHandler.cxx:64
MuonCalib::MuonCalibTruthCollection::TruthRpcPtr
std::shared_ptr< const MuonCalibRpcTruthHit > TruthRpcPtr
typedef of set of MuonCalibRpcTruthHit* s
Definition: MuonCalibTruthCollection.h:51
MuonCalib::EventHandler::extendedSegments
const SegmentVec & extendedSegments(int author) const
get extended tracks
Definition: EventHandler.cxx:47
MuonCalib::EventHandler::event
const MuonCalibEvent_E & event() const
get event
Definition: EventHandler.cxx:58
MuonCalib::MuonCalibExtendedRawHits
Definition: MuonCalibExtendedRawHits.h:28
MuonCalib::EventHandler::m_extendedSegments
AuthorSegmentVecMap m_extendedSegments
Definition: EventHandler.h:120
MuonCalib::EventHandler::createExtendedTracks
void createExtendedTracks()
create extended tracks for event
Definition: EventHandler.cxx:181
reference
Definition: hcg.cxx:437
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonCalib::EventHandler::TruthTgcPtr
MuonCalibTruthCollection::TruthTgcPtr TruthTgcPtr
Definition: EventHandler.h:38
MuonCalib::EventHandler::createExtendedRawHits
void createExtendedRawHits()
create extend raw hits
Definition: EventHandler.cxx:167
MuonCalib::EventHandler::ExtendedTrackPtr
MuonCalibExtendedRawHits::ExtendedTrkPtr ExtendedTrackPtr
Definition: EventHandler.h:32
MuonCalib::EventHandler::clear
void clear()
clear all buffers
Definition: EventHandler.cxx:68
MuonCalib::EventHandler::~EventHandler
~EventHandler()
default destructor
Definition: EventHandler.cxx:37
MuonCalib::EventHandler::mooreIndices
const AuthorIndices & mooreIndices() const
get author indices for Moore
Definition: EventHandler.cxx:61
MuonCalib::EventHandler::m_extendedTracks
AuthorTrackVecMap m_extendedTracks
Definition: EventHandler.h:119
MuonCalib::EventHandler::dumpEvent
std::string dumpEvent() const
Definition: EventHandler.cxx:147
MuonCalib::MuonCalibTruthCollection::TruthTgcPtr
std::shared_ptr< const MuonCalibTgcTruthHit > TruthTgcPtr
typedef of set of MuonCalibTgcTruthHit* s
Definition: MuonCalibTruthCollection.h:55
MuonCalibEvent_E.h
MuonCalib::EventHandler::TruthCscPtr
MuonCalibTruthCollection::TruthCscPtr TruthCscPtr
Definition: EventHandler.h:39
MuonCalib::EventHandler::AuthorSegmentVecMap
std::map< int, SegmentVec > AuthorSegmentVecMap
Definition: EventHandler.h:45
MuonCalib::EventHandler::AuthorTrackVecMap
std::map< int, TrackVec > AuthorTrackVecMap
Definition: EventHandler.h:42
MuonCalib::EventHandler::extendedRawHits
const MuonCalibExtendedRawHits & extendedRawHits() const
get extended raw hits
Definition: EventHandler.cxx:55
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::EventHandler::segmentOverlap
int segmentOverlap(const MuonCalibExtendedSegment &segment1, const MuonCalibExtendedSegment &segment2)
check whether segments share the same hits
Definition: EventHandler.cxx:441
MuonCalib::MuonCalibTruthCollection::TruthCscPtr
std::shared_ptr< const MuonCalibCscTruthHit > TruthCscPtr
typedef of set of MuonCalibCscTruthHit* s
Definition: MuonCalibTruthCollection.h:59
MuonCalib::EventHandler::setdbg
void setdbg(const bool dbg_on)
Definition: EventHandler.cxx:66
MuonCalib::EventHandler::AuthorIndices
Definition: EventHandler.h:25
MuonCalib::EventHandler::associateSegmentWithTrack
int associateSegmentWithTrack(const MuonCalibExtendedSegment &segment, const MuonCalibExtendedTrack &track)
check whether segment and track share the same hits
Definition: EventHandler.cxx:487
MuonCalib::EventHandler::transform_to_trk
std::shared_ptr< MuonCalibTrack_E > transform_to_trk(const TruthPtr &truth_part, const std::map< int, std::set< TruthMdtPtr >> &mdt_hits, const std::map< int, std::set< TruthCscPtr >> &csc_hits, const std::map< int, std::set< TruthRpcPtr >> &rpc_hits, const std::map< int, std::set< TruthTgcPtr >> &tgc_hits)
Definition: EventHandler.cxx:334
MuonCalib::EventHandler::linkTracks
void linkTracks(int referenceIndex)
link tracks to the reference track using the hits on the track
Definition: EventHandler.cxx:532
MuonCalibExtendedRawHits.h
MuonCalib::EventHandler::m_muonboyIndices
AuthorIndices m_muonboyIndices
Definition: EventHandler.h:125
MuonCalib::EventHandler::dumpTracks
std::string dumpTracks() const
Definition: EventHandler.cxx:153
MuonCalib::EventHandler::m_extendedRawHits
MuonCalibExtendedRawHits m_extendedRawHits
Definition: EventHandler.h:121
MuonCalib::EventHandler::AuthorSegmentVecCit
AuthorSegmentVecMap::const_iterator AuthorSegmentVecCit
Definition: EventHandler.h:47
MuonCalib::EventHandler
Definition: EventHandler.h:23
MuonCalib::MuonCalibExtendedRawHits::ExtendedSegPtr
std::shared_ptr< MuonCalibExtendedSegment > ExtendedSegPtr
Definition: MuonCalibExtendedRawHits.h:36
MuonCalibTruthCollection.h
MuonCalib::EventHandler::split_along_barcode
void split_along_barcode(const std::vector< T > &container, std::map< int, std::set< T >> &barcode_map)
Spltis the truth hit container into a map having the barcode of the particle as key.
Definition: EventHandler.cxx:237
MuonCalib::MuonCalibTruthCollection::TruthMdtPtr
std::shared_ptr< const MuonCalibMdtTruthHit > TruthMdtPtr
typedef of set of MuonCalibMdtTruthHit* s
Definition: MuonCalibTruthCollection.h:46
MuonCalib::EventHandler::m_event
std::shared_ptr< const MuonCalibEvent_E > m_event
Definition: EventHandler.h:118
MuonCalib::EventHandler::AuthorIndices::track
int track
Definition: EventHandler.h:28
MuonCalib::EventHandler::associateSegmentsWithTracks
void associateSegmentsWithTracks(SegmentVec &segments, TrackVec &tracks)
create association between tracks and segments
Definition: EventHandler.cxx:405
MuonCalib::EventHandler::TrackVec
std::vector< ExtendedTrackPtr > TrackVec
Definition: EventHandler.h:41
MuonCalib::EventHandler::TruthPtr
MuonCalibTruthCollection::TruthPtr TruthPtr
Definition: EventHandler.h:35
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
MuonCalib::EventHandler::createExtendedSegments
void createExtendedSegments()
create extended segments for event
Definition: EventHandler.cxx:388
MuonCalib::MuonCalibTruthCollection::TruthPtr
std::shared_ptr< const MuonCalibTruth > TruthPtr
typedef of a set of MuonCalibTruth* s
Definition: MuonCalibTruthCollection.h:41
MuonCalib::EventHandler::AuthorIndices::segment
int segment
Definition: EventHandler.h:27
MuonCalib::EventHandler::dumpSegments
std::string dumpSegments() const
Definition: EventHandler.cxx:133
MuonCalib::EventHandler::dumpRawHits
std::string dumpRawHits() const
dump routines
Definition: EventHandler.cxx:103
MuonCalib::EventHandler::EventHandler
EventHandler()
default constructor
Definition: EventHandler.cxx:35
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
MuonCalib::EventHandler::extendedTracks
const TrackVec & extendedTracks(int author) const
get extended tracks
Definition: EventHandler.cxx:39
MuonCalib::EventHandler::TruthMdtPtr
MuonCalibTruthCollection::TruthMdtPtr TruthMdtPtr
Definition: EventHandler.h:36
MuonCalib::EventHandler::AuthorSegmentVecIt
AuthorSegmentVecMap::iterator AuthorSegmentVecIt
Definition: EventHandler.h:46
MuonCalib::MuonCalibExtendedTrack
Definition: MuonCalibExtendedTrack.h:32
checker_macros.h
Define macros for attributes used to control the static checker.
MuonCalib::MuonCalibEvent_E
Definition: MuonCalibEvent_E.h:35
MuonCalib::EventHandler::TruthRpcPtr
MuonCalibTruthCollection::TruthRpcPtr TruthRpcPtr
Definition: EventHandler.h:37
MuonCalib::EventHandler::m_debug
bool m_debug
Definition: EventHandler.h:126
MuonCalib::MuonCalibExtendedSegment
Definition: MuonCalibExtendedSegment.h:27
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
MuonCalib::EventHandler::AuthorIndices::AuthorIndices
AuthorIndices(int s, int t)
Definition: EventHandler.h:26
MuonCalib::EventHandler::ExtendedSegmentPtr
MuonCalibExtendedRawHits::ExtendedSegPtr ExtendedSegmentPtr
Definition: EventHandler.h:33