Project
Loading...
Searching...
No Matches
TrapConfigHandler.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13// //
14// Trap configuraton handler //
15// //
16// based on work by U. Westerhoff //
17// //
19
20#include <iostream>
21#include <sstream>
22#include <iomanip>
23
24#include "TRDBase/FeeParam.h"
25#include "TRDBase/Geometry.h"
27#include "TRDBase/PadResponse.h"
32#include "TMath.h"
33#include "TGeoMatrix.h"
34#include "TGraph.h"
35
36using namespace std;
37using namespace o2::trd;
38using namespace o2::trd::constants;
39
40TrapConfigHandler::TrapConfigHandler(TrapConfig* cfg) : mFeeParam(), mRestrictiveMask((0x3ffff << 11) | (0x1f << 6) | 0x3f), mTrapConfig(cfg), mGtbl()
41{
42}
43
45
47{
48 if (!mTrapConfig) {
49 LOG(error) << "No TRAPconfig given";
50 return;
51 }
52
53 // setup of register allocation
54 // I/O configuration which we don't care about
56 // position look-up table by layer
57 for (int iBin = 0; iBin < 128; iBin++) {
59 }
60 // ... individual
63
64 // setup of DMEM allocation
65 for (int iAddr = TrapConfig::mgkDmemStartAddress;
67
69 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocByMCMinSM);
70
71 } else if (iAddr == TrapSimulator::mgkDmemAddrNdrift) {
72 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocByDetector);
73
75 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocByMCMinSM);
76
78 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocByMCM);
79
80 } else if ((iAddr >= TrapSimulator::mgkDmemAddrLUTStart) && (iAddr <= TrapSimulator::mgkDmemAddrLUTEnd)) {
81 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocGlobal);
82
83 } else if (iAddr == TrapSimulator::mgkDmemAddrLUTcor0) {
84 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocByMCMinSM);
85
86 } else if (iAddr == TrapSimulator::mgkDmemAddrLUTcor1) {
87 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocByMCMinSM);
88
89 } else if (iAddr == TrapSimulator::mgkDmemAddrLUTnbins) {
90 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocGlobal);
91
92 } else if (iAddr == TrapSimulator::mgkDmemAddrLUTLength) {
93 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocGlobal);
94
95 } else {
96 mTrapConfig->setDmemAlloc(iAddr, TrapConfig::kAllocGlobal);
97 }
98 }
99 mFeeParam = FeeParam::instance();
100}
101
103{
104 //
105 // Reset all MCM registers and DMEM
106 //
107
108 if (!mTrapConfig) {
109 LOG(error) << "No TRAPconfig given";
110 return;
111 }
112
113 mTrapConfig->resetRegs();
114 mTrapConfig->resetDmem();
115}
116
118{
119 // load a default configuration which is suitable for simulation
120 // for a detailed description of the registers see the TRAP manual
121 // if you want to resimulate tracklets on real data use the appropriate config instead
122
123 if (!mTrapConfig) {
124 LOG(error) << "No TRAPconfig given";
125 return -1;
126 }
127
128 // prepare mFeeParam
129 // ndrift (+ 5 binary digits)
130 mFeeParam->setNtimebins(20 << 5);
131 // deflection + tilt correction
132 mFeeParam->setRawOmegaTau(0.16133);
133 // deflection range table
134 mFeeParam->setRawPtMin(0.1);
135 // magnetic field
136 mFeeParam->setRawMagField(0.0);
137 // scaling factors for q0, q1
138 mFeeParam->setRawScaleQ0(0);
139 mFeeParam->setRawScaleQ1(0);
140 // disable length correction and tilting correction
141 mFeeParam->setRawLengthCorrectionEnable(false);
142 mFeeParam->setRawTiltCorrectionEnable(false);
143
144 for (int iDet = 0; iDet < 540; iDet++) {
145 // HC header configuration bits
146 mTrapConfig->setTrapReg(TrapConfig::kC15CPUA, 0x2102, iDet); // zs, deh
147
148 // no. of timebins
149 mTrapConfig->setTrapReg(TrapConfig::kC13CPUA, 24, iDet);
150
151 // pedestal filter
152 mTrapConfig->setTrapReg(TrapConfig::kFPNP, 4 * 10, iDet);
153 mTrapConfig->setTrapReg(TrapConfig::kFPTC, 0, iDet);
154 mTrapConfig->setTrapReg(TrapConfig::kFPBY, 0, iDet); // bypassed!
155
156 // gain filter
157 for (int adc = 0; adc < 20; adc++) {
158 mTrapConfig->setTrapReg(TrapConfig::TrapReg_t(TrapConfig::kFGA0 + adc), 40, iDet);
159 mTrapConfig->setTrapReg(TrapConfig::TrapReg_t(TrapConfig::kFGF0 + adc), 15, iDet);
160 }
161 mTrapConfig->setTrapReg(TrapConfig::kFGTA, 20, iDet);
162 mTrapConfig->setTrapReg(TrapConfig::kFGTB, 2060, iDet);
163 mTrapConfig->setTrapReg(TrapConfig::kFGBY, 0, iDet); // bypassed!
164
165 // tail cancellation
166 mTrapConfig->setTrapReg(TrapConfig::kFTAL, 200, iDet);
167 mTrapConfig->setTrapReg(TrapConfig::kFTLL, 0, iDet);
168 mTrapConfig->setTrapReg(TrapConfig::kFTLS, 200, iDet);
169 mTrapConfig->setTrapReg(TrapConfig::kFTBY, 0, iDet);
170
171 // tracklet calculation
172 mTrapConfig->setTrapReg(TrapConfig::kTPQS0, 5, iDet);
173 mTrapConfig->setTrapReg(TrapConfig::kTPQE0, 10, iDet);
174 mTrapConfig->setTrapReg(TrapConfig::kTPQS1, 11, iDet);
175 mTrapConfig->setTrapReg(TrapConfig::kTPQE1, 20, iDet);
176 mTrapConfig->setTrapReg(TrapConfig::kTPFS, 5, iDet);
177 mTrapConfig->setTrapReg(TrapConfig::kTPFE, 20, iDet);
178 mTrapConfig->setTrapReg(TrapConfig::kTPVBY, 0, iDet);
179 mTrapConfig->setTrapReg(TrapConfig::kTPVT, 10, iDet);
180 mTrapConfig->setTrapReg(TrapConfig::kTPHT, 150, iDet);
181 mTrapConfig->setTrapReg(TrapConfig::kTPFP, 40, iDet);
182 mTrapConfig->setTrapReg(TrapConfig::kTPCL, 1, iDet);
183 mTrapConfig->setTrapReg(TrapConfig::kTPCT, 10, iDet);
184
185 // apply mFeeParams
186 configureDyCorr(iDet);
187 configureDRange(iDet); // deflection range
188 configureNTimebins(iDet); // timebins in the drift region
189 configurePIDcorr(iDet); // scaling parameters for the PID
190
191 // event buffer
192 mTrapConfig->setTrapReg(TrapConfig::kEBSF, 1, iDet); // 0: store filtered; 1: store unfiltered
193
194 // zs applied to data stored in event buffer (sel. by EBSF)
195 mTrapConfig->setTrapReg(TrapConfig::kEBIS, 15, iDet); // single indicator threshold (plus two digits)
196 mTrapConfig->setTrapReg(TrapConfig::kEBIT, 30, iDet); // sum indicator threshold (plus two digits)
197 mTrapConfig->setTrapReg(TrapConfig::kEBIL, 0xf0, iDet); // lookup table
198 mTrapConfig->setTrapReg(TrapConfig::kEBIN, 0, iDet); // neighbour sensitivity
199
200 // raw data
201 mTrapConfig->setTrapReg(TrapConfig::kNES, (0x0000 << 16) | 0x1000, iDet);
202 }
203
204 // ****** hit position LUT
205
206 // now calculate it from PRF
207 PadResponse padresponse;
208 double padResponse[3]; // pad response left, central, right
209 double padResponseR[3]; // pad response left, central, right
210 double padResponseL[3]; // pad response left, central, right
211
212 for (int iLayer = 0; iLayer < 6; iLayer++) {
213 TGraph gr(128);
214 for (int iBin = 0; iBin < 256 * 0.5; iBin++) {
215 padresponse.getPRF(1., iBin * 1. / 256., iLayer, padResponse);
216 padresponse.getPRF(1., iBin * 1. / 256. - 1., iLayer, padResponseR);
217 padresponse.getPRF(1., iBin * 1. / 256. + 1., iLayer, padResponseL);
218 gr.SetPoint(iBin, (0.5 * (padResponseR[1] - padResponseL[1]) / padResponse[1] * 256), iBin);
219 }
220 for (int iBin = 0; iBin < 128; iBin++) {
221 int corr = (int)(gr.Eval(iBin)) - iBin;
222 if (corr < 0) {
223 corr = 0;
224 } else if (corr > 31) {
225 corr = 31;
226 }
227 for (int iStack = 0; iStack < 540 / 6; iStack++) {
228 mTrapConfig->setTrapReg((TrapConfig::TrapReg_t)(TrapConfig::kTPL00 + iBin), corr, 6 * iStack + iLayer);
229 }
230 }
231 }
232 // ****** hit position LUT configuration end
233
234 return 0;
235}
236
238{
239 //
240 // load a TRAP configuration from a file
241 // The file format is the format created by the standalone
242 // command coder scc / show_cfdat but without the running number
243 // scc /show_cfdat adds as the first column
244 // which are two tools to inspect/export configurations from wingDB
245 //
246
247 if (!mTrapConfig) {
248 LOG(error) << "No TRAPconfig given";
249 return -1;
250 }
251
252 int ignoredLines = 0;
253 int ignoredCmds = 0;
254 int readLines = 0;
255
256 LOG(debug3) << "Processing file " << filename.c_str();
257 std::ifstream infile;
258 infile.open(filename.c_str(), std::ifstream::in);
259 if (!infile.is_open()) {
260 LOG(error) << "Can not open MCM configuration file " << filename;
261 return false;
262 }
263
264 int addr;
265
266 // reset restrictive mask
267 mRestrictiveMask = (0x3ffff << 11) | (0x1f << 6) | 0x3f;
268 char linebuffer[512];
269 istringstream line;
270
271 while (infile.getline(linebuffer, 512) && infile.good()) {
272 unsigned int cmd = 999;
273 int data = -1;
274 int extali = -1;
275 line.clear();
276 line.str(linebuffer);
277 data = -1;
278 line >> std::skipws >> cmd >> addr >> data >> extali; // the lines read from config file can contain additional columns.
279 // Therefore the detour via istringstream
280
281 if (cmd != 999 && addr != -1 && extali != -1) {
282
283 if (cmd == mgkScsnCmdWrite) {
284 for (int det = 0; det < MAXCHAMBER; det++) {
285 unsigned int rocpos = (1 << (Geometry::getSector(det) + 11)) | (1 << (Geometry::getStack(det) + 6)) | (1 << Geometry::getLayer(det));
286 LOG(debug) << "checking restriction: mask=0x" << hex << std::setw(8) << mRestrictiveMask << " rocpos=0x" << hex << std::setw(8) << rocpos;
287 if ((mRestrictiveMask & rocpos) == rocpos) {
288 LOG(debug) << "match:"
289 << " " << cmd << " " << extali << " " << addr << " " << data;
290 addValues(det, cmd, extali, addr, data);
291 }
292 }
293 }
294
295 else if (cmd == mgkScsnLTUparam) {
296 // processLTUparam(extali, addr, data);
297 }
298
299 else if (cmd == mgkScsnCmdRestr) {
300 mRestrictiveMask = data;
301 LOG(debug) << "updated restrictive mask to 0x" << hex << std::setw(8) << mRestrictiveMask;
302 }
303
304 else if ((cmd == mgkScsnCmdReset) ||
305 (cmd == mgkScsnCmdRobReset)) {
306 mTrapConfig->resetRegs();
307 }
308
309 else if (cmd == mgkScsnCmdSetHC) {
310 int fullVersion = ((data & 0x7F00) >> 1) | (data & 0x7f);
311
312 for (int iDet = 0; iDet < MAXCHAMBER; iDet++) {
313 int smls = (Geometry::getSector(iDet) << 6) | (Geometry::getLayer(iDet) << 3) | Geometry::getStack(iDet);
314
315 for (int iRob = 0; iRob < 8; iRob++) {
316 // HC mergers
317 mTrapConfig->setTrapReg(TrapConfig::kC14CPUA, 0xc << 16, iDet, iRob, 17);
318 mTrapConfig->setTrapReg(TrapConfig::kC15CPUA, ((1 << 29) | (fullVersion << 15) | (1 << 12) | (smls << 1) | (iRob % 2)), iDet, iRob, 17);
319
320 // board mergers
321 mTrapConfig->setTrapReg(TrapConfig::kC14CPUA, 0, iDet, iRob, 16);
322 mTrapConfig->setTrapReg(TrapConfig::kC15CPUA, ((1 << 29) | (fullVersion << 15) | (1 << 12) | (smls << 1) | (iRob % 2)), iDet, iRob, 16);
323
324 // and now for the others
325 for (int iMcm = 0; iMcm < 16; iMcm++) {
326 mTrapConfig->setTrapReg(TrapConfig::kC14CPUA, iMcm | (iRob << 4) | (3 << 16), iDet, iRob, iMcm);
327 mTrapConfig->setTrapReg(TrapConfig::kC15CPUA, ((1 << 29) | (fullVersion << 15) | (1 << 12) | (smls << 1) | (iRob % 2)), iDet, iRob, iMcm);
328 }
329 }
330 }
331 }
332
333 else if ((cmd == mgkScsnCmdRead) ||
334 (cmd == mgkScsnCmdPause) ||
335 (cmd == mgkScsnCmdPtrg) ||
336 (cmd == mgkScsnCmdHwPtrg) ||
337 (cmd == mgkScsnCmdRobPower) ||
338 (cmd == mgkScsnCmdTtcRx) ||
339 (cmd == mgkScsnCmdMcmTemp) ||
340 (cmd == mgkScsnCmdOri) ||
341 (cmd == mgkScsnCmdPM)) {
342 LOG(debug2) << "ignored SCSN command: " << cmd << " " << addr << " " << data << " " << extali;
343 }
344
345 else {
346 LOG(warn) << "unknown SCSN command: " << cmd << " " << addr << " " << data << " " << extali;
347 ignoredCmds++;
348 }
349
350 readLines++;
351 }
352
353 else if (!infile.eof() && !infile.good()) {
354 infile.clear();
355 infile.ignore(256, '\n');
356 ignoredLines++;
357 }
358
359 if (!infile.eof()) {
360 infile.clear();
361 }
362 }
363
364 infile.close();
365
366 LOG(debug3) << "Ignored lines: " << ignoredLines << ", ignored cmds: " << ignoredCmds;
367
368 if (ignoredLines > readLines) {
369 LOG(error) << "More than 50% of the input file could not be processed. Perhaps you should check the input file " << filename.c_str();
370 }
371
372 return true;
373}
374
376{
377 mGtbl = gtbl;
378 return 0;
379}
380
381void TrapConfigHandler::processLTUparam(int dest, int addr, unsigned int data)
382{
383 //
384 // Process the LTU parameters and stores them in internal class variables
385 // or transfer the stored values to TrapConfig, depending on the dest parameter
386 //
387
388 switch (dest) {
389
390 case 0: // set the parameters in TrapConfig
391 for (int det = 0; det < MAXCHAMBER; det++) {
392 configureDyCorr(det);
393 configureDRange(det); // deflection range
394 configureNTimebins(det); // timebins in the drift region
395 configurePIDcorr(det); // scaling parameters for the PID
396 }
397 break;
398
399 case 1: // set variables
400 switch (addr) {
401
402 case 0:
403 mFeeParam->setPtMin(data);
404 break; // pt_min in GeV/c (*1000)
405 case 1:
406 mFeeParam->setMagField(data);
407 break; // B in T (*1000)
408 case 2:
409 mFeeParam->setOmegaTau(data);
410 break; // omega*tau
411 case 3:
412 mFeeParam->setNtimebins(data);
413 break;
414 // ntimbins: drift time (for 3 cm) in timebins (5 add. bin. digits)
415 case 4:
416 mFeeParam->setScaleQ0(data);
417 break;
418 case 5:
419 mFeeParam->setScaleQ1(data);
420 break;
421 case 6:
423 break;
424 case 7:
425 mFeeParam->setTiltCorrectionEnable(data);
426 break;
427 }
428 break;
429
430 default:
431 LOG(error) << "dest " << dest << " not implemented";
432 }
433}
434
435void TrapConfigHandler::configureNTimebins(int det)
436{
437 //
438 // set timebins in the drift region
439 //
440
441 if (!mTrapConfig) {
442 LOG(error) << "No TRAPconfig given";
443 return;
444 }
445
446 addValues(det, mgkScsnCmdWrite, 127, TrapSimulator::mgkDmemAddrNdrift, mFeeParam->getNtimebins());
447}
448
449void TrapConfigHandler::configureDyCorr(int det)
450{
451 //
452 // Deflection length correction
453 // due to Lorentz angle and tilted pad correction
454 // This correction is in units of padwidth / (256*32)
455 //
456
457 if (!mTrapConfig) {
458 LOG(error) << "No TRAPconfig given";
459 return;
460 }
461
462 int nRobs = Geometry::getStack(det) == 2 ? 6 : 8;
463
464 for (int r = 0; r < nRobs; r++) {
465 for (int m = 0; m < 16; m++) {
466 int dest = 1 << 10 | r << 7 | m;
467 int dyCorrInt = mFeeParam->getDyCorrection(det, r, m);
468 addValues(det, mgkScsnCmdWrite, dest, TrapSimulator::mgkDmemAddrDeflCorr, dyCorrInt);
469 }
470 }
471}
472
473void TrapConfigHandler::configureDRange(int det)
474{
475 //
476 // deflection range LUT
477 // range calculated according to B-field (in T) and pt_min (in GeV/c)
478 // if pt_min < 0.1 GeV/c the maximal allowed range for the tracklet
479 // deflection (-64..63) is used
480 //
481 // TODO might need to be updated depending in the FEE configuration for Run 3
482
483 if (!mTrapConfig) {
484 LOG(error) << "No TRAPconfig given";
485 return;
486 }
487
488 int nRobs = Geometry::getStack(det) == 2 ? 6 : 8;
489
490 int dyMinInt;
491 int dyMaxInt;
492
493 for (int r = 0; r < nRobs; r++) {
494 for (int m = 0; m < 16; m++) {
495 for (int c = 0; c < 18; c++) {
496
497 // cout << "maxdefl: " << maxDeflAngle << ", localPhi " << localPhi << endl;
498 // cout << "r " << r << ", m" << m << ", c " << c << ", min angle: " << localPhi-maxDeflAngle << ", max: " << localPhi+maxDeflAngle
499 //<< ", min int: " << dyMinInt << ", max int: " << dyMaxInt << endl;
500 int dest = 1 << 10 | r << 7 | m;
501 int lutAddr = TrapSimulator::mgkDmemAddrDeflCutStart + 2 * c;
502 mFeeParam->getDyRange(det, r, m, c, dyMinInt, dyMaxInt);
503 addValues(det, mgkScsnCmdWrite, dest, lutAddr + 0, dyMinInt);
504 addValues(det, mgkScsnCmdWrite, dest, lutAddr + 1, dyMaxInt);
505 }
506 }
507 }
508}
509
511{
512 //
513 // Prints some information about the geometry. Only for debugging
514 //
515
516 int sm = 0;
517 // for(int sm=0; sm<6; sm++) {
518 for (int stack = 0; stack < 5; stack++) {
519 for (int layer = 0; layer < 6; layer++) {
520
521 int det = sm * 30 + stack * 6 + layer;
522 for (int r = 0; r < 6; r++) {
523 for (int m = 0; m < 16; m++) {
524 for (int c = 7; c < 8; c++) {
525 cout << stack << ";" << layer << ";" << r << ";" << m
526 << ";" << mFeeParam->getX(det, r, m)
527 << ";" << mFeeParam->getLocalY(det, r, m, c)
528 << ";" << mFeeParam->getLocalZ(det, r, m) << endl;
529 }
530 }
531 }
532 }
533 }
534 // }
535}
536
537void TrapConfigHandler::configurePIDcorr(int det)
538{
539 //
540 // Calculate the MCM individual correction factors for the PID
541 // and transfer them to TrapConfig
542 //
543
544 if (!mTrapConfig) {
545 LOG(error) << "No TRAPconfig given";
546 return;
547 }
548
549 static const int addrLUTcor0 = TrapSimulator::mgkDmemAddrLUTcor0;
550 static const int addrLUTcor1 = TrapSimulator::mgkDmemAddrLUTcor1;
551
552 unsigned int cor0;
553 unsigned int cor1;
554 int readoutboard;
555 int mcm;
556 // int nRobs = Geometry::getStack(det) == 2 ? 6 : 8;
557 int MaxRows;
558 FeeParam* feeparam = FeeParam::instance();
559 if (Geometry::getStack(det) == 2) {
560 MaxRows = NROWC0;
561 } else {
562 MaxRows = NROWC1;
563 }
564 int MaxCols = NCOLUMN;
565 for (int row = 0; row < MaxRows; row++) { //TODO put this back to rob/mcm and not row/col as done in TrapSimulator
566 for (int col = 0; col < MaxCols; col++) {
567 readoutboard = feeparam->getROBfromPad(row, col);
568 mcm = feeparam->getMCMfromPad(row, col);
569 int dest = 1 << 10 | readoutboard << 7 | mcm;
570 //TODO impelment a method for determining if gaintables are valid, used to be if pointer was valid.
571 if (mGtbl.getMCMGain(det, row, col) != 0.0) { //TODO check this logic there might be problems here.
572 mFeeParam->getCorrectionFactors(det, readoutboard, mcm, 9, cor0, cor1, mGtbl.getMCMGain(det, row, col));
573 } else {
574 mFeeParam->getCorrectionFactors(det, readoutboard, mcm, 9, cor0, cor1);
575 }
576 addValues(det, mgkScsnCmdWrite, dest, addrLUTcor0, cor0);
577 addValues(det, mgkScsnCmdWrite, dest, addrLUTcor1, cor1);
578 }
579 }
580}
581
582bool TrapConfigHandler::addValues(unsigned int det, unsigned int cmd, unsigned int extali, int addr, unsigned int data)
583{
584 // transfer the informations provided by LoadConfig to the internal class variables
585
586 if (!mTrapConfig) {
587 LOG(error) << "No TRAPconfig given";
588 return false;
589 }
590
591 if (cmd != mgkScsnCmdWrite) {
592 LOG(error) << "Invalid command received: " << cmd;
593 return false;
594 }
595
596 TrapConfig::TrapReg_t mcmReg = mTrapConfig->getRegByAddress(addr);
597 int rocType = Geometry::getStack(det) == 2 ? 0 : 1;
598
599 static const int mcmListSize = 40; // 40 is more or less arbitrary
600 int mcmList[mcmListSize];
601
602 // configuration registers
603 if (mcmReg >= 0 && mcmReg < TrapConfig::kLastReg) {
604
605 for (int linkPair = 0; linkPair < mgkMaxLinkPairs; linkPair++) {
606 if (FeeParam::extAliToAli(extali, linkPair, rocType, mcmList, mcmListSize) != 0) {
607 int i = 0;
608 while ((i < mcmListSize) && (mcmList[i] != -1)) {
609 if (mcmList[i] == 127) {
610 LOG(debug) << "broadcast write to " << mTrapConfig->getRegName((TrapConfig::TrapReg_t)mcmReg) << ": 0x" << hex << std::setw(8) << data;
611 mTrapConfig->setTrapReg((TrapConfig::TrapReg_t)mcmReg, data, det);
612 } else {
613 LOG(debug) << "individual write to " << mTrapConfig->getRegName((TrapConfig::TrapReg_t)mcmReg) << " (" << (mcmList[i] >> 7) << "," << (mcmList[i] & 0x7F) << "): 0x" << hex << std::setw(8) << data;
614 mTrapConfig->setTrapReg((TrapConfig::TrapReg_t)mcmReg, data, det, (mcmList[i] >> 7) & 0x7, (mcmList[i] & 0x7F));
615 }
616 i++;
617 }
618 }
619 }
620 return true;
621 }
622 // DMEM
623 else if ((addr >= TrapConfig::mgkDmemStartAddress) &&
625 for (int linkPair = 0; linkPair < mgkMaxLinkPairs; linkPair++) {
626 if (FeeParam::extAliToAli(extali, linkPair, rocType, mcmList, mcmListSize) != 0) {
627 int i = 0;
628 while (i < mcmListSize && mcmList[i] != -1) {
629 if (mcmList[i] == 127) {
630 mTrapConfig->setDmem(addr, data, det, 0, 127);
631 } else {
632 mTrapConfig->setDmem(addr, data, det, mcmList[i] >> 7, mcmList[i] & 0x7f);
633 }
634 i++;
635 }
636 }
637 }
638 return true;
639 } else if ((addr >= TrapConfig::mgkImemStartAddress) &&
641 // IMEM is ignored for now
642 return true;
643 } else if ((addr >= TrapConfig::mgkDbankStartAddress) &&
645 // DBANK is ignored for now
646 return true;
647 } else {
648 LOG(error) << "Writing to unhandled address 0x" << hex << std::setw(4) << addr;
649 return false;
650 }
651}
uint16_t mcm
Global TRD definitions and constants.
int32_t i
uint32_t col
Definition RawData.h:4
uint32_t c
Definition RawData.h:2
uint32_t stack
Definition RawData.h:1
std::ostringstream debug
float getMCMGain(int det, int row, int col) const
void setTiltCorrectionEnable(int data)
Definition FeeParam.h:102
void setRawTiltCorrectionEnable(bool data)
Definition FeeParam.h:113
void setMagField(int data)
Definition FeeParam.h:96
void setScaleQ1(int data)
Definition FeeParam.h:100
void setRawScaleQ0(int data)
Definition FeeParam.h:110
void setLengthCorrectionEnable(int data)
Definition FeeParam.h:101
void setScaleQ0(int data)
Definition FeeParam.h:99
int getNtimebins() const
Definition FeeParam.cxx:578
void setPtMin(int data)
Definition FeeParam.h:91
void setRawMagField(float data)
Definition FeeParam.h:107
void getDyRange(int det, int rob, int mcm, int ch, int &dyMinInt, int &dyMaxInt) const
Definition FeeParam.cxx:485
static int getROBfromPad(int irow, int icol)
Definition FeeParam.cxx:184
void getCorrectionFactors(int det, int rob, int mcm, int ch, unsigned int &cor0, unsigned int &cor1, float gain=1.) const
Definition FeeParam.cxx:559
void setOmegaTau(int data)
Definition FeeParam.h:97
float getLocalY(int det, int rob, int mcm, int ch) const
Definition FeeParam.cxx:593
void setRawScaleQ1(int data)
Definition FeeParam.h:111
float getX(int det, int rob, int mcm) const
Definition FeeParam.cxx:585
void setRawLengthCorrectionEnable(bool data)
Definition FeeParam.h:112
void setRawPtMin(float data)
Definition FeeParam.h:106
static int extAliToAli(unsigned int dest, unsigned short linkpair, unsigned short rocType, int *list, int listSize)
Definition FeeParam.cxx:234
void setRawOmegaTau(float data)
Definition FeeParam.h:108
static FeeParam * instance()
Definition FeeParam.cxx:58
void setNtimebins(int data)
Definition FeeParam.h:98
static int getMCMfromPad(int irow, int icol)
Definition FeeParam.cxx:142
int getDyCorrection(int det, int rob, int mcm) const
Definition FeeParam.cxx:465
float getLocalZ(int det, int rob, int mcm) const
Definition FeeParam.cxx:603
int getPRF(double, double, int, double *) const
int setGaintable(CalOnlineGainTables &gtbl)
TrapConfigHandler(TrapConfig *cfg=nullptr)
void processLTUparam(int dest, int addr, unsigned int data)
static const int mgkDbankStartAddress
Definition TrapConfig.h:550
bool setDmem(int addr, unsigned int value, int det)
static const int mgkDmemStartAddress
Definition TrapConfig.h:544
std::string getRegName(TrapReg_t reg)
Definition TrapConfig.h:526
static const int mgkImemStartAddress
Definition TrapConfig.h:547
bool setTrapReg(TrapReg_t reg, int value, int det)
bool setDmemAlloc(int addr, Alloc_t mode)
static const int mgkImemWords
Definition TrapConfig.h:548
bool setTrapRegAlloc(TrapReg_t reg, Alloc_t mode)
Definition TrapConfig.h:494
TrapReg_t getRegByAddress(int address)
static const int mgkDmemWords
Definition TrapConfig.h:545
static constexpr int mgkDmemAddrDeflCorr
static constexpr int mgkDmemAddrLUTcor0
static constexpr int mgkDmemAddrDeflCutStart
static constexpr int mgkDmemAddrLUTnbins
static constexpr int mgkDmemAddrNdrift
static constexpr int mgkDmemAddrTrackletStart
static constexpr int mgkDmemAddrLUTcor1
static constexpr int mgkDmemAddrLUTLength
static constexpr int mgkDmemAddrDeflCutEnd
static constexpr int mgkDmemAddrLUTStart
static constexpr int mgkDmemAddrTrackletEnd
static constexpr int mgkDmemAddrLUTEnd
const GLfloat * m
Definition glcorearb.h:4066
GLboolean * data
Definition glcorearb.h:298
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean r
Definition glcorearb.h:1233
constexpr int NCOLUMN
the number of pad columns for each chamber
Definition Constants.h:41
constexpr int NROWC0
the number of pad rows for chambers of type C0 (installed in stack 2)
Definition Constants.h:42
constexpr int MAXCHAMBER
the maximum number of installed chambers
Definition Constants.h:30
constexpr int NROWC1
the number of pad rows for chambers of type C1 (installed in stacks 0, 1, 3 and 4)
Definition Constants.h:43
std::string fullVersion()
get full version information (official O2 release and git commit)
Defining DataPointCompositeObject explicitly as copiable.
std::string filename()
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row
ArrayADC adc