LCOV - code coverage report
Current view: top level - FMD/FMDbase - AliFMDBoolMap.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 41 41.5 %
Date: 2016-06-14 17:26:59 Functions: 7 11 63.6 %

          Line data    Source code
       1             : /**************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN.          *
       3             :  * All rights reserved.                                       *
       4             :  *                                                            *
       5             :  * Author: The ALICE Off-line Project.                        *
       6             :  * Contributors are mentioned in the code where appropriate.  *
       7             :  *                                                            *
       8             :  * Permission to use, copy, modify and distribute this        *
       9             :  * software and its documentation strictly for non-commercial *
      10             :  * purposes is hereby granted without fee, provided that the  *
      11             :  * above copyright notice appears in all copies and that both *
      12             :  * the copyright notice and this permission notice appear in  *
      13             :  * the supporting documentation. The authors make no claims   *
      14             :  * about the suitability of this software for any purpose. It *
      15             :  * is provided "as is" without express or implied warranty.   *
      16             :  **************************************************************/
      17             : /* $Id$ */
      18             : /** @file    AliFMDBoolMap.cxx
      19             :     @author  Christian Holm Christensen <cholm@nbi.dk>
      20             :     @date    Sun Mar 26 18:28:42 2006
      21             :     @brief   Per strip Boolean map
      22             : */
      23             : //__________________________________________________________
      24             : // 
      25             : // Map of Bool_t for each FMD strip
      26             : // Used in calibration and the like classes.
      27             : // Used amoung other things for dead-channel map
      28             : // Can also be used for other stuff too
      29             : // Created Mon Nov  8 12:51:51 2004 by Christian Holm Christensen
      30             : // 
      31             : #include "AliFMDBoolMap.h"    //ALIFMDBOOLMAP_H
      32             : //__________________________________________________________
      33          12 : ClassImp(AliFMDBoolMap)
      34             : #if 0
      35             :   ; // This is here to keep Emacs for indenting the next line
      36             : #endif
      37             : //__________________________________________________________
      38             : AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other)
      39           0 :   : AliFMDMap(other.fMaxDetectors,
      40           0 :               other.fMaxRings,
      41           0 :               other.fMaxSectors,
      42           0 :               other.fMaxStrips),
      43           0 :     fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
      44           0 :     fData(0)
      45           0 : {
      46             :   // Copy constructor
      47           0 :   if (fTotal == 0) fTotal = 51200;
      48           0 :   fData  = new Bool_t[fTotal];
      49           0 :   for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
      50           0 : }
      51             : 
      52             : //__________________________________________________________
      53             : AliFMDBoolMap::AliFMDBoolMap()
      54           3 :   : AliFMDMap(),
      55           3 :     fTotal(0),
      56           3 :     fData(0)
      57          15 : {
      58             :   // Constructor.
      59             :   // Parameters:
      60             :   //   None
      61           6 : }
      62             : 
      63             : //__________________________________________________________
      64             : AliFMDBoolMap::AliFMDBoolMap(UShort_t maxDet,
      65             :                              UShort_t maxRing,
      66             :                              UShort_t maxSec,
      67             :                              UShort_t maxStr)
      68           2 :   : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
      69           2 :     fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
      70           2 :     fData(0)
      71          10 : {
      72             :   // Constructor.
      73             :   // Parameters:
      74             :   //    maxDet  Maximum number of detectors
      75             :   //    maxRing Maximum number of rings per detector
      76             :   //    maxSec  Maximum number of sectors per ring
      77             :   //    maxStr  Maximum number of strips per sector
      78           4 :   if (fTotal == 0) fTotal = 51200;
      79           4 :   fData  = new Bool_t[fTotal];
      80           2 :   Reset();
      81           4 : }
      82             : 
      83             : //__________________________________________________________
      84             : AliFMDBoolMap&
      85             : AliFMDBoolMap::operator=(const AliFMDBoolMap& other)
      86             : {
      87             :   // Assignment operator 
      88           0 :   if (&other == this) return *this; 
      89           0 :   fMaxDetectors = other.fMaxDetectors;
      90           0 :   fMaxRings     = other.fMaxRings;
      91           0 :   fMaxSectors   = other.fMaxSectors;
      92           0 :   fMaxStrips    = other.fMaxStrips;
      93           0 :   if (fData) delete [] fData;
      94           0 :   fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
      95           0 :   if (fTotal == 0) fTotal = 51200;
      96           0 :   fData  = new Bool_t[fTotal];
      97           0 :   for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
      98           0 :   return *this;
      99           0 : }
     100             : 
     101             : //__________________________________________________________
     102             : void
     103             : AliFMDBoolMap::Reset(const Bool_t& val)
     104             : {
     105             :   // Reset map to val
     106     1843254 :   for (Int_t i = 0; i < fTotal; i++) fData[i] = val;
     107          18 : }
     108             : 
     109             : //__________________________________________________________
     110             : Bool_t&
     111             : AliFMDBoolMap::operator()(UShort_t det, 
     112             :                           Char_t   ring, 
     113             :                           UShort_t sec, 
     114             :                           UShort_t str)
     115             : {
     116             :   // Get data
     117             :   // Parameters:
     118             :   //    det     Detector #
     119             :   //    ring    Ring ID
     120             :   //    sec     Sector #
     121             :   //    str     Strip #
     122             :   // Returns appropriate data
     123     2458032 :   return fData[CalcIndex(det, ring, sec, str)];
     124             : }
     125             : 
     126             : //__________________________________________________________
     127             : const Bool_t&
     128             : AliFMDBoolMap::operator()(UShort_t det, 
     129             :                           Char_t   ring, 
     130             :                           UShort_t sec, 
     131             :                           UShort_t str) const
     132             : {
     133             :   // Get data
     134             :   // Parameters:
     135             :   //    det     Detector #
     136             :   //    ring    Ring ID
     137             :   //    sec     Sector #
     138             :   //    str     Strip #
     139             :   // Returns appropriate data
     140           0 :   return fData[CalcIndex(det, ring, sec, str)];
     141             : }
     142             : 
     143             : //__________________________________________________________
     144             : // 
     145             : // EOF
     146             : // 
     147             : 

Generated by: LCOV version 1.11