]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDptrgParam.cxx
Patch for AOD to keep the extrapolated pT at
[u/mrichter/AliRoot.git] / TRD / AliTRDptrgParam.cxx
index bd8b1875a0c4e5b40f1bc480a34d74074e7a9454..59675b04586d2925a24cd71e8537008fbc0020dc 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "AliTRDptrgParam.h"
 
+using std::ifstream;
 ClassImp(AliTRDptrgParam)
 
 AliTRDptrgParam *AliTRDptrgParam::fgInstance = 0;
@@ -1106,8 +1107,10 @@ Bool_t AliTRDptrgParam::ParseFEB(TString identifier, TString value) {
       return kFALSE; 
     }
     for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
-      this->fFEBT0Thresholds[0][iValue] =  
-        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      TObjString *ostrng = dynamic_cast<TObjString*>(arr[iValue]);
+      if (ostrng) {
+        this->fFEBT0Thresholds[0][iValue] = (ostrng->GetString()).Atoi();
+      }
       AliDebug(5, Form("FEB/T0/A/THR[%d]=%d", iValue, 
                        this->fFEBT0Thresholds[0][iValue])); 
     }
@@ -1127,8 +1130,10 @@ Bool_t AliTRDptrgParam::ParseFEB(TString identifier, TString value) {
       return kFALSE; 
     }
     for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
-      this->fFEBT0Thresholds[1][iValue] =  
-        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      TObjString *ostrng = dynamic_cast<TObjString*>(arr[iValue]);
+      if (ostrng) {
+        this->fFEBT0Thresholds[1][iValue] = (ostrng->GetString()).Atoi();
+      }
       AliDebug(5, Form("FEB/T0/C/THR[%d]=%d", iValue, 
                        this->fFEBT0Thresholds[1][iValue])); 
     }
@@ -1154,8 +1159,11 @@ Bool_t AliTRDptrgParam::ParseFEB(TString identifier, TString value) {
       return kFALSE; 
     }
     for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
-      this->fFEBV0Thresholds[0][cardID][iValue] =  
-        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      TObjString *ostrng = dynamic_cast<TObjString*>(arr[iValue]);
+      if (ostrng) {
+        this->fFEBV0Thresholds[0][cardID][iValue] =  
+          (ostrng->GetString()).Atoi();
+      }
       AliDebug(5, Form("FEB/V0/A%d/THR[%d]=%d", cardID, iValue, 
                        this->fFEBV0Thresholds[0][cardID][iValue])); 
     }
@@ -1180,8 +1188,10 @@ Bool_t AliTRDptrgParam::ParseFEB(TString identifier, TString value) {
       return kFALSE; 
     }
     for (Int_t iValue = 0; iValue < arr.GetEntries(); iValue++) {
-      this->fFEBV0Thresholds[1][cardID][iValue] =  
-        (dynamic_cast<TObjString*>(arr[iValue])->GetString()).Atoi();
+      TObjString *ostrng = dynamic_cast<TObjString*>(arr[iValue]);
+      if (ostrng) {
+        this->fFEBV0Thresholds[1][cardID][iValue] = (ostrng->GetString()).Atoi();
+      }
       AliDebug(5, Form("FEB/V0/C%d/THR[%d]=%d", cardID, iValue, 
                        this->fFEBV0Thresholds[1][cardID][iValue])); 
     }
@@ -1457,14 +1467,21 @@ Bool_t AliTRDptrgParam::ParseTLMU(TString identifier, TString value) {
 
     SplitUpValues(value, arr);
     
-    TString t0 = (dynamic_cast<TObjString*>(arr[0]))->GetString();
-    TString t1 = (dynamic_cast<TObjString*>(arr[1]))->GetString();
+    TObjString *ostrng0 = dynamic_cast<TObjString*>(arr[0]);
+    TObjString *ostrng1 = dynamic_cast<TObjString*>(arr[1]);
+
+    if (ostrng0 && ostrng1) {
+
+      TString t0 = ostrng0->GetString();
+      TString t1 = ostrng1->GetString();
   
-    this->fTLMUmultiplicity[index][0] = t0.Atoi();
-    this->fTLMUmultiplicity[index][1] = t1.Atoi();
+      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]));      
+      AliDebug(5, Form("%d: %d  %d", index, this->fTLMUmultiplicity[index][0], 
+                       this->fTLMUmultiplicity[index][1]));      
+
+    }
 
     return kTRUE;
   }
@@ -1481,15 +1498,22 @@ Bool_t AliTRDptrgParam::ParseTLMU(TString identifier, TString value) {
     } 
   
     for (Int_t iEntry = 0; iEntry < arr.GetEntries(); iEntry++) {
-      TString t = (dynamic_cast<TObjString*>(arr[iEntry]))->GetString(); 
+
+      TObjString *ostrng = dynamic_cast<TObjString*>(arr[iEntry]);
+      if (ostrng) {
+
+        TString t = ostrng->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();
+        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]));
@@ -1572,6 +1596,7 @@ void AliTRDptrgParam::MergeResults(TArrayI*& partResult1, TArrayI*& partResult2,
   if ((partResult1 == 0x0) || (partResult2 == 0x0) || 
       (signalsInvolved1 == 0x0) || (signalsInvolved2 == 0x0)) {
     AliError("fatal logical equation processing error!");
+    return;
   }
  
   // allocate results and signalsInvolved 
@@ -1881,29 +1906,36 @@ Int_t* AliTRDptrgParam::GenerateLUTbasedOnEq(TString eq, Int_t inputWidth,
  
   ConvertLogicalEqToBitVectors(eq, results, signalsInvolved);
   // generate bit vectors
+  
+  if ((results != 0x0) && (signalsInvolved != 0x0)) {
 
-  CheckSignalsInvolved(results, signalsInvolved, inputWidth);
-  // add bit vectors for signals which are not taken into account
+    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;
-  }
+    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;
+    return resultingLUT;
+
+  }
+  else {
+
+    return 0x0;
+
+  }
+
 }
 
 //______________________________________________________________________________