ATLAS Offline Software
Loading...
Searching...
No Matches
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
8#include <iostream>
9
10namespace LVL1TGCTrigger {
11
15
17{
18 static constexpr int kNumberOfInnerSBData = 8;
19
20 if(m_coincidenceOut!=0){
21 if ( m_slaveBoardOut!=0 ) delete m_slaveBoardOut;
23 m_slaveBoardOut->clear();
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)){
39 m_slaveBoardOut->setPos(i,j);
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)){
48 m_slaveBoardOut->setbPos(i, m_slaveBoardOut->getPos(i));
49 }
50 }
51 }
52}
53
55{
56 const TGCHitPattern* pattern[2];
57 pattern[0] = m_patchPanelOut->getHitPattern(0);
58 pattern[1] = m_patchPanelOut->getHitPattern(1);
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){
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 ";
139 m_coincidenceOut->printb();
140 std::cout << std::endl;
141#endif
142
143 }
144
145 delete [] b;
146 }
147}
148
149} // end of namespace
double length(const pvec &v)
virtual void createSlaveBoardOut()
virtual void doCoincidence()
TGCSlaveBoardOut * m_slaveBoardOut
TGCPatchPanelOut * m_patchPanelOut
std::string base
Definition hcg.cxx:81