]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDptrgFEB.cxx
If not needed do not create the histograms in the neutral meson selection task
[u/mrichter/AliRoot.git] / TRD / AliTRDptrgFEB.cxx
index a091d5a0e99de6fdefeaf1b873ee9985f5d6863e..aad1fe3b6c7efc0302dc47a81d562ca25d170204 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliLog.h"
 
 #include "../VZERO/AliVZEROdigit.h" 
+#include "../VZERO/AliVZEROCalibData.h"
 #include "../T0/AliT0digit.h"
 
 #include "AliTRDptrgParam.h"
@@ -56,7 +57,7 @@ AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl)
   fThreshold(0)
 {
   // default constructor
-  AliWarning("default ctor - not recommended");
+  AliError("default ctor - not recommended");
 }
 
 //______________________________________________________________________________
@@ -102,19 +103,20 @@ Int_t AliTRDptrgFEB::LoadDigits()
  
   if (this->fType == kVZERO) {
     // load V0's digits --------------------------------------------------------
-    
+    // behavior adapted for AliVZERODigitizer.cxx 40613 2010-04-22 09:57:15Z   
     // get V0 run loader
-    AliLoader* loader = fRunLoader->GetLoader( "VZEROLoader" );
+    AliLoader* loader = this->fRunLoader->GetLoader( "VZEROLoader" );
 
     if (!loader) {
-      AliError("Can not get VZERO loader");
+      AliError("Cannot get VZERO loader");
       return -1;
     }
     loader->LoadDigits("READ");
     TTree* vzeroDigitsTree = loader->TreeD();
 
     if (!vzeroDigitsTree) {
-      AliError("Can not get the VZERO digit tree");
+      AliError("Cannot get the VZERO digit tree");
       return -1;
     }
     
@@ -123,12 +125,8 @@ Int_t AliTRDptrgFEB::LoadDigits()
     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));    
@@ -141,15 +139,33 @@ Int_t AliTRDptrgFEB::LoadDigits()
       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 board   = pmNumber / 8; // changed in Version 40613
+      Int_t feeBoard = AliVZEROCalibData::GetBoardNumber(pmNumber);
+      Int_t board = feeBoard % 4; // feeBoard V0-A: 1-4; V0-C: 5-8 => board: 1-4
+
       Int_t channel = pmNumber % 8;
-      Int_t position = pmNumber / 32 + 1;
+
+      Int_t position = -1;
+      if ((pmNumber >= 32) && (pmNumber <= 63)) { // V0-A (matched v40613)
+        position = 1; // kA
+      } 
+      else if ((pmNumber >= 0) && (pmNumber <= 31)) { // V0-C (matched v40613)
+        position = 2; // kB
+      }
+
+      AliDebug(5, 
+        Form("pmNumber: %d; feeBoard: %d; board: %d; channel: %d; position %d",
+             pmNumber, feeBoard, board, channel, position));  
+
+      if (position == -1)   {
+        AliError("Wrong VZERO pmt position found");
+       loader->UnloadDigits();
+        return -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; 
@@ -165,13 +181,18 @@ Int_t AliTRDptrgFEB::LoadDigits()
     }
 
     AliDebug(5, Form("inputVector: 0x%x", inputVector));
-    
+    loader->UnloadDigits();
     return inputVector;
   }
   else if (this->fType == kTZERO) {
     // load T0's digits --------------------------------------------------------
     AliLoader * fT0Loader = this->fRunLoader->GetLoader("T0Loader");
     //   AliT0digit *fDigits; 
+    if (!fT0Loader) {
+      AliError("Cannot get T0 loader");
+      return -1;
+    }
+      
     fT0Loader->LoadDigits("READ");
     // Creating T0 data container
 
@@ -220,7 +241,6 @@ Int_t AliTRDptrgFEB::LoadDigits()
       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));
@@ -230,7 +250,6 @@ Int_t AliTRDptrgFEB::LoadDigits()
       channelBitMask <<= 1; // go on to the next channel
     }
     
-    // TODO check whether it is correct to delete the digit
     delete digits;
     return inputVector;
   }
@@ -263,7 +282,7 @@ Bool_t AliTRDptrgFEB::LoadParams()
       // 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
+        this->fThreshold[i] = 10; 
       }
       // initialize LUTsoutputWidth=<value optimized out>
       AliTRDptrgLUT* lut = new AliTRDptrgLUT();
@@ -287,7 +306,7 @@ Bool_t AliTRDptrgFEB::LoadParams()
       // 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
+        this->fThreshold[i] = 10; 
       }
       
       // initialize LUTsoutputWidth=<value optimized out>