ATLAS Offline Software
TGCInnerSB.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ref. SOS054V06,SOS053V04
6 #include "TrigT1TGC/TGCInnerSB.h"
8 #include <iostream>
9 
10 namespace LVL1TGCTrigger {
11 
13  : TGCSlaveBoard()
14 {}
15 
17 {
18  static constexpr int kNumberOfInnerSBData = 8;
19 
20  if(m_coincidenceOut!=0){
21  if ( m_slaveBoardOut!=0 ) delete m_slaveBoardOut;
24  m_slaveBoardOut->setNumberOfData(kNumberOfInnerSBData);
25 
26  // fill SlaveBoardOut.
27  // select largest R hit in each sections.
28  int lengthOfSection = m_lengthOfCoincidenceOut/kNumberOfInnerSBData;
29  int i,j;
30 #ifdef TGCDEBUG
31  std::cout <<" Type :" << getType() << " id:" << getId()
32  <<" lengthOfCoincidenceOut= "<< m_lengthOfCoincidenceOut
33  <<" lengthOfSection= "<<lengthOfSection<<std::endl;
34 #endif
35  for( i=0; i<kNumberOfInnerSBData; i+=1){// i=3:d 2:c 1:b 0:a, 7:d 6:c 5:b 4:a
36  m_slaveBoardOut->setHit(i,false);
37  for( j=0; j<lengthOfSection; j+=1) {
38  if(m_coincidenceOut->getChannel(j+i*lengthOfSection)){
40  m_slaveBoardOut->setHit(i,true);
41 #ifdef TGCDEBUG
42  std::cout <<" Hit @"<< i << " section:" << j <<std::endl;
43 #endif
44  break;
45  }
46  }
47  if(m_slaveBoardOut->getHit(i)){
49  }
50  }
51  }
52 }
53 
55 {
56  const TGCHitPattern* pattern[2];
59 
60  int length;
61  if(pattern[0]!=0){
62  length = pattern[0]->getLength();
63  }else if(pattern[1]!=0){
64  length = pattern[1]->getLength();
65  }else
66  length = -1;
67 
68  if(length>0){
70  if(m_coincidenceOut!=0) delete m_coincidenceOut;
72 
73  // rearrange bit pattern for coincidence.
74  bool* b = new bool [m_lengthOfCoincidenceOut];
75 
76  int j;
77  for( j=0; j<m_lengthOfCoincidenceOut; j+=1){
78  b[j]=false;
79  }
80 
81  // rearrange signal pattern for 2layer for 1/2 coincidence.
82  // ! the order to rearrange is chosen by Daniel table P.
83  int i;
84  for( i=0; i<length/2; i+=1){
85  if(pattern[1]!=0){
86  b[2*i+1] = pattern[1]->getChannel(i+length/2);// smaller in phi
87  b[2*i] = pattern[1]->getChannel(i);
88  }
89  if(pattern[0]!=0){
90  b[length+2*i+1] = pattern[0]->getChannel(i+length/2);// smaller in phi
91  b[length+2*i] = pattern[0]->getChannel(i);
92  }
93  }
94 
95 #ifdef TGCDEBUG
96  std::cout <<" Type :" << getType() << " id:" << getId() << std::endl;
97  for( j=0; j<m_lengthOfCoincidenceOut; j+=1){
98  if (b[j]) std::cout << "*";
99  else std::cout << "-";
100  }
101  std::cout <<std::endl;
102 #endif
103  // perform 1/2 coincidence
104  int block;
105  for( block=0; block<2; block+=1){
106  int base=block*length;
107 /*
108  b & c
109  +b & !a & !c
110  +a & c & !b
111  +c & !b & !d
112  +b & d & !c
113 */
114 
115  i=base;
116  m_coincidenceOut->setChannel(i,( b[i] & !b[i+1] ));
117 
118  i=base+1;
119  m_coincidenceOut->setChannel(i,(( b[i-1] & b[i] )|
120  ( b[i-1] & !b[i] )|
121  ( b[i] & !b[i-1] & !b[i+1] )|
122  ( b[i-1] & b[i+1] & !b[i] )));
123 
124  for( i=base+2; i<base+length-1; i+=1){
125  m_coincidenceOut->setChannel(i,(( b[i-1] & b[i] )|
126  ( b[i-1] & !b[i-2] & !b[i] )|
127  ( b[i-2] & b[i] & !b[i-1] )|
128  ( b[i] & !b[i-1] & !b[i+1] )|
129  ( b[i-1] & b[i+1] & !b[i] )));
130  }
131  i=base+length-1;
132  m_coincidenceOut->setChannel(i,(( b[i-1] & b[i] )|
133  ( b[i-1] & !b[i-2] & !b[i] )|
134  ( b[i-2] & b[i] & !b[i-1] )|
135  ( b[i] & !b[i-1] )));
136 
137 #ifdef TGCCOUT
138  std::cout << "InnerCoincidence OUT ";
140  std::cout << std::endl;
141 #endif
142 
143  }
144 
145  delete [] b;
146  }
147 }
148 
149 } // end of namespace
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
base
std::string base
Definition: hcg.cxx:78
LVL1TGCTrigger::TGCInnerSB::doCoincidence
virtual void doCoincidence()
Definition: TGCInnerSB.cxx:54
LVL1TGCTrigger::TGCSlaveBoard::m_bid
int m_bid
Definition: TGCSlaveBoard.h:77
LVL1TGCTrigger::TGCSlaveBoardOut::clear
void clear()
Definition: TGCSlaveBoardOut.cxx:181
TGCPatchPanelOut.h
LVL1TGCTrigger::TGCInnerSB::createSlaveBoardOut
virtual void createSlaveBoardOut()
Definition: TGCInnerSB.cxx:16
LVL1TGCTrigger::TGCSlaveBoardOut::getPos
int getPos(int iData) const
Definition: TGCSlaveBoardOut.h:125
LVL1TGCTrigger::TGCHitPattern::printb
void printb() const
Definition: TGCHitPattern.cxx:141
LVL1TGCTrigger::TGCSlaveBoard
Definition: TGCSlaveBoard.h:22
LVL1TGCTrigger::TGCSlaveBoardOut::setPos
void setPos(int iData, int posIn)
Definition: TGCSlaveBoardOut.cxx:171
TGCInnerSB.h
LVL1TGCTrigger::TGCSlaveBoardOut::setHit
void setHit(int iData, bool hitIn)
Definition: TGCSlaveBoardOut.h:87
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1TGCTrigger::TGCSlaveBoard::getType
int getType() const
Definition: TGCSlaveBoard.h:49
LVL1TGCTrigger::TGCSlaveBoardOut
Definition: TGCSlaveBoardOut.h:20
LVL1TGCTrigger::TGCHitPattern::getChannel
bool getChannel(int iChannel) const
Definition: TGCHitPattern.cxx:64
LVL1TGCTrigger::TGCSlaveBoard::m_slaveBoardOut
TGCSlaveBoardOut * m_slaveBoardOut
Definition: TGCSlaveBoard.h:74
LVL1TGCTrigger
Definition: LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::TGCSlaveBoardOut::getHit
bool getHit(int iData) const
Definition: TGCSlaveBoardOut.h:131
LVL1TGCTrigger::TGCHitPattern
Definition: TGCHitPattern.h:11
LVL1TGCTrigger::TGCInnerSB::TGCInnerSB
TGCInnerSB()
Definition: TGCInnerSB.cxx:12
LVL1TGCTrigger::TGCSlaveBoard::getId
int getId() const
Definition: TGCSlaveBoard.h:41
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
LVL1TGCTrigger::TGCHitPattern::setChannel
void setChannel(int iChannel, bool pattern)
Definition: TGCHitPattern.cxx:85
LVL1TGCTrigger::TGCSlaveBoardOut::setbPos
void setbPos(int block, int pos)
Definition: TGCSlaveBoardOut.h:74
LVL1TGCTrigger::TGCPatchPanelOut::getHitPattern
const TGCHitPattern * getHitPattern(int connector) const
Definition: TGCPatchPanelOut.h:46
LVL1TGCTrigger::TGCSlaveBoard::m_lengthOfCoincidenceOut
int m_lengthOfCoincidenceOut
Definition: TGCSlaveBoard.h:72
LVL1TGCTrigger::TGCSlaveBoard::m_patchPanelOut
TGCPatchPanelOut * m_patchPanelOut
Definition: TGCSlaveBoard.h:83
LVL1TGCTrigger::TGCSlaveBoardOut::setNumberOfData
void setNumberOfData(int nData)
Definition: TGCSlaveBoardOut.h:149
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
LVL1TGCTrigger::TGCSlaveBoard::m_coincidenceOut
TGCHitPattern * m_coincidenceOut
Definition: TGCSlaveBoard.h:73