ATLAS Offline Software
SegmTrack.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Package : MdtVsTgcRawDataValAlg
7 // Author: M.King(Kobe)
8 // Feb. 2011
9 //
10 // DESCRIPTION:
11 // Subject: TGC Efficiency -->TGC Efficiency plots including EIFI by comparing with MDT Segments
13 
14 #ifndef MdtVsTgcRawDataValAlg_SegmTrack
15 #define MdtVsTgcRawDataValAlg_SegmTrack
16 
18 
19 // Class to hold pointers to Segments which have been matched into a track, these Segments are not owned by this class
20 // Holds an array of 4 MuonSegment pointers, one in each MDT station
21 // Pointer is equal to zero if there is no matching segment in that station
22 class SegmTrack{
23  public:
24  // Constructor, sets all pointers to zero and side to -1
26  m_Segments[0] = 0;
27  m_Segments[1] = 0;
28  m_Segments[2] = 0;
29  m_Segments[3] = 0;
30  m_AC=-1;
31  }
32 
33  // Constructor, sets all pointers individually and gets side from them
34  SegmTrack(const Muon::MuonSegment *pSegm0, const Muon::MuonSegment *pSegm1, const Muon::MuonSegment *pSegm2, const Muon::MuonSegment *pSegm3){
35  m_Segments[0] = pSegm0;
36  m_Segments[1] = pSegm1;
37  m_Segments[2] = pSegm2;
38  m_Segments[3] = pSegm3;
39  SetSide();
40  }
41 
42  // Constructor, sets all pointers from array and gets side from them
44  m_Segments[0] = p[0];
45  m_Segments[1] = p[1];
46  m_Segments[2] = p[2];
47  m_Segments[3] = p[3];
48  SetSide();
49  }
50 
51  // Constructor, effectively copies the pointers from a different SegmTrack
52  // Pointers in new SegmTrack still point to the same actual Segments as the original
54  m_Segments[0] = p.at(0);
55  m_Segments[1] = p.at(1);
56  m_Segments[2] = p.at(2);
57  m_Segments[3] = p.at(3);
58  m_AC = p.Side();
59  }
60 
62  m_Segments[0] = p.at(0);
63  m_Segments[1] = p.at(1);
64  m_Segments[2] = p.at(2);
65  m_Segments[3] = p.at(3);
66  m_AC = p.Side();
67  return *this;
68  }
69 
70  // Indexer, gets element from pointer array
71  const Muon::MuonSegment* operator[](int j) const{
72  return at(j);
73  }
74  // At function, gets element from pointer array
75  const Muon::MuonSegment* at(int j) const{
76  if(j>3||j<0)return 0;
77  return m_Segments[j];
78  }
79  // Gets side, variable determined using the SetSide function
80  int Side() const{
81  return m_AC;
82  }
83 
84  private:
85  // SetSide function, sets m_AC variable using m_Segments array
86  void SetSide();
87  // Variables containing the side index and the Segments in this track
88  int m_AC;
90 };
91 
92 // is equal operator, returns true if the pointers point to the same segments
93 inline bool operator==(const SegmTrack& a, const SegmTrack& b){
94  for(int j=0;j<4;j++){
95  if(a.at(j)!=b.at(j))return false;
96  }
97  return true;
98 }
99 // SetSide function
100 inline void SegmTrack::SetSide(){
101  int AC=-1;
102  // Loop over segments/stations, ignore empty pointers
103  for(int jMDT=0;jMDT<4;jMDT++){
104  if(m_Segments[jMDT]==0)continue;
105  // Get Side from segment
106  int tempAC = (m_Segments[jMDT]->globalPosition().eta()<0);
107  if(AC==-1){// If first segment
108  AC = tempAC;
109  }
110  else if(AC!=tempAC){
111  // If two segments give different side values in the same track
112  std::cout<<"ERROR: SegmTrack: Segments are on different sides"<<std::endl;
113  AC=-1;
114  break;
115  }
116  }
117  m_AC=AC;
118 }
119 
120 #endif
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
SegmTrack::SegmTrack
SegmTrack(const Muon::MuonSegment *p[4])
Definition: SegmTrack.h:43
TRT_PAI_gasdata::AC
const float AC
Definition: TRT_PAI_gasdata.h:27
SegmTrack::SegmTrack
SegmTrack(const Muon::MuonSegment *pSegm0, const Muon::MuonSegment *pSegm1, const Muon::MuonSegment *pSegm2, const Muon::MuonSegment *pSegm3)
Definition: SegmTrack.h:34
SegmTrack::at
const Muon::MuonSegment * at(int j) const
Definition: SegmTrack.h:75
operator==
bool operator==(const SegmTrack &a, const SegmTrack &b)
Definition: SegmTrack.h:93
SegmTrack::operator=
SegmTrack & operator=(const SegmTrack &p)
Definition: SegmTrack.h:61
SegmTrack::operator[]
const Muon::MuonSegment * operator[](int j) const
Definition: SegmTrack.h:71
SegmTrack::SegmTrack
SegmTrack()
Definition: SegmTrack.h:25
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
SegmTrack
Definition: SegmTrack.h:22
a
TList * a
Definition: liststreamerinfos.cxx:10
SegmTrack::m_AC
int m_AC
Definition: SegmTrack.h:88
MuonSegment.h
Muon::MuonSegment::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
global position
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:157
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
SegmTrack::m_Segments
const Muon::MuonSegment * m_Segments[4]
Definition: SegmTrack.h:89
SegmTrack::Side
int Side() const
Definition: SegmTrack.h:80
SegmTrack::SegmTrack
SegmTrack(const SegmTrack &p)
Definition: SegmTrack.h:53
SegmTrack::SetSide
void SetSide()
Definition: SegmTrack.h:100