X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TOF%2FAliTOFDigitMap.cxx;h=d120be1ba3e142321247ca523d74974ab4ee33da;hb=409d1deea95f09c393baf756a544f5fcae7dd05a;hp=86bff8928c36c17de3a46c92a4ff3ab6d61affb1;hpb=bf6bf84c4b84f03447f8f63d2934a7b706ba1cc6;p=u%2Fmrichter%2FAliRoot.git diff --git a/TOF/AliTOFDigitMap.cxx b/TOF/AliTOFDigitMap.cxx index 86bff8928c3..d120be1ba3e 100644 --- a/TOF/AliTOFDigitMap.cxx +++ b/TOF/AliTOFDigitMap.cxx @@ -13,73 +13,82 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ +/* +$Log$ +Revision 1.12 2007/02/20 15:57:00 decaro +Raw data update: to read the TOF raw data defined in UNPACKED mode + +*/ //////////////////////////////////////////////////////////////////////// // // AliTOFDigitMap class // -// digitmap enables fast check if the pad was already hit -// The index of a AliTOFdigit is saved in the each hitmap "cell" -// (there is an offset +1, because the index can be zero and -// zero means empty cell. +// digitmap enables fast check if the pad was already digit. + +// The index of a AliTOFdigit is saved in the each digitmap "cell" +// (there is an offset +1, because the index can be zero and zero +// means empty cell). // In TOF, number of strips varies according plate type, the highest -// number is in plate C. For all plates is used this number, so -// the size of the digitmap is a little bit greater than necessary, but -// it simplifies the access algorithm. +// number is in plate C. For all plates is used this number, so the +// size of the digitmap is a little bit greater than necessary, but it +// simplifies the access algorithm. // // // Author: F. Pierella based on AliTOFHitMap // -//////////////////////////////////////////////////////////////////////// +// Modified by A. De Caro +// +/////////////////////////////////////////////////////////////////////// -#include -#include +#include "AliLog.h" #include "AliTOFDigitMap.h" -#include "AliTOFdigit.h" -#include "AliTOFConstants.h" - - -#include +#include "AliTOFGeometry.h" ClassImp(AliTOFDigitMap) -AliTOFDigitMap::AliTOFDigitMap() +AliTOFDigitMap::AliTOFDigitMap(): + fNSector(-1), + fNplate(-1), + fNstrip(-1), + fNpx(-1), + fNpz(-1), + fMaxIndex(-1), + fDigitMap(0x0) { // // Default ctor // - fDigitMap = 0; - fDigits = 0; -} -//////////////////////////////////////////////////////////////////////// -AliTOFDigitMap::AliTOFDigitMap(TClonesArray *dig) -{ - // - // ctor - // - // of course, these constants must not be hardwired - // change later - - fNSector = AliTOFConstants::fgkNSectors; - fNplate = AliTOFConstants::fgkNPlates; - fNstrip = AliTOFConstants::fgkNStripC; - fNpx = AliTOFConstants::fgkNpadX; - fNpy = AliTOFConstants::fgkNpadZ; - fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpy; - fDigitMap = new Int_t[fMaxIndex]; - fDigits = dig; + fNSector = AliTOFGeometry::NSectors(); + fNplate = AliTOFGeometry::NPlates(); + fNstrip = AliTOFGeometry::NStripC(); + fNpx = AliTOFGeometry::NpadX(); + fNpz = AliTOFGeometry::NpadZ(); + fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpz; + + fDigitMap = new Int_t*[fMaxIndex]; + for (Int_t i=0; i= fMaxIndex) { - Error("AliTOFDigitMap","CheckedIndex - input outside bounds"); - return -1; + // + // Return checked index for vol + // + + Int_t index = + vol[0]*fNplate*fNstrip*fNpx*fNpz+ // sector + vol[1]*fNstrip*fNpx*fNpz+ // plate + vol[2]*fNpx*fNpz+ // strip + vol[3]*fNpz+ // padx + vol[4]; // padz + + if (index >= fMaxIndex || index < 0) { + AliError("CheckedIndex - input outside bounds"); + return -1; } else { - return index; + return index; } } //////////////////////////////////////////////////////////////////////// -void AliTOFDigitMap::SetHit(Int_t *vol, Int_t idigit) +void AliTOFDigitMap::AddDigit(Int_t *vol, Int_t idigit) { -// -// Assign digit to pad vol -// + // + // Assign digit to pad vol + // + // 0 means empty pad, we need to shift indeces by 1 -// 0 means empty pad, we need to shift indeces by 1 - fDigitMap[CheckedIndex(vol)]=idigit+1; -} + for (Int_t slot=0; slotGetLast()+1; + } } //////////////////////////////////////////////////////////////////////// -Int_t AliTOFDigitMap::GetHitIndex(Int_t *vol) const +void AliTOFDigitMap::GetDigitIndex(Int_t *vol, Int_t *digitLabels) const { -// -// Get contents of pad vol -// + // + // Get all contents (digitLabels) of pad volume (vol) + // -// 0 means empty pad, we need to shift indeces by 1 - return fDigitMap[CheckedIndex(vol)]-1; + // 0 means empty pad, we need to shift indeces by 1 + + Int_t dummy; + for (Int_t j=0; j=0) digitLabels[j] = dummy; + else break; + } } //////////////////////////////////////////////////////////////////////// -TObject* AliTOFDigitMap::GetHit(Int_t *vol) const +Int_t AliTOFDigitMap::GetDigitIndex(Int_t *vol, Int_t label) const { -// -// Get pointer to object at vol -// return 0 if vol out of bounds - Int_t index=GetHitIndex(vol); - return (index <0) ? 0 : fDigits->UncheckedAt(index); + // + // Get one of the contents (label) of pad volume (vol) + // + + // 0 means empty pad, we need to shift indeces by 1 + + if (!(label= kMaxDigitsPerPad (=%i)", label, kMaxDigitsPerPad)); + return -1; + } + + if (CheckedIndex(vol)==-1) return -1; + + Int_t dummy = fDigitMap[CheckedIndex(vol)][label]; + + if (dummy>0) return dummy-1; + else return -1; + } //////////////////////////////////////////////////////////////////////// -FlagType AliTOFDigitMap::TestHit(Int_t *vol) const +FlagType AliTOFDigitMap::TestDigit(Int_t *vol) const { // // Check if hit cell is empty, used or unused // - Int_t inf=fDigitMap[CheckedIndex(vol)]; - if (inf < 0) { + Int_t inf=fDigitMap[CheckedIndex(vol)][0]; // to be modified + if (inf > 0) { return kUsed; } else if (inf == 0) { return kEmpty; @@ -182,13 +218,38 @@ FlagType AliTOFDigitMap::TestHit(Int_t *vol) const } //////////////////////////////////////////////////////////////////////// -AliTOFDigitMap & AliTOFDigitMap::operator = (const AliTOFDigitMap & rhs) +AliTOFDigitMap & AliTOFDigitMap::operator = (const AliTOFDigitMap & /*rhs*/) { // Dummy assignment operator return *this; } +//////////////////////////////////////////////////////////////////////// +Int_t AliTOFDigitMap::GetFilledCellNumber() const +{ + // + // Returns the number of filled cells of the TOF digit map + // + + Int_t volume[5] = {-1, -1, -1, -1, -1}; + Int_t counter = 0; + for (Int_t iSector=0; iSector0) counter++; + } + return counter; +}