3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 //***********************************************************************
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
14 // ***********************************************************************
16 #include "TClonesArray.h"
18 #include "AliITSMap.h"
19 #include "AliITSpListItem.h"
21 class AliITSpList: public AliITSMap {
24 // Default Constructor
26 // Standard Constructor
27 AliITSpList(Int_t imax,Int_t jmax);
29 virtual ~AliITSpList();
31 AliITSpList(const AliITSpList &source);
33 virtual AliITSpList& operator=(const AliITSpList &source);
34 // Returns the max mape index values
35 void GetMaxMapIndex(Int_t &ni,Int_t &nj) const {ni=fNi;nj=fNj;return;}
36 // returns the max index value.
37 Int_t GetMaxIndex() const {return fNi*fNj;}
38 // returns the largest non-zero entry kept in the array fa.
39 Int_t GetEntries() const {return fEntries;}
40 // returns the max number of track/hit entries per cell.
41 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 i = index/fNj;j = index - fNj*i;
45 if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
47 // Returns the signal+noise for a give map coordinate
48 Double_t GetSignal(Int_t index) {
49 if(GetpListItem(index)==0) return 0.0;
50 return GetpListItem(index)->GetSumSignal();
52 // Returns the signal+noise for a give map coordinate
53 virtual Double_t GetSignal(Int_t i,Int_t j) const {
54 if(GetpListItem(i,j)==0) return 0.0;
55 return GetpListItem(i,j)->GetSumSignal();
57 // Returns the signal only for a give map coordinate
58 Double_t GetSignalOnly(Int_t i,Int_t j)const {
59 if(GetpListItem(i,j)==0) return 0.0;
60 return GetpListItem(i,j)->GetSignal();
62 // Returns the noise for a give map coordinate
63 Double_t GetNoise(Int_t i,Int_t j) const {
64 if(GetpListItem(i,j)==0) return 0.0;
65 return GetpListItem(i,j)->GetNoise();
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 if(GetpListItem(i,j)==0) return 0.0;
72 return GetpListItem(i,j)->GetSignal(k);
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 if(GetpListItem(i,j)==0) return -2;
79 return GetpListItem(i,j)->GetTrack(k);
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 if(GetpListItem(i,j)==0) return -2;
86 return GetpListItem(i,j)->GetHit(k);
88 // returns the number of Signal values
89 Int_t GetNSignals(Int_t i,Int_t j) const {
90 if(GetpListItem(i,j)==0) return 0;
91 return GetpListItem(i,j)->GetNsignals();
93 // Adds the contents of pl to the list with track number off set given by
95 virtual void AddItemTo(Int_t fileIndex, AliITSpListItem *pl);
96 // Adds a Signal value to the map. Creating and expanding arrays as needed.
97 void AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,Double_t sig);
98 // Adds a Noise value to the map. Creating and expanding arrays as needed.
99 void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
100 // Delete all AliITSpListItems and zero the TClonesArray
101 virtual void ClearMap();
102 // Delete a particular AliITSpListItem in the TClonesArray.
103 virtual void DeleteHit(Int_t i,Int_t j);
104 // returns hit index in TClonesArray
105 virtual Int_t GetHitIndex(Int_t i,Int_t j) const {return GetIndex(i,j);}
106 // returns "hit" AliITSpListItem as a TObject.
107 TObject * GetHit(Int_t i,Int_t j) const {return (TObject*)GetpListItem(i,j);}
109 virtual FlagTypeITS TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmptyITS;
110 else if(GetSignal(i,j)<=0) return kUnusedITS; else return kUsedITS;}
111 // returns the pList Item stored in the TClonesArray
112 AliITSpListItem* GetpListItem(Int_t index) { if((fa[index]).IsUsed())
115 // returns the pList Item stored in the TObject array
116 AliITSpListItem* GetpListItem(Int_t i,Int_t j) const {
117 if((fa[GetIndex(i,j)]).IsUsed())return &(fa[GetIndex(i,j)]);
120 // Fill pList from digits. Not functional yet
121 virtual void FillMap(){NotImplemented("FillMap");}
122 virtual void FillMap2() {NotImplemented("FillMap2");}
123 // Sets threshold for significance. Not of relavance in this case.
124 virtual void SetThreshold(Int_t /* i */){NotImplemented("SetThreshold");}
125 virtual void SetThresholdArr(TArrayI /*thr*/) {NotImplemented("SetThresholdArr");}
126 // Sets a single hit. Not of relavance in this case.
127 virtual void SetHit(Int_t /* i */,Int_t /* j */,Int_t /* k */){NotImplemented("SetHit");}
128 // Flags a hit. Not of relavence in this case.
129 virtual void FlagHit(Int_t /* i */,Int_t /* j */){NotImplemented("FlagHit");}
130 virtual void GetCell(Int_t index,Int_t &i,Int_t &j) const;
131 // GetIndex returns the TClonesArray index for a given set of map indexes.
132 static Int_t GetIndex(Int_t i,Int_t j,Int_t maxj){
138 Int_t GetIndex(Int_t i,Int_t j) const {
139 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;}
140 return GetIndex(i,j,fNj);}
141 void NotImplemented(const char *method) const {if(gDebug>0)
142 Warning(method,"This method is not implemented for this class");}
144 Int_t fNi,fNj; // The max index in i,j.
145 AliITSpListItem *fa; // array of pList items
146 Int_t fEntries; // keepts track of the number of non-zero entries.
148 ClassDef(AliITSpList,5) // list of signals and track numbers