]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDptrgCBB.cxx
Changes needed for evaporation and fragmentation
[u/mrichter/AliRoot.git] / TRD / AliTRDptrgCBB.cxx
index c91c4f82019bfc34011a203f338e11ba0d33f10c..d4cd9a1c93802434b77ce7b4319b24be95c68944 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliTRDptrgCBAC.h"
 #include "AliTRDptrgTLMU.h"
 #include "AliTRDptrgCBB.h"
+#include "AliLog.h"
 ClassImp(AliTRDptrgCBB)
 
 AliTRDptrgCBB::AliTRDptrgCBB(AliRunLoader *rl) 
@@ -113,7 +114,13 @@ Bool_t AliTRDptrgCBB::LoadParams()
     // 1
     LUT = new AliTRDptrgLUT();
     LUT->InitTable(12, 12, this->fParam->GetCBLUT(0, 1), kFALSE);
-    // get CB-B_0 and do not copy lut content
+    // get CB-B_1 and do not copy lut content
+    this->fLUTArray.AddLast(LUT);
+
+    // 2
+    LUT = new AliTRDptrgLUT();
+    LUT->InitTable(12, 12, this->fParam->GetCBLUT(0, 2), kFALSE);
+    // get CB-B_2 and do not copy lut content
     this->fLUTArray.AddLast(LUT);
 
     // masks
@@ -122,27 +129,43 @@ Bool_t AliTRDptrgCBB::LoadParams()
   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);
+    AliTRDptrgLUT* lut = new AliTRDptrgLUT();
+    this->fLUTArray.AddLast(lut);
+    lut = new AliTRDptrgLUT(); // this->fRunLoader
+    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 = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+    if (lut) {
+      for (Int_t i = 0; i < 4096; i++ ) {
+        initData[i] = i;
+      }
+      lut->InitTable(12, 12, initData, kTRUE); // make a copy
     }
-    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 = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+    if (lut) {
+      for (Int_t i = 0; i < 4096; i++ ) {
+        initData[i] = i;
+      }
+      lut->InitTable(12, 12, initData, kTRUE); // make a copy
     }
-    LUT->InitTable(12, 12, initData, kTRUE); // make a copy 
-  
+    lut = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(1));
+    if (lut) {
+      //for (Int_t i = 4096; i >= 0; i--) {
+      for (Int_t i = 4096; i > 0; i--) {
+        initData[4096 - i] = i;  // inverse ramp
+      }
+      lut->InitTable(12, 12, initData, kTRUE); // make a copy 
+    }
+    delete [] initData;
+
     AliTRDptrgParam::AliTRDptrgPTmasks* masks = 
       new AliTRDptrgParam::AliTRDptrgPTmasks();  
     masks->fLUTs[0] = kTRUE;
     masks->fLUTs[1] = kTRUE;
+    masks->fLUTs[2] = kTRUE;
     this->fPTmasks = masks;
   }  
   return false;
@@ -170,9 +193,7 @@ Int_t* AliTRDptrgCBB::Simulate()
   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++) {
@@ -190,8 +211,10 @@ Int_t* AliTRDptrgCBB::Simulate()
   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);
+    AliTRDptrgLUT *lutTmp = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray[iLUT]);
+    if (lutTmp) {
+      result[iLUT + 1] = lutTmp->LookUp(inputVector);
+    }
     AliDebug(4, Form("CBB result[%d] = 0x%x\n",(iLUT + 1),result[iLUT + 1])); 
   }
   
@@ -213,6 +236,10 @@ Int_t* AliTRDptrgCBB::Simulate()
       result[nLUTs + 1]++;
     }       
   }
+  if (this->fPTmasks->fLUTs[2] && result[3]) { // CB-B (third own LUT)
+    result[nLUTs + 1]++;
+  }
+
   // TLMU
   for (Int_t i = 0; i < 8; i++) {
     if (this->fPTmasks->fTLMU[i] && partResults[2][i + 1]) {
@@ -220,7 +247,11 @@ Int_t* AliTRDptrgCBB::Simulate()
     }
   }
   AliDebug(4, Form("CBB TRD Wake up result = %d", result[nLUTs + 1]));
+
+  delete [] partResults;
+
   return result;
+
 }
 
 //______________________________________________________________________________