Line data Source code
1 : #ifndef ALIITSPLIST_H
2 : #define ALIITSPLIST_H
3 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : //***********************************************************************
7 : //
8 : // It consist of a TClonesArray of
9 : // AliITSpListItem objects
10 : // This array can be accessed via 2 indexed
11 : // it is used at digitization level by
12 : // all the 3 ITS subdetectors
13 : //
14 : // ***********************************************************************
15 : #include "TArrayI.h"
16 : #include "TClonesArray.h"
17 : #include "AliLog.h"
18 : #include "AliITSMap.h"
19 : #include "AliITSpListItem.h"
20 :
21 : class AliITSpList: public AliITSMap {
22 :
23 : public:
24 : // Default Constructor
25 : AliITSpList();
26 : // Standard Constructor
27 : AliITSpList(Int_t imax,Int_t jmax);
28 : // Class destrutor
29 : virtual ~AliITSpList();
30 : // Copy constructor
31 : AliITSpList(const AliITSpList &source);
32 : // = Operator
33 : virtual AliITSpList& operator=(const AliITSpList &source);
34 : // Returns the max mape index values
35 0 : void GetMaxMapIndex(Int_t &ni,Int_t &nj) const {ni=fNi;nj=fNj;return;}
36 : // returns the max index value.
37 0 : Int_t GetMaxIndex() const {return fNi*fNj;}
38 : // returns the largest non-zero entry kept in the array fa.
39 7027600 : Int_t GetEntries() const {return fEntries;}
40 : // returns the max number of track/hit entries per cell.
41 252260 : Int_t GetNEntries() const {return AliITSpListItem::GetMaxKept();}
42 : // for a given TClonesArray index it returns the corresponding map index
43 : void GetMapIndex(Int_t index,Int_t &i,Int_t &j) const {
44 12252 : i = index/fNj;j = index - fNj*i;
45 24504 : if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
46 6126 : }
47 : // Returns the signal+noise for a give map coordinate
48 : Double_t GetSignal(Int_t index) {
49 0 : if(GetpListItem(index)==0) return 0.0;
50 0 : return GetpListItem(index)->GetSumSignal();
51 0 : }
52 : // Returns the signal+noise for a give map coordinate
53 : virtual Double_t GetSignal(Int_t i,Int_t j) const {
54 78643792 : if(GetpListItem(i,j)==0) return 0.0;
55 39321896 : return GetpListItem(i,j)->GetSumSignal();
56 39321896 : }
57 : // Returns the signal only for a give map coordinate
58 : Double_t GetSignalOnly(Int_t i,Int_t j)const {
59 78679956 : if(GetpListItem(i,j)==0) return 0.0;
60 39339978 : return GetpListItem(i,j)->GetSignal();
61 39339978 : }
62 : // Returns the noise for a give map coordinate
63 : Double_t GetNoise(Int_t i,Int_t j) const {
64 0 : if(GetpListItem(i,j)==0) return 0.0;
65 0 : return GetpListItem(i,j)->GetNoise();
66 0 : }
67 : // returns the track number which generated the signal at a given map
68 : // coordinate. If there is no signal or only noise, then -2 is returned.
69 : // k is the track rank number.
70 : Double_t GetTSignal(Int_t i,Int_t j,Int_t k) const {
71 5520 : if(GetpListItem(i,j)==0) return 0.0;
72 2760 : return GetpListItem(i,j)->GetSignal(k);
73 2760 : }
74 : // returns the track number which generated the signal at a given map
75 : // coordinate. If there is no signal or only noise, then -2 is returned.
76 : // k is the track rank number.
77 : Int_t GetTrack(Int_t i,Int_t j,Int_t k) const {
78 252260 : if(GetpListItem(i,j)==0) return -2;
79 126130 : return GetpListItem(i,j)->GetTrack(k);
80 126130 : }
81 : // returns the hit number which generated the signal at a given map
82 : // coordinate. If there is no signal or only noise, then -2 is returned.
83 : // k is the hit rank number.
84 : Int_t GetHit(Int_t i,Int_t j,Int_t k) const {
85 313520 : if(GetpListItem(i,j)==0) return -2;
86 156760 : return GetpListItem(i,j)->GetHit(k);
87 156760 : }
88 : // returns the number of Signal values
89 : Int_t GetNSignals(Int_t i,Int_t j) const {
90 7917 : if(GetpListItem(i,j)==0) return 0;
91 3036 : return GetpListItem(i,j)->GetNsignals();
92 3651 : }
93 : // Returns the signal+noise for a give map coordinate for SDigits in the FO strobe
94 : virtual Double_t GetSignalFo(Int_t i,Int_t j) const {
95 592 : if(GetpListItem(i,j)==0) return 0.0;
96 296 : return GetpListItem(i,j)->GetSumSignalFo();
97 296 : }
98 :
99 : // Adds the contents of pl to the list with track number off set given by
100 : // fileIndex.
101 : virtual void AddItemTo(Int_t fileIndex, AliITSpListItem *pl);
102 : // Adds a Signal value to the map. Creating and expanding arrays as needed.
103 : void AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,Double_t sig);
104 : // Adds a Noise value to the map. Creating and expanding arrays as needed.
105 : void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
106 : // Delete all AliITSpListItems and zero the TClonesArray
107 : virtual void ClearMap();
108 : // Delete a particular AliITSpListItem in the TClonesArray.
109 : virtual void DeleteHit(Int_t i,Int_t j);
110 : // returns hit index in TClonesArray
111 12845056 : virtual Int_t GetHitIndex(Int_t i,Int_t j) const {return GetIndex(i,j);}
112 : // returns "hit" AliITSpListItem as a TObject.
113 0 : TObject * GetHit(Int_t i,Int_t j) const {return (TObject*)GetpListItem(i,j);}
114 : // tests hit status.
115 0 : virtual FlagTypeITS TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmptyITS;
116 0 : else if(GetSignal(i,j)<=0) return kUnusedITS; else return kUsedITS;}
117 : // returns the pList Item stored in the TClonesArray
118 7040378 : AliITSpListItem* GetpListItem(Int_t index) { if((fa[index]).IsUsed())
119 12657 : return &(fa[index]);
120 7027721 : else return NULL;}
121 : // returns the pList Item stored in the TObject array
122 : AliITSpListItem* GetpListItem(Int_t i,Int_t j) const {
123 576490564 : if((fa[GetIndex(i,j)]).IsUsed())return &(fa[GetIndex(i,j)]);
124 260656664 : else return NULL; }
125 :
126 : // Fill pList from digits. Not functional yet
127 0 : virtual void FillMap(){NotImplemented("FillMap");}
128 0 : virtual void FillMap2() {NotImplemented("FillMap2");}
129 : // Sets threshold for significance. Not of relavance in this case.
130 0 : virtual void SetThreshold(Int_t /* i */){NotImplemented("SetThreshold");}
131 0 : virtual void SetThresholdArr(TArrayI /*thr*/) {NotImplemented("SetThresholdArr");}
132 : // Sets a single hit. Not of relavance in this case.
133 0 : virtual void SetHit(Int_t /* i */,Int_t /* j */,Int_t /* k */){NotImplemented("SetHit");}
134 : // Flags a hit. Not of relavence in this case.
135 0 : virtual void FlagHit(Int_t /* i */,Int_t /* j */){NotImplemented("FlagHit");}
136 : virtual void GetCell(Int_t index,Int_t &i,Int_t &j) const;
137 : // GetIndex returns the TClonesArray index for a given set of map indexes.
138 : static Int_t GetIndex(Int_t i,Int_t j,Int_t maxj){
139 859845246 : return maxj*i+j;}
140 :
141 : private:
142 :
143 : // private methods
144 : Int_t GetIndex(Int_t i,Int_t j) const {
145 1719690492 : if(i<0||i>=fNi || j<0||j>=fNj){AliWarning(Form("Index out of range 0<i=%d<%d and 0<0j=%d<%d",i,fNi,j,fNj)); return -1;}
146 859845246 : return GetIndex(i,j,fNj);}
147 0 : void NotImplemented(const char *method) const {if(gDebug>0)
148 0 : Warning(method,"This method is not implemented for this class");}
149 : // data members
150 : Int_t fNi,fNj; // The max index in i,j.
151 : AliITSpListItem *fa; // array of pList items
152 : Int_t fEntries; // keepts track of the number of non-zero entries.
153 :
154 118 : ClassDef(AliITSpList,5) // list of signals and track numbers
155 : };
156 : #endif
|