ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1TGCTrigger::TGCConnectionInPP Class Reference

#include <TGCConnectionInPP.h>

Collaboration diagram for LVL1TGCTrigger::TGCConnectionInPP:

Public Member Functions

int getChannelIn (int connectorOut, int chOut)
int getConnectorIn (int connectorOut, int chOut)
TGCPatchPanelgetPPIn (int connectorOut, int chOut)
int getOredChannelIn (int connectorOut, int chOut)
int getOredConnectorIn (int connectorOut, int chOut)
TGCPatchPanelgetOredPPIn (int connectorOut, int chOut)
int getNumberOfChannel (int i) const
bool existOredSignal () const
void readConnectionTable (TGCPatchPanel *PP)
void dumpConnection (int PPId=0) const
bool replacePatchPanelPointers (TGCPatchPanel *newPatchPanel, const std::vector< const TGCPatchPanel * > &oldPatchPanels)
 TGCConnectionInPP ()
 ~TGCConnectionInPP ()
 TGCConnectionInPP (const TGCConnectionInPP &right)
TGCConnectionInPPoperator= (const TGCConnectionInPP &right)

Private Attributes

int m_nCh [NumberOfPPOutputConnector]
TGCPatchPanel ** m_patchPanelIn [NumberOfPPOutputConnector]
int * m_channelIn [NumberOfPPOutputConnector]
int * m_connectorIn [NumberOfPPOutputConnector]
TGCPatchPanel ** m_oredPatchPanelIn [NumberOfPPOutputConnector]
int * m_oredChannelIn [NumberOfPPOutputConnector]
int * m_oredConnectorIn [NumberOfPPOutputConnector]

Detailed Description

Definition at line 15 of file TGCConnectionInPP.h.

Constructor & Destructor Documentation

◆ TGCConnectionInPP() [1/2]

LVL1TGCTrigger::TGCConnectionInPP::TGCConnectionInPP ( )

Definition at line 192 of file TGCConnectionInPP.cxx.

193{
194 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
195 m_nCh[i] = 0;
196 m_patchPanelIn[i] = 0;
197 m_channelIn[i] = 0;
198 m_connectorIn[i] = 0;
200 m_oredChannelIn[i] = 0;
201 m_oredConnectorIn[i] = 0;
202 }
203}
int * m_oredConnectorIn[NumberOfPPOutputConnector]
int m_nCh[NumberOfPPOutputConnector]
int * m_oredChannelIn[NumberOfPPOutputConnector]
TGCPatchPanel ** m_patchPanelIn[NumberOfPPOutputConnector]
TGCPatchPanel ** m_oredPatchPanelIn[NumberOfPPOutputConnector]
int * m_channelIn[NumberOfPPOutputConnector]
int * m_connectorIn[NumberOfPPOutputConnector]
const int NumberOfPPOutputConnector

◆ ~TGCConnectionInPP()

LVL1TGCTrigger::TGCConnectionInPP::~TGCConnectionInPP ( )

Definition at line 205 of file TGCConnectionInPP.cxx.

206{
207 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
208 if(m_patchPanelIn[i]!=0) delete [] m_patchPanelIn[i];
209 m_patchPanelIn[i] = 0;
210 if(m_channelIn[i]!=0) delete [] m_channelIn[i];
211 m_channelIn[i] = 0;
212 if(m_connectorIn[i]!=0) delete [] m_connectorIn[i];
213 m_connectorIn[i] = 0;
214
215 if(m_oredPatchPanelIn[i]!=0) delete [] m_oredPatchPanelIn[i];
217 if(m_oredChannelIn[i]!=0) delete [] m_oredChannelIn[i];
218 m_oredChannelIn[i] = 0;
219 if(m_oredConnectorIn[i]!=0) delete [] m_oredConnectorIn[i];
220 m_oredConnectorIn[i] = 0;
221 }
222}

◆ TGCConnectionInPP() [2/2]

LVL1TGCTrigger::TGCConnectionInPP::TGCConnectionInPP ( const TGCConnectionInPP & right)

Definition at line 225 of file TGCConnectionInPP.cxx.

226{
227 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
228 m_nCh[i] = right.m_nCh[i];
229 int nPPOutCh = m_nCh[i];
230
231 m_patchPanelIn[i] = 0;
232 if(right.m_patchPanelIn[i]) {
233 m_patchPanelIn[i] = new TGCPatchPanel* [nPPOutCh];
234 for(int iCh=0; iCh<nPPOutCh; iCh++) m_patchPanelIn[i][iCh] = right.m_patchPanelIn[i][iCh];
235 }
236
237 m_channelIn[i] = 0;
238 if(right.m_channelIn[i]) {
239 m_channelIn[i] = new int [nPPOutCh];
240 for(int iCh=0; iCh<nPPOutCh; iCh++) m_channelIn[i][iCh] = right.m_channelIn[i][iCh];
241 }
242
243 m_connectorIn[i] = 0;
244 if(right.m_connectorIn[i]) {
245 m_connectorIn[i] = new int [nPPOutCh];
246 for(int iCh=0; iCh<nPPOutCh; iCh++) m_connectorIn[i][iCh] = right.m_connectorIn[i][iCh];
247 }
248
250 if(right.m_oredPatchPanelIn[i]) {
251 m_oredPatchPanelIn[i] = new TGCPatchPanel* [nPPOutCh];
252 for(int iCh=0; iCh<nPPOutCh; iCh++) m_oredPatchPanelIn[i][iCh] = right.m_oredPatchPanelIn[i][iCh];
253 }
254
255 m_oredChannelIn[i] = 0;
256 if(right.m_oredChannelIn[i]) {
257 m_oredChannelIn[i] = new int [nPPOutCh];
258 for(int iCh=0; iCh<nPPOutCh; iCh++) m_oredChannelIn[i][iCh] = right.m_oredChannelIn[i][iCh];
259 }
260
261 m_oredConnectorIn[i] = 0;
262 if(right.m_oredConnectorIn[i]) {
263 m_oredConnectorIn[i] = new int [nPPOutCh];
264 for(int iCh=0; iCh<nPPOutCh; iCh++) m_oredConnectorIn[i][iCh] = right.m_oredConnectorIn[i][iCh];
265 }
266 }
267}

Member Function Documentation

◆ dumpConnection()

void LVL1TGCTrigger::TGCConnectionInPP::dumpConnection ( int PPId = 0) const

Definition at line 156 of file TGCConnectionInPP.cxx.

157{
158 std::ofstream file;
159 file.open("dumpConnection.out", std::ios::out | std::ios::app);
160 file.setf(std::ios::right);
161
162 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
163 for( int j=0; j<m_nCh[i]; j+=1){
164 if(m_patchPanelIn[i]!=0){
165 file.width(3); file<<PPId;
166 file.width(3); file<<i;
167 file.width(3); file<<j;
168 if(m_patchPanelIn[i][j]!=0){
169 file.width(3); file<<m_patchPanelIn[i][j]->getId();
170 file.width(3); file<<m_connectorIn[i][j];
171 file.width(3); file<<m_channelIn[i][j];
172 if(m_oredPatchPanelIn[i]!=0){
173 if(m_oredPatchPanelIn[i][j]!=0){
174 file.width(3); file<<m_oredPatchPanelIn[i][j]->getId();
175 file.width(3); file<<m_oredConnectorIn[i][j];
176 file.width(3); file<<m_oredChannelIn[i][j];
177 }
178 }
179 }else{
180 file.width(3); file<<-1;
181 file.width(3); file<<-1;
182 file.width(3); file<<-1;
183 }
184 file<<std::endl;
185 }
186 }
187 }
188
189 file.close();
190}
TFile * file

◆ existOredSignal()

bool LVL1TGCTrigger::TGCConnectionInPP::existOredSignal ( ) const

Definition at line 148 of file TGCConnectionInPP.cxx.

149{
150 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
151 if(m_oredPatchPanelIn[i]!=0) return true;
152 }
153 return false;
154}

◆ getChannelIn()

int LVL1TGCTrigger::TGCConnectionInPP::getChannelIn ( int connectorOut,
int chOut )

Definition at line 323 of file TGCConnectionInPP.cxx.

324{
325 return m_channelIn[connectorOut][chOut];
326}

◆ getConnectorIn()

int LVL1TGCTrigger::TGCConnectionInPP::getConnectorIn ( int connectorOut,
int chOut )

Definition at line 328 of file TGCConnectionInPP.cxx.

329{
330 return m_connectorIn[connectorOut][chOut];
331}

◆ getNumberOfChannel()

int LVL1TGCTrigger::TGCConnectionInPP::getNumberOfChannel ( int i) const
inline

Definition at line 24 of file TGCConnectionInPP.h.

24{return m_nCh[i];};

◆ getOredChannelIn()

int LVL1TGCTrigger::TGCConnectionInPP::getOredChannelIn ( int connectorOut,
int chOut )

Definition at line 341 of file TGCConnectionInPP.cxx.

342{
343 return m_oredChannelIn[connectorOut][chOut];
344}

◆ getOredConnectorIn()

int LVL1TGCTrigger::TGCConnectionInPP::getOredConnectorIn ( int connectorOut,
int chOut )

Definition at line 346 of file TGCConnectionInPP.cxx.

347{
348 return m_oredConnectorIn[connectorOut][chOut];
349}

◆ getOredPPIn()

TGCPatchPanel * LVL1TGCTrigger::TGCConnectionInPP::getOredPPIn ( int connectorOut,
int chOut )

Definition at line 351 of file TGCConnectionInPP.cxx.

352{
353 if(m_oredPatchPanelIn[connectorOut]!=0)
354 return m_oredPatchPanelIn[connectorOut][chOut];
355 else
356 return 0;
357}

◆ getPPIn()

TGCPatchPanel * LVL1TGCTrigger::TGCConnectionInPP::getPPIn ( int connectorOut,
int chOut )

Definition at line 333 of file TGCConnectionInPP.cxx.

334{
335 if(m_patchPanelIn[connectorOut]!=0)
336 return m_patchPanelIn[connectorOut][chOut];
337 else
338 return 0;
339}

◆ operator=()

TGCConnectionInPP & LVL1TGCTrigger::TGCConnectionInPP::operator= ( const TGCConnectionInPP & right)

Definition at line 270 of file TGCConnectionInPP.cxx.

271{
272 if( this != &right ) {
273 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
274 m_nCh[i] = right.m_nCh[i];
275 int nPPOutCh = m_nCh[i];
276
277 delete [] m_patchPanelIn[i];
278 m_patchPanelIn[i] = 0;
279 if(right.m_patchPanelIn[i]) {
280 m_patchPanelIn[i] = new TGCPatchPanel* [nPPOutCh];
281 for(int iCh=0; iCh<nPPOutCh; iCh++) m_patchPanelIn[i][iCh] = right.m_patchPanelIn[i][iCh];
282 }
283
284 delete [] m_channelIn[i];
285 m_channelIn[i] = 0;
286 if(right.m_channelIn[i]) {
287 m_channelIn[i] = new int [nPPOutCh];
288 for(int iCh=0; iCh<nPPOutCh; iCh++) m_channelIn[i][iCh] = right.m_channelIn[i][iCh];
289 }
290
291 delete [] m_connectorIn[i];
292 m_connectorIn[i] = 0;
293 if(right.m_connectorIn[i]) {
294 m_connectorIn[i] = new int [nPPOutCh];
295 for(int iCh=0; iCh<nPPOutCh; iCh++) m_connectorIn[i][iCh] = right.m_connectorIn[i][iCh];
296 }
297
298 delete [] m_oredPatchPanelIn[i];
300 if(right.m_oredPatchPanelIn[i]) {
301 m_oredPatchPanelIn[i] = new TGCPatchPanel* [nPPOutCh];
302 for(int iCh=0; iCh<nPPOutCh; iCh++) m_oredPatchPanelIn[i][iCh] = right.m_oredPatchPanelIn[i][iCh];
303 }
304
305 delete [] m_oredChannelIn[i];
306 m_oredChannelIn[i] = 0;
307 if(right.m_oredChannelIn[i]) {
308 m_oredChannelIn[i] = new int [nPPOutCh];
309 for(int iCh=0; iCh<nPPOutCh; iCh++) m_oredChannelIn[i][iCh] = right.m_oredChannelIn[i][iCh];
310 }
311
312 delete [] m_oredConnectorIn[i];
313 m_oredConnectorIn[i] = 0;
314 if(right.m_oredConnectorIn[i]) {
315 m_oredConnectorIn[i] = new int [nPPOutCh];
316 for(int iCh=0; iCh<nPPOutCh; iCh++) m_oredConnectorIn[i][iCh] = right.m_oredConnectorIn[i][iCh];
317 }
318 }
319 }
320 return *this;
321}

◆ readConnectionTable()

void LVL1TGCTrigger::TGCConnectionInPP::readConnectionTable ( TGCPatchPanel * PP)

Definition at line 18 of file TGCConnectionInPP.cxx.

19{
20 enum { BufferSize = 1024 };
21 char buf[BufferSize];
22 std::string label;
23
24 if (PP->getRegion() == TGCRegionType::ENDCAP) {
25 label = "E";
26 } else if (PP->getRegion() == TGCRegionType::FORWARD) {
27 label = "F";
28 }
29
30 bool found = true;
31 // select label used in database.
32 if(PP->getType()==TGCSector::WTPP) label+="WT";
33 else if(PP->getType()==TGCSector::WDPP) label+="WD";
34 else if(PP->getType()==TGCSector::STPP) label+="ST";
35 else if(PP->getType()==TGCSector::SDPP) label+="SD";
36 else if(PP->getType()==TGCSector::WIPP) label+="WI";
37 else if(PP->getType()==TGCSector::SIPP) label+="SI";
38 else found = false;
39
40 if (!found) return;
41
42 std::string fn = TGCDatabaseManager::getFilename(1);
43
44 std::string fullName = PathResolver::find_file(fn, "PWD");
45 if( fullName.length() == 0 )
46 fullName = PathResolver::find_file(fn,"DATAPATH");
47 std::ifstream file(fullName.c_str() ,std::ios::in);
48
49 // find entries match in PatchPanel type.
50 int oPP,oCon,oCh,i1PP,i2PP,totalCh;
51 std::string inLabel;
52 while(file.getline(buf,BufferSize)){
53 std::istringstream line(buf);
54 line>>inLabel>>totalCh;
55 if(label==inLabel){
56 // create arrays store entries in database.
57 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
58 line>>m_nCh[i];
59 //coverity[TAINTED_SCALAR]
60 m_patchPanelIn[i] = new TGCPatchPanel* [m_nCh[i]];
61 //coverity[TAINTED_SCALAR]
62 for( int j=0; j<m_nCh[i]; j+=1) m_patchPanelIn[i][j]=0;
63 m_connectorIn[i] = new int [m_nCh[i]];
64 m_channelIn[i] = new int [m_nCh[i]];
65 }
66 while(file.getline(buf,BufferSize)&&(isspace(buf[0])||isdigit(buf[0]))){
67 int iCon = 0;
68 int iCh = 0;
69 iCon=iCh=0;
70 std::istringstream line2(buf);
71 line2 >> oPP >> oCon >> oCh >> i1PP >> iCon >> iCh;
72 // When i1PP is equal to -1, the channel isn't used.
73 if((i1PP!=-1)&&(PP->getId()==oPP)){
74 if(PP->getId()==i1PP){
75 // Channel correspond to this output channel is in same board.
76 //coverity[TAINTED_SCALAR]
77 m_patchPanelIn[oCon][oCh]=PP;
78 }else{
79 // Channel correspond to this output channel is in adjacent boards.
80 if(PP->getAdjacentPP(0)!=0){
81 if(PP->getAdjacentPP(0)->getId()==i1PP){
82 //coverity[TAINTED_SCALAR]
83 m_patchPanelIn[oCon][oCh]=PP->getAdjacentPP(0);
84 }
85 }
86 if(PP->getAdjacentPP(1)!=0){
87 //coverity[TAINTED_SCALAR]
88 if(PP->getAdjacentPP(1)->getId()==i1PP){
89 m_patchPanelIn[oCon][oCh]=PP->getAdjacentPP(1);
90 }
91 }
92 }
93 m_connectorIn[oCon][oCh]=iCon;
94 m_channelIn[oCon][oCh]=iCh;
95#ifdef TGCDEBUG_CONNECTION
96 std::cout << "TGCConnectionInPP: " << label << " PPIn= " << i1PP
97 << " " << m_connectorIn[oCon][oCh]
98 << " " << m_channelIn[oCon][oCh]
99 << " PPOut= " << oPP << " " << oCon << " " << oCh;
100#endif
101
102 i2PP=iCon=iCh=0;
103 line2 >> i2PP >> iCon >> iCh;
104 // i2PP, iCon and iCh are PatchPanel ID, connector
105 // ID and channel number ored.
106 if((i2PP>0)||(iCon!=0)||(iCh!=0)){
107 if(m_oredPatchPanelIn[oCon]==0){
108 m_oredPatchPanelIn[oCon] = new TGCPatchPanel* [m_nCh[oCon]];
109 m_oredConnectorIn[oCon] = new int [m_nCh[oCon]];
110 m_oredChannelIn[oCon] = new int [m_nCh[oCon]];
111 for(int j=0; j<m_nCh[oCon]; j+=1) m_oredPatchPanelIn[oCon][j]=0;
112 }
113 m_oredConnectorIn[oCon][oCh]=iCon;
114 m_oredChannelIn[oCon][oCh]=iCh;
115#ifdef TGCDEBUG_CONNECTION
116 std::cout << " PPOR= " << i2PP << " " << m_oredConnectorIn[oCon][oCh]
117 << " " << m_oredChannelIn[oCon][oCh];
118#endif
119
120 if(PP->getId()==i2PP){
121 m_oredPatchPanelIn[oCon][oCh]=PP;
122 }else{
123 if(PP->getAdjacentPP(0)!=0){
124 if(PP->getAdjacentPP(0)->getId()==i2PP){
125 m_oredPatchPanelIn[oCon][oCh]=PP->getAdjacentPP(0);
126 }
127 }
128 if(PP->getAdjacentPP(1)!=0){
129 if(PP->getAdjacentPP(1)->getId()==i2PP){
130 m_oredPatchPanelIn[oCon][oCh]=PP->getAdjacentPP(1);
131 }
132 }
133 }
134 }
135
136#ifdef TGCDEBUG_CONNECTION
137 std::cout << std::endl;
138#endif
139
140 }
141 }
142 break;
143 }
144 }
145 file.close();
146}
static std::string getFilename(int type)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
std::string label(const std::string &format, int i)
Definition label.h:19

◆ replacePatchPanelPointers()

bool LVL1TGCTrigger::TGCConnectionInPP::replacePatchPanelPointers ( TGCPatchPanel * newPatchPanel,
const std::vector< const TGCPatchPanel * > & oldPatchPanels )

Definition at line 359 of file TGCConnectionInPP.cxx.

361{
362 // The size of oldPatchPanels should be 3.
363 // oldPatchPanels.at(0) : oldPatchPanel
364 // oldPatchPanels.at(1) : oldPatchPanel->getAdjacentPP(0)
365 // oldPatchPanels.at(2) : oldPatchPanel->getAdjacentPP(1)
366 if(oldPatchPanels.size()!=3) return false;
367
368 for(int i=0; i<NumberOfPPOutputConnector; i++) {
369 int nPPOutCh = m_nCh[i];
370 if(m_patchPanelIn[i]) {
371 for(int iCh=0; iCh<nPPOutCh; iCh++) {
372 // Null pointers are NOT updated.
373 if(m_patchPanelIn[i][iCh]) {
374 if( m_patchPanelIn[i][iCh]==oldPatchPanels.at(0)) {
375 m_patchPanelIn[i][iCh] = newPatchPanel;
376 } else if(m_patchPanelIn[i][iCh]==oldPatchPanels.at(1)) {
377 m_patchPanelIn[i][iCh] = newPatchPanel->getAdjacentPP(0);
378 } else if(m_patchPanelIn[i][iCh]==oldPatchPanels.at(2)) {
379 m_patchPanelIn[i][iCh] = newPatchPanel->getAdjacentPP(1);
380 } else { // This should not happen.
381 return false;
382 }
383 }
384 }
385 }
386
387 if(m_oredPatchPanelIn[i]) {
388 for(int iCh=0; iCh<nPPOutCh; iCh++) {
389 // Null pointers are NOT updated.
390 if(m_oredPatchPanelIn[i][iCh]) {
391 if( m_oredPatchPanelIn[i][iCh]==oldPatchPanels.at(0)) {
392 m_oredPatchPanelIn[i][iCh] = newPatchPanel;
393 } else if(m_oredPatchPanelIn[i][iCh]==oldPatchPanels.at(1)) {
394 m_oredPatchPanelIn[i][iCh] = newPatchPanel->getAdjacentPP(0);
395 } else if(m_oredPatchPanelIn[i][iCh]==oldPatchPanels.at(2)) {
396 m_oredPatchPanelIn[i][iCh] = newPatchPanel->getAdjacentPP(1);
397 } else { // This should not happen.
398 return false;
399 }
400 }
401 }
402 }
403 }
404
405 return true;
406}

Member Data Documentation

◆ m_channelIn

int* LVL1TGCTrigger::TGCConnectionInPP::m_channelIn[NumberOfPPOutputConnector]
private

Definition at line 42 of file TGCConnectionInPP.h.

◆ m_connectorIn

int* LVL1TGCTrigger::TGCConnectionInPP::m_connectorIn[NumberOfPPOutputConnector]
private

Definition at line 43 of file TGCConnectionInPP.h.

◆ m_nCh

int LVL1TGCTrigger::TGCConnectionInPP::m_nCh[NumberOfPPOutputConnector]
private

Definition at line 40 of file TGCConnectionInPP.h.

◆ m_oredChannelIn

int* LVL1TGCTrigger::TGCConnectionInPP::m_oredChannelIn[NumberOfPPOutputConnector]
private

Definition at line 46 of file TGCConnectionInPP.h.

◆ m_oredConnectorIn

int* LVL1TGCTrigger::TGCConnectionInPP::m_oredConnectorIn[NumberOfPPOutputConnector]
private

Definition at line 47 of file TGCConnectionInPP.h.

◆ m_oredPatchPanelIn

TGCPatchPanel** LVL1TGCTrigger::TGCConnectionInPP::m_oredPatchPanelIn[NumberOfPPOutputConnector]
private

Definition at line 45 of file TGCConnectionInPP.h.

◆ m_patchPanelIn

TGCPatchPanel** LVL1TGCTrigger::TGCConnectionInPP::m_patchPanelIn[NumberOfPPOutputConnector]
private

Definition at line 41 of file TGCConnectionInPP.h.


The documentation for this class was generated from the following files: