fNi = imax;
fNj = jmax;
+ fEnteries = 0;
fa = new TObjArray(fNi*fNj); // elements are zeroed by
// TObjArray creator
}
fNj = 0;
delete fa;
fa = 0;
+ fEnteries = 0;
}
//______________________________________________________________________
void AliITSpList::ClearMap(){
// Return:
// A zeroed AliITSpList class.
- for(Int_t i=0;i<GetMaxIndex();i++) if(fa->At(i)!=0){
- delete fa->At(i);
- fa->AddAt(0,i); // zero content
- } // end for i && if
+ fa->Delete();
+// for(Int_t i=0;i<GetMaxIndex();i++) if(fa->At(i)!=0){
+// delete fa->At(i);
+// fa->AddAt(0,i); // zero content
+// } // end for i && if
+ fEnteries = 0;
}
//______________________________________________________________________
void AliITSpList::DeleteHit(Int_t i,Int_t j){
delete fa->At(k);
fa->AddAt(0,k); // zero content
} // end for i && if
+ if(k==fEnteries-1) fEnteries--;
}
//______________________________________________________________________
AliITSpList& AliITSpList::operator=(const AliITSpList &source){
this->fNi = source.fNi;
this->fNj = source.fNj;
this->fa = new TObjArray(*(source.fa));
+ this->fEnteries = source.fEnteries;
return *this;
}
fa->AddAt(new AliITSpListItem(-2,-1,pl->GetModule(),index,0.0),index);
} // end if
- ((AliITSpListItem*)(fa->At( index )))->AddTo( fileIndex, pl );
+ ((AliITSpListItem*)(fa->At(index)))->AddTo(fileIndex,pl);
+ if(index>=fEnteries) fEnteries = index +1;
}
//______________________________________________________________________
void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,
// none.
// Return:
// none.
+ Int_t index = GetIndex(i,j);
- if(GetpListItem(i,j)==0){ // most create AliITSpListItem
- fa->AddAt(new AliITSpListItem(trk,ht,mod,GetIndex(i,j),signal),
- GetIndex(i,j));
+ if(GetpListItem(index)==0){ // most create AliITSpListItem
+ fa->AddAt(new AliITSpListItem(trk,ht,mod,GetIndex(i,j),signal),index);
}else{ // AliITSpListItem exists, just add signal to it.
- GetpListItem(i,j)->AddSignal(trk,ht,mod,GetIndex(i,j),signal);
+ GetpListItem(index)->AddSignal(trk,ht,mod,index,signal);
} // end if
+ if(index>=fEnteries) fEnteries = index +1;
}
//______________________________________________________________________
void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
// none.
// Return:
// none.
+ Int_t index = GetIndex(i,j);
- if(GetpListItem(i,j)==0){ // most create AliITSpListItem
- fa->AddAt(new AliITSpListItem(mod,GetIndex(i,j),noise),
- GetIndex(i,j));
+ if(GetpListItem(index)==0){ // most create AliITSpListItem
+ fa->AddAt(new AliITSpListItem(mod,index,noise),index);
}else{ // AliITSpListItem exists, just add signal to it.
- GetpListItem(i,j)->AddNoise(mod,GetIndex(i,j),noise);
+ GetpListItem(index)->AddNoise(mod,index,noise);
} // end if
+ if(index>=fEnteries) fEnteries = index +1;
}
//______________________________________________________________________
void Print(ostream *os);
// Standard ascii class read function
void Read(istream *is);
+ // Returns max size of array for for Tracks, Hits, and signals.
+ static Int_t GetMaxKept() {return fkSize;};
private:
static const Int_t fkSize = 10; // Array sizes
void GetMaxMapIndex(Int_t &ni,Int_t &nj){ni=fNi;nj=fNj;return;}
// returns the max index value.
Int_t GetMaxIndex(){return fNi*fNj;}
+ // returns the largest non-zero entry kept in the array fa.
+ Int_t GetEntries(){return fEnteries;}
// returns the max number of track/hit entries per cell.
- Int_t GetNEnteries(){return 5;}
+ Int_t GetNEnteries(){return AliITSpListItem::GetMaxKept();}
// for a give TObjArray index it returns the corresponding map index
void GetMapIndex(Int_t index,Int_t &i,Int_t &j){
i = index/fNj;j = index - fNj*i;
if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
}
// Returns the signal+noise for a give map coordinate
+ Double_t GetSignal(Int_t index){
+ if(GetpListItem(index)==0) return 0.0;
+ return GetpListItem(index)->GetSumSignal();
+ }
+ // Returns the signal+noise for a give map coordinate
Double_t GetSignal(Int_t i,Int_t j){
if(GetpListItem(i,j)==0) return 0.0;
return GetpListItem(i,j)->GetSumSignal();
// Returns the pointer to the TObjArray of pList Items
TObjArray * GetpListItems(){return fa;}
// returns the pList Item stored in the TObject array
+ AliITSpListItem* GetpListItem(Int_t index){
+ if(fa!=0)return (AliITSpListItem*) (fa->At(index));
+ else return 0;}
+ // returns the pList Item stored in the TObject array
AliITSpListItem* GetpListItem(Int_t i,Int_t j){
if(fa!=0)return (AliITSpListItem*) (fa->At(GetIndex(i,j)));
- else return 0;
- }
+ else return 0;}
// Fill pList from digits. Not functional yet
void FillMap(){;}
private:
Int_t fNi,fNj; // The max index in i,j.
TObjArray *fa; // array of pList items
+ Int_t fEnteries; // keepts track of the number of non-zero entries.
- ClassDef(AliITSpList,1) // list of signals and track numbers
+ ClassDef(AliITSpList,2) // list of signals and track numbers
};
// Input and output functions for standard C++ input/output.
ostream & operator<<(ostream &os,AliITSpList &source);