X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDEdepMap.cxx;h=843a9ca299bb5ed9faef62fe6fe80c08cf7ced4b;hb=790cc2e39fb5030ccd9c5e49292e96a62d821457;hp=87cdbbc8cb11812857e9fe90e868c8b1680b44bb;hpb=1a1fdef7df14ded810885ec1c2da3dc3d7d1100c;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDEdepMap.cxx b/FMD/AliFMDEdepMap.cxx index 87cdbbc8cb1..843a9ca299b 100644 --- a/FMD/AliFMDEdepMap.cxx +++ b/FMD/AliFMDEdepMap.cxx @@ -12,11 +12,20 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - /* $Id$ */ - +/** @file AliFMDEdepMap.cxx + @author Christian Holm Christensen + @date Mon Mar 27 12:39:50 2006 + @brief Per strip map of energy deposited and number of hits + @ingroup FMD_sim +*/ //____________________________________________________________________ // +// Contains a pair of energy deposited fEdep and number of hits +// fN, fEdep is the summed energy deposition, and fN is the +// number of hits. The map contains one such object or each strip. +// It is used to cache the data in the digitization classes +// AliFMDBaseDigitizer and so on. // // #include "AliFMDEdepMap.h" // ALIFMDEDEPMAP_H @@ -31,22 +40,24 @@ ClassImp(AliFMDEdepMap) AliFMDEdepMap::AliFMDEdepMap(const AliFMDEdepMap& other) : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors, other.fMaxStrips), + fTotal(0), fData(0) { - fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings * - fMaxSectors * fMaxStrips]; - for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; - i++) fData[i] = other.fData[i]; + // Copy constructor + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; + fData = new AliFMDEdepHitPair[fTotal]; + for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; } //____________________________________________________________________ -AliFMDEdepMap::AliFMDEdepMap(size_t maxDet, - size_t maxRing, - size_t maxSec, - size_t maxStr) +AliFMDEdepMap::AliFMDEdepMap(UShort_t maxDet, + UShort_t maxRing, + UShort_t maxSec, + UShort_t maxStr) : AliFMDMap(maxDet, maxRing, maxSec, maxStr), + fTotal(0), fData(0) { // Construct a map @@ -56,32 +67,46 @@ AliFMDEdepMap::AliFMDEdepMap(size_t maxDet, // maxRinf Maximum # of rings // maxSec Maximum # of sectors // maxStr Maximum # of strips - fData = new AliFMDEdepHitPair[fMaxDetectors * fMaxRings * - fMaxSectors * fMaxStrips]; + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; + fData = new AliFMDEdepHitPair[fTotal]; } //____________________________________________________________________ AliFMDEdepMap& AliFMDEdepMap::operator=(const AliFMDEdepMap& other) { + // Assignment operator fMaxDetectors = other.fMaxDetectors; fMaxRings = other.fMaxRings; fMaxSectors = other.fMaxSectors; fMaxStrips = other.fMaxStrips; if (fData) delete [] fData; - fData = new AliFMDEdepHitPair[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 AliFMDEdepHitPair[fTotal]; + for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; return *this; } //____________________________________________________________________ void -AliFMDEdepMap::Clear(const AliFMDEdepHitPair& val) +AliFMDEdepMap::Reset() +{ + // Reset to zero + for (Int_t i = 0; i < fTotal; i++) { + fData[i].fEdep = 0; + fData[i].fN = 0; + }; +} + +//____________________________________________________________________ +void +AliFMDEdepMap::Reset(const AliFMDEdepHitPair& 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].fEdep = val.fEdep; + fData[i].fN = val.fN; + }; } //____________________________________________________________________