ATLAS Offline Software
Loading...
Searching...
No Matches
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
17namespace LVL1TGCTrigger {
18
19void 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
31void 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
76 if (m_sectorLogic->getRegion() == TGCRegionType::ENDCAP) {
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]);
84 int pt = m_lut->test(m_sideId, m_sectorLogic->getOctantID(), m_sectorLogic->getModuleID(),
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
127void 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
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
#define endmsg
std::shared_ptr< const LVL1TGC::BigWheelCoincidenceLUT > m_lut
void setCoincidenceLUT(std::shared_ptr< const LVL1TGC::BigWheelCoincidenceLUT > lut)
TGCRPhiCoincidenceMatrix & operator=(const TGCRPhiCoincidenceMatrix &right)
TGCRPhiCoincidenceMatrix(const TGCArguments *, const TGCSectorLogic *sL=0)
void inputPhi(int phiIn, int dPhiIn, int ptPhiIn)
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)