////////////////////////////////////////////////////////////////////////////
#include <TClonesArray.h>
+#include <TTree.h>
#include "AliRunLoader.h"
+#include "AliLoader.h"
#include "AliLog.h"
-#include "../VZERO/AliVZEROdigit.h"
-#include "../T0/AliT0digit.h"
+#include "AliVZEROdigit.h"
+#include "AliVZEROCalibData.h"
+#include "AliT0digit.h"
#include "AliTRDptrgParam.h"
#include "AliTRDptrgLUT.h"
fRunLoader(rl),
fParam(0),
fLUTArray(0),
- fType(kUndefined),
- fOperatingMode(kDigits),
+ fType(AliTRDptrgParam::kUndefined),
+ fOperatingMode(AliTRDptrgParam::kDigits),
fInputChannelCount(0),
- fPosition(kUnknown),
+ fPosition(AliTRDptrgParam::kUnknown),
fID(0),
fThreshold(0)
{
}
//______________________________________________________________________________
-AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl, AliTRDptrgFEBType_t febType,
- AliTRDptrgOperatingMode_t operatingMode,
- AliTRDptrgFEBPosition_t position, Int_t id,
+AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl, AliTRDptrgParam::AliTRDptrgFEBType_t febType,
+ AliTRDptrgParam::AliTRDptrgOperatingMode_t operatingMode,
+ AliTRDptrgParam::AliTRDptrgFEBPosition_t position, Int_t id,
AliTRDptrgParam *param)
: TObject(),
fRunLoader(rl),
{
// loads T0 or V0 digits and discriminates them automatically
- if (this->fType == kVZERO) {
+ if (this->fType == AliTRDptrgParam::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; // AliTRDptrgParam::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) {
+ else if (this->fType == AliTRDptrgParam::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
// A: 12 to 23
// positions according to AliT0Digitizer.cxx Revision 37491
Int_t nStart = 0;
- if (this->fPosition == kC) { // C
+ if (this->fPosition == AliTRDptrgParam::kC) { // C
nStart = 0;
}
- else if (this->fPosition == kA) { // A
+ else if (this->fPosition == AliTRDptrgParam::kA) { // A
nStart = 12;
}
// 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) {
+ if (this->fType == AliTRDptrgParam::kVZERO) {
return 0;
}
- else if (this->fType == kTZERO) {
+ else if (this->fType == AliTRDptrgParam::kTZERO) {
return 0;
}
return -1;
if (this->fParam == 0x0) {
AliWarning("No paramater object specified - start loading defaults\n");
- if (this->fType == kVZERO) {
+ if (this->fType == AliTRDptrgParam::kVZERO) {
// initialize threshold
this->fThreshold = new UInt_t[8];
for (Int_t i = 0; i < 8; i++) {
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;
}
else {
// load parameters from object
- if (this->fType == kVZERO) {
+ if (this->fType == AliTRDptrgParam::kVZERO) {
// threshold
this->fThreshold =
this->fParam->GetFEBV0Thresholds(this->fPosition, (this->fID - 1));
Int_t *result = new Int_t;
(*result) = -1;
- if (this->fOperatingMode == kDigits) {
+ if (this->fOperatingMode == AliTRDptrgParam::kDigits) {
Int_t inputVector = this->LoadDigits();
delete result; // delete error return value
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]));
}
}
- else if (this->fOperatingMode == kHits) {
+ else if (this->fOperatingMode == AliTRDptrgParam::kHits) {
return result;
}
return result;