-
-//____________________________________________________________________
-template <typename Type>
-inline
-AliFMDMap<Type>::AliFMDMap(UShort_t maxDet,
- UShort_t maxRing,
- UShort_t maxSec,
- UShort_t maxStr)
- : fValues(maxDet * maxRing * maxSec * maxStr),
- fMaxDetectors(maxDet),
- fMaxRings(maxRing),
- fMaxSectors(maxSec),
- fMaxStrips(maxStr)
-{
- // Construct a map
- //
- // Parameters:
- // maxDet Maximum # of detectors
- // maxRinf Maximum # of rings
- // maxSec Maximum # of sectors
- // maxStr Maximum # of strips
-}
-
-
-//____________________________________________________________________
-template <typename Type>
-inline UShort_t
-AliFMDMap<Type>::CalcIndex(UShort_t det, Char_t ring,
- UShort_t sec, UShort_t str) const
-{
- // Calculate index into storage from arguments.
- //
- // Parameters:
- // det Detector #
- // ring Ring ID
- // sec Sector #
- // str Strip #
- //
- // Returns appropriate index into storage
- //
- UShort_t ringi = (ring == 'I' || ring == 'i' ? 0 : 1);
- UShort_t idx =
- (det + fMaxDetectors * (ringi + fMaxRings * (sec + fMaxSectors * str)));
- if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) {
- Fatal("CalcIndex", "Index (%d,'%c',%d,%d) out of bounds, "
- "in particular the %s index",
- det, ring, sec, str,
- (det >= fMaxDetectors ? "Detector" :
- (ringi >= fMaxRings ? "Ring" :
- (sec >= fMaxSectors ? "Sector" : "Strip"))));
- return 0;
- }
- return idx;
-}
-
-//____________________________________________________________________
-template <typename Type>
-inline void
-AliFMDMap<Type>::Clear(const Type& val)
-{
- // Resets stored values to the default value for that type
- for (UShort_t i = 0; i < fValues.size(); ++i) fValues[i] = val;
-}
-
-//____________________________________________________________________
-template <typename Type>
-inline Type&
-AliFMDMap<Type>::operator()(UShort_t det, Char_t ring,
- UShort_t sec, UShort_t str)
-{
- // Parameters:
- // det Detector #
- // ring Ring ID
- // sec Sector #
- // str Strip #
- //
- // Returns data[det][ring][sec][str]
- return fValues[CalcIndex(det, ring, sec, str)];
-}
-
-//____________________________________________________________________
-template <typename Type>
-inline const Type&
-AliFMDMap<Type>::operator()(UShort_t det,
- Char_t ring,
- UShort_t sec,
- UShort_t str) const
-{
- // Parameters:
- // det Detector #
- // ring Ring ID
- // sec Sector #
- // str Strip #
- //
- // Returns data[det][ring][sec][str]
- return fValues[CalcIndex(det, ring, sec, str)];
-}
-
-
-//____________________________________________________________________
-//
-// Some specialisations
-//
-typedef AliFMDMap<UShort_t> AliFMDAdcMap;
-typedef AliFMDMap<std::pair<Float_t, UShort_t> > AliFMDEdepMap;
-
-#endif