1 #ifndef ALITRDTRAPCONFIG_H
2 #define ALITRDTRAPCONFIG_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 // Class holding the configuration of the tracklet processor
16 class AliTRDtrapConfig : public TObject
21 static AliTRDtrapConfig* Instance();
23 enum TrapReg_t { kSML0,
456 kLastReg }; // enum of all TRAP registers, to be used for access to them
458 const char* GetRegName(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fName.Data() : ""; }
459 UShort_t GetRegAddress(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fAddr : 0; }
460 UShort_t GetRegNBits(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fNbits : 0; }
461 UInt_t GetRegResetValue(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fResetValue : 0; }
463 TrapReg_t GetRegByAddress(Int_t address) const;
465 Int_t GetTrapReg(TrapReg_t reg, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1) const;
466 Bool_t PrintTrapReg(TrapReg_t reg, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1) const;
467 Bool_t PrintTrapAddr(Int_t addr, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1) const;
469 Bool_t SetTrapReg(TrapReg_t reg, Int_t value);
470 Bool_t SetTrapReg(TrapReg_t reg, Int_t value, Int_t det);
471 Bool_t SetTrapReg(TrapReg_t reg, Int_t value, Int_t det, Int_t rob, Int_t mcm);
473 UInt_t Peek(Int_t addr, Int_t det, Int_t rob, Int_t mcm) const;
474 Bool_t Poke(Int_t addr, UInt_t value, Int_t det, Int_t rob, Int_t mcm);
481 Bool_t SetDmem(Int_t addr, UInt_t value);
482 // Bool_t SetDmem(Int_t addr, UInt_t value, Int_t det);
483 Bool_t SetDmem(Int_t addr, UInt_t value, Int_t det, Int_t rob, Int_t mcm);
484 Bool_t SetDmem(Int_t addr, Int_t value) { return SetDmem(addr, (UInt_t) value); }
485 // Bool_t SetDmem(Int_t addr, Int_t value, Int_t det) { return SetDmem(addr, (UInt_t) value, det); }
486 Bool_t SetDmem(Int_t addr, Int_t value, Int_t det, Int_t rob, Int_t mcm) { return SetDmem(addr, (UInt_t) value, det, rob, mcm); }
488 UInt_t GetDmemUnsigned(Int_t addr) const;
489 UInt_t GetDmemUnsigned(Int_t addr, Int_t det, Int_t rob, Int_t mcm) const;
491 void PrintMemDatx(ostream &os, Int_t addr) const;
492 void PrintMemDatx(ostream &os, Int_t addr, Int_t det, Int_t rob, Int_t mcm) const;
493 void PrintMemDatx(ostream &os, TrapReg_t reg) const;
494 void PrintMemDatx(ostream &os, TrapReg_t reg, Int_t det, Int_t rob, Int_t mcm) const;
495 void PrintDatx(ostream &os, UInt_t addr, UInt_t data, Int_t rob, Int_t mcm) const;
498 void SetPIDscale(Double_t sq0, Double_t sq1) {fScaleQ0=sq0; fScaleQ1=sq1;} // The two scaling factors are not available in the TRAP but needed by the DCS board
499 void GetPIDscale(Double_t scale[2]) {scale[0] = fScaleQ0; scale[1]=fScaleQ1;} // The two scaling factors are not available in the TRAP but needed by the DCS board
501 // configuration handling
503 Bool_t LoadConfig(Int_t det, TString filename);
505 Bool_t ReadPackedConfig(Int_t det, UInt_t *data, Int_t size);
507 Bool_t AddValues(UInt_t det, UInt_t cmd, UInt_t extali, Int_t addr, UInt_t data);
510 static const Int_t fgkDmemAddrLUTcor0 = 0xC02A;
511 static const Int_t fgkDmemAddrLUTcor1 = 0xC028;
512 static const Int_t fgkDmemAddrLUTnbins = 0xC029;
514 static const Int_t fgkDmemAddrLUTStart = 0xC100; // LUT start address
515 static const Int_t fgkDmemAddrLUTEnd = 0xC3FF; // maximum possible end address for the LUT table
516 static const Int_t fgkDmemAddrLUTLength = 0xC02B; // address where real size of the LUT table is stored
518 static const Int_t fgkDmemAddrTrackletStart = 0xC0E0; // Storage area for tracklets, start address
519 static const Int_t fgkDmemAddrTrackletEnd = 0xC0E3; // Storage area for tracklets, end address
521 static const Int_t fgkDmemAddrDeflCorr = 0xc022; // DMEM address of deflection correction
522 static const Int_t fgkDmemAddrNdrift = 0xc025; // DMEM address of Ndrift
523 static const Int_t fgkDmemAddrDeflCutStart = 0xc030; // DMEM start address of deflection cut
524 static const Int_t fgkDmemAddrDeflCutEnd = 0xc055; // DMEM end address of deflection cut
526 // DMEM memory in simulation;
527 static const Int_t fgkDmemStartAddress; // start address in TRAP GIO
528 static const Int_t fgkDmemWords = 0xc400; // number of words in DMEM
531 static AliTRDtrapConfig *fgInstance; // pointer to instance (singleton)
534 TString fName; // Name of the register
535 UShort_t fAddr; // Address in GIO of TRAP
536 UShort_t fNbits; // Number of bits, from 1 to 32
537 UInt_t fResetValue; // reset value
538 SimpleReg_t(const char *nnn = 0, UShort_t a = 0, UShort_t n = 0, UInt_t r = 0) :
539 fName(nnn), fAddr(a), fNbits(n), fResetValue(r) {}
547 } state; // mode of storage (global or per MCM)
550 Int_t *individualValue;
554 // configuration registers
555 SimpleReg_t fRegs[kLastReg]; // array of TRAP registers
556 RegValue_t fRegisterValue[kLastReg]; // array of TRAP register values in use
558 static const UInt_t fgkScsnCmdWrite=10; // Command number for the write command
559 static const Int_t fgkMaxLinkPairs=4; // number of linkpairs used during configuration
560 static const Int_t fgkMaxMcm; // max. no. of MCMs to be treated
561 static const Int_t fgkMcmlistSize=256; // list of MCMs to which a value has to be written
564 UInt_t* fDmem[fgkDmemWords]; // DMEM storage
565 Int_t fDmemDepth[fgkDmemWords]; // memory space indicator for fDmem
567 static const Int_t fgkDmemSizeEmpty=0;
568 static const Int_t fgkDmemSizeUniform = 1;
569 static const Int_t fgkDmemSizeSmIndividual = 30*8*16; // storage for each MCM within one supermodule
570 static const Int_t fgkDmemSizeTotalIndividual = 540*6*8*16; // one individual value for each and every MCM in the TRD
571 static const Int_t fgkDmemSizeSmRocIndividual = 540; // one individual value for each chamber in TRD
574 Double_t fScaleQ0; // scaling factor for the x-axis of the PID table
575 Double_t fScaleQ1; // scaling factor for the y-axis of the PID table
577 AliTRDtrapConfig(); // private constructor due to singleton implementation
580 struct BlockDescr_t {
592 enum DbankProp_t { kDBankEmpty = 0,
603 AliTRDtrapConfig& operator=(const AliTRDtrapConfig &rhs); // not implemented
604 AliTRDtrapConfig(const AliTRDtrapConfig& cfg); // not implemented
606 ClassDef(AliTRDtrapConfig, 2);