This patch solves the problem encountered when posting tasks to the folder. What...
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Jul 2002 10:40:57 +0000 (10:40 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Jul 2002 10:40:57 +0000 (10:40 +0000)
So everything is now back to normal

EMCAL/AliEMCALClusterizerv1.cxx
EMCAL/AliEMCALClusterizerv1.h

index 1c591ab34ef2dcba9d5e8a39e7787f8d5a930b08..883445e2deffb8fb50b2fa18be5277ec7827c8cf 100644 (file)
@@ -87,6 +87,7 @@ ClassImp(AliEMCALClusterizerv1)
   // default ctor (to be used mainly by Streamer)
   
   InitParameters() ; 
+  fDefaultInit = kTRUE ; 
 }
 
 //____________________________________________________________________________
@@ -96,27 +97,41 @@ AliEMCALClusterizerv1::AliEMCALClusterizerv1(const char* headerFile,const char*
   // ctor with the indication of the file where header Tree and digits Tree are stored
   
   InitParameters() ; 
+  fDefaultInit = kFALSE ; 
   Init() ;
 
 }
 //____________________________________________________________________________
   AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
 {
-  AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; 
-  
-  // remove the task from the folder list
-  gime->RemoveTask("C",GetName()) ;
-  
-  // remove the RecPoints from the folder list
-  TString name(GetName()) ; 
-  name.Remove(name.Index(":")) ; 
-  gime->RemoveObjects("D", name) ;  //  Digits
-  gime->RemoveObjects("RT", name) ; // TowerRecPoints
-  gime->RemoveObjects("RP", name) ; // PreShoRecPoints
-  
-  // Delete gAlice
-  gime->CloseFile() ; 
+  // dtor
+  // fDefaultInit = kTRUE if Clusterizer created by default ctor (to get just the parameters)
   
+  if (!fDefaultInit) {
+    AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; 
+    
+    // remove the task from the folder list
+    gime->RemoveTask("C",GetName()) ;
+    
+    // remove the RecPoints from the folder list
+    TString name(GetName()) ; 
+    name.Remove(name.Index(":")) ; 
+    gime->RemoveObjects("D", name) ;  //  Digits
+    gime->RemoveObjects("RT", name) ; // TowerRecPoints
+    gime->RemoveObjects("RP", name) ; // PreShoRecPoints
+    
+    // Delete gAlice
+    gime->CloseFile() ; 
+    
+  }
+}
+
+//____________________________________________________________________________
+const TString AliEMCALClusterizerv1::BranchName() const 
+{  
+  TString branchName(GetName() ) ;
+  branchName.Remove(branchName.Index(Version())-1) ;
+  return branchName ;
 }
 
 //____________________________________________________________________________
@@ -456,13 +471,10 @@ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event)
   // Creates new branches with given title
   // fills and writes into TreeR.
 
-  TString branchName(GetName() ) ;
-  branchName.Remove(branchName.Index(Version())-1) ;
-
   AliEMCALGetter *gime = AliEMCALGetter::GetInstance() ; 
-  TObjArray * towerRecPoints = gime->TowerRecPoints(branchName) ; 
-  TObjArray * preshoRecPoints = gime->PreShowerRecPoints(branchName) ; 
-  TClonesArray * digits = gime->Digits(branchName) ; 
+  TObjArray * towerRecPoints = gime->TowerRecPoints(BranchName()) ; 
+  TObjArray * preshoRecPoints = gime->PreShowerRecPoints(BranchName()) ; 
+  TClonesArray * digits = gime->Digits(BranchName()) ; 
   TTree * treeR ; 
 
   if (!gAlice->TreeR() ) 
@@ -481,7 +493,7 @@ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event)
 
   towerRecPoints->Expand(towerRecPoints->GetEntriesFast()) ; 
 
-  //Now the same for CPV
+  //Now the same for pre shower
   for(index = 0; index < preshoRecPoints->GetEntries(); index++)
     (dynamic_cast<AliEMCALRecPoint *>(preshoRecPoints->At(index)))->EvalAll(fW0CPV,digits)  ;
 
@@ -494,28 +506,25 @@ void AliEMCALClusterizerv1::WriteRecPoints(Int_t event)
   
   //Make branches in TreeR for RecPoints and Clusterizer
   
-  //Make new branches
-  TDirectory *cwd = gDirectory;
-  
  
   Int_t bufferSize = 32000 ;    
   Int_t splitlevel = 0 ;
 
-  //First EMC
+  //First Tower branch
   TBranch * emcBranch = treeR->Branch("EMCALTowerRP","TObjArray",&towerRecPoints,bufferSize,splitlevel);
-  emcBranch->SetTitle(branchName);
+  emcBranch->SetTitle(BranchName());
 
     
-  //Now CPV branch
+  //Now Pre Shower branch 
   TBranch * cpvBranch = treeR->Branch("EMCALPreShoRP","TObjArray",&preshoRecPoints,bufferSize,splitlevel);
-  cpvBranch->SetTitle(branchName);
+  cpvBranch->SetTitle(BranchName());
 
     
   //And Finally  clusterizer branch
-  AliEMCALClusterizerv1 * cl = (AliEMCALClusterizerv1*)gime->Clusterizer(branchName) ;
+  AliEMCALClusterizerv1 * cl = (AliEMCALClusterizerv1*)gime->Clusterizer(BranchName()) ;
   TBranch * clusterizerBranch = treeR->Branch("AliEMCALClusterizer","AliEMCALClusterizerv1",
                                              &cl,bufferSize,splitlevel);
-  clusterizerBranch->SetTitle(branchName);
+  clusterizerBranch->SetTitle(BranchName());
 
   emcBranch        ->Fill() ;
   cpvBranch        ->Fill() ;
index e549dd169e3f7d19412a991578ac8aaf02688d8a..8fa76004bd96f1f16b52d756bcebfa388601a2ef 100644 (file)
@@ -38,6 +38,7 @@ public:
   virtual Int_t   AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const ; 
                                // Checks if digits are in neighbour cells 
 
+  const TString BranchName() const ; 
   virtual Float_t Calibrate(Int_t amp, Bool_t inpresho)const ;  // Tranforms Amp to energy 
 
   virtual void    GetNumberOfClustersFound(int * numb )const{  numb[0] = fNumberOfTowerClusters ; 
@@ -98,6 +99,7 @@ private:
 
 private:
 
+  Bool_t  fDefaultInit;              //! Says if the task was created by defaut ctor (only parameters are initialized)
   TString fHeaderFileName ;          // name of the file which contains gAlice, Tree headers etc.
   TString fDigitsBranchTitle ;       // name of the file, where digits branch is stored
   TString fRecPointsBranchTitle ;    // name of the file, where RecPoints branchs are stored