ATLAS Offline Software
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 
12  for (size_t isys=0; isys<NumberOfMuonSystem; isys++){
13  m_isFilledOutOfTimeCandidates[isys] = false;
14  }}
15 
18  *this = right;
19  }
20 
23  clearAll();
24  }
25 
27 
29  if ( this != &right ) {
30  clearAll();
31  for (size_t idSys=0; idSys<NumberOfMuonSystem; idSys++){
32  for( size_t ip=0; ip<right.m_data[idSys].size(); ip++){
33  int bc=((right.m_data[idSys]).at(ip)).first;
34  Lvl1MuVect vSL(((right.m_data[idSys]).at(ip)).second);
35  m_data[idSys].push_back(std::make_pair(bc,vSL));
36  }
38  }
39  }
40  return *this;
41  }
42 
43 
44 
47  size_t subSystemAddress,
48  size_t sectorAddress,
49  int bcid ) const {
51  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
52  int bc=((m_data[systemAddress]).at(ip)).first;
53  if (bc != bcid) continue;
54  const Lvl1MuVect vecSL( ((m_data[systemAddress]).at(ip)).second);
55  return *(vecSL.at(getSystemIndex(systemAddress,subSystemAddress,sectorAddress)));
56  }
57  return dummy;
58  }
59 
61  std::shared_ptr<Lvl1MuSectorLogicDataPhase1> Lvl1MuCTPIInputPhase1::getSectorLogicDataPtr( size_t systemAddress,
62  size_t subSystemAddress,
63  size_t sectorAddress,
64  int bcid ) const {
65  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
66  int bc=((m_data[systemAddress]).at(ip)).first;
67  if (bc != bcid) continue;
68  return m_data[systemAddress].at(ip).second.at(getSystemIndex(systemAddress,subSystemAddress,sectorAddress));
69  }
70  return nullptr;
71  }
72 
75  size_t systemAddress,
76  size_t subSystemAddress,
77  size_t sectorAddress,
78  int bcid ) {
79  size_t ip=0;
80  if (isEmpty(systemAddress,bcid)) {
81  ip = reserve( systemAddress, bcid );
82  } else {
83  ip = getBcidIndex( systemAddress, bcid );
84  }
85 
86  Lvl1MuVect vecSL((((m_data[systemAddress]).at(ip)).second));
87  size_t idx= getSystemIndex(systemAddress,subSystemAddress,sectorAddress);
88  if ( systemAddress == Barrel ) {
89  *std::dynamic_pointer_cast<Lvl1MuBarrelSectorLogicDataPhase1>(vecSL.at(idx)) = data;
90  } else if ( systemAddress == Endcap ) {
91  *std::dynamic_pointer_cast<Lvl1MuEndcapSectorLogicDataPhase1>(vecSL.at(idx))= data;
92  } else if ( systemAddress == Forward ) {
93  *std::dynamic_pointer_cast<Lvl1MuForwardSectorLogicDataPhase1>(vecSL.at(idx))= data;
94  }
95  }
96 
99  size_t systemAddress,
100  size_t subSystemAddress,
101  size_t sectorAddress,
102  int bcid ) {
103  // convert to SectorLogicDataPhase1
104  std::unique_ptr<Lvl1MuSectorLogicDataPhase1> pData;
105  if ( systemAddress == Barrel ) {
106  pData = std::make_unique<Lvl1MuBarrelSectorLogicDataPhase1>();
107  } else if ( systemAddress == Endcap ) {
108  pData = std::make_unique<Lvl1MuEndcapSectorLogicDataPhase1>();
109  } else if ( systemAddress == Forward ) {
110  pData = std::make_unique<Lvl1MuForwardSectorLogicDataPhase1>();
111  } else {
112  return ;
113  }
114  pData->convertFromWordFormat( sectorWord );
115  setSectorLogicData( *pData, systemAddress, subSystemAddress, sectorAddress, bcid );
116  }
117 
120  if ( this == &right ) return;
121 
122  for (size_t idSys=0; idSys<NumberOfMuonSystem; idSys++){
123  for( size_t ip=0; ip<right.m_data[idSys].size(); ip++){
124  int bc=((right.m_data[idSys]).at(ip)).first;
125  if (isEmpty( idSys, bc)){
126  Lvl1MuVect vSL(((right.m_data[idSys]).at(ip)).second);
127  m_data[idSys].push_back(std::make_pair(bc,vSL));
129  }
130  }
131  }
132 
133  }
134 
136  size_t Lvl1MuCTPIInputPhase1::reserve( size_t systemAddress ,
137  int bcid) {
138 
139  Lvl1MuVect vecSL;
140 
141  if ( systemAddress == Barrel ) {
142  for ( size_t id = 0; id < NumberOfBarrelSector*NumberOfMuonSubSystem; id++ ) {
143  std::shared_ptr<Lvl1MuBarrelSectorLogicDataPhase1> barrelSect = std::make_shared<Lvl1MuBarrelSectorLogicDataPhase1>();
144  vecSL.push_back(barrelSect);
145  }
146 
147  } else if ( systemAddress == Endcap ) {
148  for ( size_t id = 0; id < NumberOfEndcapSector*NumberOfMuonSubSystem; id++ ) {
149  std::shared_ptr<Lvl1MuEndcapSectorLogicDataPhase1> endcapSect = std::make_shared<Lvl1MuEndcapSectorLogicDataPhase1>();
150  vecSL.push_back(endcapSect);
151  }
152 
153  } else if ( systemAddress == Forward ) {
154  for ( size_t id = 0; id < NumberOfForwardSector*NumberOfMuonSubSystem; id++ ) {
155  std::shared_ptr<Lvl1MuForwardSectorLogicDataPhase1> forwardSect = std::make_shared<Lvl1MuForwardSectorLogicDataPhase1>();
156  vecSL.push_back(forwardSect);
157  }
158  }
159 
160  size_t ip = m_data[systemAddress].size();
161  m_data[systemAddress].push_back( std::make_pair(bcid, vecSL) );
162 
163  if (bcid!=0) m_isFilledOutOfTimeCandidates[systemAddress] = true;
164 
165  return ip;
166  }
167 
169  bool Lvl1MuCTPIInputPhase1::isEmpty( size_t systemAddress,
170  int bcid ) const {
171  for( size_t ip=0; ip<m_data[systemAddress].size(); ip++){
172  int bc=((m_data[systemAddress]).at(ip)).first;
173  if (bc == bcid) return false;;
174  }
175  return true;
176  }
177 
181  return true;
182  } else {
183  return false;
184  }
185  }
186 
188  void Lvl1MuCTPIInputPhase1::clear( size_t systemAddress ) {
189  m_data[systemAddress].clear();
190  }
191 
194  for ( size_t id = 0; id < NumberOfMuonSystem; id++ ) {
195  m_data[ id ].clear();
196  }
197 
198 
199  }
200 
201  std::ostream& operator<<( std::ostream& out, const Lvl1MuCTPIInputPhase1& right ) {
202 
203  size_t systemAddress;
204  size_t subSystemAddress;
205  size_t side, id;
206 
207  out << "--------- Barrel Sector ---------------------------" << std::endl;
208  systemAddress = right.idBarrelSystem();
209  for ( side = 0; side < right.NumberOfMuonSubSystem; ++side ) {
210  if ( side == 0 ) {
211  out << " ------ A Side (Z>0) ---------------------------" << std::endl;
212  subSystemAddress = right.idSideA();
213  } else {
214  out << " ------ C Side (Z<0) ---------------------------" << std::endl;
215  subSystemAddress = right.idSideC();
216  }
217  for ( id = 0; id < right.numberOfBarrelSector() ;++id ) {
218  out << " --- Sector ID : " << id << " ----------" << std::endl;
219  for( size_t ip=0; ip < right.m_data[systemAddress].size(); ip++){
220  int bc=((right.m_data[systemAddress]).at(ip)).first;
221  out << right.getSectorLogicData( systemAddress, subSystemAddress, id, bc );
222  out << " BC: " << bc;
223  out << std::endl;
224  }
225  }
226  }
227 
228  out << "--------- Endcap Sector ---------------------------" << std::endl;
229  systemAddress = right.idEndcapSystem();
230  for ( side = 0; side < right.NumberOfMuonSubSystem; ++side ) {
231  if ( side == 0 ) {
232  out << " ------ A Side (Z>0) ---------------------------" << std::endl;
233  subSystemAddress = right.idSideA();
234  } else {
235  out << " ------ C Side (Z<0) ---------------------------" << std::endl;
236  subSystemAddress = right.idSideC();
237  }
238  for ( id = 0; id < right.numberOfEndcapSector() ;++id ) {
239  out << " --- Sector ID : " << id << " ----------" << std::endl;
240  for( size_t ip=0; ip < right.m_data[systemAddress].size(); ip++){
241  int bc=((right.m_data[systemAddress]).at(ip)).first;
242  out << right.getSectorLogicData( systemAddress, subSystemAddress, id, bc );
243  out << " BC: " << bc;
244  out << std::endl;
245  }
246  }
247  }
248 
249  out << "--------- Forward Sector ---------------------------" << std::endl;
250  systemAddress = right.idForwardSystem();
251  for ( side = 0; side < right.NumberOfMuonSubSystem; ++side ) {
252  if ( side == 0 ) {
253  out << " ------ A Side (Z>0) ---------------------------" << std::endl;
254  subSystemAddress = right.idSideA();
255  } else {
256  out << " ------ C Side (Z<0) ---------------------------" << std::endl;
257  subSystemAddress = right.idSideC();
258  }
259  for ( id = 0; id < right.numberOfForwardSector() ;++id ) {
260  out << " --- Sector ID : " << id << " ----------" << std::endl;
261  for( size_t ip=0; ip < right.m_data[systemAddress].size(); ip++){
262  int bc=((right.m_data[systemAddress]).at(ip)).first;
263  out << right.getSectorLogicData( systemAddress, subSystemAddress, id, bc );
264  out << " BC: " << bc;
265  out << std::endl;
266  }
267  }
268  }
269 
270  return out;
271  }
272 }
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfForwardSector
@ NumberOfForwardSector
Definition: Lvl1MuCTPIInputPhase1.h:53
LVL1MUONIF::Lvl1MuCTPIInputPhase1::setSectorLogicData
void setSectorLogicData(const Lvl1MuSectorLogicDataPhase1 &data, size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0)
Definition: Lvl1MuCTPIInputPhase1.cxx:74
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:179
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Lvl1MuVect
std::vector< std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > > Lvl1MuVect
Definition: Lvl1MuCTPIInputPhase1.h:120
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idForwardSystem
static size_t idForwardSystem()
Definition: Lvl1MuCTPIInputPhase1.h:138
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfBarrelSector
@ NumberOfBarrelSector
Definition: Lvl1MuCTPIInputPhase1.h:51
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:119
LVL1MUONIF::Lvl1MuCTPIInputPhase1::m_isFilledOutOfTimeCandidates
bool m_isFilledOutOfTimeCandidates[NumberOfMuonSystem]
Definition: Lvl1MuCTPIInputPhase1.h:129
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:33
LVL1MUONIF::Lvl1MuCTPIInputPhase1::m_data
std::vector< Lvl1MuVectWithBC > m_data[NumberOfMuonSystem]
Definition: Lvl1MuCTPIInputPhase1.h:131
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
LVL1MUONIF::Lvl1MuCTPIInputPhase1::operator=
Lvl1MuCTPIInputPhase1 & operator=(const Lvl1MuCTPIInputPhase1 &right)
Definition: Lvl1MuCTPIInputPhase1.cxx:28
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getBcidIndex
size_t getBcidIndex(size_t systemAddress, int bcid=0) const
Definition: Lvl1MuCTPIInputPhase1.h:170
LVL1MUONIF::Lvl1MuCTPIInputPhase1::clear
void clear(size_t systemAddress)
Definition: Lvl1MuCTPIInputPhase1.cxx:188
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LVL1MUONIF::Lvl1MuCTPIInputPhase1::~Lvl1MuCTPIInputPhase1
virtual ~Lvl1MuCTPIInputPhase1()
Definition: Lvl1MuCTPIInputPhase1.cxx:22
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfMuonSubSystem
@ NumberOfMuonSubSystem
Definition: Lvl1MuCTPIInputPhase1.h:50
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:47
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideA
static size_t idSideA()
Definition: Lvl1MuCTPIInputPhase1.h:140
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getSystemIndex
size_t getSystemIndex(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress) const
Definition: Lvl1MuCTPIInputPhase1.h:158
LVL1MUONIF::Lvl1MuCTPIInputPhase1::clearAll
void clearAll()
Clear Sector Logic data.
Definition: Lvl1MuCTPIInputPhase1.cxx:193
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:46
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfEndcapSector
@ NumberOfEndcapSector
Definition: Lvl1MuCTPIInputPhase1.h:52
LVL1MUONIF::Lvl1MuCTPIInputPhase1::getSectorLogicDataPtr
std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > getSectorLogicDataPtr(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
Definition: Lvl1MuCTPIInputPhase1.cxx:61
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Barrel
@ Barrel
Definition: Lvl1MuCTPIInputPhase1.h:47
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idEndcapSystem
static size_t idEndcapSystem()
Definition: Lvl1MuCTPIInputPhase1.h:136
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfBarrelSector
static size_t numberOfBarrelSector()
Definition: Lvl1MuCTPIInputPhase1.h:135
LVL1MUONIF::Lvl1MuCTPIInputPhase1::isEmpty
bool isEmpty(size_t systemAddress, int bcid=0) const
Return "true" if data of specified system is empty.
Definition: Lvl1MuCTPIInputPhase1.cxx:169
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idSideC
static size_t idSideC()
Definition: Lvl1MuCTPIInputPhase1.h:141
DeMoScan.first
bool first
Definition: DeMoScan.py:534
LVL1MUONIF::Lvl1MuCTPIInputPhase1::NumberOfMuonSystem
@ NumberOfMuonSystem
Definition: Lvl1MuCTPIInputPhase1.h:49
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LVL1MUONIF::Lvl1MuCTPIInputPhase1::idBarrelSystem
static size_t idBarrelSystem()
Definition: Lvl1MuCTPIInputPhase1.h:134
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfEndcapSector
static size_t numberOfEndcapSector()
Definition: Lvl1MuCTPIInputPhase1.h:137
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Lvl1MuCTPIInputPhase1
Lvl1MuCTPIInputPhase1()
Definition: Lvl1MuCTPIInputPhase1.cxx:11
LVL1MUONIF::Lvl1MuCTPIInputPhase1::reserve
size_t reserve(size_t systemAddress, int bcid=0)
Definition: Lvl1MuCTPIInputPhase1.cxx:136
LVL1MUONIF::Lvl1MuCTPIInputPhase1::numberOfForwardSector
static size_t numberOfForwardSector()
Definition: Lvl1MuCTPIInputPhase1.h:139
LVL1MUONIF::Lvl1MuCTPIInputPhase1::Endcap
@ Endcap
Definition: Lvl1MuCTPIInputPhase1.h:47
LVL1MUONIF::operator<<
std::ostream & operator<<(std::ostream &out, const Lvl1MuCTPIInput &right)
Definition: Lvl1MuCTPIInput.cxx:223