ATLAS Offline Software
TGCStripTripletSB.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include <iostream>
8 #include <cstdlib>
9 
10 namespace LVL1TGCTrigger {
11 
13  : TGCSlaveBoard()
14 {}
15 
17 {
18  if ( m_slaveBoardOut!=0 ) {
19  delete m_slaveBoardOut;
20  m_slaveBoardOut =0;
21  }
22 
23  if(m_coincidenceOut!=0){
27 
28  // fill SlaveBoardOut.
29  // select largest R hit in each sections.
31  int i,j;
32 #ifdef TGCDEBUG
33  std::cout <<" lengthOfCoincidenceOut= "<< m_lengthOfCoincidenceOut<<std::endl
34  <<" lengthOfSection= "<<lengthOfSection<<std::endl;
35 #endif
36  for( i=0; i<s_NumberOfStripTripletSBData; i+=1){// i=3:d 2:c 1:b 0:a, 7:d 6:c 5:b 4:a
37  m_slaveBoardOut->setHit(i,false);
38  for( j=0; j<lengthOfSection; j+=1) {
39  if(m_coincidenceOut->getChannel(j+i*lengthOfSection)){
41  m_slaveBoardOut->setHit(i,true);
42  break;
43  }
44  }
45  if(m_slaveBoardOut->getHit(i)){
47  }
48  }
49  }
50 }
51 
53 {
54  const TGCHitPattern* pattern[2];
57 
58  int length;
59  if(pattern[0]!=0){
60  length = pattern[0]->getLength();
61  }else if(pattern[1]!=0){
62  length = pattern[1]->getLength();
63  }else{
64  length = -1;
65  }
66  if(m_coincidenceOut!=0) delete m_coincidenceOut;
68 
69  if(length>0){
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  for( int i=0; i<length/2; i+=1){
82  if(pattern[0]!=0){
83  b[2*i+1] = pattern[0]->getChannel(i+length/2);// smaller in phi
84  b[2*i] = pattern[0]->getChannel(i);
85  }
86  if(pattern[1]!=0){
87  b[length+2*i+1] = pattern[1]->getChannel(i+length/2);// smaller in phi
88  b[length+2*i] = pattern[1]->getChannel(i);
89  }
90  }
91 
92  // perform 1/2 coincidence
93  int block;
94  for( block=0; block<2; block+=1){
95  int base=block*length;
96 /*
97  b & c
98  +b & !a & !c
99  +a & c & !b
100  +c & !b & !d
101  +b & d & !c
102 */
103 
104  int i=base;
105  m_coincidenceOut->setChannel(i,( b[i] & !b[i+1] ));
106 
107  i=base+1;
108  m_coincidenceOut->setChannel(i,(( b[i-1] & b[i] )|
109  ( b[i-1] & !b[i] )|
110  ( b[i] & !b[i-1] & !b[i+1] )|
111  ( b[i-1] & b[i+1] & !b[i] )));
112 
113  for( i=base+2; i<base+length-1; i+=1){
114  m_coincidenceOut->setChannel(i,(( b[i-1] & b[i] )|
115  ( b[i-1] & !b[i-2] & !b[i] )|
116  ( b[i-2] & b[i] & !b[i-1] )|
117  ( b[i] & !b[i-1] & !b[i+1] )|
118  ( b[i-1] & b[i+1] & !b[i] )));
119  }
120  i=base+length-1;
121  m_coincidenceOut->setChannel(i,(( b[i-1] & b[i] )|
122  ( b[i-1] & !b[i-2] & !b[i] )|
123  ( b[i-2] & b[i] & !b[i-1] )|
124  ( b[i] & !b[i-1] )));
125 
126 #ifdef TGCCOUT
127  std::cout << "StripTripletCoincidence OUT ";
129  std::cout << std::endl;
130 #endif
131 
132  }
133 
134  delete [] b;
135  }
136 }
137 
138 } //end of namespace bracket
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
base
std::string base
Definition: hcg.cxx:78
LVL1TGCTrigger::TGCSlaveBoard::m_bid
int m_bid
Definition: TGCSlaveBoard.h:77
LVL1TGCTrigger::TGCSlaveBoardOut::clear
void clear()
Definition: TGCSlaveBoardOut.cxx:181
TGCPatchPanelOut.h
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
LVL1TGCTrigger::TGCSlaveBoardOut::setHit
void setHit(int iData, bool hitIn)
Definition: TGCSlaveBoardOut.h:87
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1TGCTrigger::TGCSlaveBoardOut
Definition: TGCSlaveBoardOut.h:20
TGCStripTripletSB.h
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::TGCStripTripletSB::s_NumberOfStripTripletSBData
static constexpr int s_NumberOfStripTripletSBData
Definition: TGCStripTripletSB.h:15
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
LVL1TGCTrigger::TGCHitPattern::setChannel
void setChannel(int iChannel, bool pattern)
Definition: TGCHitPattern.cxx:85
LVL1TGCTrigger::TGCStripTripletSB::createSlaveBoardOut
virtual void createSlaveBoardOut()
Definition: TGCStripTripletSB.cxx:16
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::TGCStripTripletSB::TGCStripTripletSB
TGCStripTripletSB()
Definition: TGCStripTripletSB.cxx:12
LVL1TGCTrigger::TGCSlaveBoard::m_patchPanelOut
TGCPatchPanelOut * m_patchPanelOut
Definition: TGCSlaveBoard.h:83
LVL1TGCTrigger::TGCStripTripletSB::doCoincidence
virtual void doCoincidence()
Definition: TGCStripTripletSB.cxx:52
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