#include "AliLog.h"
#include "../VZERO/AliVZEROdigit.h"
+#include "../VZERO/AliVZEROCalibData.h"
#include "../T0/AliT0digit.h"
#include "AliTRDptrgParam.h"
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 = 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;
}
AliVZEROdigit* digit = (AliVZEROdigit*)vzeroDigits->At(iDigit);
Int_t pmNumber = digit->PMNumber();
- Int_t board = pmNumber / 8;
+ // 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, 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
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 = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray.At(0));
+ if (lut) {
+ for (Int_t i = 0; i < 256; i++ ) {
+ initData[i] = i;
+ }
+ lut->InitTable(8, 8, initData, kTRUE); // make copy of initData
}
- 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
+ if (lut) {
+ for (Int_t i = 255; i >= 0; i--) {
+ initData[255 - i] = i; // inverse ramp
+ }
+ lut->InitTable(8, 8, initData, kTRUE);
}
- lut->InitTable(8, 8, initData, kTRUE);
+ delete [] initData;
}
else {
// initialize threshold
// 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;
+ if (lut) {
+ for (Int_t i = 0; i < 4096; i++ ) {
+ initData[i] = i;
+ }
+ lut->InitTable(12, 12, initData, kTRUE); // make a copy of the table
}
- 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
+ if (lut) {
+ //for (Int_t i = 4095; 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 of the table
}
- lut->InitTable(12, 12, initData, kTRUE); // make a copy of the table
- delete[] initData;
+ delete [] initData;
}
return false;
}
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);
+ AliTRDptrgLUT *lutTmp = dynamic_cast<AliTRDptrgLUT*>(this->fLUTArray[iLUT]);
+ if (lutTmp) {
+ result[iLUT + 1] = lutTmp->LookUp(inputVector);
+ }
AliDebug(4, Form("FEB result[%d] = 0x%x",(iLUT + 1),result[iLUT + 1]));
}
}