LCOV - code coverage report
Current view: top level - MUON/MUONbase - AliMUONRawClusterV2.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 57 89 64.0 %
Date: 2016-06-14 17:26:59 Functions: 12 15 80.0 %

          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 AliMUONRawClusterV2
      20             : ///
      21             : /// Class for the MUON RecPoint
      22             : ///
      23             : /// \author Philippe Pillot, Subatech
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : 
      27             : #include "AliMUONRawClusterV2.h"
      28             : 
      29             : #include "AliLog.h"
      30             : 
      31             : #include <TClonesArray.h>
      32             : #include <Riostream.h>
      33             : 
      34             : /// \cond CLASSIMP
      35          18 : ClassImp(AliMUONRawClusterV2)
      36             : /// \endcond
      37             : 
      38             : 
      39             : //____________________________________________________
      40             : AliMUONRawClusterV2::AliMUONRawClusterV2() 
      41         166 :   : AliMUONVCluster(),
      42         166 :     fX(FLT_MAX),
      43         166 :     fY(FLT_MAX),
      44         166 :     fZ(FLT_MAX),
      45         166 :     fErrX2(FLT_MAX),
      46         166 :     fErrY2(FLT_MAX),
      47         166 :     fQ(0.),
      48         166 :     fChi2(0.),
      49         166 :     fNDigits(0),
      50         166 :     fDigitsId(0x0),
      51         166 :     fMCLabel(-1)
      52         830 : {
      53             :   /// Default Constructor
      54         332 : }
      55             : 
      56             : //_____________________________________________________________________________
      57             : AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
      58         164 :   : AliMUONVCluster(chamberId, detElemId, clusterIndex),
      59         164 :     fX(FLT_MAX),
      60         164 :     fY(FLT_MAX),
      61         164 :     fZ(FLT_MAX),
      62         164 :     fErrX2(FLT_MAX),
      63         164 :     fErrY2(FLT_MAX),
      64         164 :     fQ(0.),
      65         164 :     fChi2(0.),
      66         164 :     fNDigits(0),
      67         164 :     fDigitsId(0x0),
      68         164 :     fMCLabel(-1)
      69         820 : {
      70             :   /// Constructor
      71         328 : }
      72             : 
      73             : //____________________________________________________
      74             : AliMUONRawClusterV2::~AliMUONRawClusterV2() 
      75        1500 : {
      76             :   /// Destructor
      77         414 :   delete [] fDigitsId;
      78         750 : }
      79             : 
      80             : //____________________________________________________
      81             : AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
      82         164 :   : AliMUONVCluster(cluster),
      83         164 :     fX(cluster.fX),
      84         164 :     fY(cluster.fY),
      85         164 :     fZ(cluster.fZ),
      86         164 :     fErrX2(cluster.fErrX2),
      87         164 :     fErrY2(cluster.fErrY2),
      88         164 :     fQ(cluster.fQ),
      89         164 :     fChi2(cluster.fChi2),
      90         164 :     fNDigits(cluster.fNDigits),
      91         164 :     fDigitsId(0x0),
      92         164 :     fMCLabel(cluster.fMCLabel)
      93             : 
      94         820 : {
      95             :   /// Copy constructor
      96             :   
      97         164 :   if (cluster.fDigitsId) {
      98         328 :     fDigitsId = new UInt_t[fNDigits];
      99         164 :     memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
     100         164 :   }
     101         328 : }
     102             : 
     103             :   //__________________________________________________________________________
     104             : AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
     105             : {
     106             :   /// Asignment operator
     107             :   
     108             :   // check assignement to self
     109           0 :   if (this == &cluster)
     110           0 :     return *this;
     111             : 
     112             :   // base class assignement
     113           0 :   AliMUONVCluster::operator=(cluster);
     114             :   
     115           0 :   fX = cluster.fX;
     116           0 :   fY = cluster.fY;
     117           0 :   fZ = cluster.fZ;
     118           0 :   fErrX2 = cluster.fErrX2;
     119           0 :   fErrY2 = cluster.fErrY2;
     120           0 :   fQ = cluster.fQ;
     121           0 :   fChi2 = cluster.fChi2;
     122           0 :   SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
     123           0 :   fMCLabel = cluster.fMCLabel;
     124             : 
     125           0 :   return *this;
     126           0 : }
     127             : 
     128             : //____________________________________________________
     129             : void AliMUONRawClusterV2::Clear(Option_t*)
     130             : {
     131             :   /// clear memory
     132         984 :   delete [] fDigitsId;
     133         328 :   fDigitsId = 0x0;
     134         328 :   fNDigits = 0;
     135         328 : }
     136             : 
     137             : //____________________________________________________
     138             : void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
     139             : {
     140             :   /// Set size of array of digits Id to n ints and set the content
     141             :   /// if digitsId is not given the array is filled with id=0
     142             :   
     143           0 :   if (fDigitsId && fNDigits != nDigits) {
     144           0 :     delete [] fDigitsId;
     145           0 :     fDigitsId = 0;
     146           0 :   }
     147           0 :   fNDigits = nDigits;
     148           0 :   if (fNDigits == 0) return;
     149           0 :   if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
     150           0 :   if (digitsId == 0)
     151           0 :     for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
     152             :   else
     153           0 :     memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
     154           0 : }
     155             : 
     156             : //____________________________________________________
     157             : void AliMUONRawClusterV2::AddDigitId(UInt_t id)
     158             : {
     159             :   /// Reset size of array of digits Id and add the new id to its content
     160             :   
     161        2648 :   UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
     162        1324 :   memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
     163        1324 :   digitsIdNew[fNDigits++] = id;
     164        2484 :   delete[] fDigitsId;
     165        1324 :   fDigitsId = digitsIdNew;
     166        1324 : }
     167             : 
     168             : //____________________________________________________
     169             : Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
     170             : {
     171             : /// Compare
     172             : 
     173           0 :   const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
     174           0 :   if ( GetCharge() > raw->GetCharge() ) 
     175             :   {
     176           0 :     return 1;
     177             :   }
     178           0 :   else if ( GetCharge() < raw->GetCharge() ) 
     179             :   {
     180           0 :     return -1;
     181             :   }
     182           0 :   return 0;
     183           0 : }

Generated by: LCOV version 1.11