ATLAS Offline Software
Loading...
Searching...
No Matches
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
9namespace LVL1MUONIF {
10
14
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 {
45 static const Lvl1MuBarrelSectorLogicDataPhase1 dummy;
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
175 if ( isEmpty(Barrel,bcid) && isEmpty(Endcap,bcid) && isEmpty(Forward,bcid) ) {
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}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Class representing data from a barrel SL board.
const Lvl1MuSectorLogicDataPhase1 & getSectorLogicData(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
void merge(const Lvl1MuCTPIInputPhase1 &another)
Merge SectorLogic data of another object into this data of a system (Barrel, Endcap or Forward) is no...
Lvl1MuCTPIInputPhase1 & operator=(const Lvl1MuCTPIInputPhase1 &right)
size_t getBcidIndex(size_t systemAddress, int bcid=0) const
bool isEmptyAll(int bcid=0) const
Return "true" if data of all systems for this bcid is empty.
void clearAll()
Clear Sector Logic data.
size_t reserve(size_t systemAddress, int bcid=0)
bool isEmpty(size_t systemAddress, int bcid=0) const
Return "true" if data of specified system is empty.
std::vector< std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > > Lvl1MuVect
void setSectorLogicData(const Lvl1MuSectorLogicDataPhase1 &data, size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0)
std::vector< Lvl1MuVectWithBC > m_data[NumberOfMuonSystem]
std::array< bool, NumberOfMuonSystem > m_isFilledOutOfTimeCandidates
size_t getSystemIndex(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress) const
std::shared_ptr< Lvl1MuSectorLogicDataPhase1 > getSectorLogicDataPtr(size_t systemAddress, size_t subSystemAddress, size_t sectorAddress, int bcid=0) const
Class representing data from an endcap SL board.
Class representing data from an forward SL board.
Base class for the data coming from one SL board.
std::pair< unsigned long int, unsigned short int > SectorLogicWord
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
Namespace for the LVL1 muon interface classes.
std::ostream & operator<<(std::ostream &out, const Lvl1MuCTPIInput &right)