X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=FMD%2FAliFMDUShortMap.cxx;h=b0e75f6e94d2238484e0c772ea0b97981f7dfc0d;hb=4a8b667ccb39eb357833c40ca710545759e33904;hp=a33c98c3a4c54074cb78141244c935d48d03c69b;hpb=1a1fdef7df14ded810885ec1c2da3dc3d7d1100c;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDUShortMap.cxx b/FMD/AliFMDUShortMap.cxx index a33c98c3a4c..b0e75f6e94d 100644 --- a/FMD/AliFMDUShortMap.cxx +++ b/FMD/AliFMDUShortMap.cxx @@ -12,13 +12,19 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDUShortMap.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:48:18 2006 + @brief Per strip of unisgned shorts (16 bit) data +*/ //____________________________________________________________________ // // A map of per strip UShort_t information (for example ADC values, // number of hits and so on). +// Used for various calib information, and the like, +// as well as in reconstruction. +// Can be used elsewhere too. // #include "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H @@ -32,21 +38,24 @@ ClassImp(AliFMDUShortMap) AliFMDUShortMap::AliFMDUShortMap(const AliFMDUShortMap& other) : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, other.fMaxStrips), + fTotal(0), fData(0) { - fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; - for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; - i++) fData[i] = other.fData[i]; + // CTOR + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; + fData = new UShort_t[fTotal]; + for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; } //____________________________________________________________________ -AliFMDUShortMap::AliFMDUShortMap(size_t maxDet, - size_t maxRing, - size_t maxSec, - size_t maxStr) +AliFMDUShortMap::AliFMDUShortMap(UShort_t maxDet, + UShort_t maxRing, + UShort_t maxSec, + UShort_t maxStr) : AliFMDMap(maxDet, maxRing, maxSec, maxStr), + fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips), fData(0) { // Construct a map @@ -56,30 +65,45 @@ AliFMDUShortMap::AliFMDUShortMap(size_t maxDet, // maxRinf Maximum # of rings // maxSec Maximum # of sectors // maxStr Maximum # of strips - fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; + if (fTotal == 0) fTotal = 51200; + fData = new UShort_t[fTotal]; +} + +//____________________________________________________________________ +AliFMDUShortMap::AliFMDUShortMap() + : AliFMDMap(), + fTotal(0), + fData(0) +{ + // Construct a map + // + // Parameters: + // None } //____________________________________________________________________ AliFMDUShortMap& AliFMDUShortMap::operator=(const AliFMDUShortMap& other) { + // Assignment operator + if (&other == this) return *this; fMaxDetectors = other.fMaxDetectors; fMaxRings = other.fMaxRings; fMaxSectors = other.fMaxSectors; fMaxStrips = other.fMaxStrips; if (fData) delete [] fData; - fData = new UShort_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; - for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; - i++) fData[i] = other.fData[i]; + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; + fData = new UShort_t[fTotal]; + for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; return *this; } //____________________________________________________________________ void -AliFMDUShortMap::Clear(const UShort_t& val) +AliFMDUShortMap::Reset(const UShort_t& val) { - for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; - i++) fData[i] = val; + // Reset to val + for (Int_t i = 0; i < fTotal; i++) fData[i] = val; } //____________________________________________________________________