LCOV - code coverage report
Current view: top level - STEER/ESD - AliESDMuonCluster.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 22 103 21.4 %
Date: 2016-06-14 17:26:59 Functions: 7 15 46.7 %

          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 AliESDMuonCluster
      20             : ///
      21             : /// Class to describe the MUON clusters in the Event Summary Data
      22             : ///
      23             : /// \author Philippe Pillot, Subatech
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : #include "AliESDEvent.h"
      27             : #include "AliESDMuonCluster.h"
      28             : #include "AliESDMuonPad.h"
      29             : 
      30             : #include "AliLog.h"
      31             : 
      32             : #include <TClonesArray.h>
      33             : #include <Riostream.h>
      34             : 
      35             : using std::endl;
      36             : using std::cout;
      37             : /// \cond CLASSIMP
      38         172 : ClassImp(AliESDMuonCluster)
      39             : /// \endcond
      40             : 
      41             : //_____________________________________________________________________________
      42             : AliESDMuonCluster::AliESDMuonCluster()
      43         250 : : TObject(),
      44         250 :   fCharge(0.),
      45         250 :   fChi2(0.),
      46         250 :   fPads(0x0),
      47         250 :   fNPads(0),
      48         250 :   fPadsId(0x0),
      49         250 :   fLabel(-1)
      50        1250 : {
      51             :   /// default constructor
      52         250 :   fXYZ[0] = fXYZ[1] = fXYZ[2] = 0.;
      53         250 :   fErrXY[0] = fErrXY[1] = 0.;
      54         500 : }
      55             : 
      56             : //_____________________________________________________________________________
      57             : AliESDMuonCluster::AliESDMuonCluster (const AliESDMuonCluster& cluster)
      58           0 : : TObject(cluster),
      59           0 :   fCharge(cluster.fCharge),
      60           0 :   fChi2(cluster.fChi2),
      61           0 :   fPads(0x0),
      62           0 :   fNPads(cluster.fNPads),
      63           0 :   fPadsId(0x0),
      64           0 :   fLabel(cluster.fLabel)
      65           0 : {
      66             :   /// Copy constructor
      67           0 :   fXYZ[0] = cluster.fXYZ[0];
      68           0 :   fXYZ[1] = cluster.fXYZ[1];
      69           0 :   fXYZ[2] = cluster.fXYZ[2];
      70           0 :   fErrXY[0] = cluster.fErrXY[0];
      71           0 :   fErrXY[1] = cluster.fErrXY[1];
      72             :   
      73           0 :   if (cluster.fPads) {
      74           0 :     fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
      75           0 :     AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
      76           0 :     while (pad) {
      77           0 :       new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
      78           0 :       pad = (AliESDMuonPad*) cluster.fPads->After(pad);
      79             :     }
      80           0 :   }
      81             :   
      82           0 :   if (cluster.fPadsId) fPadsId = new TArrayI(*(cluster.fPadsId));
      83           0 : }
      84             : 
      85             : //_____________________________________________________________________________
      86             : AliESDMuonCluster& AliESDMuonCluster::operator=(const AliESDMuonCluster& cluster)
      87             : {
      88             :   /// Equal operator
      89           0 :   if (this == &cluster) return *this;
      90             :   
      91           0 :   TObject::operator=(cluster); // don't forget to invoke the base class' assignment operator
      92             :   
      93           0 :   fXYZ[0] = cluster.fXYZ[0];
      94           0 :   fXYZ[1] = cluster.fXYZ[1];
      95           0 :   fXYZ[2] = cluster.fXYZ[2];
      96           0 :   fErrXY[0] = cluster.fErrXY[0];
      97           0 :   fErrXY[1] = cluster.fErrXY[1];
      98             :   
      99           0 :   fCharge = cluster.fCharge;
     100           0 :   fChi2 = cluster.fChi2;
     101           0 :   fLabel = cluster.fLabel;
     102             :   
     103           0 :   delete fPads;
     104           0 :   if (cluster.fPads) {
     105           0 :     fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
     106           0 :     AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
     107           0 :     while (pad) {
     108           0 :       new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
     109           0 :       pad = (AliESDMuonPad*) cluster.fPads->After(pad);
     110             :     }
     111           0 :   } else fPads = 0x0;
     112             :   
     113           0 :   SetPadsId(cluster.fNPads, cluster.GetPadsId());
     114             :   
     115           0 :   return *this;
     116           0 : }
     117             : 
     118             : //_____________________________________________________________________________
     119             : void AliESDMuonCluster::Copy(TObject &obj) const {
     120             :   
     121             :   /// This overwrites the virtual TOBject::Copy()
     122             :   /// to allow run time copying without casting
     123             :   /// in AliESDEvent
     124             : 
     125           0 :   if(this==&obj)return;
     126           0 :   AliESDMuonCluster *robj = dynamic_cast<AliESDMuonCluster*>(&obj);
     127           0 :   if(!robj)return; // not an AliESDMuonCluster
     128           0 :   *robj = *this;
     129             : 
     130           0 : }
     131             : 
     132             : //__________________________________________________________________________
     133             : AliESDMuonCluster::~AliESDMuonCluster()
     134         528 : {
     135             :   /// Destructor
     136          88 :   delete fPads;
     137          88 :   delete fPadsId;
     138         264 : }
     139             : 
     140             : //__________________________________________________________________________
     141             : void AliESDMuonCluster::Clear(Option_t* opt)
     142             : {
     143             :   /// Clear arrays
     144        1458 :   if (opt && opt[0] == 'C') {
     145         162 :     if (fPads) fPads->Clear("C");
     146             :   } else {
     147         648 :     delete fPads; fPads = 0x0;
     148             :   }
     149         972 :   delete fPadsId; fPadsId = 0x0;
     150         486 :   fNPads = 0;
     151         486 : }
     152             : 
     153             : //_____________________________________________________________________________
     154             : void AliESDMuonCluster::AddPadId(UInt_t padId)
     155             : {
     156             :   /// Add the given pad Id to the list associated to the cluster
     157           0 :   if (!fPadsId) fPadsId = new TArrayI(10);
     158           0 :   if (fPadsId->GetSize() <= fNPads) fPadsId->Set(fNPads+10);
     159           0 :   fPadsId->AddAt(static_cast<Int_t>(padId), fNPads++);
     160           0 : }
     161             : 
     162             : //_____________________________________________________________________________
     163             : void AliESDMuonCluster::SetPadsId(Int_t nPads, const UInt_t *padsId)
     164             : {
     165             :   /// Fill the list pads'Id associated to the cluster with the given list
     166             :   
     167           0 :   if (nPads <= 0 || !padsId) {
     168           0 :     delete fPadsId;
     169           0 :     fPadsId = 0x0;
     170           0 :     fNPads = 0;
     171           0 :     return;
     172             :   }
     173             :   
     174           0 :   if (!fPadsId) fPadsId = new TArrayI(nPads, reinterpret_cast<const Int_t*>(padsId));
     175           0 :   else fPadsId->Set(nPads, reinterpret_cast<const Int_t*>(padsId));
     176           0 :   fNPads = nPads;
     177             :   
     178           0 : }
     179             : 
     180             : //_____________________________________________________________________________
     181             : void AliESDMuonCluster::MovePadsToESD(AliESDEvent &esd)
     182             : {
     183             :   /// move the pads to the new ESD structure
     184           0 :   if (!fPads) return;
     185           0 :   for (Int_t i = 0; i < fPads->GetEntriesFast(); i++) {
     186           0 :     AliESDMuonPad *pad = static_cast<AliESDMuonPad*>(fPads->UncheckedAt(i));
     187           0 :     AliESDMuonPad *newPad = esd.NewMuonPad();
     188           0 :     *newPad = *pad;
     189           0 :     AddPadId(newPad->GetUniqueID());
     190             :   }
     191           0 :   delete fPads;
     192           0 :   fPads = 0x0;
     193           0 : }
     194             : 
     195             : //_____________________________________________________________________________
     196             : void AliESDMuonCluster::Print(Option_t */*option*/) const
     197             : {
     198             :   /// print cluster content
     199           0 :   UInt_t cId = GetUniqueID();
     200             :   
     201           0 :   cout<<Form("clusterID=%u (ch=%d, det=%d, index=%d)",
     202           0 :              cId,GetChamberId(),GetDetElemId(),GetClusterIndex())<<endl;
     203             :   
     204           0 :   cout<<Form("  position=(%5.2f, %5.2f, %5.2f), sigma=(%5.2f, %5.2f, 0.0)",
     205           0 :              GetX(),GetY(),GetZ(),GetErrX(),GetErrY())<<endl;
     206             :   
     207           0 :   cout<<Form("  charge=%5.2f, chi2=%5.2f, MClabel=%d", GetCharge(), GetChi2(), GetLabel())<<endl;
     208             :   
     209           0 :   if (PadsStored()) {
     210           0 :     cout<<"  pad infos:"<<endl;
     211           0 :     for (Int_t iPad=0; iPad<GetNPads(); iPad++) cout<<"  "<<GetPadId(iPad)<<endl;
     212           0 :   }
     213           0 : }
     214             : 

Generated by: LCOV version 1.11