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):
55 // Standard constructor
61 // A setup AliITSpList class.
63 fa = new TClonesArray("AliITSpListItem",fNi*fNj);
65 //______________________________________________________________________
66 AliITSpList::~AliITSpList(){
73 // a properly destroyed class
86 //______________________________________________________________________
87 void AliITSpList::ClearMap(){
88 // Delete all AliITSpListItems and zero TClonesArray.
94 // A zeroed AliITSpList class.
99 //______________________________________________________________________
100 void AliITSpList::DeleteHit(Int_t i,Int_t j){
101 // Delete a particular AliITSpListItems.
103 // Int_t i Row number
104 // Int_t j Columns number
109 Int_t k = GetIndex(i,j);
114 if(k==fEntries-1) fEntries--;
116 //______________________________________________________________________
117 AliITSpList& AliITSpList::operator=(const AliITSpList &source){
120 // const AliITSpList &source A AliITSpList object.
124 // A copied AliITSpList object.
126 this->~AliITSpList();
127 new(this) AliITSpList(source);
130 //______________________________________________________________________
131 AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source),
132 fNi(source.fNi),fNj(source.fNj),fa(0),fEntries(source.fEntries){
135 fa = new TClonesArray(*(source.fa));
137 //______________________________________________________________________
138 void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) {
139 // Adds the contents of pl to the list with track number off set given by
141 // Creates the AliITSpListItem if needed.
143 // Int_t fileIndex track number offset value
144 // AliITSpListItem *pl an AliITSpListItem to be added to this class.
149 Int_t index = pl->GetIndex();
150 TClonesArray &rfa = *fa;
151 if( fa->At( index ) == 0 ) { // most create AliITSpListItem
152 new(rfa[index])AliITSpListItem(-2,-1,pl->GetModule(),index,0.0);
155 ((AliITSpListItem*)(fa->At(index)))->AddTo( fileIndex,pl);
156 if(index>=fEntries) fEntries = index +1;
158 //______________________________________________________________________
159 void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,
161 // Adds a Signal value to the TClonesArray at i,j.
162 // Creates the AliITSpListItem
165 // Int_t i Row number for this signal
166 // Int_t j Column number for this signal
167 // Int_t trk Track number creating this signal
168 // Int_t ht Hit number creating this signal
169 // Int_t mod The module where this signal is in
170 // Double_t signal The signal (ionization)
175 Int_t index = GetIndex(i,j);
177 TClonesArray &rfa = *fa;
178 if(GetpListItem(index)==0){ // must create AliITSpListItem
179 new(rfa[index])AliITSpListItem(trk,ht,mod,index,signal);
180 }else{ // AliITSpListItem exists, just add signal to it.
181 GetpListItem(index)->AddSignal(trk,ht,mod,index,signal);
183 if(index>=fEntries) fEntries = index +1;
185 //______________________________________________________________________
186 void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
187 // Adds a noise value to the TClonesArray at i,j.
188 // Creates the AliITSpListItem
191 // Int_t i Row number for this noise
192 // Int_t j Column number for this noise
193 // Double_t noise The noise signal value.
198 Int_t index = GetIndex(i,j);
199 TClonesArray &rfa = *fa;
200 if(GetpListItem(index)==0){ // most create AliITSpListItem
201 new(rfa[index]) AliITSpListItem(mod,index,noise);
202 }else{ // AliITSpListItem exists, just add signal to it.
203 GetpListItem(index)->AddNoise(mod,index,noise);
205 if(index>=fEntries) fEntries = index +1;
207 //______________________________________________________________________
208 void AliITSpList::GetCell(Int_t index,Int_t &i,Int_t &j) const {
209 // returns the i,j index numbers from the linearized index computed
211 if(index<0 || index>=fNi*fNj){
212 Warning("GetCell","Index out of range 0<=index=%d<%d",
221 //______________________________________________________________________
222 Int_t AliITSpList::GetIndex(Int_t i, Int_t j) const {
223 // returns the TClonesArray index for a given set of map indexes.
224 if(i<0||i>=fNi || j<0||j>=fNj){
225 Warning("GetIndex","Index out of range 0<i=%d<%d and 0<0j=%d<%d",i,fNi,j,fNj);