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