ATLAS Offline Software
Loading...
Searching...
No Matches
PADpatterns.cxx
Go to the documentation of this file.
1/* // -*- C++ -*- */
2
3/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
6
7
9#include <utility> // std::in_range
10#include <stdexcept>
11
12
13PADpatterns::PADpatterns(int sector, int pad,unsigned long int debug) :
14 RPCtrigDataObject(0,"PAD patterns"),m_sector(sector),m_pad_id(pad),
16{
17}
18
20 RPCtrigDataObject(PAD.number(),PAD.name())
21{
22 m_sector = PAD.sector();
23 m_pad_id = PAD.pad_id();
24 m_debug = PAD.debug();
26}
27
30{
31 static_cast<RPCtrigDataObject&>(*this) =
32 static_cast<const RPCtrigDataObject&>(PAD);
33 m_sector = PAD.sector();
34 m_pad_id = PAD.pad_id();
35 m_debug = PAD.debug();
36 m_cma_patterns.clear();
38 return *this;
39}
40
41bool
43{
44 if(m_sector == patterns.sector())
45 {
46 if (m_pad_id == patterns.pad_id() ) return true;
47 }
48 return false;
49}
50
51bool
53{
54 return !(*this == patterns);
55}
56
57
58bool
60{
61 if(m_sector < patterns.sector())
62 {
63 if (m_pad_id < patterns.pad_id() ) return true;
64 }
65 return false;
66}
67
68void
73
74
77{
78 this->load_cma_patterns(patterns);
79 return *this;
80}
81
82Pad*
83PADpatterns::give_pad(const RpcCablingCondData* readCdo, int NOBXS, int BCZERO)
84{
85 if (!m_pad)
86 {
87 int subsystem = (m_sector<32)? 0 : 1;
88 int logic_sector = m_sector%32;
89
90 CMAdata::PatternsList::iterator cma = m_cma_patterns.begin();
91
92 // M.Corradi 26/2/2010 check if old cabling from cma data !
93 bool oldSimulation = false;
94 if (cma!=m_cma_patterns.end()) {
95 if ( (*cma)->cma_parameters().conf_type() != CMAparameters::Atlas){
96 oldSimulation = true;
97 }
98 }
99
100 m_pad = std::make_unique<Pad>(0,0,m_debug,subsystem,logic_sector,m_pad_id,1,oldSimulation, NOBXS);
101
102 //M.Corradi 8/1/2015 get Pad configuration Parameters
103 bool eta_and_phi{}, feet_on{};
104 unsigned short int cma_mask{}, feet_th0{}, feet_th1{}, feet_th2{};
105 auto canBeUShort = [](auto a){return std::in_range<unsigned short>(a);};
106 if (not canBeUShort(m_pad_id) or not canBeUShort(m_sector)){
107 throw std::out_of_range("PADpatterns::give_pad: m_pad_id or m_sector are not within the range of an unsigned short int");
108 }
109 const unsigned short shortPad = static_cast<unsigned short int>(m_pad_id);
110 const unsigned short shortSector = static_cast<unsigned short int>(m_sector);
111 if (readCdo->give_Pad_Parameters(shortSector,
112 shortPad,
113 feet_on,eta_and_phi,cma_mask,
114 feet_th0,feet_th1,feet_th2)){
115 m_pad->setFeetOn(feet_on);
116 m_pad->setFeetThresholds(0,feet_th0);
117 m_pad->setFeetThresholds(1,feet_th1);
118 m_pad->setFeetThresholds(2,feet_th2);
119 // m_pad->display(1);
120 // MASK AND eta_and_phi to be implemented
121
122 }else {
123 std::runtime_error("PADpatterns::give_pad: Could not retrieve Pad Parameters m_sector, m_pad_id = " +
124 std::to_string(m_sector) + ", " + std::to_string(m_pad_id));
125 }
126
127
128 while(cma != m_cma_patterns.end())
129 {
130 Matrix* low_pt_matrix = (*cma)->give_low_pt_matrix(NOBXS, BCZERO);
131 Matrix* high_pt_matrix = (*cma)->give_high_pt_matrix(NOBXS, BCZERO);
132
133 CMAidentity id = (*cma)->cma_parameters().id();
134 int matrix_view = (id.type() == Phi)? 1 : 0;
135 int matrix_id = id.Ixx_index();
136
137 for (int bunch=0;bunch< NOBXS;++bunch)
138 {
139 m_pad->load(0,matrix_view,matrix_id,bunch,
140 low_pt_matrix->getOutputThres(bunch),
141 low_pt_matrix->getOutputOverl(bunch));
142
143 m_pad->load(1,matrix_view,matrix_id,bunch,
144 high_pt_matrix->getOutputThres(bunch),
145 high_pt_matrix->getOutputOverl(bunch));
146 }
147 ++cma;
148 }
149
150 m_pad->execute();
151 }
152 return m_pad.get();
153}
154
155void
156PADpatterns::Print(std::ostream& stream,bool detail) const
157{
158 stream << name() << " (Id = " << m_pad_id << ") in sector logic "
159 << m_sector << std::endl;
160 stream << "It contains n. " << m_cma_patterns.size()
161 << " CMAs";
162
163 if(detail)
164 {
165 stream << " :" << std::endl;
166 CMAdata::PatternsList::const_iterator cma = m_cma_patterns.begin();
167 while (cma != m_cma_patterns.end())
168 {
169 (*cma)->Print(stream,false);
170 ++cma;
171 }
172 }
173 else stream << "." << std::endl;
174}
175
static Double_t a
const std::string & name() const
Definition BaseObject.h:23
int Ixx_index() const
ubit16 getOutputThres(ubit16 bunch) const
ubit16 getOutputOverl(ubit16 bunch) const
const CMAdata::PatternsList & cma_patterns(void) const
Definition PADpatterns.h:52
Pad * give_pad(const RpcCablingCondData *readCdo, int NOBXS, int BCZERO)
void Print(std::ostream &, bool) const
void load_cma_patterns(CMApatterns *)
unsigned long int debug(void) const
Definition PADpatterns.h:50
PADpatterns operator=(const PADpatterns &)
bool operator!=(const PADpatterns &) const
bool operator<(const PADpatterns &) const
CMAdata::PatternsList m_cma_patterns
Definition PADpatterns.h:29
int sector(void) const
Definition PADpatterns.h:48
std::unique_ptr< Pad > m_pad
Definition PADpatterns.h:32
int pad_id(void) const
Definition PADpatterns.h:49
PADpatterns & operator<<(CMApatterns *)
unsigned long int m_debug
Definition PADpatterns.h:27
PADpatterns(int, int, unsigned long int)
bool operator==(const PADpatterns &) const
Definition Pad.h:10
RPCtrigDataObject(int, const std::string &)
virtual bool give_Pad_Parameters(unsigned short int logic_sector, unsigned short int PADId, bool &feet, bool &eta_and_phi, unsigned short int &cma_mask, unsigned short int &feet_th0, unsigned short int &feet_th1, unsigned short int &feet_th2) const
std::vector< std::string > patterns
Definition listroot.cxx:187