1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.3 2000/10/15 23:40:01 cblume
21 Revision 1.2 2000/10/06 16:49:46 cblume
24 Revision 1.1.2.2 2000/10/04 16:34:58 cblume
25 Replace include files by forward declarations
27 Revision 1.1.2.1 2000/09/22 14:47:52 cblume
32 #include "AliTRDcluster.h"
33 #include "AliTRDtimeBin.h"
35 ClassImp(AliTRDtimeBin)
37 //______________________________________________________
39 AliTRDtimeBin::AliTRDtimeBin() {
42 for (Int_t i=0; i<kMAX_CLUSTER_PER_TIME_BIN; i++)
45 //______________________________________________________
47 void AliTRDtimeBin::InsertCluster(AliTRDcluster* c, UInt_t index) {
49 // Insert cluster in TimeBin cluster array.
50 // Clusters are sorted according to Y coordinate.
52 if (fN==kMAX_CLUSTER_PER_TIME_BIN) {
53 printf("AliTRDtimeBin::InsertCluster(): Too many clusters !\n");
56 if (fN==0) {fIndex[0]=index; fClusters[fN++]=c; return;}
57 Int_t i=Find(c->GetY());
58 memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTRDcluster*));
59 memmove(fIndex +i+1 ,fIndex +i,(fN-i)*sizeof(UInt_t));
60 fIndex[i]=index; fClusters[i]=c; fN++;
63 //______________________________________________________
65 Int_t AliTRDtimeBin::Find(Double_t y) const {
67 // Returns index of the cluster nearest in Y
69 if (y <= fClusters[0]->GetY()) return 0;
70 if (y > fClusters[fN-1]->GetY()) return fN;
71 Int_t b=0, e=fN-1, m=(b+e)/2;
72 for (; b<e; m=(b+e)/2) {
73 if (y > fClusters[m]->GetY()) b=m+1;
79 //______________________________________________________
80 AliTRDcluster *AliTRDtimeBin::operator[](Int_t i)