]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMultiplicity.h
use Terminate function for producing summary plots (Markus)
[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(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
53   Bool_t FreeClustersTracklet(Int_t i, Int_t mode) const {return (mode>=0&&mode<2&&i>=0&&i<fNtracks) ? !fUsedClusT[mode].TestBitNumber(i):kFALSE;}
54   Bool_t FreeSingleCluster(Int_t i, Int_t mode)    const {return (mode>=0&&mode<2&&i>=0&&i<fNsingle) ? !fUsedClusS[mode].TestBitNumber(i):kFALSE;}
55
56   
57 // methods to access single cluster information
58   Int_t GetNumberOfSingleClusters() const {return fNsingle;}
59   Double_t GetThetaSingle(Int_t i) const { 
60     if(i>=0 && i<fNsingle) return fThsingle[i];
61     Error("GetThetaSingle","Invalid cluster number %d",i); return -9999.;
62   }
63
64   Double_t GetPhiSingle(Int_t i) const { 
65     if(i>=0 && i<fNsingle) return fPhisingle[i];
66     Error("GetPhisingle","Invalid cluster number %d",i); return -9999.;
67   }
68
69   Short_t GetNumberOfFiredChips(Int_t layer) const { return fFiredChips[layer]; }
70   void SetFiredChips(Int_t layer, Short_t firedChips) { fFiredChips[layer] = firedChips; }
71
72   UInt_t GetNumberOfITSClusters(Int_t layer) const { return layer<6 ? fITSClusters[layer] : 0; }
73   UInt_t GetNumberOfITSClusters(Int_t layMin, Int_t layMax) const ;
74   void SetITSClusters(Int_t layer, UInt_t clusters) { fITSClusters[layer] = clusters; }
75
76   void   SetFastOrFiredChips(UInt_t chipKey){fFastOrFiredChips.SetBitNumber(chipKey);}
77   const TBits & GetFastOrFiredChips() const {return fFastOrFiredChips;}
78   Bool_t TestFastOrFiredChips(UInt_t chipKey) const {return fFastOrFiredChips.TestBitNumber(chipKey);}
79
80   void   SetFiredChipMap(TBits & firedChips){fClusterFiredChips = firedChips;}
81   void   SetFiredChipMap(UInt_t chipKey){fClusterFiredChips.SetBitNumber(chipKey);}
82   const TBits & GetFiredChipMap() const {return fClusterFiredChips;}
83   Bool_t TestFiredChipMap(UInt_t chipKey) const {return fClusterFiredChips.TestBitNumber(chipKey);}
84
85
86
87   // array getters
88   Double_t* GetTheta()       const {return (Double_t*)fTh;}
89   Double_t* GetPhi()         const {return (Double_t*)fPhi;}
90   Double_t* GetDeltTheta()   const {return (Double_t*)fDeltTh;}
91   Double_t* GetDeltPhi()     const {return (Double_t*)fDeltPhi;}
92   Double_t* GetThetaSingle() const {return (Double_t*)fThsingle;}
93   Double_t* GetPhiSingle()   const {return (Double_t*)fPhisingle;}
94   Int_t*    GetLabels()      const {return (Int_t*)fLabels;}
95   Int_t*    GetLabels2()     const {return (Int_t*)fLabelsL2;}
96   
97   void SetTrackletData(Int_t id, const Float_t* tlet, UInt_t bits);
98   void SetSingleClusterData(Int_t id, const Float_t* scl,UInt_t bits);
99   void CompactBits();
100
101   virtual void Print(Option_t *opt="") const;
102
103   protected:
104   void Duplicate(const AliMultiplicity &m);  // used by copy ctr.
105
106   Int_t fNtracks;            // Number of tracklets
107   Int_t fNsingle;            // Number of clusters on SPD layer 1, not associated
108                              // with a tracklet on SPD layer 2
109   Int_t *fLabels;            //[fNtracks] array with labels of cluster in L1 used for tracklet
110   Int_t *fLabelsL2;          //[fNtracks] array with labels of cluster in L2 used for tracklet
111   Double32_t *fTh;           //[fNtracks] array with theta values
112   Double32_t *fPhi;          //[fNtracks] array with phi values
113   Double32_t *fDeltTh;       //[fNtracks] array with delta theta values
114   Double32_t *fDeltPhi;      //[fNtracks] array with delta phi values
115   Double32_t *fThsingle;     //[fNsingle] array with theta values of L1 clusters
116   Double32_t *fPhisingle;    //[fNsingle] array with phi values of L1 clusters
117   Short_t fFiredChips[2];    // Number of fired chips in the two SPD layers
118   UInt_t fITSClusters[6];   // Number of ITS cluster per layer
119   TBits fFastOrFiredChips;   // Map of FastOr fired chips
120   TBits fClusterFiredChips;  // Map of fired chips (= at least one cluster)
121   TBits fUsedClusT[2];       // flag that at least one of tracklets clusters is used by TPC/ITS+ITS_SA (0) or ITS_SA_PURE tracks (1)
122   TBits fUsedClusS[2];       // flag that the single clusters is used by TPC/ITS+ITS_SA (0) or ITS_SA_PURE tracks
123
124   ClassDef(AliMultiplicity,13);
125 };
126
127 inline Int_t AliMultiplicity::GetLabel(Int_t i, Int_t layer) const
128 {
129     if(i>=0 && i<fNtracks) {
130         if (layer == 0) {
131             return fLabels[i];
132         } else if (layer == 1) {
133             if (fLabelsL2) {
134                 return fLabelsL2[i];
135             } else {
136                 Warning("GetLabel", "No information for layer 2 available !");
137                 return -9999;
138             }
139         } else {
140             Error("GetLabel","Invalid layer number %d",layer); return -9999;
141         }
142     } else {
143         Error("GetLabel","Invalid track number %d",i); return -9999;
144     }
145     return -9999;
146 }
147 #endif