ATLAS Offline Software
CMAdata.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 
7 CMAdata::CMAdata(unsigned long int debug) :
8  BaseObject(Data,"CMApatterns"),m_debug(debug)
9 {
10  m_eta_cma_patterns.clear();
11  m_phi_cma_patterns.clear();
12 }
13 
14 CMAdata::CMAdata(const RPCdata* rpcData,const RpcCablingCondData* rpcCabling, const unsigned long int debug) :
15  BaseObject(Data,"CMApatterns"),
16  m_debug(debug)
17 {
18  m_eta_cma_patterns.clear();
19  m_phi_cma_patterns.clear();
20 
22  RPCdata::digitList::const_iterator digi = eta.begin();
23 
24  while(digi != eta.end())
25  {
26  const int sector = (*digi)->decoding().logic_sector();
27  const ViewType type = (*digi)->decoding().view();
28  const int station = (*digi)->decoding().lvl1_station();
29  const int cabling_code = (*digi)->decoding().cabling_code();
30 
31  const CMAparameters::CMAlist list = rpcCabling->give_CMAs(sector,type,station,cabling_code);
32  CMAparameters::CMAlist::const_iterator cma = list.begin();
33  while(cma != list.end())
34  {
35  create_patterns(*cma,*digi);
36  ++cma;
37  }
38  ++digi;
39  }
40 
42  digi = phi.begin();
43  while(digi != phi.end())
44  {
45  const int sector = (*digi)->decoding().logic_sector();
46  const ViewType type = (*digi)->decoding().view();
47  const int station = (*digi)->decoding().lvl1_station();
48  const int cabling_code = (*digi)->decoding().cabling_code();
49 
50  const CMAparameters::CMAlist list = rpcCabling->give_CMAs(sector,type,station,cabling_code);
51  CMAparameters::CMAlist::const_iterator cma = list.begin();
52  while(cma != list.end())
53  {
54  create_patterns(*cma,*digi);
55  ++cma;
56  }
57  ++digi;
58  }
59 }
60 
61 
62 CMAdata::CMAdata(const CMAdata& cma_patterns) :
63  BaseObject(Data,cma_patterns.name()),
64  m_debug(cma_patterns.debug()),
65  m_eta_cma_patterns(cma_patterns.eta_cma_patterns()),
66  m_phi_cma_patterns(cma_patterns.phi_cma_patterns())
67 {
68 }
69 
71 {
72  m_eta_cma_patterns.clear();
73  m_phi_cma_patterns.clear();
74 }
75 
76 CMAdata
77 CMAdata::operator=(const CMAdata& cma_patterns)
78 {
79  static_cast<BaseObject&>(*this) =
80  static_cast<const BaseObject&>(cma_patterns);
81  m_eta_cma_patterns.clear();
82  m_phi_cma_patterns.clear();
83  m_eta_cma_patterns = cma_patterns.eta_cma_patterns();
84  m_phi_cma_patterns = cma_patterns.phi_cma_patterns();
85  m_debug = cma_patterns.debug();
86  return *this;
87 }
88 
89 void
91 {
93 
94  const int sector = digit->decoding().logic_sector();
95  const ViewType type = digit->decoding().view();
96 
97  if( (patterns = find(sector,cma)) ) patterns->load_digit(digit);
98  else
99  {
100  CMApatterns patterns(sector,cma,m_debug);
101  patterns.load_digit(digit);
102  if(type == Eta) m_eta_cma_patterns.push_back(std::move(patterns));
103  else if (type == Phi) m_phi_cma_patterns.push_back(std::move(patterns));
104  }
105 }
106 
107 
109 CMAdata::find(const int sector,const CMAparameters* cma)
110 {
111  const ViewType view = cma->id().type();
112 
113  if(view == Eta)
114  {
116  while (it != m_eta_cma_patterns.end())
117  {
118  if((*it).cma_parameters() == *cma &&
119  (*it).sector() == sector ) return &(*it);
120  ++it;
121  }
122  }
123  else if (view == Phi)
124  {
126  while (it != m_phi_cma_patterns.end())
127  {
128  if((*it).cma_parameters() == *cma &&
129  (*it).sector() == sector ) return &(*it);
130  ++it;
131  }
132  }
133 
134  return 0;
135 }
136 
137 
140 {
142 
145 
146  while(eta != m_eta_cma_patterns.end())
147  {
148  patterns.push_back(&(*eta));
149  ++eta;
150  }
151  while(phi != m_phi_cma_patterns.end())
152  {
153  patterns.push_back(&(*phi));
154  ++phi;
155  }
156  return patterns;
157 }
158 
159 
160 void CMAdata::PrintElement(std::ostream& stream,std::string element,bool detail)
161  const
162 {
163  bool all = (element == name() || element == "")? true : false;
164  bool nEta = eta_cma_patterns().size();
165  bool nPhi = phi_cma_patterns().size();
166  bool printed = false;
167 
168  if(nEta && (element == (*m_eta_cma_patterns.begin()).name() || all))
169  {
170  stream << name() << " contains " << eta_cma_patterns().size()
171  << " eta patterns:" << std::endl;
172  printed = true;
173  PATTERNSlist::const_iterator it = m_eta_cma_patterns.begin();
174  while(it != m_eta_cma_patterns.end())
175  {
176  it->Print(stream,detail);
177  ++it;
178  }
179  }
180 
181  if (nPhi && (element == (*m_phi_cma_patterns.begin()).name() || all))
182  {
183  stream << name() << " contains " << phi_cma_patterns().size()
184  << " phi patterns:" << std::endl;
185  printed = true;
186  PATTERNSlist::const_iterator it = m_phi_cma_patterns.begin();
187  while(it != m_phi_cma_patterns.end())
188  {
189  it->Print(stream,detail);
190  ++it;
191  }
192  }
193 
194  if(!printed)
195  {
196  if (element == "") element = "CMAs";
197  stream << name() << " contains no " << element << "!" << std::endl;
198  }
199 }
200 
201 
202 void CMAdata::Print(std::ostream& stream,bool detail) const
203 {
204  stream << name() << " contains "
205  << eta_cma_patterns().size()
206  << " eta patterns and " << phi_cma_patterns().size()
207  << " phi patterns" << std::endl;
208 
209  PATTERNSlist::const_iterator eta = eta_cma_patterns().begin();
210  PATTERNSlist::const_iterator phi = phi_cma_patterns().begin();
211 
212  while(eta != eta_cma_patterns().end())
213  {
214  (*eta).Print(stream,detail);
215  ++eta;
216  }
217  while(phi != phi_cma_patterns().end())
218  {
219  (*phi).Print(stream,detail);
220  ++phi;
221  }
222 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
CMAdata::debug
unsigned long int debug(void) const
Definition: CMAdata.h:45
BaseObject::name
const std::string & name() const
Definition: BaseObject.h:23
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CMAdata::create_patterns
void create_patterns(const CMAparameters *, const RPCdigit *)
Definition: CMAdata.cxx:90
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
patterns
std::vector< std::string > patterns
Definition: listroot.cxx:187
CMAdata::m_debug
unsigned long int m_debug
Definition: CMAdata.h:25
CMAidentity::type
ViewType type() const
Definition: CMAidentity.cxx:117
Data
@ Data
Definition: BaseObject.h:11
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67
CMAparameters::CMAlist
std::list< const CMAparameters * > CMAlist
Definition: CMAparameters.h:24
detail
Definition: extract_histogram_tag.cxx:14
CMAparameters::id
const CMAidentity & id() const
Definition: CMAparameters.cxx:17
Phi
@ Phi
Definition: RPCdef.h:8
RPCdata::eta_digits_list
virtual digitList eta_digits_list(void) const =0
CMAdata::m_eta_cma_patterns
PATTERNSlist m_eta_cma_patterns
Definition: CMAdata.h:27
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
CMAdata::find
CMApatterns * find(const int, const CMAparameters *)
Definition: CMAdata.cxx:109
CMAdata
Definition: CMAdata.h:19
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
TrigVSI::AlgConsts::nPhi
constexpr int nPhi
Default bin number of phi for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:27
CMAdata::PrintElement
void PrintElement(std::ostream &, std::string, bool) const
Definition: CMAdata.cxx:160
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
RpcCablingCondData
Definition: RpcCablingCondData.h:21
CMAdata::operator=
CMAdata operator=(const CMAdata &)
Definition: CMAdata.cxx:77
CMAdata::PatternsList
std::list< CMApatterns * > PatternsList
Definition: CMAdata.h:22
CMAdata.h
CMAdata::m_phi_cma_patterns
PATTERNSlist m_phi_cma_patterns
Definition: CMAdata.h:28
CMAdata::give_patterns
PatternsList give_patterns(void)
Definition: CMAdata.cxx:139
ViewType
ViewType
Definition: RPCdef.h:8
CMAdata::eta_cma_patterns
const PATTERNSlist & eta_cma_patterns(void) const
Definition: CMAdata.h:47
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
RPCdata
Definition: RPCdata.h:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
BaseObject
Definition: BaseObject.h:13
RPCdigit
Definition: RPCdigit.h:16
CMAdata::Print
void Print(std::ostream &, bool) const
Definition: CMAdata.cxx:202
CMAparameters
Definition: CMAparameters.h:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RPCdata::phi_digits_list
virtual digitList phi_digits_list(void) const =0
RPCdata::digitList
std::list< const RPCdigit * > digitList
Definition: RPCdata.h:21
CMAdata::~CMAdata
~CMAdata()
Definition: CMAdata.cxx:70
CMApatterns
Definition: CMApatterns.h:21
TrigVSI::AlgConsts::nEta
constexpr int nEta
Default bin number of eta for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:26
CMAdata::CMAdata
CMAdata(unsigned long int)
Definition: CMAdata.cxx:7
RpcCablingCondData::give_CMAs
const CMAparameters::CMAlist give_CMAs(const int logic_sector, const ViewType side, const int station, const int cabling_code) const
Definition: RpcCablingCondData.cxx:178
CMAdata::phi_cma_patterns
const PATTERNSlist & phi_cma_patterns(void) const
Definition: CMAdata.h:49
Eta
@ Eta
Definition: RPCdef.h:8
drawFromPickle.view
view
Definition: drawFromPickle.py:294