ATLAS Offline Software
TGCRPhiCoincidenceMatrix.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
12 
14 #include <iostream>
15 #include <cstdlib>
16 
17 namespace LVL1TGCTrigger {
18 
19 void TGCRPhiCoincidenceMatrix::inputR(int rIn, int dRIn, int ptRIn)
20 {
21  m_r=rIn;
22  m_dR=dRIn;
23  m_ptR=ptRIn;
24 
25 #ifdef TGCDEBUG
26  std::cout <<"LVL1TGCTrigger::TGCRPhiCoincidenceMatrix "
27  <<"inputR r=" <<m_r <<" dR=" <<m_dR <<" H/L=" <<m_ptR <<std::endl;
28 #endif
29 }
30 
31 void TGCRPhiCoincidenceMatrix::inputPhi(int phiIn, int dPhiIn, int ptPhiIn)
32 {
34  m_phi[m_nPhiHit]=phiIn;
35  m_dPhi[m_nPhiHit]=dPhiIn;
36  m_ptPhi[m_nPhiHit]=ptPhiIn;
37 
38 #ifdef TGCDEBUG
39  std::cout <<"LVL1TGCTrigger::TGCRPhiCoincidenceMatrix "
40  << "inputPhi phi" << m_nPhiHit << "="<< m_phi[m_nPhiHit]
41  << " dPhi=" << m_dPhi[m_nPhiHit] << " H/L=" << m_ptPhi[m_nPhiHit]
42  << std::endl;
43 #endif
44 
45  m_nPhiHit++;
46  }
47 }
48 
50 {
51  m_SSCId=0;
52  m_r=m_dR=m_ptR=0;
53 
54  m_nPhiHit=0;
55  int i;
56  for( i=0; i<MaxNPhiHit; i+=1)
57  m_phi[i]=m_dPhi[i]=m_ptPhi[i]=0;
58 }
59 
61 {
63  out->clear();
64 
65  if(m_nPhiHit ==0) return out;
66 
67  out->setIdSSC(m_SSCId);
68 
69  int j0 = -1;
70  int ptMax = 1;
71  for( int j=m_nPhiHit-1; j>=0; j-=1){ // left half-SSC has priority when both output same pT
72  int subsector;
73  int chargeOut = 2;
74  int CoincidenceTypeOut=-1;
75 
77  subsector = 4*(2*m_SSCId+m_r-1)+m_phi[j];
78  } else {
79  subsector = 4*(2*m_SSCId+m_r)+m_phi[j];
80  }
81 
82  // calculate pT of muon candidate
83  int type = m_lut->getMapType(m_ptR, m_ptPhi[j]);
85  subsector,type,m_dR,m_dPhi[j]);
86  uint8_t ptOut = std::abs(pt); // 0 is no candidate.
87  chargeOut = pt<0 ? 0:1;
88  // the charge is inverted on the C-side.
89  chargeOut = m_sideId == 0 ? chargeOut : !chargeOut;
90 
91  CoincidenceTypeOut=(type==0);
92 
93  // Trigger Out (only pT>0 candidate)
94  if(ptOut >= ptMax) {
95  ptMax = ptOut;
96  out->clear();
97  out->setIdSSC(m_SSCId);
98  out->setpT(ptMax);
99  out->setR(m_r);
100  out->setPhi(m_phi[j]);
101  out->setDR(m_dR);
102  out->setDPhi(m_dPhi[j]);
103  out->setRoI(subsector);
104  out->setCharge(chargeOut);
105  out->setCoincidenceType(CoincidenceTypeOut);
106  j0 = j;
107  }
108  }
109 
110  if (tgcArgs()->MSGLEVEL() <= MSG::DEBUG){
111  MsgStream log(Athena::getMessageSvc(), "LVL1TGCTrigger::TGCRPhiCoincidenceMatrix");
112  if (j0>0) {
113  log << MSG::DEBUG << " Trigger Out : "
114  << " pt =" << ptMax+1 << " R=" << m_r << " Phi=" << m_phi[j0]
115  << " ptR=" << m_ptR << " dR=" << m_dR
116  << " ptPhi=" << m_ptPhi[j0] << " dPhi=" << m_dPhi[j0]
117  << endmsg;
118  } else {
119  log << MSG::DEBUG << "NO Trigger Out : " << endmsg;
120  }
121  }
122 
123  //m_matrixOut = out;
124  return out;
125 }
126 
127 void TGCRPhiCoincidenceMatrix::setCoincidenceLUT(std::shared_ptr<const LVL1TGC::BigWheelCoincidenceLUT> lut) {
128  this->m_lut = std::move(lut);
129 }
130 
132  : m_sectorLogic(sL),
133  m_matrixOut(0), m_lut(0),
134  m_nPhiHit(0), m_SSCId(0), m_r(0), m_dR(0), m_ptR(0), m_sideId(0), m_tgcArgs(tgcargs)
135 {
136  for (int i=0; i<MaxNPhiHit; i++) {
137  m_phi[i]=0;
138  m_dPhi[i]=0;
139  m_ptPhi[i]=0;
140  }
141 }
142 
144 {
145  m_matrixOut=0;
146 }
147 
149 {
150  if (this != &right){
151  m_sideId = right.m_sideId;
152  m_tgcArgs = right.m_tgcArgs;
154  delete m_matrixOut;
155  m_matrixOut =0;
156  m_nPhiHit = 0;
157  m_SSCId = 0;
158  m_r = 0;
159  m_dR = 0;
160  m_ptR = 0;
161  for (int i=0; i<MaxNPhiHit; i++) {
162  m_phi[i]=0;
163  m_dPhi[i]=0;
164  m_ptPhi[i]=0;
165  }
166  }
167  return *this;
168 }
169 
170 } //end of namespace bracket
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_sideId
int m_sideId
Definition: TGCRPhiCoincidenceMatrix.h:55
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::inputR
void inputR(int rIn, int dRIn, int ptRIn)
Definition: TGCRPhiCoincidenceMatrix.cxx:19
LVL1TGCTrigger::TGCSectorLogic::getRegion
TGCRegionType getRegion() const
Definition: TGCSectorLogic.h:61
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_SSCId
int m_SSCId
Definition: TGCRPhiCoincidenceMatrix.h:48
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_ptPhi
int m_ptPhi[MaxNPhiHit]
Definition: TGCRPhiCoincidenceMatrix.h:54
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix
Definition: TGCRPhiCoincidenceMatrix.h:21
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_ptR
int m_ptR
Definition: TGCRPhiCoincidenceMatrix.h:51
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_matrixOut
TGCRPhiCoincidenceOut * m_matrixOut
Definition: TGCRPhiCoincidenceMatrix.h:44
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
LVL1TGCTrigger::TGCSectorLogic::getOctantID
int getOctantID() const
Definition: TGCSectorLogic.h:184
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_sectorLogic
const TGCSectorLogic * m_sectorLogic
Definition: TGCRPhiCoincidenceMatrix.h:42
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_nPhiHit
int m_nPhiHit
Definition: TGCRPhiCoincidenceMatrix.h:47
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
BigWheelCoincidenceLUT.h
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_phi
int m_phi[MaxNPhiHit]
Definition: TGCRPhiCoincidenceMatrix.h:52
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_dPhi
int m_dPhi[MaxNPhiHit]
Definition: TGCRPhiCoincidenceMatrix.h:53
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::tgcArgs
const TGCArguments * tgcArgs() const
Definition: TGCRPhiCoincidenceMatrix.h:37
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_r
int m_r
Definition: TGCRPhiCoincidenceMatrix.h:49
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_dR
int m_dR
Definition: TGCRPhiCoincidenceMatrix.h:50
LVL1TGCTrigger::TGCSectorLogic::getModuleID
int getModuleID() const
Definition: TGCSectorLogic.h:177
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::doCoincidence
TGCRPhiCoincidenceOut * doCoincidence()
Definition: TGCRPhiCoincidenceMatrix.cxx:60
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::operator=
TGCRPhiCoincidenceMatrix & operator=(const TGCRPhiCoincidenceMatrix &right)
Definition: TGCRPhiCoincidenceMatrix.cxx:148
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_lut
std::shared_ptr< const LVL1TGC::BigWheelCoincidenceLUT > m_lut
Definition: TGCRPhiCoincidenceMatrix.h:45
LVL1TGCTrigger::TGCArguments::MSGLEVEL
MSG::Level MSGLEVEL() const
Definition: TGCArguments.cxx:40
TGCSectorLogic.h
LVL1TGCTrigger::TGCRPhiCoincidenceOut
Definition: TGCRPhiCoincidenceOut.h:11
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::~TGCRPhiCoincidenceMatrix
virtual ~TGCRPhiCoincidenceMatrix()
Definition: TGCRPhiCoincidenceMatrix.cxx:143
LVL1TGCTrigger
Definition: LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::clear
void clear()
Definition: TGCRPhiCoincidenceMatrix.cxx:49
TGCRPhiCoincidenceMatrix.h
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::inputPhi
void inputPhi(int phiIn, int dPhiIn, int ptPhiIn)
Definition: TGCRPhiCoincidenceMatrix.cxx:31
LVL1TGCTrigger::TGCArguments
Definition: TGCArguments.h:12
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::m_tgcArgs
const TGCArguments * m_tgcArgs
Definition: TGCRPhiCoincidenceMatrix.h:57
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::setCoincidenceLUT
void setCoincidenceLUT(std::shared_ptr< const LVL1TGC::BigWheelCoincidenceLUT > lut)
Definition: TGCRPhiCoincidenceMatrix.cxx:127
LVL1TGCTrigger::TGCSectorLogic
Definition: TGCSectorLogic.h:41
TGCRPhiCoincidenceOut.h
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::MaxNPhiHit
@ MaxNPhiHit
Definition: TGCRPhiCoincidenceMatrix.h:40
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TGCArguments.h
LVL1TGCTrigger::TGCRPhiCoincidenceMatrix::TGCRPhiCoincidenceMatrix
TGCRPhiCoincidenceMatrix(const TGCArguments *, const TGCSectorLogic *sL=0)
Definition: TGCRPhiCoincidenceMatrix.cxx:131