1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 //***********************************************************************
19 // It consist of a TClonesArray of
20 // AliITSpListItem objects
21 // This array can be accessed via 2 indexed
22 // it is used at digitization level by
23 // all the 3 ITS subdetectors
25 // ***********************************************************************
27 #include "AliITSpList.h"
28 #include "AliITSpListItem.h"
31 //______________________________________________________________________
34 //______________________________________________________________________
35 AliITSpList::AliITSpList():
40 // Default constructor
46 // A zeroed/empty AliITSpList class.
49 //______________________________________________________________________
50 AliITSpList::AliITSpList(Int_t imax,Int_t jmax):
53 fa(new AliITSpListItem[imax*jmax]),
55 // Standard constructor
61 // A setup AliITSpList class.
64 //______________________________________________________________________
65 AliITSpList::~AliITSpList(){
74 //______________________________________________________________________
75 void AliITSpList::ClearMap(){
76 // Delete all AliITSpListItems and zero TClonesArray.
82 // A zeroed AliITSpList class.
83 for(Int_t i=0; i<fEntries; i++)(fa[i]).MarkUnused();
86 //______________________________________________________________________
87 void AliITSpList::DeleteHit(Int_t i,Int_t j){
88 // Delete a particular AliITSpListItems.
91 // Int_t j Columns number
96 Int_t k = GetIndex(i,j);
97 if((fa[k]).IsUsed())(fa[k]).MarkUnused();
98 if(k==fEntries-1) fEntries--;
100 //______________________________________________________________________
101 AliITSpList& AliITSpList::operator=(const AliITSpList &source){
104 // const AliITSpList &source A AliITSpList object.
108 // A copied AliITSpList object.
110 this->~AliITSpList();
111 new(this) AliITSpList(source);
114 //______________________________________________________________________
115 AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source),
118 fa(new AliITSpListItem[fNi*fNj]),
119 fEntries(source.fEntries){
121 for(Int_t i=0; i<fEntries; i++)(fa[i]).Build(source.fa[i]);
123 //______________________________________________________________________
124 void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) {
125 // Adds the contents of pl to the list with track number off set given by
127 // Creates the AliITSpListItem if needed.
129 // Int_t fileIndex track number offset value
130 // AliITSpListItem *pl an AliITSpListItem to be added to this class.
135 Int_t index = pl->GetIndex();
136 AliITSpListItem &lit = fa[index];
137 if(!lit.IsUsed())lit.Build(-2,-1,pl->GetModule(),index,0.);
138 lit.AddTo(fileIndex,pl);
139 if(index>=fEntries) fEntries = index +1;
141 //______________________________________________________________________
142 void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,
144 // Adds a Signal value to the TClonesArray at i,j.
145 // Creates the AliITSpListItem
148 // Int_t i Row number for this signal
149 // Int_t j Column number for this signal
150 // Int_t trk Track number creating this signal
151 // Int_t ht Hit number creating this signal
152 // Int_t mod The module where this signal is in
153 // Double_t signal The signal (ionization)
158 Int_t index = GetIndex(i,j);
160 AliITSpListItem &lit = fa[index];
162 lit.Build(trk,ht,mod,index,signal);
165 lit.AddSignal(trk,ht,mod,index,signal);
167 if(index>=fEntries) fEntries = index +1;
169 //______________________________________________________________________
170 void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
171 // Adds a noise value to the TClonesArray at i,j.
172 // Creates the AliITSpListItem
175 // Int_t i Row number for this noise
176 // Int_t j Column number for this noise
177 // Double_t noise The noise signal value.
182 Int_t index = GetIndex(i,j);
184 AliITSpListItem &lit = fa[index];
186 lit.Build(mod,index,noise);
189 lit.AddNoise(mod,index,noise);
191 if(index>=fEntries) fEntries = index +1;
193 //______________________________________________________________________
194 void AliITSpList::GetCell(Int_t index,Int_t &i,Int_t &j) const {
195 // returns the i,j index numbers from the linearized index computed
197 if(index<0 || index>=fNi*fNj){
198 Warning("GetCell","Index out of range 0<=index=%d<%d",