Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Lvl1MuCTPIInputPhase1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 #include <iostream>
5 #include <iomanip>
6 
8 
9 namespace LVL1MUONIF {
10 
13  }
14 
17  *this = right;
18  }
19 
20 
22 
24  if ( this != &right ) {
25  clearAll();
26  for (size_t idSys=0; idSys<NumberOfMuonSystem; idSys++){
27  for( size_t ip=0; ip<right.m_data[idSys].size(); ip++){
28  int bc=((right.m_data[idSys]).at(ip)).first;
29  Lvl1MuVect vSL(((right.m_data[idSys]).at(ip)).second);
30  m_data[idSys].emplace_back(bc,std::move(vSL));
31  }
33  }
34  }
35  return *this;
36  }
37 
38 
39 
42  size_t subSystemAddress,
43  size_t sectorAddress,
44  int bcid ) const {
46  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
47  int bc=((m_data[systemAddress]).at(ip)).first;
48  if (bc != bcid) continue;
49  const Lvl1MuVect &vecSL( ((m_data[systemAddress]).at(ip)).second);
50  return *(vecSL.at(getSystemIndex(systemAddress,subSystemAddress,sectorAddress)));
51  }
52  return dummy;
53  }
54 
56  std::shared_ptr<Lvl1MuSectorLogicDataPhase1> Lvl1MuCTPIInputPhase1::getSectorLogicDataPtr( size_t systemAddress,
57  size_t subSystemAddress,
58  size_t sectorAddress,
59  int bcid ) const {
60  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
61  int bc=((m_data[systemAddress]).at(ip)).first;
62  if (bc != bcid) continue;
63  return m_data[systemAddress].at(ip).second.at(getSystemIndex(systemAddress,subSystemAddress,sectorAddress));
64  }
65  return nullptr;
66  }
67 
70  size_t systemAddress,
71  size_t subSystemAddress,
72  size_t sectorAddress,
73  int bcid ) {
74  size_t ip=0;
75  if (isEmpty(systemAddress,bcid)) {
76  ip = reserve( systemAddress, bcid );
77  } else {
78  ip = getBcidIndex( systemAddress, bcid );
79  }
80 
81  const Lvl1MuVect &vecSL((((m_data[systemAddress]).at(ip)).second));
82  size_t idx= getSystemIndex(systemAddress,subSystemAddress,sectorAddress);
83  if ( systemAddress == Barrel ) {
84  *static_cast<Lvl1MuBarrelSectorLogicDataPhase1*>(vecSL.at(idx).get()) = data;
85  } else if ( systemAddress == Endcap ) {
86  *static_cast<Lvl1MuEndcapSectorLogicDataPhase1*>(vecSL.at(idx).get())= data;
87  } else if ( systemAddress == Forward ) {
88  *static_cast<Lvl1MuForwardSectorLogicDataPhase1*>(vecSL.at(idx).get())= data;
89  }
90  }
91 
94  size_t systemAddress,
95  size_t subSystemAddress,
96  size_t sectorAddress,
97  int bcid ) {
98  // convert to SectorLogicDataPhase1
99  std::unique_ptr<Lvl1MuSectorLogicDataPhase1> pData;
100  if ( systemAddress == Barrel ) {
101  pData = std::make_unique<Lvl1MuBarrelSectorLogicDataPhase1>();
102  } else if ( systemAddress == Endcap ) {
103  pData = std::make_unique<Lvl1MuEndcapSectorLogicDataPhase1>();
104  } else if ( systemAddress == Forward ) {
105  pData = std::make_unique<Lvl1MuForwardSectorLogicDataPhase1>();
106  } else {
107  return ;
108  }
109  pData->convertFromWordFormat( sectorWord );
110  setSectorLogicData( *pData, systemAddress, subSystemAddress, sectorAddress, bcid );
111  }
112 
115  if ( this == &right ) return;
116 
117  for (size_t idSys=0; idSys<NumberOfMuonSystem; idSys++){
118  for( size_t ip=0; ip<right.m_data[idSys].size(); ip++){
119  int bc=((right.m_data[idSys]).at(ip)).first;
120  if (isEmpty( idSys, bc)){
121  Lvl1MuVect vSL(((right.m_data[idSys]).at(ip)).second);
122  m_data[idSys].emplace_back(bc,std::move(vSL));
124  }
125  }
126  }
127 
128  }
129 
131  size_t Lvl1MuCTPIInputPhase1::reserve( size_t systemAddress ,
132  int bcid) {
133 
134  Lvl1MuVect vecSL;
135 
136  if ( systemAddress == Barrel ) {
138  for ( size_t id = 0; id < NumberOfBarrelSector*NumberOfMuonSubSystem; id++ ) {
139  vecSL.emplace_back(std::make_shared<Lvl1MuBarrelSectorLogicDataPhase1>());
140  }
141 
142  } else if ( systemAddress == Endcap ) {
144  for ( size_t id = 0; id < NumberOfEndcapSector*NumberOfMuonSubSystem; id++ ) {
145  vecSL.emplace_back(std::make_shared<Lvl1MuEndcapSectorLogicDataPhase1>());
146  }
147 
148  } else if ( systemAddress == Forward ) {
150  for ( size_t id = 0; id < NumberOfForwardSector*NumberOfMuonSubSystem; id++ ) {
151  vecSL.emplace_back(std::make_shared<Lvl1MuForwardSectorLogicDataPhase1>());
152  }
153  }
154 
155  size_t ip = m_data[systemAddress].size();
156  m_data[systemAddress].emplace_back( bcid, std::move(vecSL));
157 
158  if (bcid!=0) m_isFilledOutOfTimeCandidates[systemAddress] = true;
159 
160  return ip;
161  }
162 
164  bool Lvl1MuCTPIInputPhase1::isEmpty( size_t systemAddress,
165  int bcid ) const {
166  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
167  int bc=((m_data[systemAddress]).at(ip)).first;
168  if (bc == bcid) return false;;
169  }
170  return true;
171  }
172 
176  return true;
177  } else {
178  return false;
179  }
180  }
181 
183  void Lvl1MuCTPIInputPhase1::clear( size_t systemAddress ) {
184  m_data[systemAddress].clear();
185  }
186 
189  for ( size_t id = 0; id < NumberOfMuonSystem; id++ ) {
190  m_data[ id ].clear();
191  }
192 
193 
194  }
195 
196  std::ostream& operator<<( std::ostream& out, const Lvl1MuCTPIInputPhase1& right ) {
197 
198  size_t systemAddress;
199  size_t subSystemAddress;
200  size_t side, id;
201 
202  out << "--------- Barrel Sector ---------------------------" << std::endl;
203  systemAddress = right.idBarrelSystem();
204  for ( side = 0; side < right.NumberOfMuonSubSystem; ++side ) {
205  if ( side == 0 ) {
206  out << " ------ A Side (Z>0) ---------------------------" << std::endl;
207  subSystemAddress = right.idSideA();
208  } else {
209  out << " ------ C Side (Z<0) ---------------------------" << std::endl;
210  subSystemAddress = right.idSideC();
211  }
212  for ( id = 0; id < right.numberOfBarrelSector() ;++id ) {
213  out << " --- Sector ID : " << id << " ----------" << std::endl;
214  for( size_t ip=0; ip < right.m_data[systemAddress].size(); ip++){
215  int bc=((right.m_data[systemAddress]).at(ip)).first;
216  out << right.getSectorLogicData( systemAddress, subSystemAddress, id, bc );
217  out << " BC: " << bc;
218  out << std::endl;
219  }
220  }
221  }
222 
223  out << "--------- Endcap Sector ---------------------------" << std::endl;
224  systemAddress = right.idEndcapSystem();
225  for ( side = 0; side < right.NumberOfMuonSubSystem; ++side ) {
226  if ( side == 0 ) {
227  out << " ------ A Side (Z>0) ---------------------------" << std::endl;
228  subSystemAddress = right.idSideA();
229  } else {
230  out << " ------ C Side (Z<0) ---------------------------" << std::endl;
231  subSystemAddress = right.idSideC();
232  }
233  for ( id = 0; id < right.numberOfEndcapSector() ;++id ) {
234  out << " --- Sector ID : " << id << " ----------" << std::endl;
235  for( size_t ip=0; ip < right.m_data[systemAddress].size(); ip++){
236  int bc=((right.m_data[systemAddress]).at(ip)).first;
237  out << right.getSectorLogicData( systemAddress, subSystemAddress, id, bc );
238  out << " BC: " << bc;
239  out << std::endl;
240  }
241  }
242  }
243 
244  out << "--------- Forward Sector ---------------------------" << std::endl;
245  systemAddress = right.idForwardSystem();
246  for ( side = 0; side < right.NumberOfMuonSubSystem; ++side ) {
247  if ( side == 0 ) {
248  out << " ------ A Side (Z>0) ---------------------------" << std::endl;
249  subSystemAddress = right.idSideA();
250  } else {
251  out << " ------ C Side (Z<0) ---------------------------" << std::endl;
252  subSystemAddress = right.idSideC();
253  }
254  for ( id = 0; id < right.numberOfForwardSector() ;++id ) {
255  out << " --- Sector ID : " << id << " ----------" << std::endl;
256  for( size_t ip=0; ip < right.m_data[systemAddress].size(); ip++){
257  int bc=((right.m_data[systemAddress]).at(ip)).first;
258  out << right.getSectorLogicData( systemAddress, subSystemAddress, id, bc );
259  out << " BC: " << bc;
260  out << std::endl;
261  }
262  }
263  }
264 
265  return out;
266  }
267 }
LVL1MUONIF::Lvl1MuCTPIInputPhase1::setSectorLogicData
void setSectorLogicData(const Lvl1MuSectorLogicDataPhase1 &data, size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0)
Definition: Lvl1MuCTPIInputPhase1.cxx:69
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
LVL1MUONIF::Lvl1MuCTPIInputPhase1::isEmptyAll
bool isEmptyAll(int bcid=0) const
Return "true" if data of all systems for this bcid is empty.
Definition: Lvl1MuCTPIInputPhase1.cxx:174
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Lvl1MuVect
std::vector< std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > > Lvl1MuVect
Definition: Lvl1MuCTPIInputPhase1.h:121
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idForwardSystem
static size_t idForwardSystem()
Definition: Lvl1MuCTPIInputPhase1.h:139
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfMuonSystem
@ NumberOfMuonSystem
Definition: Lvl1MuCTPIInputPhase1.h:50
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfBarrelSector
@ NumberOfBarrelSector
Definition: Lvl1MuCTPIInputPhase1.h:52
LVL1MUONIF::Lvl1MuCTPIInputPhase1::merge
void merge(const Lvl1MuCTPIInputPhase1 &another)
Merge SectorLogic data of another object into this data of a system (Barrel, Endcap or Forward) is no...
Definition: Lvl1MuCTPIInputPhase1.cxx:114
LVL1MUONIF
Namespace for the LVL1 muon interface classes.
Definition: Lvl1MuBarrelSectorLogicData.cxx:9
LVL1MUONIF::Lvl1MuCTPIInputPhase1
Class representing (part of) the input data to the MuCTPI for Phase 1.
Definition: Lvl1MuCTPIInputPhase1.h:34
LVL1MUONIF::Lvl1MuCTPIInputPhase1::m_data
std::vector< Lvl1MuVectWithBC > m_data[NumberOfMuonSystem]
Definition: Lvl1MuCTPIInputPhase1.h:132
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
LVL1MUONIF::Lvl1MuCTPIInputPhase1::operator=
Lvl1MuCTPIInputPhase1 & operator=(const Lvl1MuCTPIInputPhase1 &right)
Definition: Lvl1MuCTPIInputPhase1.cxx:23
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getBcidIndex
size_t getBcidIndex(size_t systemAddress, int bcid=0) const
Definition: Lvl1MuCTPIInputPhase1.h:171
LVL1MUONIF::Lvl1MuCTPIInputPhase1::clear
void clear(size_t systemAddress)
Definition: Lvl1MuCTPIInputPhase1.cxx:183
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfMuonSubSystem
@ NumberOfMuonSubSystem
Definition: Lvl1MuCTPIInputPhase1.h:51
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1
Class representing data from an endcap SL board.
Definition: Lvl1MuEndcapSectorLogicDataPhase1.h:26
TRT::Hit::side
@ side
Definition: HitInfo.h:83
Lvl1MuCTPIInputPhase1.h
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::SectorLogicWord
std::pair< unsigned long int, unsigned short int > SectorLogicWord
Definition: Lvl1MuSectorLogicDataPhase1.h:45
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Forward
@ Forward
Definition: Lvl1MuCTPIInputPhase1.h:48
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideA
static size_t idSideA()
Definition: Lvl1MuCTPIInputPhase1.h:141
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getSystemIndex
size_t getSystemIndex(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress) const
Definition: Lvl1MuCTPIInputPhase1.h:159
LVL1MUONIF::Lvl1MuCTPIInputPhase1::clearAll
void clearAll()
Clear Sector Logic data.
Definition: Lvl1MuCTPIInputPhase1.cxx:188
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1
Base class for the data coming from one SL board.
Definition: Lvl1MuSectorLogicDataPhase1.h:35
LVL1MUONIF::Lvl1MuBarrelSectorLogicDataPhase1
Class representing data from a barrel SL board.
Definition: Lvl1MuBarrelSectorLogicDataPhase1.h:26
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
python.xAODType.dummy
dummy
Definition: xAODType.py:4
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getSectorLogicData
const Lvl1MuSectorLogicDataPhase1 & getSectorLogicData(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
Definition: Lvl1MuCTPIInputPhase1.cxx:41
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getSectorLogicDataPtr
std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > getSectorLogicDataPtr(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
Definition: Lvl1MuCTPIInputPhase1.cxx:56
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Barrel
@ Barrel
Definition: Lvl1MuCTPIInputPhase1.h:48
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
LVL1MUONIF::Lvl1MuForwardSectorLogicDataPhase1
Class representing data from an forward SL board.
Definition: Lvl1MuForwardSectorLogicDataPhase1.h:26
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfEndcapSector
@ NumberOfEndcapSector
Definition: Lvl1MuCTPIInputPhase1.h:53
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idEndcapSystem
static size_t idEndcapSystem()
Definition: Lvl1MuCTPIInputPhase1.h:137
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfBarrelSector
static size_t numberOfBarrelSector()
Definition: Lvl1MuCTPIInputPhase1.h:136
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfForwardSector
@ NumberOfForwardSector
Definition: Lvl1MuCTPIInputPhase1.h:54
LVL1MUONIF::Lvl1MuCTPIInputPhase1::isEmpty
bool isEmpty(size_t systemAddress, int bcid=0) const
Return "true" if data of specified system is empty.
Definition: Lvl1MuCTPIInputPhase1.cxx:164
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideC
static size_t idSideC()
Definition: Lvl1MuCTPIInputPhase1.h:142
DeMoScan.first
bool first
Definition: DeMoScan.py:536
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idBarrelSystem
static size_t idBarrelSystem()
Definition: Lvl1MuCTPIInputPhase1.h:135
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfEndcapSector
static size_t numberOfEndcapSector()
Definition: Lvl1MuCTPIInputPhase1.h:138
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Lvl1MuCTPIInputPhase1
Lvl1MuCTPIInputPhase1()
Definition: Lvl1MuCTPIInputPhase1.cxx:11
LVL1MUONIF::Lvl1MuCTPIInputPhase1::reserve
size_t reserve(size_t systemAddress, int bcid=0)
Definition: Lvl1MuCTPIInputPhase1.cxx:131
LVL1MUONIF::Lvl1MuCTPIInputPhase1::m_isFilledOutOfTimeCandidates
std::array< bool, NumberOfMuonSystem > m_isFilledOutOfTimeCandidates
Definition: Lvl1MuCTPIInputPhase1.h:130
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfForwardSector
static size_t numberOfForwardSector()
Definition: Lvl1MuCTPIInputPhase1.h:140
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Endcap
@ Endcap
Definition: Lvl1MuCTPIInputPhase1.h:48
LVL1MUONIF::operator<<
std::ostream & operator<<(std::ostream &out, const Lvl1MuCTPIInput &right)
Definition: Lvl1MuCTPIInput.cxx:218