* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.2 2000/10/06 16:49:46 cblume
-Made Getters const
+/* $Id$ */
-Revision 1.1.2.1 2000/09/22 14:47:52 cblume
-Add the tracking code
-
-*/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// TRD cluster //
+// //
+///////////////////////////////////////////////////////////////////////////////
#include "AliTRDcluster.h"
-#include "AliTRDgeometry.h"
-#include "AliTRDrecPoint.h"
-
ClassImp(AliTRDcluster)
-
-//_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster() {
- //default constructor
- fDetector = fTimeBin = 0;
- fTracks[0]=fTracks[1]=fTracks[2]=0;
- fY=fZ=fQ=fSigmaY2=fSigmaZ2=0.;
+//___________________________________________________________________________
+AliTRDcluster::AliTRDcluster()
+ :AliCluster()
+ ,fDetector(0)
+ ,fTimeBin(0)
+ ,fQ(0)
+ ,fNPads(0)
+ ,fCenter(0)
+ ,fPad(0)
+{
+ //
+ // Default constructor
+ //
+
+ for (Int_t i = 0; i < 7; i++) {
+ fSignals[i] = 0;
+ }
+
}
-//_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster(AliTRDrecPoint *rp)
-{
+//___________________________________________________________________________
+AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
+ , Float_t *pos, Float_t *sig
+ , Int_t *tracks, Char_t npads, Short_t *signals
+ , UChar_t col, Char_t timebin
+ , Float_t center, UShort_t volid)
+ :AliCluster(volid,pos[2],pos[0],pos[1],sig[0],sig[1],0.0,0x0)
+ ,fDetector(det)
+ ,fTimeBin(timebin)
+ ,fQ(q)
+ ,fNPads(npads)
+ ,fCenter(center)
+ ,fPad(col)
+{
//
- // constructor from AliTRDrecPoint
+ // Constructor
//
- fDetector = rp->GetDetector();
- fTimeBin = rp->GetLocalTimeBin();
+ for (Int_t i = 0; i < 7; i++) {
+ fSignals[i] = signals[i];
+ }
- fTracks[0] = rp->GetTrackIndex(0);
- fTracks[1] = rp->GetTrackIndex(1);
- fTracks[2] = rp->GetTrackIndex(2);
+ if (tracks) {
+ AddTrackIndex(tracks);
+ }
- fQ = rp->GetEnergy();
+}
- fY = rp->GetY();
- fZ = rp->GetZ();
- fSigmaY2 = rp->GetSigmaY2();
- fSigmaZ2 = rp->GetSigmaZ2();
+//_____________________________________________________________________________
+AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
+ :AliCluster(c)
+ ,fDetector(c.fDetector)
+ ,fTimeBin(c.fTimeBin)
+ ,fQ(c.fQ)
+ ,fNPads(c.fNPads)
+ ,fCenter(c.fCenter)
+ ,fPad(c.fPad)
+{
+ //
+ // Copy constructor
+ //
+
+ SetLabel(c.GetLabel(0),0);
+ SetLabel(c.GetLabel(1),1);
+ SetLabel(c.GetLabel(2),2);
+
+ SetY(c.GetY());
+ SetZ(c.GetZ());
+ SetSigmaY2(c.GetSigmaY2());
+ SetSigmaZ2(c.GetSigmaZ2());
- fSigmaY2 = 0.2;
- fSigmaZ2 = 5.;
+ for (Int_t i = 0; i < 7; i++) {
+ fSignals[i] = c.fSignals[i];
+ }
}
//_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster(AliTRDcluster *cl)
+void AliTRDcluster::AddTrackIndex(Int_t *track)
{
//
- // Copy constructor
+ // Adds track index. Currently assumed that track is an array of
+ // size 9, and up to 3 track indexes are stored in fTracks[3].
+ // Indexes are sorted according to:
+ // 1) index of max number of appearances is stored first
+ // 2) if two or more indexes appear equal number of times, the lowest
+ // ones are stored first;
//
- fDetector = cl->GetDetector();
- fTimeBin = cl->GetLocalTimeBin();
+ const Int_t kSize = 9;
+ Int_t entries[kSize][2];
+
+ Int_t i = 0;
+ Int_t j = 0;
+ Int_t k = 0;
+ Int_t index;
+ Bool_t indexAdded;
+
+ for (i = 0; i < kSize; i++) {
+ entries[i][0] = -1;
+ entries[i][1] = 0;
+ }
+
+ for (k = 0; k < kSize; k++) {
+
+ index = track[k];
+ indexAdded = kFALSE;
+
+ j = 0;
+ if (index >= 0) {
+ while ((!indexAdded) && (j < kSize)) {
+ if ((entries[j][0] == index) ||
+ (entries[j][1] == 0)) {
+ entries[j][0] = index;
+ entries[j][1] = entries[j][1] + 1;
+ indexAdded = kTRUE;
+ }
+ j++;
+ }
+ }
+
+ }
+
+ // Sort by number of appearances and index value
+ Int_t swap = 1;
+ Int_t tmp0;
+ Int_t tmp1;
+ while (swap > 0) {
+ swap = 0;
+ for (i = 0; i < (kSize - 1); i++) {
+ if ((entries[i][0] >= 0) &&
+ (entries[i+1][0] >= 0)) {
+ if ((entries[i][1] < entries[i+1][1]) ||
+ ((entries[i][1] == entries[i+1][1]) &&
+ (entries[i][0] > entries[i+1][0]))) {
+ tmp0 = entries[i][0];
+ tmp1 = entries[i][1];
+ entries[i][0] = entries[i+1][0];
+ entries[i][1] = entries[i+1][1];
+ entries[i+1][0] = tmp0;
+ entries[i+1][1] = tmp1;
+ swap++;
+ }
+ }
+ }
+ }
+
+ // Set track indexes
+ for (i = 0; i < 3; i++) {
+ SetLabel(entries[i][0],i);
+ }
+
+ return;
+
+}
- fTracks[0] = cl->GetTrackIndex(0);
- fTracks[1] = cl->GetTrackIndex(1);
- fTracks[2] = cl->GetTrackIndex(2);
+//_____________________________________________________________________________
+Float_t AliTRDcluster::GetSumS() const
+{
+ //
+ // Returns the total charge from a not unfolded cluster
+ //
- fQ = cl->GetQ();
+ Float_t sum = 0.0;
+ for (Int_t i = 0; i < 7; i++) {
+ sum += fSignals[i];
+ }
- fY = cl->GetY();
- fZ = cl->GetZ();
- fSigmaY2 = cl->GetSigmaY2();
- fSigmaZ2 = cl->GetSigmaZ2();
+ return sum;
}
-