]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixes for report #68312: Improper usage of TClonesArrays in ITS
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Jun 2010 15:32:28 +0000 (15:32 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Jun 2010 15:32:28 +0000 (15:32 +0000)
13 files changed:
HLT/ITS/AliHLTITSClusterFinderComponent.cxx
HLT/ITS/AliHLTITSClusterFinderComponent.h
ITS/AliITSClusterFinder.h
ITS/AliITSClusterFinderV2SDD.cxx
ITS/AliITSClusterFinderV2SDD.h
ITS/AliITSClusterFinderV2SPD.cxx
ITS/AliITSClusterFinderV2SPD.h
ITS/AliITSClusterFinderV2SSD.cxx
ITS/AliITSClusterFinderV2SSD.h
ITS/AliITSDetTypeRec.cxx
ITS/AliITSDetTypeRec.h
ITS/AliITSRecPointContainer.cxx
ITS/AliITSRecPointContainer.h

index b6593f3043f26b5deb913bf6146a496a4e14122e..8a25cb4542f96d5f57292daf50ba1b444b066da9 100644 (file)
@@ -41,6 +41,7 @@ using namespace std;
 #include "AliHLTITSClusterFinderSPD.h"
 #include "AliHLTITSClusterFinderSSD.h"
 #include "TMap.h"
+#include "AliITSRecPointContainer.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -61,7 +62,6 @@ AliHLTITSClusterFinderComponent::AliHLTITSClusterFinderComponent(int mode)
   fNModules(0),
   fId(0),
   fNddl(0),
-  fClusters(NULL),
   fRawReader(NULL),
   fDettype(NULL),
   fgeom(NULL),
@@ -70,6 +70,9 @@ AliHLTITSClusterFinderComponent::AliHLTITSClusterFinderComponent(int mode)
   fSSD(NULL),
   tD(NULL),
   tR(NULL),
+  fSPDNModules(0),
+  fSDDNModules(0),
+  fSSDNModules(0),
   fclusters(),
   fBenchmark(GetComponentID())
 { 
@@ -282,12 +285,25 @@ Int_t AliHLTITSClusterFinderComponent::DoInit( int argc, const char** argv ) {
   fgeom = fgeomInit->CreateAliITSgeom();
  
   fNModules = fgeom->GetIndexMax();
-
-  fClusters = new TClonesArray*[fNModules]; 
-  for (Int_t iModule = 0; iModule < fNModules; iModule++) {
-    fClusters[iModule] = NULL;
-  } 
-
+  Int_t modperlay[6];
+  for(Int_t i=0;i<6;i++)modperlay[i]=AliITSgeomTGeo::GetNDetectors(1+i)*AliITSgeomTGeo::GetNLadders(1+i);
+  fSPDNModules=modperlay[0]+modperlay[1];
+  fSDDNModules=modperlay[2]+modperlay[3];
+  fSSDNModules=modperlay[4]+modperlay[5];
+  
+  if(fModeSwitch==kClusterFinderSPD) {
+    fFirstModule=0;
+    fLastModule=fSPDNModules;
+  }
+  else if(fModeSwitch==kClusterFinderSDD) {
+     fFirstModule=fSPDNModules;
+     fLastModule=fFirstModule + fSDDNModules;
+  }
+  else if(fModeSwitch==kClusterFinderSSD) {
+    fFirstModule=fSPDNModules + fSDDNModules;
+    fLastModule=fFirstModule + fSSDNModules;
+  }
   //set dettype
   fDettype = new AliITSDetTypeRec();
   fDettype->SetITSgeom(fgeom); 
@@ -334,14 +350,6 @@ Int_t AliHLTITSClusterFinderComponent::DoDeinit() {
   delete fSSD;
   fSSD = 0;
 
-  for (Int_t iModule = 0; iModule < fNModules; iModule++) {
-    if(fClusters[iModule] != NULL){
-      fClusters[iModule]->Delete();
-      delete fClusters[iModule];
-    }
-    fClusters[iModule] = NULL;
-  } 
-  
   fUseOfflineFinder = 0;
 
   return 0;
@@ -458,7 +466,15 @@ int AliHLTITSClusterFinderComponent::DoEvent
     }
   }
   else{
-      
+
+    AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
+
+    if(fUseOfflineFinder){
+      if(fModeSwitch==kClusterFinderSPD){rpc->ResetSPD();}
+      if(fModeSwitch==kClusterFinderSSD){rpc->ResetSSD();}
+    }
+    if(fModeSwitch==kClusterFinderSDD){rpc->ResetSDD();}
+
     // -- Loop over blocks
     for( const AliHLTComponentBlockData* iter = GetFirstInputBlock(fInputDataType); iter != NULL; iter = GetNextInputBlock() ) {
       
@@ -500,21 +516,28 @@ int AliHLTITSClusterFinderComponent::DoEvent
       if(fModeSwitch==kClusterFinderSPD && !fUseOfflineFinder){ fSPD->RawdataToClusters( fRawReader, fclusters ); }
       else if(fModeSwitch==kClusterFinderSSD && !fUseOfflineFinder){ fSSD->RawdataToClusters( fclusters ); }
       else{
-       if(fModeSwitch==kClusterFinderSPD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,fClusters,"SPD");}
-       if(fModeSwitch==kClusterFinderSSD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,fClusters,"SSD");}
-       if(fModeSwitch==kClusterFinderSDD) {fDettype->DigitsToRecPoints(fRawReader,fClusters,"SDD");}
-       for(int i=0;i<fNModules;i++){
-         if(fClusters[i] != NULL){
-           for(int j=0;j<fClusters[i]->GetEntriesFast();j++){
-             AliITSRecPoint *recpoint = (AliITSRecPoint*) (fClusters[i]->At(j));
+       if(fModeSwitch==kClusterFinderSPD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,"SPD");}
+       if(fModeSwitch==kClusterFinderSSD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,"SSD");}
+       if(fModeSwitch==kClusterFinderSDD) {fDettype->DigitsToRecPoints(fRawReader,"SDD");}
+       //AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
+       TClonesArray* clusters = NULL;
+       for(int i=fFirstModule;i<fLastModule;i++){
+         clusters = rpc->UncheckedGetClusters(i);
+         if(clusters != NULL){
+           for(int j=0;j<clusters->GetEntriesFast();j++){
+             AliITSRecPoint *recpoint = (AliITSRecPoint*) (clusters->At(j));
              fclusters.push_back(*recpoint);
            }
-           fClusters[i]->Delete();
-           delete fClusters[i];
          }
-         fClusters[i] = NULL;
        }     
       }
+  
+      if(fUseOfflineFinder){
+       if(fModeSwitch==kClusterFinderSPD){rpc->ResetSPD();}
+       if(fModeSwitch==kClusterFinderSSD){rpc->ResetSSD();}
+      }
+      if(fModeSwitch==kClusterFinderSDD){rpc->ResetSDD();}
+  
       fBenchmark.Stop(1);
       
       fRawReader->ClearBuffers();    
index d4dffc5d65a8e34f1faef5eee85626474a3313eb..6efc42271ed68ad5d96d6b0f2c2cf8b3a577c739 100644 (file)
@@ -201,8 +201,6 @@ class AliHLTITSClusterFinderComponent : public AliHLTProcessor
   Int_t fId;                   // ddl offset
   Int_t fNddl;                 // number of ddl's
   
-   TClonesArray** fClusters;                                  //!transient
-  
   /** the reader object for data decoding */
 
   AliRawReaderMemory* fRawReader;                             //!transient
@@ -216,6 +214,13 @@ class AliHLTITSClusterFinderComponent : public AliHLTProcessor
   TTree *tD;                                                  //!transient
   TTree *tR;                                                  //!transient
 
+  Int_t fSPDNModules;                                         //!transient 
+  Int_t fSDDNModules;                                         //!transient
+  Int_t fSSDNModules;                                         //!transient 
+  
+  Int_t fFirstModule;                                         //!transient    
+  Int_t fLastModule;                                          //!transient
+
   std::vector<AliITSRecPoint> fclusters;                      //!transient
 
   AliHLTComponentBenchmark fBenchmark;// benchmark
index 2ccbaa5a449c52837f884d100bfb63e59c4b5055..db36088727cabb53af95c9707523865998454bca 100644 (file)
@@ -35,7 +35,7 @@ class AliITSClusterFinder :public TObject{
     //
     // Do the Reconstruction.
     virtual void FindRawClusters(Int_t /*mod*/)=0; // Finds cluster of digits.
-    virtual void RawdataToClusters(AliRawReader* /*rawReader*/,TClonesArray** /*clusters*/) {
+    virtual void RawdataToClusters(AliRawReader* /*rawReader*/) {
       AliError("Method not implemented in this class ");
     }
 
index 616932b677966a4e4ff6ecaf88426398bc98d001..8d065dfd218b82c1a8ae659e5cbd7f37b35e63e4 100644 (file)
@@ -28,6 +28,7 @@
 #include <TBits.h>
 #include "AliITSClusterFinderV2SDD.h"
 #include "AliITSRecPoint.h"
+#include "AliITSRecPointContainer.h"
 #include "AliITSDetTypeRec.h"
 #include "AliRawReader.h"
 #include "AliITSRawStreamSDD.h"
@@ -316,7 +317,7 @@ FindClustersSDD(AliBin* bins[2], TBits* anodeFired[2],
 
 } 
 //______________________________________________________________________
-void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){
+void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader){
     //------------------------------------------------------------
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
@@ -343,16 +344,16 @@ void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClones
       }
     }
   }
-  FindClustersSDD(inputSDD,clusters);
+  FindClustersSDD(inputSDD);
   delete inputSDD;
 }
 
-void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, 
-                                       TClonesArray** clusters) 
+void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input) 
 {
   //------------------------------------------------------------
   // Actual SDD cluster finder for raw data
   //------------------------------------------------------------
+  AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
   Int_t nClustersSDD = 0;
   AliBin *bins[2];
   TBits* anodeFired[2];
@@ -385,13 +386,13 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input,
       for(Int_t iMod=0; iMod<kModulesPerDDL; iMod++){
        if(vectModId[iMod]>=0){
          fModule = vectModId[iMod];
-         clusters[fModule] = new TClonesArray("AliITSRecPoint");
+         TClonesArray* clusters = rpc->UncheckedGetClusters(fModule);
          bins[0]=fDDLBins[iMod*2];   // first hybrid of the module
          bins[1]=fDDLBins[iMod*2+1]; // second hybrid of the module
          anodeFired[0]=ddlAnodeFired[iMod*2];
          anodeFired[1]=ddlAnodeFired[iMod*2+1];
-         FindClustersSDD(bins, anodeFired, NULL, clusters[fModule],jitter);
-         Int_t nClusters = clusters[fModule]->GetEntriesFast();
+         FindClustersSDD(bins, anodeFired, NULL, clusters,jitter);
+         Int_t nClusters = clusters->GetEntriesFast();
          nClustersSDD += nClusters;
          vectModId[iMod]=-1;
        }
index 2cf9d1cc08a9b133c3e9cd0620e6198e95dc3427..8ed101b66e53be6e7a495cd9234490caf878d63b 100644 (file)
@@ -24,7 +24,7 @@ public:
   AliITSClusterFinderV2SDD(AliITSDetTypeRec* dettyp);
   virtual ~AliITSClusterFinderV2SDD();
   virtual void FindRawClusters(Int_t mod);
-  virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters);
+  virtual void RawdataToClusters(AliRawReader* rawReader);
   void SetPeakSelection(Float_t looseCut=15., Float_t tightCut=30., Float_t maxTime=2000.){
     fCutOnPeakLoose=looseCut;
     fCutOnPeakTight=tightCut;
@@ -43,7 +43,7 @@ public:
   void FindClustersSDD(AliBin* bins[2], TBits* anodeFired[2],
                       TClonesArray *dig, TClonesArray *clusters=0x0, Int_t jitter=0);
 
-  void FindClustersSDD(AliITSRawStream* input,TClonesArray** clusters);
+  void FindClustersSDD(AliITSRawStream* input);
   virtual AliITSCalibrationSDD* GetResp(Int_t mod)const{
     return (AliITSCalibrationSDD*) fDetTypeRec->GetCalibrationModel(mod);}
   virtual AliITSsegmentationSDD* GetSeg()const{
index 5dd8cc274d86d7227dc5cf25098a1b6bf1f01d26..75e1dac79628d09b0a23128996a6159526f68d62 100644 (file)
@@ -32,6 +32,7 @@
 #include <TClonesArray.h>
 #include "AliITSdigitSPD.h"
 #include "AliITSFOSignalsSPD.h"
+#include "AliITSRecPointContainer.h"
 
 ClassImp(AliITSClusterFinderV2SPD)
 
@@ -73,13 +74,13 @@ void AliITSClusterFinderV2SPD::FindRawClusters(Int_t mod){
 
 }
 //__________________________________________________________________________
-void AliITSClusterFinderV2SPD::RawdataToClusters(AliRawReader* rawReader, TClonesArray** clusters){
+void AliITSClusterFinderV2SPD::RawdataToClusters(AliRawReader* rawReader){
   //------------------------------------------------------------
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
   rawReader->Reset();
   AliITSRawStreamSPD inputSPD(rawReader);
-  FindClustersSPD(&inputSPD, clusters);
+  FindClustersSPD(&inputSPD);
 
 }
 //__________________________________________________________________________
@@ -273,14 +274,14 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
   
 }
 //__________________________________________________________________________
-void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input, 
-                                       TClonesArray** clusters) 
+void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input) 
 {
   //------------------------------------------------------------
   // SPD cluster finder for raw data (this method is called once per event)
   // Now also fills fast-or fired map
   //------------------------------------------------------------
-  
+
+  AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();  
   Int_t nClustersSPD = 0;
   Int_t kNzBins = fNzSPD + 2;
   Int_t kNyBins = fNySPD + 2;
@@ -297,8 +298,8 @@ void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input,
 
       // when all data from a module was read, search for clusters
       if (bins) { 
-       clusters[iModule] = new TClonesArray("AliITSRecPoint");
-       Int_t nClusters = ClustersSPD(bins,0,clusters[iModule],kMaxBin,kNzBins,iModule,kTRUE);
+       TClonesArray* clusters = rpc->UncheckedGetClusters(iModule);
+       Int_t nClusters = ClustersSPD(bins,0,clusters,kMaxBin,kNzBins,iModule,kTRUE);
        nClustersSPD += nClusters;
        bins = NULL;
       }
index e027d28f47da4836434a2c112d022379eee311ef..2416476c774533ddd13eb54acc7fd5ba673c328e 100644 (file)
@@ -21,13 +21,13 @@ public:
   AliITSClusterFinderV2SPD(AliITSDetTypeRec* dettyp);
   virtual ~AliITSClusterFinderV2SPD(){;}
   virtual void FindRawClusters(Int_t mod);
-  virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters);
+  virtual void RawdataToClusters(AliRawReader* rawReader);
   
 
  protected:
 
   void FindClustersSPD(TClonesArray *digits);
-  void FindClustersSPD(AliITSRawStreamSPD* input,TClonesArray** clusters);
+  void FindClustersSPD(AliITSRawStreamSPD* input);
   Int_t ClustersSPD(AliBin* bins, TClonesArray* digits,TClonesArray* clusters,Int_t maxBins, Int_t nzbins,Int_t iModule,Bool_t rawdata=kFALSE);
 
   Int_t fLastSPD1;       //index of the last SPD1 detector
index 9d7d60a239a0d30fc1ef03077b0fb11ec44be302..3c71ad378e6d2a0bb55680aae0343f20a0696453 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "AliITSClusterFinderV2SSD.h"
 #include "AliITSRecPoint.h"
+#include "AliITSRecPointContainer.h"
 #include "AliITSgeomTGeo.h"
 #include "AliITSDetTypeRec.h"
 #include "AliRawReader.h"
@@ -356,24 +357,24 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) {
 }
 
 
-void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){
+void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader){
 
     //------------------------------------------------------------
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
   rawReader->Reset();
   AliITSRawStreamSSD inputSSD(rawReader);
-  FindClustersSSD(&inputSSD,clusters);
+  FindClustersSSD(&inputSSD);
   
 }
 
-void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input, 
-                                       TClonesArray** clusters) 
+void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input) 
 {
   //------------------------------------------------------------
   // Actual SSD cluster finder for raw data
   //------------------------------------------------------------
 
+  AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
   static AliITSRecoParam *repa = NULL;
   if(!repa){
     repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
@@ -712,13 +713,12 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input,
       }
       
       // create recpoints
-      if((nClusters[0])&&(nClusters[1])) {
-       
-       clusters[iModule] = new TClonesArray("AliITSRecPoint");
+      if((nClusters[0])&&(nClusters[1])) {     
        fModule = iModule;
+       TClonesArray* clusters = rpc->UncheckedGetClusters(fModule);
        FindClustersSSD(&clusters1D[0][0], nClusters[0], 
-                       &clusters1D[1][0], nClusters[1], clusters[iModule]);
-       Int_t nClustersn = clusters[iModule]->GetEntriesFast();
+                       &clusters1D[1][0], nClusters[1], clusters);
+       Int_t nClustersn = clusters->GetEntriesFast();
        nClustersSSD += nClustersn;
       }
 
index f1f737a647cc8e738e69f8870b51bd44de75beb9..ab9a39f8d7f78192ca50130aabab252f7ed994e0 100644 (file)
@@ -28,7 +28,7 @@ public:
   AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp);
   virtual ~AliITSClusterFinderV2SSD(){;}
   virtual void FindRawClusters(Int_t mod);
-  virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters);
+  virtual void RawdataToClusters(AliRawReader* rawReader);
  protected:
   AliITSClusterFinderV2SSD(const AliITSClusterFinderV2SSD& cf);
   AliITSClusterFinderV2SSD& operator=(const AliITSClusterFinderV2SSD&  cf );
@@ -37,7 +37,7 @@ public:
                       Ali1Dcluster* pos, Int_t np,
                       TClonesArray *clusters=0x0);
 
-  void FindClustersSSD(AliITSRawStreamSSD* input,TClonesArray** clusters);
+  void FindClustersSSD(AliITSRawStreamSSD* input);
   virtual AliITSCalibrationSSD* GetResp(Int_t mod)const{
     return (AliITSCalibrationSSD*) fDetTypeRec->GetCalibrationModel(mod);}
 
index 13b02e3c6defe59a18466a398f67452736a73fe1..44a42ff8d93a2d30a459b90550b3a2edf6e5602c 100644 (file)
@@ -932,38 +932,49 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Op
                         strstr(opt,"SSD")};
   
   Int_t id=0;
-
+  /*
   TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
   TBranch *branch = treeR->Branch("ITSRecPoints",&array);
   delete array;
   TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; 
   for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
     clusters[iModule] = NULL;
   }
-
-  DigitsToRecPoints(rawReader,clusters,opt);
+  */
+  AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
+  rpc->FullReset();
+  TClonesArray* array = rpc->UncheckedGetClusters(0);
+  TBranch *branch = treeR->Branch("ITSRecPoints",&array);
+  DigitsToRecPoints(rawReader,opt); 
 
   Int_t nClusters =0;
-  TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
+  //  TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
   for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
     id = GetITSgeom()->GetModuleType(iModule);
     if (!all && !det[id]) continue;
-    array = clusters[iModule];
+    array = rpc->UncheckedGetClusters(iModule);
     if(!array){
       AliDebug(1,Form("data for module %d missing!",iModule));
-      array = emptyArray;
+      //     array = emptyArray;
     }
     branch->SetAddress(&array);
     treeR->Fill();
     nClusters+=array->GetEntriesFast();
-
+    /*
     if (array != emptyArray) {
       array->Delete();
       delete array;
     }
+    */
+  }
+  //  delete emptyArray;
+  printf("===============   +++++++++++++++++ ===================\n");
+  for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
+    array = rpc->UncheckedGetClusters(iModule);
+    Int_t number = array->GetEntries();
+    if(number>0)printf("Module %d has %d clusters\n",iModule,number);
   }
-  delete emptyArray;
+  rpc->FullReset();
 
   AliITSRecPointContainer* rpcont = AliITSRecPointContainer::Instance();
   Int_t nClu[6];
@@ -971,17 +982,24 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Op
   for(Int_t iLay=2; iLay<=6; iLay++) nClu[iLay-1]=rpcont->GetNClustersInLayerFast(iLay);
   AliInfo(Form("Number of RecPoints in ITS Layers = %d %d %d %d %d %d, Total = %d",
               nClu[0],nClu[1],nClu[2],nClu[3],nClu[4],nClu[5],nClusters));
-  delete[] clusters;
+
+  printf("===============  SECOND   +++++++++++++++++ ===================\n");
+  for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
+    array = rpc->UncheckedGetClusters(iModule);
+    Int_t number = array->GetEntries();
+    if(number>0)printf("Module %d has %d clusters\n",iModule,number);
+  }
+
+  //  delete[] clusters;
 }
 //______________________________________________________________________
-void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TClonesArray** clusters,Option_t *opt){
+void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,Option_t *opt){
   // cluster finding and reconstruction of space points
   // the condition below will disappear when the geom class will be
   // initialized for all versions - for the moment it is only for v5 !
   // 7 is the SDD beam test version
   // Inputs:
   //      AliRawReader *rawReader  Pointer to the raw-data reader
-  //      TClonesArray **clusters  Clusters Array
   // Outputs:
   //      none.
   // Return:
@@ -1002,14 +1020,14 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TClonesArray**
     if (!rec)
       AliFatal("The reconstruction class was not instantiated");
     rec->SetDetTypeRec(this);
-    rec->RawdataToClusters(rawReader,clusters);    
+    rec->RawdataToClusters(rawReader);    
   } 
    
   // Remove PIT in-active chips from Fast-OR fired map
   if (all || det[0]) { // SPD present
     RemoveFastOrFiredInActive();
     // here removing bits which have no associated clusters 
-    if(clusters) RemoveFastOrFiredFromDead(GetFiredChipMap(clusters));
+    RemoveFastOrFiredFromDead(GetFiredChipMap());
    
   }  
 }
@@ -1101,12 +1119,14 @@ void AliITSDetTypeRec::RemoveFastOrFiredInActive() {
   }
 }
 //______________________________________________________________________
-TBits AliITSDetTypeRec::GetFiredChipMap(TClonesArray **clusters) const {
+TBits AliITSDetTypeRec::GetFiredChipMap() const {
   
   //
   // TBits of the fired chips  
   //
  
+  AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance();
+
   TBits isfiredchip(1200);
   
    AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)GetSegmentationModel(0);
@@ -1117,29 +1137,29 @@ TBits AliITSDetTypeRec::GetFiredChipMap(TClonesArray **clusters) const {
    
   
   for(Int_t imod =0; imod < fgkDefaultNModulesSPD; imod++){
TClonesArray *array = clusters[imod];
- if(!array) continue;
- Int_t nCluster = array->GetEntriesFast();
   TClonesArray *array = rpc->UncheckedGetClusters(imod);
   if(!array) continue;
   Int_t nCluster = array->GetEntriesFast();
  
- while(nCluster--) {
-     AliITSRecPoint* cluster = (AliITSRecPoint*)array->UncheckedAt(nCluster);
   while(nCluster--) {
+      AliITSRecPoint* cluster = (AliITSRecPoint*)array->UncheckedAt(nCluster);
      if (cluster->GetLayer()>1)continue;
-      Float_t local[3]={-1,-1};
-      local[1]=cluster->GetDetLocalX();
-      local[0]=cluster->GetDetLocalZ();
-      
-      Int_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(imod);
-      Int_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(imod);
-      Int_t row, col;
-      segSPD->LocalToDet(0.5,local[0],row,col);
-      Int_t chip = AliITSRawStreamSPD::GetOnlineChipFromOffline(imod,col);
-      Int_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
-      isfiredchip.SetBitNumber(chipkey,kTRUE);
-   }
+     Float_t local[3]={-1,-1};
+     local[1]=cluster->GetDetLocalX();
+     local[0]=cluster->GetDetLocalZ();
+     
+     Int_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(imod);
+     Int_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(imod);
+     Int_t row, col;
+     segSPD->LocalToDet(0.5,local[0],row,col);
+     Int_t chip = AliITSRawStreamSPD::GetOnlineChipFromOffline(imod,col);
+     Int_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip);
+     isfiredchip.SetBitNumber(chipkey,kTRUE);
+    }
     
- } 
 
  
- return isfiredchip;
 return isfiredchip;
   
 }
 //______________________________________________________________________
index 40fb6b054de8420f528620d3c4663048a6530219..f80f83dbec8207db4a704f5daeeeb517772fdfc1 100644 (file)
@@ -91,12 +91,12 @@ class AliITSDetTypeRec : public TObject {
     void MakeBranchRF(TTree *treeR){MakeBranchR(treeR,"Fast");}
     void DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastEntry,Option_t *det, Int_t optCluFind=0);
     void DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *det="All");
-    void DigitsToRecPoints(AliRawReader* rawReader,TClonesArray** clusters,Option_t *opt);
+    void DigitsToRecPoints(AliRawReader* rawReader,Option_t *opt);
 
     void   SetFastOrFiredMapOnline(UInt_t eq, UInt_t hs, UInt_t chip);
     void   SetFastOrFiredMap(UInt_t chipKey){fFastOrFiredMap.SetBitNumber(chipKey);} 
     TBits  GetFastOrFiredMap() const {return fFastOrFiredMap;}
-    TBits  GetFiredChipMap(TClonesArray **clusters) const; // (using SPD RecPoints)
+    TBits  GetFiredChipMap() const; // (using SPD RecPoints)
     TBits  GetFiredChipMap(TTree *treeR) const; // (using SPD RecPoints)
     void   ResetFastOrFiredMap(){fFastOrFiredMap.ResetAllBits();}
     void   RemoveFastOrFiredInActive(); // (using Trigger Conditions)
index e4b8143ef644a9fd850cc7420b5818726a3e594f..e2180111b608bfa516fcf401d39e18c8c0263fc9 100644 (file)
@@ -247,9 +247,44 @@ AliITSRecPointContainer* AliITSRecPointContainer::Instance(const AliITSRecoParam
 //______________________________________________________________________
 void AliITSRecPointContainer::Reset(){
   // Resets the status of the object
-  for(Int_t i=0;i<fgkNModules;i++){
-    (fArray[i])->Clear();
-  }
+  ClearClus(0,fgkNModules);
   fDet="";
   for(Int_t i=0;i<6;i++)fNClusters[i]=0;
 }
+//______________________________________________________________________
+void AliITSRecPointContainer::ResetSPD(){
+  // Resets only the entries in fArray concerning SPD
+  // This method should be used with care only when the filling
+  // of the container is not done from the RP TTree. 
+  fCurrentEve = -1000;  // protection: if FetchClusters method will be used
+                          // after this call, an ccess to the RP TTree will
+                          // be forced
+  ClearClus(0,fSPDNModules);
+}
+
+//______________________________________________________________________
+void AliITSRecPointContainer::ResetSDD(){
+  // Resets only the entries in fArray concerning SDD
+  // This method should be used with care only when the filling
+  // of the container is not done from the RP TTree. 
+  fCurrentEve = -1000;  // protection: if FetchClusters method will be used
+                          // after this call, an ccess to the RP TTree will
+                          // be forced
+  Int_t first = fSPDNModules;
+  Int_t last = first + fSDDNModules; 
+  ClearClus(first,last);
+}
+
+//______________________________________________________________________
+void AliITSRecPointContainer::ResetSSD(){
+  // Resets only the entries in fArray concerning SSD
+  // This method should be used with care only when the filling
+  // of the container is not done from the RP TTree. 
+  fCurrentEve = -1000;  // protection: if FetchClusters method will be used
+                          // after this call, an ccess to the RP TTree will
+                          // be forced
+  Int_t first = fSPDNModules + fSDDNModules;
+  Int_t last = first + fSSDNModules; 
+  ClearClus(first,last);
+}
+
index 1a493ef03baee1d98822ca4e612ebafadfa9a7b2..c80bbfe06ceb4da7b95c278ae46c34cf6976f31a 100644 (file)
@@ -36,6 +36,10 @@ class AliITSRecPointContainer : public TObject {
   // In the following two methods: 1<=lay<=6  (i.e. layers numbered from 1) 
   UInt_t GetNClustersInLayer(Int_t lay, TTree* tR, Int_t eventN=-1);
   UInt_t GetNClustersInLayerFast(Int_t lay) const;
+  void FullReset(){fCurrentEve=-1000; Reset();}
+  void ResetSPD(); // clears only SPD parts - see implementation for usage
+  void ResetSDD(); // clears only SPD parts - see implementation for usage
+  void ResetSSD(); // clears only SPD parts - see implementation for usage
 
  private:
   // methods
@@ -45,6 +49,10 @@ class AliITSRecPointContainer : public TObject {
   Bool_t CheckBoundaries(Int_t i)const { return (i>=0 && i<fgkNModules);}
   void CookEntries();
   void Reset();
+  void ClearClus(Int_t first, Int_t lastpp){ // clears clusters for modules 
+    // ranging from first to lastpp-1 included
+    for(Int_t i=first;i<lastpp;i++)(fArray[i])->Clear();
+  }
   //Data members
   static AliITSRecPointContainer* fgInstance; //! AliITSRecPointContainer 
                                               //  singleton