ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/* $Id$ */

//-----------------------------------------------------------------------------
/// \class AliMUONRawClusterV2
///
/// Class for the MUON RecPoint
///
/// \author Philippe Pillot, Subatech
//-----------------------------------------------------------------------------


#include "AliMUONRawClusterV2.h"

#include "AliLog.h"

#include <TClonesArray.h>
#include <Riostream.h>

/// \cond CLASSIMP
ClassImp(AliMUONRawClusterV2)
/// \endcond


//____________________________________________________
AliMUONRawClusterV2::AliMUONRawClusterV2() 
  : AliMUONVCluster(),
    fX(FLT_MAX),
    fY(FLT_MAX),
    fZ(FLT_MAX),
    fErrX2(FLT_MAX),
    fErrY2(FLT_MAX),
    fQ(0.),
    fChi2(0.),
    fNDigits(0),
    fDigitsId(0x0),
    fMCLabel(-1)
{
  /// Default Constructor
}

//_____________________________________________________________________________
AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
  : AliMUONVCluster(chamberId, detElemId, clusterIndex),
    fX(FLT_MAX),
    fY(FLT_MAX),
    fZ(FLT_MAX),
    fErrX2(FLT_MAX),
    fErrY2(FLT_MAX),
    fQ(0.),
    fChi2(0.),
    fNDigits(0),
    fDigitsId(0x0),
    fMCLabel(-1)
{
  /// Constructor
}

//____________________________________________________
AliMUONRawClusterV2::~AliMUONRawClusterV2() 
{
  /// Destructor
  delete [] fDigitsId;
}

//____________________________________________________
AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
  : AliMUONVCluster(cluster),
    fX(cluster.fX),
    fY(cluster.fY),
    fZ(cluster.fZ),
    fErrX2(cluster.fErrX2),
    fErrY2(cluster.fErrY2),
    fQ(cluster.fQ),
    fChi2(cluster.fChi2),
    fNDigits(cluster.fNDigits),
    fDigitsId(0x0),
    fMCLabel(cluster.fMCLabel)

{
  /// Copy constructor
  
  if (cluster.fDigitsId) {
    fDigitsId = new UInt_t[fNDigits];
    memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
  }
}

  //__________________________________________________________________________
AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
{
  /// Asignment operator
  
  // check assignement to self
  if (this == &cluster)
    return *this;

  // base class assignement
  AliMUONVCluster::operator=(cluster);
  
  fX = cluster.fX;
  fY = cluster.fY;
  fZ = cluster.fZ;
  fErrX2 = cluster.fErrX2;
  fErrY2 = cluster.fErrY2;
  fQ = cluster.fQ;
  fChi2 = cluster.fChi2;
  SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
  fMCLabel = cluster.fMCLabel;

  return *this;
}

//____________________________________________________
void AliMUONRawClusterV2::Clear(Option_t*)
{
  /// clear memory
  delete [] fDigitsId;
  fDigitsId = 0x0;
  fNDigits = 0;
}

//____________________________________________________
void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
{
  /// Set size of array of digits Id to n ints and set the content
  /// if digitsId is not given the array is filled with id=0
  
  if (fDigitsId && fNDigits != nDigits) {
    delete [] fDigitsId;
    fDigitsId = 0;
  }
  fNDigits = nDigits;
  if (fNDigits == 0) return;
  if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
  if (digitsId == 0)
    for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
  else
    memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
}

//____________________________________________________
void AliMUONRawClusterV2::AddDigitId(UInt_t id)
{
  /// Reset size of array of digits Id and add the new id to its content
  
  UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
  memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
  digitsIdNew[fNDigits++] = id;
  delete[] fDigitsId;
  fDigitsId = digitsIdNew;
}

//____________________________________________________
Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
{
/// Compare

  const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
  if ( GetCharge() > raw->GetCharge() ) 
  {
    return 1;
  }
  else if ( GetCharge() < raw->GetCharge() ) 
  {
    return -1;
  }
  return 0;
}
 AliMUONRawClusterV2.cxx:1
 AliMUONRawClusterV2.cxx:2
 AliMUONRawClusterV2.cxx:3
 AliMUONRawClusterV2.cxx:4
 AliMUONRawClusterV2.cxx:5
 AliMUONRawClusterV2.cxx:6
 AliMUONRawClusterV2.cxx:7
 AliMUONRawClusterV2.cxx:8
 AliMUONRawClusterV2.cxx:9
 AliMUONRawClusterV2.cxx:10
 AliMUONRawClusterV2.cxx:11
 AliMUONRawClusterV2.cxx:12
 AliMUONRawClusterV2.cxx:13
 AliMUONRawClusterV2.cxx:14
 AliMUONRawClusterV2.cxx:15
 AliMUONRawClusterV2.cxx:16
 AliMUONRawClusterV2.cxx:17
 AliMUONRawClusterV2.cxx:18
 AliMUONRawClusterV2.cxx:19
 AliMUONRawClusterV2.cxx:20
 AliMUONRawClusterV2.cxx:21
 AliMUONRawClusterV2.cxx:22
 AliMUONRawClusterV2.cxx:23
 AliMUONRawClusterV2.cxx:24
 AliMUONRawClusterV2.cxx:25
 AliMUONRawClusterV2.cxx:26
 AliMUONRawClusterV2.cxx:27
 AliMUONRawClusterV2.cxx:28
 AliMUONRawClusterV2.cxx:29
 AliMUONRawClusterV2.cxx:30
 AliMUONRawClusterV2.cxx:31
 AliMUONRawClusterV2.cxx:32
 AliMUONRawClusterV2.cxx:33
 AliMUONRawClusterV2.cxx:34
 AliMUONRawClusterV2.cxx:35
 AliMUONRawClusterV2.cxx:36
 AliMUONRawClusterV2.cxx:37
 AliMUONRawClusterV2.cxx:38
 AliMUONRawClusterV2.cxx:39
 AliMUONRawClusterV2.cxx:40
 AliMUONRawClusterV2.cxx:41
 AliMUONRawClusterV2.cxx:42
 AliMUONRawClusterV2.cxx:43
 AliMUONRawClusterV2.cxx:44
 AliMUONRawClusterV2.cxx:45
 AliMUONRawClusterV2.cxx:46
 AliMUONRawClusterV2.cxx:47
 AliMUONRawClusterV2.cxx:48
 AliMUONRawClusterV2.cxx:49
 AliMUONRawClusterV2.cxx:50
 AliMUONRawClusterV2.cxx:51
 AliMUONRawClusterV2.cxx:52
 AliMUONRawClusterV2.cxx:53
 AliMUONRawClusterV2.cxx:54
 AliMUONRawClusterV2.cxx:55
 AliMUONRawClusterV2.cxx:56
 AliMUONRawClusterV2.cxx:57
 AliMUONRawClusterV2.cxx:58
 AliMUONRawClusterV2.cxx:59
 AliMUONRawClusterV2.cxx:60
 AliMUONRawClusterV2.cxx:61
 AliMUONRawClusterV2.cxx:62
 AliMUONRawClusterV2.cxx:63
 AliMUONRawClusterV2.cxx:64
 AliMUONRawClusterV2.cxx:65
 AliMUONRawClusterV2.cxx:66
 AliMUONRawClusterV2.cxx:67
 AliMUONRawClusterV2.cxx:68
 AliMUONRawClusterV2.cxx:69
 AliMUONRawClusterV2.cxx:70
 AliMUONRawClusterV2.cxx:71
 AliMUONRawClusterV2.cxx:72
 AliMUONRawClusterV2.cxx:73
 AliMUONRawClusterV2.cxx:74
 AliMUONRawClusterV2.cxx:75
 AliMUONRawClusterV2.cxx:76
 AliMUONRawClusterV2.cxx:77
 AliMUONRawClusterV2.cxx:78
 AliMUONRawClusterV2.cxx:79
 AliMUONRawClusterV2.cxx:80
 AliMUONRawClusterV2.cxx:81
 AliMUONRawClusterV2.cxx:82
 AliMUONRawClusterV2.cxx:83
 AliMUONRawClusterV2.cxx:84
 AliMUONRawClusterV2.cxx:85
 AliMUONRawClusterV2.cxx:86
 AliMUONRawClusterV2.cxx:87
 AliMUONRawClusterV2.cxx:88
 AliMUONRawClusterV2.cxx:89
 AliMUONRawClusterV2.cxx:90
 AliMUONRawClusterV2.cxx:91
 AliMUONRawClusterV2.cxx:92
 AliMUONRawClusterV2.cxx:93
 AliMUONRawClusterV2.cxx:94
 AliMUONRawClusterV2.cxx:95
 AliMUONRawClusterV2.cxx:96
 AliMUONRawClusterV2.cxx:97
 AliMUONRawClusterV2.cxx:98
 AliMUONRawClusterV2.cxx:99
 AliMUONRawClusterV2.cxx:100
 AliMUONRawClusterV2.cxx:101
 AliMUONRawClusterV2.cxx:102
 AliMUONRawClusterV2.cxx:103
 AliMUONRawClusterV2.cxx:104
 AliMUONRawClusterV2.cxx:105
 AliMUONRawClusterV2.cxx:106
 AliMUONRawClusterV2.cxx:107
 AliMUONRawClusterV2.cxx:108
 AliMUONRawClusterV2.cxx:109
 AliMUONRawClusterV2.cxx:110
 AliMUONRawClusterV2.cxx:111
 AliMUONRawClusterV2.cxx:112
 AliMUONRawClusterV2.cxx:113
 AliMUONRawClusterV2.cxx:114
 AliMUONRawClusterV2.cxx:115
 AliMUONRawClusterV2.cxx:116
 AliMUONRawClusterV2.cxx:117
 AliMUONRawClusterV2.cxx:118
 AliMUONRawClusterV2.cxx:119
 AliMUONRawClusterV2.cxx:120
 AliMUONRawClusterV2.cxx:121
 AliMUONRawClusterV2.cxx:122
 AliMUONRawClusterV2.cxx:123
 AliMUONRawClusterV2.cxx:124
 AliMUONRawClusterV2.cxx:125
 AliMUONRawClusterV2.cxx:126
 AliMUONRawClusterV2.cxx:127
 AliMUONRawClusterV2.cxx:128
 AliMUONRawClusterV2.cxx:129
 AliMUONRawClusterV2.cxx:130
 AliMUONRawClusterV2.cxx:131
 AliMUONRawClusterV2.cxx:132
 AliMUONRawClusterV2.cxx:133
 AliMUONRawClusterV2.cxx:134
 AliMUONRawClusterV2.cxx:135
 AliMUONRawClusterV2.cxx:136
 AliMUONRawClusterV2.cxx:137
 AliMUONRawClusterV2.cxx:138
 AliMUONRawClusterV2.cxx:139
 AliMUONRawClusterV2.cxx:140
 AliMUONRawClusterV2.cxx:141
 AliMUONRawClusterV2.cxx:142
 AliMUONRawClusterV2.cxx:143
 AliMUONRawClusterV2.cxx:144
 AliMUONRawClusterV2.cxx:145
 AliMUONRawClusterV2.cxx:146
 AliMUONRawClusterV2.cxx:147
 AliMUONRawClusterV2.cxx:148
 AliMUONRawClusterV2.cxx:149
 AliMUONRawClusterV2.cxx:150
 AliMUONRawClusterV2.cxx:151
 AliMUONRawClusterV2.cxx:152
 AliMUONRawClusterV2.cxx:153
 AliMUONRawClusterV2.cxx:154
 AliMUONRawClusterV2.cxx:155
 AliMUONRawClusterV2.cxx:156
 AliMUONRawClusterV2.cxx:157
 AliMUONRawClusterV2.cxx:158
 AliMUONRawClusterV2.cxx:159
 AliMUONRawClusterV2.cxx:160
 AliMUONRawClusterV2.cxx:161
 AliMUONRawClusterV2.cxx:162
 AliMUONRawClusterV2.cxx:163
 AliMUONRawClusterV2.cxx:164
 AliMUONRawClusterV2.cxx:165
 AliMUONRawClusterV2.cxx:166
 AliMUONRawClusterV2.cxx:167
 AliMUONRawClusterV2.cxx:168
 AliMUONRawClusterV2.cxx:169
 AliMUONRawClusterV2.cxx:170
 AliMUONRawClusterV2.cxx:171
 AliMUONRawClusterV2.cxx:172
 AliMUONRawClusterV2.cxx:173
 AliMUONRawClusterV2.cxx:174
 AliMUONRawClusterV2.cxx:175
 AliMUONRawClusterV2.cxx:176
 AliMUONRawClusterV2.cxx:177
 AliMUONRawClusterV2.cxx:178
 AliMUONRawClusterV2.cxx:179
 AliMUONRawClusterV2.cxx:180
 AliMUONRawClusterV2.cxx:181
 AliMUONRawClusterV2.cxx:182
 AliMUONRawClusterV2.cxx:183