ClassImp(AliITSpList)
//______________________________________________________________________
-AliITSpList::AliITSpList(){
+AliITSpList::AliITSpList():
+fNi(0),
+fNj(0),
+fa(0),
+fEntries(0){
// Default constructor
// Inputs:
// none.
// Return:
// A zeroed/empty AliITSpList class.
- fNi = 0;
- fNj = 0;
- fa = 0;
}
//______________________________________________________________________
-AliITSpList::AliITSpList(Int_t imax,Int_t jmax){
+AliITSpList::AliITSpList(Int_t imax,Int_t jmax):
+fNi(imax),
+fNj(jmax),
+fa(new AliITSpListItem[imax*jmax]),
+fEntries(0){
// Standard constructor
// Inputs:
// none.
// Return:
// A setup AliITSpList class.
- fNi = imax;
- fNj = jmax;
- fEntries = 0;
- fa = new TClonesArray("AliITSpListItem",fNi*fNj);
}
//______________________________________________________________________
AliITSpList::~AliITSpList(){
// Default destructor
- // Inputs:
- // none.
- // Outputs:
- // none.
- // Return:
- // a properly destroyed class
-
- if(fa){
- fa->Delete();
- delete fa;
- fa = 0;
- }
- fNi = 0;
- fNj = 0;
- fEntries = 0;
+ delete [] fa;
+ fNi = 0;
+ fNj = 0;
+ fEntries = 0;
}
//______________________________________________________________________
// none.
// Return:
// A zeroed AliITSpList class.
-
- fa->Delete();
- fEntries = 0;
+ for(Int_t i=0; i<fEntries; i++)(fa[i]).MarkUnused();
+ fEntries = 0;
}
//______________________________________________________________________
void AliITSpList::DeleteHit(Int_t i,Int_t j){
// Return:
// none.
Int_t k = GetIndex(i,j);
-
- if(fa->At(k)!=0){
- fa->RemoveAt(k);
- } // end for i && if
+ if((fa[k]).IsUsed())(fa[k]).MarkUnused();
if(k==fEntries-1) fEntries--;
}
//______________________________________________________________________
// Return:
// A copied AliITSpList object.
- if(this == &source) return *this;
-
- if(this->fa!=0){ // if this->fa exists delete it first.
- fa->Delete();
- delete fa;
- fa = 0;
- } // end if this->fa!=0
- this->fNi = source.fNi;
- this->fNj = source.fNj;
- this->fa = new TClonesArray(*(source.fa));
- this->fEntries = source.fEntries;
-
- return *this;
+ this->~AliITSpList();
+ new(this) AliITSpList(source);
+ return *this;
}
//______________________________________________________________________
-AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source){
+AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source),
+fNi(source.fNi),
+fNj(source.fNj),
+fa(new AliITSpListItem[fNi*fNj]),
+fEntries(source.fEntries){
// Copy constructor
-
- fNi = source.fNi;
- fNj = source.fNj;
- fa = new TClonesArray(*(source.fa));
- fEntries = source.fEntries;
+ for(Int_t i=0; i<fEntries; i++)(fa[i]).Build(source.fa[i]);
}
//______________________________________________________________________
void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) {
// Return:
// none.
Int_t index = pl->GetIndex();
- TClonesArray &rfa = *fa;
- if( fa->At( index ) == 0 ) { // most create AliITSpListItem
- new(rfa[index])AliITSpListItem(-2,-1,pl->GetModule(),index,0.0);
- } // end if
-
- ((AliITSpListItem*)(fa->At(index)))->AddTo( fileIndex,pl);
+ AliITSpListItem &lit = fa[index];
+ if(!lit.IsUsed())lit.Build(-2,-1,pl->GetModule(),index,0.);
+ lit.AddTo(fileIndex,pl);
if(index>=fEntries) fEntries = index +1;
}
//______________________________________________________________________
// none.
Int_t index = GetIndex(i,j);
if (index<0) return;
- TClonesArray &rfa = *fa;
- if(GetpListItem(index)==0){ // must create AliITSpListItem
- new(rfa[index])AliITSpListItem(trk,ht,mod,index,signal);
- }else{ // AliITSpListItem exists, just add signal to it.
- GetpListItem(index)->AddSignal(trk,ht,mod,index,signal);
- } // end if
+ AliITSpListItem &lit = fa[index];
+ if(!lit.IsUsed()){
+ lit.Build(trk,ht,mod,index,signal);
+ }
+ else {
+ lit.AddSignal(trk,ht,mod,index,signal);
+ }
if(index>=fEntries) fEntries = index +1;
}
//______________________________________________________________________
// Return:
// none.
Int_t index = GetIndex(i,j);
- TClonesArray &rfa = *fa;
- if(GetpListItem(index)==0){ // most create AliITSpListItem
- new(rfa[index]) AliITSpListItem(mod,index,noise);
- }else{ // AliITSpListItem exists, just add signal to it.
- GetpListItem(index)->AddNoise(mod,index,noise);
- } // end if
+ if (index<0) return;
+ AliITSpListItem &lit = fa[index];
+ if(!lit.IsUsed()){
+ lit.Build(mod,index,noise);
+ }
+ else {
+ lit.AddNoise(mod,index,noise);
+ }
if(index>=fEntries) fEntries = index +1;
}
//______________________________________________________________________
j = index - fNj*i;
return;
}
-//______________________________________________________________________
-Int_t AliITSpList::GetIndex(Int_t i, Int_t j) const {
- // returns the TClonesArray index for a given set of map indexes.
- if(i<0||i>=fNi || j<0||j>=fNj){
- Warning("GetIndex","Index out of range 0<i=%d<%d and 0<0j=%d<%d",i,fNi,j,fNj);
- return -1;
- }
- else {
- return fNj*i+j;
- }
-}