LCOV - code coverage report
Current view: top level - MUON/MUONbase - AliMUONDigitStoreVImplIterator.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 29 51 56.9 %
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, All rights reserved. *
       3             : *                                                                        *
       4             : * Author: The ALICE Off-line Project.                                    *
       5             : * Contributors are mentioned in the code where appropriate.              *
       6             : *                                                                        *
       7             : * Permission to use, copy, modify and distribute this software and its   *
       8             : * documentation strictly for non-commercial purposes is hereby granted   *
       9             : * without fee, provided that the above copyright notice appears in all   *
      10             : * copies and that both the copyright notice and this permission notice   *
      11             : * appear in the supporting documentation. The authors make no claims     *
      12             : * about the suitability of this software for any purpose. It is          *
      13             : * provided "as is" without express or implied warranty.                  *
      14             : **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : //-----------------------------------------------------------------------------
      19             : /// \class AliMUONDigitStoreVImplIterator
      20             : ///
      21             : /// Implementation of AliMUONVDataIterator for AliMUONDigitStoreVImpl
      22             : ///
      23             : /// \author Laurent Aphecetche, Subatech
      24             : ///
      25             : //-----------------------------------------------------------------------------
      26             : 
      27             : #include "AliMUONDigitStoreVImplIterator.h"
      28             : 
      29             : #include "AliMUONVDigit.h"
      30             : #include "AliMUONDigitStoreVImpl.h"
      31             : #include "AliMUON2DMap.h"
      32             : #include "AliMUONVCalibParam.h"
      33             : #include <TClonesArray.h>
      34             : #include <TError.h>
      35             : 
      36             : /// \cond CLASSIMP
      37          18 : ClassImp(AliMUONDigitStoreVImplIterator)
      38             : /// \endcond
      39             : 
      40             : //_____________________________________________________________________________
      41             : AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl* store)
      42           0 : : TIterator(),
      43           0 : fkStore(store),
      44           0 : fFirstDetElemId(100),
      45           0 : fLastDetElemId(1417),
      46           0 : fCathode(2),
      47           0 : fStoreIterator(store->fMap->CreateIterator()),
      48           0 : fCurrentCalibParam(0x0),
      49           0 : fCurrentCalibParamIndex(-1)
      50           0 : {
      51             :   /// ctor for full iteration
      52           0 : }
      53             : 
      54             : //_____________________________________________________________________________
      55             : AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl* store,
      56             :                                                                Int_t firstDE,
      57             :                                                                Int_t lastDE,
      58             :                                                                Int_t cathode)
      59         961 : : TIterator(),
      60         961 : fkStore(store),
      61         961 : fFirstDetElemId(firstDE),
      62         961 : fLastDetElemId(lastDE),
      63         961 : fCathode(cathode),
      64        1922 : fStoreIterator(store->fMap->CreateIterator(firstDE,lastDE)),
      65         961 : fCurrentCalibParam(0x0),
      66         961 : fCurrentCalibParamIndex(-1)
      67        4805 : {
      68             :   /// ctor for partial iteration
      69        1922 : }
      70             : 
      71             : //_____________________________________________________________________________
      72             : AliMUONDigitStoreVImplIterator&
      73             : AliMUONDigitStoreVImplIterator::operator=(const TIterator&)
      74             : {
      75             :   // overriden assignment operator (imposed by Root's declaration of Titerator ?)
      76           0 :   Fatal("TIterator::operator=","Not implementeable"); // because there's no clone in TIterator :-(
      77           0 :   return *this;
      78             : }
      79             : 
      80             : //_____________________________________________________________________________
      81             : AliMUONDigitStoreVImplIterator::~AliMUONDigitStoreVImplIterator()
      82        5766 : {
      83             :   /// dtor
      84        1922 :   delete fStoreIterator;
      85        2883 : }
      86             : 
      87             : //_____________________________________________________________________________
      88             : TObject*
      89             : AliMUONDigitStoreVImplIterator::Next()
      90             : {
      91             :   /// Return next digit in store
      92      324874 :   if ( !fCurrentCalibParam ) 
      93             :   {
      94       13761 :     fCurrentCalibParam = static_cast<AliMUONVCalibParam*>(fStoreIterator->Next());
      95       13761 :     fCurrentCalibParamIndex = 0;
      96       14722 :     if ( !fCurrentCalibParam ) return 0x0;
      97             :   }
      98             :   
      99             :   Int_t ix(-1);
     100             :   AliMUONVDigit* d(0x0);
     101             :   
     102      161476 :   if ( fCathode == 2 ) 
     103             :   {
     104     1799876 :     while ( fCurrentCalibParamIndex < 64 && ix < 0 )
     105             :     {
     106      819200 :       ix = fCurrentCalibParam->ValueAsInt(fCurrentCalibParamIndex++);
     107             :     };
     108             :     
     109      161476 :     if (ix>=0)
     110             :     {
     111      148676 :       d = static_cast<AliMUONVDigit*>(fkStore->fDigits->UncheckedAt(ix));
     112      148676 :     }  
     113             :   }
     114             :   else
     115             :   {
     116           0 :     while ( d == 0x0 ) 
     117             :     {
     118           0 :       while ( fCurrentCalibParamIndex < 64 && ix < 0 )
     119             :       {
     120           0 :         ix = fCurrentCalibParam->ValueAsInt(fCurrentCalibParamIndex++);
     121             :       };
     122             :     
     123           0 :       if (ix>=0)
     124             :       {
     125           0 :         d = static_cast<AliMUONVDigit*>(fkStore->fDigits->UncheckedAt(ix));
     126             :         
     127           0 :         if (  fCathode == 2 || d->Cathode() == fCathode ) 
     128             :         {
     129             :           break;
     130             :         }
     131             :         d = 0x0;
     132             :         ix = -1;
     133             :       }
     134             :       else
     135             :       {
     136             :         break;
     137             :       }
     138             :     }
     139             :   }
     140             :   
     141      161476 :   if (ix<0) 
     142             :   {
     143       12800 :     fCurrentCalibParam = 0x0;
     144       12800 :     return Next();
     145             :   }
     146             :   
     147      148676 :   return d;
     148      162437 : }
     149             : 
     150             : //_____________________________________________________________________________
     151             : void
     152             : AliMUONDigitStoreVImplIterator::Reset()
     153             : {
     154             :   /// Reset the iterator
     155           0 :   fCurrentCalibParam = 0x0;
     156           0 :   fCurrentCalibParamIndex = 0;  
     157           0 :   fStoreIterator->Reset();
     158           0 : }

Generated by: LCOV version 1.11