From ac07a8f59ad49a1eb3b24ac3c431bb589f8ed5b3 Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 8 Mar 2006 15:24:20 +0000 Subject: [PATCH] Corrected FMD data in the ESD (C.Holm) --- STEER/AliESDFMD.h | 8 ++++++-- STEER/AliFMDFloatMap.cxx | 17 ++++++++--------- STEER/AliFMDFloatMap.h | 3 ++- STEER/AliFMDMap.cxx | 4 ++-- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/STEER/AliESDFMD.h b/STEER/AliESDFMD.h index c2e6addab5d..96adb5432dc 100755 --- a/STEER/AliESDFMD.h +++ b/STEER/AliESDFMD.h @@ -1,5 +1,5 @@ -#ifndef ALIFMDHIT_H -#define ALIFMDHIT_H +#ifndef ALIESDFMD_H +#define ALIESDFMD_H /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights * reserved. * @@ -41,6 +41,10 @@ public: UShort_t sector, UShort_t strip, Float_t mult); + size_t MaxDetectors() const { return fMultiplicity.MaxDetectors(); } + size_t MaxRings() const { return fMultiplicity.MaxRings(); } + size_t MaxSectors() const { return fMultiplicity.MaxSectors(); } + size_t MaxStrips() const { return fMultiplicity.MaxStrips(); } void Print(Option_t* option="") const; enum { kInvalidMult = 1000 diff --git a/STEER/AliFMDFloatMap.cxx b/STEER/AliFMDFloatMap.cxx index 5251a30ce2f..dbe33866f90 100755 --- a/STEER/AliFMDFloatMap.cxx +++ b/STEER/AliFMDFloatMap.cxx @@ -36,7 +36,8 @@ AliFMDFloatMap::AliFMDFloatMap(const AliFMDFloatMap& other) fData(0) { // Copy constructor - fData = new Float_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; + fData = new Float_t[fTotal]; for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; i++) fData[i] = other.fData[i]; @@ -56,7 +57,8 @@ AliFMDFloatMap::AliFMDFloatMap(size_t maxDet, // maxRing Maximum number of rings per detector // maxSec Maximum number of sectors per ring // maxStr Maximum number of strips per sector - fData = new Float_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; + fData = new Float_t[fTotal]; Reset(); } @@ -69,11 +71,10 @@ AliFMDFloatMap::operator=(const AliFMDFloatMap& other) fMaxRings = other.fMaxRings; fMaxSectors = other.fMaxSectors; fMaxStrips = other.fMaxStrips; + fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; if (fData) delete [] fData; - fData = new Float_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips]; - for (size_t i = 0; i < fMaxDetectors * fMaxRings - * fMaxSectors * fMaxStrips; i++) - fData[i] = other.fData[i]; + fData = new Float_t[fTotal]; + for (size_t i = 0; i < fTotal; i++) fData[i] = other.fData[i]; return *this; } @@ -82,9 +83,7 @@ void AliFMDFloatMap::Reset(const Float_t& val) { // Reset map to val - for (size_t i = 0; i < fMaxDetectors * fMaxRings - * fMaxSectors * fMaxStrips; i++) - fData[i] = val; + for (size_t i = 0; i < fTotal; i++) fData[i] = val; } //__________________________________________________________ diff --git a/STEER/AliFMDFloatMap.h b/STEER/AliFMDFloatMap.h index 3f263537511..a61792532e4 100755 --- a/STEER/AliFMDFloatMap.h +++ b/STEER/AliFMDFloatMap.h @@ -32,7 +32,8 @@ public: UShort_t sec, UShort_t str) const; protected: - Float_t* fData; + size_t fTotal; // Total number of entries + Float_t* fData; //[fTotal] ClassDef(AliFMDFloatMap,1) // Map of floats }; diff --git a/STEER/AliFMDMap.cxx b/STEER/AliFMDMap.cxx index 3390c7556ce..f5b0406993b 100755 --- a/STEER/AliFMDMap.cxx +++ b/STEER/AliFMDMap.cxx @@ -57,11 +57,11 @@ AliFMDMap::CheckIndex(size_t det, Char_t ring, size_t sec, size_t str) const { // Check that the index supplied is OK. Returns true index, or -1 // on error. + if (det < 1) return -1; size_t ringi = (ring == 'I' || ring == 'i' ? 0 : 1); size_t idx = (str + fMaxStrips * (sec + fMaxSectors * (ringi + fMaxRings * (det-1)))); - if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) - return -1; + if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) return -1; return idx; } -- 2.43.0