ROOT logo
#ifndef ALIITSCLUSTERERV2_H
#define ALIITSCLUSTERERV2_H
//--------------------------------------------------------------
//                       ITS clusterer V2
//
//   This can be a "wrapping" for the V1 cluster finding classes
//   if compiled with uncommented "#define V1" line 
//   in the AliITSclustererV2.cxx file.
//
//   Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
//--------------------------------------------------------------
#include <TObject.h>

class TFile;
class TTree;
class TClonesArray;

class AliITSclusterV2;
class AliRawReader;
class AliITSRawStream;

class AliITSclustererV2 : public TObject {
public:
  AliITSclustererV2();
  AliITSclustererV2(const Char_t *geom);

  void SetEvent(Int_t event) { fEvent=event; }
  Int_t Digits2Clusters(TTree *in, TTree *out);
  void Digits2Clusters(AliRawReader* rawReader);
  void FindClustersSPD(const TClonesArray *dig, TClonesArray *cls);
  void FindClustersSPD(AliITSRawStream* input, TClonesArray** clusters);
  void FindClustersSDD(const TClonesArray *dig, TClonesArray *cls);
  void FindClustersSDD(AliITSRawStream* input, TClonesArray** clusters);
  void FindClustersSSD(const TClonesArray *dig, TClonesArray *cls);
  void FindClustersSSD(AliITSRawStream* input, TClonesArray** clusters);

  void RecPoints2Clusters(const TClonesArray *p, Int_t idx, TClonesArray *c);

  class Ali1Dcluster {
  public:
    void SetY(Float_t y) {fY=y;}
    void SetQ(Float_t q) {fQ=q;}
    void SetNd(Int_t n)  {fNd=n;}
    void SetLabels(Int_t *lab) {fLab[0]=lab[0];fLab[1]=lab[1];fLab[2]=lab[2];}
    Float_t GetY() const {return fY;}
    Float_t GetQ() const {return fQ;}
    Int_t GetNd()const {return fNd;}
    Int_t GetLabel(Int_t lab) const { return fLab[lab]; }
  private:
    Float_t fY; //cluster position
    Float_t fQ; //cluster charge
    Int_t fNd;  //number of digits
    Int_t fLab[3]; //track label
  };
  class AliBin {
  public:
    AliBin():fIndex(0),fMask(0xFFFFFFFE),fQ(0) {}
    void SetIndex(UInt_t idx) {fIndex=idx;}
    void SetQ(UShort_t q)  {fQ=q;}
    void SetMask(UInt_t m) {fMask=m;}
    void Reset() {fIndex=0; fMask=0xFFFFFFFE; fQ=0;}

    void Use() {fMask&=0xFFFFFFFE;}
    Bool_t IsNotUsed() const {return (fMask&1);}
    Bool_t IsUsed() const {return !(IsNotUsed());}

    UInt_t   GetIndex() const {return fIndex;}
    UShort_t GetQ()     const {return fQ;}
    UInt_t   GetMask()  const {return fMask;}
  private:
    UInt_t fIndex; //digit index
    UInt_t fMask; //peak mask
    UShort_t fQ;  //signal
  };
  static Bool_t IsMaximum(Int_t k, Int_t max, const AliBin *bins);
  static void FindPeaks(Int_t k,Int_t m,AliBin*b,Int_t*idx,UInt_t*msk,Int_t&n);
  static void MarkPeak(Int_t k, Int_t max, AliBin *bins, UInt_t m);
  static void MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,
   AliITSclusterV2 &c);
  void FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nMaxZ,
		       const TClonesArray *dig, TClonesArray *cls);
  void FindClustersSSD(Ali1Dcluster* neg, Int_t nn, 
		       Ali1Dcluster* pos, Int_t np,
		       TClonesArray *clusters);


  static void FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx);

protected:
  Int_t fNModules;             // total number of modules

private:
  Int_t fEvent;           //event number

  Int_t fI;                     //index of the current subdetector
  Float_t fYshift[2200];       //y-shifts of detector local coor. systems 
  Float_t fZshift[2200];       //z-shifts of detector local coor. systems 
  Int_t fNdet[2200];            //detector index  
  Int_t fNlayer[2200];          //detector layer

  //SPD related values:
  Int_t fLastSPD1;       //index of the last SPD1 detector
  Int_t fNySPD;          //number of pixels in Y
  Int_t fNzSPD;          //number of pixels in Z
  Float_t fYpitchSPD;    //pixel size in Y
  Float_t fZ1pitchSPD,fZ2pitchSPD;    //pixel sizes in Z
  Float_t fHwSPD;        //half width of the SPD detector
  Float_t fHlSPD;        //half length of the SPD detector
  Float_t fYSPD[260];    //Y-coordinates of pixel centers
  Float_t fZSPD[170];    //Z-coordinates of pixel centers

  //SDD related values:
  Int_t fNySDD;           //number of "pixels" in Y
  Int_t fNzSDD;           //number of "pixels" in Z
  Float_t fYpitchSDD;     //"pixel size" in Y (drift direction)
  Float_t fZpitchSDD;     //"pixel sizes" in Z
  Float_t fHwSDD;         //half width of the SDD detector
  Float_t fHlSDD;         //half length of the SDD detector
  Float_t fYoffSDD;       //some delay in the drift channel   

  //SSD related values:
  Int_t fLastSSD1;        //index of the last SSD1 detector   
  Float_t fYpitchSSD;     //strip pitch (cm)
  Float_t fHwSSD;         //half-width of an SSD detector (cm)
  Float_t fHlSSD;         //half-length of an SSD detector (cm)
  Float_t fTanP;          //tangent of the stereo angle on the P side
  Float_t fTanN;          //tangent of the stereo angle on the N side

  ClassDef(AliITSclustererV2,1)  // ITS cluster finder V2
};

#endif
 AliITSclustererV2.h:1
 AliITSclustererV2.h:2
 AliITSclustererV2.h:3
 AliITSclustererV2.h:4
 AliITSclustererV2.h:5
 AliITSclustererV2.h:6
 AliITSclustererV2.h:7
 AliITSclustererV2.h:8
 AliITSclustererV2.h:9
 AliITSclustererV2.h:10
 AliITSclustererV2.h:11
 AliITSclustererV2.h:12
 AliITSclustererV2.h:13
 AliITSclustererV2.h:14
 AliITSclustererV2.h:15
 AliITSclustererV2.h:16
 AliITSclustererV2.h:17
 AliITSclustererV2.h:18
 AliITSclustererV2.h:19
 AliITSclustererV2.h:20
 AliITSclustererV2.h:21
 AliITSclustererV2.h:22
 AliITSclustererV2.h:23
 AliITSclustererV2.h:24
 AliITSclustererV2.h:25
 AliITSclustererV2.h:26
 AliITSclustererV2.h:27
 AliITSclustererV2.h:28
 AliITSclustererV2.h:29
 AliITSclustererV2.h:30
 AliITSclustererV2.h:31
 AliITSclustererV2.h:32
 AliITSclustererV2.h:33
 AliITSclustererV2.h:34
 AliITSclustererV2.h:35
 AliITSclustererV2.h:36
 AliITSclustererV2.h:37
 AliITSclustererV2.h:38
 AliITSclustererV2.h:39
 AliITSclustererV2.h:40
 AliITSclustererV2.h:41
 AliITSclustererV2.h:42
 AliITSclustererV2.h:43
 AliITSclustererV2.h:44
 AliITSclustererV2.h:45
 AliITSclustererV2.h:46
 AliITSclustererV2.h:47
 AliITSclustererV2.h:48
 AliITSclustererV2.h:49
 AliITSclustererV2.h:50
 AliITSclustererV2.h:51
 AliITSclustererV2.h:52
 AliITSclustererV2.h:53
 AliITSclustererV2.h:54
 AliITSclustererV2.h:55
 AliITSclustererV2.h:56
 AliITSclustererV2.h:57
 AliITSclustererV2.h:58
 AliITSclustererV2.h:59
 AliITSclustererV2.h:60
 AliITSclustererV2.h:61
 AliITSclustererV2.h:62
 AliITSclustererV2.h:63
 AliITSclustererV2.h:64
 AliITSclustererV2.h:65
 AliITSclustererV2.h:66
 AliITSclustererV2.h:67
 AliITSclustererV2.h:68
 AliITSclustererV2.h:69
 AliITSclustererV2.h:70
 AliITSclustererV2.h:71
 AliITSclustererV2.h:72
 AliITSclustererV2.h:73
 AliITSclustererV2.h:74
 AliITSclustererV2.h:75
 AliITSclustererV2.h:76
 AliITSclustererV2.h:77
 AliITSclustererV2.h:78
 AliITSclustererV2.h:79
 AliITSclustererV2.h:80
 AliITSclustererV2.h:81
 AliITSclustererV2.h:82
 AliITSclustererV2.h:83
 AliITSclustererV2.h:84
 AliITSclustererV2.h:85
 AliITSclustererV2.h:86
 AliITSclustererV2.h:87
 AliITSclustererV2.h:88
 AliITSclustererV2.h:89
 AliITSclustererV2.h:90
 AliITSclustererV2.h:91
 AliITSclustererV2.h:92
 AliITSclustererV2.h:93
 AliITSclustererV2.h:94
 AliITSclustererV2.h:95
 AliITSclustererV2.h:96
 AliITSclustererV2.h:97
 AliITSclustererV2.h:98
 AliITSclustererV2.h:99
 AliITSclustererV2.h:100
 AliITSclustererV2.h:101
 AliITSclustererV2.h:102
 AliITSclustererV2.h:103
 AliITSclustererV2.h:104
 AliITSclustererV2.h:105
 AliITSclustererV2.h:106
 AliITSclustererV2.h:107
 AliITSclustererV2.h:108
 AliITSclustererV2.h:109
 AliITSclustererV2.h:110
 AliITSclustererV2.h:111
 AliITSclustererV2.h:112
 AliITSclustererV2.h:113
 AliITSclustererV2.h:114
 AliITSclustererV2.h:115
 AliITSclustererV2.h:116
 AliITSclustererV2.h:117
 AliITSclustererV2.h:118
 AliITSclustererV2.h:119
 AliITSclustererV2.h:120
 AliITSclustererV2.h:121
 AliITSclustererV2.h:122
 AliITSclustererV2.h:123
 AliITSclustererV2.h:124
 AliITSclustererV2.h:125
 AliITSclustererV2.h:126
 AliITSclustererV2.h:127
 AliITSclustererV2.h:128
 AliITSclustererV2.h:129
 AliITSclustererV2.h:130
 AliITSclustererV2.h:131
 AliITSclustererV2.h:132