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