Instead just bit-flag marking used clusters store ID's of ESDtracks for
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.h
CommitLineData
32e449be 1#ifndef ALIMULTIPLICITY_H
2#define ALIMULTIPLICITY_H
3
4#include<TObject.h>
ff44c37c 5#include <TBits.h>
44ca59b0 6#include<TMath.h>
32e449be 7
8////////////////////////////////////////////////////////
9//// Class containing multiplicity information //
10//// to stored in the ESD //
11////////////////////////////////////////////////////////
12
13class AliMultiplicity : public TObject {
14
15 public:
16
17 AliMultiplicity(); // default constructor
18 // standard constructor
fa9ed8e9 19 AliMultiplicity(Int_t ntr,Float_t *th, Float_t *ph, Float_t *dth, Float_t *dph, Int_t *labels,
d7c5c1e4 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);
1f9831ab 21 AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOr);
32e449be 22 AliMultiplicity(const AliMultiplicity& m);
23 AliMultiplicity& operator=(const AliMultiplicity& m);
732a24fe 24 virtual void Copy(TObject &obj) const;
1f9831ab 25 virtual void Clear(Option_t* opt="");
32e449be 26 virtual ~AliMultiplicity();
968e8539 27// methods to access tracklet information
32e449be 28 Int_t GetNumberOfTracklets() const {return fNtracks;}
4f499767 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 }
eda42f29 49
50 Int_t GetLabel(Int_t i, Int_t layer) const;
56258350 51 void SetLabel(Int_t i, Int_t layer, Int_t label);
d7c5c1e4 52 Int_t GetLabelSingle(Int_t i) const;
53 void SetLabelSingle(Int_t i, Int_t label);
54
1f9831ab 55
34581d1e 56 Bool_t FreeClustersTracklet(Int_t i, Int_t mode) const;
57 Bool_t FreeSingleCluster(Int_t i, Int_t mode) const;
1f9831ab 58
eda42f29 59
968e8539 60// methods to access single cluster information
61 Int_t GetNumberOfSingleClusters() const {return fNsingle;}
4f499767 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 }
32e449be 71
ab37e14c 72 Short_t GetNumberOfFiredChips(Int_t layer) const { return fFiredChips[layer]; }
73 void SetFiredChips(Int_t layer, Short_t firedChips) { fFiredChips[layer] = firedChips; }
466ffa28 74
d325d83f 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
ee87788b 79 void SetFastOrFiredChips(UInt_t chipKey){fFastOrFiredChips.SetBitNumber(chipKey);}
adc4b00f 80 const TBits & GetFastOrFiredChips() const {return fFastOrFiredChips;}
ee87788b 81 Bool_t TestFastOrFiredChips(UInt_t chipKey) const {return fFastOrFiredChips.TestBitNumber(chipKey);}
ff44c37c 82
ab37e14c 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);}
adc4b00f 87
34581d1e 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;
1f9831ab 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;}
d7c5c1e4 98 Int_t* GetLabels() const {return (Int_t*)fLabels;}
1f9831ab 99 Int_t* GetLabels2() const {return (Int_t*)fLabelsL2;}
d7c5c1e4 100 Int_t* GetLabelsSingle() const {return (Int_t*)fLabelssingle;}
1f9831ab 101
34581d1e 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);
1f9831ab 104 void CompactBits();
105
106 virtual void Print(Option_t *opt="") const;
107
32e449be 108 protected:
109 void Duplicate(const AliMultiplicity &m); // used by copy ctr.
32e449be 110
cd888a89 111 Int_t fNtracks; // Number of tracklets
112 Int_t fNsingle; // Number of clusters on SPD layer 1, not associated
cd888a89 113 // with a tracklet on SPD layer 2
0939e22a 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
34581d1e 116 UInt_t* fUsedClusS; //[fNtracks] 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
cd888a89 118 Double32_t *fTh; //[fNtracks] array with theta values
119 Double32_t *fPhi; //[fNtracks] array with phi values
fa9ed8e9 120 Double32_t *fDeltTh; //[fNtracks] array with delta theta values
cd888a89 121 Double32_t *fDeltPhi; //[fNtracks] array with delta phi values
122 Double32_t *fThsingle; //[fNsingle] array with theta values of L1 clusters
1f9831ab 123 Double32_t *fPhisingle; //[fNsingle] array with phi values of L1 clusters
d7c5c1e4 124 Int_t *fLabelssingle; //[fNsingle] array with labels of clusters in L1 not used for tracklets
ab37e14c 125 Short_t fFiredChips[2]; // Number of fired chips in the two SPD layers
d7c5c1e4 126 UInt_t fITSClusters[6]; // Number of ITS cluster per layer
ff44c37c 127 TBits fFastOrFiredChips; // Map of FastOr fired chips
1f9831ab 128 TBits fClusterFiredChips; // Map of fired chips (= at least one cluster)
ff44c37c 129
34581d1e 130 ClassDef(AliMultiplicity,15);
32e449be 131};
132
eda42f29 133inline 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 }
4f499767 151 return -9999;
eda42f29 152}
d7c5c1e4 153
154inline 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
32e449be 167#endif