ATLAS Offline Software
PADdata.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
9 PADdata::PADdata(CMAdata* cma_data,unsigned long int debug) :
10  BaseObject(Data,"PAD data"),m_debug(debug)
11 {
12  m_pad_patterns.clear();
13 
14  CMAdata::PatternsList cma_patterns = cma_data->give_patterns();
15  CMAdata::PatternsList::const_iterator CMApatterns = cma_patterns.begin();
16 
17  while(CMApatterns != cma_patterns.end())
18  {
20  ++CMApatterns;
21  }
22 }
23 
24 PADdata::PADdata(const PADdata& pad_data) :
25  BaseObject(Data,pad_data.name()),
26  m_debug(pad_data.debug()),
27  m_pad_patterns(pad_data.pad_patterns())
28 {
29 }
30 
32 {
33  m_pad_patterns.clear();
34 }
35 
36 PADdata
37 PADdata::operator=(const PADdata& pad_data)
38 {
39  static_cast<BaseObject&>(*this) = static_cast<const BaseObject&>(pad_data);
40  m_pad_patterns.clear();
41  m_pad_patterns = pad_data.pad_patterns();
42  m_debug = pad_data.debug();
43  return *this;
44 }
45 
46 void
48 {
49  const int pad_id = cma_patterns->cma_parameters().id().PAD_index();
50  const int sector = cma_patterns->sector();
51  PADpatterns* patterns = find(sector,pad_id);
52  if(patterns) patterns->load_cma_patterns(cma_patterns);
53  else {
54  PADpatterns thePatterns(sector,pad_id,m_debug);
55  thePatterns.load_cma_patterns(cma_patterns);
56  m_pad_patterns.push_back(thePatterns);
57  }
58 }
59 
60 
62 PADdata::find(const int sector,const int pad_id)
63 {
65  while (it != m_pad_patterns.end())
66  {
67  if((*it).pad_id() == pad_id &&
68  (*it).sector() == sector ) return &(*it);
69  ++it;
70  }
71 
72  return 0;
73 }
74 
75 
78 {
80 
82 
83  while(pad != m_pad_patterns.end())
84  {
85  patterns.push_back(&(*pad));
86  ++pad;
87  }
88 
89  return patterns;
90 }
91 
92 
93 void PADdata::PrintElement(std::ostream& stream,std::string element,bool detail)
94  const
95 {
96  bool all = (element == name() || element == "")? true : false;
97  bool nPad = m_pad_patterns.size();
98  bool printed = false;
99 
100  if(nPad && (element == (*m_pad_patterns.begin()).name() || all))
101  {
102  stream << name() << " contains " << m_pad_patterns.size()
103  << " pad patterns:" << std::endl;
104  printed = true;
105  PATTERNSlist::const_iterator it = m_pad_patterns.begin();
106  while(it != m_pad_patterns.end())
107  {
108  it->Print(stream,detail);
109  ++it;
110  }
111  }
112 
113  if(!printed)
114  {
115  if (element == "") element = "PADs";
116  stream << name() << " contains no " << element << "!" << std::endl;
117  }
118 }
119 
120 
121 void PADdata::Print(std::ostream& stream,bool detail) const
122 {
123  stream << name() << " contains "
124  << m_pad_patterns.size()
125  << " pad patterns " << std::endl;
126 
127  PATTERNSlist::const_iterator pad = pad_patterns().begin();
128 
129  while(pad != pad_patterns().end())
130  {
131  (*pad).Print(stream,detail);
132  ++pad;
133  }
134 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
BaseObject::name
const std::string & name() const
Definition: BaseObject.h:23
patterns
std::vector< std::string > patterns
Definition: listroot.cxx:187
Data
@ Data
Definition: BaseObject.h:11
skel.it
it
Definition: skel.GENtoEVGEN.py:396
PADdata::m_pad_patterns
PATTERNSlist m_pad_patterns
Definition: PADdata.h:23
PADdata::PrintElement
void PrintElement(std::ostream &, std::string, bool) const
Definition: PADdata.cxx:93
detail
Definition: extract_histogram_tag.cxx:14
CMAparameters::id
const CMAidentity & id() const
Definition: CMAparameters.cxx:17
PADdata::operator=
PADdata operator=(const PADdata &)
Definition: PADdata.cxx:37
CMAdata
Definition: CMAdata.h:19
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
PADdata::PADdata
PADdata(CMAdata *, unsigned long int)
Definition: PADdata.cxx:9
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
PADpatterns
Definition: PADpatterns.h:20
CMAdata::PatternsList
std::list< CMApatterns * > PatternsList
Definition: CMAdata.h:22
CMAdata.h
PADdata::PatternsList
std::list< PADpatterns * > PatternsList
Definition: PADdata.h:19
CMApatterns::cma_parameters
const CMAparameters & cma_parameters(void) const
Definition: CMApatterns.h:87
CMAdata::give_patterns
PatternsList give_patterns(void)
Definition: CMAdata.cxx:139
PADdata::m_debug
unsigned long int m_debug
Definition: PADdata.h:22
PADpatterns::load_cma_patterns
void load_cma_patterns(CMApatterns *)
Definition: PADpatterns.cxx:67
PADdata
Definition: PADdata.h:16
PADdata::pad_patterns
const PATTERNSlist & pad_patterns(void) const
Definition: PADdata.h:39
PADdata::debug
unsigned long int debug(void) const
Definition: PADdata.h:37
PADdata::create_pad_patterns
void create_pad_patterns(CMApatterns *)
Definition: PADdata.cxx:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
BaseObject
Definition: BaseObject.h:13
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67
CMAidentity::PAD_index
int PAD_index() const
Definition: CMAidentity.cxx:122
PADdata::Print
void Print(std::ostream &, bool) const
Definition: PADdata.cxx:121
PADdata::give_patterns
PatternsList give_patterns(void)
Definition: PADdata.cxx:77
CMApatterns::sector
int sector(void) const
Definition: CMApatterns.h:86
CMApatterns
Definition: CMApatterns.h:21
PADdata::find
PADpatterns * find(const int, const int)
Definition: PADdata.cxx:62
PADdata::~PADdata
~PADdata()
Definition: PADdata.cxx:31
PADdata.h