minor fix
[u/mrichter/AliRoot.git] / ITS / AliITSpList.h
CommitLineData
fb4e90e0 1#ifndef ALIITSPLIST_H
2#define ALIITSPLIST_H
2134176d 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
88cb7938 5
590d15ee 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// ***********************************************************************
f45f6658 15#include "TArrayI.h"
9881a682 16#include "TClonesArray.h"
dee45d79 17#include "AliLog.h"
2134176d 18#include "AliITSMap.h"
fb4e90e0 19#include "AliITSpListItem.h"
2134176d 20
21class AliITSpList: public AliITSMap {
2134176d 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();
fb4e90e0 30 // Copy constructor
31 AliITSpList(const AliITSpList &source);
32 // = Operator
2134176d 33 virtual AliITSpList& operator=(const AliITSpList &source);
34 // Returns the max mape index values
fb4e90e0 35 void GetMaxMapIndex(Int_t &ni,Int_t &nj) const {ni=fNi;nj=fNj;return;}
2134176d 36 // returns the max index value.
fb4e90e0 37 Int_t GetMaxIndex() const {return fNi*fNj;}
9ce4d38b 38 // returns the largest non-zero entry kept in the array fa.
9881a682 39 Int_t GetEntries() const {return fEntries;}
2134176d 40 // returns the max number of track/hit entries per cell.
9881a682 41 Int_t GetNEntries() const {return AliITSpListItem::GetMaxKept();}
42 // for a given TClonesArray index it returns the corresponding map index
fb4e90e0 43 void GetMapIndex(Int_t index,Int_t &i,Int_t &j) const {
2134176d 44 i = index/fNj;j = index - fNj*i;
c7d528c6 45 if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
2134176d 46 }
47 // Returns the signal+noise for a give map coordinate
590d15ee 48 Double_t GetSignal(Int_t index) {
9ce4d38b 49 if(GetpListItem(index)==0) return 0.0;
50 return GetpListItem(index)->GetSumSignal();
51 }
52 // Returns the signal+noise for a give map coordinate
590d15ee 53 virtual Double_t GetSignal(Int_t i,Int_t j) const {
2134176d 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
590d15ee 58 Double_t GetSignalOnly(Int_t i,Int_t j)const {
2134176d 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
590d15ee 63 Double_t GetNoise(Int_t i,Int_t j) const {
2134176d 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.
590d15ee 70 Double_t GetTSignal(Int_t i,Int_t j,Int_t k) const {
2134176d 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.
590d15ee 77 Int_t GetTrack(Int_t i,Int_t j,Int_t k) const {
2134176d 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.
590d15ee 84 Int_t GetHit(Int_t i,Int_t j,Int_t k) const {
2134176d 85 if(GetpListItem(i,j)==0) return -2;
86 return GetpListItem(i,j)->GetHit(k);
87 }
88 // returns the number of Signal values
590d15ee 89 Int_t GetNSignals(Int_t i,Int_t j) const {
2134176d 90 if(GetpListItem(i,j)==0) return 0;
91 return GetpListItem(i,j)->GetNsignals();
92 }
c7d528c6 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);
2134176d 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);
9881a682 100 // Delete all AliITSpListItems and zero the TClonesArray
fb4e90e0 101 virtual void ClearMap();
9881a682 102 // Delete a particular AliITSpListItem in the TClonesArray.
fb4e90e0 103 virtual void DeleteHit(Int_t i,Int_t j);
9881a682 104 // returns hit index in TClonesArray
fb4e90e0 105 virtual Int_t GetHitIndex(Int_t i,Int_t j) const {return GetIndex(i,j);}
2134176d 106 // returns "hit" AliITSpListItem as a TObject.
590d15ee 107 TObject * GetHit(Int_t i,Int_t j) const {return (TObject*)GetpListItem(i,j);}
2134176d 108 // tests hit status.
85ac1062 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;}
9881a682 111 // returns the pList Item stored in the TClonesArray
5ff02a9a 112 AliITSpListItem* GetpListItem(Int_t index) { if((fa[index]).IsUsed())
113 return &(fa[index]);
114 else return NULL;}
9ce4d38b 115 // returns the pList Item stored in the TObject array
fb4e90e0 116 AliITSpListItem* GetpListItem(Int_t i,Int_t j) const {
5ff02a9a 117 if((fa[GetIndex(i,j)]).IsUsed())return &(fa[GetIndex(i,j)]);
118 else return NULL; }
2134176d 119
120 // Fill pList from digits. Not functional yet
fb4e90e0 121 virtual void FillMap(){NotImplemented("FillMap");}
f45f6658 122 virtual void FillMap2() {NotImplemented("FillMap2");}
2134176d 123 // Sets threshold for significance. Not of relavance in this case.
fb4e90e0 124 virtual void SetThreshold(Int_t /* i */){NotImplemented("SetThreshold");}
f45f6658 125 virtual void SetThresholdArr(TArrayI /*thr*/) {NotImplemented("SetThresholdArr");}
2134176d 126 // Sets a single hit. Not of relavance in this case.
fb4e90e0 127 virtual void SetHit(Int_t /* i */,Int_t /* j */,Int_t /* k */){NotImplemented("SetHit");}
2134176d 128 // Flags a hit. Not of relavence in this case.
fb4e90e0 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;
dee45d79 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;}
2134176d 134
135 private:
fb4e90e0 136
137// private methods
dee45d79 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);}
fb4e90e0 141 void NotImplemented(const char *method) const {if(gDebug>0)
dee45d79 142 Warning(method,"This method is not implemented for this class");}
fb4e90e0 143// data members
2134176d 144 Int_t fNi,fNj; // The max index in i,j.
5ff02a9a 145 AliITSpListItem *fa; // array of pList items
9881a682 146 Int_t fEntries; // keepts track of the number of non-zero entries.
2134176d 147
5ff02a9a 148 ClassDef(AliITSpList,5) // list of signals and track numbers
2134176d 149};
2134176d 150#endif