LCOV - code coverage report
Current view: top level - MUON/MUONmapping - AliMpVSegmentation.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 37 16.2 %
Date: 2016-06-14 17:26:59 Functions: 4 9 44.4 %

          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             : // $MpId: AliMpVSegmentation.cxx,v 1.5 2006/05/24 13:58:29 ivana Exp $
      18             : // Category: basic
      19             : 
      20             : //-----------------------------------------------------------------------------
      21             : // Class AliMpVSegmentation
      22             : // ------------------------
      23             : // The abstract base class for the segmentation.
      24             : // Provides methods related to pads:
      25             : // conversion between pad indices, pad location, pad position;
      26             : // finding pad neighbour.
      27             : //
      28             : // Included in AliRoot: 2003/05/02
      29             : // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
      30             : //         Laurent Aphecetche, SUBATECH
      31             : //-----------------------------------------------------------------------------
      32             : 
      33             : 
      34             : #include "AliMpVSegmentation.h"
      35             : #include "AliMpArea.h"
      36             : #include "AliMpConstants.h"
      37             : 
      38             : #include "AliLog.h"
      39             : 
      40             : #include "TObjArray.h"
      41             : 
      42             : /// \cond CLASSIMP
      43          18 : ClassImp(AliMpVSegmentation)
      44             : /// \endcond
      45             : 
      46             : //_____________________________________________________________________________
      47             : AliMpVSegmentation::AliMpVSegmentation() 
      48        1538 :   : TObject()
      49        4614 : {
      50             : /// Default constructor
      51        1538 : }
      52             : 
      53             : //_____________________________________________________________________________
      54             : AliMpVSegmentation::~AliMpVSegmentation() 
      55           0 : {
      56             : /// Destructor 
      57        2124 : }
      58             : 
      59             : //_____________________________________________________________________________
      60             : Int_t 
      61             : AliMpVSegmentation::GetNeighbours(const AliMpPad& pad, 
      62             :                                   TObjArray& neighbours,
      63             :                                   Bool_t includeSelf,
      64             :                                   Bool_t includeVoid) const
      65             : {
      66             :   /// Returns the list of neighbours of pad
      67             :   /// testPositions are the positions (L,T,R,B) relative to pad's center (O)
      68             :   /// were we'll try to get a neighbouring pad, by getting a little
      69             :   /// bit outside the pad itself.
      70             :   /// The pad density can only decrease when going from left to right except
      71             :   /// for round slates where it is the opposite.
      72             :   /// The pad density can only decrease when going from bottom to top but
      73             :   /// to be symmetric we also consider the opposite.
      74             :   /// The order in which we actually test the positions has some importance,
      75             :   /// i.e. when using this information to compute status map later on. Here's
      76             :   /// the sequence :
      77             :   /// <pre>
      78             :   /// 4- 5- 6-7
      79             :   /// |       |
      80             :   /// 3       8
      81             :   /// |   0   |
      82             :   /// 2       9
      83             :   /// |       |
      84             :   /// 1-12-11-10
      85             :   /// </pre>
      86             : 
      87             :   static const Int_t kNofTestPositions(12);
      88             :   static Double_t shiftx[12] = {-1., -1., -1., -1., -1./3., 1./3., 1., 1., 1., 1., 1./3., -1./3.};
      89             :   static Double_t shifty[12] = {-1., -1./3., 1./3., 1., 1., 1., 1., 1./3., -1./3., -1., -1., -1.};
      90             : 
      91           0 :   static const Double_t kEpsilon(AliMpConstants::LengthTolerance()*2.0);
      92             :   
      93           0 :   neighbours.Delete();
      94           0 :   neighbours.SetOwner(kTRUE);
      95             :   
      96           0 :   if ( ! pad.IsValid() ) return 0;
      97             :   
      98           0 :   AliMpPad invalid(AliMpPad::Invalid());
      99             :   AliMpPad *previous = &invalid;
     100             :   Int_t n(0);
     101             :   
     102             :   // consider adding the pad itself
     103           0 :   if ( includeSelf )
     104             :   {
     105           0 :     neighbours.Add(new AliMpPad(pad));
     106             :     ++n;
     107           0 :   }
     108           0 :   else if ( includeVoid )
     109             :   {
     110           0 :     neighbours.Add(new AliMpPad(invalid));
     111             :     ++n;
     112           0 :   }
     113             :   
     114             :   // add the neighbours (only once)
     115           0 :   for ( Int_t i = 0; i < kNofTestPositions; ++i )
     116             :   {
     117             :     
     118           0 :     AliMpPad p
     119           0 :       = PadByPosition(pad.GetPositionX() + ( pad.GetDimensionX() + kEpsilon )*shiftx[i], 
     120           0 :                       pad.GetPositionY() + ( pad.GetDimensionY() + kEpsilon )*shifty[i],
     121             :                       kFALSE);
     122             :     
     123           0 :     if ( p.IsValid() && p != *previous )
     124             :     {
     125           0 :       previous = new AliMpPad(p);
     126           0 :       neighbours.Add(previous);
     127           0 :       ++n;
     128           0 :     }
     129           0 :     else if ( includeVoid )
     130             :     {
     131           0 :       neighbours.Add(new AliMpPad(invalid));
     132           0 :       ++n;
     133           0 :     }
     134             :     
     135           0 :   }
     136             :   
     137             :   return n;
     138             :   
     139           0 : }
     140             : 
     141             : //
     142             : // public methods
     143             : //
     144             : 
     145             : //_____________________________________________________________________________
     146             : Bool_t 
     147             : AliMpVSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const
     148             : {
     149             :   /// Default implementation. Must be overwritten if can be made more
     150             :   /// efficient in the child class
     151             :   
     152      302592 :   return ( PadByIndices(ix, iy, kFALSE) != AliMpPad::Invalid() );
     153           0 : }
     154             : 
     155             : //_____________________________________________________________________________
     156             : Bool_t 
     157             : AliMpVSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const
     158             : {
     159             :   /// Default implementation. Must be overwritten if can be made more
     160             :   /// efficient in the child class
     161             :   
     162           0 :   return (PadByLocation(manuId, manuChannel, kFALSE) != AliMpPad::Invalid());
     163           0 : }
     164             : 
     165             : //_____________________________________________________________________________
     166             : Bool_t 
     167             : AliMpVSegmentation::HasMotifPosition(Int_t manuId) const
     168             : {
     169             :   /// Default implementation to know if we hold a given manu
     170           0 :   return ( MotifPosition(manuId) != 0x0 );
     171             : }
     172             : 
     173             : 

Generated by: LCOV version 1.11