ATLAS Offline Software
Lvl1MuEndcapSectorLogicDataPhase1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 #include <iomanip>
5 #include <iostream>
6 
9 
10 namespace LVL1MUONIF {
11 
14  m_id_system = 1;
15  initialize();
16  }
17 
19  if ( ( right.getSystemId() == m_id_system ) &&
20  ( this != &right ) ) {
21  m_bcid = right.bcid();
22  m_nsw = right.nsw();
24  for ( size_t i = 0; i < NCAND[m_id_system]; ++i ) {
25  m_roi[ i ] = right.roi( i );
26  m_ovl[ i ] = right.ovl( i );
27  m_pt[ i ] = right.pt( i );
28  m_charge[ i ] = right.charge( i );
29  m_2candidates[ i ] = right.is2candidates( i );
30  m_goodmf[ i ] = right.goodmf(i);
31  m_innercoin[ i ] = right.innercoin(i);
32  m_bw2or3[ i ] = right.bw2or3(i);
33  m_veto[ i ] = right.veto(i);
34  }
35  }
36  return *this;
37  }
38 
40 
41  SectorLogicWord val(std::make_pair(0, 0));
42  unsigned int len=0;
43  unsigned int pos=0;
44  for (size_t i=0;i<NCAND[m_id_system];i++)
45  {
46  //track current position and length of current data
47  len=0;
48  pos=0;
49 
50  // Candidate 'i' will be offset by 16*i bits
51  //0-7: ROI - 8 bits
52  len=NBITS_ROI[m_id_system];
53  if (roi(i) < 0) val.first |= len << (i*16+pos);
54  else val.first |= (roi(i) & len) << (i*16+pos);
55  pos += len;
56 
57  //8-11: pT - 4 bits
58  len=NBITS_PT[m_id_system];
59  val.first |= (pt(i) & len) << (i*16+pos);
60  pos += len;
61 
62  //12: charge
63  len=NBITS_CHARGE[m_id_system];
64  val.first |= (charge(i) & len) << (i*16+pos);
65  pos += len;
66 
67  //13: 2 or 3 hits in BW
68  len=NBITS_BW2OR3[m_id_system];
69  val.first |= (bw2or3(i) & len) << (i*16+pos);
70  pos += len;
71 
72  //14: inner coincidence
73  len=NBITS_CHARGE[m_id_system];
74  if (charge(i) > 0) val.first |= (1 >> (i*16+pos)) & len;
75  pos += len;
76 
77  //15: GoodMF
78  len=NBITS_GOODMF[m_id_system];
79  val.first |= (goodmf(i) & len) << (i*16+pos);
80  pos += len;
81  }
82 
83 
84  // Global+BCID flags (bits 32-47)
85  len=0;
86  pos=0;
87 
88  //0-11: BCID
89  len=NBITS_BCID[m_id_system];
90  val.second |= ( bcid() & len);
91  pos += len;
92 
93  //12-15: global flags
94  //12: >1cand/sector
95  len=NBITS_IS2CANDIDATESINSECTOR[m_id_system];
96  if (is2candidatesInSector()) val.second |= (1 >> pos) & len;
97  pos += len;
98 
99  //13: nsw monitoring
100  len=NBITS_NSWMON[m_id_system];
101  if (nsw()) val.second |= (1 >> pos) & len;
102  pos += len;
103 
104  return val;
105  }
106 
107 
109 
110  unsigned int val;
111  unsigned int pos=0;
112  unsigned int len=0;
113  for (size_t i=0;i<NCAND[m_id_system];i++)
114  {
115  //track current position and length of current data
116  len=0;
117  pos=0;
118 
119  // Candidate 'i' will be offset by 16*i bits
120  //0-7: ROI - 8 bits
121  len=NBITS_ROI[m_id_system];
122  val = (value.first >> (i*16+pos)) & len;
123  if (val == len) roi(i, -1);
124  else roi(i, val);
125  pos += len;
126 
127  //8-11: pT - 4 bits
128  len=NBITS_PT[m_id_system];
129  val = (value.first >> (i*16+pos)) & len;
130  if (val == len) pt(i, -1);
131  else pt(i, val);
132  pos += len;
133 
134  //12: charge
135  len=NBITS_CHARGE[m_id_system];
136  val = (value.first >> (i*16+pos)) & len;
137  if (val > 0) charge(i, +1);
138  else charge(i, -1);
139  pos += len;
140 
141  //13: 2 or 3 hits in BW
142  len=NBITS_BW2OR3[m_id_system];
143  val = (value.first >> (i*16+pos)) & len;
144  bw2or3(i, val);
145  pos += len;
146 
147  //14: inner coincidence
148  len=NBITS_INNERCOIN[m_id_system];
149  val = (value.first >> (i*16+pos)) & len;
150  innercoin(i, val);
151  pos += len;
152 
153  //15: GoodMF
154  len=NBITS_GOODMF[m_id_system];
155  val = (value.first >> (i*16+pos)) & len;
156  goodmf(i, val);
157  pos += len;
158  }
159 
160  // Global+BCID flags (bits 32-47)
161  len=0;
162  pos=0;
163 
164  //0-11: BCID
165  len=NBITS_BCID[m_id_system];
166  val = value.second & len;
167  bcid(val);
168  pos += len;
169 
170  //12: > 2 candidates
171  len=NBITS_IS2CANDIDATESINSECTOR[m_id_system];
172  val = (value.second >> pos) & len;
175 
176  //13: nsw monitoring
177  len=NBITS_NSWMON[m_id_system];
178  val = (value.second >> pos) & len;
179  nsw(val);
180 
181  //14-15: other global flags (empty for now)
182 
183  return *this;
184  }
185 
186 
187  void Lvl1MuEndcapSectorLogicDataPhase1::printOut( std::ostream& out ) const {
188 
189  for (size_t i=0;i<NCAND[m_id_system];i++)
190  {
191  out << "Bit 0-7 " << " ROI<" << i+1 << "> ";
192  if (roi(i) == -1) out << "NA" << std::endl;
193  else out << std::setw(8) << roi(i) << std::endl;
194 
195  out << "Bit 8-11 "<< "Pt" << i+1 << " ";
196  if (pt(i) == -1) out << "No Hit" << std::endl;
197  else out << pt(i) << std::endl;
198 
199  out << "Bit 12 "<<"2 candidates in ROI<" << i+1 << "> ";
200  out << std::setw(8) << is2candidates(i) << std::endl;
201 
202  out << "Bit 13-14 "<<"overlap<"<<i+1<<"> ";
203  out << std::setw(8) << ovl(i) << std::endl;
204 
205  out << "Bit 15 "<<"charge<"<<i+1<<"> ";
206  out << std::setw(8) << charge(i) << std::endl;
207  }
208  out << "Bit 0-11 " << " BCID ";
209  out << std::setw( 8 ) << bcid() << std::endl;
210 
211  out << "Bit 12 " << " >2candidates in a sector ";
212  out << std::setw( 8 ) << m_2candidatesInSector << std::endl;
213 
214  out << "Bit 13 " << " NSW monitoring ";
215  out << std::setw( 8 ) << m_nsw << std::endl;
216  }
217 
218 } // namespace LVL1MUONIF
Lvl1MuEndcapSectorLogicDataPhase1.h
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_bcid
int m_bcid
Definition: Lvl1MuSectorLogicDataPhase1.h:96
Lvl1MuSectorLogicConstantsPhase1.h
LVL1MUONIF
Namespace for the LVL1 muon interface classes.
Definition: Lvl1MuBarrelSectorLogicData.cxx:9
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::innercoin
int innercoin(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:56
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_bw2or3
std::vector< int > m_bw2or3
Definition: Lvl1MuSectorLogicDataPhase1.h:102
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1::convertFromWordFormat
const Lvl1MuSectorLogicDataPhase1 & convertFromWordFormat(const SectorLogicWord &)
Convert SectorLogicDataPhase1 from 32 bit word data.
Definition: Lvl1MuEndcapSectorLogicDataPhase1.cxx:108
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::nsw
int nsw() const
Definition: Lvl1MuSectorLogicDataPhase1.h:49
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_pt
std::vector< int > m_pt
Definition: Lvl1MuSectorLogicDataPhase1.h:94
athena.value
value
Definition: athena.py:122
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1::operator=
Lvl1MuEndcapSectorLogicDataPhase1 & operator=(const Lvl1MuSectorLogicDataPhase1 &right)
Definition: Lvl1MuEndcapSectorLogicDataPhase1.cxx:18
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::bw2or3
int bw2or3(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:57
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_roi
std::vector< int > m_roi
Definition: Lvl1MuSectorLogicDataPhase1.h:92
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1::Lvl1MuEndcapSectorLogicDataPhase1
Lvl1MuEndcapSectorLogicDataPhase1()
Definition: Lvl1MuEndcapSectorLogicDataPhase1.cxx:12
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1
Class representing data from an endcap SL board.
Definition: Lvl1MuEndcapSectorLogicDataPhase1.h:26
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_goodmf
std::vector< int > m_goodmf
Definition: Lvl1MuSectorLogicDataPhase1.h:100
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_2candidatesInSector
bool m_2candidatesInSector
Definition: Lvl1MuSectorLogicDataPhase1.h:91
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1::printOut
virtual void printOut(std::ostream &out) const
print out data
Definition: Lvl1MuEndcapSectorLogicDataPhase1.cxx:187
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::ovl
int ovl(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:51
LVL1MUONIF::Lvl1MuEndcapSectorLogicDataPhase1::getWordFormat
SectorLogicWord getWordFormat() const
Get data in 32 bit word format.
Definition: Lvl1MuEndcapSectorLogicDataPhase1.cxx:39
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::set2candidatesInSector
void set2candidatesInSector()
Definition: Lvl1MuSectorLogicDataPhase1.h:60
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::SectorLogicWord
std::pair< unsigned long int, unsigned short int > SectorLogicWord
Definition: Lvl1MuSectorLogicDataPhase1.h:45
lumiFormat.i
int i
Definition: lumiFormat.py:92
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_nsw
int m_nsw
Definition: Lvl1MuSectorLogicDataPhase1.h:97
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_innercoin
std::vector< int > m_innercoin
Definition: Lvl1MuSectorLogicDataPhase1.h:101
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1
Base class for the data coming from one SL board.
Definition: Lvl1MuSectorLogicDataPhase1.h:35
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::charge
int charge(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:53
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::veto
int veto(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:58
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::initialize
void initialize()
Definition: Lvl1MuSectorLogicDataPhase1.cxx:35
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::goodmf
int goodmf(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:55
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::getSystemId
int getSystemId() const
Definition: Lvl1MuSectorLogicDataPhase1.h:84
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_ovl
std::vector< int > m_ovl
Definition: Lvl1MuSectorLogicDataPhase1.h:93
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::pt
int pt(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:52
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_charge
std::vector< int > m_charge
Definition: Lvl1MuSectorLogicDataPhase1.h:98
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::is2candidates
bool is2candidates(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:54
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::roi
int roi(size_t id) const
Definition: Lvl1MuSectorLogicDataPhase1.h:50
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::bcid
int bcid() const
Definition: Lvl1MuSectorLogicDataPhase1.h:48
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::clear2candidatesInSector
void clear2candidatesInSector()
Definition: Lvl1MuSectorLogicDataPhase1.h:61
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_2candidates
std::vector< bool > m_2candidates
Definition: Lvl1MuSectorLogicDataPhase1.h:95
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::is2candidatesInSector
bool is2candidatesInSector() const
Definition: Lvl1MuSectorLogicDataPhase1.h:47
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_id_system
int m_id_system
Definition: Lvl1MuSectorLogicDataPhase1.h:99
LVL1MUONIF::Lvl1MuSectorLogicDataPhase1::m_veto
std::vector< int > m_veto
Definition: Lvl1MuSectorLogicDataPhase1.h:103
NCAND
#define NCAND
Definition: SuperPointData.h:11