]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSpList.h
load AddTaskEmcalJet.C
[u/mrichter/AliRoot.git] / ITS / AliITSpList.h
... / ...
CommitLineData
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
21class 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 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;}
46 }
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();
51 }
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();
56 }
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();
61 }
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();
66 }
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);
73 }
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);
80 }
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);
87 }
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();
92 }
93 // Adds the contents of pl to the list with track number off set given by
94 // fileIndex.
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);}
108 // tests hit status.
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())
113 return &(fa[index]);
114 else return NULL;}
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)]);
118 else return NULL; }
119
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){
133 return maxj*i+j;}
134
135 private:
136
137// private methods
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");}
143// data members
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.
147
148 ClassDef(AliITSpList,5) // list of signals and track numbers
149};
150#endif