X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDptrgFEB.cxx;h=60e15fed635e913eaedb1a8c7a049643420f0869;hb=22fceaeca5737ed5409748d70852302a77ebd7a5;hp=fe272867262c725d5e73c7d0748601fefdbde6cc;hpb=e51605d9fcb8d4d8f121b756a034877c39fa9023;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDptrgFEB.cxx b/TRD/AliTRDptrgFEB.cxx index fe272867262..60e15fed635 100644 --- a/TRD/AliTRDptrgFEB.cxx +++ b/TRD/AliTRDptrgFEB.cxx @@ -34,6 +34,7 @@ #include "AliLog.h" #include "../VZERO/AliVZEROdigit.h" +#include "../VZERO/AliVZEROCalibData.h" #include "../T0/AliT0digit.h" #include "AliTRDptrgParam.h" @@ -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 = 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; } @@ -137,9 +139,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; // 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,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 @@ -263,17 +290,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 @@ -290,16 +322,21 @@ 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; } @@ -372,8 +409,10 @@ 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])); } }