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 187 of file TGCConnectionInPP.cxx.

188{
189 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
190 m_nCh[i] = 0;
191 m_patchPanelIn[i] = 0;
192 m_channelIn[i] = 0;
193 m_connectorIn[i] = 0;
195 m_oredChannelIn[i] = 0;
196 m_oredConnectorIn[i] = 0;
197 }
198}
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 200 of file TGCConnectionInPP.cxx.

201{
202 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
203 if(m_patchPanelIn[i]!=0) delete [] m_patchPanelIn[i];
204 m_patchPanelIn[i] = 0;
205 if(m_channelIn[i]!=0) delete [] m_channelIn[i];
206 m_channelIn[i] = 0;
207 if(m_connectorIn[i]!=0) delete [] m_connectorIn[i];
208 m_connectorIn[i] = 0;
209
210 if(m_oredPatchPanelIn[i]!=0) delete [] m_oredPatchPanelIn[i];
212 if(m_oredChannelIn[i]!=0) delete [] m_oredChannelIn[i];
213 m_oredChannelIn[i] = 0;
214 if(m_oredConnectorIn[i]!=0) delete [] m_oredConnectorIn[i];
215 m_oredConnectorIn[i] = 0;
216 }
217}

◆ TGCConnectionInPP() [2/2]

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

Definition at line 220 of file TGCConnectionInPP.cxx.

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

Member Function Documentation

◆ dumpConnection()

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

Definition at line 151 of file TGCConnectionInPP.cxx.

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

◆ existOredSignal()

bool LVL1TGCTrigger::TGCConnectionInPP::existOredSignal ( ) const

Definition at line 143 of file TGCConnectionInPP.cxx.

144{
145 for( int i=0; i<NumberOfPPOutputConnector; i+=1){
146 if(m_oredPatchPanelIn[i]!=0) return true;
147 }
148 return false;
149}

◆ getChannelIn()

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

Definition at line 318 of file TGCConnectionInPP.cxx.

319{
320 return m_channelIn[connectorOut][chOut];
321}

◆ getConnectorIn()

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

Definition at line 323 of file TGCConnectionInPP.cxx.

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

◆ 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 336 of file TGCConnectionInPP.cxx.

337{
338 return m_oredChannelIn[connectorOut][chOut];
339}

◆ getOredConnectorIn()

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

Definition at line 341 of file TGCConnectionInPP.cxx.

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

◆ getOredPPIn()

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

Definition at line 346 of file TGCConnectionInPP.cxx.

347{
348 if(m_oredPatchPanelIn[connectorOut]!=0)
349 return m_oredPatchPanelIn[connectorOut][chOut];
350 else
351 return 0;
352}

◆ getPPIn()

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

Definition at line 328 of file TGCConnectionInPP.cxx.

329{
330 if(m_patchPanelIn[connectorOut]!=0)
331 return m_patchPanelIn[connectorOut][chOut];
332 else
333 return 0;
334}

◆ operator=()

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

Definition at line 265 of file TGCConnectionInPP.cxx.

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

◆ 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 m_patchPanelIn[i] = new TGCPatchPanel* [m_nCh[i]];
60 for( int j=0; j<m_nCh[i]; j+=1) m_patchPanelIn[i][j]=0;
61 m_connectorIn[i] = new int [m_nCh[i]];
62 m_channelIn[i] = new int [m_nCh[i]];
63 }
64 while(file.getline(buf,BufferSize)&&(isspace(buf[0])||isdigit(buf[0]))){
65 int iCon = 0;
66 int iCh = 0;
67 iCon=iCh=0;
68 std::istringstream line2(buf);
69 line2 >> oPP >> oCon >> oCh >> i1PP >> iCon >> iCh;
70 // When i1PP is equal to -1, the channel isn't used.
71 if((i1PP!=-1)&&(PP->getId()==oPP)){
72 if(PP->getId()==i1PP){
73 // Channel correspond to this output channel is in same board.
74 m_patchPanelIn[oCon][oCh]=PP;
75 }else{
76 // Channel correspond to this output channel is in adjacent boards.
77 if(PP->getAdjacentPP(0)!=0){
78 if(PP->getAdjacentPP(0)->getId()==i1PP){
79 m_patchPanelIn[oCon][oCh]=PP->getAdjacentPP(0);
80 }
81 }
82 if(PP->getAdjacentPP(1)!=0){
83 if(PP->getAdjacentPP(1)->getId()==i1PP){
84 m_patchPanelIn[oCon][oCh]=PP->getAdjacentPP(1);
85 }
86 }
87 }
88 m_connectorIn[oCon][oCh]=iCon;
89 m_channelIn[oCon][oCh]=iCh;
90#ifdef TGCDEBUG_CONNECTION
91 std::cout << "TGCConnectionInPP: " << label << " PPIn= " << i1PP
92 << " " << m_connectorIn[oCon][oCh]
93 << " " << m_channelIn[oCon][oCh]
94 << " PPOut= " << oPP << " " << oCon << " " << oCh;
95#endif
96
97 i2PP=iCon=iCh=0;
98 line2 >> i2PP >> iCon >> iCh;
99 // i2PP, iCon and iCh are PatchPanel ID, connector
100 // ID and channel number ored.
101 if((i2PP>0)||(iCon!=0)||(iCh!=0)){
102 if(m_oredPatchPanelIn[oCon]==0){
103 m_oredPatchPanelIn[oCon] = new TGCPatchPanel* [m_nCh[oCon]];
104 m_oredConnectorIn[oCon] = new int [m_nCh[oCon]];
105 m_oredChannelIn[oCon] = new int [m_nCh[oCon]];
106 for(int j=0; j<m_nCh[oCon]; j+=1) m_oredPatchPanelIn[oCon][j]=0;
107 }
108 m_oredConnectorIn[oCon][oCh]=iCon;
109 m_oredChannelIn[oCon][oCh]=iCh;
110#ifdef TGCDEBUG_CONNECTION
111 std::cout << " PPOR= " << i2PP << " " << m_oredConnectorIn[oCon][oCh]
112 << " " << m_oredChannelIn[oCon][oCh];
113#endif
114
115 if(PP->getId()==i2PP){
116 m_oredPatchPanelIn[oCon][oCh]=PP;
117 }else{
118 if(PP->getAdjacentPP(0)!=0){
119 if(PP->getAdjacentPP(0)->getId()==i2PP){
120 m_oredPatchPanelIn[oCon][oCh]=PP->getAdjacentPP(0);
121 }
122 }
123 if(PP->getAdjacentPP(1)!=0){
124 if(PP->getAdjacentPP(1)->getId()==i2PP){
125 m_oredPatchPanelIn[oCon][oCh]=PP->getAdjacentPP(1);
126 }
127 }
128 }
129 }
130
131#ifdef TGCDEBUG_CONNECTION
132 std::cout << std::endl;
133#endif
134
135 }
136 }
137 break;
138 }
139 }
140 file.close();
141}
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 354 of file TGCConnectionInPP.cxx.

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

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: