]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMultiplicity.h
Fix for bug #66122: Backward compatibility in AliMultiplicity
[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, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOrFiredChips);
21   AliMultiplicity(const AliMultiplicity& m);
22   AliMultiplicity& operator=(const AliMultiplicity& m);
23   virtual void Copy(TObject &obj) const;
24   virtual ~AliMultiplicity();
25 // methods to access tracklet information
26   Int_t GetNumberOfTracklets() const {return fNtracks;}
27   Double_t GetTheta(Int_t i) const { 
28     if(i>=0 && i<fNtracks) return fTh[i];
29     Error("GetTheta","Invalid track number %d",i); return -9999.;
30   }
31   Double_t GetEta(Int_t i) const { 
32     if(i>=0 && i<fNtracks) return -TMath::Log(TMath::Tan(fTh[i]/2.));
33     Error("GetEta","Invalid track number %d",i); return -9999.;
34   }
35   Double_t GetPhi(Int_t i) const { 
36     if(i>=0 && i<fNtracks) return fPhi[i];
37     Error("GetPhi","Invalid track number %d",i); return -9999.;
38   }
39   Double_t GetDeltaTheta(Int_t i) const {
40     if(fDeltTh && i>=0 && i<fNtracks) return fDeltTh[i];
41     Error("GetDeltaTheta","DeltaTheta not available in data or Invalid track number %d(max %d)",i, fNtracks); return -9999.;
42   }
43   Double_t GetDeltaPhi(Int_t i) const {
44     if(i>=0 && i<fNtracks) return fDeltPhi[i];
45     Error("GetDeltaPhi","Invalid track number %d",i); return -9999.;
46   }
47
48   Int_t GetLabel(Int_t i, Int_t layer) const;
49   void  SetLabel(Int_t i, Int_t layer, Int_t label);
50   
51 // methods to access single cluster information
52   Int_t GetNumberOfSingleClusters() const {return fNsingle;}
53   Double_t GetThetaSingle(Int_t i) const { 
54     if(i>=0 && i<fNsingle) return fThsingle[i];
55     Error("GetThetaSingle","Invalid cluster number %d",i); return -9999.;
56   }
57
58   Double_t GetPhiSingle(Int_t i) const { 
59     if(i>=0 && i<fNsingle) return fPhisingle[i];
60     Error("GetPhisingle","Invalid cluster number %d",i); return -9999.;
61   }
62
63   Short_t GetNumberOfFiredChips(Int_t layer) const { return fFiredChips[layer]; }
64   void SetFiredChips(Int_t layer, Short_t firedChips) { fFiredChips[layer] = firedChips; }
65
66   UInt_t GetNumberOfITSClusters(Int_t layer) const { return layer<6 ? fITSClusters[layer] : 0; }
67   UInt_t GetNumberOfITSClusters(Int_t layMin, Int_t layMax) const ;
68   void SetITSClusters(Int_t layer, UInt_t clusters) { fITSClusters[layer] = clusters; }
69
70   void   SetFastOrFiredChips(UInt_t chipKey){fFastOrFiredChips.SetBitNumber(chipKey);}
71   const TBits & GetFastOrFiredChips() const {return fFastOrFiredChips;}
72   Bool_t TestFastOrFiredChips(UInt_t chipKey) const {return fFastOrFiredChips.TestBitNumber(chipKey);}
73
74   void   SetFiredChipMap(TBits & firedChips){fClusterFiredChips = firedChips;}
75   void   SetFiredChipMap(UInt_t chipKey){fClusterFiredChips.SetBitNumber(chipKey);}
76   const TBits & GetFiredChipMap() const {return fClusterFiredChips;}
77   Bool_t TestFiredChipMap(UInt_t chipKey) const {return fClusterFiredChips.TestBitNumber(chipKey);}
78
79   protected:
80   void Duplicate(const AliMultiplicity &m);  // used by copy ctr.
81
82   Int_t fNtracks;            // Number of tracklets
83   Int_t fNsingle;            // Number of clusters on SPD layer 1, not associated
84                              // with a tracklet on SPD layer 2
85   Int_t *fLabels;            //[fNtracks] array with labels of cluster in L1 used for tracklet
86   Int_t *fLabelsL2;          //[fNtracks] array with labels of cluster in L2 used for tracklet
87   Double32_t *fTh;           //[fNtracks] array with theta values
88   Double32_t *fPhi;          //[fNtracks] array with phi values
89   Double32_t *fDeltTh;       //[fNtracks] array with delta theta values
90   Double32_t *fDeltPhi;      //[fNtracks] array with delta phi values
91   Double32_t *fThsingle;     //[fNsingle] array with theta values of L1 clusters
92   Double32_t *fPhisingle;    //[fNsingle] array with phi values of L2 clusters
93   Short_t fFiredChips[2];    // Number of fired chips in the two SPD layers
94   UInt_t fITSClusters[6];   // Number of ITS cluster per layer
95   TBits fFastOrFiredChips;   // Map of FastOr fired chips
96   TBits fClusterFiredChips;         // Map of fired chips (= at least one cluster)
97
98   ClassDef(AliMultiplicity,12);
99 };
100
101 inline Int_t AliMultiplicity::GetLabel(Int_t i, Int_t layer) const
102 {
103     if(i>=0 && i<fNtracks) {
104         if (layer == 0) {
105             return fLabels[i];
106         } else if (layer == 1) {
107             if (fLabelsL2) {
108                 return fLabelsL2[i];
109             } else {
110                 Warning("GetLabel", "No information for layer 2 available !");
111                 return -9999;
112             }
113         } else {
114             Error("GetLabel","Invalid layer number %d",layer); return -9999;
115         }
116     } else {
117         Error("GetLabel","Invalid track number %d",i); return -9999;
118     }
119     return -9999;
120 }
121 #endif