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