ATLAS Offline Software
BIS78_triggerSimulation.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 
8 #include <iostream>
9 
10 using namespace std;
11 
12 
14 
16 {}
17 
18 unsigned int BIS78_triggerSimulation::AddStrip(int sectoreta, int sectorphi, int igap, int mphi, int strip){
19  if (igap<1||igap>3) return false;
20  int side = 0;
21  if (sectoreta>0) side=1;
22  if (mphi==1){
23  m_strip_phi[side][sectorphi-1][igap-1].push_back(strip);
24  } else {
25  m_strip_eta[side][sectorphi-1][igap-1].push_back(strip);
26  }
27 
28  return 0;
29 }
30 
32 
33  for (int i=0; i<2; i++){ // 2 sides (0 or 1, just for BIS78, otherwise, for full BIS it should be the eta sector)
34  for (int j=0; j<8; j++){ // 8 sectors
35  for (int k=0;k<3; k++){ // 3 gas gaps
36  m_strip_eta[i][j][k].clear();
37  m_strip_phi[i][j][k].clear();
38  }
39  }
40  }
41 
42  return StatusCode::SUCCESS;
43 }
44 
45 
47 // take the data from TrigT1RPC
48 {
49 
50  uint8_t delta_strip_phi=dstrip_phi;
51  uint8_t delta_strip_eta=dstrip_eta;
52 
53  for (int i=0; i<2; i++){ // i = side (0,1)
54  for (int j=0; j<8; j++){ // j = sector-1 (0,7)
55 
56  uint16_t side=i;
57  uint16_t sector=j;
58  auto trgRawData=std::make_unique< Muon::RpcBis78_TrigRawData>(sector, side, bcid);
59 
60 
61  uint32_t trigword = 0;
62  unsigned int majority_eta=0; uint8_t position_eta=0;
63  unsigned int majority_phi=0; uint8_t position_phi=0;
64 
65  // use middle gas gap as pilot
66  // SEARCH OF PHI COINCIDENCES
67  for (unsigned int istrip1=0; istrip1<m_strip_phi[i][j][1].size(); istrip1++){
68  unsigned int majority=0;
69  for (unsigned int istrip0=0; istrip0<m_strip_phi[i][j][0].size(); istrip0++){
70  if (std::abs(m_strip_phi[i][j][1].at(istrip1)-m_strip_phi[i][j][0].at(istrip0))<=delta_strip_phi) {
71  majority=1;
72  }
73  }
74  for (unsigned int istrip2=0; istrip2<m_strip_phi[i][j][2].size(); istrip2++){
75  if (std::abs(m_strip_phi[i][j][1].at(istrip1)-m_strip_phi[i][j][2].at(istrip2))<=delta_strip_phi) {
76  if (majority>0) {
77  majority=2;
78  } else {
79  majority=1;
80  }
81  }
82  }
83  if (majority > majority_phi) {
84  majority_phi=majority;
85  position_phi=m_strip_phi[i][j][1].at(istrip1);
86  }
87  }
88  if (majority_phi==0) { // try also combination first-last
89  for (unsigned int istrip0=0; istrip0<m_strip_phi[i][j][0].size(); istrip0++){
90  for (unsigned int istrip2=0; istrip2<m_strip_phi[i][j][2].size(); istrip2++){
91  if (std::abs(m_strip_phi[i][j][2].at(istrip2)-m_strip_phi[i][j][0].at(istrip0))<=delta_strip_phi) {
92  position_phi=m_strip_phi[i][j][0].at(istrip0);
93  majority_phi=1;
94  }
95  }
96  }
97  } // end of phi loop
98  // SEARCH OF ETA COINCIDENCES
99  for (unsigned int istrip1=0; istrip1<m_strip_eta[i][j][1].size(); istrip1++){
100  unsigned int majority=0;
101  for (unsigned int istrip0=0; istrip0<m_strip_eta[i][j][0].size(); istrip0++){
102  if (std::abs(m_strip_eta[i][j][1].at(istrip1)-m_strip_eta[i][j][0].at(istrip0))<=delta_strip_eta) {
103  majority=1;
104  }
105  }
106  for (unsigned int istrip2=0; istrip2<m_strip_eta[i][j][2].size(); istrip2++){
107  if (std::abs(m_strip_eta[i][j][1].at(istrip1)-m_strip_eta[i][j][2].at(istrip2))<=delta_strip_eta) {
108  if (majority>0) {
109  majority=2;
110  } else {
111  majority=1;
112  }
113  }
114  }
115  if (majority > majority_eta) {
116  majority_eta=majority;
117  position_eta=m_strip_eta[i][j][1].at(istrip1);
118  }
119  }
120  if (majority_eta==0) { // try also combination first-last
121  for (unsigned int istrip0=0; istrip0<m_strip_eta[i][j][0].size(); istrip0++){
122  for (unsigned int istrip2=0; istrip2<m_strip_eta[i][j][2].size(); istrip2++){
123  if (std::abs(m_strip_eta[i][j][2].at(istrip2)-m_strip_eta[i][j][0].at(istrip0))<=delta_strip_eta) {
124  position_eta=m_strip_eta[i][j][0].at(istrip0);
125  majority_eta=1;
126  }
127  }
128  }
129  } // end of eta loop
130 
131 
132  // Here one has to compute the trigword for each sector
133  // Content of the 24 bits word:
134  // - eta strip index -> 6 bits
135  // - phi strip index -> 6 bits
136  // - eta strip coincidence window -> 3 bits (NOT IMPLEMENTED YET: TO BE CHECKED WITH FIRMWARE)
137  // - phi strip coincidence window -> 3 bits (NOT IMPLEMENTED YET: TO BE CHECKED WITH FIRMWARE)
138  // - 3 over 3 gaps coincidence flag for eta/phi-> 2 bits
139  // - reserved -> 4 bits
140 
141 
142  uint8_t flag3o3_eta=0;
143  uint8_t flag3o3_phi=0;
144  if (majority_eta>0&&majority_phi>0){
145  if (majority_eta>1) flag3o3_eta=1;
146  if (majority_phi>1) flag3o3_phi=1;
147 
148  // set the trigger word
149  trigword = ((position_eta & 0x3f) << 18)
150  + ((position_phi & 0x3f) << 12 )
151  + ((flag3o3_eta & 0x1) << 5 )
152  + ((flag3o3_phi & 0x1) << 4 );
153 
154  auto bis_segment= std::make_unique<Muon::RpcBis78_TrigRawDataSegment>(position_eta,position_phi,
155  delta_strip_eta,delta_strip_phi,
156  flag3o3_eta,flag3o3_phi,trigword );
157 
158  trgRawData->push_back(std::move(bis_segment));
159  trgContainer->push_back(std::move(trgRawData));
160  }
161 
162 
163  }
164  }
165 
166 }
167 
168 
169 
170 
171 
172 
173 
174 
175 
BIS78_triggerSimulation::BIS78_triggerSimulation
BIS78_triggerSimulation()
Definition: BIS78_triggerSimulation.cxx:15
SiliconTech::strip
@ strip
BIS78_triggerSimulation.h
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TRT::Hit::side
@ side
Definition: HitInfo.h:83
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::RpcBis78_TrigRawDataContainer
Definition: RpcBis78_TrigRawDataContainer.h:21
BIS78_triggerSimulation::AddStrip
unsigned int AddStrip(int sectoreta, int sectorphi, int igap, int mphi, int strip)
Definition: BIS78_triggerSimulation.cxx:18
BIS78_triggerSimulation::build_trigRawData
void build_trigRawData(Muon::RpcBis78_TrigRawDataContainer *trgContainer, uint8_t dstrip_phi, uint8_t dstrip_eta, uint16_t bcid)
Definition: BIS78_triggerSimulation.cxx:46
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
BIS78_triggerSimulation::clear
StatusCode clear()
Definition: BIS78_triggerSimulation.cxx:31
fitman.k
k
Definition: fitman.py:528