]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDtrapConfig.cxx
update comments, add some possible TODOs
[u/mrichter/AliRoot.git] / TRD / AliTRDtrapConfig.cxx
index 9410c88dd3b12dcc76cd89b880e95cdea63c6255..4b3a2e2ebf704908a339a9dc01cec52d5e6e6ecf 100644 (file)
@@ -31,7 +31,6 @@
 #include <iostream>
 #include <iomanip>
 
-const Int_t AliTRDtrapConfig::fgkMaxMcm = AliTRDfeeParam::GetNmcmRob() + 2;
 const Int_t AliTRDtrapConfig::AliTRDtrapValue::fgkSize[] = {
   0,
   1,
@@ -80,7 +79,8 @@ AliTRDtrapConfig::AliTRDtrapConfig(const TString &name, const TString &title) :
        AliError(Form("Register address 0x%04x not handled in register map", addr));
       }
       else if (addr < fgkRegisterAddressBlockStart[2] + fgkRegisterAddressBlockSize[2]) {
-       fgRegAddressMap[addr - fgkRegisterAddressBlockStart[2] + fgkRegisterAddressBlockSize[1] + fgkRegisterAddressBlockSize[0]] = (TrapReg_t) iReg;
+       Int_t ind = addr - fgkRegisterAddressBlockStart[2] + fgkRegisterAddressBlockSize[1] + fgkRegisterAddressBlockSize[0];
+       fgRegAddressMap[ind] = (TrapReg_t) iReg;
       }
       else {
        AliError(Form("Register address 0x%04x not handled in register map", addr));
@@ -708,7 +708,7 @@ Bool_t AliTRDtrapConfig::PrintTrapReg(TrapReg_t reg, Int_t det, Int_t rob, Int_t
 
   if((det >= 0 && det < AliTRDgeometry::Ndet()) &&
      (rob >= 0 && rob < AliTRDfeeParam::GetNrobC1()) &&
-     (mcm >= 0 && mcm < fgkMaxMcm)) {
+     (mcm >= 0 && mcm < AliTRDfeeParam::GetNmcmRob() + 2)) {
     printf("%10s (%2i bits) at 0x%04x is 0x%08x and resets to: 0x%08x (currently individual mode)\n",
           GetRegName((TrapReg_t) reg),
           GetRegNBits((TrapReg_t) reg),
@@ -816,6 +816,29 @@ void AliTRDtrapConfig::PrintDatx(ostream &os, UInt_t addr, UInt_t data, Int_t ro
 }
 
 
+void AliTRDtrapConfig::PrintVerify(ostream &os, Int_t det, Int_t rob, Int_t mcm) const
+{
+  // print verification file in datx format
+
+  for (Int_t iReg = 0; iReg < kLastReg; ++iReg) {
+    os << std::setw(5) << 9
+       << std::setw(8) << GetRegAddress((TrapReg_t) iReg)
+       << std::setw(12) << GetTrapReg((TrapReg_t) iReg, det, rob, mcm)
+       << std::setw(8) << AliTRDfeeParam::AliToExtAli(rob, mcm)
+       << std::endl;
+  }
+
+  for (Int_t iWord = 0; iWord < fgkDmemWords; ++iWord) {
+    if (GetDmemUnsigned(fgkDmemStartAddress + iWord, det, rob, mcm) == 0)
+      continue;
+    os << std::setw(5) << 9
+       << std::setw(8) << fgkDmemStartAddress + iWord
+       << std::setw(12) << GetDmemUnsigned(fgkDmemStartAddress + iWord, det, rob, mcm)
+       << std::setw(8) << AliTRDfeeParam::AliToExtAli(rob, mcm)
+       << std::endl;
+  }
+}
+
 AliTRDtrapConfig::AliTRDtrapValue::AliTRDtrapValue() :
   TObject(),
   fAllocMode(kAllocGlobal),
@@ -827,6 +850,11 @@ AliTRDtrapConfig::AliTRDtrapValue::AliTRDtrapValue() :
   fValid[0] = kTRUE;
 }
 
+AliTRDtrapConfig::AliTRDtrapValue::~AliTRDtrapValue()
+{
+  delete [] fData;
+  delete [] fValid;
+}
 
 Bool_t AliTRDtrapConfig::AliTRDtrapValue::Allocate(Alloc_t alloc)
 {