ATLAS Offline Software
Loading...
Searching...
No Matches
Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef TrigT1RPChardware_Matrix_H
5#define TrigT1RPChardware_Matrix_H
6
9
10#include <iosfwd>
11
12
13
14class Matrix : public BaseObject {
15public:
16
19 //****************************************************************************//
20 // //
21 // Coincidence Matrix data for ReadOut //
22 // =================================== //
23 // //
24 // These data are used by MatrixReadOut //
25 // //
26 // 1) raw data for readout; for more details see also below in input[][]... //
27 // //
28 CMAword rodat[2][2][64][2]; // input signals to CMA; for readout //
29 // (rodat[2][2][8 * NOBXS][2];) //
30 // //
31 // 2) trigger results output; for more details see below //
32 CMAword k_readout[64]; // k-pattern for readout //
33 // //k_readout[8 * NOBXS]; //
34 // //
35 // 3) highest triggered threshold //
36 ubit16 highestthRO[64]; // highest triggered threshold (for ReadOut) //
37 //highestthRO[8 * NOBXS]; //
38 // //
39 // 4) trigger in overlap regions //
40 ubit16 overlapRO[64]; // overlap flag (for ReadOut) //
41 //overlapRO[8 * NOBXS]; //
42 // //
43 //****************************************************************************//
44 //
45 Matrix(int run, int event, CMAword debug, int subsys, int proj, int sect, int padadd, int lowhig, int add[2], int locadd, int NOBXS, int BCZERO);
46 ~Matrix();
47 void deleteRPCdata();
48 void reset();
49 void initRegisters();
50 void initPointers();
51 void initRPCpointers();
52 void initDat();
53 void putData(int sidemat, int layer, int stripaddress, float time);
54 void putPatt(const Matrix *p);
56 void setRunEvent(int runNum, int eventNum);
57 void setBCzero(ubit16 offset);
58 void setDeadTime(ubit16 deadt);
59 void setDeadTime(ubit16 iside, ubit16 ilayer, ubit16 deadt);
60 void setDeadTime(ubit16 iside, ubit16 ilayer, ubit16 igroup, ubit16 deadt);
61 void setDelay(ubit16 iside, ubit16 ilayer, ubit16 delay);
62 void setDelay(ubit16 iside, ubit16 ilayer, ubit16 igroup, ubit16 delay);
64 void setPulseWidth(ubit16 iside, ubit16 ilayer, ubit16 length);
65 void setPulseWidth(ubit16 iside, ubit16 ilayer, ubit16 igroup, ubit16 length);
66 void setMask0(ubit16 iside, ubit16 ilayer, ubit16 ichannel);
67 void setMask1(ubit16 ithreshold, ubit16 iside, ubit16 imajority, ubit16 ichannel);
68 void setMask1(ubit16 ithreshold, ubit16 iside, ubit16 imajority);
69 void setMask1(ubit16 ithreshold, ubit16 iside);
70 void setMaskReadOut(ubit16 iside, ubit16 ilayer, ubit16 ichannel);
71 void setMaskReadOut(ubit16 iside, ubit16 ilayer, ubit16 ichannel, ubit16 nchannels);
72 void setConfig(int *l, ubit16 *p1, int *k, CMAword *p2, int *q, CMAword *o, sbit32 *g);
73 void setLocalDirection(ubit16 add, int content);
74 void setKReadOut(int kToReadout);
75 void setOverlaThres(int overthres);
76 void setMajority(ubit16 add, int content);
77 void setRoad(ubit16 addThres, ubit16 addChn, ubit16 add64, CMAword content);
78 void setRoad(ubit16 addThres, ubit16 addChn, char road[17]);
79 void setMatOverlap(ubit16 add, CMAword content);
80 void setTrigDeadTime(ubit16 deadt);
81 void setTrigDeadTime(ubit16 igroup, ubit16 deadt);
82 void setDiagonal(ubit16 add, sbit32 content);
84 int getMajority(ubit16 add) const;
85 CMAword getRoad(ubit16 addThres, ubit16 addChn, ubit16 add64) const;
87 void execute();
88 int getSubsystem() const;
89 int getProjection() const;
90 int getSector() const;
91 int getPad() const;
92 int getLowHigh() const;
93 int getAddress0() const;
94 int getAddress1() const;
95 int getLocalAdd() const;
97 ubit16 getOutputThres(ubit16 bunch) const;
98 ubit16 getOutputOverl(ubit16 bunch) const;
99 sbit16 getBunchPhase() const;
100 sbit16 getBunchOffset() const;
101 void display() const;
102 void dispWind() const;
103 void dispWind(ubit16 thres) const;
104 void dispDefaultConfiguration() const;
105 ubit16 char2int(const char *str, CMAword the32[2]);
107 static const ubit16 s_nthres; // number of thresholds possible
108 static const ubit16 s_nchan[2]; // CMA x-y dimensions
109 static const float s_BCtime; // Bunch-Crossing separation (25 ns)
110 static const ubit16 s_NDLLCYC; // Number of DLL Cycles in one Bunch Crossing
111 static const float s_DLLtime; // Bunch-Crossing IDentifier
112 static const sbit16 s_NBunch; // number of Bunch-Crossings to be considered
113 static const sbit16 s_nclock; // length of the CMA buffers
114 // crossing in the CMA buffers
115 static const sbit16 s_timeGroupA; // number of channel in a group for
116 // timing setting
117 static const sbit16 s_timeGroupB; // number of channel in a group for
118 // timing setting
119 static const sbit16 s_wordlen; // number of bits for a single word in CMAword
120 // (to be fixed to 32);
122 //
123private:
124 int m_run;
126
129 //
131 //
132 // debug flags
133 //
135 //
136 // Matrix attributes: subsystem, projection, sector, pad, low/high-pt, address;
137 //
138 int m_subsystem; // subsystem 0,1
139 int m_projection; // projection 0=eta view; 1=phi view
140 int m_sector; // sector address
141 int m_pad; // pad address in this sector
142 int m_lowhigh; // lowhigh_pt type, 0=low; 1=high
143 int m_address[2]; // address[0]=eta chamber segment address;
144 // address[1]=phi chamber segment address;
145 int m_localadd; // local Matrix address in the pad
146 //
147 // dynamic structure for the RPC raw data belonging to this matrix
148 //
149 struct rpcdata {
150 sbit16 layer; // layer address: 0,1;
151 sbit16 stripadd; // channel address: 0,..,31 side x; 0,..,63 side y;
152 float time; // digit time (high accuracy in case of MC events);
153 sbit16 BC; // raw Bunch crossing identifier;
154 sbit16 DLL; // raw DLL identifier;
155 sbit16 masked; // masked bit, if masked==1;
156 sbit16 maskto1; // mask_to_1 flag: set to 1 this channel
157 sbit16 mark; // flag to mark hit; for internal use only
158 sbit16 deadtime; // deadtime
159 sbit16 delay; // delay time for this hit, in DLL counts
160 rpcdata *next; // pointer to next digit;
161 };
162 rpcdata *m_datarpc[2]; // pointers to the rpc raw data, one for each
163 // // side of the CMA: 0 for side-x and 1 for side-y;
164 //
165 // Coincidence Matrix parameters:
166 // nthres
167 // lowtohigh
168 // toreadout
169 //
171 //
172 // CMAword rodat[i][j][k][l]
173 // CMAword input[i][j][k][l];
174 // ^ ^ ^ ^
175 // | | | |
176 // | | | - 64 bits needed
177 // | | ---- absolute clock bin
178 // | ------- layer address
179 // ---------- side address
180 //
181 // CMAword prepr[i][j][k][l][m];
182 // ^ ^ ^ ^ ^
183 // | | | | |
184 // | | | | - 64 bits needed
185 // | | | ---- absolute clock bin
186 // | | ------- layer address
187 // | ---------- side address
188 // ------------- threshold address
189 //
190 // CMAword mjori[i][j][k][l][m];
191 // ^ ^ ^ ^ ^
192 // | | | | |
193 // | | | | - 64 bits needed
194 // | | | ---- absolute clock bin
195 // | | ------- majority address (0 for 1/2; 1 for 2/2)
196 // | ---------- side address
197 // ------------- threshold address
198 //
199 // CMAword trigg[i][j][k];
200 // ^ ^ ^
201 // | | |
202 // | | ---- 64 bits needed
203 // | ------- absolute clock bin
204 // ---------- threshold address
205 //
206 //
208 //
209 // CMAword rodat [2][2][8*NOBXS][2];
210 CMAword m_input[2][2][64][2] // input signals to CMA
211 ,
212 m_prepr[3][2][2][64][2] // prepro pattern in CMA
213 ,
214 m_mjori[3][2][2][64][2] // majority pattern in CMA
215 ,
216 m_trigg[3][72] // trigger pattern in CMA
217 ; // to high-pt CM
218
220 // CMAword m_input[2][2][8 * NOBXS][2] // input signals to CMA
221 // ,
222 // m_prepr[3][2][2][8 * NOBXS][2] // prepro pattern in CMA
223 // ,
224 // m_mjori[3][2][2][8 * NOBXS][2] // majority pattern in CMA
225 // ,
226 // m_trigg[3][9 * NOBXS] // trigger pattern in CMA
227 // ; // to high-pt CM
228
229 //
230 ubit16 m_trigger[3][8]; // triggered thresholds 0=no_trigger; 1=trigger (m_trigger[3][NOBXS];)
231 CMAword m_triggerOverlap[8][2]; // trigger occured in an overlapping region: (m_triggerOverlap[NOBXS][2];)
232 // 0=legt; 1=right;
233 CMAword m_triggerOverlapRO[64][2]; // trigger occured in an overlapping (m_triggerOverlapRO[8 * NOBXS][2];)
234 // region: 0=legt; 1=right;
235 //
237 // //
238 // CMA output //
239 // ========== //
240 // //
241 CMAword m_k_pattern[8 * 64]; // k-pattern for trigger (m_k_pattern[8 * NOBXS];)
242 // CMAword k_readout[8*NOBXS] ; // k-pattern for readout
243 ubit16 m_highestth[8]; // highest triggered threshold: (m_highestth[NOBXS];)
244 // // 0=no trigger at all;
245 // // 1="0" threshold;
246 // // 2="1" threshold;
247 // // 3="2" threshold
248 ubit16 m_overlap[8]; // overlap flag: (ubit16 m_overlap[NOBXS];)
249 // // 0 = no trigger in overlap regions
250 // // 1 = trigger in overlap low channels
251 // // 2 = trigger in overlap hig channels
252 // // 3 = trigger in overlap low and high
253 // ubit16 highestthRO[8*NOBXS]; // highest triggered threshold (for ReadOut)
254 // ubit16 overlapRO[8*NOBXS]; // overlap flag (for ReadOut)
255 sbit16 m_BCID; // Bunch Crossing IDentifier
257 ubit16 *m_chdly; // channel delay
258 ubit16 *m_width; // pulse width
259 int *m_locDi; // local coincidence direction
260 int *m_kRead; // address of pattern threshold for readout
261 CMAword *m_roads; // programmed 3 roads
262 int *m_major; // programmed 3 majorities
263 CMAword *m_overl; // overlapping channels list
264 sbit32 *m_geome; // geometry
266 sbit16 m_thisBC; // real Bunch Crossing ID
267 // (from real data for example...)
268 ubit16 m_BCzero; // offset for bunch crossing address
270 ubit16 m_lowtohigh; // address of lowpt thres. to fill high-pt CMA
271 ubit16 m_toreadout; // address of the threshold to be sent to readout
272 ubit16 m_overlapthres; // address of the threshold to be cosidered in overlap
273 ubit16 m_majorities[3]; // majorities levels
274 ubit16 m_localDirec[2]; // Direction of majority, from innermost layer to outermost
275 // layer, in radius. Values & configurations:
276 // = 1 ==> layer 0 channel n --> layer 1 channel n
277 // = 2 ==> layer 0 channel n --> layer 1 channel n-1
278 // = 4 ==> layer 0 channel n --> layer 1 channel n+1
279 // localDirec[0] ==> side 0 (=pivot)
280 // localDirec[1] ==> side 1
283 //
285 //
286 // Coincidence trigger roads for each threshold
287 //
288 // CMAword trigRoad[i][j][k]
289 // ^ ^ ^
290 // | | |
291 // | | --- half address of a 64-bits word
292 // | ------- pivot channel address
293 // ---------- threshold address
294 //
296 //
297 // delays
298 //
299 // channDeadT[i][j][k]
300 // ^ ^ ^
301 // | | |
302 // | | |
303 // | | -- group index: from 0 to 3 for side=0 (I)
304 // | | from 0 to 7 for side=1 (J)
305 // | ----- layer address: 0 or 1
306 // -------- side address : 0 (I) or 1 (J)
307 //
308 //
310 //
311 // delays
312 //
313 // channDelay[i][j][k]
314 // ^ ^ ^
315 // | | |
316 // | | |
317 // | | -- group index: from 0 to 1 for side=0 (I)
318 // | | from 0 to 3 for side=1 (J)
319 // | ----- layer address: 0 or 1
320 // -------- side address : 0 (I) or 1 (J)
321 //
322 //
324 //
325 // masking-to-0
326 //
327 // channMask0[i][j][k]
328 // ^ ^ ^
329 // | | |
330 // | | |
331 // | | -- channel address
332 // | ----- layer address: 0 or 1
333 // -------- side address : 0 (I) or 1 (J)
334 //
335 //
337 //
338 // masking-to-1 of OR and AND registers
339 //
340 // channMask1[i][j][k][l]
341 // ^ ^ ^ ^
342 // | | | |
343 // | | | |
344 // | | | -- channel address, in bits
345 // | | ----- majority address: 0 (1/2) or 1 (2/2)
346 // | -------- side address : 0 (I) or 1 (J) |
347 // ----------- threshold address
348 //
350 //
351 // masking-to-0 of ReadOut RPC registers
352 //
353 // channReadOutMask[2][2][2];
354 // ^ ^ ^
355 // | | |
356 // | | |
357 // | | -- channel address, in bits, from 0 to 63
358 // | ----- layer address: 0 or 1
359 // |------- side address : 0 (I) or 1 (J) |
360 //
361 //
363 //
364 // Pulse widths
365 //
366 // pulseWidth[i][j][k]
367 // ^ ^ ^
368 // | | |
369 // | | |
370 // | | -- group index: from 0 to 3 for side=0 (I)
371 // | | from 0 to 7 for side=1 (J)
372 // | ----- layer address: 0 or 1
373 // -------- side address : 0 (I) or 1 (J)
374 //
375 //
376 CMAword m_matOverlap[2]; // overlap registers
377 ubit16 m_trigDeadTime[4]; // trigger dead time
378 sbit32 m_diagonal[32]; // diagonal map (= pattern for pt=infinite)
380 // //
381 // READOUT parameters //
382 // //
383 static const sbit16 s_ROOffset; // ROOffset: alignment of CM input and
384 // k-pattern
385 // // channel time; units: DLL cycles //
387 void storeDeadtime();
388 void masking();
389 void delay();
390 void load();
391 void copyDataToReadOut();
392 void prepro();
393 void coincide();
394 void maskTo1();
395 void deadTime();
396 void pulse_width();
397 void declus();
398 void majori();
399 void reduce(ubit16 ia, ubit16 ja, ubit16 ka, ubit16 la, ubit16 nup, ubit16 first);
400 void shift(CMAword *buffi, CMAword *buffo, ubit16 i) const;
401 void makeOut();
402 void makeTestPattern(ubit16 mode, ubit16 ktimes);
403 void makeOutPattern();
404 ubit16 config(ubit16 i, ubit16 *arr) const;
405 void set_to_0(CMAword *p, sbit16 channel) const;
406 void set_to_1(CMAword *p, sbit16 channel) const;
407 CMAword intPow(const ubit16 base, const ubit16 expo) const;
408 void wind() const;
409 void show_attributes() const;
410 void disp_CMAreg(ubit16 id) const;
411 void dispRegister(const CMAword *p, ubit16 side) const;
412 void dispTrigger(const CMAword *p) const;
413 void dispBinary(const CMAword *p, std::ostream &strdisp) const;
414 //
415}; // end-of-class matrix
416#endif
double length(const pvec &v)
int16_t sbit16
Definition Lvl1Def.h:21
int32_t sbit32
Definition Lvl1Def.h:19
uint32_t CMAword
Definition Lvl1Def.h:17
const bool debug
unsigned short int ubit16
BaseObject(ObjectType, const std::string &)
Definition BaseObject.cxx:7
CMAword intPow(const ubit16 base, const ubit16 expo) const
Matrix(int run, int event, CMAword debug, int subsys, int proj, int sect, int padadd, int lowhig, int add[2], int locadd, int NOBXS, int BCZERO)
void setRunEvent(int runNum, int eventNum)
void setDelay(ubit16 iside, ubit16 ilayer, ubit16 delay)
void set_to_1(CMAword *p, sbit16 channel) const
void dispBinary(const CMAword *p, std::ostream &strdisp) const
void reduce(ubit16 ia, ubit16 ja, ubit16 ka, ubit16 la, ubit16 nup, ubit16 first)
ubit16 char2int(const char *str, CMAword the32[2])
ubit16 config(ubit16 i, ubit16 *arr) const
ubit16 getOutputThres(ubit16 bunch) const
CMAword getMatOverlap(ubit16 add) const
void setMask1(ubit16 ithreshold, ubit16 iside, ubit16 imajority, ubit16 ichannel)
void set_to_0(CMAword *p, sbit16 channel) const
void makeTestPattern(ubit16 mode, ubit16 ktimes)
void dispTrigger(const CMAword *p) const
CMAword rodat[2][2][64][2]
Note array lengths using hardcoded values rather than to depend on NOBXS as they were in the past (as...
ubit16 getParams() const
void setMaskReadOut(ubit16 iside, ubit16 ilayer, ubit16 ichannel)
void shift(CMAword *buffi, CMAword *buffo, ubit16 i) const
void setConfig(int *l, ubit16 *p1, int *k, CMAword *p2, int *q, CMAword *o, sbit32 *g)
ubit16 getOutputOverl(ubit16 bunch) const
void setMask0(ubit16 iside, ubit16 ilayer, ubit16 ichannel)
void dispRegister(const CMAword *p, ubit16 side) const
void putData(int sidemat, int layer, int stripaddress, float time)
CMAword getRoad(ubit16 addThres, ubit16 addChn, ubit16 add64) const
void setMatOverlap(ubit16 add, CMAword content)
void setLocalDirection(ubit16 add, int content)
void setMajority(ubit16 add, int content)
void setRoad(ubit16 addThres, ubit16 addChn, ubit16 add64, CMAword content)
void setDiagonal(ubit16 add, sbit32 content)
bool add(const std::string &hname, TKey *tobj)
Definition fastadd.cxx:55
std::string base
Definition hcg.cxx:81
int run(int argc, char *argv[])