ROOT logo
#ifndef ALIMUONRAWCLUSTER_H
#define ALIMUONRAWCLUSTER_H

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */
// Revision of includes 07/05/2004

/// \ingroup base
/// \class AliMUONRawCluster
/// \brief MUON raw cluster
///
/// Class for the MUON RecPoint
/// It contains the properties of the physics cluters found in the tracking chambers
/// RawCluster contains also the information from the both cathode of the chambers.


#include "AliMUONVCluster.h"
#include <TMath.h> // because of inline funtion GetRadius
#include <TArrayF.h>

class AliMUONRawCluster : public AliMUONVCluster {

public:
   AliMUONRawCluster();
   virtual ~AliMUONRawCluster();
   
           /// Clear method (used by TClonesArray)
   virtual void Clear(Option_t* = "") {}
   
           /// Create a copy of the current cluster
   virtual AliMUONRawCluster* Clone(const char* = "") const {return new AliMUONRawCluster(*this);}
   
           /// Set coordinates (cm)
  virtual void     SetXYZ(Double_t x, Double_t y, Double_t z) {fX[0] = x; fY[0] = y; fZ[0] = z;}
           /// Return coordinate X (cm)
  virtual Double_t GetX() const {return fX[0];}
           /// Return coordinate Y (cm)
  virtual Double_t GetY() const {return fY[0];}
           /// Return coordinate Z (cm)
  virtual Double_t GetZ() const {return fZ[0];}
  
	   /// Set resolution (cm) on coordinates (X,Y)
  virtual void     SetErrXY(Double_t errX, Double_t errY) {fErrXY[0] = errX; fErrXY[1] = errY;}
           /// Return resolution (cm) on coordinate X
  virtual Double_t GetErrX() const {return fErrXY[0];}
           /// Return resolution**2 (cm**2) on coordinate X
  virtual Double_t GetErrX2() const {return fErrXY[0] * fErrXY[0];}
           /// Return resolution (cm) on coordinate Y
  virtual Double_t GetErrY() const {return fErrXY[1];}
           /// Return resolution**2 (cm**2) on coordinate Y
  virtual Double_t GetErrY2() const {return fErrXY[1] * fErrXY[1];}
  
           /// Set the cluster charge
  virtual void     SetCharge(Double_t q) {fQ[0] = q;}
           /// Set the cluster charge
  virtual Double_t GetCharge() const {return fQ[0];}
  
           /// Return chamber Id
  virtual Int_t    GetChamberId() const {return fDetElemId/100 - 1;}
           /// Set detection element Id
          void     SetDetElemId(Int_t id) {fDetElemId = id;}
           /// Return detection element Id
  virtual Int_t    GetDetElemId() const {return fDetElemId;}
  
  virtual void     SetDigitsId(Int_t nDigits, const UInt_t *digitsId);
           /// Add a digit Id to the array of associated digits
  virtual void     AddDigitId(UInt_t id) {fIndexMap[fMultiplicity[0]++][0] = id;}

           /// Return number of associated digits
  virtual Int_t    GetNDigits() const {return fMultiplicity[0];}
           /// Return Id of digits i
  virtual UInt_t   GetDigitId(Int_t i) const {return (i < fMultiplicity[0] && i < 50) ? (UInt_t)fIndexMap[i][0] : 0;}
  
           /// Set chi2 of cluster
  virtual void     SetChi2( Double_t chi2) {fChi2[0] = chi2;}
           /// Return chi2 of cluster
  virtual Double_t GetChi2() const {return fChi2[0];}
   
           /// Set the corresponding MC track number
  virtual void     SetMCLabel(Int_t label) {SetTrack(0, label);}
           /// Return the corresponding MC track number
  virtual Int_t    GetMCLabel() const {return GetTrack(0);}
  
  /// Return radius
   Float_t      GetRadius(Int_t i) const {return TMath::Sqrt(fX[i]*fX[i]+fY[i]*fY[i]);}
   /// Return true as the function Compare() is implemented
   Bool_t       IsSortable() const {return kTRUE;}
   Int_t        Compare(const TObject *obj) const;
   Int_t        PhysicsContribution() const;
   virtual void Print(Option_t* opt="") const;
   static Int_t BinarySearch(Float_t r, TArrayF ccord, Int_t from, Int_t upto);
   static void  SortMin(Int_t *idx,Float_t *xdarray, Float_t *xarray, Float_t *yarray, Float_t *qarray,Int_t ntr);
   void         DumpIndex();

   Int_t        AddCharge(Int_t i, Float_t Q);
   Int_t        AddX(Int_t i, Float_t X);
   Int_t        AddY(Int_t i, Float_t Y);
   Int_t        AddZ(Int_t i, Float_t Z);

   Float_t      GetCharge(Int_t i) const;
   Float_t      GetX(Int_t i) const;
   Float_t      GetY(Int_t i) const;
   Float_t      GetZ(Int_t i) const;
   Int_t        GetTrack(Int_t i=0) const;
   Float_t      GetPeakSignal(Int_t i=0) const;
   Int_t        GetMultiplicity(Int_t i=0) const;
   Int_t        GetClusterType() const;
   Int_t        GetGhost() const;
   Int_t        GetNcluster(Int_t i=0) const;
   Float_t      GetChi2(Int_t i) const;
   Int_t        GetIndex(Int_t i, Int_t j) const;
   Int_t        GetOffset(Int_t i, Int_t j) const;
   Float_t      GetContrib(Int_t i, Int_t j) const;
   Int_t        GetPhysics(Int_t i) const;

   Int_t        SetCharge(Int_t i, Float_t Q);
   Int_t        SetX(Int_t i, Float_t X);
   Int_t        SetY(Int_t i, Float_t Y);
   Int_t        SetZ(Int_t i, Float_t Z);
   Int_t        SetTrack(Int_t i, Int_t track);
   Int_t        SetPeakSignal(Int_t i, Float_t peaksignal);
   Int_t        SetMultiplicity(Int_t i, Int_t mul);
   Int_t        SetClusterType(Int_t type);
   Int_t        SetGhost(Int_t ghost);
   Int_t        SetNcluster(Int_t i, Int_t ncluster);
   Int_t        SetChi2(Int_t i, Float_t chi2);
   void         SetIndex(Int_t i, Int_t j, Int_t index);
   void         SetOffset(Int_t i, Int_t j, Int_t offset);
   void         SetContrib(Int_t i, Int_t j, Float_t contrib);
   void         SetPhysics(Int_t i, Int_t physics);

private:
   Int_t       fIndexMap[50][2];  ///< Indices of digits
   Int_t       fOffsetMap[50][2]; ///< Emmanuel special
   Float_t     fContMap[50][2];   ///< Contribution from digit
   Int_t       fPhysicsMap[50];   ///< Distinguish signal and background contr.
  
   Float_t     fQ[2]  ;           ///< Q of cluster (in ADC counts)     
   Float_t     fX[2]  ;           ///< X of cluster
   Float_t     fY[2]  ;           ///< Y of cluster
   Float_t     fZ[2]  ;           ///< Z of cluster
   Int_t       fTracks[3];        ///< Labels of overlapped tracks
   Float_t     fPeakSignal[2];    ///< Peak signal 
   Int_t       fMultiplicity[2];  ///< Cluster multiplicity
   Int_t       fClusterType;      ///< Cluster type
   Int_t       fGhost;            ///< Ghost info
                                  // 0 if not a ghost or ghost problem solved
                                  // >0 if ghost problem remains because
                                  // 1 both (true and ghost) satify 
                                  //   charge chi2 compatibility
                                  // 2 none give satisfactory chi2
   Int_t       fNcluster[2];      ///< Number of clusters
   Float_t     fChi2[2];          ///< Chi**2 of fit
   Int_t       fDetElemId;        ///< ID number of the detection element (slat) on which the cluster is found. 
   Float_t     fErrXY[2];         ///< coordinate errors
   
   ClassDef(AliMUONRawCluster,3)  //Cluster class for MUON
};

// inline functions

/// Return Indices of digits
inline  Int_t  AliMUONRawCluster::GetIndex(Int_t i, Int_t j) const
{ return fIndexMap[i][j]; }

/// Return Emmanuel special offset map
inline  Int_t  AliMUONRawCluster::GetOffset(Int_t i, Int_t j) const
{ return fOffsetMap[i][j]; }

/// Return Contribution from digit
inline  Float_t  AliMUONRawCluster::GetContrib(Int_t i, Int_t j) const
{ return fContMap[i][j]; }

/// Return Distinguish signal and background contr.
inline  Int_t  AliMUONRawCluster::GetPhysics(Int_t i) const
{ return fPhysicsMap[i]; }

/// Set Indices of digits
inline  void  AliMUONRawCluster::SetIndex(Int_t i, Int_t j, Int_t index)
{ fIndexMap[i][j] = index; }

/// Set Emmanuel special offset map
inline  void  AliMUONRawCluster::SetOffset(Int_t i, Int_t j, Int_t offset)
{ fOffsetMap[i][j] = offset; }

/// Set Contribution from digit
inline  void  AliMUONRawCluster::SetContrib(Int_t i, Int_t j, Float_t contrib)
{ fContMap[i][j] = contrib; }

/// Set Distinguish signal and background contr.
inline  void  AliMUONRawCluster::SetPhysics(Int_t i, Int_t physics)
{ fPhysicsMap[i] = physics; }


#endif

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