]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMultiplicity.h
Typo fixed, and removing unused variable.
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.h
1 #ifndef ALIMULTIPLICITY_H
2 #define ALIMULTIPLICITY_H
3
4 #include<TObject.h>
5 #include <TBits.h>
6 #include<TMath.h>
7
8 ////////////////////////////////////////////////////////
9 ////   Class containing multiplicity information      //
10 ////   to stored in the ESD                           //
11 ////////////////////////////////////////////////////////
12
13 class AliMultiplicity : public TObject {
14
15  public:
16
17   AliMultiplicity();               // default constructor
18   // standard constructor
19   AliMultiplicity(Int_t ntr,Float_t *th, Float_t *ph, Float_t *dth, Float_t *dph, Int_t *labels,
20          Int_t* labelsL2, Int_t ns, Float_t *ts, Float_t *ps, Int_t *labelss, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOrFiredChips);
21   AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOr);
22   AliMultiplicity(const AliMultiplicity& m);
23   AliMultiplicity& operator=(const AliMultiplicity& m);
24   virtual void Copy(TObject &obj) const;
25   virtual void Clear(Option_t* opt="");
26   virtual ~AliMultiplicity();
27 // methods to access tracklet information
28   Int_t GetNumberOfTracklets() const {return fNtracks;}
29   Double_t GetTheta(Int_t i) const { 
30     if(i>=0 && i<fNtracks) return fTh[i];
31     Error("GetTheta","Invalid track number %d",i); return -9999.;
32   }
33   Double_t GetEta(Int_t i) const { 
34     if(i>=0 && i<fNtracks) return -TMath::Log(TMath::Tan(fTh[i]/2.));
35     Error("GetEta","Invalid track number %d",i); return -9999.;
36   }
37   Double_t GetPhi(Int_t i) const { 
38     if(i>=0 && i<fNtracks) return fPhi[i];
39     Error("GetPhi","Invalid track number %d",i); return -9999.;
40   }
41   Double_t GetDeltaTheta(Int_t i) const {
42     if(fDeltTh && i>=0 && i<fNtracks) return fDeltTh[i];
43     Error("GetDeltaTheta","DeltaTheta not available in data or Invalid track number %d(max %d)",i, fNtracks); return -9999.;
44   }
45   Double_t GetDeltaPhi(Int_t i) const {
46     if(i>=0 && i<fNtracks) return fDeltPhi[i];
47     Error("GetDeltaPhi","Invalid track number %d",i); return -9999.;
48   }
49
50   Int_t GetLabel(Int_t i, Int_t layer) const;
51   void  SetLabel(Int_t i, Int_t layer, Int_t label);
52   Int_t GetLabelSingle(Int_t i) const;
53   void  SetLabelSingle(Int_t i, Int_t label);
54
55
56   Bool_t FreeClustersTracklet(Int_t i, Int_t mode) const;
57   Bool_t FreeSingleCluster(Int_t i, Int_t mode)    const;
58
59   
60 // methods to access single cluster information
61   Int_t GetNumberOfSingleClusters() const {return fNsingle;}
62   Double_t GetThetaSingle(Int_t i) const { 
63     if(i>=0 && i<fNsingle) return fThsingle[i];
64     Error("GetThetaSingle","Invalid cluster number %d",i); return -9999.;
65   }
66
67   Double_t GetPhiSingle(Int_t i) const { 
68     if(i>=0 && i<fNsingle) return fPhisingle[i];
69     Error("GetPhisingle","Invalid cluster number %d",i); return -9999.;
70   }
71
72   Short_t GetNumberOfFiredChips(Int_t layer) const { return fFiredChips[layer]; }
73   void SetFiredChips(Int_t layer, Short_t firedChips) { fFiredChips[layer] = firedChips; }
74
75   UInt_t GetNumberOfITSClusters(Int_t layer) const { return layer<6 ? fITSClusters[layer] : 0; }
76   UInt_t GetNumberOfITSClusters(Int_t layMin, Int_t layMax) const ;
77   void SetITSClusters(Int_t layer, UInt_t clusters) { fITSClusters[layer] = clusters; }
78
79   void   SetFastOrFiredChips(UInt_t chipKey){fFastOrFiredChips.SetBitNumber(chipKey);}
80   const TBits & GetFastOrFiredChips() const {return fFastOrFiredChips;}
81   Bool_t TestFastOrFiredChips(UInt_t chipKey) const {return fFastOrFiredChips.TestBitNumber(chipKey);}
82
83   void   SetFiredChipMap(TBits & firedChips){fClusterFiredChips = firedChips;}
84   void   SetFiredChipMap(UInt_t chipKey){fClusterFiredChips.SetBitNumber(chipKey);}
85   const TBits & GetFiredChipMap() const {return fClusterFiredChips;}
86   Bool_t TestFiredChipMap(UInt_t chipKey) const {return fClusterFiredChips.TestBitNumber(chipKey);}
87
88   Bool_t GetTrackletTrackIDs(Int_t i, Int_t mode, Int_t &spd1, Int_t &spd2) const;
89   Bool_t GetSingleClusterTrackID(Int_t i, Int_t mode, Int_t &tr) const;
90
91   // array getters
92   Double_t* GetTheta()       const {return (Double_t*)fTh;}
93   Double_t* GetPhi()         const {return (Double_t*)fPhi;}
94   Double_t* GetDeltTheta()   const {return (Double_t*)fDeltTh;}
95   Double_t* GetDeltPhi()     const {return (Double_t*)fDeltPhi;}
96   Double_t* GetThetaSingle() const {return (Double_t*)fThsingle;}
97   Double_t* GetPhiSingle()   const {return (Double_t*)fPhisingle;}
98   Int_t*    GetLabels()      const {return (Int_t*)fLabels;}  
99   Int_t*    GetLabels2()     const {return (Int_t*)fLabelsL2;}
100   Int_t*    GetLabelsSingle()      const {return (Int_t*)fLabelssingle;} 
101   
102   void SetTrackletData(Int_t id, const Float_t* tlet, UInt_t trSPD1, UInt_t trSPD2);
103   void SetSingleClusterData(Int_t id, const Float_t* scl,UInt_t tr);
104   void CompactBits();
105
106   virtual void Print(Option_t *opt="") const;
107
108   protected:
109   void Duplicate(const AliMultiplicity &m);  // used by copy ctr.
110
111   Int_t fNtracks;            // Number of tracklets
112   Int_t fNsingle;            // Number of clusters on SPD layer 1, not associated
113                              // with a tracklet on SPD layer 2
114   Int_t *fLabels;            //[fNtracks] array with labels of cluster in L1 used for tracklet
115   Int_t *fLabelsL2;          //[fNtracks] array with labels of cluster in L2 used for tracklet
116   UInt_t* fUsedClusS;        //[fNsingle] id+1 of the tracks using cluster, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16)
117   ULong64_t* fUsedClusT;     //[fNtracks] id+1 of the tracks using clusters, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16) for SPD1 and SPD2 in low and high parts
118   Double32_t *fTh;           //[fNtracks] array with theta values
119   Double32_t *fPhi;          //[fNtracks] array with phi values
120   Double32_t *fDeltTh;       //[fNtracks] array with delta theta values
121   Double32_t *fDeltPhi;      //[fNtracks] array with delta phi values
122   Double32_t *fThsingle;     //[fNsingle] array with theta values of L1 clusters
123   Double32_t *fPhisingle;    //[fNsingle] array with phi values of L1 clusters
124   Int_t *fLabelssingle;      //[fNsingle] array with labels of clusters in L1 not used for tracklets 
125   Short_t fFiredChips[2];    // Number of fired chips in the two SPD layers
126   UInt_t fITSClusters[6];    // Number of ITS cluster per layer
127   TBits fFastOrFiredChips;   // Map of FastOr fired chips
128   TBits fClusterFiredChips;  // Map of fired chips (= at least one cluster)
129
130   ClassDef(AliMultiplicity,17);
131 };
132
133 inline Int_t AliMultiplicity::GetLabel(Int_t i, Int_t layer) const
134 {
135     if(i>=0 && i<fNtracks) {
136         if (layer == 0) {
137             return fLabels[i];
138         } else if (layer == 1) {
139             if (fLabelsL2) {
140                 return fLabelsL2[i];
141             } else {
142                 Warning("GetLabel", "No information for layer 2 available !");
143                 return -9999;
144             }
145         } else {
146             Error("GetLabel","Invalid layer number %d",layer); return -9999;
147         }
148     } else {
149         Error("GetLabel","Invalid track number %d",i); return -9999;
150     }
151     return -9999;
152 }
153
154 inline Int_t AliMultiplicity::GetLabelSingle(Int_t i) const 
155 {
156     if(i>=0 && i<fNsingle) {
157       return fLabelssingle[i];
158     } else {
159         Error("GetLabelSingle","Invalid cluster number %d",i); return -9999;
160     }
161     return -9999;
162 }
163
164
165
166
167 #endif