ATLAS Offline Software
MuCTPI_RIO.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // Gaudi/Athena include(s):
7 #include "GaudiKernel/Bootstrap.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/IMessageSvc.h"
10 #include "GaudiKernel/MsgStream.h"
11 
12 // Local include(s):
14 
21  : m_headerSourceId( 0 ), m_headerRunNumber( 0 ), m_headerLVL1ID( 0 ), m_headerBCID( 0 ),
22  m_headerLVL1TriggerType( 0 ), m_headerDetEventType( 0 ), m_headerNDataWords( 0 ),
23  m_headerNStatusWords( 0 ), m_bcId( 0 ), m_sum() {
24 
25 }
26 
27 
35  for( int i = 0; i < N_SUM; ++i ) m_sum[ i ] = *( sum + i );
36  return;
37 }
38 
47 uint16_t MuCTPI_RIO::getSum( const int index ) const {
48  if( index >= N_SUM ) return 0;
49  return m_sum[ index ];
50 }
51 
69 void MuCTPI_RIO::setRoI( const uint16_t bcId, const uint16_t pTval, const uint16_t pTnum, const double eta, const double phi,
70  const uint16_t secID, const uint16_t sysId, const uint16_t hemisphere, const uint16_t roiNum,
71  const bool accepted, const bool first, const bool duplicatedRoI, const bool duplicatedSector) {
72 
73  MyRoI roI( bcId, pTval,pTnum, eta, phi, secID, sysId, hemisphere, roiNum, accepted, first, duplicatedRoI, duplicatedSector);
74  m_roI.push_back( roI );
75 
76  return;
77 }
78 
98 bool MuCTPI_RIO::getRoI( const int index, uint16_t &bcId, uint16_t &pTval, uint16_t& pTnum, double &eta, double &phi,
99  uint16_t& secID, uint16_t& sysId, uint16_t& hemisphere, uint16_t& roiNum, bool &accepted,
100  bool &first, bool &duplicatedRoI, bool &duplicatedSector) const {
101 
102  if( index >= getNRoI() ) return false;
103 
104  const MyRoI &roi = m_roI.at( index );
105  bcId = roi.m_bcId;
106  pTval = roi.m_pTvalue;
107  pTnum = roi.m_pTnumber;
108  eta = roi.m_eta;
109  phi = roi.m_phi;
110  secID = roi.m_sectorID;
111  sysId = roi.m_sysId;
112  hemisphere = (roi.m_hemisphere ? 1 : 0);
113  roiNum = roi.m_roINumber;
114  accepted = roi.m_accepted;
115  first = roi.m_first;
116  duplicatedRoI = roi.m_duplicatedRoI;
117  duplicatedSector = roi.m_duplicatedSector;
118 
119 
120  return true;
121 }
122 
127 void MuCTPI_RIO::dumpData() const {
128 
129  IMessageSvc* msgSvc;
130  ISvcLocator* svcLoc = Gaudi::svcLocator( );
131  StatusCode sc = svcLoc->service( "MessageSvc", msgSvc );
132  if( sc.isFailure() ) {
133  return;
134  }
135  MsgStream log( msgSvc, "MuCTPI_RIO" );
136  dumpData( log );
137 
138  return;
139 }
140 
146 void MuCTPI_RIO::dumpData( MsgStream& log ) const {
147 
148  log << MSG::DEBUG << "=================================================" << endmsg;
149  log << MSG::DEBUG << "MUCTPI ROD Header / Trailer data" << endmsg;
150  log << MSG::DEBUG << "Source ID : 0x" << MSG::hex << getHeaderSourceId() << MSG::dec << endmsg;
151  log << MSG::DEBUG << "Run number : " << getHeaderRunNumber() << endmsg;
152  log << MSG::DEBUG << "Ext. LVL1 ID : " << getHeaderLVL1ID() << endmsg;
153  log << MSG::DEBUG << "BCID : " << getHeaderBCID() << endmsg;
154  log << MSG::DEBUG << "Trigger type : " << getHeaderLVL1TriggerType() << endmsg;
155  log << MSG::DEBUG << "Det. event type : " << getHeaderDetectorEventType() << endmsg;
156  log << MSG::DEBUG << "No data words : " << getHeaderNumberDataWords() << endmsg;
157  log << MSG::DEBUG << "No status words : " << getHeaderNumberStatusWords() << endmsg;
158  for( uint32_t i = 0 ; i < getHeaderNumberStatusWords(); ++i ) {
159  log << MSG::DEBUG << "Status word " << i << " : 0x" << MSG::hex << getHeaderStatusWords()[i]
160  << MSG::dec << endmsg;
161  }
162  log << MSG::DEBUG << "=================================================" << endmsg;
163 
164  std::vector<MyRoI>::const_iterator it = m_roI.begin();
165  for( ; it != m_roI.end(); ++it ) it->dumpData( log );
166 
167  return;
168 }
169 
187 MuCTPI_RIO::MyRoI::MyRoI( const uint16_t bcId, const uint16_t pTVal,const uint16_t pTnumber, const double eta, const double phi,const uint16_t secID, const uint16_t sysId , const uint16_t hemisphere, const uint16_t roiNum, const bool accepted, const bool first, const bool duplicatedRoI, const bool duplicatedSector)
188  : m_bcId( bcId ), m_pTvalue( pTVal ), m_pTnumber( pTnumber ), m_eta( eta ), m_phi( phi ),
189  m_sectorID( secID ), m_sysId( sysId ), m_hemisphere( hemisphere ? true : false ), m_roINumber( roiNum ), m_accepted( accepted ),
190  m_first( first ), m_duplicatedRoI( duplicatedRoI ), m_duplicatedSector( duplicatedSector ) {}
191 
197 
198  IMessageSvc* msgSvc;
199  ISvcLocator* svcLoc = Gaudi::svcLocator( );
200  StatusCode sc = svcLoc->service( "MessageSvc", msgSvc );
201  if( sc.isFailure() ) {
202  return;
203  }
204  MsgStream log( msgSvc, "MuCTPI_RIO::RoI" );
205  dumpData( log );
206 
207  return;
208 }
209 
215 void MuCTPI_RIO::MyRoI::dumpData( MsgStream& log ) const {
216 
217  log << MSG::DEBUG << "=================================================" << endmsg;
218  log << MSG::DEBUG << "MUCTPI RoI data" << endmsg;
219  log << MSG::DEBUG << "BCID : " << m_bcId << endmsg;
220  log << MSG::DEBUG << "Pt value : " << m_pTvalue << endmsg;
221  log << MSG::DEBUG << "Pt threshold number : " << m_pTnumber << endmsg;
222  log << MSG::DEBUG << "Eta : " << m_eta << endmsg;
223  log << MSG::DEBUG << "Phi : " << m_phi << endmsg;
224  log << MSG::DEBUG << "RoI number : " << m_roINumber << endmsg;
225  log << MSG::DEBUG << "Sector ID : " << m_sectorID << endmsg;
226  log << MSG::DEBUG << "System ID : " << m_sysId << endmsg;
227  log << MSG::DEBUG << "Hemisphere : " << m_hemisphere << endmsg;
228  log << MSG::DEBUG << "Flags " << endmsg;
229  log << MSG::DEBUG << "Accepted : " << m_accepted << endmsg;
230  log << MSG::DEBUG << "First : " << m_first << endmsg;
231  log << MSG::DEBUG << "Duplicated sector : " << m_duplicatedSector << endmsg;
232  log << MSG::DEBUG << "Duplicated RoI : " << m_duplicatedRoI << endmsg;
233  log << MSG::DEBUG << "=================================================" << endmsg;
234 
235  return;
236 }
MuCTPI_RIO::getHeaderStatusWords
const std::vector< uint32_t > & getHeaderStatusWords() const
Get the status words from the payload.
Definition: MuCTPI_RIO.h:92
MuCTPI_RIO::m_roI
std::vector< MyRoI > m_roI
Variable holding the custom RoIs.
Definition: MuCTPI_RIO.h:240
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
MuCTPI_RIO::MyRoI::m_pTvalue
uint16_t m_pTvalue
pT threshold value (in GeV) as reconstructed from the data word
Definition: MuCTPI_RIO.h:210
MuCTPI_RIO::MyRoI::m_first
bool m_first
Flag showing whether the candidate had the highest pT in its sector.
Definition: MuCTPI_RIO.h:230
MuCTPI_RIO::getHeaderSourceId
uint32_t getHeaderSourceId() const
Get the ROD ID specified in the header.
Definition: MuCTPI_RIO.h:76
MuCTPI_RIO::MyRoI
Custom private object to hold information about the stored reconstructed RoIs.
Definition: MuCTPI_RIO.h:192
MuCTPI_RIO::MyRoI::m_phi
double m_phi
φ position of the candidate
Definition: MuCTPI_RIO.h:216
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
MuCTPI_RIO::MyRoI::m_sectorID
uint16_t m_sectorID
8-bit sector address as stored in the data word
Definition: MuCTPI_RIO.h:218
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
index
Definition: index.py:1
MuCTPI_RIO::getHeaderNumberDataWords
uint32_t getHeaderNumberDataWords() const
Get the number of data words as it was specified in the trailer
Definition: MuCTPI_RIO.h:88
MuCTPI_RIO::MyRoI::m_bcId
uint16_t m_bcId
3-bit BCID as stored in the data word
Definition: MuCTPI_RIO.h:208
skel.it
it
Definition: skel.GENtoEVGEN.py:423
MuCTPI_RIO::MuCTPI_RIO
MuCTPI_RIO()
Default constructor.
Definition: MuCTPI_RIO.cxx:20
MuCTPI_RIO::getHeaderLVL1TriggerType
uint32_t getHeaderLVL1TriggerType() const
Get the LVL1 trigger type specified in the header.
Definition: MuCTPI_RIO.h:84
MuCTPI_RIO::MyRoI::m_accepted
bool m_accepted
Flag showing whether the candidate was sent to the RoIB.
Definition: MuCTPI_RIO.h:228
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MuCTPI_RIO::setRoI
void setRoI(const uint16_t bcId, const uint16_t pTval, const uint16_t pTnum, const double eta, const double phi, const uint16_t secID, const uint16_t sysId, const uint16_t hemisphere, const uint16_t roiNum, const bool accepted, const bool first, const bool duplicatedRoI, const bool duplicatedSector)
Add a muon RoI to the object
Definition: MuCTPI_RIO.cxx:69
MuCTPI_RIO::MyRoI::m_pTnumber
uint16_t m_pTnumber
3-bit pT threshold number as stored in the data word
Definition: MuCTPI_RIO.h:212
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
MuCTPI_RIO::m_sum
std::array< uint16_t, N_SUM > m_sum
Candidate multiplicity in MuCTPI_RIO::N_SUM number of pT thresholds.
Definition: MuCTPI_RIO.h:170
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
MuCTPI_RIO::setSum
void setSum(const uint16_t *sum)
Set the multiplicity sum.
Definition: MuCTPI_RIO.cxx:34
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuCTPI_RIO::MyRoI::m_eta
double m_eta
η position of the candidate
Definition: MuCTPI_RIO.h:214
MuCTPI_RIO.h
MuCTPI_RIO::getHeaderBCID
uint32_t getHeaderBCID() const
Get the full BCID specified in the header.
Definition: MuCTPI_RIO.h:82
MuCTPI_RIO::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPI_RIO.cxx:127
MuCTPI_RIO::getHeaderNumberStatusWords
uint32_t getHeaderNumberStatusWords() const
Get the number of status words as it was specified in the trailer
Definition: MuCTPI_RIO.h:90
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:329
MuCTPI_RIO::getNRoI
int getNRoI() const
Get the number of muon RoIs.
Definition: MuCTPI_RIO.h:69
MuCTPI_RIO::MyRoI::m_duplicatedSector
bool m_duplicatedSector
Flag showing whether there were more than 2 candidates in this candidate's sector.
Definition: MuCTPI_RIO.h:234
DeMoScan.index
string index
Definition: DeMoScan.py:362
MuCTPI_RIO::getHeaderLVL1ID
uint32_t getHeaderLVL1ID() const
Get the LVL1 ID specified in the header.
Definition: MuCTPI_RIO.h:80
DeMoScan.first
bool first
Definition: DeMoScan.py:534
DEBUG
#define DEBUG
Definition: page_access.h:11
MuCTPI_RIO::getSum
uint16_t getSum(const int index) const
Get the multiplicity sum for a given pT threshold.
Definition: MuCTPI_RIO.cxx:47
MuCTPI_RIO::MyRoI::MyRoI
MyRoI(const uint16_t bcId, const uint16_t pTVal, const uint16_t pTNum, const double eta, const double phi, const uint16_t secID, const uint16_t sysId, const uint16_t hemisphere, const uint16_t roiNum, const bool accepted, const bool first, const bool duplicatedRoI, const bool duplicatedSector)
Constructor.
Definition: MuCTPI_RIO.cxx:187
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuCTPI_RIO::getHeaderDetectorEventType
uint32_t getHeaderDetectorEventType() const
Get the event type specified in the header.
Definition: MuCTPI_RIO.h:86
MuCTPI_RIO::MyRoI::m_hemisphere
bool m_hemisphere
Hemisphere in which the candidate was detected (false: z < 0, true: z > 0)
Definition: MuCTPI_RIO.h:222
MuCTPI_RIO::getHeaderRunNumber
uint32_t getHeaderRunNumber() const
Get the run number specified in the header.
Definition: MuCTPI_RIO.h:78
MuCTPI_RIO::MyRoI::m_duplicatedRoI
bool m_duplicatedRoI
Flag showing whether there was more than 1 candidate in this candidate's RoI.
Definition: MuCTPI_RIO.h:232
MuCTPI_RIO::MyRoI::m_roINumber
uint16_t m_roINumber
RoI number (sub-sector in which the candidate was detected) as stored in the data word.
Definition: MuCTPI_RIO.h:225
MuCTPI_RIO::MyRoI::m_sysId
uint16_t m_sysId
System in which the candidate was detected.
Definition: MuCTPI_RIO.h:220
MuCTPI_RIO::getRoI
bool getRoI(const int index, uint16_t &bcId, uint16_t &pTval, uint16_t &pTnum, double &eta, double &phi, uint16_t &secID, uint16_t &sysId, uint16_t &hemisphere, uint16_t &roiNum, bool &accepted, bool &first, bool &duplicatedRoI, bool &duplicatedSector) const
Get the properties of a given muon RoI.
Definition: MuCTPI_RIO.cxx:98
MuCTPI_RIO::m_bcId
uint16_t m_bcId
What kind of BCID is this???
Definition: MuCTPI_RIO.h:166
MuCTPI_RIO::N_SUM
@ N_SUM
Definition: MuCTPI_RIO.h:47
MuCTPI_RIO::MyRoI::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPI_RIO.cxx:196