TRD pretrigger simulation based on digits of T0, V0 and TOF, simulation control is...
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Apr 2010 14:47:13 +0000 (14:47 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Apr 2010 14:47:13 +0000 (14:47 +0000)
16 files changed:
TRD/AliTRDTriggerL0.cxx
TRD/AliTRDptrgCBAC.cxx [new file with mode: 0644]
TRD/AliTRDptrgCBAC.h [new file with mode: 0644]
TRD/AliTRDptrgCBB.cxx [new file with mode: 0644]
TRD/AliTRDptrgCBB.h [new file with mode: 0644]
TRD/AliTRDptrgFEB.cxx [new file with mode: 0644]
TRD/AliTRDptrgFEB.h [new file with mode: 0644]
TRD/AliTRDptrgLUT.cxx [new file with mode: 0644]
TRD/AliTRDptrgLUT.h [new file with mode: 0644]
TRD/AliTRDptrgParam.cxx [new file with mode: 0644]
TRD/AliTRDptrgParam.h [new file with mode: 0644]
TRD/AliTRDptrgParamConfigurationFile.txt [new file with mode: 0644]
TRD/AliTRDptrgTLMU.cxx [new file with mode: 0644]
TRD/AliTRDptrgTLMU.h [new file with mode: 0644]
TRD/TRDbaseLinkDef.h
TRD/libTRDbase.pkg

index 21587ee..88f7f0c 100644 (file)
@@ -29,6 +29,9 @@
 #include "AliRunLoader.h"
 #include "AliLoader.h"
 
+#include "AliTRDptrgParam.h"
+#include "AliTRDptrgCBB.h"
+
 #include "AliTRDTriggerL0.h"
 
 AliTRDTriggerL0::AliTRDTriggerL0()
@@ -46,12 +49,14 @@ void AliTRDTriggerL0::CreateInputs()
   if (fInputs.GetEntriesFast() > 0)
     return;
 
-  fInputs.AddLast(new AliTriggerInput("0HMB", "TRD", 1)); // whatever should be there
+  fInputs.AddLast(new AliTriggerInput("0HWU", "TRD", 1)); // TRD wake up
+  fInputs.AddLast(new AliTriggerInput("0HSG", "TRD", 1)); // single gap
+  fInputs.AddLast(new AliTriggerInput("0HDG", "TRD", 1)); // double gap
 }
 
 void AliTRDTriggerL0::Trigger()
 {
-  // just an example:
+
   AliRunLoader *runLoader = AliRunLoader::Instance();
   if (!runLoader)
     return;
@@ -59,6 +64,33 @@ void AliTRDTriggerL0::Trigger()
   if (!trdLoader)
     return;
 
-  // here comes the actual pretrigger simulation
+  AliTRDptrgParam* param = AliTRDptrgParam::Instance();
+
+  AliTRDptrgCBB* ptrgCBB = new AliTRDptrgCBB(runLoader, param, kDigits);
+
+  Int_t* simulationResult;
+  simulationResult = ptrgCBB->Simulate();
+  for (Int_t iResult = 1; iResult <= simulationResult[0]; iResult++) {
+    AliDebug(5, Form("Result[%d]=0x%x\n",iResult,simulationResult[iResult]));
+  }
+  if (simulationResult[0] > 0) { 
+    AliInfo("Fired single gap trigger");
+    SetInput("0HSG");
+  }
+
+  if (simulationResult[1] > 0) {
+    AliInfo("Fired  double gap trigger");
+    SetInput("0HDG");
+  }
+  if (simulationResult[2] > 0) {
+    AliInfo("Fired TRD wake up call trigger");
+    SetInput("0HWU");
+  }
+
+  delete ptrgCBB;
+  if (simulationResult != 0x0)
+    delete[] simulationResult;
+  simulationResult = 0x0;
 
+  AliDebug(5, Form("memory state: %d", param->CheckVariables()));
 }
diff --git a/TRD/AliTRDptrgCBAC.cxx b/TRD/AliTRDptrgCBAC.cxx
new file mode 100644 (file)
index 0000000..c5f8862
--- /dev/null
@@ -0,0 +1,205 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Pre-Trigger Control-Box A or C for simulation                         //
+//                                                                        //
+//  Authors: F. Reidt (Felix.Reidt@cern.ch)                               //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+
+#include "AliRun.h"
+#include "AliRunLoader.h"
+
+#include "AliLog.h"
+
+#include "AliTRDptrgParam.h"
+#include "AliTRDptrgFEB.h"
+#include "AliTRDptrgLUT.h"
+
+#include "AliTRDptrgCBAC.h"
+
+ClassImp(AliTRDptrgCBAC)
+
+//______________________________________________________________________________
+AliTRDptrgCBAC::AliTRDptrgCBAC(AliRunLoader *rl) 
+  : TObject(),
+  fRunLoader(rl),
+  fLUTArray(),
+  fFEBArray(),
+  fPosition(kUnknown),
+  fOperatingMode(kDigits),
+  fParam(0x0)
+{
+  // ctor
+  AliError("default ctor - usage not recommended");
+}
+
+//______________________________________________________________________________
+AliTRDptrgCBAC::AliTRDptrgCBAC(AliRunLoader *rl, 
+                               AliTRDptrgFEBPosition_t position,
+                               AliTRDptrgOperatingMode_t operatingMode,
+                               AliTRDptrgParam *param) 
+  : TObject(),
+  fRunLoader(rl),
+  fLUTArray(),
+  fFEBArray(),
+  fPosition(position),
+  fOperatingMode(operatingMode),
+  fParam(param)
+{
+  // ctor  
+  this->LoadParams(); // load parameters
+  // T0
+  AliTRDptrgFEB *FEB = new AliTRDptrgFEB(this->fRunLoader, kTZERO, 
+                                         this->fOperatingMode, this->fPosition,
+                                         0, this->fParam);
+  this->fFEBArray.AddLast(FEB);
+
+  // V0-1
+  FEB = new AliTRDptrgFEB(this->fRunLoader, kVZERO, this->fOperatingMode, 
+                          this->fPosition, 1, this->fParam);
+  this->fFEBArray.AddLast(FEB);
+
+  // V0-2
+  FEB = new AliTRDptrgFEB(this->fRunLoader, kVZERO, this->fOperatingMode, 
+                          this->fPosition, 2, this->fParam);
+  this->fFEBArray.AddLast(FEB);
+
+  // V0-3
+  FEB = new AliTRDptrgFEB(this->fRunLoader, kVZERO, this->fOperatingMode, 
+                          this->fPosition, 3, this->fParam);
+  this->fFEBArray.AddLast(FEB);
+
+  // V0-4
+  FEB = new AliTRDptrgFEB(this->fRunLoader, kVZERO, this->fOperatingMode, 
+                          this->fPosition, 4, this->fParam);
+  this->fFEBArray.AddLast(FEB);
+
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgCBAC::LoadParams() 
+{
+  // load configuration parameters
+
+  if (this->fParam != 0x0) {
+    // read AliTRDptrgParam
+
+    // get LUTs
+    AliTRDptrgLUT* LUT = new AliTRDptrgLUT();
+    // 0
+    LUT = new AliTRDptrgLUT();
+    LUT->InitTable(10, 10, this->fParam->GetCBLUT(this->fPosition, 0), kFALSE); 
+    // do not copy table data 
+    this->fLUTArray.AddLast(LUT);
+    // 1
+    LUT = new AliTRDptrgLUT();
+    LUT->InitTable(10, 10, this->fParam->GetCBLUT(this->fPosition, 1), kFALSE); 
+    // do not copy table data // TODO 0x0
+    this->fLUTArray.AddLast(LUT);
+  }
+  else {
+    // load default parameters 
+    AliTRDptrgLUT* LUT = new AliTRDptrgLUT();
+    this->fLUTArray.AddLast(LUT);
+    LUT = new AliTRDptrgLUT();
+    this->fLUTArray.AddLast(LUT);
+               // the following lines are only needed for test reasons
+    LUT = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+    Int_t* initData = new Int_t[1024]; // 2^10
+    for (Int_t i = 0; i < 1024; i++ ) {
+      initData[i] = i;
+    }
+    LUT->InitTable(10, 10, initData, kTRUE); // copy initData
+    LUT = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(1));
+    for (Int_t i = 1023; i >= 0; i--) {
+      initData[31 - i] = i;  // inverse ramp
+    }
+    LUT->InitTable(10, 10, initData, kTRUE); // copy initData
+  }  
+  return false;
+}
+
+//______________________________________________________________________________
+AliTRDptrgCBAC::~AliTRDptrgCBAC() 
+{
+  // destructor
+
+  this->fLUTArray.Delete();
+  this->fFEBArray.Delete();
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgCBAC::Simulate()
+{ // TODO check new/delete
+  // Simulate the CBAC behavior of event
+  Int_t nFEBs = this->fFEBArray.GetEntries();
+  Int_t nLUTs = this->fLUTArray.GetEntries();
+
+  Int_t inputVector = 0x0;
+
+  Int_t** partResults = 0x0;  
+  partResults = new Int_t* [nFEBs];
+
+
+  for (Int_t iFEB = 0; iFEB < nFEBs; iFEB++) {
+    partResults[iFEB] = 
+      dynamic_cast<AliTRDptrgFEB*>(this->fFEBArray.At(iFEB))->Simulate();
+  }
+  
+  // combine partResults and create inputVector  
+  Int_t iBit = 0;
+  Int_t mask = 0x1;
+  for (Int_t iFEB = 0; iFEB < nFEBs ; iFEB++) {
+    for (Int_t j = 1; j <= partResults[iFEB][0]; j++) {
+      if ((iBit++ >
+           dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray[0])->GetInputWidth()) 
+          || (iBit++ >
+           dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray[0])->GetInputWidth())) {
+        AliError("FEB result width does not match CB-A/C input with!");
+      }
+      if (partResults[iFEB][j] > 0) {
+        inputVector |= mask; // Add bit to the corresponding inputVector
+        mask <<= 1;
+      } 
+    }
+  }
+  
+
+  AliDebug(5, Form("Inputvector: 0x%x", inputVector));
+    
+  // perform look up
+  Int_t* result = new Int_t[nLUTs + 1]; // generate new return array
+  result[0] = nLUTs; // storage array length in the first array value
+  for (Int_t iLUT = 0; iLUT < nLUTs; iLUT++) { 
+    // process the return value for each LUT and store the result in the array
+    result[iLUT + 1] = 
+      dynamic_cast<AliTRDptrgLUT*>(
+        this->fLUTArray[iLUT])->LookUp(inputVector);
+    AliDebug(4, Form("CBAC result[%d] = 0x%x",(iLUT + 1),result[iLUT + 1])); 
+  }
+
+  return result;
+}
+
+
+
diff --git a/TRD/AliTRDptrgCBAC.h b/TRD/AliTRDptrgCBAC.h
new file mode 100644 (file)
index 0000000..c31ec63
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef AlITRDPTRGCBAC_H
+#define AliTRDPTRGCBAC_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// --------------------------------------------------------
+// 
+// Pre-Trigger Control-Box A or C class
+//
+// --------------------------------------------------------
+
+#include "TObject.h"
+#include "AliTRDptrgParam.h"
+
+class AliRunLoader;
+
+
+class AliTRDptrgCBAC : public TObject {
+ public:
+  AliTRDptrgCBAC(AliRunLoader *rl = 0x0);
+  AliTRDptrgCBAC(AliRunLoader *rl, AliTRDptrgFEBPosition_t position,
+                 AliTRDptrgOperatingMode_t operatingMode, 
+                 AliTRDptrgParam *param);
+  ~AliTRDptrgCBAC();
+  
+  Int_t* Simulate();
+
+ protected:
+  Bool_t LoadParams(); // load AliTRDprtgParam content
+
+  AliRunLoader *fRunLoader;  //!
+  TObjArray fLUTArray; // Array with Look-Up-Tables
+  TObjArray fFEBArray; // front end boxes connected to T0 (fFEB[0]) and VO (4x)
+  AliTRDptrgFEBPosition_t fPosition; // Control box position (A or C side)
+  AliTRDptrgOperatingMode_t fOperatingMode; // working on Digits or Hits?
+  AliTRDptrgParam* fParam; // parameters
+ private:
+  AliTRDptrgCBAC& operator=(const AliTRDptrgCBAC &rhs); // not implemented
+  AliTRDptrgCBAC(const AliTRDptrgCBAC &rhs); // not implemented                 
+
+  ClassDef(AliTRDptrgCBAC, 1);
+};
+
+#endif
diff --git a/TRD/AliTRDptrgCBB.cxx b/TRD/AliTRDptrgCBB.cxx
new file mode 100644 (file)
index 0000000..c91c4f8
--- /dev/null
@@ -0,0 +1,239 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Pre-Trigger Control-Box bottom class                                  //
+//                                                                        //
+//  Authors: F. Reidt (Felix.Reidt@cern.ch)                               //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+
+#include "TROOT.h"
+
+#include "AliRun.h"
+#include "AliRunLoader.h"
+
+#include "AliTRDptrgLUT.h"
+#include "AliTRDptrgParam.h"
+#include "AliTRDptrgCBAC.h"
+#include "AliTRDptrgTLMU.h"
+#include "AliTRDptrgCBB.h"
+ClassImp(AliTRDptrgCBB)
+
+AliTRDptrgCBB::AliTRDptrgCBB(AliRunLoader *rl) 
+  : TObject(),
+  fRunLoader(rl),
+  fParam(0),
+  fOperatingMode(kDigits),
+  fCBA(0),
+  fCBC(0),
+  fTLMU(0),
+  fLUTArray(0),
+  fPTmasks(0x0)
+{
+  // default ctor
+  AliError("default ctor - usage not recommended\n");
+}
+
+
+AliTRDptrgCBB::AliTRDptrgCBB(AliRunLoader *rl, AliTRDptrgParam* param, 
+                             AliTRDptrgOperatingMode_t operatingMode)
+  : TObject(),
+  fRunLoader(rl),
+  fParam(param),
+  fOperatingMode(operatingMode),
+  fCBA(0),
+  fCBC(0),
+  fTLMU(0),
+  fLUTArray(0),
+  fPTmasks(0x0) 
+{
+  // recommended ctor
+  this->fCBA = new AliTRDptrgCBAC(rl, kA, operatingMode, param);
+  this->fCBC = new AliTRDptrgCBAC(rl, kC, operatingMode, param);
+  this->fTLMU = new AliTRDptrgTLMU(rl, param, operatingMode);
+
+  this->LoadParams();
+}
+
+AliTRDptrgCBB::~AliTRDptrgCBB() 
+{
+  // destructor
+
+  if (this->fCBA != 0x0) {
+    delete this->fCBA;
+    this->fCBA = 0x0;
+  }
+
+  if (this->fCBC != 0x0) {
+    delete this->fCBC;
+    this->fCBC = 0x0;
+  }
+
+  if (this->fTLMU != 0x0) {
+    delete this->fTLMU;
+    this->fTLMU = 0x0;
+  }
+
+  this->fLUTArray.Delete();
+}
+
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgCBB::LoadParams() 
+{
+  // load configuration parameters
+
+  if (this->fParam != 0x0) {
+    // read AliTRDptrgParam
+    
+    // get LUTs
+    // 0
+    AliTRDptrgLUT* LUT = new AliTRDptrgLUT();
+    LUT->InitTable(12, 12, this->fParam->GetCBLUT(0, 0), kFALSE);
+    // get CB-B_0 and do not copy lut content
+    this->fLUTArray.AddLast(LUT);
+    // 1
+    LUT = new AliTRDptrgLUT();
+    LUT->InitTable(12, 12, this->fParam->GetCBLUT(0, 1), kFALSE);
+    // get CB-B_0 and do not copy lut content
+    this->fLUTArray.AddLast(LUT);
+
+    // masks
+    this->fPTmasks = this->fParam->GetPTmasks();
+  }
+  else {
+    // load default parameters 
+    // initialize LUTsoutputWidth=<value optimized out>
+    AliTRDptrgLUT* LUT = new AliTRDptrgLUT();
+    this->fLUTArray.AddLast(LUT);
+    LUT = new AliTRDptrgLUT(); // this->fRunLoader
+    this->fLUTArray.AddLast(LUT);
+    // the following lines are only needed for test reasons
+    LUT = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+    Int_t* initData = new Int_t[4096]; // 2^12
+    for (Int_t i = 0; i < 4096; i++ ) {
+      initData[i] = i;
+    }
+    LUT->InitTable(12, 12, initData, kTRUE); // make a copy
+    LUT = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(1));
+    for (Int_t i = 4096; i >= 0; i--) {
+      initData[4096 - i] = i;  // inverse ramp
+    }
+    LUT->InitTable(12, 12, initData, kTRUE); // make a copy 
+  
+    AliTRDptrgParam::AliTRDptrgPTmasks* masks = 
+      new AliTRDptrgParam::AliTRDptrgPTmasks();  
+    masks->fLUTs[0] = kTRUE;
+    masks->fLUTs[1] = kTRUE;
+    this->fPTmasks = masks;
+  }  
+  return false;
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgCBB::Simulate()
+{ 
+  // Simulate the CBB behavior of event
+  //
+  // returns array containing:
+  // 0: array element count
+  // 1..count-2: LUT results
+  // count-1: pretrigger decision
+
+  Int_t nLUTs = this->fLUTArray.GetEntries();
+
+  Int_t inputVector = 0x0;
+  // initialize partResults
+  Int_t** partResults = 0x0;  
+  partResults = new Int_t* [3]; // CB-A, CB-C, TLMU
+  // get partResults
+  partResults[0] = this->fCBA->Simulate(); // CB-A
+  partResults[1] = this->fCBC->Simulate(); // CB-C
+  partResults[2] = this->fTLMU->Simulate(); // TLMU
+  
+  
+  // combine partResults and create inputVectors  
+  // TODO make assignment configurable
+  Int_t mask = 0x1;
+  for (Int_t i = 0; i < 3 ; i++) {
+    for (Int_t j = 1; j <= partResults[i][0]; j++) {
+      if (partResults[i][j] > 0) {
+        inputVector |= mask; // Add bit to the  inputVector
+      }
+      mask <<= 1;
+    }
+  }
+  
+  AliDebug(5, Form("Inputvectors: 0x%x", inputVector));
+    
+  // perform look up
+  Int_t* result = new Int_t[nLUTs + 2]; // generate new return array
+  result[0] = nLUTs + 1; // storage array length in the first array value
+  for (Int_t iLUT = 0; iLUT < nLUTs; iLUT++) { 
+    // process the return value for each LUT and store the result in the array
+    result[iLUT + 1] = 
+      dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray[iLUT])->LookUp(inputVector);
+    AliDebug(4, Form("CBB result[%d] = 0x%x\n",(iLUT + 1),result[iLUT + 1])); 
+  }
+  
+  // evaluate PT decision
+  // stored in result[nLUTs + 1]
+  result[nLUTs + 1] = 0;
+
+  for (Int_t i = 0; i < 2; i++) {
+    // CB-A
+    if (this->fPTmasks->fCBA[i] && partResults[0][i + 1]) {
+      result[nLUTs + 1]++;
+    }
+    // CB-C
+    if (this->fPTmasks->fCBC[i] && partResults[1][i + 1]) {
+      result[nLUTs + 1]++;
+    }
+    // CB-B (own LUTs)
+    if (this->fPTmasks->fLUTs[i] && result[i + 1]) {
+      result[nLUTs + 1]++;
+    }       
+  }
+  // TLMU
+  for (Int_t i = 0; i < 8; i++) {
+    if (this->fPTmasks->fTLMU[i] && partResults[2][i + 1]) {
+      result[nLUTs + 1]++;
+    }
+  }
+  AliDebug(4, Form("CBB TRD Wake up result = %d", result[nLUTs + 1]));
+  return result;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgCBB::GetPT() {
+  // evaluates the pre trigger decision
+
+  Int_t* LUTresults = this->Simulate();
+  if (LUTresults[(LUTresults[0] - 1)]) {
+    delete[] LUTresults;
+    return kTRUE;
+  }
+  else {
+    delete[] LUTresults;
+    return kFALSE;
+  }
+}
diff --git a/TRD/AliTRDptrgCBB.h b/TRD/AliTRDptrgCBB.h
new file mode 100644 (file)
index 0000000..c2c212e
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef AliTRDPTRGCBB_H
+#define AliTRDPTRGCBB_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// --------------------------------------------------------
+// 
+// PTRG simulation
+//
+// --------------------------------------------------------
+#include "TObject.h"
+#include "AliTRDptrgParam.h"
+
+class AliRunLoader;
+
+class AliTRDptrgCBAC;
+class AliTRDptrgTLMU;
+
+class AliTRDptrgCBB : public TObject {
+ public:
+  AliTRDptrgCBB(AliRunLoader *rl = 0x0);
+  AliTRDptrgCBB(AliRunLoader *rl, AliTRDptrgParam* param, 
+                AliTRDptrgOperatingMode_t operatingMode);
+  ~AliTRDptrgCBB();
+  
+  Int_t* Simulate(); // Simulates the ptrg behavior of event
+  Bool_t GetPT(); // Evaluates ptrg decision
+ protected:
+  Bool_t LoadParams(); // loads the parameters stored
+
+  AliRunLoader *fRunLoader;  //!
+  AliTRDptrgParam *fParam; // singleton obj containing configuration parameters
+  AliTRDptrgOperatingMode_t fOperatingMode; // working on Digits or Hits?
+
+  AliTRDptrgCBAC *fCBA; // control box at a side of the solenoid
+  AliTRDptrgCBAC *fCBC; // control box at c side of the solenoid
+  AliTRDptrgTLMU *fTLMU; // TLMU
+
+  TObjArray fLUTArray; // Array with Look-Up-Tables (usually two, called X,Y)
+
+  const AliTRDptrgParam::AliTRDptrgPTmasks *fPTmasks; // PT output masks 
+ private:
+  AliTRDptrgCBB& operator=(const AliTRDptrgCBB &rhs); // not implemented
+  AliTRDptrgCBB(const AliTRDptrgCBB &rhs); // not implemented
+
+  ClassDef(AliTRDptrgCBB, 1);
+};
+
+#endif
diff --git a/TRD/AliTRDptrgFEB.cxx b/TRD/AliTRDptrgFEB.cxx
new file mode 100644 (file)
index 0000000..a091d5a
--- /dev/null
@@ -0,0 +1,392 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        
+//  Pre-Trigger simulation                                                
+//                                                                        
+//  Authors: F. Reidt (Felix.Reidt@cern.ch)                               
+//               
+//  This class is used to simulate the front end box behavior of the 
+//  pretrigger system. Digits of T0 and V0 are used as input. A threshold
+//  discrimination, masking and first processing with look up tables  is 
+//  done during the simulation process
+//                                                                  
+////////////////////////////////////////////////////////////////////////////
+
+#include <TClonesArray.h> 
+
+#include "AliRunLoader.h"
+#include "AliLog.h"
+
+#include "../VZERO/AliVZEROdigit.h" 
+#include "../T0/AliT0digit.h"
+
+#include "AliTRDptrgParam.h"
+#include "AliTRDptrgLUT.h"
+#include "AliTRDptrgFEB.h"
+
+ClassImp(AliTRDptrgFEB)
+
+//______________________________________________________________________________
+AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl) 
+  : TObject(),
+  fRunLoader(rl),
+  fParam(0),
+  fLUTArray(0),
+  fType(kUndefined),
+  fOperatingMode(kDigits),
+  fInputChannelCount(0),
+  fPosition(kUnknown),  
+  fID(0),
+  fThreshold(0)
+{
+  // default constructor
+  AliWarning("default ctor - not recommended");
+}
+
+//______________________________________________________________________________
+AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl, AliTRDptrgFEBType_t febType, 
+                             AliTRDptrgOperatingMode_t operatingMode,
+                             AliTRDptrgFEBPosition_t position, Int_t id, 
+                             AliTRDptrgParam *param)
+  : TObject(),
+  fRunLoader(rl),
+  fParam(param),
+  fLUTArray(0),
+  fType(febType),
+  fOperatingMode(operatingMode),
+  fInputChannelCount(0),
+  fPosition(position),
+  fID(id),
+  fThreshold(0x0) 
+{
+  // prefered constructor
+  
+  this->LoadParams(); // load configuration parameters
+
+}
+
+//______________________________________________________________________________
+AliTRDptrgFEB::~AliTRDptrgFEB() 
+{
+  // destructor
+  if (this->fParam == 0x0) {  
+    if (this->fThreshold != 0x0) {
+      delete[] this->fThreshold;
+      this->fThreshold = 0x0;
+   }
+  }
+  // delete LUTArray
+  this->fLUTArray.Delete();
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgFEB::LoadDigits()
+{
+  // loads T0 or V0 digits and discriminates them automatically
+  if (this->fType == kVZERO) {
+    // load V0's digits --------------------------------------------------------
+    
+    // get V0 run loader
+    AliLoader* loader = fRunLoader->GetLoader( "VZEROLoader" );
+
+    if (!loader) {
+      AliError("Can not get VZERO loader");
+      return -1;
+    }
+    loader->LoadDigits("READ");
+    TTree* vzeroDigitsTree = loader->TreeD();
+
+    if (!vzeroDigitsTree) {
+      AliError("Can not get the VZERO digit tree");
+      return -1;
+    }
+    
+               
+    TClonesArray* vzeroDigits = NULL;
+    TBranch* digitBranch = vzeroDigitsTree->GetBranch("VZERODigit");
+    digitBranch->SetAddress(&vzeroDigits);
+    vzeroDigitsTree->GetEvent(0);      
+    //digitBranch->GetEvent(event);
+
+    AliDebug(5, Form("Number of Events: %d",
+                this->fRunLoader->GetNumberOfEvents()));
+          
+    Int_t nDigits = vzeroDigits->GetEntriesFast(); // get digit count
+               
+    AliDebug(5, Form("Found a whole of %d digits", nDigits));    
+               
+    Int_t inputVector = 0x0; // Vector which is feed into the LUT
+               
+    for (Int_t iDigit=0; iDigit<nDigits; iDigit++) {
+      // loop over all digits
+      AliDebug(5, "Looping over digit");
+      AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(iDigit);
+                             
+      Int_t pmNumber   = digit->PMNumber();
+      // TODO check the assignment of the photomultipliers to the FEBs
+      Int_t board   = pmNumber / 8;\r
+      Int_t channel = pmNumber % 8;
+      Int_t position = pmNumber / 32 + 1;
+
+      // check whether the digits belongs to the current FEB, otherwise omit it
+      if ((position == this->fPosition) && (board == this->fID)) {
+        AliDebug(5, "Found an digit corresponding to the current FEB");
+                               //if in timing window? // TODO
+        Float_t value = digit->ADC();
+        AliDebug(5, Form("ADC value: %f\n", value));
+        Int_t channelBitMask = 0x01; 
+        // channel0 => 0x01; channel1=> 0x02;  2^(channel number)
+        channelBitMask <<= channel;
+        if (value >= this->fThreshold[channel]) {
+          inputVector |= channelBitMask;
+          AliDebug(5,
+            Form("Threshold exceeded in channel %d, new inputVector 0x%x", 
+                 channel, inputVector));
+        }
+      }
+    }
+
+    AliDebug(5, Form("inputVector: 0x%x", inputVector));
+    
+    return inputVector;
+  }
+  else if (this->fType == kTZERO) {
+    // load T0's digits --------------------------------------------------------
+    AliLoader * fT0Loader = this->fRunLoader->GetLoader("T0Loader");
+    //   AliT0digit *fDigits; 
+    fT0Loader->LoadDigits("READ");
+    // Creating T0 data container
+
+    TTree* treeD = fT0Loader->TreeD();
+    if (!treeD) {
+      AliError("no digits tree");
+      return -1;
+    }
+    AliT0digit* digits = new AliT0digit();
+    TBranch *brDigits = treeD->GetBranch("T0");
+
+    if (brDigits) {
+      brDigits->SetAddress(&digits);
+    }
+    else {
+      AliError("Branch T0 DIGIT not found");
+      return -1;
+    }     
+    brDigits->GetEntry(0);             
+
+    TArrayI qtc0(24); // Array must have 24 entries!
+    TArrayI qtc1(24); // Array must have 24 entries!
+    
+    digits->GetQT0(qtc0); // baseline (reference level)
+    digits->GetQT1(qtc1); // measurement value
+
+    Int_t inputVector = 0x0; // vector to be fed into the look up table
+    
+    // PMT Positions
+    // C: 0  to 11
+    // A: 12 to 23
+    // positions according to AliT0Digitizer.cxx Revision 37491
+    Int_t nStart = 0;
+    if (this->fPosition == kC) { // C
+      nStart = 0;
+    }
+    else if (this->fPosition == kA) { // A
+      nStart = 12;
+    }
+
+    Int_t channelBitMask = 0x01;
+    for (Int_t i = 0 + nStart; i < nStart + 12; i++) {
+      //Int_t channelBitMask = 0x01;
+      AliDebug(5, Form("channel: %d", i));
+
+      Int_t value = qtc1[i] - qtc0[i]; // calculate correct measurement value
+
+      if (value > (Int_t)this->fThreshold[i - nStart]) {
+       // channelBitMask <<= 1; //(i - nStart);  // 2^(i - nStart) ERROR? TODO
+        inputVector |= channelBitMask;    // Add bit
+          
+        AliDebug(5, Form("Threshold exceeded in channel %d,", i));
+        AliDebug(5, Form("new inputVector 0x%x", inputVector));       
+        AliDebug(5, Form("channelBitMask 0x%x", channelBitMask));
+      }
+      channelBitMask <<= 1; // go on to the next channel
+    }
+    
+    // TODO check whether it is correct to delete the digit
+    delete digits;
+    return inputVector;
+  }
+  return -1;
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgFEB::LoadAndProcessHits()
+{
+  // loads TO or VO hits and converts them to digits optimized for ptrg  
+  // afterwards the digits will be discriminated
+  AliError("LoadAndProcessHits() - not yet implemented!\n");
+  if (this->fType == kVZERO) {         
+    return 0;
+  }
+  else if (this->fType == kTZERO) {
+    return 0;
+  }
+  return -1;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgFEB::LoadParams()
+{
+  // Load Parameters
+
+  if (this->fParam == 0x0) {
+    AliWarning("No paramater object specified - start loading defaults\n");
+    if (this->fType == kVZERO) {               
+      // initialize threshold
+      this->fThreshold = new UInt_t[8]; 
+      for (Int_t i = 0; i < 8; i++) {
+        this->fThreshold[i] = 10; // TODO choose a correct value
+      }
+      // initialize LUTsoutputWidth=<value optimized out>
+      AliTRDptrgLUT* lut = new AliTRDptrgLUT();
+      this->fLUTArray.AddLast(lut);
+      lut = new AliTRDptrgLUT(); 
+      this->fLUTArray.AddLast(lut);
+                       // the following lines are only needed for test reasons
+      lut = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+      Int_t* initData = new Int_t[256]; // 2^8
+      for (Int_t i = 0; i < 256; i++ ) {
+        initData[i] = i;
+      }
+      lut->InitTable(8, 8, initData, kTRUE); // make copy of initData
+      lut = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(1));
+      for (Int_t i = 255; i >= 0; i--) {
+        initData[255 - i] = i;  // inverse ramp
+      }
+      lut->InitTable(8, 8, initData, kTRUE);
+    }
+    else {
+      // initialize threshold
+      this->fThreshold = new UInt_t[12];
+      for (Int_t i = 0; i < 12; i++) {
+        this->fThreshold[i] = 10; // TODO choose a correct value
+      }
+      
+      // initialize LUTsoutputWidth=<value optimized out>
+      AliTRDptrgLUT* lut = new AliTRDptrgLUT();
+      this->fLUTArray.AddLast(lut);
+      lut = new AliTRDptrgLUT(); // this->fRunLoader
+      this->fLUTArray.AddLast(lut);
+      // the following lines are only needed for test reasons
+      lut = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+      Int_t* initData = new Int_t[4096]; // 2^12
+      for (Int_t i = 0; i < 4096; i++ ) {
+        initData[i] = i;
+      }
+      lut->InitTable(12, 12, initData, kTRUE); // make a copy of the table
+      lut = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(1));
+      for (Int_t i = 4095; i >= 0; i--) {
+        initData[4096 - i] = i;  // inverse ramp
+      }
+      lut->InitTable(12, 12, initData, kTRUE); // make a copy of the table
+      delete[] initData;    
+    }
+    return false;
+  }
+  else {
+    // load parameters from object
+    if (this->fType == kVZERO) {               
+      // threshold
+      this->fThreshold = 
+        this->fParam->GetFEBV0Thresholds(this->fPosition, (this->fID - 1));
+
+      // look up tables
+      // 1
+      AliTRDptrgLUT* LUT = new AliTRDptrgLUT();
+      LUT->InitTable(8, 8, this->fParam->GetFEBV0LUT(this->fPosition, 
+                                                     (this->fID - 1),
+                                                     0), kFALSE);
+      // do not make a copy of the table due to performance reasons
+      this->fLUTArray.AddLast(LUT);
+      // 2
+      LUT = new AliTRDptrgLUT(); 
+      LUT->InitTable(8, 8, this->fParam->GetFEBV0LUT(this->fPosition, 
+                                                     (this->fID - 1),
+                                                     1), kFALSE);
+      // do not make a copy of the table due to performance reasons
+      this->fLUTArray.AddLast(LUT);
+    }
+    else {             
+      // threshold
+      this->fThreshold =
+        this->fParam->GetFEBT0Thresholds(this->fPosition);
+
+      // look up tables
+      // 1
+      AliTRDptrgLUT* LUT = new AliTRDptrgLUT();
+      LUT->InitTable(12, 12, fParam->GetFEBT0LUT(this->fPosition, 0), kFALSE); 
+      // do not make a copy of the table due to performance reasosn
+      this->fLUTArray.AddLast(LUT);
+
+      // 2
+      LUT = new AliTRDptrgLUT(); 
+      LUT->InitTable(12, 12, fParam->GetFEBT0LUT(this->fPosition, 1), kFALSE); 
+      // do not make a copy of the table due to performance reasosn      
+      this->fLUTArray.AddLast(LUT);
+    }
+    return true;
+  }
+  
+  return false;
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgFEB::Simulate()
+{
+  // simulates the FEB behavior and returns a 2 bit ouput 
+  // (least significant bits)
+  
+  Int_t *result = new Int_t;
+  (*result) = -1; 
+  if (this->fOperatingMode == kDigits) {
+    Int_t inputVector = this->LoadDigits();
+    delete result; // delete error return value
+
+    // perform look up
+    Int_t nLUTs = this->fLUTArray.GetEntriesFast();  // get LUT count
+    result = new Int_t[nLUTs + 1]; // generate new return array
+    result[0] = nLUTs; // storage array length in the first array value
+    for (Int_t iLUT = 0; iLUT < nLUTs; iLUT++) { 
+      // process the return value for each LUT and store the result in the array
+      AliDebug(4, Form("FEB: (pos=%d,id=%d,lut=%d,vector=0x%x)", 
+                       this->fPosition, this->fID, iLUT, inputVector));
+
+      result[iLUT + 1] = 
+       dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray[iLUT])->LookUp(inputVector);
+      AliDebug(4, Form("FEB result[%d] = 0x%x",(iLUT + 1),result[iLUT + 1])); 
+    }
+  }
+  else if (this->fOperatingMode == kHits) {
+    return result;
+  }
+  return result;
+}
diff --git a/TRD/AliTRDptrgFEB.h b/TRD/AliTRDptrgFEB.h
new file mode 100644 (file)
index 0000000..3816569
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef ALITRDPTRGFEB_H
+#define ALITRDPTRGFEB_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// --------------------------------------------------------
+// 
+// PTRG simulation
+//
+// --------------------------------------------------------
+
+#include "TObject.h"
+#include "AliTRDptrgParam.h"
+
+class AliRunLoader;
+
+class AliTRDptrgFEB : public TObject {
+ public:
+  AliTRDptrgFEB(AliRunLoader *rl = 0x0);
+  AliTRDptrgFEB(AliRunLoader *rl, AliTRDptrgFEBType_t febType, 
+                AliTRDptrgOperatingMode_t operatingMode, 
+                AliTRDptrgFEBPosition_t position, Int_t id,
+                AliTRDptrgParam *param);
+
+  ~AliTRDptrgFEB();
+  Int_t* Simulate(); // starts a simulation
+protected:
+  Int_t LoadDigits(); // loads Digits (for usage with aquired data)
+  Int_t LoadAndProcessHits(); 
+  // load and process hits (for usage with simulated data)
+  Bool_t LoadParams(); // load AliTRDprtgParam content
+  
+
+  AliRunLoader *fRunLoader;  //!
+  AliTRDptrgParam *fParam; // Configuration parameter object
+  TObjArray fLUTArray; // Array with Look-Up-Tables
+
+  AliTRDptrgFEBType_t fType; // Indicates what input FEB uses (V0 or T0)
+  AliTRDptrgOperatingMode_t fOperatingMode; // working on Digits or Hits?
+  Int_t fInputChannelCount; // Number of input channels 
+  AliTRDptrgFEBPosition_t fPosition; // 0 = unkown, 1 = A, 2 = C
+  Int_t fID; // 0 = T0, 1 = V0-1, 2 = V0-2, 3 = V0-3, 4 = V0-4 (numbering?)
+  
+  UInt_t *fThreshold; // specifies the threshold for incoming analog signals
+ private:
+  AliTRDptrgFEB& operator=(const AliTRDptrgFEB &rhs); // not implemented
+  AliTRDptrgFEB(const AliTRDptrgFEB &rhs); // not implemented
+
+  ClassDef(AliTRDptrgFEB, 1);
+};
+
+#endif
diff --git a/TRD/AliTRDptrgLUT.cxx b/TRD/AliTRDptrgLUT.cxx
new file mode 100644 (file)
index 0000000..7f8f4ad
--- /dev/null
@@ -0,0 +1,113 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                        
+//  Pre-Trigger simulation                                                
+//                                                                        
+//  Authors: F. Reidt (Felix.Reidt@cern.ch)                               
+//                                                                             
+//                                                                        
+//  Limitations: input/output width: 32 bits (UInt_t)                      
+//                                                                        
+//  Annotation: That LUT is usually used to provide a single output bit   
+//              In that case every output value bigger 0 means true       
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <fstream>
+#include <string>
+#include <math.h>
+
+#include "TFile.h"
+#include "TROOT.h"
+
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliLog.h"
+
+#include "AliTRDptrgLUT.h"
+
+ClassImp(AliTRDptrgLUT)
+//_____________________________________________________________________________
+AliTRDptrgLUT::AliTRDptrgLUT() 
+  : TObject(),
+  fLUTData(0),
+  fInputWidth(0),
+  fOutputWidth(0),
+  fTableEntryCount(0),
+  fCopiedTable(kFALSE)
+{
+  // ctor
+}
+
+//_____________________________________________________________________________
+AliTRDptrgLUT::~AliTRDptrgLUT() 
+{
+  // destructor
+  if (this->fCopiedTable) {
+    AliDebug(5, "Deleted LUT data");
+    if (this->fLUTData != 0x0) {
+      delete[] this->fLUTData;
+    }
+    this->fLUTData = 0x0;
+  }
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDptrgLUT::LookUp(UInt_t input)
+{
+  // perform a look up 
+  
+  if (input > (UInt_t)this->fTableEntryCount) {
+    // check whether the input value is out of bounds
+    AliWarning("incorrect LUT input value");
+    return -1;
+  }
+  return this->fLUTData[input]; // do look up and output 
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgLUT::InitTable(Int_t inputWidth, Int_t outputWidth, 
+                               Int_t *tableData, Bool_t copy)
+{
+  // load and initialize the look up table
+  
+  // assign width
+  this->fInputWidth = inputWidth;
+  this->fOutputWidth = outputWidth;
+  
+  // calculated table entry count 
+  this->fTableEntryCount = 0x1;
+  this->fTableEntryCount <<= inputWidth; 
+  AliDebug(5,Form("fTableEntryCount=%d", this->fTableEntryCount));
+  this->fCopiedTable = copy; 
+  if (copy) {
+    this->fLUTData = new Int_t[this->fTableEntryCount]; // allocate data table
+    for (Int_t i=0; i < this->fTableEntryCount; i++) {
+      this->fLUTData[i] = tableData[i];
+    }
+  }
+  else { // do not copy (due to performace reasons)
+    this->fLUTData = tableData;
+  }
+  return 0;
+}
+
diff --git a/TRD/AliTRDptrgLUT.h b/TRD/AliTRDptrgLUT.h
new file mode 100644 (file)
index 0000000..1661086
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef AliTRDPTRGLUT_H
+#define AliTRDPTRGLUT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// --------------------------------------------------------
+// 
+// PTRG look up table definition
+//
+// --------------------------------------------------------
+
+#include "TObject.h"
+
+class AliRunLoader;
+
+class AliTRDptrgLUT : public TObject {
+ public:
+  AliTRDptrgLUT();
+  ~AliTRDptrgLUT();
+  Int_t LookUp(UInt_t input); // execute a look up
+  Int_t InitTable(Int_t inputWidth, Int_t outputWidth, Int_t *tableData, 
+                  Bool_t copy); // load look up table
+  Int_t GetInputWidth() { return fInputWidth; } // getter function
+ protected:
+  Int_t *fLUTData; // lut data storage
+  Int_t fInputWidth; // bit width of the input vector
+  Int_t fOutputWidth; // bit width of the output vector 
+  Int_t fTableEntryCount; // table entry count
+  Bool_t fCopiedTable; // indicates whether the look up table was copied
+ private:
+  AliTRDptrgLUT& operator=(const AliTRDptrgLUT &rhs); // not implemented
+  AliTRDptrgLUT(const AliTRDptrgLUT &rhs); // not implemented
+
+  ClassDef(AliTRDptrgLUT, 1);
+};
+
+#endif
diff --git a/TRD/AliTRDptrgParam.cxx b/TRD/AliTRDptrgParam.cxx
new file mode 100644 (file)
index 0000000..56cd4a0
--- /dev/null
@@ -0,0 +1,1945 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        
+//  Parameters for Pre-Trigger Simulation                                 
+//                                                                        
+//  Author: F. Reidt (Felix.Reidt@cern.ch)                                
+//               
+//  This class controls the parameters used by the pretrigger simulation.
+//  A configuration file ca be loaded by calling LoadConfigurationFromFile()
+//  The generation of look up tables is also done in this class and has to
+//  be done only once after a configuration file was loaded.
+//  If no configuration file was loaded, the standard
+//  configuration in LoadStandardConfiguration() would be used.
+//                                                        
+////////////////////////////////////////////////////////////////////////////
+#include "TArrayI.h"
+#include "TObjString.h"
+#include "TString.h"
+
+#include <fstream>
+
+#include "AliLog.h"
+
+#include "AliTRDptrgParam.h"
+
+ClassImp(AliTRDptrgParam)
+
+AliTRDptrgParam *AliTRDptrgParam::fgInstance = 0;
+
+
+//______________________________________________________________________________
+AliTRDptrgParam::AliTRDptrgParam()
+  : TObject(),
+    fTLMUInputStretch(0),
+    fTLMUcmatrices(0x0),
+    fTLMUmultiplicity(0x0), 
+    fTLMUoutput(0x0),
+    fFEBT0Thresholds(0x0),
+    fFEBT0Multiplicities(0x0),
+    fFEBT0LUTs(0x0),
+    fFEBV0Thresholds(0x0),
+    fFEBV0Multiplicities(0x0),
+    fFEBV0LUTs(0x0),
+    fCBLUTs(0x0),
+    fCBALUTequX(TString()),
+    fCBALUTequY(TString()),
+    fCBCLUTequX(TString()),
+    fCBCLUTequY(TString()),
+    fCBBLUTequX(TString()),
+    fCBBLUTequY(TString()),
+    fPTmasks(AliTRDptrgPTmasks())
+{
+  // ctor
+  
+  // initialize coincidence matrices
+  this->fTLMUcmatrices = new UInt_t*[3];
+  for (UInt_t iMatrix = 0; iMatrix < 3; iMatrix++) {
+    this->fTLMUcmatrices[iMatrix] = new UInt_t[18];
+    for (UInt_t iSlice = 0; iSlice < 18; iSlice++) {
+      this->fTLMUcmatrices[iMatrix][iSlice] = 0;
+    }
+  }
+  
+  // initialize multiplicity slices
+  this->fTLMUmultiplicity = new UInt_t*[9];
+  for (UInt_t iSlice = 0; iSlice < 9; iSlice++) {
+    this->fTLMUmultiplicity[iSlice] = new UInt_t[2];
+    this->fTLMUmultiplicity[iSlice][0] = 577; // disabled
+    this->fTLMUmultiplicity[iSlice][1] = 0;
+  }
+  
+  // initialize output muxer
+  this->fTLMUoutput = new Int_t*[8];
+  for (UInt_t iBit = 0; iBit < 8; iBit++) {
+    this->fTLMUoutput[iBit] = new Int_t[2];
+    this->fTLMUoutput[iBit][0] = -1; // cmatrix disabled
+    this->fTLMUoutput[iBit][1] = -1; // multslice disabled
+  }
+  
+  // initialize T0 FEB thresholds
+  this->fFEBT0Thresholds = new UInt_t*[2];
+  this->fFEBT0Thresholds[0] = new UInt_t[12];
+  this->fFEBT0Thresholds[1] = new UInt_t[12];
+  for (Int_t iChan = 0; iChan < 12; iChan++) {
+    this->fFEBT0Thresholds[0][iChan] = 4294967295U; 
+    this->fFEBT0Thresholds[1][iChan] = 4294967295U;
+    // writing 2^32-1 disables the input because all used adcs have 
+    // less than 32 bits
+  }
+  
+  // initialize T0 Multiplicity
+  this->fFEBT0Multiplicities = new UInt_t**[2];
+  this->fFEBT0Multiplicities[0] = new UInt_t*[2];
+  this->fFEBT0Multiplicities[1] = new UInt_t*[2];
+  this->fFEBT0Multiplicities[0][0] = new UInt_t[2];
+  this->fFEBT0Multiplicities[0][1] = new UInt_t[2];
+  this->fFEBT0Multiplicities[1][0] = new UInt_t[2];
+  this->fFEBT0Multiplicities[1][1] = new UInt_t[2];
+  this->fFEBT0Multiplicities[0][0][0] = 4294967295U;
+  this->fFEBT0Multiplicities[0][0][1] = 4294967295U;
+  this->fFEBT0Multiplicities[0][1][0] = 4294967295U;
+  this->fFEBT0Multiplicities[0][1][1] = 4294967295U;
+  this->fFEBT0Multiplicities[1][0][0] = 4294967295U;
+  this->fFEBT0Multiplicities[1][0][1] = 4294967295U;
+  this->fFEBT0Multiplicities[1][1][0] = 4294967295U;
+  this->fFEBT0Multiplicities[1][1][1] = 4294967295U;
+  // writing 2^32-1 disables the input because all used adcs have 
+  // less than 32 bits
+
+  // initialize T0 LUTs
+  // this->fFEBT0LUTs = 0x0; (done in member initialization list)
+  // further initialization is done in AliTRDptrgParam::GenerateLUTs()
+  
+
+  // initialize V0 FEB Thresholds
+  this->fFEBV0Thresholds = new UInt_t**[2];
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    this->fFEBV0Thresholds[iPosition] = new UInt_t*[4];
+    for (UInt_t iCard = 0; iCard < 4; iCard++) {
+      this->fFEBV0Thresholds[iPosition][iCard] = new UInt_t[8];
+      for (UInt_t iChannel = 0; iChannel < 8; iChannel++) {
+        this->fFEBV0Thresholds[iPosition][iCard][iChannel] = 4294967295U;
+      }
+    }
+  }
+  // initialize V0 Multiplicities
+  this->fFEBV0Multiplicities = new UInt_t***[2];
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    this->fFEBV0Multiplicities[iPosition] = new UInt_t**[4];
+    for (UInt_t iCard = 0; iCard < 4; iCard++) {
+      this->fFEBV0Multiplicities[iPosition][iCard] = new UInt_t*[2];
+      for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+        this->fFEBV0Multiplicities[iPosition][iCard][iLUT] = new UInt_t[2];
+        this->fFEBV0Multiplicities[iPosition][iCard][iLUT][0] = 4294967295U;
+        this->fFEBV0Multiplicities[iPosition][iCard][iLUT][1] = 0x0;      
+      }
+    }
+  }
+  
+  // initialize V0 LUTs
+  //  this->fFEBV0LUTs = 0x0; (done in member initialization list)
+  // further initialization is done in AliTRDptrgParam::GenerateLUTs()
+
+  // initialize CB LUTs
+  // this->fCBLUTs = 0x0; (done in member initialization list)
+  // further initialization is done in AliTRDptrgParam::GenerateLUTs()
+
+  this->LoadStandardConfiguration(); // load standard configuration
+}
+
+//______________________________________________________________________________
+AliTRDptrgParam::~AliTRDptrgParam() 
+{
+  // dtor
+  
+  // delete coincidence matrices
+  if (this->fTLMUcmatrices != 0x0) {
+    for (UInt_t iMatrix = 0; iMatrix < 3; iMatrix++) {
+      if (this->fTLMUcmatrices[iMatrix] != 0x0) {
+        delete[] this->fTLMUcmatrices[iMatrix];
+        this->fTLMUcmatrices[iMatrix] = 0x0;
+      }
+    }
+    delete[] this->fTLMUcmatrices;
+    this->fTLMUcmatrices = 0x0;
+  }
+  
+  // delete multiplicity slices
+  if (this->fTLMUmultiplicity != 0x0) {
+    for (UInt_t iSlice = 0; iSlice < 9; iSlice++) {
+      if (this->fTLMUmultiplicity[iSlice] != 0x0) {
+        delete[] this->fTLMUmultiplicity[iSlice];
+        this->fTLMUmultiplicity[iSlice] = 0x0;
+      }
+    }
+    delete[] this->fTLMUmultiplicity;
+    this->fTLMUmultiplicity = 0x0;
+  }
+
+  // delete output mux
+  if (this->fTLMUoutput != 0x0) {
+    for (UInt_t iBit = 0; iBit < 8; iBit++) {
+      if (this->fTLMUoutput[iBit] != 0x0) {
+        delete[] this->fTLMUoutput[iBit];
+        this->fTLMUoutput[iBit] = 0x0;
+      }
+    }
+    delete[] this->fTLMUoutput;
+    this->fTLMUoutput = 0x0;
+  }
+
+  // delete T0 FEB thresholds
+  if (this->fFEBT0Thresholds != 0x0) {
+    if (this->fFEBT0Thresholds[0] != 0x0) {
+      delete[] this->fFEBT0Thresholds[0];
+      this->fFEBT0Thresholds[0] = 0x0;
+    }
+    if (this->fFEBT0Thresholds[1] != 0x0) {
+      delete[] this->fFEBT0Thresholds[1];
+      this->fFEBT0Thresholds[1] = 0x0;
+    }
+    delete[] this->fFEBT0Thresholds;
+    this->fFEBT0Thresholds = 0x0;
+  }
+  // delete T0 multiplicities
+  if (this->fFEBT0Multiplicities != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBT0Multiplicities[iPosition] != 0x0) {
+        for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+          if (this->fFEBT0Multiplicities[iPosition][iLUT] != 0x0) {
+            delete[] this->fFEBT0Multiplicities[iPosition][iLUT];
+            this->fFEBT0Multiplicities[iPosition][iLUT] = 0x0;
+          }
+       }
+        delete[] this->fFEBT0Multiplicities[iPosition];
+       this->fFEBT0Multiplicities[iPosition] = 0x0;
+      }
+    }
+    delete[] this->fFEBT0Multiplicities;
+    this->fFEBT0Multiplicities = 0x0;
+  }  
+
+  // delete T0 LUTs
+  if (this->fFEBT0LUTs != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBT0LUTs[iPosition] != 0x0) {
+        for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+          if (this->fFEBT0LUTs[iPosition][iLUT] != 0x0) {
+            delete[] this->fFEBT0LUTs[iPosition][iLUT];
+            this->fFEBT0LUTs[iPosition][iLUT] = 0x0;
+          }
+       }
+        delete[] this->fFEBT0LUTs[iPosition];
+       this->fFEBT0LUTs[iPosition] = 0x0;
+      }
+    }
+    delete[] this->fFEBT0LUTs;
+    this->fFEBT0LUTs = 0x0;
+  }  
+
+  // delete V0 FEB thresholds
+  if (this->fFEBV0Thresholds != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBV0Thresholds[iPosition] != 0x0) {
+        for (UInt_t iCard = 0; iCard < 4; iCard++) {
+          if (this->fFEBV0Thresholds[iPosition][iCard] != 0x0) {
+            delete[] this->fFEBV0Thresholds[iPosition][iCard];
+            this->fFEBV0Thresholds[iPosition][iCard] = 0x0;
+         }
+       }
+        delete[] this->fFEBV0Thresholds[iPosition]; 
+        this->fFEBV0Thresholds[iPosition] = 0x0;
+      }
+    }
+    delete[] this->fFEBV0Thresholds;
+    this->fFEBV0Thresholds = 0x0;
+  }
+
+  // delete V0 multiplicities
+  if (this->fFEBV0Multiplicities != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBV0Multiplicities[iPosition] != 0x0) {
+        for (UInt_t iCard = 0; iCard < 4; iCard++) {
+          if (this->fFEBV0Multiplicities[iPosition][iCard] != 0x0) {
+            for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+              if (this->fFEBV0Multiplicities[iPosition][iCard][iLUT] != 0x0) {
+                delete[] this->fFEBV0Multiplicities[iPosition][iCard][iLUT];
+                this->fFEBV0Multiplicities[iPosition][iCard][iLUT] = 0x0;
+             }
+           }
+            delete[] this->fFEBV0Multiplicities[iPosition][iCard];
+            this->fFEBV0Multiplicities[iPosition][iCard] = 0x0;
+         }
+       }
+        delete[] this->fFEBV0Multiplicities[iPosition]; 
+        this->fFEBV0Multiplicities[iPosition] = 0x0;
+      }
+    }
+    delete[] this->fFEBV0Multiplicities;
+    this->fFEBV0Multiplicities = 0x0;
+  } 
+
+  // delete V0 LUTs
+  if (this->fFEBV0LUTs != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBV0LUTs[iPosition] != 0x0) {
+        for (UInt_t iCard = 0; iCard < 4; iCard++) {
+          if (this->fFEBV0LUTs[iPosition][iCard] != 0x0) {
+            for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+              if (this->fFEBV0LUTs[iPosition][iCard][iLUT] != 0x0) {
+                delete[] this->fFEBV0LUTs[iPosition][iCard][iLUT];
+                this->fFEBV0LUTs[iPosition][iCard][iLUT] = 0x0;
+             }
+           }
+            delete[] this->fFEBV0LUTs[iPosition][iCard];
+            this->fFEBV0LUTs[iPosition][iCard] = 0x0;
+         }
+       }
+        delete[] this->fFEBV0LUTs[iPosition]; 
+        this->fFEBV0LUTs[iPosition] = 0x0;
+      }
+    }
+    delete[] this->fFEBV0LUTs;
+    this->fFEBV0LUTs = 0x0;
+  } 
+
+  // delete CB LUTs
+  if (this->fCBLUTs != 0x0) {
+    for (UInt_t iCB = 0; iCB < 3; iCB++) {
+      if (this->fCBLUTs[iCB] != 0x0) {
+        for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+          if (this->fCBLUTs[iCB][iLUT] != 0x0) {
+            delete[] this->fCBLUTs[iCB][iLUT];
+            this->fCBLUTs[iCB][iLUT] = 0x0;
+          }
+       }
+        delete[] this->fCBLUTs[iCB];
+       this->fCBLUTs[iCB] = 0x0;
+      }
+    }
+    delete[] this->fCBLUTs;
+    this->fCBLUTs = 0x0;
+  }  
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgParam::CheckVariables() const
+{
+  // checks whether variables are deleted early enough
+  // check coincidence matrices
+  if (this->fTLMUcmatrices != 0x0) {
+    for (UInt_t iMatrix = 0; iMatrix < 3; iMatrix++) {
+      if (this->fTLMUcmatrices[iMatrix] == 0x0) {
+        return -1;
+      }
+    }
+  }
+  else {
+    return -2;
+  }
+  
+  // check multiplicity slices
+  if (this->fTLMUmultiplicity != 0x0) {
+    for (UInt_t iSlice = 0; iSlice < 9; iSlice++) {
+      if (this->fTLMUmultiplicity[iSlice] == 0x0) {
+        return -3;
+      }
+    }
+  }
+  else {
+    return -4;
+  }
+
+  // check output mux
+  if (this->fTLMUoutput != 0x0) {
+    for (UInt_t iBit = 0; iBit < 8; iBit++) {
+      if (this->fTLMUoutput[iBit] == 0x0) {
+        return -5;
+      }
+    }
+  }
+  else {
+    return -6;
+  }
+
+  // delete T0 FEB thresholds
+  if (this->fFEBT0Thresholds != 0x0) {
+    if (this->fFEBT0Thresholds[0] == 0x0) {
+      return -7;
+    }
+    if (this->fFEBT0Thresholds[1] == 0x0) {
+      return -8;
+    }
+  }
+  else {
+    return -9;
+  }
+
+  // delete T0 multiplicities
+  if (this->fFEBT0Multiplicities != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBT0Multiplicities[iPosition] != 0x0) {
+        for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+          if (this->fFEBT0Multiplicities[iPosition][iLUT] == 0x0) {
+            return -10;
+          }
+       }
+      }
+      else {
+        return -11;
+      }
+    }
+  }
+  else {
+    return -12;
+  }
+  
+
+  // delete T0 LUTs
+  if (this->fFEBT0LUTs != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBT0LUTs[iPosition] != 0x0) {
+        for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+          if (this->fFEBT0LUTs[iPosition][iLUT] == 0x0) {
+            return -13;
+          }
+       }
+      }
+      else {
+        return -14;
+      }
+    }
+  }  
+  else {
+    return -15;
+  }
+
+  // delete V0 FEB thresholds
+  if (this->fFEBV0Thresholds != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBV0Thresholds[iPosition] != 0x0) {
+        for (UInt_t iCard = 0; iCard < 4; iCard++) {
+          if (this->fFEBV0Thresholds[iPosition][iCard] == 0x0) {
+            return -16;
+         }
+       }
+      }
+      else {
+        return -17;
+      }
+    }
+  }
+  else {
+    return -18;
+  }
+
+  // delete V0 multiplicities
+  if (this->fFEBV0Multiplicities != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBV0Multiplicities[iPosition] != 0x0) {
+        for (UInt_t iCard = 0; iCard < 4; iCard++) {
+          if (this->fFEBV0Multiplicities[iPosition][iCard] != 0x0) {
+            for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+              if (this->fFEBV0Multiplicities[iPosition][iCard][iLUT] == 0x0) {
+                return -19;
+             }
+           }
+         }
+          else {
+            return -20;
+         }
+       }
+      }
+      else {
+        return -21;
+      }
+    }
+  } 
+  else {
+    return -22;
+  }
+
+  // delete V0 LUTs
+  if (this->fFEBV0LUTs != 0x0) {
+    for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+      if (this->fFEBV0LUTs[iPosition] != 0x0) {
+        for (UInt_t iCard = 0; iCard < 4; iCard++) {
+          if (this->fFEBV0LUTs[iPosition][iCard] != 0x0) {
+            for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+              if (this->fFEBV0LUTs[iPosition][iCard][iLUT] == 0x0) {
+                return -23;
+             }
+           }
+         }
+          else {
+            return -24;
+         }
+       }
+      }
+      else {
+        return -25;
+      }
+    }
+  } 
+  else {
+    return -26;
+  }
+
+  // delete CB LUTs
+  if (this->fCBLUTs != 0x0) {
+    for (UInt_t iCB = 0; iCB < 3; iCB++) {
+      if (this->fCBLUTs[iCB] != 0x0) {
+        for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+          if (this->fCBLUTs[iCB][iLUT] == 0x0) {
+            return -27;
+          }
+       }
+      }
+      else {
+        return -28;
+      }
+    }
+  }  
+  else {
+    return -29;
+  }
+  return 0;
+}
+
+//______________________________________________________________________________
+AliTRDptrgParam* AliTRDptrgParam::Instance() 
+{
+  // get (or create) the single instance
+
+  if (fgInstance == 0) 
+    fgInstance = new AliTRDptrgParam();
+
+  return fgInstance;
+}
+
+//______________________________________________________________________________
+void AliTRDptrgParam::Terminate() 
+{
+  // destruct the instance
+
+  if (fgInstance != 0) {
+    delete fgInstance;
+    fgInstance = 0x0;
+  }
+}
+
+//______________________________________________________________________________
+void AliTRDptrgParam::LoadStandardConfiguration() {
+  // loads a standard configuration parameters for testing 
+
+  // TLMU Input Masks
+  for (UInt_t iSM = 0; iSM < 18; iSM++) {
+    this->fTLMUInputMask[iSM] = 0xFFFFFFFF; // enable all input bits
+  }
+  // TLMU Input Stretch
+  this->fTLMUInputStretch = 0; // not used in simulation
+
+  // TLMU Coincidence Matrices
+  //
+  // Matrix 0: Back-To-Back
+  // Matrix 1: Back-To-Back +/-1
+  // Matrix 2: Back-To-Back +/-2
+  for (UInt_t iMatrix = 0; iMatrix < 3; iMatrix++) {
+    for (UInt_t iSlice = 0; iSlice < 18; iSlice++) {
+      if (iMatrix == 0) {
+        if (iSlice < 9) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x201 << iSlice; 
+          // Back-To-Back 
+          AliDebug(5, Form("fTLMUcmatrices[%d][%d]=0x%x",iMatrix,iSlice,
+                           this->fTLMUcmatrices[iMatrix][iSlice]));
+       }
+        // because of symmetrie the other slices are not necessary
+      } 
+      else if (iMatrix == 1)  {
+        // Back-To-Back +/- 1
+        if (iSlice < 8) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x381 << iSlice;
+        }
+        else if (iSlice == 8) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x30101;
+        }
+        else if (iSlice == 9) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x20203;
+        }
+        else {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x407 << (iSlice - 10);
+        } 
+        AliDebug(5, Form("fTLMUcmatrices[%d][%d]=0x%x",iMatrix,iSlice,
+                         this->fTLMUcmatrices[iMatrix][iSlice])); 
+      }
+      else if (iMatrix == 2) {
+        // Back-To-Back +/-2
+        if (iSlice < 7 ) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0xF81 << iSlice;
+        }
+        else if (iSlice == 7) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x3C081;
+        }
+        else if (iSlice == 8) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x38103;
+        }
+        else if (iSlice == 9) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x30207;
+        }
+        else if (iSlice == 10) {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x2040F;
+        }
+        else {
+          this->fTLMUcmatrices[iMatrix][iSlice] = 0x81F << (iSlice - 11);
+        } 
+        AliDebug(5, Form("fTLMUcmatrices[%d][%d]=0x%x",iMatrix,iSlice,
+                         this->fTLMUcmatrices[iMatrix][iSlice]));     
+      }
+    } 
+  }
+
+  // TLMU Mulitplicity
+  this->fTLMUmultiplicity[0][0] = 0;
+  this->fTLMUmultiplicity[0][1] = 10;
+  this->fTLMUmultiplicity[1][0] = 10;
+  this->fTLMUmultiplicity[1][1] = 25;
+  this->fTLMUmultiplicity[2][0] = 25;
+  this->fTLMUmultiplicity[2][1] = 50;
+  this->fTLMUmultiplicity[3][0] = 50;
+  this->fTLMUmultiplicity[3][1] = 100;
+  this->fTLMUmultiplicity[4][0] = 100;
+  this->fTLMUmultiplicity[4][1] = 200;
+  this->fTLMUmultiplicity[5][0] = 200;
+  this->fTLMUmultiplicity[5][1] = 350;
+  this->fTLMUmultiplicity[6][0] = 350;
+  this->fTLMUmultiplicity[6][1] = 400;
+  this->fTLMUmultiplicity[7][0] = 400;
+  this->fTLMUmultiplicity[7][1] = 576;
+  this->fTLMUmultiplicity[8][0] = 100;
+  this->fTLMUmultiplicity[8][1] = 576;
+  // TLMU output
+  this->fTLMUoutput[0][0] = 0;
+  this->fTLMUoutput[1][0] = 1;
+  this->fTLMUoutput[2][0] = 2;
+  this->fTLMUoutput[3][1] = 0;
+  this->fTLMUoutput[4][1] = 1;
+  this->fTLMUoutput[5][1] = 2;
+  this->fTLMUoutput[6][1] = 3;
+  this->fTLMUoutput[7][1] = 8;
+
+  // T0 FEB Thresholds
+  for (UInt_t iChannel = 0; iChannel < 12; iChannel++) {
+    this->fFEBT0Thresholds[0][iChannel] = 10;
+    this->fFEBT0Thresholds[1][iChannel] = 10;
+  }
+
+  // T0 Multiplicities
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+      if (iLUT == 0) {
+        this->fFEBT0Multiplicities[iPosition][iLUT][0] = 0;
+      }
+      else {
+       this->fFEBT0Multiplicities[iPosition][iLUT][0] = 5;
+      }
+      this->fFEBT0Multiplicities[iPosition][iLUT][1] = 0xFFF;
+    }
+  }
+
+  // V0 FEB Thresholds
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    for (UInt_t iCard = 0; iCard < 4; iCard++) {
+      for (UInt_t iChannel = 0; iChannel < 8; iChannel++) {
+        this->fFEBV0Thresholds[iPosition][iCard][iChannel] = 10;
+      }
+    }
+  }
+
+  // V0 Multiplicities
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    for (UInt_t iCard = 0; iCard < 4; iCard++) {
+      for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+        if (iLUT == 0) {
+          this->fFEBV0Multiplicities[iPosition][iCard][iLUT][0] = 0;
+        }
+        else {
+          this->fFEBV0Multiplicities[iPosition][iCard][iLUT][0] = 3;
+        }
+        this->fFEBV0Multiplicities[iPosition][iCard][iLUT][1] = 0xFF;
+      }
+    }
+  }
+
+  // CB-A LUT equations
+  this->fCBALUTequX = "T0_0 || (V0-0_0 || V0-1_0 || V0-2_0 || V0-3_0)";
+  this->fCBALUTequY = "!T0_1 && !V0-0_1 && !V0-1_1 && !V0-2_1 && !V0-3_1";
+
+  // CB-C LUT equations
+  this->fCBCLUTequX = "T0_0 || ( V0-0_0 || V0-1_0 || V0-2_0 || V0-3_0 )";
+  this->fCBCLUTequY = "!T0_1 && !V0-0_1 && !V0-1_1 && !V0-2_1 && !V0-3_1";
+
+  // CB-B LUT equations
+  this->fCBBLUTequX = "( CB-A_1 || CB-C_1 ) && TLMU_7";
+  this->fCBBLUTequY = "( CB-A_1 || CB-C_1 ) && TLMU_7";
+
+  // PT output mask
+  this->fPTmasks.fLUTs[0] = kTRUE;
+  this->fPTmasks.fLUTs[1] = kTRUE;
+  this->fPTmasks.fCBA[0] = kTRUE;
+  this->fPTmasks.fCBC[0] = kTRUE;
+  for (Int_t i = 1; i < 8; i++) {
+    this->fPTmasks.fTLMU[i] = kTRUE;
+  }
+
+  return;  
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgParam::LoadConfigurationFromFile(TString filename) {
+  // Reads pretrigger configuration file and forwards identifiers and values
+  // to the corresponding parser functions
+  // This method is only checking for certain keywords at the beginning of a
+  // line in the config file
+
+  ifstream inputFile;
+  inputFile.open(filename.Data());
+  TString line;
+  TString identifier;
+  TString value;
+  std::string str;
+
+
+  if (inputFile.is_open())
+  {
+    AliDebug(5, "---- Reading configuration file ----");
+    while (getline(inputFile, str)) {
+      line = str;
+   
+      AliDebug(5, Form("line: %s\n", line.Data()));
+      if (line.Index("TLMU") == 0) {
+        this->PrepareLine(line, identifier, value);
+        if (!this->ParseTLMU(identifier, value)) {
+         return kFALSE;
+        }
+      }
+      else if (line.Index("FEB") == 0) {
+        this->PrepareLine(line, identifier, value);
+        if (!this->ParseFEB(identifier, value)) {
+         return kFALSE;
+        }
+      }
+      else if (line.Index("CBB") == 0) {
+        this->PrepareLine(line, identifier, value);
+        if (!this->ParseCBB(identifier, value)) {
+          return kFALSE;
+       }
+      }
+      else if ((line.Index("CBA") == 0) ||
+               (line.Index("CBC") == 0)) {
+        this->PrepareLine(line, identifier, value);
+        if (!this->ParseCBAC(identifier, value)) {
+          return kFALSE;
+       }
+      }
+    }
+    AliDebug(5, "---- Finished reading configuration file ----");
+    inputFile.close();
+    return kTRUE;
+  }
+  else
+  {
+    AliDebug(5, "Error opening configuration file");
+    return kFALSE;
+  }
+  return kTRUE;
+}
+
+
+//______________________________________________________________________________
+Int_t AliTRDptrgParam::GenerateLUTs() {
+  // generates all LUTs defined inside this object, this schould called only
+  // once, after configuration is loaded in order to save cpu time
+
+  // generation method:
+  // walk through address space
+  // mask address with input mask =>  get multiplicity of masked value
+  // if (multiplicity of masked value) > multiplicity condition
+  // write 1 in LUT
+  
+  // T0
+  this->fFEBT0LUTs = new Int_t**[2]; // 2 A + C side
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    // iPosition = 0 -> A, iPosition = 1 -> C
+    this->fFEBT0LUTs[iPosition] = new Int_t*[2]; // 2 LUTs per side
+    for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+      // LUT with 12 input channels 2^12=4096
+      this->fFEBT0LUTs[iPosition][iLUT] = new Int_t[4096];
+      AliDebug(5, Form("Generate FEBT0LUT[%d][%d]: (0x%x)>%d", iPosition, iLUT,
+                       this->fFEBT0Multiplicities[iPosition][iLUT][1],
+                       this->fFEBT0Multiplicities[iPosition][iLUT][0]));
+      for (UInt_t iEntry = 0; iEntry < 4096; iEntry++) {
+        // Check whether that entry belongs to a multiplicity exceeding the 
+        // threshold
+        if (this->GetMultiplicity(iEntry & 
+             this->fFEBT0Multiplicities[iPosition][iLUT][1]) > 
+            this->fFEBT0Multiplicities[iPosition][iLUT][0]) {
+          this->fFEBT0LUTs[iPosition][iLUT][iEntry] = 1;
+       }
+        else {
+          // initialize LUT (not done before !)
+          this->fFEBT0LUTs[iPosition][iLUT][iEntry] = 0;
+        }
+        AliDebug(10, Form("FEBT0LUTs[%d][%d][0x%x]=%d", iPosition, iLUT, iEntry,
+                         this->fFEBT0LUTs[iPosition][iLUT][iEntry])); 
+      }
+      AliDebug(5, Form("Generated FEBT0LUTs[%d][%d]", iPosition, iLUT));
+    }
+  }
+
+  // V0
+  this->fFEBV0LUTs = new Int_t***[2]; // 2 A + C side
+  for (UInt_t iPosition = 0; iPosition < 2; iPosition++) {
+    // iPosition = 0 -> A, iPosition = 1 -> C
+    this->fFEBV0LUTs[iPosition] = new Int_t**[4]; // 4 FEBs per side
+    for (UInt_t iFEB = 0; iFEB < 4; iFEB++) {
+      this->fFEBV0LUTs[iPosition][iFEB] = new Int_t*[2]; // 2 LUTs per FEB
+      for (UInt_t iLUT = 0; iLUT < 2; iLUT++) {
+      // LUT with 10 input channels 2^10=1024
+        this->fFEBV0LUTs[iPosition][iFEB][iLUT] = new Int_t[1024];
+        AliDebug(5, Form("Generate FEBV0LUT[%d][%d][%d]: (0x%x)>%d", iPosition, 
+                         iFEB, iLUT,
+                         this->fFEBV0Multiplicities[iPosition][iFEB][iLUT][1],
+                         this->fFEBV0Multiplicities[iPosition][iFEB][iLUT][0]));
+        for (UInt_t iEntry = 0; iEntry < 1024; iEntry++) {
+          // Check whether that entry belongs to a multiplicity exceeding the 
+          // threshold
+          if (this->GetMultiplicity(iEntry & 
+               this->fFEBV0Multiplicities[iPosition][iFEB][iLUT][1]) > 
+              this->fFEBV0Multiplicities[iPosition][iFEB][iLUT][0]) {
+            this->fFEBV0LUTs[iPosition][iFEB][iLUT][iEntry] = 1;
+         }
+          else {
+            // initialize LUT (not done before !)
+            this->fFEBV0LUTs[iPosition][iFEB][iLUT][iEntry] = 0;
+          }
+          AliDebug(10, Form("FEBV0LUTs[%d][%d][%d][0x%x]=%d", iPosition, iFEB,
+                            iLUT, iEntry, 
+                            this->fFEBV0LUTs[iPosition][iFEB][iLUT][iEntry]));
+        }
+        AliDebug(5, Form("Generated FEBV0LUTs[%d][%d][%d]", iPosition, iFEB, 
+                         iLUT));
+      }
+    }
+  }
+
+  // ControlBoxes (CB-x)
+  // initialize LUTs
+  this->fCBLUTs = new Int_t**[3];
+  for (Int_t iCB = 0; iCB < 3; iCB++) {
+    this->fCBLUTs[iCB] = new Int_t*[2];
+    this->fCBLUTs[iCB][0] = 0x0;
+    this->fCBLUTs[iCB][1] = 0x0;
+  }
+  
+  // CB-A (CB = 1 / kA)
+  this->fCBLUTs[1][0] = this->GenerateLUTbasedOnEq(this->fCBALUTequX, 10, 1);
+  for (Int_t iEntry = 0; iEntry < 1024; iEntry++) {
+    AliDebug(10, Form("fCBLUTs[@A][0]=%d", this->fCBLUTs[1][0]));
+  }
+  this->fCBLUTs[1][1] = this->GenerateLUTbasedOnEq(this->fCBALUTequY, 10, 1);
+  for (Int_t iEntry = 0; iEntry < 1024; iEntry++) {
+    AliDebug(10, Form("fCBLUTs[@A][1]=%d", this->fCBLUTs[1][1]));
+  }
+
+  // CB-C (CB = 2 / kC)
+  this->fCBLUTs[2][0] = this->GenerateLUTbasedOnEq(this->fCBCLUTequX, 10, 1);
+  for (Int_t iEntry = 0; iEntry < 1024; iEntry++) {
+    AliDebug(6, Form("fCBLUTs[@C][0]=%d", this->fCBLUTs[2][0]));
+  }
+  this->fCBLUTs[2][1] = this->GenerateLUTbasedOnEq(this->fCBCLUTequY, 10, 1);
+  for (Int_t iEntry = 0; iEntry < 1024; iEntry++) {
+    AliDebug(10, Form("fCBLUTs[@C][1]=%d", this->fCBLUTs[2][0]));
+  }
+  // CB-B (CB = 0 / kB)
+  this->fCBLUTs[0][0] = this->GenerateLUTbasedOnEq(this->fCBALUTequX, 12, 1);
+  for (Int_t iEntry = 0; iEntry < 4096; iEntry++) {
+    AliDebug(10, Form("fCBLUTs[@B][0]=%d", this->fCBLUTs[0][0]));
+  }
+  this->fCBLUTs[0][1] = this->GenerateLUTbasedOnEq(this->fCBALUTequY, 12, 1);
+  
+  for (Int_t iEntry = 0; iEntry < 4096; iEntry++) {
+    AliDebug(10, Form("fCBLUTs[@B][1]=%d", this->fCBLUTs[0][1]));
+  }
+
+  AliDebug(5, "LUTs were generated!");
+  return 0;
+}
+
+//______________________________________________________________________________
+UInt_t AliTRDptrgParam::GetMultiplicity(UInt_t BitVector) const {
+  // returns the multiplicity of a given bit vector
+  
+  UInt_t result = 0;
+  UInt_t temp = 0x01;
+  for (UInt_t iBit = 0; iBit < 32; iBit++) {
+    if (BitVector & temp) {
+      result++;
+    }
+    temp <<= 1;
+  }
+
+  return result;
+}
+
+//______________________________________________________________________________
+UInt_t AliTRDptrgParam::GetMultiplicity(Int_t BitVector) const {
+  // returns the multiplicity of a given bit vector
+  
+  UInt_t result = 0;
+  UInt_t temp = 0x01;
+  for (UInt_t iBit = 0; iBit < 32; iBit++) {
+    if (BitVector & temp) {
+      result++;
+    }
+    temp <<= 1;
+  }
+
+  return result;
+}
+
+//______________________________________________________________________________
+//
+//      Configuration file parsing (helper functions)
+//______________________________________________________________________________
+
+//______________________________________________________________________________
+void AliTRDptrgParam::PrepareLine(TString line, TString& identifier, 
+                                  TString& value) {
+  // Prepares a line for parsing
+  // divide identifier and value 
+
+  // clear identifier and value
+  identifier.Clear();
+  value.Clear();  
+
+  Int_t iLetter = 0;
+  while ((line[iLetter] != ' ') && (line[iLetter] != '\t') && 
+         (line[iLetter] != '#') && (iLetter < line.Length())) {
+    // read identifier
+    identifier += line[iLetter];
+    iLetter++;
+  }
+  while (((line[iLetter] == ' ') || (line[iLetter] == '\t')) &&
+        (iLetter < line.Length()) && (line[iLetter] != '#')) {
+    // omit whitespaces and tabs in between
+    iLetter++;
+  }
+  while(iLetter < line.Length()) {
+    // read value or equation and remove white spaces and tabs
+    //if ((line[iLetter] != ' ') && (line[iLetter] != '\t') &&
+    //    (line[iLetter] != '#')) {
+    if (line[iLetter] != '#') {
+      value += line[iLetter];
+    }
+    iLetter++;
+  }
+}
+
+//______________________________________________________________________________
+TString AliTRDptrgParam::CleanTString(TString string) {
+  // Removes white spaces and tabs
+
+  TString result;
+  result.Clear();
+  for (Int_t iLetter = 0; iLetter < string.Length(); iLetter++) {
+    if ((string[iLetter] != ' ') && (string[iLetter] != '\t')) {
+      result += string[iLetter];
+    }
+  } 
+  AliDebug(5, Form("Cleaned string: %s", result.Data()));  
+  return result;
+}
+
+//______________________________________________________________________________
+void AliTRDptrgParam::SplitUpValues(TString value, TObjArray& arr) {
+  // splits up multiple values into a TObjArray
+
+  TString temp;
+  temp.Clear();
+  temp.Resize(0);
+  for (Int_t iLetter = 0; iLetter < value.Length(); iLetter++) {
+    if ((value[iLetter] != ' ') && (value[iLetter] != '\t')) {
+      // add another letter
+      temp += value[iLetter];
+    }
+    else {
+      // seperator found: white space or tabs
+      if (temp.Length()) {
+        TObjString* t = new TObjString(temp.Data());
+        arr.Add(t);      
+        temp.Clear();
+        temp.Resize(0);
+      }
+    }
+  }
+  if (temp.Length() != 0) { // TODO
+    TObjString* t = new TObjString(temp.Data());
+    arr.Add(t);         
+  }
+}
+
+//______________________________________________________________________________
+UInt_t AliTRDptrgParam::BinaryTStringToInt(TString number) const {
+  // converts a binary TString to an integer
+  UInt_t temp = 0x01;
+  UInt_t result = 0x0;
+  for (Int_t i = number.Length() - 1; i >= 0; i--) {
+    if (number[i] == '1') {
+      result |= temp;
+      temp <<= 1;
+    }
+    else if (number[i] == '0')  {
+      temp <<= 1;    
+    }
+  }
+  return result;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgParam::ParseMultiplicityCondition(TString condition, 
+                                                   UInt_t* threshold,
+                                                   UInt_t* mask) {
+  // converts a string formed like "M(1111_1111)>4" to a input mask and a
+  // multiplicity threshold
+
+  // check whether condition is starting with "M(
+  if ((condition[0] != 'M') || ( condition[1] != '(')) {
+    return kFALSE;
+  }
+  
+  TString maskStr = "";
+  Int_t iLetter = 0;
+  
+  // extract input mask
+  while (condition[iLetter] != ')') {
+    maskStr += condition[iLetter++];
+  }
+  (*mask) = BinaryTStringToInt(maskStr);
+  if ((*mask) == 0) { // TODO find a better method to detected parser errors
+    AliDebug(5, Form("Invalid input mask: %s,[%s]", maskStr.Data(), 
+                      condition.Data()));
+    return kFALSE;
+  }
+  
+  // ensure that ')' is followed by a '>'
+  if (condition[++iLetter] != '>') {
+    AliDebug(5, Form("multiplicity condition is incorrectly formed: %s", 
+                     condition.Data()));
+    return kFALSE;
+  }
+  iLetter++; // move on to the first digit
+
+  TString thresholdStr = "";
+  // gain threshold string
+  while (((condition[iLetter] != ' ') || (condition[iLetter] != '\t')) &&
+         (iLetter < condition.Length())) {
+    thresholdStr += condition[iLetter++];
+  }
+  (*threshold) = thresholdStr.Atoi(); // convert string to integer
+  AliDebug(5, Form("mask: 0x%x, multiplicity threshold: %d", (*mask), 
+                   (*threshold)));
+  return kTRUE;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgParam::ParseFEB(TString identifier, TString value) {
+  // Parse FEB configuration
+
+  //------------------------------------------
+  if (identifier.Index("FEB/T0/A/THR") == 0) {
+    // FEB T0 thresholds at A side
+
+    TObjArray arr;
+    arr.Clear();
+    SplitUpValues(value, arr);
+    
+    if (arr.GetEntries() != 12) {
+      AliError("Wrong FEB T0 Threshold count, it must be 12 channels!");
+      return kFALSE; 
+    }
+    for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
+      this->fFEBT0Thresholds[0][iValue] =  
+        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      AliDebug(5, Form("FEB/T0/A/THR[%d]=%d", iValue, 
+                       this->fFEBT0Thresholds[0][iValue])); 
+    }
+    return kTRUE;
+  }
+
+  //-----------------------------------------------
+  else if (identifier.Index("FEB/T0/C/THR") == 0) {
+    // FEB T0 thresholds at c side
+
+    TObjArray arr;
+    arr.Clear();
+    SplitUpValues(value, arr);
+    
+    if (arr.GetEntries() != 12) {
+      AliError("Wrong FEB T0 Threshold count, it must be 12 channels!");
+      return kFALSE; 
+    }
+    for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
+      this->fFEBT0Thresholds[1][iValue] =  
+        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      AliDebug(5, Form("FEB/T0/C/THR[%d]=%d", iValue, 
+                       this->fFEBT0Thresholds[1][iValue])); 
+    }
+    return kTRUE;
+  }
+  
+  //--------------------------------------------------
+  else if ((identifier.Index("FEB/V0/A0/THR") == 0) ||
+      (identifier.Index("FEB/V0/A1/THR") == 0) ||
+      (identifier.Index("FEB/V0/A2/THR") == 0) ||
+      (identifier.Index("FEB/V0/A3/THR") == 0)) {
+    // FEB V0 thresholds at a side (cards 0,1,2,3)
+   
+    TString cardIDstr = identifier(8, 1);
+    Int_t cardID = cardIDstr.Atoi();
+    TObjArray arr;
+    arr.Clear();
+    SplitUpValues(value, arr);
+    
+    if (arr.GetEntries() != 8) {
+      AliError("Wrong FEB V0 Threshold count, it must be 8 channels!");
+      return kFALSE; 
+    }
+    for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
+      this->fFEBV0Thresholds[0][cardID][iValue] =  
+        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      AliDebug(5, Form("FEB/V0/A%d/THR[%d]=%d", cardID, iValue, 
+                       this->fFEBV0Thresholds[0][cardID][iValue])); 
+    }
+  }
+
+  //--------------------------------------------------
+  else if ((identifier.Index("FEB/V0/C0/THR") == 0) ||
+      (identifier.Index("FEB/V0/C1/THR") == 0) ||
+      (identifier.Index("FEB/V0/C2/THR") == 0) ||
+      (identifier.Index("FEB/V0/C3/THR") == 0)) {
+    // FEB V0 thresholds at c side (cards 0,1,2,3)
+   
+    TString cardIDstr = identifier(8, 1);
+    Int_t cardID = cardIDstr.Atoi();
+    TObjArray arr;
+    arr.Clear();
+    SplitUpValues(value, arr);
+    
+    if (arr.GetEntries() != 8) {
+      AliError("Wrong FEB V0 Threshold count, it must be 8 channels!");
+      return kFALSE; 
+    }
+    for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
+      this->fFEBV0Thresholds[1][cardID][iValue] =  
+        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      AliDebug(5, Form("FEB/V0/C%d/THR[%d]=%d", cardID, iValue, 
+                       this->fFEBV0Thresholds[1][cardID][iValue])); 
+    }
+  }
+  
+  //-----------------------------------------------
+  else if (identifier.Index("FEB/T0/A/LUT") == 0) {
+    // FEB T0 look up tables at A side
+
+    TString lutIDstr = identifier(13, 1);
+    Int_t lutID = lutIDstr.Atoi();
+    
+    UInt_t val = 0;
+    UInt_t mask = 0;
+    ParseMultiplicityCondition(value, &val, &mask);
+    this->fFEBT0Multiplicities[0][lutID][0] = val;
+    this->fFEBT0Multiplicities[0][lutID][1] = mask;
+    AliDebug(5, Form("FEBT0Multiplicities[0/A][%d][val] = %d", lutID, val));
+    AliDebug(5, Form("FEBT0Multiplicities[0/A][%d][mask] = %d", lutID, mask));
+    
+    return kTRUE;
+  }
+
+  //-----------------------------------------------
+  else if (identifier.Index("FEB/T0/C/LUT") == 0) {
+    // FEB T0 look up tables at C side
+
+    TString lutIDstr = identifier(13, 1);
+    Int_t lutID = lutIDstr.Atoi();
+    
+    UInt_t val = 0;
+    UInt_t mask = 0;
+    ParseMultiplicityCondition(value, &val, &mask);
+    this->fFEBT0Multiplicities[1][lutID][0] = val;
+    this->fFEBT0Multiplicities[1][lutID][1] = mask;
+    AliDebug(5, Form("FEBT0Multiplicities[1/C][%d][val] = %d", lutID, val));
+    AliDebug(5, Form("FEBT0Multiplicities[1/C][%d][mask] = %d", lutID, mask));
+
+    return kTRUE;
+  }
+
+  //--------------------------------------------------
+  else if ((identifier.Index("FEB/V0/A0/LUT") == 0) ||
+           (identifier.Index("FEB/V0/A1/LUT") == 0) ||
+           (identifier.Index("FEB/V0/A2/LUT") == 0) ||
+           (identifier.Index("FEB/V0/A3/LUT") == 0)) {
+    // FEB V0 look up tables at A side
+
+    TString cardIDstr = identifier(8, 1);
+    Int_t cardID = cardIDstr.Atoi();
+    TString lutIDstr = identifier(14, 1);
+    Int_t lutID = lutIDstr.Atoi();
+     
+    UInt_t val = 0;
+    UInt_t mask = 0;
+    ParseMultiplicityCondition(value, &val, &mask);
+    this->fFEBV0Multiplicities[0][cardID][lutID][0] = val;
+    this->fFEBV0Multiplicities[0][cardID][lutID][1] = mask;
+    AliDebug(5, Form("FEBV0Multiplicities[0/A][%d][%d][val] = %d", cardID, 
+                     lutID, val));
+    AliDebug(5, Form("FEBV0Multiplicities[0/A][%d][%d][mask] = %d", cardID, 
+                     lutID, mask));
+
+    return kTRUE;
+  }
+   
+  //--------------------------------------------------
+  else if ((identifier.Index("FEB/V0/C0/LUT") == 0) ||
+           (identifier.Index("FEB/V0/C1/LUT") == 0) ||
+           (identifier.Index("FEB/V0/C2/LUT") == 0) ||
+           (identifier.Index("FEB/V0/C3/LUT") == 0)) {
+    // FEB V0 look up tables at C side
+
+    TString cardIDstr = identifier(8, 1);
+    Int_t cardID = cardIDstr.Atoi();
+    TString lutIDstr = identifier(14, 1);
+    Int_t lutID = lutIDstr.Atoi();
+     
+    UInt_t val = 0;
+    UInt_t mask = 0;
+    ParseMultiplicityCondition(value, &val, &mask);
+    this->fFEBV0Multiplicities[1][cardID][lutID][0] = val;
+    this->fFEBV0Multiplicities[1][cardID][lutID][1] = mask;
+    AliDebug(5, Form("FEBV0Multiplicities[1/C][%d][%d][val] = %d", cardID, 
+                     lutID, val));
+    AliDebug(5, Form("FEBV0Multiplicities[1/C][%d][%d][mask] = %d", cardID, 
+                     lutID, mask));
+
+    return kTRUE;
+  }
+  return kTRUE;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgParam::ParseCBAC(TString identifier, TString value) {
+  // Parse CB-A and CB-C configuration
+  if (identifier.Index("CBA/LUT/") == 0) {
+    // parse CB-A's logical equations
+    
+    TString eqIDstr = identifier(8, 1);
+    Int_t eqID = eqIDstr.Atoi();
+   
+    if (eqID == 0) {
+      this->fCBALUTequX = this->CleanTString(value);
+      AliDebug(5, Form("fCBALUTequX=%s", this->fCBALUTequX.Data())); 
+    }
+    else if(eqID == 1) {
+      this->fCBALUTequY= this->CleanTString(value);
+      AliDebug(5, Form("fCBALUTequY=%s", this->fCBALUTequY.Data()));
+    }
+    return kTRUE;    
+  }
+    
+  else if (identifier.Index("CBC/LUT/") == 0) {
+    // parse CB-C's logical equations
+    
+    TString eqIDstr = identifier(8, 1);
+    Int_t eqID = eqIDstr.Atoi();
+   
+    if (eqID == 0) {
+      this->fCBCLUTequX = this->CleanTString(value);
+      AliDebug(5, Form("fCBCLUTequX=%s", this->fCBCLUTequX.Data()));
+    }
+    else if(eqID == 1) {
+      this->fCBCLUTequY= this->CleanTString(value);
+      AliDebug(5, Form("fCBCLUTequY=%s", this->fCBCLUTequY.Data()));
+    }    
+  }
+
+  return kTRUE;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgParam::ParseCBB(TString identifier, TString value) {
+  // Parse CBB configuration
+  
+  if (identifier.Index("CBB/LUT/") == 0) {
+    // parse CB-B's logical equations
+    
+    TString eqIDstr = identifier(8, 1);
+    Int_t eqID = eqIDstr.Atoi();
+   
+    if (eqID == 0) {
+      this->fCBBLUTequX = this->CleanTString(value);
+      AliDebug(5, Form("fCBBLUTequX=%s", this->fCBBLUTequX.Data()));
+    }
+    else if(eqID == 1) {
+      this->fCBBLUTequY= this->CleanTString(value);
+      AliDebug(5, Form("fCBBLUTequY=%s", this->fCBBLUTequY.Data()));
+    }    
+    return kTRUE;
+  }
+  
+  // PT masks 
+  else if (identifier.Index("CBB/PT/MASK/CB-A_0") == 0) { // CB-A_0
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fCBA[0] = kTRUE;     
+    }
+    else {
+      this->fPTmasks.fCBA[0] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/CB-A_0=%d", this->fPTmasks.fCBA[0]));
+    return kTRUE;
+  }
+  else if (identifier.Index("CBB/PT/MASK/CB-A_1") == 0) { // CB-A_1
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fCBA[1] = kTRUE;     
+    }
+    else {
+      this->fPTmasks.fCBA[1] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/CB-A_1=%d", this->fPTmasks.fCBA[1]));
+    return kTRUE;
+  } 
+  else if (identifier.Index("CBB/PT/MASK/CB-C_0") == 0) { // CB-C_0
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fCBC[0] = kTRUE;     
+    }
+    else {
+      this->fPTmasks.fCBC[0] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/CB-C_0=%d",this->fPTmasks.fCBC[0]));
+    return kTRUE;
+  }
+  else if (identifier.Index("CBB/PT/MASK/CB-C_1") == 0) { // CB-C_1
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fCBC[1] = kTRUE;     
+    }
+    else {
+      this->fPTmasks.fCBC[1] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/CB-C_1=%d", this->fPTmasks.fCBC[1]));
+    return kTRUE;
+  } 
+  else if (identifier.Index("CBB/PT/MASK/CB-B_0") == 0) { // CB-B_0
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fLUTs[0] = kTRUE;     
+    }
+    else {
+      this->fPTmasks.fLUTs[0] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/CB-B_0=%d",this->fPTmasks.fLUTs[0]));
+    return kTRUE;
+  }
+  else if (identifier.Index("CBB/PT/MASK/CB-B_1") == 0) { // CB-B_1
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fLUTs[1] = kTRUE;     
+    }
+    else {
+      this->fPTmasks.fLUTs[1] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/CB-B_1/=%d", this->fPTmasks.fLUTs[1]));
+    return kTRUE;
+  }
+  else if (identifier.Index("BB/PT/MASK/TLMU_") == 0) {
+    TString indexStr = identifier(16, 1);
+    Int_t index = indexStr.Atoi();
+    if (value.Index("YES") == 0) {
+      this->fPTmasks.fTLMU[index] = kTRUE;
+    }
+    else {
+      this->fPTmasks.fTLMU[index] = kFALSE;
+    }
+    AliDebug(5, Form("CBB/PT/MASK/TLMU_%d=%d", index, 
+                     this->fPTmasks.fTLMU[index]));
+    return kTRUE;
+  }
+  return kTRUE;
+}
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgParam::ParseTLMU(TString identifier, TString value) {
+  // Parse TLMU configuration
+
+  if (identifier.Index("TLMU/IMASK/SEC") == 0) {
+    // TLMU input masks
+    TString indexStr = identifier(14,2);
+    Int_t index = indexStr.Atoi();
+    if ((index < 0) || (index > 17)) {
+      AliDebug(5, "Wrong section index in TLMU input mask");
+      return kFALSE;
+    }
+    this->fTLMUInputMask[index] = BinaryTStringToInt(value);
+    AliDebug(5, Form("%d %x\n", index, this->fTLMUInputMask[index]));
+    return kTRUE;
+  }
+
+  //-----------------------------------------------
+  else if (identifier.Index("TLMU/CMATRIX") == 0) {
+    // TLMU coincidence matrices
+
+    // matrix index
+    TString matrixIndexStr = identifier(12,1);
+    Int_t matrixIndex = matrixIndexStr.Atoi();
+    // entry index
+    TString indexStr = identifier(17,2);
+    Int_t index = indexStr.Atoi();
+    this->fTLMUcmatrices[matrixIndex][index] = BinaryTStringToInt(value);
+    AliDebug(5, Form("%d 0x%x\n", matrixIndex, 
+                     this->fTLMUcmatrices[matrixIndex][index]));
+    return kTRUE;
+  }
+
+  //---------------------------------------------
+  else if (identifier.Index("TLMU/MCNTR") == 0) {
+    // TLMU multiplicity counter setup
+    
+    TString indexStr = identifier(10,1);
+    Int_t index = indexStr.Atoi();
+    TObjArray arr;
+
+    SplitUpValues(value, arr);
+    
+    TString t0 = (dynamic_cast<TObjString*>(arr[0]))->GetString();
+    TString t1 = (dynamic_cast<TObjString*>(arr[1]))->GetString();
+  
+    this->fTLMUmultiplicity[index][0] = t0.Atoi();
+    this->fTLMUmultiplicity[index][1] = t1.Atoi();
+    AliDebug(5, Form("%d: %d  %d", index, this->fTLMUmultiplicity[index][0], 
+                     this->fTLMUmultiplicity[index][1]));      
+
+    return kTRUE;
+  }
+  
+  //----------------------------------------------
+  else if (identifier.Index("TLMU/OUTMUX") == 0) {
+    // TLMU output signal assignment
+    TObjArray arr;
+    SplitUpValues(value, arr);
+  
+    if (arr.GetEntries() > 8) {
+      AliError("Too many TLMU output signals assigned");
+      return kFALSE;
+    } 
+  
+    for (Int_t iEntry = 0; iEntry < arr.GetEntries(); iEntry++) {
+      TString t = (dynamic_cast<TObjString*>(arr[iEntry]))->GetString(); 
+      
+      TString indexStr = t(2,1);
+      if (t.Index("CM") == 0) { // coincidence matrix
+        this->fTLMUoutput[iEntry][0] = indexStr.Atoi();
+      }
+      else if (t.Index("MC") == 0) { // multiplicity
+        this->fTLMUoutput[iEntry][1] = indexStr.Atoi();
+      }
+      AliDebug(5, Form("TLMU output: cm = %d, mc = %d", 
+                       this->fTLMUoutput[iEntry][0], 
+                       this->fTLMUoutput[iEntry][1]));
+    }
+    return kTRUE;
+  }
+  return kTRUE;
+}
+
+//______________________________________________________________________________
+//
+//       Logical Equation to LUT processing (helper functions)
+//______________________________________________________________________________
+
+//______________________________________________________________________________
+Int_t AliTRDptrgParam::LookUp(TString* const identifier) const {
+  // Transforms identifier into look up table address bit
+  //
+  // this function has to be extended/changed when different identifiers for
+  // other equations and destination LUTs should be used
+
+  if (identifier->CompareTo("T0_0", TString::kIgnoreCase) == 0)  
+    return 0x001;
+  else if (identifier->CompareTo("T0_1", TString::kIgnoreCase) == 0) 
+    return 0x002; 
+  else if (identifier->CompareTo("V0-0_0", TString::kIgnoreCase) == 0) 
+    return 0x004; 
+  else if (identifier->CompareTo("V0-0_1", TString::kIgnoreCase) == 0) 
+    return 0x008; 
+  else if (identifier->CompareTo("V0-1_0", TString::kIgnoreCase) == 0) 
+    return 0x010; 
+  else if (identifier->CompareTo("V0-1_1", TString::kIgnoreCase) == 0) 
+    return 0x020; 
+  else if (identifier->CompareTo("V0-2_0", TString::kIgnoreCase) == 0) 
+    return 0x040; 
+  else if (identifier->CompareTo("V0-2_1", TString::kIgnoreCase) == 0) 
+    return 0x080; 
+  else if (identifier->CompareTo("V0-3_0", TString::kIgnoreCase) == 0) 
+    return 0x100; 
+  else if (identifier->CompareTo("V0-3_1", TString::kIgnoreCase) == 0) 
+    return 0x200; 
+  else if (identifier->CompareTo("CB-A_0", TString::kIgnoreCase) == 0) 
+    return 0x001; 
+  else if (identifier->CompareTo("CB-A_1", TString::kIgnoreCase) == 0) 
+    return 0x002; 
+  else if (identifier->CompareTo("CB-C_0", TString::kIgnoreCase) == 0) 
+    return 0x004; 
+  else if (identifier->CompareTo("CB-C_1", TString::kIgnoreCase) == 0) 
+    return 0x008; 
+  else if (identifier->CompareTo("TLMU_0", TString::kIgnoreCase) == 0)  
+    return 0x010; 
+  else if (identifier->CompareTo("TLMU_1", TString::kIgnoreCase) == 0) 
+    return 0x020; 
+  else if (identifier->CompareTo("TLMU_2", TString::kIgnoreCase) == 0) 
+    return 0x040; 
+  else if (identifier->CompareTo("TLMU_3", TString::kIgnoreCase) == 0) 
+    return 0x080; 
+  else if (identifier->CompareTo("TLMU_4", TString::kIgnoreCase) == 0) 
+    return 0x100; 
+  else if (identifier->CompareTo("TLMU_5", TString::kIgnoreCase) == 0) 
+    return 0x200; 
+  else if (identifier->CompareTo("TLMU_6", TString::kIgnoreCase) == 0) 
+    return 0x400; 
+  else if (identifier->CompareTo("TLMU_7", TString::kIgnoreCase) == 0) 
+    return 0x100; 
+  else return 0x0; // Error
+}
+
+//______________________________________________________________________________
+void AliTRDptrgParam::MergeResults(TArrayI*& partResult1, TArrayI*& partResult2,
+                                   TArrayI*& results,
+                                   TArrayI*& signalsInvolved1, 
+                                   TArrayI*& signalsInvolved2, 
+                                   TArrayI*& signalsInvolved, 
+                                   Bool_t useOR) {
+  // merges result and signal involved arrays
+  // uses logical OR (or=kTRUE) and AND (or==kFALSE) as merging function
+  
+  // check whether input data is valid
+  if ((partResult1 == 0x0) || (partResult2 == 0x0) || 
+      (signalsInvolved1 == 0x0) || (signalsInvolved2 == 0x0)) {
+    AliError("fatal logical equation processing error!");
+  }
+  // allocate results and signalsInvolved 
+  results = new TArrayI(0);    
+  signalsInvolved = new TArrayI(0);
+
+  // merge arrays (necessary for OR and AND)
+  for (Int_t i = 0; i < partResult1->GetSize(); i++) {
+    for (Int_t j = 0; j < partResult2->GetSize(); j++) {
+      results->Set(results->GetSize() + 1); // increment size
+      (*results)[results->GetSize() - 1] =  // add combination
+        (*partResult1)[i] | (*partResult2)[j];
+      signalsInvolved->Set(signalsInvolved->GetSize() + 1);
+      (*signalsInvolved)[signalsInvolved->GetSize() - 1] = 
+         (*signalsInvolved1)[i] | (*signalsInvolved2)[j];
+    }
+  }
+  
+  if (useOR) { // only necessary for OR
+    // add partResult1
+    for (Int_t i = 0; i < partResult1->GetSize(); i++) {
+      results->Set(results->GetSize() + 1);
+      (*results)[results->GetSize() - 1] = (*partResult1)[i];
+      
+      signalsInvolved->Set(signalsInvolved->GetSize() + 1);
+      (*signalsInvolved)[signalsInvolved->GetSize()-1] = (*signalsInvolved1)[i];
+    }
+    // add partResult2
+    for (Int_t i = 0; i < partResult2->GetSize(); i++) {
+      results->Set(results->GetSize() + 1);
+      (*results)[results->GetSize() - 1] = (*partResult2)[i];
+      
+      signalsInvolved->Set(signalsInvolved->GetSize() + 1);
+      (*signalsInvolved)[signalsInvolved->GetSize()-1] = (*signalsInvolved2)[i];
+    }
+  }
+  
+  // debug output
+  AliDebug(5, "merging results: ");
+  for (Int_t i = 0; i < results->GetSize(); i++) {
+    AliDebug(5, Form("0x%x 0x%x", (*results)[i], (*signalsInvolved)[i]));
+  }
+
+  // free memory
+  delete partResult1;
+  partResult1 = 0x0;
+  delete partResult2;
+  partResult2 = 0x0; 
+}
+
+//______________________________________________________________________________
+void AliTRDptrgParam::ConvertLogicalEqToBitVectors(TString eq, 
+                                                   TArrayI*& results,
+                                                   TArrayI*& signalsInvolved) {
+  // converts a logical equation to a LUT
+  //
+  // input string must not contain white spaces or tabs
+  // only identifiers, ||, &&, (, ) and ! are allowed
+  //
+  // neglected signals are assumed to be zero in this function
+  // this problem is solved by "void CheckSignalsInvolved(...)"
+
+  AliDebug(5, Form("eq: %s", eq.Data()));
+
+  // temporary variables used before/while merging
+  TArrayI* partResult1 = 0x0;
+  TArrayI* partResult2 = 0x0;
+  TArrayI* partResult3 = 0x0;
+  TArrayI* partResult4 = 0x0;
+  TArrayI* signalsInvolved1 = 0x0;
+  TArrayI* signalsInvolved2 = 0x0;
+  TArrayI* signalsInvolved3 = 0x0;
+  TArrayI* signalsInvolved4 = 0x0;
+  Int_t iChar = 0; // counter variable
+  
+  // variables needed for correct operator order (&& before ||!)
+  Int_t foundORbefore = -1; // found an || in that string (-1 = not found)
+  Int_t foundAND = -1; // found an &&
+  Int_t foundORafter = -1; // found a second OR after &&
+
+  // variables needed for correct bracket processing
+  Int_t enteredBrackets = 0; // indicates in which bracket layer the parser is
+  Int_t bracketLevelAtZero = -1; // when enteredBrackets = 0 was reached first
+  // after it ascended  
+
+  while ((iChar < eq.Length())) { //--------------------------------------------
+    // walk through string
+
+    // operators ---------------------------------------------------------------
+    if ((enteredBrackets == 0 ) && (eq[iChar] != '(') && (eq[iChar] != ')'))  {
+      // '|'
+      if (eq[iChar] == '|') {
+        if (eq[iChar + 1] == '|') { // ||
+          iChar++; // jump to the next charakter
+          if (foundAND == -1) {
+            foundORbefore = iChar;
+          }
+          else if ((foundORafter == -1) && (foundAND != -1)) {
+            foundORafter = iChar;
+          }
+        }
+        else { // bit-wise and not supported
+          AliError(Form("LogicalEquation incorrect: %s", eq.Data()));
+          AliError("bit-wise AND (&) not supported for now");
+          return;
+        }
+      }
+      // '&' 
+      else if (eq[iChar] == '&') {
+        if (eq[iChar] == '&') { // ||
+          iChar++; // jump to the next charakter
+          if (foundAND == -1) {
+            foundAND = iChar;
+          }
+        }
+        else { // bit-wise or not supported
+          AliError(Form("LogicalEquation incorrect: %s", eq.Data()));
+          AliError("bit-wise OR (|) not supported for now");
+         return;
+        }
+      }
+    }
+    // brackets ----------------------------------------------------------------
+    // '(' 
+    if (eq[iChar] == '(') {
+      enteredBrackets++;      
+    }
+    // ')' 
+    else if (eq[iChar] == ')') {
+      enteredBrackets--;
+      if (enteredBrackets < 0) {        
+        AliError(Form("LogicalEquation incorrect: %s", eq.Data()));     
+        AliError("Too many )s");
+      }
+      if ((enteredBrackets == 0) && (bracketLevelAtZero == -1) &&
+          (foundAND == -1) && (foundORbefore == -1)) {
+        // needed to detected equations encapsulated in brackets: (...)
+        bracketLevelAtZero = iChar;
+      }
+    }      
+    iChar++; // go on to the next letter/char
+  } //--------------------------------------------------------------------------
+
+  if (bracketLevelAtZero == (eq.Length() - 1)) { // strip ( ) and process again
+    ConvertLogicalEqToBitVectors(eq(1, eq.Length() -2), results, 
+                                 signalsInvolved);
+    return;     
+  }
+  else if (foundAND == -1) { // no AND
+    if (foundORbefore != -1) { // only OR / || found and no AND
+      ConvertLogicalEqToBitVectors(eq(0, foundORbefore-1), partResult1, 
+                                   signalsInvolved1); 
+      ConvertLogicalEqToBitVectors(eq(foundORbefore+1, 
+                                      eq.Length()-foundORbefore-1),
+                                   partResult2, signalsInvolved2);
+      
+      MergeResults(partResult1, partResult2, results, signalsInvolved1,
+                   signalsInvolved2, signalsInvolved, kTRUE);
+      return;
+    } 
+    else { // only identifier remained!
+      results = new TArrayI(1);
+      signalsInvolved = new TArrayI(1);
+      if (eq[0] != '!') { // identifier without negation
+        (*results)[0] = LookUp(&eq); 
+        (*signalsInvolved)[0] = (*results)[0];
+      }
+      else { // identifier with negation
+        (*results)[0] = 0;
+        TString eqNegated = eq(1, eq.Length()-1);
+        (*signalsInvolved)[0] = LookUp(&eqNegated);
+      } 
+      return;
+    }
+  }
+  // found single or multiple AND / && 
+  else if ((foundORafter != -1) && (foundORbefore != -1)) { 
+    // found: ...||...&&...||...   
+    ConvertLogicalEqToBitVectors(eq(0, foundORbefore-1), partResult1, 
+                                 signalsInvolved1);
+    ConvertLogicalEqToBitVectors(eq(foundORbefore+1, 
+                                    foundORafter-foundORbefore-2),
+                                 partResult2, signalsInvolved2);
+    ConvertLogicalEqToBitVectors(eq(foundORafter+1, eq.Length()-foundORafter-1),
+                                 partResult3, signalsInvolved3);
+
+    // merge: 4 = 1 || 2 
+    MergeResults(partResult1, partResult2, partResult4, signalsInvolved1,
+                 signalsInvolved2, signalsInvolved4, kTRUE);
+    // merge results = 3 || 4
+    MergeResults(partResult3, partResult4, results, signalsInvolved3,
+                 signalsInvolved4, signalsInvolved, kTRUE);
+    return;
+  } 
+  else if (foundORbefore != -1) { 
+    // found ...||...&&...
+    ConvertLogicalEqToBitVectors(eq(0, foundORbefore - 1), partResult1, 
+                                 signalsInvolved1); 
+    ConvertLogicalEqToBitVectors(eq(foundORbefore+1, 
+                                    eq.Length()-foundORbefore-1),
+                                 partResult2, signalsInvolved2);
+   
+    MergeResults(partResult1, partResult2, results, signalsInvolved1,
+                 signalsInvolved2, signalsInvolved, kTRUE);
+    return;
+  }
+  else if (foundORafter != -1) {
+    // found  ...&&...||...
+    ConvertLogicalEqToBitVectors(eq(0, foundORafter - 1), partResult1, 
+                                 signalsInvolved1); 
+    ConvertLogicalEqToBitVectors(eq(foundORafter+1, 
+                                    eq.Length()-foundORafter-1),
+                                 partResult2, signalsInvolved2);
+   
+    MergeResults(partResult1, partResult2, results, signalsInvolved1,
+                 signalsInvolved2, signalsInvolved, kTRUE);
+    return;
+  }
+  else /* if (foundAND != -1)*/ { // found ...&&...
+    ConvertLogicalEqToBitVectors(eq(0, foundAND-1), partResult1, 
+                                 signalsInvolved1); 
+    ConvertLogicalEqToBitVectors(eq(foundAND+1, eq.Length()-foundAND-1), 
+                                 partResult2, signalsInvolved2); 
+
+    MergeResults(partResult1, partResult2, results, signalsInvolved1,
+                 signalsInvolved2, signalsInvolved, kFALSE);    
+    return;
+  }
+  
+  AliError("Logical equation parser error!");
+  return;
+}
+
+//______________________________________________________________________________
+void AliTRDptrgParam::CheckSignalsInvolved(TArrayI*& results, 
+                                           TArrayI*& signalsInvolved,
+                                           Int_t inputWidth) {
+  // checks whether all input signals are taken into account
+  //
+  // this function is needed to be able to write equations which contain not all
+  // possible signals and which are not mentioned in the equation do not effect
+  // the result
+  // X=B&&C=(A||!A)&&B&&C
+
+  // this routine is quite inefficient but working O((2^inputWidth)^3)
+
+  // generate mask:
+  Int_t temp = 0x1;
+  Int_t mask = 0x0;
+  for (Int_t iSignal = 0; iSignal < inputWidth; iSignal++) {
+    mask |= temp;
+    temp <<= 1; // move temp to the next bit 
+  }
+  
+  for (Int_t iResult = 0; iResult < results->GetSize(); iResult++) {
+    // tricky: size of results increases while loop is iterating
+    // that is needed to generate all valid input signal combinations
+    if (mask != (*signalsInvolved)[iResult]) {
+      // not all input signals are taken into account
+      Int_t inputSignal = 0x1;
+      for (Int_t iSignal = 0; iSignal < inputWidth; iSignal++) {
+        if (!(inputSignal & (*signalsInvolved)[iResult])) {
+          Int_t newInvolvedSignalCombination = 
+            (*signalsInvolved)[iResult] | inputSignal;
+          Int_t newResult = inputSignal | (*results)[iResult];
+          Bool_t signalCombinationAlreadyEnlisted = kFALSE;
+          for (Int_t iEntry = 0; iEntry < signalsInvolved->GetSize(); iEntry++){
+            // this loop is needed to reduce the amount of equal entries in 
+            // signalsInvolved
+            // maybe a table with all possible input values could reduce the
+            // computional effort, but this would consume a lot of ram
+            if ((signalsInvolved->At(iEntry) == newInvolvedSignalCombination) &&
+               (results->At(iEntry) == newResult)) {
+              signalCombinationAlreadyEnlisted = kTRUE;
+              break;
+           }
+          }
+         if (!signalCombinationAlreadyEnlisted) {
+            results->Set(results->GetSize() + 1);
+            (*results)[results->GetSize() - 1] = inputSignal | 
+                                                 (*results)[iResult];
+            // add variant with active bit, variant with inactive signal
+            // is already containt in the results array
+
+            // update signalsInvolved:
+            signalsInvolved->Set(signalsInvolved->GetSize() + 1);
+            (*signalsInvolved)[signalsInvolved->GetSize() - 1] =
+              (*signalsInvolved)[iResult] | inputSignal;
+         }
+       }
+        inputSignal <<= 1; // move temp to the next input signal      
+      }      
+    }
+  }
+  return;
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgParam::GenerateLUTbasedOnEq(TString eq, Int_t inputWidth, 
+                                             Int_t initValue) {
+  // Processes the conversion of a logical equation to a look up table
+  
+  TArrayI* results = 0x0;
+  TArrayI* signalsInvolved = 0x0;
+  ConvertLogicalEqToBitVectors(eq, results, signalsInvolved);
+  // generate bit vectors
+
+  CheckSignalsInvolved(results, signalsInvolved, inputWidth);
+  // add bit vectors for signals which are not taken into account
+
+  Int_t lutSize =  0x1 << inputWidth; // 2^inputwidth elements
+  Int_t* resultingLUT = new Int_t[lutSize]; // create LUT
+  for (Int_t iLUTentry = 0; iLUTentry < lutSize; iLUTentry++) { // init LUT
+    resultingLUT[iLUTentry] = 0;
+  }
+  for (Int_t iEntry = 0; iEntry < results->GetSize(); iEntry++) {
+    resultingLUT[(*results)[iEntry]] = initValue;
+  }
+  
+  if (results != 0x0) {
+    delete results;
+    results = 0x0;
+  }
+  if (signalsInvolved != 0x0) {
+    delete signalsInvolved;
+    signalsInvolved = 0x0;
+  }
+  
+  return resultingLUT;
+}
+
+//______________________________________________________________________________
+//___ GETTER FUNCTIONS__________________________________________________________
+//______________________________________________________________________________
+UInt_t* AliTRDptrgParam::GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition)
+  const
+{
+  // get T0 FEB Thresholds
+  return this->fFEBT0Thresholds[FEBposition - 1];
+  // 0 kB, 1= kA, 2, kC => -1 because T0FEBs are only in position kA and kC
+}
+
+//_____________________________________________________________________________
+Int_t* AliTRDptrgParam::GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, 
+                                    Int_t iLUT) {
+  // get T0 FEB LUTs
+  if (this->fFEBT0LUTs == 0x0) {
+    this->GenerateLUTs();
+  }
+  return this->fFEBT0LUTs[FEBposition - 1][iLUT]; 
+  // 0 kB, 1= kA, 2, kC => -1 because T0FEBs are only in position kA and kC
+} 
+
+//______________________________________________________________________________
+UInt_t* AliTRDptrgParam::GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition,
+                                           Int_t iCard) const {
+  // get V0 FEB Thresholds
+  return this->fFEBV0Thresholds[FEBposition - 1][iCard];
+  // 0 kB, 1= kA, 2, kC => -1 because T0FEBs are only in position kA and kC
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgParam::GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, 
+                                    Int_t iCard, Int_t iLUT) {
+  // get V0 FEB LUTs
+  if (this->fFEBV0LUTs == 0x0) {
+    this->GenerateLUTs();
+  }
+  return this->fFEBV0LUTs[FEBposition - 1][iCard][iLUT];
+  // 0 kB, 1= kA, 2, kC => -1 because T0FEBs are only in position kA and kC
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgParam::GetCBLUT(UInt_t iCB, Int_t LUTid) {
+  // return control box LUT
+  // iCB: 0 = B, 1 = A, 2 = C
+  if (this->fCBLUTs == 0x0) {
+    this->GenerateLUTs();
+  }
+  return this->fCBLUTs[iCB][LUTid];
+}
+
diff --git a/TRD/AliTRDptrgParam.h b/TRD/AliTRDptrgParam.h
new file mode 100644 (file)
index 0000000..fbca0c5
--- /dev/null
@@ -0,0 +1,223 @@
+#ifndef ALITRDPTRGPARAM_H
+#define ALITRDPTRGPARAM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// --------------------------------------------------------
+// 
+// Singleton class to hold the parameters steering the PTRG 
+// 
+// --------------------------------------------------------
+#include "TObject.h"
+
+  enum AliTRDptrgFEBType_t{ kUndefined = (Int_t)0, 
+                            kTZERO = (Int_t)1, 
+                            kVZERO = (Int_t)2 };
+  enum AliTRDptrgOperatingMode_t{ kHits = (Int_t)0, kDigits = (Int_t)1 };
+  enum AliTRDptrgFEBPosition_t{ kB = (Int_t)0, 
+                                kA = (Int_t)1, 
+                                kC = (Int_t)2,
+                                kUnknown = (Int_t)3 };
+
+
+class AliTRDptrgParam : public TObject {
+ public:
+  struct AliTRDptrgPTmasks {
+    Bool_t fCBA[2]; // contribute CB-A look up results to pretrigger decision?
+    Bool_t fCBC[2]; // contribute CB-C look up results to pretrigger decision?
+    Bool_t fLUTs[2]; // CB-B look up results contribution to pretrigger decision
+    Bool_t fTLMU[8]; // TLMU output signal contribution to pretrigger decisions
+
+    AliTRDptrgPTmasks() {
+      fCBA[0] = kFALSE;
+      fCBA[1] = kFALSE;
+      fCBC[0] = kFALSE;
+      fCBC[1] = kFALSE;
+      fLUTs[0] = kFALSE;
+      fLUTs[1] = kFALSE;
+      for (Int_t i = 0; i < 8; i++) {
+        fTLMU[i] = kFALSE;
+      } 
+    }
+  };
+  virtual ~AliTRDptrgParam();
+
+  static AliTRDptrgParam *Instance(); // Singleton
+  static void Terminate();  // delete Singleton
+  
+  void LoadStandardConfiguration(); // initialize with standard values
+  Bool_t LoadConfigurationFromFile(TString filename); // load file 
+  
+  Int_t GenerateLUTs(); // generates all LUTs
+
+  // --- GETTER FUNCTIONS -----------------------------------------------------
+  // -- TLMU --
+  const UInt_t* GetTLMUInputMask() const { return this->fTLMUInputMask; };
+  // get TLMU input mask
+   
+  UInt_t** GetTLMUcmatrices() const { return this->fTLMUcmatrices; };
+  // get TLMU coincidence matrices
+  
+  UInt_t** GetTLMUmultiplicity() const { return this->fTLMUmultiplicity; };
+  // get TLMU multiplicity slices
+
+  Int_t** GetTLMUoutput() const { return this->fTLMUoutput; };
+  // get TLMU output mux configuration
+
+  // -- T0 --
+  UInt_t* GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition) const;
+  // get T0 FEB Thresholds
+
+  Int_t* GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iLUT); 
+  // get T0 FEB LUTs
+  // -- V0 --
+  UInt_t* GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard) const;
+  // get V0 FEB Thresholds
+
+  Int_t* GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard, 
+                     Int_t iLUT);
+  // get V0 FEB LUTs
+
+  Int_t* GetCBLUT(UInt_t CB, Int_t LUTid);
+  // returns the corresponding LUT (control boxes only)
+
+  const AliTRDptrgPTmasks* GetPTmasks() const { return &fPTmasks; };
+  // returns the list containing the information which CB-B inputs are masked
+  // out or forwarded as pre trigger output to the CTP
+
+
+  Int_t CheckVariables() const; // returns -1 if a variable is already deleted
+
+ protected:
+  UInt_t GetMultiplicity(UInt_t BitVector) const; 
+  // returns the multiplicity ('1's) 
+  
+  UInt_t GetMultiplicity(Int_t BitVector) const;  
+  // returns the multiplicity ('1's)
+
+  // helper functions for configuration file reading
+  // -----------------------------------------------
+  Bool_t ParseTLMU(TString identifier, TString value);
+  // parses the TLMU configuration parameters
+
+  Bool_t ParseCBB(TString identifier, TString value);
+  // parses the CBB configuration parameters
+  
+  Bool_t ParseCBAC(TString identifier, TString value);
+  // parses the CB-A and CB-C configuration parameters
+
+  Bool_t ParseFEB(TString identifier, TString value);
+  // parses the FEB configuration parameters
+
+  Bool_t ParseMultiplicityCondition(TString condition, UInt_t* threshold,
+                                    UInt_t* mask);
+  // parses a multiplicity condition "M(#mask#)>#threshold#"
+
+  UInt_t BinaryTStringToInt(TString number) const;
+  // converts TString containing a binary number to a unsigned integer
+
+  void SplitUpValues(TString value, TObjArray& arr);
+  // splits a value string which contains multiple values seperated by ' ' 
+  // and '\t'
+
+  TString CleanTString(TString string);
+  // removes ' ' and '\t' in a TString
+
+  void PrepareLine(TString line, TString& identifier, TString& value);
+  // divides identifier and value (seperator is the first ' ' or '\t'  
+
+  
+  // (helper) functions for conversion of logical equations into LUTs 
+  // ----------------------------------------------------------------
+  Int_t LookUp(TString* const identifier) const; // translates an identifier used in a
+  // logical equation into an address bit of the corresponding LUT
+  
+  void MergeResults(TArrayI*& partResult1, TArrayI*& partResult2, 
+                    TArrayI*& results, TArrayI*& signalsInvolved1, 
+                    TArrayI*& signalsInvolved2, TArrayI*& signalsInvolved,
+                    Bool_t useOR);
+  // merges the results of to logical equation parts
+  
+  void ConvertLogicalEqToBitVectors(TString eq, TArrayI*& results,
+                                    TArrayI*& signalsInvolved);
+  // converts logical equations to bit vectors
+  // neglected input signals are for now assumed to be 0!
+  
+  void CheckSignalsInvolved(TArrayI*& results, TArrayI*& signalsInvolved,
+                           Int_t inputWidth);
+  // adds all signal combinations needed to behave correctly in every state of
+  // neglected signals
+  
+  Int_t* GenerateLUTbasedOnEq(TString eq, Int_t inputWidth, Int_t initValue);
+  // generates a lut based on a logical functions (uses the functions above)
+
+  static AliTRDptrgParam *fgInstance; // instance pointer
+
+  // TLMU configuration --------------------------------------------------------
+  UInt_t fTLMUInputMask[18]; // masks TOF-to-TRD bits
+  UInt_t fTLMUInputStretch; // designates how long TLMU input is stretched   
+  UInt_t** fTLMUcmatrices; // [matrix][section] unsigned int values
+  // Bits 0..17 identify supermodules, bits equal 1 are checked for coincidence
+
+  UInt_t** fTLMUmultiplicity; // [slice][0 = lower bound, 1 = upper bound]
+  // use a lower bound above 576 to disable
+  
+  Int_t** fTLMUoutput; // [output][0 = cmatrix, 1 = multslice] 
+  // output bit assignment, -1 disables
+
+  // T0 ------------------------------------------------------------------------
+  // [position][channel] 12 channels at A and C side
+  UInt_t** fFEBT0Thresholds; // threshold for analog value discrimination
+  //UInt_t** fFEBT0Delays; // delay is not used in simulation right now //TODO
+  
+  // [position][LUT][0 = threshold, 1 = bitmask] 2 LUTs at A and C side  
+  UInt_t*** fFEBT0Multiplicities; // multiplicity threshold for T0
+  Int_t*** fFEBT0LUTs; // look up tables [position][LUT][entry]
+    
+  // V0 ------------------------------------------------------------------------
+  // [position][feb][channel] 4x8 channels per side (A and C)
+  UInt_t*** fFEBV0Thresholds; // threshold for analog value discrimation
+  //UInt_t** fFEBV0Delays; // delay is not used in simulation right now //TODO
+
+  // [position][feb][LUT][0 = threshold, 1 = bitmask] 2 LUTs per FEB 
+  // (4 per Side) at each side ( A and C)
+  UInt_t**** fFEBV0Multiplicities; // multiplicity threshold for V0   
+  Int_t**** fFEBV0LUTs; // look up tables [position][feb][LUT][entry] 
+
+  // CB-{A/B/C}
+  // 0 = B, 1 = A, 2 = C
+  Int_t*** fCBLUTs; // control box look up tables
+
+  // CB-A ----------------------------------------------------------------------
+  TString fCBALUTequX; // logical equation used for generation of LUT X of CB-A
+  TString fCBALUTequY; // logical equation used for generation of LUT Y of CB-A
+
+  // CB-C ----------------------------------------------------------------------
+  TString fCBCLUTequX; // logical equation used for generation of LUT X of CB-C
+  TString fCBCLUTequY; // logical equation used for generation of LUT Y of CB-C
+
+  // CBB -----------------------------------------------------------------------
+  TString fCBBLUTequX; // logical equation used for generation of LUT X of CB-B 
+  TString fCBBLUTequY; // logical equation used for generation of LUT Y of CB-B
+
+  // CTP -----------------------------------------------------------------------
+  // PT mask
+  AliTRDptrgPTmasks fPTmasks; 
+  // masks usage of internal signals for the pretrigger wake up signal
+                              
+
+  // CBB-LUT to TriggerInput assignment
+  
+  // class state ---------------------------------------------------------------
+
+ private:
+  AliTRDptrgParam();                        // instance only via Instance()
+  AliTRDptrgParam(const AliTRDptrgParam &rhs); // not implemented
+  AliTRDptrgParam& operator=(const AliTRDptrgParam &rhs); // not implemented
+
+  ClassDef(AliTRDptrgParam, 1);
+};
+#endif
diff --git a/TRD/AliTRDptrgParamConfigurationFile.txt b/TRD/AliTRDptrgParamConfigurationFile.txt
new file mode 100644 (file)
index 0000000..1406dff
--- /dev/null
@@ -0,0 +1,259 @@
+#
+# Pre-trigger run time parameter example file
+# which should be generated by PVSS tag editor panels 
+#
+
+# Configuration infos
+TAG 120
+REVISION 123
+TIMESTAMP/CREATION    YYYY-MM-DD hh:mm:ss    
+TIMESTAMP/LASTUPDATE  YYYY-MM-DD hh:mm:ss
+COMMENT example configuration (2010-03-31) changes according to PT meeting
+
+# TLMU input masks
+TLMU/IMASK/SEC00    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC01    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC02    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC03    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC04    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC05    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC06    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC07    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC08    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC09    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC10    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC11    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC12    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC13    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC14    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC15    1111_1111_1111_1111_1111_1111_1111_1111
+TLMU/IMASK/SEC17    1111_1111_1111_1111_1111_1111_1111_1111
+
+# How long input if stretched. Value can be 0 to 3 
+TLMU/STRETCH          1
+
+# Coincidence matrices set (there are three) (if not set, not activated)
+
+TLMU/CMATRIX0/SEC00 00_0000_0010_0000_0001
+TLMU/CMATRIX0/SEC01 00_0000_0100_0000_0010
+TLMU/CMATRIX0/SEC02 00_0000_1000_0000_0100
+TLMU/CMATRIX0/SEC03 00_0001_0000_0000_1000
+TLMU/CMATRIX0/SEC04 00_0010_0000_0001_0000
+TLMU/CMATRIX0/SEC05 00_0100_0000_0010_0000
+TLMU/CMATRIX0/SEC06 00_1000_0000_0100_0000
+TLMU/CMATRIX0/SEC07 01_0000_0000_1000_0000
+TLMU/CMATRIX0/SEC08 10_0000_0001_0000_0000
+
+TLMU/CMATRIX1/SEC00 00_0000_0111_0000_0001
+TLMU/CMATRIX1/SEC01 00_0000_1110_0000_0010
+TLMU/CMATRIX1/SEC02 00_0001_1100_0000_0100
+TLMU/CMATRIX1/SEC03 00_0011_1000_0000_1000
+TLMU/CMATRIX1/SEC04 00_0111_0000_0001_0000
+TLMU/CMATRIX1/SEC05 00_1110_0000_0010_0000
+TLMU/CMATRIX1/SEC06 01_1100_0000_0100_0000
+TLMU/CMATRIX1/SEC07 11_1000_0000_1000_0000
+TLMU/CMATRIX1/SEC08 11_0000_0001_0000_0001
+TLMU/CMATRIX1/SEC09 10_0000_0010_0000_0011
+TLMU/CMATRIX1/SEC10 00_0000_0100_0000_0111
+TLMU/CMATRIX1/SEC11 00_0000_1000_0000_1110
+TLMU/CMATRIX1/SEC12 00_0001_0000_0001_1100
+TLMU/CMATRIX1/SEC13 00_0010_0000_0011_1000
+TLMU/CMATRIX1/SEC14 00_0100_0000_0111_0000
+TLMU/CMATRIX1/SEC15 00_1000_0000_1110_0000
+TLMU/CMATRIX1/SEC16 01_0000_0001_1100_0000
+TLMU/CMATRIX1/SEC17 10_0000_0011_1000_0000
+
+
+TLMU/CMATRIX2/SEC00 00_0000_1111_1000_0001
+TLMU/CMATRIX2/SEC01 00_0001_1111_0000_0010
+TLMU/CMATRIX2/SEC02 00_0011_1110_0000_0100
+TLMU/CMATRIX2/SEC03 00_0111_1100_0000_1000
+TLMU/CMATRIX2/SEC04 00_1111_1000_0001_0000
+TLMU/CMATRIX2/SEC05 01_1111_0000_0010_0000
+TLMU/CMATRIX2/SEC06 11_1110_0000_0100_0000
+TLMU/CMATRIX2/SEC07 11_1100_0000_1000_0001
+TLMU/CMATRIX2/SEC08 11_1000_0001_0000_0011
+TLMU/CMATRIX2/SEC09 11_0000_0010_0000_0111
+TLMU/CMATRIX2/SEC10 10_0000_0100_0000_1111
+TLMU/CMATRIX2/SEC11 00_0000_1000_0001_1111
+TLMU/CMATRIX2/SEC12 00_0001_0000_0011_1110
+TLMU/CMATRIX2/SEC13 00_0010_0000_0111_1100
+TLMU/CMATRIX2/SEC14 00_0100_0000_1111_1000
+TLMU/CMATRIX2/SEC15 00_1000_0001_1111_0000
+TLMU/CMATRIX2/SEC16 01_0000_0011_1110_0000
+TLMU/CMATRIX2/SEC17 10_0000_0111_1100_0000
+
+
+# Multiplicity counter setup (where to slice) . 
+# there are 9 slices with lower and upper thresholds
+TLMU/MCNTR0/THR   5  20
+TLMU/MCNTR1/THR  20 100
+TLMU/MCNTR2/THR 100 200
+TLMU/MCNTR3/THR 200 300
+TLMU/MCNTR4/THR 300 400
+TLMU/MCNTR5/THR 400 500
+TLMU/MCNTR6/THR 500 520
+TLMU/MCNTR7/THR 520 540
+TLMU/MCNTR8/THR 540 999
+
+
+# Assign signal to output. CM means CMATRIX and MC means Multiplicity counter
+# SEQ [0..4] means trigger sequencer. NONE will not assign anything 
+#
+#   channel          0    1    2    3    4    5    6    7
+TLMU/OUTMUX         CM1  MC2  MC3  MC4  MC5  MC6  MC7  MC8
+
+# FEBs
+
+# basically thresholds and delay (T0 has 12 channels, and V0 has 8 channels)
+# V0 has 4 sections named V0, V1, V2, V3
+# Delay is 0 to 31, with 1/4 BC precision (max delay is then 8 BCs)
+# The value can take here is from 0 to 255 for threshold and 0 to 31 for delay
+
+FEB/T0/A/THR               10  10  10  10  10  10  10  10  10  10  10  10
+FEB/T0/A/DELAY              1   1   1   1   1   1   1   1   1   1   1   1
+FEB/T0/C/THR               10  10  10  10  10  10  10  10  10  10  10  10
+FEB/T0/C/DELAY              1   1   1   1   1   1   1   1   1   1   1   1
+
+FEB/V0/A0/THR              10  10  10  10  10  10  10  10
+FEB/V0/A1/THR              10  10  10  10  10  10  10  10
+FEB/V0/A2/THR              10  10  10  10  10  10  10  10
+FEB/V0/A3/THR              10  10  10  10  10  10  10  10
+
+FEB/V0/A0/DELAY             1   1   1   1   1   1   1   1
+FEB/V0/A1/DELAY             1   1   1   1   1   1   1   1
+FEB/V0/A2/DELAY             1   1   1   1   1   1   1   1
+FEB/V0/A3/DELAY             1   1   1   1   1   1   1   1
+
+FEB/V0/C0/THR              10  10  10  10  10  10  10  10
+FEB/V0/C1/THR              10  10  10  10  10  10  10  10
+FEB/V0/C2/THR              10  10  10  10  10  10  10  10
+FEB/V0/C3/THR              10  10  10  10  10  10  10  10
+
+FEB/V0/C0/DELAY             1   1   1   1   1   1   1   1
+FEB/V0/C1/DELAY             1   1   1   1   1   1   1   1
+FEB/V0/C2/DELAY             1   1   1   1   1   1   1   1
+FEB/V0/C3/DELAY             1   1   1   1   1   1   1   1
+
+# Lookup table at FEB
+
+FEB/T0/A/LUT/0               M(1111_1111_1111)>0  # maybe also logical equations
+FEB/T0/A/LUT/1               M(1111_1111_1111)>4
+
+FEB/V0/A0/LUT/0              M(1111_1111)>0
+FEB/V0/A0/LUT/1              M(1111_1111)>2
+FEB/V0/A1/LUT/0              M(1111_1111)>0
+FEB/V0/A1/LUT/1              M(1111_1111)>2
+FEB/V0/A2/LUT/0              M(1111_1111)>0
+FEB/V0/A2/LUT/1              M(1111_1111)>2
+FEB/V0/A3/LUT/0              M(1111_1111)>0
+FEB/V0/A3/LUT/1              M(1111_1111)>2
+
+FEB/T0/C/LUT/0               M(1111_1111_1111)>0
+FEB/T0/C/LUT/1               M(1111_1111_1111)>4
+
+FEB/V0/C0/LUT/0              M(1111_1111)>0
+FEB/V0/C0/LUT/1              M(1111_1111)>2
+FEB/V0/C1/LUT/0              M(1111_1111)>0
+FEB/V0/C1/LUT/1              M(1111_1111)>2
+FEB/V0/C2/LUT/0              M(1111_1111)>0
+FEB/V0/C2/LUT/1              M(1111_1111)>2
+FEB/V0/C3/LUT/0              M(1111_1111)>0
+FEB/V0/C3/LUT/1              M(1111_1111)>2
+
+# Lookup table at CB-AC
+
+CBA/LUT/0               T0_0 || ( V0-0_0 || V0-1_0 || V0-2_0 || V0-3_0 )
+CBA/LUT/1               !T0_1 && !V0-0_1 && !V0-1_1 && !V0-2_1 && !V0-3_1 
+
+CBC/LUT/0               T0_0 || ( V0-0_0 || V0-1_0 || V0-2_0 || V0-3_0 )
+CBC/LUT/1               !T0_1 && !V0-0_1 && !V0-1_1 && !V0-2_1 && !V0-3_1 
+
+# Lookup table at CB-B
+
+CBB/LUT/0               ( !CB-A_1 || !CB-C_1 ) && TLMU_7
+CBB/LUT/1               ( !CB-A_1 && !CB-C_1 ) && TLMU_7
+
+# Timing parameter for trigger processor
+
+CBB/TRG/L0A            43 # comment
+CBB/TRG/L0S            47
+CBB/TRG/L1A            308
+CBB/TRG/L1S            311
+CBB/TRG/DEAD/PT                200
+CBB/TRG/DEAD/L0                350
+CBB/TRG/DEAD/L1                500
+CBB/TRG/DELAY/L0       46
+
+CBB/TRG/CTRL/SM_TO_CTP YES
+CBB/TRG/CTRL/TRG_EMU   YES
+CBB/TRG/CTRL/A/VALUE   0
+CBB/TRG/CTRL/A/OVR     NO
+CBB/TRG/CTRL/B/VALUE   0
+CBB/TRG/CTRL/B/OVR     NO
+
+CBB/TRG/A/DIS          YES # do not change!
+
+CBB/TRG/TIN/0          0 # normal triggering (should be 0!)
+CBB/TRG/TIN/1          0 # normal triggering (should be 0!)
+
+CBB/PT/CBA/SAMPL       0
+CBB/PT/CBC/SAMPL       0
+
+
+CBB/PT/ALIGN/CB-A_0/STRETCH    0
+CBB/PT/ALIGN/CB-A_0/DELAY      0
+CBB/PT/ALIGN/CB-A_1/STRETCH    0
+CBB/PT/ALIGN/CB-A_1/DELAY      0
+CBB/PT/ALIGN/CB-C_0/STRETCH    0
+CBB/PT/ALIGN/CB-C_0/DELAY      0
+CBB/PT/ALIGN/CB-C_1/STRETCH    0
+CBB/PT/ALIGN/CB-C_1/DELAY      0
+CBB/PT/ALIGN/RND/STRETCH       0
+CBB/PT/ALIGN/RND/DELAY         0
+CBB/PT/ALIGN/BC/STRETCH                0
+CBB/PT/ALIGN/BC/DELAY          0
+CBB/PT/ALIGN/TLMU_0/STRETCH    0
+CBB/PT/ALIGN/TLMU_0/DELAY      0
+CBB/PT/ALIGN/TLMU_1/STRETCH    0
+CBB/PT/ALIGN/TLMU_1/DELAY      0
+CBB/PT/ALIGN/TLMU_2/STRETCH    0
+CBB/PT/ALIGN/TLMU_2/DELAY      0
+CBB/PT/ALIGN/TLMU_3/STRETCH    0
+CBB/PT/ALIGN/TLMU_3/DELAY      0
+CBB/PT/ALIGN/TLMU_4/STRETCH    0
+CBB/PT/ACBB/LIGN/TLMU_4/DELAY  0
+CBB/PT/ALIGN/TLMU_5/STRETCH    0
+CBB/PT/ALIGN/TLMU_5/DELAY      0
+CBB/PT/ALIGN/TLMU_6/STRETCH    0
+CBB/PT/ALIGN/TLMU_6/DELAY      0
+CBB/PT/ALIGN/TLMU_7/STRETCH    0
+CBB/PT/ALIGN/TLMU_7/DELAY      0
+CBB/PT/ALIGN/CB-B_0/STRETCH    0
+CBB/PT/ALIGN/CB-B_0/DELAY      0
+CBB/PT/ALIGN/CB-B_1/STRETCH    0
+CBB/PT/ALIGN/CB-B_1/DELAY      0
+
+CBB/BUSY/CTRL                  0
+
+CBB/RND/THR                    150000
+CBB/BC/RESET_VALUE             222
+
+CBB/PT/MASK/CB-A_0             YES
+CBB/PT/MASK/CB-A_1             YES
+CBB/PT/MASK/CB-C_0             YES
+CBB/PT/MASK/CB-C_1             YES
+CBB/PT/MASK/RND                        YES
+CBB/PT/MASK/BC                 YES
+CBB/PT/MASK/TLMU_0             YES
+CBB/PT/MASK/TLMU_1             YES
+CBB/PT/MASK/TLMU_2             YES
+CBB/PT/MASK/TLMU_3             YES
+CBB/PT/MASK/TLMU_4             YES
+CBB/PT/MASK/TLMU_5             YES
+CBB/PT/MASK/TLMU_6             YES
+CBB/PT/MASK/TLMU_7             YES
+CBB/PT/MASK/CB-B_0             YES
+CBB/PT/MASK/CB-B_1             YES
+
+# EOF
diff --git a/TRD/AliTRDptrgTLMU.cxx b/TRD/AliTRDptrgTLMU.cxx
new file mode 100644 (file)
index 0000000..c1c3ff2
--- /dev/null
@@ -0,0 +1,380 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Pre-Trigger simulation                                                //
+//                                                                        //
+//  Authors: F. Reidt (Felix.Reidt@cern.ch)                               //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include "TFile.h"
+#include "TROOT.h"
+
+#include "TClonesArray.h"
+
+#include "AliRun.h"
+#include "AliRunLoader.h"
+
+#include "../TOF/AliTOFdigit.h"
+#include "../RAW/AliRawReader.h" // needed for AliTOFTrigger's raw digit support
+#include "../TOF/AliTOFTrigger.h"
+
+#include "AliTRDptrgParam.h"
+
+#include "AliTRDptrgTLMU.h"
+
+ClassImp(AliTRDptrgTLMU)
+
+//______________________________________________________________________________
+AliTRDptrgTLMU::AliTRDptrgTLMU(AliRunLoader *rl) 
+  : TObject(),
+  fRunLoader(rl),
+  fParam(0x0),
+  fOperatingMode(kDigits),
+  fInputMask(0x0),
+  fCMatrices(0x0),
+  fMultiplicity(0x0),
+  fOutput(0x0) 
+{
+  // default ctor
+  for (Int_t i = 0; i < 18; i++) {
+    this->fInputTOFinputBits[i] = 0;
+  }
+}
+
+//______________________________________________________________________________
+AliTRDptrgTLMU::AliTRDptrgTLMU(AliRunLoader *rl,  AliTRDptrgParam *param,
+                               AliTRDptrgOperatingMode_t operatingMode)
+  : TObject(),
+  fRunLoader(rl),
+  fParam(param),
+  fOperatingMode(operatingMode),
+  fInputMask(0x0),
+  fCMatrices(0x0),
+  fMultiplicity(0x0),
+  fOutput(0x0) 
+{
+  // recommended ctor
+  
+  for (Int_t i = 0; i < 18; i++) {
+    this->fInputTOFinputBits[i] = 0;
+  }
+  this->LoadParams();
+}
+
+//______________________________________________________________________________
+AliTRDptrgTLMU::~AliTRDptrgTLMU() 
+{
+  // destructor
+  
+  this->fCMatrices = 0x0;
+  this->fMultiplicity = 0x0;
+  this->fOutput = 0x0;
+}
+
+//______________________________________________________________________________
+Int_t* AliTRDptrgTLMU::Simulate() 
+{
+  // starts a simulation
+       
+  if (this->fOperatingMode == kDigits) {
+    this->LoadDigits();
+  }    
+  else if (this->fOperatingMode == kHits) {
+    return 0x0; // TODO
+  }
+
+  // which super modules are active? - needed for fast coincidence processing:  
+  // M(sm | coincidence condition)>=2
+  UInt_t temp = 0x1;
+  UInt_t sm = 0x0; 
+  for (Int_t iSM = 0; iSM < 18; iSM++) {
+    if (this->Or(iSM)) {
+      sm |= temp;
+    }
+    temp <<= 1;
+  }
+  AliDebug(4, Form("Active supermodules: 0x%x", sm));
+
+  // get multiplicity
+  UInt_t multiplicity = this->GetMultiplicitySum();
+  AliDebug(4, Form("TOF/TLMU multiplicity: %d", multiplicity));        
+
+  Int_t* result = new Int_t[9]; 
+  result[0] = 8;
+  for (Int_t iResult = 0; iResult < 8; iResult++) {
+    result[iResult + 1] = 0;
+
+    // coincidence matrix
+    if (this->fOutput[iResult][0] != -1) {
+      for (Int_t iLine = 0; iLine < 18; iLine++) {
+        if (this->GetBitVectorMultiplicity(
+            sm | this->fCMatrices[this->fOutput[iResult][0]][iLine]) > 1) {
+         result[iResult + 1] = 1;
+          break;
+       }        
+      }
+    }
+    
+    // multiplicity conditions
+    if (this->fOutput[iResult][1] != -1) {
+      AliDebug(5, Form("Entry %d, slice: %d", iResult, 
+                       this->fOutput[iResult][1]));
+      if ((this->fMultiplicity[this->fOutput[iResult][1]][0] < multiplicity) &&
+          (this->fMultiplicity[this->fOutput[iResult][1]][1] >= multiplicity)) {
+        result[iResult + 1] = 1;
+      } 
+    }
+    AliDebug(4, Form("TLMU result[%d] = %d", iResult, result[iResult + 1]));
+  }
+
+  return result;
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgTLMU::LoadDigits()
+{
+  // loads Digits (for usage with aquired data)
+  this->GetInputBits(); // get bits from AliTOFTrigger
+  return 0;
+}
+
+
+//______________________________________________________________________________
+Bool_t AliTRDptrgTLMU::LoadParams()
+{
+  // load AliTRDprtgParam content
+       
+  if (this->fParam == 0x0) {
+    // no parameter object assigned
+    AliWarning("no parameter object assigned - using default settings!");
+
+    AliError("no default settings available!");
+    // TODO
+  }
+  else {
+    // parameter object assigned
+    
+    this->fInputMask = this->fParam->GetTLMUInputMask(); 
+    // input mask for TOF-bits (18x32=576)
+    
+    this->fCMatrices = this->fParam->GetTLMUcmatrices();
+    // get coincidence matrices
+    this->fMultiplicity = this->fParam->GetTLMUmultiplicity();
+    // get multiplicity slices
+  
+    this->fOutput = this->fParam->GetTLMUoutput();
+    // get output signal assignment
+  }
+
+  return false;
+}
+
+//______________________________________________________________________________
+void AliTRDptrgTLMU::GetInputBits() {
+  // Gets TOF-to-TRD input bits from AliTOFTrigger as Bool_t array
+
+  AliTOFTrigger *toftrig = new AliTOFTrigger(); // create AliTOFTrigger 
+  toftrig->CreateLTMMatrixFromDigits(); // Generate LTMMatrix from AliTOFdigits
+  
+  // prepare map  
+  Bool_t** map = 0x0;
+  map = new Bool_t*[72];
+  for (Int_t i=0; i < 72; i++) 
+    map[i] = new Bool_t[8];
+  
+  // initialise map
+  for (Int_t i=0; i < 72; i++)
+    for (Int_t j=0; j < 8; j++)
+      map[i][j] = 0;
+
+  // get 576 TOF-to-TRD bits
+  toftrig->GetTRDmap(map);
+
+  /* DEBUG output 
+  // used to determine the correct bit assignment
+  for (Int_t i=0; i < 72; i++) {
+    AliDebug(5, Form("%d ", i));
+    for (Int_t j=7; j >= 0; j--) {
+      AliDebug(5, Form("%d", map[i][j])); 
+    }
+  }
+  //*/ // end of DEBUG output
+  
+  // transform Bool_t array to UInt_t bitvectors according to
+  // http://www.physi.uni-heidelberg.de/~schicker/cbtof/cbtof_docu.pdf
+  // chapter 1.4 and 2.1 to a supermodule based structured 
+  // integer (bit) array
+  Int_t supermodule = -1;
+  UInt_t tempA = 0x00000001;
+  UInt_t tempC = 0x00010000;
+  for (Int_t iLTM = 0; iLTM < (kNLTM / 2); iLTM++) {
+    if (!(iLTM % 2)) { // renew temp vectors, update supermodule
+      tempA = 0x00000001;
+      tempC = 0x00010000;
+      supermodule++;
+    }
+    AliDebug(5, Form("(%2d,0x%8x,0x%8x)", iLTM, tempA, tempC));
+    for (Int_t iLTMchan = 0; iLTMchan < 8; iLTMchan++) {
+      // A-side
+      if (map[iLTM][iLTMchan]) {
+        this->fInputTOFinputBits[supermodule] |= tempA;        
+      }
+      // C-side
+      if (map[iLTM + 36][iLTMchan]) {
+        this->fInputTOFinputBits[supermodule] |= tempC;
+      }
+      // change temp vectors
+      tempA <<= 1;
+      tempC <<= 1;
+    }
+  }
+
+  // handle input mask
+  for (Int_t iSM = 0; iSM < 18; iSM++) {
+    AliDebug(5, Form("fInputTOFinputBits[%d]=0x%x", iSM, 
+             this->fInputTOFinputBits[iSM]));
+    this->fInputTOFinputBits[iSM] &= this->fInputMask[iSM];
+  }
+}
+
+
+//______________________________________________________________________________
+Int_t AliTRDptrgTLMU::BackToBack(Int_t iSM, Int_t range) {
+  // Check whether there is an back-to-back particle trace
+
+  // get the counterpart of supermodule iSM
+  Int_t counterPart = -1;
+  if (iSM >= 9) { 
+    counterPart = iSM - 9;
+  }
+  else  {
+    counterPart = iSM + 9;
+  }
+
+  if (this->Or(iSM)) { // is there are active bits in supermodule iSM
+    Int_t result = 0;
+    for (Int_t i = counterPart - range; i <= counterPart + range; i++) {
+      // TODO WARNING: There are possible Errors with sm0 +-range!
+      // check whether there are active bits in supermodule i (counterParts)
+      if ((i >= 0) && (i < 18)) {
+        if (Or(i)) {
+          result++;
+        }
+      }
+      else {
+       if (i < 0) {
+          if (Or(17 - i)) {
+            result++;
+          }
+        }
+        if (i > 17) {
+          if (Or(i - 18)) {
+            result++;
+          }
+        }
+      }
+    }
+    AliDebug(5, Form("BackToBack of %d and %d+-%d\n: %d", iSM, counterPart, 
+                     range, result));
+    return result; // return whether there was a possible back-to-back trace
+  }    
+  else {
+    AliDebug(5, Form("BackToBack unsuccessful, not hit in sm%d", iSM));
+    return 0; // iSM did not recognize anything
+  }
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgTLMU::Coincidence(Int_t iSM1, Int_t iSM2) {
+  // checks whether there is an coincidence in iSM1 and iSM2
+
+  if (this->Or(iSM1) && this->Or(iSM2)) {
+    return 1;
+  }
+  else
+    return 0;
+}
+
+//______________________________________________________________________________
+inline Int_t AliTRDptrgTLMU::Or(Int_t  iSM) {
+  // returns 1 if one or more bits are active in supermodule iSM
+  if ((iSM >= 0) && (iSM < 18)) {
+    if (this->fInputTOFinputBits[iSM] > 0)
+      return 1;
+    else
+      return 0; 
+  }
+  else {
+    return -1;
+  }
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgTLMU::GetMultiplicity(Int_t iSM) {
+  // counts how many bits equal one are in class member fInputTOFinputBits[iSM]
+  // (32bits from TOF to TRD of supermodule iSM)
+
+  UInt_t temp = this->fInputTOFinputBits[iSM];
+  UInt_t mask = 0x01;
+  Int_t multiplicity = 0;  
+       
+  // TODO maybe there is a more efficient way to do that?
+  for (int iBit = 0; iBit < 32; iBit++) {
+    if ((mask & temp) != 0x0) { // is the bit equal one?
+      multiplicity++;
+    }
+    mask <<= 1; // rotate mask to the left after each iteration
+  }
+  AliDebug(5, Form("Multiplicity of supermodule %d: %d", iSM, multiplicity));
+  return multiplicity;
+}
+
+//______________________________________________________________________________
+Int_t AliTRDptrgTLMU::GetMultiplicitySum() {
+  // returns the multiplicity of the whole detector (all 576bit TOF to TRD bits)
+  Int_t sum = 0;
+  
+  for (Int_t i = 0; i < 18; i++) {
+    sum += this->GetMultiplicity(i);
+  }
+  AliDebug(5, Form("Whole multiplicity: %d", sum));
+  return sum;
+}
+
+//______________________________________________________________________________
+UInt_t AliTRDptrgTLMU::GetBitVectorMultiplicity(UInt_t BitVector) {
+  // returns the multiplicity of a given bit vector
+  
+  UInt_t result = 0;
+  UInt_t temp = 0x01;
+  for (UInt_t iBit = 0; iBit < 32; iBit++) {
+    if (BitVector & temp) {
+      result++;
+    }
+    temp <<= 1;
+  }
+
+  return result;
+}
diff --git a/TRD/AliTRDptrgTLMU.h b/TRD/AliTRDptrgTLMU.h
new file mode 100644 (file)
index 0000000..eb858ea
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef AliTRDPTRGTLMU_H
+#define AliTRDPTRGTLMU_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// --------------------------------------------------------
+// 
+// PTRG simulation
+//
+// --------------------------------------------------------
+
+#include "TObject.h"
+#include "AliTRDptrgParam.h"
+
+class AliRunLoader;
+
+class AliTRDptrgParam;
+
+class AliTRDptrgTLMU : public TObject {
+ public:
+  AliTRDptrgTLMU(AliRunLoader *rl = 0x0);
+  AliTRDptrgTLMU(AliRunLoader *rl,  AliTRDptrgParam *param, 
+                 AliTRDptrgOperatingMode_t operatingMode);
+  ~AliTRDptrgTLMU();
+
+  Int_t* Simulate(); // starts a simulation
+  
+
+ protected:
+  Bool_t LoadParams(); // load AliTRDprtgParam content
+  
+  // functions for input data processing ---------------------------------------
+  Int_t LoadDigits(); // loads Digits (for usage with aquired data)
+  void GetInputBits(); // Gets TOF-to-TRD bits from AliTOFTrigger
+
+  // logical functions ---------------------------------------------------------
+  Int_t BackToBack(Int_t iSM, Int_t range = 0); // Back-To-Back check
+  // (for +-1 and so on) SM0 and SM8, SM9, SM10 (range == 1)
+  Int_t Coincidence(Int_t iSM1, Int_t iSM2); // more flexible version of 
+  // BackToBack(..)
+  inline Int_t Or(Int_t iSM); // returns >=1 for iSM
+  Int_t GetMultiplicity(Int_t iSM);  // returns multiplicity of supermodule iSM 
+  Int_t GetMultiplicitySum(); // returns the multiplicity of the whole detector
+
+  UInt_t GetBitVectorMultiplicity(UInt_t BitVector); 
+  // returns the multiplicity of a bit vector
+
+  // variables -----------------------------------------------------------------
+  AliRunLoader *fRunLoader;  //!
+  AliTRDptrgParam *fParam; // Configuration parameter object
+  AliTRDptrgOperatingMode_t fOperatingMode; // working on Digits or Hits?
+  
+  const UInt_t* fInputMask; // input mask for TOF-bits (18x32=576)
+  UInt_t fInputTOFinputBits[18]; // input bits from TOF (18x32)
+  
+  UInt_t** fCMatrices;    // get coincidence matrices
+  UInt_t** fMultiplicity;    // get multiplicity slices
+  Int_t** fOutput;    // get output signal assignment
+  
+ private:
+  AliTRDptrgTLMU& operator=(const AliTRDptrgTLMU &rhs); // not implemented
+  AliTRDptrgTLMU(const AliTRDptrgTLMU &rhs); // not implemented
+
+  enum{
+    kNLTM = 72,          //Number of LTM
+    kNLTMchannels = 48,  //Number of channels in a LTM
+    kNCTTM = 36,         //Number of CTTM per TOF side
+    kNCTTMchannels = 24  //Number of channels in a CTTM
+  };
+
+  ClassDef(AliTRDptrgTLMU, 1);
+};
+
+#endif
index d1c2780..50e6cc4 100644 (file)
 #pragma link C++ class  AliTRDgtuTMU+;
 #pragma link C++ class  AliTRDtrackGTU+;
 
+#pragma link C++ class  AliTRDptrgFEB+;
+#pragma link C++ class  AliTRDptrgLUT+;
+#pragma link C++ class  AliTRDptrgCBAC+;
+#pragma link C++ class  AliTRDptrgCBB+;
+#pragma link C++ class  AliTRDptrgTLMU+;
+
 #pragma link C++ class  AliTRDhit+;
 
 #pragma link C++ class  AliTRDrecoParam+;
 #pragma link C++ class  AliTRDSimParam+;
+#pragma link C++ class  AliTRDptrgParam+;
 #endif
index 6d6ba61..a656545 100644 (file)
@@ -62,9 +62,15 @@ SRCS= AliTRDarraySignal.cxx \
       AliTRDtrackletWord.cxx \
       AliTRDgtuSim.cxx \
       AliTRDgtuTMU.cxx \
+      AliTRDptrgFEB.cxx \
+      AliTRDptrgLUT.cxx \
+      AliTRDptrgCBB.cxx \
+      AliTRDptrgCBAC.cxx \
+      AliTRDptrgTLMU.cxx \
       AliTRDhit.cxx \
       AliTRDrecoParam.cxx \
       AliTRDSimParam.cxx \
+      AliTRDptrgParam.cxx \
 
 HDRS= $(SRCS:.cxx=.h)