#include "AliTRDgeometry.h"
#include "AliTRDfeeParam.h"
#include "AliTRDtrapConfig.h"
+#include "AliTRDtrapConfigHandler.h"
#include <fstream>
#include <iostream>
if (!fgInstance) {
fgInstance = new AliTRDtrapConfig();
- fgInstance->LoadConfig();
+ AliTRDtrapConfigHandler cfgHandler;
+ cfgHandler.LoadConfig();
}
return fgInstance;
if ((reg < 0) || (reg >= kLastReg)) {
AliError("Non-existing register requested");
- return -1;
+ return 0;
}
else {
if (fRegisterValue[reg].state == RegValue_t::kGlobal) {
}
else {
AliError("Invalid MCM specified or register is individual");
- return -1;
+ return 0;
}
}
else { // should never be reached
AliError("MCM register status neither kGlobal nor kIndividual");
- return -1;
+ return 0;
}
}
- return -1;
}
return kTRUE;
}
else {
- AliError("Register has individual values");
+ AliError(Form("Register %s has individual values", AliTRDtrapConfig::GetRegName(reg)));
}
return kFALSE;
}
}
}
- return -1;
+ return 0;
}
addr = addr - fgkDmemStartAddress;
if(addr < 0 || addr >= fgkDmemWords) {
- AliDebug(5, Form("No DMEM address: 0x%08x", addr+fgkDmemStartAddress));
+ AliError(Form("No DMEM address: 0x%08x", addr+fgkDmemStartAddress));
return kFALSE;
}
switch(fDmemDepth[addr]) {
case fgkDmemSizeEmpty:
- AliDebug(5, Form("DMEM address %i not active", addr));
+ AliDebug(4, Form("DMEM address %i not active", addr));
return kFALSE;
break;
case fgkDmemSizeUniform:
switch(fDmemDepth[addr]) {
case fgkDmemSizeEmpty:
- AliError(Form("DMEM address 0x%08x not active", addr+fgkDmemStartAddress));
+ AliDebug(4, Form("DMEM address 0x%08x not active", addr+fgkDmemStartAddress));
return kFALSE;
break;
case fgkDmemSizeUniform:
UInt_t AliTRDtrapConfig::GetDmemUnsigned(Int_t addr) const
{
addr = addr - fgkDmemStartAddress;
- if(addr >= fgkDmemWords) {
+ if(addr < 0 || addr >= fgkDmemWords) {
AliError(Form("No DMEM address: 0x%08x", addr+fgkDmemStartAddress));
return 0;
}
switch(fDmemDepth[addr]) {
case fgkDmemSizeEmpty:
- AliError(Form("DMEM address 0x%08x not active", addr+fgkDmemStartAddress));
+ AliDebug(4, Form("DMEM address 0x%08x not active", addr+fgkDmemStartAddress));
return 0;
break;
case fgkDmemSizeUniform:
}
-Bool_t AliTRDtrapConfig::LoadConfig()
-{
- // load a set of TRAP register values (configuration)
- // here a default set is implemented for testing
- // for a detailed description of the registers see the TRAP manual
-
- // no. of timebins
- SetTrapReg(kC13CPUA, 24);
-
- // pedestal filter
- SetTrapReg(kFPNP, 4*10);
- SetTrapReg(kFPTC, 0);
- SetTrapReg(kFPBY, 0); // bypassed!
-
- // gain filter
- for (Int_t adc = 0; adc < 20; adc++) {
- SetTrapReg(TrapReg_t(kFGA0+adc), 40);
- SetTrapReg(TrapReg_t(kFGF0+adc), 15);
- }
- SetTrapReg(kFGTA, 20);
- SetTrapReg(kFGTB, 2060);
- SetTrapReg(kFGBY, 0); // bypassed!
-
- // tail cancellation
- SetTrapReg(kFTAL, 267);
- SetTrapReg(kFTLL, 356);
- SetTrapReg(kFTLS, 387);
- SetTrapReg(kFTBY, 0);
-
- // tracklet calculation
- SetTrapReg(kTPQS0, 5);
- SetTrapReg(kTPQE0, 10);
- SetTrapReg(kTPQS1, 11);
- SetTrapReg(kTPQE1, 20);
- SetTrapReg(kTPFS, 5);
- SetTrapReg(kTPFE, 20);
- SetTrapReg(kTPVBY, 0);
- SetTrapReg(kTPVT, 10);
- SetTrapReg(kTPHT, 150);
- SetTrapReg(kTPFP, 40);
- SetTrapReg(kTPCL, 1);
- SetTrapReg(kTPCT, 10);
-
- // ndrift (+ 5 binary digits)
- SetDmem(0xc025, 20 << 5);
- // deflection + tilt correction
- SetDmem(0xc022, 0);
- // deflection range table
- for (Int_t iTrklCh = 0; iTrklCh < 18; iTrklCh++) {
- SetDmem(0xc030 + 2 * iTrklCh, -64); // min. deflection
- SetDmem(0xc031 + 2 * iTrklCh, 63); // max. deflection
- }
-
- // hit position LUT
- const UShort_t lutPos[128] = {
- 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15,
- 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26,
- 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 26,
- 26, 26, 26, 25, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 18, 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 7};
- for (Int_t iCOG = 0; iCOG < 128; iCOG++)
- SetTrapReg((TrapReg_t) (kTPL00 + iCOG), lutPos[iCOG]);
-
- // event buffer
- SetTrapReg(kEBSF, 1); // 0: store filtered; 1: store unfiltered
- // zs applied to data stored in event buffer (sel. by EBSF)
- SetTrapReg(kEBIS, 15 << 2); // single indicator threshold (plus two digits)
- SetTrapReg(kEBIT, 30 << 2); // sum indicator threshold (plus two digits)
- SetTrapReg(kEBIL, 0xf0); // lookup table
- SetTrapReg(kEBIN, 0); // neighbour sensitivity
-
- // raw data
- SetTrapReg(kNES, (0x0000 << 16) | 0x1000);
-
- return kTRUE;
-}
-
-
-Bool_t AliTRDtrapConfig::LoadConfig(Int_t det, TString filename)
-{
- // load a TRAP configuration from a file
- // The file format is the format created by the standalone
- // command coder: scc / show_cfdat
- // which are two tools to inspect/export configurations from wingDB
-
- ResetRegs(); // does not really make sense here???
-
- std::ifstream infile;
- infile.open(filename.Data(), std::ifstream::in);
- if (!infile.is_open()) {
- AliError("Can not open MCM configuration file");
- return kFALSE;
- }
-
- Int_t cmd, extali, addr, data;
- Int_t no;
- char tmp;
-
- while(infile.good()) {
- cmd=-1;
- extali=-1;
- addr=-1;
- data=-1;
- infile >> std::skipws >> no >> tmp >> cmd >> addr >> data >> extali;
- // std::cout << "no: " << no << ", cmd " << cmd << ", extali " << extali << ", addr " << addr << ", data " << data << endl;
-
- if(cmd!=-1 && extali!=-1 && addr != -1 && data!= -1) {
- AddValues(det, cmd, extali, addr, data);
- }
- else if(!infile.eof() && !infile.good()) {
- infile.clear();
- infile.ignore(256, '\n');
- }
-
- if(!infile.eof())
- infile.clear();
- }
-
- infile.close();
-
- return kTRUE;
-}
-
-
Bool_t AliTRDtrapConfig::ReadPackedConfig(Int_t hc, UInt_t *data, Int_t size)
{
// Read the packed configuration from the passed memory block