ATLAS Offline Software
MuonRoI_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: MuonRoI_v1.cxx 579914 2014-01-24 10:15:15Z krasznaa $
6 
7 // xAOD include(s):
9 
10 // Local include(s):
12 
13 // get bitsmasks from common definition source:
15 using namespace LVL1::MuCTPIBits;
16 
17 namespace xAOD{
18 
19  MuonRoI_v1::MuonRoI_v1()
20  : SG::AuxElement() {
21 
22  }
23 
33  void MuonRoI_v1::initialize( uint32_t roiword, float eta, float phi,
34  const std::string& thrname, float thrvalue ) {
35 
36  setRoIWord( roiword );
37  setEta( eta );
38  setPhi( phi );
39  setThrValue( thrvalue );
40  setThrName( thrname );
41 
42  return;
43  }
44 
46  //
47  // Raw/simple data accessor functions
48  //
49 
53  setRoIWord )
55  setThrValue )
56 
57 
58  AUXSTORE_OBJECT_SETTER_AND_GETTER( MuonRoI_v1, std::string, thrName,
59  setThrName )
60 
61  //
63 
65  //
66  // Implementation of the RoI word decoder functions
67  //
68 
75  int MuonRoI_v1::getThrNumber() const {
76 
77  if (isRun3()) return ( ( roiWord() >> RUN3_CAND_PT_SHIFT ) & RUN3_CAND_PT_MASK );
78  else return ( ( roiWord() >> CAND_PT_SHIFT ) & CAND_PT_MASK );
79  }
80 
88  int MuonRoI_v1::getRoI() const {
89 
90  if (isRun3()) {
91  if( this->getSource() == Forward ) {
92  return ( ( roiWord() >> RUN3_ROI_SHIFT ) & FORWARD_ROI_MASK );
93  } else if( this->getSource() == Endcap ) {
94  return ( ( roiWord() >> RUN3_ROI_SHIFT ) & ENDCAP_ROI_MASK );
95  } else if( this->getSource() == Barrel ) {
96  return ( ( roiWord() >> RUN3_ROI_SHIFT ) & BARREL_ROI_MASK );
97  }
98  }
99  else
100  {
101  if( this->getSource() == Forward ) {
102  return ( ( roiWord() >> ROI_SHIFT ) & FORWARD_ROI_MASK );
103  } else if( this->getSource() == Endcap ) {
104  return ( ( roiWord() >> ROI_SHIFT ) & ENDCAP_ROI_MASK );
105  } else if( this->getSource() == Barrel ) {
106  return ( ( roiWord() >> ROI_SHIFT ) & BARREL_ROI_MASK );
107  }
108  }
109  return 0;
110  }
111 
122  int MuonRoI_v1::getSectorAddress() const {
123 
124  if (isRun3()) return ( ( roiWord() >> RUN3_CAND_SECTOR_ADDRESS_SHIFT ) & CAND_SECTOR_ADDRESS_MASK );
125  else return ( ( roiWord() >> CAND_SECTOR_ADDRESS_SHIFT ) & CAND_SECTOR_ADDRESS_MASK );
126  }
127 
133  int MuonRoI_v1::getSectorID() const {
134 
135  if (isRun3()) {
136  if( this->getSource() == Forward ) {
137  return ( ( roiWord() >> RUN3_CAND_SECTORID_SHIFT ) & FORWARD_SECTORID_MASK );
138  } else if( this->getSource() == Endcap ) {
139  return ( ( roiWord() >> RUN3_CAND_SECTORID_SHIFT ) & ENDCAP_SECTORID_MASK );
140  } else if( this->getSource() == Barrel ) {
141  return ( ( roiWord() >> RUN3_CAND_SECTORID_SHIFT ) & BARREL_SECTORID_MASK );
142  }
143  } else {
144  if( this->getSource() == Forward ) {
145  return ( ( roiWord() >> CAND_SECTORID_SHIFT ) & FORWARD_SECTORID_MASK );
146  } else if( this->getSource() == Endcap ) {
147  return ( ( roiWord() >> CAND_SECTORID_SHIFT ) & ENDCAP_SECTORID_MASK );
148  } else if( this->getSource() == Barrel ) {
149  return ( ( roiWord() >> CAND_SECTORID_SHIFT ) & BARREL_SECTORID_MASK );
150  }
151  }
152  return 0;
153  }
154 
162  bool MuonRoI_v1::isFirstCandidate() const {
163 
164  if (isRun3()) return true; // undefined in run3, return default true
165  else return ( ( roiWord() >> CAND_HIGHEST_PT_SHIFT ) & CAND_HIGHEST_PT_MASK );
166  }
167 
173  bool MuonRoI_v1::isMoreCandInRoI() const {
174 
175  if (isRun3()) {
176  if (getSource() == Barrel) return ( ( roiWord() >> RUN3_ROI_OVERFLOW_SHIFT ) & ROI_OVERFLOW_MASK );
177  else return false; // Endcap + Fwd have no flag for this
178  } else return ( ( roiWord() >> ROI_OVERFLOW_SHIFT ) & ROI_OVERFLOW_MASK );
179  }
180 
186  bool MuonRoI_v1::isMoreCandInSector() const {
187 
188  if (isRun3()) return ( ( roiWord() >> RUN3_CAND_OVERFLOW_SHIFT ) & CAND_OVERFLOW_MASK );
189  else return ( ( roiWord() >> CAND_OVERFLOW_SHIFT ) & CAND_OVERFLOW_MASK );
190  }
191 
199 
200  //same mask for run2 and run3
201  if( this->getSectorAddress() & ENDCAP_ADDRESS_MASK ) {
202  return Endcap;
203  } else if( this->getSectorAddress() & FORWARD_ADDRESS_MASK ) {
204  return Forward;
205  } else {
206  return Barrel;
207  }
208  }
209 
217 
218  //same mask for run2 and run3
219  if( this->getSectorAddress() & SECTOR_HEMISPHERE_MASK ) {
220  return Positive;
221  } else {
222  return Negative;
223  }
224  }
225 
230  bool MuonRoI_v1::getPhiOverlap() const {
231  if (isRun3()) {
232  if (getSource() == Barrel) return (roiWord() >> RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_SHIFT) & RUN3_CAND_WORD_CANDFLAGS_BA_PHIOVERLAP_MASK;
233  else return false;
234  } else {
235  if (getSource() == Barrel) return (roiWord() >> BARREL_OL_SHIFT) & BARREL_PHI_OL_MASK;
236  else return false;
237  }
238  }
239 
244  bool MuonRoI_v1::getEtaOverlap() const {
245  if (isRun3()) return false;
246  else {
247  if (getSource() == Barrel) return (roiWord() >> BARREL_OL_SHIFT) & BARREL_ETA_OL_MASK;
248  else return (roiWord() >> ENDCAP_OL_SHIFT) & ENDCAP_OL_MASK;
249  }
250  }
251 
259 
260  if( getSource() == Barrel ) return Undef;
261 
262  if (isRun3()) {
263  if( ( roiWord() >> RUN3_CAND_TGC_CHARGE_SIGN_SHIFT) & 0x1 ) {
264  return Pos;
265  } else {
266  return Neg;
267  }
268  } else {
269  if( ( roiWord() >> CAND_TGC_CHARGE_SIGN_SHIFT) & 0x1 ) {
270  return Pos;
271  } else {
272  return Neg;
273  }
274  }
275  }
276 
280  bool MuonRoI_v1::getBW3Coincidence() const {
281  if (isRun3() && getSource() != Barrel) return (roiWord() >> RUN3_CAND_TGC_BW2OR3_SHIFT) & 0x1;
282  else return false;
283  }
284 
285 
289  bool MuonRoI_v1::getInnerCoincidence() const {
290  if (isRun3() && getSource() != Barrel) return (roiWord() >> RUN3_CAND_TGC_INNERCOIN_SHIFT) & 0x1;
291  else return false;
292  }
293 
294 
298  bool MuonRoI_v1::getGoodMF() const {
299  if (isRun3() && getSource() != Barrel) return (roiWord() >> RUN3_CAND_TGC_GOODMF_SHIFT) & 0x1;
300  else return false;
301  }
302 
307  bool MuonRoI_v1::isVetoed() const {
308 
309  if (isRun3()) return ( ( roiWord() >> RUN3_CAND_VETO_SHIFT) & 0x1 );
310  else return ( ( roiWord() >> CAND_VETO_SHIFT) & 0x1 );
311  }
312 
316  bool MuonRoI_v1::isRun3() const {
317 
318  return ( roiWord() >> 31 & 0x1 );
319  }
320 
321  //
323 
324 } // namespace xAOD
xAOD::MuonRoI_v1::initialize
void initialize(uint32_t roiword, float eta, float phi, const std::string &thrname, float thrvalue)
Initialise the object with all its properties.
Definition: MuonRoI_v1.cxx:33
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
xAOD::MuonRoI_v1::getSectorAddress
int getSectorAddress() const
Get the full sector address.
xAOD::MuonRoI_v1::getPhiOverlap
bool getPhiOverlap() const
Returns whether there's overlap between barrel sectors.
xAOD::MuonRoI_v1::Endcap
@ Endcap
The muon candidate was detected in the endcap region.
Definition: MuonRoI_v1.h:39
xAOD::MuonRoI_v1::getInnerCoincidence
bool getInnerCoincidence() const
Returns whether or not there was an inner coincidence in the TGC.
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::MuonRoI_v1::Neg
@ Neg
Candidate is a mu- from a TGC sector.
Definition: MuonRoI_v1.h:49
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
xAOD::MuonRoI_v1::getHemisphere
Hemisphere getHemisphere() const
Returns the hemisphere that detected the muon candidate.
xAOD::MuonRoI_v1::eta
float eta() const
The pseudorapidity ( ) of the muon candidate.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::MuonRoI_v1::setPhi
void setPhi(float v)
Set the azimuthal angle of the muon candidate.
xAOD::MuonRoI_v1::setRoIWord
void setRoIWord(uint32_t value)
Set the "raw" RoI word, describing the muon candidate.
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
xAOD::MuonRoI_v1::isRun3
bool isRun3() const
Returns extra flag at end of RoI word indicating that it's in Run3 format.
xAOD::MuonRoI_v1::isMoreCandInRoI
bool isMoreCandInRoI() const
Returns if there were other muons detected in the same RoI.
xAOD::MuonRoI_v1::isVetoed
bool isVetoed() const
Returns the veto flag for the candidate.
xAOD::MuonRoI_v1::setThrName
void setThrName(const std::string &value)
Set the name of the threshold passed by the muon candidate.
MuonRoI_v1.h
xAOD::MuonRoI_v1
Class describing a LVL1 muon region of interest.
Definition: MuonRoI_v1.h:33
xAOD::MuonRoI_v1::setThrValue
void setThrValue(float v)
Set the threshold value passed by the muon candidate.
xAOD::MuonRoI_v1::Undef
@ Undef
This is an RPC candidate.
Definition: MuonRoI_v1.h:51
xAOD::MuonRoI_v1::getRoI
int getRoI() const
Get the "RoI number" (position inside the sector)
xAOD::MuonRoI_v1::Charge
Charge
Charge sign.
Definition: MuonRoI_v1.h:48
xAOD::MuonRoI_v1::Barrel
@ Barrel
The muon candidate was detected in the barrel region.
Definition: MuonRoI_v1.h:38
xAOD::MuonRoI_v1::Negative
@ Negative
The candidate came from the -z side (side C)
Definition: MuonRoI_v1.h:45
MuCTPI_Bits.h
xAOD::MuonRoI_v1::RoISource
RoISource
RoI source enumeration.
Definition: MuonRoI_v1.h:37
xAOD::MuonRoI_v1::isMoreCandInSector
bool isMoreCandInSector() const
Returns if there were other muons detected in the same sector.
xAOD::MuonRoI_v1::isFirstCandidate
bool isFirstCandidate() const
Returns if the candidate had the highest pT in the sector.
xAOD::MuonRoI_v1::Hemisphere
Hemisphere
RoI hemisphere enumeration.
Definition: MuonRoI_v1.h:43
LVL1::MuCTPIBits
Definition: HelpersPhase1.h:14
xAOD::MuonRoI_v1::Forward
@ Forward
The muon candidate was detected in the forward region.
Definition: MuonRoI_v1.h:40
xAOD::MuonRoI_v1::getBW3Coincidence
bool getBW3Coincidence() const
Returns whether or not there was a 3-station coincidence in the TGC.
xAOD::MuonRoI_v1::getSectorID
int getSectorID() const
Get the sector ID number.
xAOD::MuonRoI_v1::getCharge
Charge getCharge() const
Returns the charge sign of the muon candidate.
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:54
xAOD::MuonRoI_v1::getSource
RoISource getSource() const
Returns the system that detected the muon candidate.
xAOD::MuonRoI_v1::setEta
void setEta(float v)
Set the pseudorapidity of the muon candidate.
xAOD::MuonRoI_v1::Pos
@ Pos
Candidate is a mu+ from a TGC sector.
Definition: MuonRoI_v1.h:50
xAOD::MuonRoI_v1::Positive
@ Positive
The candidate came from the +z side (side A)
Definition: MuonRoI_v1.h:44
xAOD::MuonRoI_v1::roiWord
uint32_t roiWord() const
The "raw" RoI word describing the muon candidate.
xAOD::MuonRoI_v1::getEtaOverlap
bool getEtaOverlap() const
Returns whether there's overlap between the barrel-EC sectors.
xAOD::MuonRoI_v1::getGoodMF
bool getGoodMF() const
Returns whether or not there was a good magnetic field quality in the TGC.
xAOD::AUXSTORE_OBJECT_SETTER_AND_GETTER
AUXSTORE_OBJECT_SETTER_AND_GETTER(CaloRings_v1, RingSetLinks, ringSetLinks, setRingSetLinks) unsigned CaloRings_v1
Definition: CaloRings_v1.cxx:27
xAOD::MuonRoI_v1::phi
float phi() const
The azimuthal angle ( ) of the muon candidate.