X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDptrgFEB.cxx;h=b1254b1b4a4235059ad51cd479eb73ceb4aa9240;hb=4e6eb3f6ff8f346e7fef20ed18daa7ff2111bed8;hp=ffaf9906ee7f12bd2e95a43aabd4775da5a3ea63;hpb=dcf1edef68bdbf399e9538994c61af63a4c1d50f;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDptrgFEB.cxx b/TRD/AliTRDptrgFEB.cxx index ffaf9906ee7..b1254b1b4a4 100644 --- a/TRD/AliTRDptrgFEB.cxx +++ b/TRD/AliTRDptrgFEB.cxx @@ -29,12 +29,15 @@ //////////////////////////////////////////////////////////////////////////// #include +#include #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" @@ -48,10 +51,10 @@ AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl) 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) { @@ -60,9 +63,9 @@ AliTRDptrgFEB::AliTRDptrgFEB(AliRunLoader *rl) } //______________________________________________________________________________ -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), @@ -100,9 +103,10 @@ Int_t AliTRDptrgFEB::LoadDigits() { // 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" ); @@ -137,9 +141,29 @@ Int_t AliTRDptrgFEB::LoadDigits() 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)) { @@ -159,10 +183,10 @@ Int_t AliTRDptrgFEB::LoadDigits() } 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; @@ -204,10 +228,10 @@ Int_t AliTRDptrgFEB::LoadDigits() // 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; } @@ -240,10 +264,10 @@ Int_t AliTRDptrgFEB::LoadAndProcessHits() // 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; @@ -256,7 +280,7 @@ Bool_t AliTRDptrgFEB::LoadParams() 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++) { @@ -268,17 +292,22 @@ Bool_t AliTRDptrgFEB::LoadParams() lut = new AliTRDptrgLUT(); this->fLUTArray.AddLast(lut); // the following lines are only needed for test reasons - lut = dynamic_cast(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(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(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 @@ -295,22 +324,27 @@ Bool_t AliTRDptrgFEB::LoadParams() // the following lines are only needed for test reasons lut = dynamic_cast(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(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)); @@ -364,7 +398,7 @@ Int_t* AliTRDptrgFEB::Simulate() 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 @@ -377,12 +411,14 @@ Int_t* AliTRDptrgFEB::Simulate() AliDebug(4, Form("FEB: (pos=%d,id=%d,lut=%d,vector=0x%x)", this->fPosition, this->fID, iLUT, inputVector)); - result[iLUT + 1] = - dynamic_cast(this->fLUTArray[iLUT])->LookUp(inputVector); + AliTRDptrgLUT *lutTmp = dynamic_cast(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;