ATLAS Offline Software
SortInDetCandidates.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONCOMBINED_SORTINDETCANDIDATES
6 #define MUONCOMBINED_SORTINDETCANDIDATES
7 
14 
15 namespace MuonCombined {
16 
18  public:
19  bool operator()(const std::pair<const InDetCandidate*, std::vector<const TagBase*> >& c1,
20  const std::pair<const InDetCandidate*, std::vector<const TagBase*> >& c2) const {
21  if (c1.second.empty() || c2.second.empty()) { return c1.second.empty(); }
22 
23  const TagBase& t1 = *c1.second.front();
24  const TagBase& t2 = *c2.second.front();
25  // compare based on author/type
26  bool s1 = t1 < t2;
27  bool s2 = t2 < t1;
28  if (s1 && !s2) return true;
29  if (s2 && !s1) return false;
30 
31  // if we get here we have the same author and type
32  // this is not too elegant, maybe rethink implementation
33  if (t1.type() == xAOD::Muon::Combined) {
34  // work out type of tag
35  const CombinedFitTag* cbFitTag1 = dynamic_cast<const CombinedFitTag*>(&t1);
36  if (cbFitTag1) {
37  const CombinedFitTag* cbFitTag2 = dynamic_cast<const CombinedFitTag*>(&t2);
38  if (!cbFitTag2) return false;
39  return *cbFitTag1 < *cbFitTag2;
40  }
41  const StacoTag* stacoTag1 = dynamic_cast<const StacoTag*>(&t1);
42  if (stacoTag1) {
43  const StacoTag* stacoTag2 = dynamic_cast<const StacoTag*>(&t2);
44  if (!stacoTag2) return false;
45  return *stacoTag1 < *stacoTag2;
46  }
47  const MuGirlTag* muGirlTag1 = dynamic_cast<const MuGirlTag*>(&t1);
48  if (muGirlTag1) {
49  const MuGirlTag* muGirlTag2 = dynamic_cast<const MuGirlTag*>(&t2);
50  if (!muGirlTag2) return false;
51  return *muGirlTag1 < *muGirlTag2;
52  }
53  return false;
54  } else if (t1.type() == xAOD::Muon::SegmentTagged) {
55  const SegmentTag* segmentTag1 = dynamic_cast<const SegmentTag*>(&t1);
56  if (segmentTag1) {
57  const SegmentTag* segmentTag2 = dynamic_cast<const SegmentTag*>(&t2);
58  if (!segmentTag2) return false;
59  return *segmentTag1 < *segmentTag2;
60  }
61  const MuGirlTag* muGirlTag1 = dynamic_cast<const MuGirlTag*>(&t1);
62  if (muGirlTag1) {
63  const MuGirlTag* muGirlTag2 = dynamic_cast<const MuGirlTag*>(&t2);
64  if (!muGirlTag2) return false;
65  return *muGirlTag1 < *muGirlTag2;
66  }
67  return false;
68  } else if (t1.type() == xAOD::Muon::CaloTagged) {
69  const CaloTag* caloTag1 = dynamic_cast<const CaloTag*>(&t1);
70  if (caloTag1) {
71  const CaloTag* caloTag2 = dynamic_cast<const CaloTag*>(&t2);
72  if (!caloTag2) return false;
73  return *caloTag1 < *caloTag2;
74  }
75  return false;
76  }
77  return false;
78  }
79  };
80 
81 } // namespace MuonCombined
82 
83 #endif
MuonCombined::SegmentTag
TagBase implementation for a segment tagger.
Definition: SegmentTag.h:14
extractSporadic.c1
c1
Definition: extractSporadic.py:134
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
MuonCombined::InDetCandidate
Definition: InDetCandidate.h:18
MuonCombined::StacoTag
TagBase implementation for a combined fit.
Definition: StacoTag.h:22
MuonCombined::SortInDetCandidates::operator()
bool operator()(const std::pair< const InDetCandidate *, std::vector< const TagBase * > > &c1, const std::pair< const InDetCandidate *, std::vector< const TagBase * > > &c2) const
Definition: SortInDetCandidates.h:19
MuonCombined::CombinedFitTag
TagBase implementation for a combined fit.
Definition: CombinedFitTag.h:24
CaloTag.h
InDetCandidate.h
MuonCombined::SortInDetCandidates
Definition: SortInDetCandidates.h:17
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
SegmentTag.h
MuonCombined::CaloTag
TagBase implementation for a calo tag.
Definition: CaloTag.h:17
MuonCombined::MuGirlTag
TagBase implementation for a combined fit.
Definition: MuGirlTag.h:23
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
python.DataFormatRates.c2
c2
Definition: DataFormatRates.py:123
MuonCombined
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
Definition: IMuonSystemExtensionTool.h:23
CombinedFitTag.h
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
StacoTag.h
MuGirlTag.h
MuonCombined::TagBase
base-class for combined reconstruction output Provides access to MuonType and Author
Definition: TagBase.h:48