ATLAS Offline Software
Loading...
Searching...
No Matches
RPCrawData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7using namespace std;
8
10 RPCdata("RPCrawData")
11{
12 m_eta_digits.clear();
13 m_phi_digits.clear();
14}
15
22
24{
25 m_eta_digits.clear();
26 m_phi_digits.clear();
27}
28
31{
32 m_eta_digits.clear();
33 m_phi_digits.clear();
34
35 m_eta_digits = data.eta_digits();
36 m_phi_digits = data.phi_digits();
37
38 return *this;
39}
40
41
42const RPCrawDigit*
44{
45 digit.set_data(*this);
46 if(digit.decoding().view() == Eta)
47 {
48 RPCrawData::DigitList::const_iterator dig = m_eta_digits.begin();
49 while(dig != m_eta_digits.end())
50 {
51 if(*dig == static_cast<RPCdigit&>(digit)) return &(*dig);
52 ++dig;
53 }
54 digit.set_number(m_eta_digits.size()+1);
55 m_eta_digits.push_back(digit);
56 return &m_eta_digits.back();
57 }
58 else if(digit.decoding().view() == Phi)
59 {
60 RPCrawData::DigitList::const_iterator dig = m_phi_digits.begin();
61 while(dig != m_phi_digits.end())
62 {
63 if(*dig == static_cast<RPCdigit&>(digit)) return &(*dig);
64 ++dig;
65 }
66 digit.set_number(m_phi_digits.size()+1);
67 m_phi_digits.push_back(digit);
68 return &m_phi_digits.back();
69 }
70 return 0;
71}
72
73
76{
77 return this->load_data(rpc_digit);
78}
79
82{
83 digitList list;
84 DigitList::const_iterator it = m_eta_digits.begin();
85 while(it != m_eta_digits.end())
86 {
87 list.push_back(&(*it));
88 ++it;
89 }
90 return list;
91}
92
95{
96 digitList list;
97 DigitList::const_iterator it = m_phi_digits.begin();
98 while(it != m_phi_digits.end())
99 {
100 list.push_back(&(*it));
101 ++it;
102 }
103 return list;
104}
105
106int
107RPCrawData::how_many(int type,int sector,int station,int layer,int chamber,
108 int strip) const
109{
110 int size = 0;
111
112 if(type < 0 || type == 1)
113 {
114 DigitList::const_iterator it = m_phi_digits.begin();
115 while(it != m_phi_digits.end())
116 {
117 if( (sector < 0 || sector == (*it).decoding().logic_sector()) &&
118 (station < 0 || station == (*it).decoding().lvl1_station()) &&
119 (layer < 0 || layer == (*it).decoding().rpc_layer() ) &&
120 (chamber < 0 || chamber == (*it).decoding().rpc_z_index() ) &&
121 (strip < 0 || strip == (*it).decoding().strip_number()) )
122 {
123 ++size;
124 }
125 ++it;
126 }
127 }
128
129 if(type < 0 || type == 2)
130 {
131 DigitList::const_iterator it = m_eta_digits.begin();
132 while(it != m_eta_digits.end())
133 {
134 if( (sector < 0 || sector == (*it).decoding().logic_sector()) &&
135 (station < 0 || station == (*it).decoding().lvl1_station()) &&
136 (layer < 0 || layer == (*it).decoding().rpc_layer() ) &&
137 (chamber < 0 || chamber == (*it).decoding().rpc_z_index() ) &&
138 (strip < 0 || strip == (*it).decoding().strip_number()) )
139 {
140 ++size;
141 }
142 ++it;
143 }
144 }
145
146 return size;
147}
148
149void
150RPCrawData::PrintElement(ostream& stream,std::string element,bool detail) const
151{
152 bool all = (element == name() || element == "")? true : false;
153 bool nEtaDig = m_eta_digits.size();
154 bool nPhiDig = m_phi_digits.size();
155 bool printed = false;
156
157 if (nEtaDig && (element == (*m_eta_digits.begin()).name() || all))
158 {
159 printed = true;
160 DigitList::const_iterator it = m_eta_digits.begin();
161 while(it != m_eta_digits.end())
162 {
163 it->Print(stream,detail);
164 ++it;
165 }
166 }
167
168 if (nPhiDig && (element == (*m_phi_digits.begin()).name() || all))
169 {
170 printed = true;
171 DigitList::const_iterator it = m_phi_digits.begin();
172 while(it != m_phi_digits.end())
173 {
174 it->Print(stream,detail);
175 ++it;
176 }
177 }
178
179 if(!printed)
180 {
181 if( element == "") element = "digits";
182 stream << name() << " contains no " << element << "!" << endl;
183 }
184}
185
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const std::string & name() const
Definition BaseObject.h:23
std::list< const RPCdigit * > digitList
Definition RPCdata.h:21
RPCdata(const std::string &)
Definition RPCdata.cxx:8
RPCdata::digitList phi_digits_list(void) const
RPCrawData operator=(const RPCrawData &)
DigitList m_phi_digits
Definition RPCrawData.h:24
DigitList m_eta_digits
Definition RPCrawData.h:23
const RPCrawDigit * load_data(RPCrawDigit &)
const DigitList & eta_digits(void) const
Definition RPCrawData.h:37
const RPCrawDigit * operator<<(RPCrawDigit &)
virtual int how_many(int type, int sector, int station, int layer, int chamber, int strip) const
RPCdata::digitList eta_digits_list(void) const
void PrintElement(std::ostream &, std::string, bool) const
const DigitList & phi_digits(void) const
Definition RPCrawData.h:38
STL namespace.