]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMultiplicity.h
Do not reset a zero pointer to MC info
[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, 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   TBits  GetFastOrFiredChips() const {return fFastOrFiredChips;}
72   Bool_t TestFastOrFiredChips(UInt_t chipKey) const {return fFastOrFiredChips.TestBitNumber(chipKey);}
73
74   protected:
75   void Duplicate(const AliMultiplicity &m);  // used by copy ctr.
76
77   Int_t fNtracks;            // Number of tracklets
78   Int_t fNsingle;            // Number of clusters on SPD layer 1, not associated
79                              // with a tracklet on SPD layer 2
80   Int_t *fLabels;            //[fNtracks] array with labels of cluster in L1 used for tracklet
81   Int_t *fLabelsL2;          //[fNtracks] array with labels of cluster in L2 used for tracklet
82   Double32_t *fTh;           //[fNtracks] array with theta values
83   Double32_t *fPhi;          //[fNtracks] array with phi values
84   Double32_t *fDeltTh;       //[fNtracks] array with delta theta values
85   Double32_t *fDeltPhi;      //[fNtracks] array with delta phi values
86   Double32_t *fThsingle;     //[fNsingle] array with theta values of L1 clusters
87   Double32_t *fPhisingle;    //[fNsingle] array with phi values of L2 clusters
88   Short_t fFiredChips[2];    // Number of fired chips in the two SPD layers
89   UInt_t fITSClusters[6];   // Number of ITS cluster per layer
90   TBits fFastOrFiredChips;   // Map of FastOr fired chips
91
92   ClassDef(AliMultiplicity,10);
93 };
94
95 inline Int_t AliMultiplicity::GetLabel(Int_t i, Int_t layer) const
96 {
97     if(i>=0 && i<fNtracks) {
98         if (layer == 0) {
99             return fLabels[i];
100         } else if (layer == 1) {
101             if (fLabelsL2) {
102                 return fLabelsL2[i];
103             } else {
104                 Warning("GetLabel", "No information for layer 2 available !");
105                 return -9999;
106             }
107         } else {
108             Error("GetLabel","Invalid layer number %d",layer); return -9999;
109         }
110     } else {
111         Error("GetLabel","Invalid track number %d",i); return -9999;
112     }
113     return -9999;
114 }
115 #endif