Create clusterizes only once per run and avoid resizing of data arrays, [bug #63491...
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Feb 2010 12:16:38 +0000 (12:16 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Feb 2010 12:16:38 +0000 (12:16 +0000)
TRD/AliTRDReconstructor.cxx
TRD/AliTRDReconstructor.h
TRD/AliTRDclusterizer.cxx

index d34bbf9..6b89546 100644 (file)
@@ -76,6 +76,7 @@ Int_t AliTRDReconstructor::fgNTimeBins = -1;
 AliTRDReconstructor::AliTRDReconstructor()
   :AliReconstructor()
   ,fSteerParam(0)
+  ,fClusterizer(NULL)
 {
   // setting default "ON" steering parameters
   // owner of debug streamers 
@@ -109,6 +110,10 @@ AliTRDReconstructor::~AliTRDReconstructor()
     for(Int_t itask = 0; itask < AliTRDrecoParam::kTRDreconstructionTasks; itask++)
       if(fDebugStream[itask]) delete fDebugStream[itask];
   }
+  if(fClusterizer){
+    delete fClusterizer;
+    fClusterizer = NULL;
+  }
 }
 
 
@@ -120,6 +125,11 @@ void AliTRDReconstructor::Init(){
   SetOption(GetOption());
   Options(fSteerParam);
 
+  if(!fClusterizer){
+    fClusterizer = new AliTRDclusterizer(fgTaskNames[AliTRDrecoParam::kClusterizer], fgTaskNames[AliTRDrecoParam::kClusterizer]);
+    fClusterizer->SetReconstructor(this);
+  }
+  
   // Make Debug Streams when Debug Streaming
   if(IsDebugStreaming()){
     for(Int_t task = 0; task < AliTRDrecoParam::kTRDreconstructionTasks; task++){
@@ -168,25 +178,27 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
   rawReader->Select("TRD");
   AliTRDrawStreamBase::SetRawStreamVersion(GetRecoParam()->GetRawStreamVersion()->Data());
 
-  // New (fast) cluster finder
-  AliTRDclusterizer clusterer(fgTaskNames[AliTRDrecoParam::kClusterizer], fgTaskNames[AliTRDrecoParam::kClusterizer]);
-  clusterer.SetReconstructor(this);
-  clusterer.OpenOutput(clusterTree);
-  clusterer.OpenTrackletOutput();
-  clusterer.SetUseLabels(kFALSE);
-  clusterer.Raw2ClustersChamber(rawReader);
+  if(!fClusterizer){
+    AliFatal("Clusterizer not available!");
+    return;
+  }
+
+  fClusterizer->OpenOutput(clusterTree);
+  fClusterizer->OpenTrackletOutput();
+  fClusterizer->SetUseLabels(kFALSE);
+  fClusterizer->Raw2ClustersChamber(rawReader);
   
   if(IsWritingClusters()) return;
 
   // take over ownership of clusters
-  fgClusters = clusterer.RecPoints();
-  clusterer.SetClustersOwner(kFALSE);
+  fgClusters = fClusterizer->RecPoints();
+  fClusterizer->SetClustersOwner(kFALSE);
 
   // take over ownership of online tracklets
-  fgTracklets = clusterer.TrackletsArray();
-  clusterer.SetTrackletsOwner(kFALSE);
+  fgTracklets = fClusterizer->TrackletsArray();
+  fClusterizer->SetTrackletsOwner(kFALSE);
 
-  fgNTimeBins = clusterer.GetNTimeBins();
+  fgNTimeBins = fClusterizer->GetNTimeBins();
 }
 
 //_____________________________________________________________________________
@@ -199,23 +211,26 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree
 
   //AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
   
-  AliTRDclusterizer clusterer(fgTaskNames[AliTRDrecoParam::kClusterizer], fgTaskNames[AliTRDrecoParam::kClusterizer]);
-  clusterer.SetReconstructor(this);
-  clusterer.OpenOutput(clusterTree);
-  clusterer.ReadDigits(digitsTree);
-  clusterer.MakeClusters();
+  if(!fClusterizer){
+    AliFatal("Clusterizer not available!");
+    return;
+  }
+
+  fClusterizer->OpenOutput(clusterTree);
+  fClusterizer->ReadDigits(digitsTree);
+  fClusterizer->MakeClusters();
 
   if(IsWritingClusters()) return;
 
   // take over ownership of clusters
-  fgClusters = clusterer.RecPoints();
-  clusterer.SetClustersOwner(kFALSE);
+  fgClusters = fClusterizer->RecPoints();
+  fClusterizer->SetClustersOwner(kFALSE);
 
   // take over ownership of online tracklets
-  fgTracklets = clusterer.TrackletsArray();
-  clusterer.SetTrackletsOwner(kFALSE);
+  fgTracklets = fClusterizer->TrackletsArray();
+  fClusterizer->SetTrackletsOwner(kFALSE);
 
-  fgNTimeBins = clusterer.GetNTimeBins();
+  fgNTimeBins = fClusterizer->GetNTimeBins();
 }
 
 //_____________________________________________________________________________
index f4330a0..2d78a37 100644 (file)
@@ -21,6 +21,7 @@
 class TClonesArray;
 class TTreeSRedirector;
 class AliRawReader;
+class AliTRDclusterizer;
 class AliTRDReconstructor: public AliReconstructor 
 {
 public:
@@ -81,14 +82,16 @@ private:
   UInt_t            fSteerParam;          // steering bits
   TTreeSRedirector *fDebugStream[AliTRDrecoParam::kTRDreconstructionTasks];// Debug Streamer container;
  
-  static TClonesArray *fgClusters;    // list of clusters for local reconstructor
-  static TClonesArray *fgTracklets;   // list of online tracklets for local reconstructor
-  static Int_t         fgNTimeBins;   // number of time bins as given by the clusterizer
+  static TClonesArray *fgClusters;    //  list of clusters for local reconstructor
+  static TClonesArray *fgTracklets;   //  list of online tracklets for local reconstructor
+  static Int_t         fgNTimeBins;   //  number of time bins as given by the clusterizer
+  AliTRDclusterizer   *fClusterizer;  //! instance of TRD clusterizer
 
-  ClassDef(AliTRDReconstructor, 3)    //  Class for the TRD reconstruction
+  ClassDef(AliTRDReconstructor, 4)    //  Class for the TRD reconstruction
 
 };
 
 
 
 #endif
+
index 91301c8..fd2fb08 100644 (file)
@@ -611,10 +611,8 @@ Bool_t AliTRDclusterizer::MakeClusters()
     //  ResetRecPoints();
     //}
         
-    // No compress just remove
-    fDigitsManager->RemoveDigits(i);
-    fDigitsManager->RemoveDictionaries(i);      
-    fDigitsManager->ClearIndexes(i);  
+    // Clear arrays of this chamber, to prepare for next event
+    fDigitsManager->ClearArrays(i);
   }
   
   if(fReconstructor->IsWritingClusters()) WriteClusters(-1);