]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
TObjArray replaced with TClonesArray in AliITSpList - Typo corrected
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Feb 2006 09:57:22 +0000 (09:57 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Feb 2006 09:57:22 +0000 (09:57 +0000)
ITS/AliITSpList.cxx
ITS/AliITSpList.h
ITS/AliITSsimulationSPD.cxx
ITS/AliITSsimulationSPDdubna.cxx
ITS/AliITSsimulationSSD.cxx

index 1de0279827e2dbe57c4810d5df37b2b65b0c9da9..61b9ba599c0138bbe79e29d932955e8fa9d4aaa6 100644 (file)
@@ -16,7 +16,7 @@
 
 //***********************************************************************
 //
-// It consist of a TObjectArray of 
+// It consist of a TClonesArray of 
 // AliITSpListItem objects
 // This array can be accessed via 2 indexed
 // it is used at digitization level by 
@@ -24,8 +24,6 @@
 //
 // ***********************************************************************
 
-#include <TObjArray.h>
-
 #include "AliITSpList.h"
 #include "AliITSpListItem.h"
 
@@ -59,9 +57,8 @@ AliITSpList::AliITSpList(Int_t imax,Int_t jmax){
 
     fNi = imax;
     fNj = jmax;
-    fEnteries = 0;
-    fa  = new TObjArray(fNi*fNj); // elements are zeroed by 
-                                  // TObjArray creator
+    fEntries = 0;
+    fa = new TClonesArray("AliITSpListItem",fNi*fNj);
 }
 //______________________________________________________________________
 AliITSpList::~AliITSpList(){
@@ -73,20 +70,20 @@ AliITSpList::~AliITSpList(){
     // Return:
     //    a properly destroyed 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
+  if(fa){
+    fa->Delete();
+    delete fa;
+    fa = 0;
+  }
     fNi = 0;
     fNj = 0;
-    delete fa;
-    fa  = 0;
-    fEnteries = 0;
+
+    fEntries = 0;
 }
 
 //______________________________________________________________________
 void AliITSpList::ClearMap(){
-    // Delete all AliITSpListItems and zero TObjArray.
+    // Delete all AliITSpListItems and zero TClonesArray.
     // Inputs:
     //    none.
     // Outputs:
@@ -95,17 +92,11 @@ void AliITSpList::ClearMap(){
     //    A zeroed AliITSpList class.
 
     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;
+    fEntries = 0;
 }
 //______________________________________________________________________
 void AliITSpList::DeleteHit(Int_t i,Int_t j){
-    // Delete a particular AliITSpListItems and zero TObjArray.
+    // Delete a particular AliITSpListItems.
     // Inputs:
     //    Int_t i   Row number
     //    Int_t j   Columns number
@@ -116,10 +107,9 @@ void AliITSpList::DeleteHit(Int_t i,Int_t j){
     Int_t k = GetIndex(i,j);
 
     if(fa->At(k)!=0){
-        delete fa->At(k);
-        fa->AddAt(0,k); // zero content
+      fa->RemoveAt(k);
     } // end for i && if
-    if(k==fEnteries-1) fEnteries--;
+    if(k==fEntries-1) fEntries--;
 }
 //______________________________________________________________________
 AliITSpList& AliITSpList::operator=(const AliITSpList &source){
@@ -134,16 +124,14 @@ AliITSpList& AliITSpList::operator=(const AliITSpList &source){
     if(this == &source) return *this;
 
     if(this->fa!=0){ // if this->fa exists delete it first.
-        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
-        delete this->fa;
+      fa->Delete();
+      delete fa;
+      fa = 0;
     } // end if this->fa!=0
     this->fNi = source.fNi;
     this->fNj = source.fNj;
-    this->fa = new TObjArray(*(source.fa));
-    this->fEnteries = source.fEnteries;
+    this->fa = new TClonesArray(*(source.fa));
+    this->fEntries = source.fEntries;
 
     return *this;
 }
@@ -153,8 +141,8 @@ AliITSpList::AliITSpList(const AliITSpList &source) : AliITSMap(source){
 
   fNi = source.fNi;
   fNj = source.fNj;
-  fa = new TObjArray(*(source.fa));
-  fEnteries = source.fEnteries;
+  fa = new TClonesArray(*(source.fa));
+  fEntries = source.fEntries;
 }
 //______________________________________________________________________
 void AliITSpList::AddItemTo(Int_t fileIndex, AliITSpListItem *pl) {
@@ -169,18 +157,19 @@ 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
-        fa->AddAt(new AliITSpListItem(-2,-1,pl->GetModule(),index,0.0),index);
+      new(rfa[index])AliITSpListItem(-2,-1,pl->GetModule(),index,0.0);
     } // end if
  
     ((AliITSpListItem*)(fa->At(index)))->AddTo( fileIndex,pl);
-    if(index>=fEnteries) fEnteries = index +1;
+    if(index>=fEntries) fEntries = index +1;
 }
 //______________________________________________________________________
 void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,
                        Double_t signal){
-    // Adds a Signal value to the TObjArray at i,j. Creates the AliITSpListItem
+    // Adds a Signal value to the TClonesArray at i,j. 
+    // Creates the AliITSpListItem
     // if needed.
     // Inputs:
     //    Int_t i         Row number for this signal
@@ -194,17 +183,18 @@ void AliITSpList::AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,
     // Return:
     //    none.
     Int_t index = GetIndex(i,j);
-
-    if(GetpListItem(index)==0){ // most create AliITSpListItem
-        fa->AddAt(new AliITSpListItem(trk,ht,mod,index,signal),index);
+    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
-    if(index>=fEnteries) fEnteries = index +1;
+    if(index>=fEntries) fEntries = index +1;
 }
 //______________________________________________________________________
 void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
-    // Adds a noise value to the TObjArray at i,j. Creates the AliITSpListItem
+    // Adds a noise value to the TClonesArray at i,j. 
+    // Creates the AliITSpListItem
     // if needed.
     // Inputs:
     //    Int_t i        Row number for this noise
@@ -215,13 +205,13 @@ void AliITSpList::AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise){
     // Return:
     //    none.
     Int_t index = GetIndex(i,j);
-
+    TClonesArray &rfa = *fa;
     if(GetpListItem(index)==0){ // most create AliITSpListItem
-        fa->AddAt(new AliITSpListItem(mod,index,noise),index);
+      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>=fEnteries) fEnteries = index +1;
+    if(index>=fEntries) fEntries = index +1;
 }
 //______________________________________________________________________
 void AliITSpList::GetCell(Int_t index,Int_t &i,Int_t &j) const {
@@ -239,7 +229,7 @@ void AliITSpList::GetCell(Int_t index,Int_t &i,Int_t &j) const {
 }
 //______________________________________________________________________
 Int_t AliITSpList::GetIndex(Int_t i, Int_t j) const {
- // returns the TObjArray index for a given set of map indexes.
+ // 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;
index 5f9f200345c24daf6d1829af8c9576a73c636935..3f21271203e571df147fc7f06bba154de99726f2 100644 (file)
@@ -3,10 +3,9 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice     */
 
+#include "TClonesArray.h"
 #include "AliITSMap.h"
 #include "AliITSpListItem.h"
-class TObjArray;
-// class AliITSpListItem;
 
 class AliITSpList: public AliITSMap {
 
@@ -26,10 +25,10 @@ class AliITSpList: public AliITSMap {
     // returns the max index value.
     Int_t GetMaxIndex() const {return fNi*fNj;}
     // returns the largest non-zero entry kept in the array fa.
-    Int_t GetEntries() const {return fEnteries;}
+    Int_t GetEntries() const {return fEntries;}
     // returns the max number of track/hit entries per cell.
-    Int_t GetNEnteries() const {return AliITSpListItem::GetMaxKept();}
-    // for a give TObjArray index it returns the corresponding map index
+    Int_t GetNEntries() const {return AliITSpListItem::GetMaxKept();}
+    // for a given TClonesArray index it returns the corresponding map index
     void  GetMapIndex(Int_t index,Int_t &i,Int_t &j) const {
        i = index/fNj;j = index - fNj*i;
        if(i<0||i>=fNi || j<0||j>=fNj){i=-1;j=-1; return;}
@@ -87,20 +86,20 @@ class AliITSpList: public AliITSMap {
     void AddSignal(Int_t i,Int_t j,Int_t trk,Int_t ht,Int_t mod,Double_t sig);
     // Adds a Noise value to the map. Creating and expanding arrays as needed.
     void AddNoise(Int_t i,Int_t j,Int_t mod,Double_t noise);
-    // Delete all AliITSpListItems and zero the TObjArray
+    // Delete all AliITSpListItems and zero the TClonesArray
     virtual void ClearMap();
-    // Delete a particular AliITSpListItem in the TObjArray.
+    // Delete a particular AliITSpListItem in the TClonesArray.
     virtual void DeleteHit(Int_t i,Int_t j);
-    // returns hit index in TObjArray
+    // returns hit index in TClonesArray
     virtual Int_t GetHitIndex(Int_t i,Int_t j) const {return GetIndex(i,j);}
     // returns "hit" AliITSpListItem as a TObject.
     TObject * GetHit(Int_t i,Int_t j){return (TObject*)GetpListItem(i,j);}
     // tests hit status.
     virtual FlagType TestHit(Int_t i,Int_t j){if(GetpListItem(i,j)==0) return kEmpty;
     else if(GetSignal(i,j)<=0) return kUnused; else return kUsed;}
-    // Returns the pointer to the TObjArray of pList Items
-    TObjArray * GetpListItems(){return fa;}
-    // returns the pList Item stored in the TObject array
+    // Returns the pointer to the TClonesArray of pList Items
+    TClonesArray * GetpListItems(){return fa;}
+    // returns the pList Item stored in the TClonesArray
     AliITSpListItem* GetpListItem(Int_t index){
        if(fa!=0)return (AliITSpListItem*) (fa->At(index));
        else return 0;}
@@ -127,8 +126,8 @@ class AliITSpList: public AliITSMap {
          Warning(method,"This method is not implemented for this class");}
 // data members
     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.
+    TClonesArray *fa;       // array of pList items
+    Int_t     fEntries; // keepts track of the number of non-zero entries.
 
     ClassDef(AliITSpList,3) // list of signals and track numbers
 };     
index 2993d6bbb5c58cdaf8b694a9e064d410e438c3eb..f7781990a7113bc5384bdca1de28cc85ce46cdec 100644 (file)
@@ -784,7 +784,7 @@ void AliITSsimulationSPD::CreateDigit(Int_t module,AliITSpList *pList) {
                 digits[2] =  (Int_t) signal;  // the signal is stored in
                                               //  electrons
                 for(j1=0;j1<size;j1++){
-                    if(j1<pList->GetNEnteries()){
+                    if(j1<pList->GetNEntries()){
                         tracks[j1] = pList->GetTrack(r,c,j1);
                         hits[j1]   = pList->GetHit(r,c,j1);
                         //}else{
index 32cc2a171921e95aa351d2e7c49eec67a732fb7e..bf76b68ae45f512c60f815bd62cde8b3a04d7817 100644 (file)
@@ -478,7 +478,7 @@ void AliITSsimulationSPDdubna::pListToDigits(){
         dig.SetSignal(1);
         dig.SetSignalSPD((Int_t) GetMap()->GetSignal(iz,ix));
         for(j=0;j<nmaxtrk;j++){
-            if (j<GetMap()->GetNEnteries()) {
+            if (j<GetMap()->GetNEntries()) {
                 dig.SetTrack(j,GetMap()->GetTrack(iz,ix,j));
                 dig.SetHit(j,GetMap()->GetHit(iz,ix,j));
             }else { // Default values
index e9b8e34f61d12923afe4f9ec5137beca3359366d..2e3ea367ca7fb9f49631b4257acbb98a1164a379 100644 (file)
@@ -552,7 +552,7 @@ void AliITSsimulationSSD::ChargeToSignal(Int_t module,AliITSpList *pList) {
             digits[0] = k;
             digits[1] = ix;
             digits[2] = (Int_t) signal;
-            for(j1=0;j1<size;j1++)if(j1<pList->GetNEnteries()){
+            for(j1=0;j1<size;j1++)if(j1<pList->GetNEntries()){
                 // only three in digit.
                 tracks[j1]  = pList->GetTrack(k,ix,j1);
                 hits[j1]    = pList->GetHit(k,ix,j1);