]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
update of Jenn and Marco
authorpavlinov <pavlinov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Feb 2006 15:11:06 +0000 (15:11 +0000)
committerpavlinov <pavlinov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 15 Feb 2006 15:11:06 +0000 (15:11 +0000)
25 files changed:
EMCAL/AliEMCAL.cxx
EMCAL/AliEMCAL.h
EMCAL/AliEMCALClusterizer.cxx
EMCAL/AliEMCALClusterizer.h
EMCAL/AliEMCALClusterizerv1.cxx
EMCAL/AliEMCALDigit.cxx
EMCAL/AliEMCALDigitizer.cxx
EMCAL/AliEMCALJetFinder.cxx
EMCAL/AliEMCALJetFinderAlgoOmni.cxx
EMCAL/AliEMCALJetFinderInputPrep.cxx
EMCAL/AliEMCALJetFinderInputSimPrep.cxx
EMCAL/AliEMCALJetFinderInputSimPrep.h
EMCAL/AliEMCALLoader.cxx
EMCAL/AliEMCALLoader.h
EMCAL/AliEMCALRecPoint.cxx
EMCAL/AliEMCALRecPoint.h
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALReconstructor.h
EMCAL/AliEMCALSDigitizer.cxx
EMCAL/AliEMCALSDigitizer.h
EMCAL/AliEMCALv2.cxx
EMCAL/EMCALLinkDefbase.h
EMCAL/EMCALLinkDefrec.h
EMCAL/libEMCALbase.pkg
EMCAL/libEMCALrec.pkg

index 806b83fcc84a7e1006791f6f85308b581f5507a7..c9b18cdd7a8a678e938b31f1a353e26cb915463f 100644 (file)
@@ -39,10 +39,11 @@ class TFile;
 // --- AliRoot header files ---
 #include "AliMagF.h"
 #include "AliEMCAL.h"
-#include "AliEMCALGetter.h"
 #include "AliRun.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCALSDigitizer.h"
 #include "AliEMCALDigitizer.h"
+#include "AliEMCALDigit.h"
 #include "AliAltroBuffer.h"
 
 ClassImp(AliEMCAL)
@@ -77,7 +78,7 @@ AliEMCAL::~AliEMCAL()
 }
 
 //____________________________________________________________________________
-void AliEMCAL::Copy(AliEMCAL & emcal)
+void AliEMCAL::Copy(AliEMCAL & emcal) const
 {
   TObject::Copy(emcal) ; 
   emcal.fHighCharge        = fHighCharge ;
@@ -329,6 +330,7 @@ void AliEMCAL::Hits2SDigits()
 }
 
 //____________________________________________________________________________
+
 AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
 {
 //different behaviour than standard (singleton getter)
@@ -403,27 +405,3 @@ const Double_t dtime, const Double_t damp, Int_t * adcH, Int_t * adcL) const
   }
   return lowGain ; 
 }
-
-//____________________________________________________________________________
-void AliEMCAL::SetTreeAddress()
-{ 
-  // Linking Hits in Tree to Hits array
-  TBranch *branch;
-  //  char branchname[20];
-  //  sprintf(branchname,"%s",GetName());
-  // Branch address for hit tree
-  TTree *treeH = TreeH();
-  if (treeH) {
-    //    treeH->Print();
-    branch = treeH->GetBranch(GetName());
-    if (branch) { 
-       if (fHits == 0x0) 
-       fHits= new TClonesArray("AliEMCALHit",1000);
-       branch->SetAddress(&fHits);
-    } else {
-      Warning("SetTreeAddress","<%s> Failed",GetName());
-    }
-  } else {
-    //    Warning("SetTreeAddress"," no treeH ");
-  }
-}
index 82e937732d63ce36c69e33ae9ff8df5031d0c299..345a90ffdb1aff9d9807c3a27819866d4f992132 100644 (file)
@@ -33,10 +33,12 @@ class AliEMCAL : public AliDetector {
     Fatal("cpy ctor", "not implemented") ;  
   }
   virtual ~AliEMCAL() ; 
-  virtual void   AddHit(Int_t, Int_t*, Float_t *) const{
+  virtual void   AddHit(Int_t, Int_t*, Float_t *) {
     Fatal("AddHit(Int_t, Int_t*, Float_t *", "not to be used: use AddHit( Int_t shunt, Int_t primary, Int_t track,Int_t id, Float_t *hits )") ;  
   }
-  virtual void  Copy(AliEMCAL & emcal) ; 
+  virtual void  Copy(TObject & emcal) const 
+    { Copy(dynamic_cast<AliEMCAL&>(emcal)); }
+  virtual void  Copy(AliEMCAL & emcal) const; 
   virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
   virtual void  CreateMaterials() ;   
   //  virtual void  
@@ -62,18 +64,15 @@ class AliEMCAL : public AliDetector {
   static Double_t RawResponseFunctionMax(Double_t charge, Double_t gain) ;
   //  
   virtual AliLoader* MakeLoader(const char* topfoldername);
-  virtual void SetTreeAddress() ;              
   virtual const TString Version() const {return TString(" ") ; }   
   AliEMCAL & operator = (const AliEMCAL & /*rvalue*/)  {
     Fatal("operator =", "not implemented") ;  return *this ; }
 
 protected:
   
-  friend class AliEMCALGetter;
   static Double_t RawResponseFunction(Double_t *x, Double_t *par) ; 
   Bool_t   RawSampledResponse(const Double_t dtime, const Double_t damp, Int_t * adcH, Int_t * adcL) const ; 
 
-
   Int_t fBirkC0;    // constants for Birk's Law implementation
   Double_t fBirkC1; // constants for Birk's Law implementation
   Double_t fBirkC2; // constants for Birk's Law implementation
index 127e476faa7159f47d468365d75771d2653836e2..09beb9077a1764d9318a525c55e5af3a7f69df05 100644 (file)
@@ -31,7 +31,7 @@
 
 // --- AliRoot header files ---
 #include "AliEMCALClusterizer.h"
-#include "AliEMCALGetter.h"
+#include "AliRunLoader.h"
 
 ClassImp(AliEMCALClusterizer)
 
@@ -60,6 +60,6 @@ AliEMCALClusterizer::~AliEMCALClusterizer()
 {
   // dtor
  //Remove this from the parental task before destroying
-  AliEMCALGetter::Instance()->EmcalLoader()->CleanReconstructioner();
+  AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")->CleanReconstructioner();
 }
 
index 1eafc6f119efad003dc87d499d1de99f03731491..8a0ff8307efc8b41c4d03b654124aa30f32743b5 100644 (file)
@@ -36,8 +36,7 @@ public:
   virtual Int_t GetRecPointsInRun()  const {Warning("GetRecPointsInRun", "Not Defined") ; return 0 ; }
   virtual const char *  GetDigitsBranch() const  {Warning("GetDigitsBranch", "Not Defined") ; return 0 ; }
 
-  virtual void MakeClusters() const {Warning("MakeClusters", "Not Defined") ; }
-  virtual void Print(Option_t * /*option*/)const {Warning("Print", "Not Defined") ; }
+  virtual void MakeClusters() = 0;
 
   virtual void SetECAClusteringThreshold(Float_t) = 0;
   virtual void SetECALocalMaxCut(Float_t)         = 0;
index 0085172be7352765c07c0260a7f03190c94ec446..536a066d00364fdade53c6448b12e5561685a99c 100644 (file)
@@ -60,7 +60,9 @@
 
 
 // --- AliRoot header files ---
-#include "AliEMCALGetter.h"
+#include "AliRunLoader.h"
+#include "AliRun.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCALClusterizerv1.h"
 #include "AliEMCALRecPoint.h"
 #include "AliEMCALDigit.h"
@@ -148,15 +150,18 @@ void AliEMCALClusterizerv1::Exec(Option_t * option)
   if(strstr(option,"print"))
     Print("") ; 
 
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+  //AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
 
   if (fLastEvent == -1) 
-    fLastEvent = gime->MaxEvent() - 1;
+    fLastEvent = rl->GetNumberOfEvents() - 1;
   Int_t nEvents   = fLastEvent - fFirstEvent + 1;
 
   Int_t ievent ;
+  rl->LoadDigits("EMCAL");
   for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
-    gime->Event(ievent,"D") ;
+    rl->GetEvent(ievent);
     GetCalibrationParameters() ;
 
     fNumberOfECAClusters = 0;
@@ -172,7 +177,7 @@ void AliEMCALClusterizerv1::Exec(Option_t * option)
       PrintRecPoints(option) ;
 
     //increment the total number of recpoints per run   
-    fRecPointsInRun += gime->ECARecPoints()->GetEntriesFast() ;  
+    fRecPointsInRun += emcalLoader->RecPoints()->GetEntriesFast() ;  
   }
   
   Unload();
@@ -195,9 +200,13 @@ Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit **
   // The initial values for fitting procedure are set equal to the positions of local maxima.
   // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  TClonesArray *digits = emcalLoader->Digits();
+  /*
   AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
   TClonesArray * digits = gime->Digits() ; 
-  
+  */
+
   gMinuit->mncler();                     // Reset Minuit's list of paramters
   gMinuit->SetPrintLevel(-1) ;           // No Printout
   gMinuit->SetFCN(AliEMCALClusterizerv1::UnfoldingChiSquare) ;  
@@ -217,7 +226,7 @@ Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit **
 
   Int_t iDigit ;
 
-  AliEMCALGeometry * geom = gime->EMCALGeometry() ; 
+  AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance(); //gime->EMCALGeometry() ; 
 
   for(iDigit = 0; iDigit < nDigits; iDigit++){
     digit = maxAt[iDigit]; 
@@ -282,11 +291,12 @@ Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit **
 void AliEMCALClusterizerv1::GetCalibrationParameters() 
 {
   // Gets the parameters for the calibration from the digitizer
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+  //AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
 
-  if ( !gime->Digitizer() ) 
-    gime->LoadDigitizer();
-  AliEMCALDigitizer * dig = gime->Digitizer();  
+  if ( !emcalLoader->Digitizer() ) 
+    emcalLoader->LoadDigitizer();
+  AliEMCALDigitizer * dig = dynamic_cast<AliEMCALDigitizer*>(emcalLoader->Digitizer());
 
   fADCchannelECA   = dig->GetECAchannel() ;
   fADCpedestalECA  = dig->GetECApedestal();
@@ -299,12 +309,10 @@ void AliEMCALClusterizerv1::Init()
   // Make all memory allocations which can not be done in default constructor.
   // Attach the Clusterizer task to the list of EMCAL tasks
   
-  AliEMCALGetter * gime = AliEMCALGetter::Instance();
-  if(!gime)
-    gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data());
-
-  AliEMCALGeometry * geom = gime->EMCALGeometry() ;
-//PH   cout<<"gime,geom "<<gime<<" "<<geom<<endl;
+  //AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance() ;
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliEMCALGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+  AliInfo(Form("geom 0x%x",geom));
 
 //Sub  fNTowers = geom->GetNZ() *  geom->GetNPhi() ;
   fNTowers =400;
@@ -313,7 +321,6 @@ void AliEMCALClusterizerv1::Init()
  //Sub if ( !gime->Clusterizer() ) 
  //Sub   gime->PostClusterizer(this); 
  BookHists();
-//PH   cout<<"hists booked "<<endl;
 }
 
 //____________________________________________________________________________
@@ -342,7 +349,8 @@ Int_t AliEMCALClusterizerv1::AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d
   // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster 
   //                                      which is compared to a digit (d2)  not yet in a cluster  
 
-   AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ;
+  //AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ;
+   AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance() ;
 
   Int_t rv = 0 ; 
 
@@ -398,9 +406,10 @@ if(rv==1)printf("AreNeighbours: neighbours=%d, id1=%d, relid1=%d,%d \n id2=%d, r
 void AliEMCALClusterizerv1::Unload() 
 {
   // Unloads the Digits and RecPoints
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
-  gime->EmcalLoader()->UnloadDigits() ; 
-  gime->EmcalLoader()->UnloadRecPoints() ; 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+    
+  emcalLoader->UnloadDigits() ; 
+  emcalLoader->UnloadRecPoints() ; 
 }
  
 //____________________________________________________________________________
@@ -410,13 +419,16 @@ void AliEMCALClusterizerv1::WriteRecPoints()
   // Creates new branches with given title
   // fills and writes into TreeR.
 
-  AliEMCALGetter *gime = AliEMCALGetter::Instance() ; 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
 
-  TObjArray * aECARecPoints = gime->ECARecPoints() ; 
+  TObjArray * aECARecPoints = emcalLoader->RecPoints() ; 
 
-  TClonesArray * digits = gime->Digits() ; 
-  TTree * treeR = gime->TreeR(); ; 
-  
+  TClonesArray * digits = emcalLoader->Digits() ; 
+  TTree * treeR = emcalLoader->TreeR();  
+  if ( treeR==0 ) {
+    emcalLoader->MakeRecPointsContainer();
+    treeR = emcalLoader->TreeR();  
+  }
   Int_t index ;
 
   //Evaluate position, dispersion and other RecPoint properties for EC section
@@ -428,19 +440,21 @@ void AliEMCALClusterizerv1::WriteRecPoints()
   for(index = 0; index < aECARecPoints->GetEntries(); index++)
     (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
 
-  aECARecPoints->Expand(aECARecPoints->GetEntriesFast()) ; 
-  
   Int_t bufferSize = 32000 ;    
   Int_t splitlevel = 0 ; 
 
   //EC section branch
-  TBranch * branchECA = treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
-  branchECA->SetTitle(BranchName());
-
-  branchECA->Fill() ;
+  
+  TBranch * branchECA = 0;
+  if ((branchECA = treeR->GetBranch("EMCALECARP")))
+    branchECA->SetAddress(&aECARecPoints);
+  else
+    treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
+  treeR->Fill() ;
 
-  gime->WriteRecPoints("OVERWRITE");
-  gime->WriteClusterizer("OVERWRITE");
+  emcalLoader->WriteRecPoints("OVERWRITE");
+  //emcalLoader->WriteClusterizer("OVERWRITE");
+  emcalLoader->WriteReconstructioner("OVERWRITE");
 }
 
 //____________________________________________________________________________
@@ -448,51 +462,39 @@ void AliEMCALClusterizerv1::MakeClusters()
 {
   // Steering method to construct the clusters stored in a list of Reconstructed Points
   // A cluster is defined as a list of neighbour digits
-    
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
 
-  AliEMCALGeometry * geom = gime->EMCALGeometry() ; 
+  cout << "Star of " << __PRETTY_FUNCTION__ << endl;
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
 
-  TObjArray * aECARecPoints  = gime->ECARecPoints() ; 
+  TObjArray * aECARecPoints = emcalLoader->RecPoints() ; 
+    
+  AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
+  if (geom==0) 
+     AliFatal("Did not get geometry from EMCALLoader");
 
-  aECARecPoints->Delete() ;
+  aECARecPoints->Clear();
 
-  TClonesArray * digits = gime->Digits() ; 
+  TClonesArray * digits = emcalLoader->Digits() ; 
   TClonesArray * digitsC =  dynamic_cast<TClonesArray*>(digits->Clone()) ;
 
   // Clusterization starts    
   TIter nextdigit(digitsC) ;
   AliEMCALDigit * digit;
 
-//just for hist
-/*
-  while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigit())) ) { // scan over the list of digitsC
-         digitAmp->Fill(digit->GetAmp());
-  }
-  */
-/////////// 
-
+  cout << "Outer Loop" << endl;
   while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigit())) ) { // scan over the list of digitsC
     AliEMCALRecPoint * clu = 0 ; 
     
     TArrayI clusterECAdigitslist(50000);   
-   
-//Sub    if (gDebug == 2) { 
-   //  printf("MakeClusters: id = %d, ene = %f , thre = %f \n", digit->GetId(),Calibrate(digit->GetAmp()),
-//         fECAClusteringThreshold) ;  
-//    }
+
 ////////////////////////temp solution, embedding///////////////////
    int nSupMod=0, nTower=0, nIphi=0, nIeta=0;
    int iphi=0, ieta=0;
-          geom->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
-          geom->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
-
-         /////////////////////////////////// 
-
-//cout<<ieta<<" "<<iphi<<endl;
-
-//    if ( geom->IsInECA(digit->GetId()) && (Calibrate(digit->GetAmp()) > fECAClusteringThreshold  ) ){
-    if (geom->CheckAbsCellId(digit->GetId()) && (Calibrate(digit->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) > fECAClusteringThreshold  ) ){
+   geom->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
+   geom->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
+   
+   //cout << "Some checking" << endl;
+   if (geom->CheckAbsCellId(digit->GetId()) && (Calibrate(digit->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) > fECAClusteringThreshold  ) ){
       //if(addOn[nSupMod-1][ieta-1][iphi-1]>0)cout<<"11 digit, add "<<ieta<<" "<<iphi<<" "<<addOn[nSupMod-1][ieta-1][iphi-1]<<" "<<digit->GetAmp()<<endl;
 //         cout<<"crossed the threshold "<<endl;
       Int_t iDigitInECACluster = 0;
@@ -500,6 +502,7 @@ void AliEMCALClusterizerv1::MakeClusters()
       if(fNumberOfECAClusters >= aECARecPoints->GetSize()) 
          aECARecPoints->Expand(2*fNumberOfECAClusters+1) ;
       AliEMCALRecPoint * rp = new  AliEMCALRecPoint("") ; 
+      //rp->SetGeom(geom);
       aECARecPoints->AddAt(rp, fNumberOfECAClusters) ;
       clu = dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(fNumberOfECAClusters)) ; 
       fNumberOfECAClusters++ ; 
@@ -508,8 +511,7 @@ void AliEMCALClusterizerv1::MakeClusters()
       iDigitInECACluster++ ; 
 //    cout<<" 1st setp:cluno, digNo "<<fNumberOfECAClusters<<" "<<iDigitInECACluster<<endl;
       digitsC->Remove(digit) ; 
-      if (gDebug == 2 ) 
-       printf("MakeClusters: OK id = %d, ene = %f , thre = %f \n", digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold) ;  
+      AliDebug(1,Form("MakeClusters: OK id = %d, ene = %f , thre = %f \n", digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold));  
       nextdigit.Reset() ;
       
       AliEMCALDigit * digitN ; 
@@ -517,17 +519,15 @@ void AliEMCALClusterizerv1::MakeClusters()
 
       // Find the neighbours
       while (index < iDigitInECACluster){ // scan over digits already in cluster 
-       digit =  (AliEMCALDigit*)digits->At(clusterECAdigitslist[index])  ;      
+       digit =  (AliEMCALDigit*)digits->At(clusterECAdigitslist[index]);
        index++ ; 
         while ( (digitN = (AliEMCALDigit *)nextdigit())) { // scan over the reduced list of digits 
-//     cout<<"we have new digit "<<endl;
+         // cout<<"we have new digit "<<endl;
           // check that the digit is above the min E Cut
-         ////////////////////
           geom->GetCellIndex(digitN->GetId(), nSupMod,nTower,nIphi,nIeta);
           geom->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
-         ////////////////
-          if(Calibrate(digitN->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) < fMinECut  )  digitsC->Remove(digitN);
-//     cout<<" new digit above ECut "<<endl;
+          if( Calibrate(digitN->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) < fMinECut  )  digitsC->Remove(digitN);
+         //cout<<" new digit above ECut "<<endl;
          Int_t ineb = AreNeighbours(digit, digitN);       // call (digit,digitN) in THAT oder !!!!! 
 //     cout<<" new digit neighbour?? "<<ineb<<endl;
          switch (ineb ) {
@@ -547,8 +547,7 @@ void AliEMCALClusterizerv1::MakeClusters()
          } // switch
     //cout<<"in nextDigit loop "<<fNumberOfECAClusters<<" "<<iDigitInECACluster<<endl;
        } // while digitN
-       
-//Sub      endofloop1: ;
+       //cout << "Done neighbout searching" << endl;
        nextdigit.Reset() ; 
       } // loop over ECA cluster
     } // energy threshold
@@ -559,7 +558,7 @@ void AliEMCALClusterizerv1::MakeClusters()
     //cout<<"after endofloop: cluno, digNo "<<fNumberOfECAClusters<<endl;
   } // while digit  
   delete digitsC ;
-cout<<"total no of clusters "<<fNumberOfECAClusters<<" from "<<digits->GetEntriesFast()<<" digits"<<endl
+  AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,digits->GetEntriesFast()))
 }
 
 //____________________________________________________________________________
@@ -643,11 +642,12 @@ void AliEMCALClusterizerv1::Print(Option_t * /*option*/)const
 void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
 {
   // Prints list of RecPoints produced at the current pass of AliEMCALClusterizer
-
-  TObjArray * aECARecPoints = AliEMCALGetter::Instance()->ECARecPoints() ; 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  TObjArray * aECARecPoints = emcalLoader->RecPoints() ; 
+    
   printf("PrintRecPoints: Clusterization result:") ; 
   
-  printf("event # %d\n", gAlice->GetEvNumber() ) ;
+  printf("event # %d\n", emcalLoader->GetRunLoader()->GetEventNumber() ) ;
   printf("           Found %d ECA Rec Points\n ", 
         aECARecPoints->GetEntriesFast()) ; 
 
index 602eab8410cd5ca20452538248d5611e9d079d25..d53a3b20a97226952bc6842bf7f5a9ed3ca0acd4 100644 (file)
@@ -36,8 +36,6 @@
 
 #include "AliEMCALDigit.h"
 #include "AliEMCALGeometry.h"
-#include "AliEMCALGetter.h"
-
 
 ClassImp(AliEMCALDigit)
 
@@ -156,7 +154,8 @@ Float_t AliEMCALDigit::GetEta() const
 { // should be change in EMCALGeometry - 19-nov-04
   Float_t eta=-10., phi=-10.;
   Int_t id = GetId();
-  const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry();
+  //const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry();
+  const AliEMCALGeometry *g = AliEMCALGeometry::GetInstance();
   g->EtaPhiFromIndex(id,eta,phi);
   return eta ;
 }
@@ -166,7 +165,8 @@ Float_t AliEMCALDigit::GetPhi() const
 { // should be change in EMCALGeometry - 19-nov-04
   Float_t eta=-10., phi=-10.;
   Int_t id = GetId();
-  const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry();
+  //const AliEMCALGeometry *g = AliEMCALGetter::Instance()->EMCALGeometry();
+  const AliEMCALGeometry *g = AliEMCALGeometry::GetInstance();
   g->EtaPhiFromIndex(id,eta,phi);
   return phi ;
 }
index 73d87dc72f7d19ee22578b734b1218a1638463ce..7bfc71b69b4e351fdaf8a3957a444e75f86aa1a8 100644 (file)
 
 // --- AliRoot header files ---
 #include "AliRunDigitizer.h"
+#include "AliRunLoader.h"
 #include "AliEMCALDigit.h"
 #include "AliEMCAL.h"
-#include "AliEMCALGetter.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCALDigitizer.h"
 #include "AliEMCALSDigitizer.h"
 #include "AliEMCALGeometry.h"
@@ -145,14 +146,15 @@ AliEMCALDigitizer::AliEMCALDigitizer(AliRunDigitizer * rd):
 //____________________________________________________________________________ 
   AliEMCALDigitizer::~AliEMCALDigitizer()
 {
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
-   
-  // Clean Digitizer from the white board
-  gime->EmcalLoader()->CleanDigitizer() ;
-
+  if (AliRunLoader::GetRunLoader()) {
+    AliLoader *emcalLoader=0;
+    if ((emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")))
+      emcalLoader->CleanDigitizer();
+  }
+  else
+    AliDebug(1," no runloader present");
   delete [] fInputFileNames ; 
   delete [] fEventNames ; 
-
 }
 
 //____________________________________________________________________________
@@ -168,18 +170,20 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   static int isTrd1Geom = -1; // -1 - mean undefined 
   static int nEMC=0; //max number of digits possible
 
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ; 
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
   Int_t ReadEvent = event ; 
   // fManager is data member from AliDigitizer
   if (fManager) 
     ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetCurrentEventNumber() ; 
   AliDebug(1,Form("Adding event %d from input stream 0 %s %s", 
                  ReadEvent, GetTitle(), fEventFolderName.Data())) ; 
-  gime->Event(ReadEvent, "S") ;
-  TClonesArray * digits = gime->Digits() ; 
+  rl->GetEvent(ReadEvent);
+
+  TClonesArray * digits = emcalLoader->Digits() ; 
   digits->Clear() ;
 
-  const AliEMCALGeometry *geom = gime->EMCALGeometry() ;
+  const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
   if(isTrd1Geom < 0) { 
     TString ng(geom->GetName());
     isTrd1Geom = 0;
@@ -187,35 +191,37 @@ void AliEMCALDigitizer::Digitize(Int_t event)
 
     if(isTrd1Geom == 0) nEMC = geom->GetNPhi()*geom->GetNZ();
     else                nEMC = geom->GetNCells();
-    printf(" nEMC %i (number cells in EMCAL) | %s | isTrd1Geom %i\n", nEMC, geom->GetName(), isTrd1Geom);
+    AliDebug(1,Form("nEMC %i (number cells in EMCAL) | %s | isTrd1Geom %i\n", nEMC, geom->GetName(), isTrd1Geom));
   }
   Int_t absID ;
 
   digits->Expand(nEMC) ;
 
   // get first the sdigitizer from the tasks list (must have same name as the digitizer)
-  if ( !gime->SDigitizer() ) 
-    gime->LoadSDigitizer();
-  AliEMCALSDigitizer * sDigitizer = gime->SDigitizer(); 
+  if ( !emcalLoader->SDigitizer() ) 
+    emcalLoader->LoadSDigitizer();
+  AliEMCALSDigitizer * sDigitizer = dynamic_cast<AliEMCALSDigitizer*>(emcalLoader->SDigitizer()); 
   
   if ( !sDigitizer )
     Fatal("Digitize", "SDigitizer with name %s %s not found", fEventFolderName.Data(), GetTitle() ) ; 
 
   //take all the inputs to add together and load the SDigits
   TObjArray * sdigArray = new TObjArray(fInput) ;
-  sdigArray->AddAt(gime->SDigits(), 0) ;
+  sdigArray->AddAt(emcalLoader->SDigits(), 0) ;
   Int_t i ;
+
   for(i = 1 ; i < fInput ; i++){
     TString tempo(fEventNames[i]) ; 
     tempo += i ;
-    AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[i], tempo) ; 
+    rl = AliRunLoader::Open(fInputFileNames[i], tempo) ; 
     if (fManager) 
       ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(i))->GetCurrentEventNumber() ; 
     Info("Digitize", "Adding event %d from input stream %d %s %s", ReadEvent, i, fInputFileNames[i].Data(), tempo.Data()) ; 
-    gime->Event(ReadEvent,"S");
-    sdigArray->AddAt(gime->SDigits(), i) ;
+    rl->LoadSDigits();
+    rl->GetEvent(ReadEvent);
+    sdigArray->AddAt(emcalLoader->SDigits(), i) ;
   }
+  
   //Find the first tower with signal
   Int_t nextSig = nEMC + 1 ; 
   TClonesArray * sdigits ;  
@@ -239,7 +245,7 @@ void AliEMCALDigitizer::Digitize(Int_t event)
 
   TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
 
-  //Put Noise contributiony
+  //Put Noise contribution
   for(absID = 1; absID <= nEMC; absID++){
     Float_t amp = 0 ;
     // amplitude set to zero, noise will be added later
@@ -382,22 +388,25 @@ void AliEMCALDigitizer::Exec(Option_t *option)
   
   if(strstr(option,"tim"))
     gBenchmark->Start("EMCALDigitizer");
-  
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
-   
+
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
+
   // Post Digitizer to the white board
-  gime->PostDigitizer(this) ;
+  emcalLoader->PostDigitizer(this) ;
   
   if (fLastEvent == -1) 
-    fLastEvent = gime->MaxEvent() - 1 ;
+    fLastEvent = rl->GetNumberOfEvents() - 1 ;
   else if (fManager) 
     fLastEvent = fFirstEvent ; // what is this ??
 
   Int_t nEvents   = fLastEvent - fFirstEvent + 1;
   Int_t ievent;
 
+  rl->LoadSDigits("EMCAL");
   for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
-    gime->Event(ievent,"S") ; 
+    //gime->Event(ievent,"S") ; 
+    rl->GetEvent(ievent);
 
     Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
 
@@ -408,11 +417,11 @@ void AliEMCALDigitizer::Exec(Option_t *option)
     if(strstr(option,"table")) gObjectTable->Print();
 
     //increment the total number of Digits per run 
-    fDigitsInRun += gime->Digits()->GetEntriesFast() ;  
+    fDigitsInRun += emcalLoader->Digits()->GetEntriesFast() ;  
   }
   //  gime->WriteDigitizer("OVERWRITE");
 
-  gime->EmcalLoader()->CleanDigitizer() ;
+  emcalLoader->CleanDigitizer() ;
 
   if(strstr(option,"tim")){
     gBenchmark->Stop("EMCALDigitizer");
@@ -448,16 +457,12 @@ Bool_t AliEMCALDigitizer::Init()
 {
   // Makes all memory allocations
   fInit = kTRUE ; 
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ;  
-  if ( gime == 0 ) {
-    Error("Init", "Could not obtain the Getter object for file %s and event %s !", GetTitle(), fEventFolderName.Data()) ;   
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+
+  if ( emcalLoader == 0 ) {
+    Fatal("Init", "Could not obtain the AliEMCALLoader");  
     return kFALSE;
   } 
-  TString opt("Digits") ; 
-  if(gime->VersionExists(opt) ) { 
-    Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ;
-    fInit = kFALSE ; 
-  }
 
   fFirstEvent = 0 ; 
   fLastEvent = fFirstEvent ; 
@@ -479,7 +484,7 @@ Bool_t AliEMCALDigitizer::Init()
   }
   
   //to prevent cleaning of this object while GetEvent is called
-  gime->EmcalLoader()->GetDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
+  emcalLoader->GetDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
   
   return fInit ;    
 }
@@ -534,8 +539,9 @@ void AliEMCALDigitizer::MixWith(TString alirunFileName, TString eventFolderName)
     return ; 
   }
   // looking for the file which contains SDigits
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
-  TString fileName( gime->GetSDigitsFileName() ) ; 
+  //AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  TString fileName( emcalLoader->GetSDigitsFileName() ) ; 
     if ( eventFolderName != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name 
       fileName = fileName.ReplaceAll(".root", "") + "_" + eventFolderName + ".root" ;
     if ( (gSystem->AccessPathName(fileName)) ) { 
@@ -579,17 +585,24 @@ void AliEMCALDigitizer::Print(Option_t*)const
       nStreams = fInput ; 
     
     Int_t index = 0 ;  
+
+    AliRunLoader *rl=0;
+
     for (index = 0 ; index < nStreams ; index++) {  
       TString tempo(fEventNames[index]) ; 
       tempo += index ;
-      AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[index], tempo) ; 
-      TString fileName( gime->GetSDigitsFileName() ) ; 
+      if ((rl = AliRunLoader::GetRunLoader(tempo)) == 0)
+       rl = AliRunLoader::Open(fInputFileNames[index], tempo) ; 
+      AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
+      TString fileName( emcalLoader->GetSDigitsFileName() ) ; 
       if ( fEventNames[index] != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name 
        fileName = fileName.ReplaceAll(".root", "") + "_" + fEventNames[index]  + ".root" ;
       printf ("Adding SDigits from %s %s\n", fInputFileNames[index].Data(), fileName.Data()) ; 
     }
-    AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; 
-    printf("\nWriting digits to %s", gime->GetDigitsFileName().Data()) ;
+
+    AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+
+    printf("\nWriting digits to %s", emcalLoader->GetDigitsFileName().Data()) ;
     
     printf("\nWith following parameters:\n") ;
     
@@ -603,13 +616,12 @@ void AliEMCALDigitizer::Print(Option_t*)const
 
 //__________________________________________________________________
 void AliEMCALDigitizer::PrintDigits(Option_t * option){
-    
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; 
-  TClonesArray * digits  = gime->Digits() ;
-  TClonesArray * sdigits = gime->SDigits() ;
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  TClonesArray * digits  = emcalLoader->Digits() ;
+  TClonesArray * sdigits = emcalLoader->SDigits() ;
   
   printf("\n #Digits: %d : sdigits %d ", digits->GetEntriesFast(), sdigits->GetEntriesFast()) ; 
-  printf("\n event %d", gAlice->GetEvNumber()) ;
+  printf("\n event %d", emcalLoader->GetRunLoader()->GetEventNumber());
   
   if(strstr(option,"all")){  
     //loop over digits
@@ -642,16 +654,17 @@ Float_t AliEMCALDigitizer::TimeOfNoise(void)
 void AliEMCALDigitizer::Unload() 
 {  
   // Unloads the SDigits and Digits
+  AliRunLoader *rl=0;
+    
   Int_t i ; 
   for(i = 1 ; i < fInput ; i++){
     TString tempo(fEventNames[i]) ; 
-    tempo += i ;
-    AliEMCALGetter * gime = AliEMCALGetter::Instance(fInputFileNames[i], tempo) ; 
-    gime->EmcalLoader()->UnloadSDigits() ; 
+    tempo += i;
+    if ((rl = AliRunLoader::GetRunLoader(tempo))) 
+      rl->GetDetectorLoader("EMCAL")->UnloadSDigits() ; 
   }
-  
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName) ; 
-  gime->EmcalLoader()->UnloadDigits() ; 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  emcalLoader->UnloadDigits() ; 
 }
 
 //_________________________________________________________________________________________
@@ -666,19 +679,27 @@ void AliEMCALDigitizer::WriteDigits()
   //      and branch "AliEMCALDigitizer", with the same title to keep all the parameters
   //      and names of files, from which digits are made.
 
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ; 
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
 
-  const TClonesArray * digits = gime->Digits() ; 
-  TTree * treeD = gime->TreeD(); 
+  const TClonesArray * digits = emcalLoader->Digits() ; 
+  TTree * treeD = emcalLoader->TreeD(); 
+  if ( !treeD ) {
+    emcalLoader->MakeDigitsContainer();
+    treeD = emcalLoader->TreeD(); 
+  }
 
   // -- create Digits branch
   Int_t bufferSize = 32000 ;    
-  TBranch * digitsBranch = treeD->Branch("EMCAL","TClonesArray",&digits,bufferSize);
-  digitsBranch->SetTitle(fEventFolderName);
-  digitsBranch->Fill() ;
+  TBranch * digitsBranch = 0;
+  if ((digitsBranch = treeD->GetBranch("EMCAL")))
+    digitsBranch->SetAddress(&digits);
+  else
+    treeD->Branch("EMCAL","TClonesArray",&digits,bufferSize);
+  //digitsBranch->SetTitle(fEventFolderName);
+  treeD->Fill() ;
   
-  gime->WriteDigits("OVERWRITE");
-  gime->WriteDigitizer("OVERWRITE");
+  emcalLoader->WriteDigits("OVERWRITE");
+  emcalLoader->WriteDigitizer("OVERWRITE");
 
   Unload() ; 
 
@@ -694,18 +715,18 @@ TList *AliEMCALDigitizer::BookControlHists(int var)
 { // 22-nov-04
   Info("BookControlHists"," started ");
   gROOT->cd();
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName);
-  const AliEMCALGeometry *geom = gime->EMCALGeometry() ;
+  const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
   if(var>=1){
     new TH1F("hDigiN",  "#EMCAL digits with fAmp > fDigitThreshold", 
     fNADCEC+1, -0.5, Double_t(fNADCEC));
-    new TH1F("HDigiSumEnergy","Sum.EMCAL energy from digi", 10000, 0.0, 200.);
+    new TH1F("HDigiSumEnergy","Sum.EMCAL energy from digi", 1000, 0.0, 200.);
     new TH1F("hDigiAmp",  "EMCAL digital amplitude", fNADCEC+1, -0.5, Double_t(fNADCEC));
     new TH1F("hDigiEnergy","EMCAL cell energy", 2000, 0.0, 200.);
     new TH1F("hDigiAbsId","EMCAL absId cells with fAmp > fDigitThreshold ",
     geom->GetNCells(), 0.5, Double_t(geom->GetNCells())+0.5);
   }
   fHists = sv::MoveHistsToList("EmcalDigiControlHists", kFALSE);
+  fHists = 0;
   return fHists;
 }
 
index a4c066105a2f5018dc30fc1af078c04c43e499f0..0ea8700035417189e41e79ca9e544767d705bbda 100644 (file)
 #include <TBrowser.h>
 
 // From AliRoot ...
+#include "AliEMCALJetFinder.h"
+#include "AliHeader.h"
+#include "AliMagF.h"
+#include "AliMagFCM.h"
+#include "AliRun.h"
+#include "AliGenerator.h"
+#include "AliRunLoader.h"
 #include "AliEMCAL.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCALDigit.h"
 #include "AliEMCALDigitizer.h"
 #include "AliEMCALFast.h"
 #include "AliEMCALGeometry.h"
 #include "AliEMCALHadronCorrection.h"
 #include "AliEMCALHit.h"
-#include "AliEMCALJetFinder.h"
 #include "AliEMCALJetMicroDst.h"
-#include "AliHeader.h"
-#include "AliMagF.h"
-#include "AliMagFCM.h"
-#include "AliRun.h"
-#include "AliGenerator.h"
-#include "AliEMCALGetter.h"
+
 // Interface to FORTRAN
 #include "Ecommon.h"
 #include "AliMC.h"
@@ -228,24 +230,9 @@ void AliEMCALJetFinder::Init()
 //  Get geometry parameters from EMCAL
 //
 //
-  AliEMCALGeometry *geom=0;
-  AliEMCALGetter   *gime = AliEMCALGetter::Instance(); 
-  if(gime) {
-    geom = gime->EMCALGeometry() ;  
-    if(!geom) {
-      printf(" No AliEMCALGeometry !! \n");
-      assert(0);
-    }
-  } else {  
-    printf(" No AliEMCALGetter !! \n");
-    geom = AliEMCALGeometry::GetInstance();
-    if(!geom) {
-      printf(" No AliEMCALGeometry !! \n");
-      assert(0);
-    } else {
-      printf(" AliEMCALGeometry : %s\n", geom->GetName());
-    }
-  }
+//  Geometry 
+  //AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
+  AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
 
 //    SetSamplingFraction(geom->GetSampling());
 
@@ -542,21 +529,23 @@ void AliEMCALJetFinder::WriteJets()
     }
 
 // I/O
-    AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
+    AliRunLoader *rl = AliRunLoader::GetRunLoader();
+    AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
+
     if (!fOutFileName) {
 //
 // output written to input file
 //
       AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL");
-      TTree* pK = gAlice->TreeK();
+      TTree* pK = rl->TreeK();
       file = (pK->GetCurrentFile())->GetName();
       TBranch * jetBranch ;  
        if (fDebug > 1)
            printf("Make Branch - TreeR address %p %p\n",(void*)gAlice->TreeR(), (void*)pEMCAL);
        //if (fJets && gAlice->TreeR()) {
-       if (fJets && gime->TreeR()) {
+       if (fJets && emcalLoader->TreeR()) {
          // pEMCAL->MakeBranchInTree(gAlice->TreeR(), 
-          jetBranch = gime->TreeR()->Branch("EMCALJets", &fJets, kBufferSize, 0) ; 
+          jetBranch = emcalLoader->TreeR()->Branch("EMCALJets", &fJets, kBufferSize, 0) ; 
          //pEMCAL->MakeBranchInTree(gime->TreeR(), 
          //                         "EMCALJets", 
          //                         &fJets, 
@@ -570,14 +559,15 @@ void AliEMCALJetFinder::WriteJets()
          //sprintf(hname,"TreeR%d", nev);
          //gAlice->TreeR()->Write(hname);
          //gAlice->TreeR()->Reset();
-         gime->WriteRecPoints("OVERWRITE");
+         //gime->WriteRecPoints("OVERWRITE");
+         emcalLoader->WriteRecPoints("OVERWRITE");
        }
     } else {
 //
 // Output written to user specified output file
 //
       //TTree* pK = gAlice->TreeK();
-      TTree* pK = gAlice->TreeK();
+      TTree* pK = rl->TreeK();
       fInFile  = pK->GetCurrentFile();
 
       fOutFile->cd();
@@ -960,8 +950,8 @@ void AliEMCALJetFinder::FillFromHits(Int_t flag)
 //
 // Access hit information    
     AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
-    AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
-    TTree *treeH = gime->TreeH();
+    AliLoader *emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL");
+    TTree *treeH = emcalLoader->TreeH();
     Int_t ntracks = (Int_t) treeH->GetEntries();
 //
 //   Loop over tracks
@@ -1321,10 +1311,11 @@ void AliEMCALJetFinder::BuildTrackFlagTable() {
     for (Int_t i = 0; i < nKTrks; i++) {       //Initialize members to 0
        fTrackList[i] = 0;
     }
-    
-    AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
+
+    AliLoader *emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL");
+    //AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
     // TTree *treeH = gAlice->TreeH();
-    TTree *treeH = gime->TreeH();
+    TTree *treeH = emcalLoader->TreeH();
    Int_t ntracks = (Int_t) treeH->GetEntries();
 //
 //   Loop over tracks
index d48a1debf5a51922a3baecabb946de36b4ea9513..28f8b06eba054a4f99758c53bf85878d66b0608e 100644 (file)
@@ -20,6 +20,9 @@
 /*
  
 $Log$
+Revision 1.15  2004/11/22 19:52:05  mhorner
+Make sure pi0 get through
+
 Revision 1.14  2004/04/02 17:11:33  mhorner
 Marco's bug - fixes implemented
 
@@ -64,19 +67,20 @@ Changed hadron correction and added saving EMCAL and track contributions
 //*--Based on UA1 jet algorithm from LUND JETSET called from EMC-erj
 
 #include "TTask.h"
+#include "TMath.h"
+#include "TParticle.h"
+#include "AliRun.h"
+#include "AliRunLoader.h"
 #include "AliEMCALJetFinderInput.h"
 #include "AliEMCALJetFinderOutput.h"
 #include "AliEMCALJetFinderAlgo.h"
 #include "AliEMCALJetFinderAlgoOmni.h"
 #include "AliEMCALJetFinderAlgoUA1Unit.h"
-#include "AliEMCALGetter.h"
 #include "AliEMCALGeometry.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCAL.h"
 #include "AliEMCALDigit.h"
-#include "TParticle.h"
-#include "AliRun.h"
 #include "AliEMCALJet.h"
-#include "TMath.h"
 
 
 ClassImp(AliEMCALJetFinderAlgoOmni)
@@ -85,9 +89,6 @@ ClassImp(AliEMCALJetFinderAlgoOmni)
 {
   //Default constructor
 if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Default Constructor");
-
-// AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-//  AliEMCALGeometry * geom = gime->EMCALGeometry();
   AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL");
   fNumIter           = 0;
   fNumUnits          = geom->GetNTowers();     //Number of towers in EMCAL
@@ -187,11 +188,8 @@ if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Default Constructor");
          //     }else
          //    {
 
-     AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-     AliEMCALGeometry * geom;
-     if (gime)
-      geom = gime->EMCALGeometry();
-     else
+     AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
+     if (geom == 0)
       geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL");
 
         //    }
@@ -565,12 +563,9 @@ if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Default Constructor");
    {
      //Stores the resulting jet information in appropriate storage structure (TO BE DECIDED!!!!)
      if (fDebug>1) Info("StoreJetInfo","Storing Jet Information");
-     AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-     AliEMCALGeometry * geom;
-     if (gime)
-      geom = gime->EMCALGeometry();
-     else
-      geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL");
+     AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
+     if (geom == 0)
+       geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL");
      //Store:
      //fJetESum is the final jet energy (background has been subtracted)
      //fJetEta is the final jet Eta
index aaf7bdc8ce0c1a57766cc94caf3aa8251cb23143..752b8e9ea23916a192eca9e80808a2d1f682eb7f 100755 (executable)
@@ -27,7 +27,7 @@
 #include <TClonesArray.h>
 #include <TParticle.h>
 #include <TTree.h>
-
+#include "Riostream.h"
 //.....................
 #include "AliEMCALJet.h"
 #include "AliEMCALParton.h"
@@ -54,7 +54,7 @@ Int_t AliEMCALJetFinderInputPrep::FillFromFile(TString * /*filename*/,
                                               AliEMCALJetFinderFileType_t /*fileType*/,
                                               Int_t /*EventNumber*/)
 {
-return 0;
+  return 0;
 }
 void AliEMCALJetFinderInputPrep::Reset(AliEMCALJetFinderResetType_t resettype)
 { 
index d1f936f878915447bde7977b5a90085469c43d61..df12d77edd8852a495953af6824c13016d5ae605 100755 (executable)
 
 
 #include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliStack.h"
 #include "AliMagF.h"
 #include "AliEMCALFast.h"
 #include "AliEMCAL.h"
 #include "AliEMCALHit.h"
 #include "AliEMCALGeometry.h"
-#include "AliEMCALGetter.h"
 #include "AliEMCALLoader.h"
 #include "AliGenEventHeader.h"
 #include "AliGenPythiaEventHeader.h"
@@ -74,7 +75,7 @@ if (fDebug > 0) Info("~AliEMCALJetFinderInputSimPrep","Beginning Destructor");
 void AliEMCALJetFinderInputSimPrep::Reset(AliEMCALJetFinderResetType_t resettype)
 {
        // Method to reset data
-if (fDebug > 1) Info("Reset","Beginning Reset");
+  if (fDebug > 1) Info("Reset","Beginning Reset");
        switch (resettype){
 
        case kResetData:
@@ -110,18 +111,22 @@ if (fDebug > 1) Info("Reset","Beginning Reset");
 
 }
 
-Int_t AliEMCALJetFinderInputSimPrep::FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber,TString data="H")
+Int_t AliEMCALJetFinderInputSimPrep::FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber,TString data)
 {
-if (fDebug > 1) Info("FillFromFile","Beginning FillFromFile");
-   fFileType = filetype;       
-   AliEMCALGetter *gime = AliEMCALGetter::Instance(filename->Data());
-   if (fDebug > 1) Info("FillFromFile","Instantiated Getter with %s as the file",filename->Data());
+  if (fDebug > 1) Info("FillFromFile","Beginning FillFromFile");
+  fFileType = filetype;        
+  AliRunLoader *rl=AliRunLoader::Open(filename->Data());
+  if (fDebug > 1) Info("FillFromFile","Opened file %s",filename->Data());
    if (data.Contains("S"))
    {
-          gime->Event(EventNumber,"XS") ;
+          rl->LoadKinematics();
+          rl->LoadSDigits();
+          rl->GetEvent(EventNumber);
    }else
    {
-          gime->Event(EventNumber,"XH") ;
+          rl->LoadKinematics();
+          rl->LoadHits();
+          rl->GetEvent(EventNumber);
    }
    if (fDebug > 1) Info("FillFromFile","Got event %i with option \"XH\"",EventNumber);
 
@@ -140,9 +145,6 @@ if (fDebug > 1) Info("FillFromFile","Beginning FillFromFile");
    if ( fFileType  != kData){
           FillPartons();
    }
-/*   gime->EmcalLoader()->UnloadRecParticles();   
-   gime->EmcalLoader()->UnloadTracks();   
-   gime->Reset();*/
    return 0;   
 }
 
@@ -152,12 +154,11 @@ void AliEMCALJetFinderInputSimPrep::FillHits()
 if (fDebug > 1) Info("FillHits","Beginning FillHits");
        
 // Access hit information
-    AliEMCALHit *mHit;
 //  AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
 //  Info("AliEMCALJetFinderInputSimPrep","Title of the geometry is %s",pEMCAL->GetTitle());
-    AliEMCALGeometry* geom =  AliEMCALGetter::Instance()->EMCALGeometry();
-    AliEMCALGetter *gime = AliEMCALGetter::Instance();
-    
+    AliEMCALGeometry* geom =  AliEMCALGeometry::GetInstance();
+    AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+
     //    TTree *treeH = AliEMCALGetter::Instance()->TreeH();
 //    Int_t ntracks = (Int_t) treeH->GetEntries();
 //
@@ -171,10 +172,10 @@ if (fDebug > 1) Info("FillHits","Beginning FillHits");
 //
 //  Loop over hits
 //
-        for(Int_t i =0; i < gime->Hits()->GetEntries() ;i++)
+        for(Int_t i =0; i < emcalLoader->Hits()->GetEntries() ;i++)
         {
-           mHit = gime->Hit(i);        
-                if (fEMCALType == kTimeCut && 
+           const AliEMCALHit *mHit = emcalLoader->Hit(i);      
+           if (fEMCALType == kTimeCut && 
                    (mHit->GetTime()>fTimeCut) ) continue;
             Float_t x      =    mHit->X();         // x-pos of hit
             Float_t y      =    mHit->Y();         // y-pos
@@ -205,28 +206,23 @@ if (fDebug > 1) Info("FillHits","Beginning FillHits");
 void AliEMCALJetFinderInputSimPrep::FillTracks()       
 {
        // Fill from particles simulating a TPC to input object from simulation
-
     if (fDebug > 1) Info("FillTracks","Beginning FillTracks");
        
+    AliRunLoader *rl = AliRunLoader::GetRunLoader();
     TParticlePDG* pdgP = 0;
     TParticle *mPart;
-    Int_t npart = (gAlice->GetHeader())->GetNprimary();
+    Int_t npart = rl->Stack()->GetNprimary();
     if (fDebug > 1) Info("FillTracks","Header says there are %i primaries",npart);
-    //AliEMCALGetter *gime = AliEMCALGetter::Instance();
     Float_t bfield,rEMCAL;              
-/*     for (Int_t i =0; i<gime->NPrimaries(); i++)
-       {
-               cout<<gime->Primary(i)->GetFirstMother()<<endl;
-               if (gime->Primary(i)->GetFirstMother() == -1) {
-                       counterforus++;
-                       gime->Primary(i)->Dump();
-               }
-       }*/
     
     if (fDebug > 1) Info("FillTracks","Defining the geometry");
     
     AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
-    AliEMCALGeometry* geom =  AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
+    AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
+    if (geom == 0 && pEMCAL) 
+      geom = AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
+    if (geom == 0) 
+      geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","");//","SHISH_77_TRD1_2X2_FINAL_110DEG");
     fEtaMax = geom->GetArm1EtaMax();
     fEtaMin = geom->GetArm1EtaMin();
     fPhiMax = TMath::Pi()/180.0*geom->GetArm1PhiMax();
@@ -236,8 +232,7 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()
            
     if (fDebug > 1) Info("FillTracks","Particle loop of %i",npart);
     for (Int_t part = 0; part < npart; part++) {
-       mPart = gAlice->GetMCApp()->Particle(part);
-       //if (part%10) gObjectTable->Print();
+       mPart = rl->Stack()->Particle(part);
        pdgP = mPart->GetPDG();
 
        if (fDebug > 5) Info("FillTracks","Checking if track is a primary");
@@ -273,7 +268,10 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()
             }
        }
 
-       bfield = gAlice->Field()->SolenoidField();
+       if (gAlice && gAlice->Field()) 
+         bfield = gAlice->Field()->SolenoidField();
+       else
+         bfield = 0.4;
        rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
        Float_t rB = 3335.6 * mPart->Pt() / bfield;  // [cm]  (case of |charge|=1)
        if (2.*rB < rEMCAL) continue;  // track curls away
@@ -436,7 +434,8 @@ void AliEMCALJetFinderInputSimPrep::FillPartons()
        // input object from simulation
 if (fDebug > 1) Info("FillPartons","Beginning FillPartons");
 
-  AliGenEventHeader* evHeader = ((AliHeader*)(gAlice->GetHeader()))->GenEventHeader();
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliGenEventHeader* evHeader = rl->GetHeader()->GenEventHeader();
   Float_t triggerJetValues[4];
   AliEMCALParton tempParton;
   
@@ -593,12 +592,12 @@ void AliEMCALJetFinderInputSimPrep::FillDigits()
 void AliEMCALJetFinderInputSimPrep::FillSDigits()  
 {
 Info("FillSDigits","Beginning FillSDigits");
-       AliEMCALGetter *gime = AliEMCALGetter::Instance();
+       AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
         
        // Fill digits to input object
-       for (Int_t towerid=0; towerid < gime->SDigits()->GetEntries(); towerid++)
+       for (Int_t towerid=0; towerid < emcalLoader->SDigits()->GetEntries(); towerid++)
        {
-               fInputObject.AddEnergyToDigit(gime->SDigit(towerid)->GetId(), gime->SDigit(towerid)->GetAmp());
+               fInputObject.AddEnergyToDigit(emcalLoader->SDigit(towerid)->GetId(), emcalLoader->SDigit(towerid)->GetAmp());
        }
 
 }
@@ -626,14 +625,16 @@ if (fDebug > 5) Info("Smear","Beginning Smear");
 void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
 {
        // Populate parton tracks for input distributions
-       if (fDebug>1) Info("FillPartonTracks","Beginning FillPartonTracks");    
-       Int_t npart = (gAlice->GetHeader())->GetNprimary();
+  if (fDebug>1) Info("FillPartonTracks","Beginning FillPartonTracks");
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+       
+       Int_t npart = rl->Stack()->GetNprimary();
        Int_t ntracks =0;
        TParticlePDG *getpdg;
        TParticle *tempPart;
        for (Int_t part = 0; part < npart; part++)
        {
-               tempPart = gAlice->GetMCApp()->Particle(part);
+               tempPart = rl->Stack()->Particle(part);
                if (tempPart->GetStatusCode() != 1) continue;
                if ((!fPythiaComparison)&&(tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin || 
                    tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin) ){
@@ -655,7 +656,7 @@ void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
        ntracks=0;
        for (Int_t part = 0; part < npart; part++)
        {
-               tempPart = gAlice->GetMCApp()->Particle(part);
+               tempPart = rl->Stack()->Particle(part);
                if (tempPart->GetStatusCode() != 1) continue;
                if ((!fPythiaComparison)&&(tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin ||
                    tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin) ){ 
index 41ddfabd32b89def6e8f3f82ed21be1f0414d5ec..28509d475a27c69b0ada92989d66cab40ebca640 100755 (executable)
@@ -30,7 +30,7 @@ class AliEMCALJetFinderInputSimPrep : public AliEMCALJetFinderInputPrep
        void SetTrackType(AliEMCALJetFinderTrackType_t tracktype){fTrackType = tracktype;}  
        void SetEfficiency(Float_t efficiency)  {fEfficiency = efficiency;}
        void SetTimeCut(Float_t timecut)  {fTimeCut = timecut; fEMCALType = kTimeCut;}
-       Int_t FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber,TString data);
+       Int_t FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber,TString data="XH");
        AliEMCALJetFinderInput* GetJetFinderInput(){return &fInputObject;}
        private:
        void FillHits();                // Fill from the hits to input object from simulation
index d23adb2397b414b216827b711b2070448ed96b54..6074f07dbf8ed42bf227903fbf608a062e2d5a58 100644 (file)
 //_________________________________________________________________________
 //  A singleton. This class should be used in the analysis stage to get 
 //  reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
-//  instead of directly reading them from galice.root file. This container 
-//  ensures, that one reads Digits, made of these particular digits, RecPoints, 
-//  made of these particular RecPoints, TrackSegments and RecParticles. 
-//  This becomes non trivial if there are several identical branches, produced with
-//  different set of parameters. 
-//
-//  An example of how to use (see also class AliEMCALAnalyser):
-//  for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
-//     AliEMCALRecParticle * part = gime->RecParticle(1) ;
-//     ................
-//  please->GetEvent(event) ;    // reads new event from galice.root
+//  instead of directly reading them from galice.root file. 
 //                  
+//  MvL Feb 2006:
+//  The AliEMCALLoader now holds the TClonesArray and TObjArray for reading
+//  Hits, Dgits, SDigits and RecPoints. Filling is managed in the GetEvent()
+//  method.
+//
+//  Creation/writing of files is managed by the relevant parts of the 
+//  reconstruction software (AliEMCALDigitiser etx)
+//
 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
 //*--         Completely redesigned by Dmitri Peressounko March 2001  
 //
 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
-//*--         systematic usage of TFolders without changing the interface        
+//*--         systematic usage of TFolders without changing the interface
+// 
+//*-- Marco van Leeuwen, Jan 2006: complete revision to simplify reading
+//*--         and fit better in general ALICE scheme
+//
 //////////////////////////////////////////////////////////////////////////////
 
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
-#include "AliEMCAL.h"
-#include "AliEMCALGetter.h"
-#include "AliEMCALHit.h"
 #include "AliEMCALLoader.h"
 #include "AliLog.h"
-#include "AliObjectLoader.h"
 
 ClassImp(AliEMCALLoader)
   
-  
-const TString AliEMCALLoader::fgkHitsName("HITS");//Name for TClonesArray with hits from one event
-const TString AliEMCALLoader::fgkSDigitsName("SDIGITS");//Name for TClonesArray 
-const TString AliEMCALLoader::fgkDigitsName("DIGITS");//Name for TClonesArray 
-const TString AliEMCALLoader::fgkECARecPointsName("ECARECPOINTS");//Name for TClonesArray 
-const TString AliEMCALLoader::fgkTracksName("TRACKS");//Name for TClonesArray 
-const TString AliEMCALLoader::fgkRecParticlesName("RECPARTICLES");//Name for TClonesArray
-
 const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
-const TString AliEMCALLoader::fgkTrackSegmentsBranchName("EMCALTS");//Name for branch with TrackSegments
-const TString AliEMCALLoader::fgkRecParticlesBranchName("EMCALRP");//Name for branch with Reconstructed Particles
 
 //____________________________________________________________________________ 
 AliEMCALLoader::AliEMCALLoader()
 {
   fDebug = 0;
-  fRecParticlesLoaded = kFALSE;
+  fHits = new TClonesArray("AliEMCALHit");
+  fDigits = new TClonesArray("AliEMCALDigit");
+  fSDigits = new TClonesArray("AliEMCALDigit");
+  fRecPoints = new TObjArray();
 }
 
 //____________________________________________________________________________ 
@@ -78,835 +69,66 @@ AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfolderna
   AliLoader(detname,eventfoldername)
 {
   fDebug=0;
-  fRecParticlesLoaded = kFALSE;
+  fHits = new TClonesArray("AliEMCALHit");
+  fDigits = new TClonesArray("AliEMCALDigit");
+  fSDigits = new TClonesArray("AliEMCALDigit");
+  fRecPoints = new TObjArray();
 }
 
 //____________________________________________________________________________ 
 AliEMCALLoader::~AliEMCALLoader()
 {
-  //remove and delete arrays
-  Clean(fgkHitsName);
-  Clean(fgkSDigitsName);
-  Clean(fgkDigitsName);
-  Clean(fgkECARecPointsName);
-  Clean(fgkTracksName);
-  Clean(fgkRecParticlesName);
-  CleanFolders() ; 
- // set to 0x0 the objgetter in AliGetter ... weird isn it !
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
-  if (gime) 
-    gime->Reset() ;
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::CleanFolders()
-{
-  CleanRecParticles();
-  AliLoader::CleanFolders();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::SetEvent()
-{
-  //Cleans loaded stuff and and sets Files and Directories
-  // do not post any data to folder/tasks
-
-  
-  Int_t retval = AliLoader::SetEvent();
-  if (retval)
-   {
-     Error("SetEvent","AliLoader::SetEvent returned error");
-     return retval;
-   }
-
-
-  if (Hits()) Hits()->Clear();
-  if (SDigits()) SDigits()->Clear();
-  if (Digits()) Digits()->Clear();
-  if (ECARecPoints()) ECARecPoints()->Clear();
-  if (TrackSegments()) TrackSegments()->Clear();
-  if (RecParticles()) RecParticles()->Clear();
-   
-  return 0;
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::GetEvent()
-{
-  //Overloads GetEvent method called by AliRunLoader::GetEvent(Int_t) method
-  //to add Rec Particles specific for EMCAL
-  
-  //First call the original method to get whatever from std. setup is needed
-  Int_t retval;
-  
-  retval = AliLoader::GetEvent();
-  if (retval)
-    {
-      Error("GetEvent","AliLoader::GetEvent returned error");
-      return retval;
-    }
-  
-  if (GetHitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadHits();
-  if (GetSDigitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadSDigits();
-  if (GetDigitsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadDigits();
-  if (GetRecPointsDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadRecPoints();
-  if (GetTracksDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadTracks();
-  if (GetRecParticlesDataLoader()->GetBaseDataLoader()->IsLoaded()) ReadRecParticles();
-
-
-  //Now, check if RecPart were loaded  
-  return 0;
-}
-
-//____________________________________________________________________________ 
-const AliEMCAL * AliEMCALLoader::EMCAL() 
-{
-  // returns the EMCAL object 
-  AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(GetModulesFolder()->FindObject(fDetectorName));
-  if ( emcal == 0x0) 
-    if (fDebug)
-      cout << "WARNING: AliEMCALLoader::EMCAL -> EMCAL module not found in Folders" << endl ; 
-  return emcal ; 
-}  
-
-//____________________________________________________________________________ 
-const AliEMCALGeometry * AliEMCALLoader::EMCALGeometry() 
-{
-  // Gets the EMCAL Geometry object 
-  AliEMCALGeometry * rv = 0 ; 
-  if (EMCAL() )
-    rv =  EMCAL()->GetGeometry();
-  return rv ; 
-} 
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::LoadHits(Option_t* opt)
-{  
-  //------- Hits ----------------------
-  //Overload (extends) LoadHits implemented in AliLoader
-  //
-  Int_t res;
-  
-  //First call the AliLoader's method to send the TreeH to folder
-  res = AliLoader::LoadHits(opt);
-  
-  if (res)
-   {//oops, error
-     AliError("returned error");
-     return res;
-   }
-
-  //read the data from tree in folder and send it to folder
-  res = ReadHits();
-  return 0;
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::LoadSDigits(Option_t* opt)
-{  
-  // Loads the SDigits array in the folder structure
-  Int_t res;
-  //First call the AliLoader's method to send the TreeS to folder
-  res = AliLoader::LoadSDigits(opt);
-  if (res)
-    {//oops, error
-      Error("PostSDigits","AliLoader::LoadSDigits returned error");
-      return res;
-    }
-  return ReadSDigits();
-  
-} 
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::LoadDigits(Option_t* opt)
-{ 
-  // Loads the Digits array in the folder structure
-  
-  Int_t res;
-  //First call the AliLoader's method to send the TreeS to folder
-  res = AliLoader::LoadDigits(opt);
-  if (res)
-    {//oops, error
-      Error("LoadDigits","AliLoader::LoadDigits returned error");
-      return res;
-    }
-  return ReadDigits();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::LoadRecPoints(Option_t* opt) 
-{ 
-  // Loads the RecPoints array in the folder structure
-  Int_t res;
-  //First call the AliLoader's method to send the TreeR to folder
-  res = AliLoader::LoadRecPoints(opt);
-  if (res)
-    {//oops, error
-      Error("LoadRecPoints","AliLoader::LoadRecPoints returned error");
-      return res;
-    }
-  
-  TFolder * emcalFolder = GetDetectorDataFolder();
-  if ( emcalFolder  == 0x0 ) 
-    {
-      Error("LoadRecPoints","Can not get detector data folder");
-      return 1;
-    }
-  return ReadRecPoints();
-}
-
-//____________________________________________________________________________ 
-Int_t  AliEMCALLoader::LoadTracks(Option_t* opt)
-{
-  //Loads Tracks: Open File, Reads Tree and posts, Read Data and Posts
-  AliDebug(1, Form("opt = %s",opt));
-  Int_t res;
-  res = AliLoader::LoadTracks(opt);
-  if (res)
-    {//oops, error
-      AliError("returned error");
-      return res;
-    }  
-  return ReadTracks();
-  
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::LoadRecParticles(Option_t* opt) 
-{ 
-  // Loads the RecParticles array in the folder structure
-  Int_t res;
-  //First call the AliLoader's method to send the TreeS to folder
-  res = AliLoader::LoadRecParticles(opt);
-  if (res)
-    {//oops, error
-      Error("LoadRecParticles","AliLoader::LoadRecParticles returned error");
-      return res;
-    }
-  return ReadRecParticles();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::PostHits()
-{
-  // Post Hits
-  Int_t reval = AliLoader::PostHits();
-  if (reval)
-    {
-     Error("PostHits","AliLoader::  returned error");
-     return reval;
-    }
-  return const_cast<AliEMCALLoader *>(this)->ReadHits();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::PostSDigits()
-{
-  // Posts the SDigits array to the folder structure
-  Int_t reval = AliLoader::PostSDigits();
-  if (reval)
-   {
-     Error("PostSDigits","AliLoader::PostSDigits  returned error");
-     return reval;
-   }
-  return const_cast<AliEMCALLoader *>(this)->ReadSDigits();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::PostDigits()
-{
-  // Posts the Digits array to the folder structure
-  Int_t reval = AliLoader::PostDigits();
-  if (reval)
-    {
-      Error("PostDigits","AliLoader::PostDigits  returned error");
-      return reval;
-    }
-  return const_cast<AliEMCALLoader *>(this)->ReadDigits();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::PostRecPoints()
-{
-  // Posts the RecPoints array to the folder structure
-  Int_t reval = AliLoader::PostRecPoints();
-  if (reval)
-   {
-     Error("PostRecPoints","AliLoader::PostRecPoints  returned error");
-     return reval;
-   }
-  return const_cast<AliEMCALLoader *>(this)->ReadRecPoints();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::PostRecParticles()
-{
-  // Posts the RecParticles array to the folder structure
-  
-  Int_t reval = AliLoader::PostRecParticles();
-  if (reval)
-    {
-      Error("PostRecParticles","AliLoader::PostRecParticles  returned error");
-      return reval;
-    }
-  return const_cast<AliEMCALLoader *>(this)->ReadRecParticles();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::PostTracks()
-{
-  // Posts the Tracks array to the folder structure
-  Int_t reval = AliLoader::PostTracks();
-  if (reval)
-    {
-      Error("PostTracks","AliLoader::PostTracks  returned error");
-      return reval;
-    }
-  return const_cast<AliEMCALLoader *>(this)->ReadTracks();
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::ReadHits()
-{
-  // If there is no Clones Array in folder creates it and sends to folder
-  // then tries to read
-  // Reads the first entry of EMCAL branch in hit tree TreeH()
-  // Reads data from TreeH and stores it in TClonesArray that sits in DetectorDataFolder
-  //
-  TObject** hitref = HitsRef();
-  if(hitref == 0x0)
-    {
-      MakeHitsArray();
-     hitref = HitsRef();
-    }
-  
-  TClonesArray* hits = dynamic_cast<TClonesArray*>(*hitref);
-  
-  TTree* treeh = TreeH();
-  
-  if(treeh == 0)
-    {
-      AliError("Cannot read TreeH from folder");
-      return 1;
-    }
-  
-  TBranch * hitsbranch = treeh->GetBranch(fDetectorName);
-  if (hitsbranch == 0) 
-    {
-      AliError("Cannot find branch EMCAL"); 
-      return 1;
-    }
-  
-  AliDebug(1, "Reading Hits");
-  
-  if (hitsbranch->GetEntries() > 1)
-    {
-      TClonesArray * tempo =  new TClonesArray("AliEMCALHit",1000);
-      
-      hitsbranch->SetAddress(&tempo);
-      Int_t index = 0 ; 
-      Int_t i = 0 ;
-      for (i = 0 ; i < hitsbranch->GetEntries(); i++) 
-       {
-         hitsbranch->GetEntry(i) ;
-         Int_t j = 0 ;
-         for ( j = 0 ; j < tempo->GetEntries() ; j++) 
-           {
-             AliEMCALHit* hit = (AliEMCALHit*)tempo->At(j); 
-             new((*hits)[index]) AliEMCALHit( *hit ) ;
-             index++ ; 
-           }
-       }
-      tempo->Delete() ; 
-      delete tempo;
-    }
-  else 
-    {
-      hitsbranch->SetAddress(hitref);
-      hitsbranch->GetEntry(0) ;
-    }
-  
-  return 0;
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::ReadSDigits()
-{
-  // Read the summable digits tree TreeS():
-  // Check if TClones is in folder
-  // if not create and add to folder
-  // connect to tree if available
-  // Read the data
-  
-  TObject** sdref = SDigitsRef();
-  if(sdref == 0x0)
-    {
-      MakeSDigitsArray();
-      sdref = SDigitsRef();
-    }
-  
-  TTree * treeS = TreeS();
-  if(treeS==0)
-    {
-      //May happen if file is truncated or new in LoadSDigits
-      //Error("ReadSDigits","There is no SDigit Tree");
-      return 0;
-    }
-  
-  TBranch * branch = treeS->GetBranch(fDetectorName);
-  if (branch == 0) 
-    {//easy, maybe just a new tree
-      //Error("ReadSDigits"," Cannot find branch EMCAL"); 
-      return 0;
-    }
-  
-  branch->SetAddress(SDigitsRef());
-  branch->GetEntry(0);
-  return 0;
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::ReadDigits()
-{
-  // Read the summable digits tree TreeS():
-  // Check if TClones is in folder
-  // if not create and add to folder
-  // connect to tree if available
-  // Read the data
-  
-  TObject** dref = DigitsRef();
-  if(dref == 0x0)
-    {//if there is not array in folder, create it and put it there
-      MakeDigitsArray();
-      dref = DigitsRef();
-    }
-  
-  TTree * treeD = TreeD();
-  if(treeD==0)
-    {
-      //May happen if file is truncated or new in LoadSDigits
-      //Error("ReadDigits","There is no Digit Tree");
-      return 0;
-    }
-  
-  TBranch * branch = treeD->GetBranch(fDetectorName);
-  if (branch == 0) 
-    {//easy, maybe just a new tree
-      //Error("ReadDigits"," Cannot find branch ",fDetectorName.Data()); 
-      return 0;
-    }
-  
-  branch->SetAddress(dref);//connect branch to buffer sitting in folder
-  branch->GetEntry(0);//get first event 
-  
-  return 0;  
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::UnloadRecParticles()
-{
-  // Unloads the RecParticles array fromthe folder structure
-  fRecParticlesLoaded = kFALSE;
-  CleanRecParticles();
-  if (fTracksLoaded == kFALSE) UnloadTracks();
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::UnloadTracks()
-{
-  // Unloads the Tracks array fromthe folder structure
-  CleanTracks();//free the memory
-  //in case RecPart are loaded we can not onload tree and close the file
-  if (fRecParticlesLoaded == kFALSE) AliLoader::UnloadTracks();
-  fTracksLoaded = kFALSE;//mark that nobody needs them
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::Track(Int_t itrack)
-{
-  // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
-  if(TreeH()== 0)
-    {
-      if (LoadHits())
-       {
-         Error("Track","Can not load hits.");
-         return;
-       } 
-    }
-  
-  TBranch * hitsbranch = dynamic_cast<TBranch*>(TreeH()->GetListOfBranches()->FindObject("EMCAL")) ;
-  if ( !hitsbranch ) {
-    if (fDebug)
-      cout << "WARNING:  AliEMCALLoader::ReadTreeH -> Cannot find branch EMCAL" << endl ; 
-    return ;
-  }  
-  if(!Hits()) PostHits();
-  
-  hitsbranch->SetAddress(HitsRef());
-  hitsbranch->GetEntry(itrack);
-  
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::ReadRecPoints()
-{
-  //Creates and posts to folder an array container, 
-  //connects branch in tree (if exists), and reads data to array
-  
-  MakeRecPointsArray();
-   
-  TObjArray * eca = 0x0 ;  
-
-  TTree * treeR = TreeR();
-  
-  if(treeR==0)
-    {
-      //May happen if file is truncated or new in LoadSDigits
-      return 0;
-    }
-  
-  Int_t retval = 0;
-
-  TBranch * ecabranch = treeR->GetBranch(fgkECARecPointsBranchName);
-  if (ecabranch == 0x0)
-    {
-      Error("ReadRecPoints","Can not get branch with ECA Rec. Points named %s",fgkECARecPointsBranchName.Data());
-      retval = 2;
-    }
-  else
-   {
-     ecabranch->SetAddress(&eca);
-     ecabranch->GetEntry(0) ;
-   }
-
-
-  Int_t ii ; 
-
-  Int_t maxeca = eca->GetEntries() ; 
-  for ( ii= 0 ; ii < maxeca ; ii++ ) 
-    ECARecPoints()->Add(eca->At(ii)) ;
-
-  return retval;
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::ReadTracks()
-{
-  //Creates and posts to folder an array container, 
-  //connects branch in tree (if exists), and reads data to arry
-  
-  TObject** trkref = TracksRef();
-  if ( trkref == 0x0 )   
-    {//Create and post array
-      MakeTrackSegmentsArray();
-      trkref = TracksRef();
-    }
-  
-  TTree * treeT = TreeT();
-  if(treeT==0)
-    {
-      //May happen if file is truncated or new in LoadSDigits, or the file is in update mode, 
-      //but tracking was not performed yet for a current event
-      //Error("ReadTracks","There is no Tree with Tracks");
-      return 0;
-    }
-  
-  TBranch * branch = treeT->GetBranch(fgkTrackSegmentsBranchName);
-  if (branch == 0) 
-    {//easy, maybe just a new tree
-      Error("ReadTracks"," Cannot find branch named %s",fgkTrackSegmentsBranchName.Data());
-      return 0;
-    }
-  
-  branch->SetAddress(trkref);//connect branch to buffer sitting in folder
-  branch->GetEntry(0);//get first event 
-  
-  return 0;
-}
-
-//____________________________________________________________________________ 
-Int_t AliEMCALLoader::ReadRecParticles()
-{
-  //Reads Reconstructed  Particles from file
-  //Creates and posts to folder an array container, 
-  //connects branch in tree (if exists), and reads data to arry
-  
-  TObject** recpartref = RecParticlesRef();
-  
-  if ( recpartref == 0x0 )   
-    {//Create and post array
-      MakeRecParticlesArray();
-      recpartref = RecParticlesRef();
-    }
-  
-  TTree * treeP = TreeP();
-  if(treeP==0)
-    {
-      //May happen if file is truncated or new in LoadSDigits, 
-      //or the file is in update mode, 
-      //but tracking was not performed yet for a current event
-      //     Error("ReadRecParticles","There is no Tree with Tracks and Reconstructed Particles");
-      return 0;
-    }
-  
-  TBranch * branch = treeP->GetBranch(fgkRecParticlesBranchName);
-  if (branch == 0) 
-    {//easy, maybe just a new tree
-      Error("ReadRecParticles"," Cannot find branch %s",fgkRecParticlesBranchName.Data()); 
-      return 0;
-    }
-  
-  branch->SetAddress(recpartref);//connect branch to buffer sitting in folder
-  branch->GetEntry(0);//get first event 
-  
-  return 0;
-}
-
-//____________________________________________________________________________ 
-AliEMCALGeometry* AliEMCALLoader::GetEMCALGeometry()
-{
-  //returns EMCAL geometry from gAlice 
-  //static Method used by some classes where it is not convienient to pass eventfoldername
-  if (gAlice == 0x0)
-    return 0x0;
-  AliEMCAL* emcal=dynamic_cast<AliEMCAL*>(gAlice->GetDetector("EMCAL"));
-  if (emcal == 0x0)
-    return 0x0;
-  return emcal->GetGeometry();
-}
-
-//____________________________________________________________________________ 
-AliEMCALLoader* AliEMCALLoader::GetEMCALLoader(const  char* eventfoldername)
-{
-  // Get an instance of the EMCALLoader object
-  AliRunLoader* rn  = AliRunLoader::GetRunLoader(eventfoldername);
-  if (rn == 0x0)
-    {
-      cerr<<"Error: <AliEMCALLoader::GetEMCALLoader>: "
-         << "Can not find Run Loader in folder "<<eventfoldername<<endl;
-      return 0x0;
-    }
-  return dynamic_cast<AliEMCALLoader*>(rn->GetLoader("EMCALLoader"));
-}
-
-//____________________________________________________________________________ 
-Bool_t AliEMCALLoader::BranchExists(const TString& recName)
-{ 
-  // Check is branch exists
-  if (fBranchTitle.IsNull()) return kFALSE;
-  TString dataname, zername ;
-  TTree* tree;
-  if(recName == "SDigits") {
-    tree = TreeS();
-    dataname = GetDetectorName();
-    zername = "AliEMCALSDigitizer" ;
-  }
-  else if(recName == "Digits"){
-    tree = TreeD();
-    dataname = GetDetectorName();
-    zername = "AliEMCALDigitizer" ;
-  }
-  else if(recName == "ECARecPoints"){
-    tree = TreeR();
-    dataname = fgkECARecPointsBranchName;
-    zername = "AliEMCALClusterizer" ;
-  }
-  else if(recName == "TrackSegments"){
-    tree = TreeT();
-    dataname = fgkTrackSegmentsBranchName;
-    zername = "AliEMCALTrackSegmentMaker";
-  }        
-  else if(recName == "RecParticles"){
-    tree = TreeP();
-    dataname = fgkRecParticlesBranchName;
-    zername = "AliEMCALPID";
-  }
-  else
-    return kFALSE ;
-  
-  if(!tree ) 
-    return kFALSE ;
-  
-  TObjArray * lob = static_cast<TObjArray*>(tree->GetListOfBranches()) ;
-  TIter next(lob) ; 
-  TBranch * branch = 0 ;  
-  TString titleName(fBranchTitle);
-  titleName+=":";
-  
-  while ((branch = (static_cast<TBranch*>(next())))) {
-    TString branchName(branch->GetName() ) ; 
-    TString branchTitle(branch->GetTitle() ) ;  
-    if ( branchName.BeginsWith(dataname) && branchTitle.BeginsWith(fBranchTitle) ){  
-      Warning("BranchExists","branch %s  with title  %s ",dataname.Data(),fBranchTitle.Data());
-      return kTRUE ;
-    }
-    if ( branchName.BeginsWith(zername) &&  branchTitle.BeginsWith(titleName) ){
-      Warning("BranchExists","branch AliEMCAL... with title  %s ",branch->GetTitle());
-      return kTRUE ; 
-    }
+  // Disconnect trees and remove arrays
+  if (TreeH())
+    TreeH()->SetBranchAddress(fDetectorName,0);
+  if (TreeD())
+    TreeD()->SetBranchAddress(fDetectorName,0);
+  if (TreeS())
+    TreeS()->SetBranchAddress(fDetectorName,0);
+  if (TreeR())
+    TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
+  delete fHits;
+  delete fDigits;
+  delete fSDigits;
+  delete fRecPoints;
+}
+
+//____________________________________________________________________________ 
+Int_t AliEMCALLoader::GetEvent() {
+  AliLoader::GetEvent();  // First call AliLoader to do all the groundwork
+
+  AliDebug(1,__PRETTY_FUNCTION__);
+  // Now connect and fill TClonesArray
+
+  // Hits
+  TTree *treeH = TreeH();
+  if (treeH) {
+    treeH->SetBranchAddress(fDetectorName,&fHits);
+    if (treeH->GetEntries() > 1)
+      Warning(__PRETTY_FUNCTION__,"multiple arrays in treeH no longer supported");
+    treeH->GetEvent(0);
   }
-  return kFALSE ;
-  
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::SetBranchTitle(const TString& btitle)
-{
-  // Gives a name to a branch in the folder structure
-  if (btitle.CompareTo(fBranchTitle) == 0) return;
-  fBranchTitle = btitle;
-  ReloadAll();
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::CleanHits()
-{
-  // Clean hits        
-  AliLoader::CleanHits();
-  //Clear an array 
-  TClonesArray* hits = Hits();
-  if (hits) 
-    hits->Clear();
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::CleanSDigits()
-{
-  // Cleans the SDigits array in the folder structure
-  AliLoader::CleanSDigits();
-  TClonesArray* sdigits = SDigits();
-  if (sdigits) sdigits->Clear();
-  
-}
-//____________________________________________________________________________ 
 
-void AliEMCALLoader::CleanDigits()
-{
-  // Cleans the Digits array in the folder structure
-  AliLoader::CleanDigits();
-  TClonesArray* digits = Digits();
-  if (digits) digits->Clear();
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::CleanRecPoints()
-{
-  // Cleans the RecPoints array in the folder structure
-  AliLoader::CleanRecPoints();
-  TObjArray* recpoints = ECARecPoints();
-  if (recpoints) recpoints->Clear();
-
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::CleanTracks()
-{
-  // Cleans the Tracks array in the folder structure
-  AliLoader::CleanTracks();//tree
-  //and clear the array
-  TClonesArray* tracks = TrackSegments();
-  if (tracks) 
-    tracks->Clear();  
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::CleanRecParticles()
-{
-  // Cleans the RecParticles array in the folder structure
-  TClonesArray *recpar = RecParticles();
-  if (recpar) 
-    recpar->Clear();
-}
-
-//____________________________________________________________________________ 
-// void AliEMCALLoader::ReadCalibrationDB(const char * database,const char * filename)
-// {
-
-//   if(fcdb && (strcmp(database,fcdb->GetTitle())==0))
-//     return ;
-
-//   TFile * file = gROOT->GetFile(filename) ;
-//   if(!file)
-//     file = TFile::Open(filename);
-//   if(!file){
-//     Error ("ReadCalibrationDB", "Cannot open file %s", filename) ;
-//     return ;
-//   }
-//   if(fcdb)
-//     fcdb->Delete() ;
-//   fcdb = dynamic_cast<AliEMCALCalibrationDB *>(file->Get("AliEMCALCalibrationDB")) ;
-//   if(!fcdb)
-//     Error ("ReadCalibrationDB", "No database %s in file %s", database, filename) ;
-// }
-//____________________________________________________________________________ 
-
-// AliEMCALSDigitizer*  AliEMCALLoader::EMCALSDigitizer() 
-// { 
-// //return EMCAL SDigitizer
-//  return  dynamic_cast<AliEMCALSDigitizer*>(SDigitizer()) ;
-// }
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::MakeHitsArray()
-{
-  // Create the array for Hits
-  if (Hits()) return;
-  TClonesArray* hits = new TClonesArray("AliEMCALHit",1000);
-  hits->SetName(fgkHitsName);
-  GetDetectorDataFolder()->Add(hits);
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::MakeSDigitsArray()
-{
-  // Create the array for SDigits
-  if ( SDigits()) return;
-  TClonesArray* sdigits = new TClonesArray("AliEMCALDigit",1);
-  sdigits->SetName(fgkSDigitsName);
-  GetDetectorDataFolder()->Add(sdigits);
-}
-
-//____________________________________________________________________________ 
-void AliEMCALLoader::MakeDigitsArray()
-{
-  // Create the array for Digits
-  if ( Digits()) return;
-  TClonesArray* digits = new TClonesArray("AliEMCALDigit",1);
-  digits->SetName(fgkDigitsName);
-  GetDetectorDataFolder()->Add(digits);
-  
-}
+  // SDigits
+  TTree *treeS = TreeS();
+  if (treeS) {
+    treeS->SetBranchAddress(fDetectorName,&fSDigits);
+    treeS->GetEvent(0);
+  }
 
-//____________________________________________________________________________ 
-void AliEMCALLoader::MakeRecPointsArray()
-{
-  // Make recpoints array
-  if ( ECARecPoints() == 0x0) 
-    {
-      AliDebug(9, "Making array for ECA");
-      TObjArray* eca = new TObjArray(100) ;
-      eca->SetName(fgkECARecPointsName) ;
-      GetDetectorDataFolder()->Add(eca);
-    }
-}
+  // Digits
+  TTree *treeD = TreeD();
+  if (treeD) {
+    treeD->SetBranchAddress(fDetectorName,&fDigits);
+    treeD->GetEvent(0);
+  }
 
-//____________________________________________________________________________ 
-void AliEMCALLoader::MakeTrackSegmentsArray()
-{
-  // Create the array for TrackSegments
-  if ( TrackSegments()) 
-    return;
-  TClonesArray * ts = new TClonesArray("AliEMCALTrackSegment",100) ;
-  ts->SetName(fgkTracksName);
-  GetDetectorDataFolder()->Add(ts);
-}
+  // RecPoints
+  TTree *treeR = TreeR();
+  if (treeR) {
+    treeR->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints);
+    treeR->GetEvent(0);
+  }
 
-//____________________________________________________________________________ 
-void AliEMCALLoader::MakeRecParticlesArray()
-{  
-  // Create the array for RecParticles
-  if ( RecParticles()) return;
-  TClonesArray * rp = new TClonesArray("AliEMCALRecParticle",100) ;
-  rp->SetName(fgkRecParticlesName);
-  GetDetectorDataFolder()->Add(rp);
+  return 0;
 }
index f047bcf55839f5e8566ed303c7b7bbaf5f8b0055..d38db613f833cc2027af3e5102cb5fc740208b0a 100644 (file)
@@ -24,29 +24,14 @@ class TString ;
 class TParticle ;
 class TTask ;
 
-// --- Standard library ---
-
 // --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliRunLoader.h"
-#include "AliEMCALDigit.h"
-#include "AliEMCALRecPoint.h"
-#include "AliEMCALTrackSegment.h"
-#include "AliEMCALClusterizer.h"
-#include "AliEMCALTrackSegmentMaker.h" 
-#include "AliEMCALPID.h"
+#include "AliLoader.h"
 class AliLoader ;
 class AliEMCAL ; 
 class AliEMCALHit ;
-class AliEMCALRecParticle ; 
-class AliEMCALGeometry ;
-class AliEMCALDigitizer ; 
-class AliEMCALSDigitizer ; 
-class AliEMCALCalibrationDB ;
-
-
-//
+class AliEMCALDigit ;
+class AliEMCALSDigit ;
+class AliEMCALRecPoint ; 
 
 class AliEMCALLoader : public AliLoader {
   
@@ -61,262 +46,72 @@ class AliEMCALLoader : public AliLoader {
   // assignement operator requested by coding convention, but not needed
   const AliEMCALLoader & operator = (const AliEMCALLoader & ) {return *this;}
 
-  Int_t   GetEvent();//extends the method on EMCAL RecPart posting
-  Int_t   SetEvent();//extends the method on EMCAL RecPart posting
-  
-  Bool_t  BranchExists(const TString& recName);
-  Int_t   LoadHits(Option_t* opt=""); //reads  from disk and sends them to folder; array as well as tree
-  Int_t   LoadSDigits(Option_t* opt="");
-  Int_t   LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree
-  Int_t   LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree
-  Int_t   LoadTracks(Option_t* opt="");  //reads Tracks from disk and sends them to folder; array as well as tree
-  Int_t   LoadRecParticles(Option_t* opt="");
-  void    UnloadRecParticles();
-  void    UnloadTracks();
-  
-  Int_t   PostHits();  //Posts the 
-  Int_t   PostSDigits();
-  Int_t   PostDigits();
-  Int_t   PostRecPoints();
-  Int_t   PostTracks();
-  Int_t   PostRecParticles();
-  
-  void    CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean
-
-  void    CleanHits();
-  void    CleanSDigits();
-  void    CleanDigits();
-  void    CleanRecPoints();
-  void    CleanTracks();
-  void    CleanRecParticles();
-
-//up to now it is only here -> no definition about global/incremental tracking/PID
-//   Int_t   WriteRecParticles(Option_t* opt="");//writes the reconstructed particles
-//   Int_t   WritePID(Option_t* opt="");//writes the task for PID to file
-//   Bool_t  PostPID  (AliEMCALPID * pid) const {return kTRUE;}
-
-/*******************************************************************/
-/*******************************************************************/
-/*******************************************************************/
-
-  TObject** HitsRef(){return GetDetectorDataRef(Hits());}
-  TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());}
-  TObject** DigitsRef(){return GetDetectorDataRef(Digits());}
-  TObject** ECARecPointsRef(){return GetDetectorDataRef(ECARecPoints());}
-  TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());}
-  TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());}
-
-  void   Track(Int_t itrack) ;
+  virtual Int_t GetEvent();  // Overload to fill TClonesArray
+
+  virtual void    CleanHits() const 
+    { if (fHits) fHits->Clear(); AliLoader::CleanHits(); }
+  virtual void    CleanSDigits() const
+    { if (fSDigits) fSDigits->Clear(); AliLoader::CleanSDigits(); }
+  virtual void    CleanDigits() const
+    { if (fDigits) fDigits->Clear(); AliLoader::CleanDigits(); }
+  virtual void    CleanRecPoints() const
+    { if (fRecPoints) fRecPoints->Clear(); AliLoader::CleanRecPoints(); }
+
+  // This does not work due to const
+  /*
+  virtual void   MakeHitsContainer() const { AliLoader::MakeHitsContainer(); TreeH()->Branch(fDetectorName,"TClonesArray",&fHits); }
+  virtual void   MakeSDigitsContainer() const { AliLoader::MakeSDigitsContainer(); TreeS()->SetBranchAddress(fDetectorName,&fSDigits); }
+  virtual void   MakeDigitsContainer() const { AliLoader::MakeDigitsContainer(); TreeD()->SetBranchAddress(fDetectorName,&fDigits); }
+  virtual void   MakeRecPointsContainer() const { AliLoader::MakeRecPointsContainer(); TreeR()->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints); }
+  */
+
+  // ************    TClonesArrays Access functions
+
+  TClonesArray*  Hits(void) { return fHits;}
+
+  const AliEMCALHit*    Hit(Int_t index) {
+    if (fHits)
+      return (const AliEMCALHit*) fHits->At(index);
+    return 0x0; 
+  }
+
+  TClonesArray*  SDigits()  { return fSDigits;}
+  const AliEMCALDigit*  SDigit(Int_t index)  {
+    if (fSDigits)
+      return (const AliEMCALDigit*) fSDigits->At(index);
+    return 0x0; 
+  }
+
+  TClonesArray*   Digits()  { return fDigits;}
+  const AliEMCALDigit *  Digit(Int_t index)  {
+    if (fDigits)
+      return (const AliEMCALDigit*) fDigits->At(index);
+    return 0x0; 
+  }
+
+  TObjArray * RecPoints()  { return fRecPoints;}
+  const AliEMCALRecPoint * RecPoint(Int_t index)  {
+    if (fRecPoints)
+      return (const AliEMCALRecPoint*) fRecPoints->At(index);
+    return 0x0; 
+  }
 
-  static AliEMCALGeometry* GetEMCALGeometry();
-  static AliEMCALLoader* GetEMCALLoader(const  char* eventfoldername);
-
-  //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
-  Int_t  EventNumber()       { return (Int_t) GetRunLoader()->GetEventNumber();}
-  Int_t  MaxEvent()          { return (Int_t) GetRunLoader()->TreeE()->GetEntries();}
-
-  const AliEMCAL *         EMCAL();
-  const AliEMCALGeometry  *EMCALGeometry() ; 
-
-  /*********************************************/
-  /************    TClonesArrays     ***********/
-  /*********************************************/
-  /****   H i t s  ****/
-  TClonesArray*  Hits(void);
-  const AliEMCALHit*    Hit(Int_t index);
-  void MakeHitsArray();
-  /****   S D i g i t s  ****/ 
-  TClonesArray*  SDigits();
-  const AliEMCALDigit*  SDigit(Int_t index);
-  void MakeSDigitsArray();
-  /****  D i g i t s  ****/
-  TClonesArray*   Digits();
-  const AliEMCALDigit *  Digit(Int_t index);
-  void MakeDigitsArray();
-  /****  R e c P o i n t s  ****/
-  TObjArray * ECARecPoints();
-  const AliEMCALRecPoint * ECARecPoint(Int_t index) ;
-  void MakeRecPointsArray();
-  /****   T r a c k S e g m e n t s ****/
-  TClonesArray * TrackSegments();
-  const AliEMCALTrackSegment * TrackSegment(Int_t index);
-  void MakeTrackSegmentsArray();
-  /****  R e c P a r t ic l e s   ****/
-  TClonesArray * RecParticles() ;
-  const AliEMCALRecParticle * RecParticle(Int_t index);
-  void MakeRecParticlesArray();
-
-  /*********************************************/
-  /************    T A S K S      **************/
-  /*********************************************/
-  // 
-  //  AliEMCALSDigitizer*  EMCALSDigitizer(TString name = AliConfig::GetDefaultEventFolderName());
-  //AliEMCALDigitizer*   EMCALDigitizer()  { return  dynamic_cast<AliEMCALDigitizer*>(Digitizer()) ;}
-
-  AliEMCALClusterizer* Clusterizer () const {return dynamic_cast<AliEMCALClusterizer*>(Reconstructioner()) ;}
-  Int_t PostClusterizer(TTask* clust) const {return PostReconstructioner(clust);}
-  Int_t LoadClusterizer(Option_t * opt="") const {return LoadReconstructioner(opt);}
-  Int_t WriteClusterizer(Option_t * opt="") const {return WriteReconstructioner(opt);}
-
-  AliEMCALPID * PID() const {return dynamic_cast<AliEMCALPID*>(PIDTask()) ;}
-  Int_t PostPID(TTask* pid) const {return PostPIDTask(pid);}
-  Int_t LoadPID(Option_t * opt="") const {return LoadPIDTask(opt);}
-  Int_t WritePID(Option_t * opt="") const {return WritePIDTask(opt);}
-
-
-  AliEMCALTrackSegmentMaker * TrackSegmentMaker () const  { return dynamic_cast<AliEMCALTrackSegmentMaker *>(Tracker()) ;}
-  Int_t PostTrackSegmentMaker(TTask* segmaker) const {return PostTracker(segmaker);}
-  Int_t LoadTrackSegmentMaker(Option_t * opt="") const {return LoadTracker(opt);}
-  Int_t WriteTrackSegmentMaker(Option_t * opt="") const  {return WriteTracker(opt);}
-
-  
   void   SetDebug(Int_t level) {fDebug = level;} // Set debug level
-  void   SetBranchTitle(const TString& btitle);
-  
-  AliEMCALCalibrationDB * CalibrationDB(){return  fcdb; }
-  //void ReadCalibrationDB(const char * name, const char * filename);
-  
-
-  static TString HitsName() { return fgkHitsName ; }   //Name for TClonesArray with hits from one event
-  static TString SDigitsName() { return fgkSDigitsName ;} //Name for TClonesArray 
-  static TString DigitsName() { return fgkDigitsName ;} //Name for TClonesArray 
-  static TString ECARecPointsName() { return fgkECARecPointsName ;} //Name for TClonesArray y 
-  static TString TracksName() { return fgkTracksName ;} //Name for TClonesArray 
-  static TString RecParticlesName() { return fgkRecParticlesName ;} //Name for TClonesArray
-  static TString ECARecPointsBranchName() { return fgkECARecPointsBranchName ;} //Name for branch
-  static TString TrackSegmentsBranchName() { return fgkTrackSegmentsBranchName ;} //Name for branch
-  static TString RecParticlesBranchName() { return fgkRecParticlesBranchName ;} //Name for branch
-
-protected:
-  TString fBranchTitle;            //Title of the branch
-  Bool_t  fRecParticlesLoaded;     //Flag signing if Reconstructed Particles are loaded
-  Bool_t  fTracksLoaded;           //Flag signing if Tracks are loaded
-  TString fRecParticlesFileOption; //Loading Option for Reconstructed Particles
-  AliEMCALCalibrationDB * fcdb ;       //!
 
 private:
+  static const TString fgkECARecPointsBranchName; //! Name of branch with ECA Reconstructed Points
 
-  Int_t ReadHits();
-  Int_t ReadDigits();
-  Int_t ReadSDigits();
-  Int_t ReadRecPoints();
-  Int_t ReadTracks();
-  Int_t ReadRecParticles();
-
-  static const TString fgkHitsName;//Name for TClonesArray with hits from one event
-  static const TString fgkSDigitsName;//Name for TClonesArray 
-  static const TString fgkDigitsName;//Name for TClonesArray 
-  static const TString fgkECARecPointsName;//Name for TClonesArray 
-  static const TString fgkTracksName;//Name for TClonesArray 
-  static const TString fgkRecParticlesName;//Name for TClonesArray
-
-  static const TString fgkECARecPointsBranchName;//Name for branch
-  static const TString fgkTrackSegmentsBranchName;//Name for branch
-  static const TString fgkRecParticlesBranchName;//Name for branch
   Int_t  fDebug ;             // Debug level
-
-  
-  ClassDef(AliEMCALLoader,4)  // Algorithm class that provides methods to retrieve objects from a list knowing the index 
 
+  // All data are stored in TTrees on file. 
+  // These TCLonesArrays are temporary storage for reading or writing
+  // (connected to TTrees with SetBranchAddress)
+  TClonesArray     *fHits;         //! TClonesArray of hits (for tree reading)
+  TClonesArray     *fDigits;       //! TClonesArray of digits (for tree reading)
+  TClonesArray     *fSDigits;      //! TClonesArray of sdigits (for tree reading)
+  TObjArray        *fRecPoints;    //! TClonesArray of recpoints (for tree reading)
+  ClassDef(AliEMCALLoader,0)  // Algorithm class that provides methods to retrieve objects from a list knowing the index 
+   
 };
 
-/******************************************************************************/
-/****************    I N L I N E S     ****************************************/
-/******************************************************************************/
-
-inline TClonesArray* AliEMCALLoader::Hits()  
-{
- return (TClonesArray*)GetDetectorData(fgkHitsName);
-}
-/******************************************************************************/
-
-inline const AliEMCALHit* AliEMCALLoader::Hit(Int_t index)  
-{
-  const TClonesArray* tcarr = Hits();
-  if (tcarr)
-    return (const AliEMCALHit*) tcarr->At(index);
-  return 0x0; 
-}
-/******************************************************************************/
-
-inline TClonesArray* AliEMCALLoader::SDigits()
-{
-   return dynamic_cast<TClonesArray*>(GetDetectorData(fgkSDigitsName));
-}
-/******************************************************************************/
-
-inline const AliEMCALDigit*  AliEMCALLoader::SDigit(Int_t index)
-{
-  const TClonesArray* tcarr = SDigits();
-  if (tcarr)
-    return (const AliEMCALDigit*) tcarr->At(index);
-  return 0x0; 
-}
-/******************************************************************************/
-
-inline TClonesArray* AliEMCALLoader::Digits()
-{
- return dynamic_cast<TClonesArray*>(GetDetectorData(fgkDigitsName));
-}
-/******************************************************************************/
-
-inline const AliEMCALDigit*  AliEMCALLoader::Digit(Int_t index)
-{
-  const TClonesArray* tcarr = Digits();
-  if (tcarr)
-    return (const AliEMCALDigit*) tcarr->At(index);
-  return 0x0; 
-}
-
-/******************************************************************************/
-
-inline TObjArray * AliEMCALLoader::ECARecPoints()
-{
- return dynamic_cast<TObjArray*>(GetDetectorData(fgkECARecPointsName));
-}
-
-/******************************************************************************/
-
-inline const AliEMCALRecPoint * AliEMCALLoader::ECARecPoint(Int_t index)
-{
-  TObjArray* tcarr = ECARecPoints();
-  if (tcarr)
-    return dynamic_cast<const AliEMCALRecPoint*>(tcarr->At(index));
-  return 0x0; 
-}
-
-/******************************************************************************/
-
-inline TClonesArray * AliEMCALLoader::TrackSegments()
-{
- return dynamic_cast<TClonesArray*>(GetDetectorData(fgkTracksName));
-}
-/******************************************************************************/
-
-inline const AliEMCALTrackSegment * AliEMCALLoader::TrackSegment(Int_t index)
-{
-  const TClonesArray* tcarr = TrackSegments();
-  if (tcarr)
-    return (const AliEMCALTrackSegment*) tcarr->At(index);
-  return 0x0; 
-}
-/******************************************************************************/
-
-inline TClonesArray * AliEMCALLoader::RecParticles() 
-{
- return dynamic_cast<TClonesArray*>(GetDetectorData(fgkRecParticlesName)); 
-}
-/******************************************************************************/
-
-inline const AliEMCALRecParticle* AliEMCALLoader::RecParticle(Int_t index)
-{
-  TClonesArray* tcarr = RecParticles();
-  if (tcarr)
-    return (const AliEMCALRecParticle*) tcarr->At(index);
-  return 0x0;  
-}
-
 #endif // AliEMCALLOADER_H
index 7157e5ee0dbe2ba7f21fa573a3d9d998d92e1afb..db3d007b98ed5a4e99805ed37b41c3c2b29faa67 100644 (file)
@@ -34,7 +34,6 @@
 #include "AliEMCALGeometry.h"
 #include "AliEMCALDigit.h"
 #include "AliEMCALRecPoint.h"
-#include "AliEMCALGetter.h"
 
 ClassImp(AliEMCALRecPoint)
 
@@ -131,7 +130,8 @@ Bool_t AliEMCALRecPoint::AreNeighbours(AliEMCALDigit * digit1, AliEMCALDigit * d
   
   Bool_t areNeighbours = kFALSE ;
   
-  AliEMCALGeometry * geom =  (AliEMCALGetter::Instance())->EMCALGeometry();
+  //AliEMCALGeometry * geom =  (AliEMCALGetter::Instance())->EMCALGeometry();
+  AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance();
 
   Int_t relid1[2] ; 
     //copied for shish-kebab geometry, ieta,iphi is cast as float as eta,phi conversion
@@ -334,8 +334,9 @@ void  AliEMCALRecPoint::EvalDispersion(Float_t logWeight, TClonesArray * digits)
 
   AliEMCALDigit * digit ;
  
-  AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
-  
+  //AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+  AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance();
+
   // Calculates the centre of gravity in the local EMCAL-module coordinates   
   Int_t iDigit;
 
@@ -401,7 +402,8 @@ void AliEMCALRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * digit
   //  Int_t relid[3] ;
   
   AliEMCALDigit * digit ;
-  AliEMCALGeometry * geom  =  (AliEMCALGetter::Instance())->EMCALGeometry();
+  //AliEMCALGeometry * geom  =  (AliEMCALGetter::Instance())->EMCALGeometry();
+  AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance();
   Int_t iDigit;
   Float_t cluEta = 0;
   Float_t cluPhi = 0;
@@ -455,7 +457,9 @@ void AliEMCALRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits)
 
   AliEMCALDigit * digit ;
   const Float_t kDeg2Rad = TMath::DegToRad() ;
-  AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();    
+  //AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();    
+  AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance();
+
   Int_t iDigit;
 
   if (!fLocPos.X() || !fLocPos.Y() ) {
@@ -490,7 +494,8 @@ void  AliEMCALRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits)
   const Float_t kDeg2Rad = TMath::DegToRad();
   AliEMCALDigit * digit ;
 
-  AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+  //AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+  AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance();
   TString gn(geom->GetName());
 
   Int_t iDigit;
@@ -676,7 +681,8 @@ void AliEMCALRecPoint::GetGlobalPosition(TVector3 & gpos) const
   // returns the position of the cluster in the global reference system of ALICE
   // These are now the Cartesian X, Y and Z
 
-  AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+  //AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+  AliEMCALGeometry * geom =  AliEMCALGeometry::GetInstance();
   Int_t absid = geom->TowerIndexFromEtaPhi(fLocPos.X(), TMath::RadToDeg()*fLocPos.Y());
   geom->XYZFromIndex(absid, gpos);
 }
index 3963a3744a0d159fa4a4788b477a8407ad25f1f6..a79d16b3ac1a86b664a031ad99d689f7c8bc94b1 100644 (file)
@@ -70,7 +70,7 @@ class AliEMCALRecPoint : public AliRecPoint {
     return kTRUE ; 
   }  
   virtual void    Paint(Option_t * option="");
-  virtual void    Print(Option_t * ) const ; 
+  virtual void    Print(Option_t * option="") const ; 
   
   AliEMCALRecPoint & operator = (const AliEMCALRecPoint & )  {
     Fatal("operator =", "not implemented") ;
index d5caaded9a3e494ecec313060e3ef8a5b08cd1ad..6e4d388eafb3ef6bfaf2c2639d996fe5bd199a28 100644 (file)
 // --- Standard library ---
 
 // --- AliRoot header files ---
-#include "AliESD.h"
 #include "AliEMCALReconstructor.h"
+
+#include "AliESD.h"
+#include "AliRunLoader.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCALClusterizerv1.h"
-#include "AliEMCALPIDv1.h"
-#include "AliEMCALGetter.h"
+#include "AliEMCALRecPoint.h"
 #include "AliRawReaderFile.h"
 
 ClassImp(AliEMCALReconstructor)
@@ -70,7 +72,7 @@ void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const
 }
 
 //____________________________________________________________________________
-void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReaderFile* rawreader) const 
+void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const 
 {
   // method called by AliReconstruction; 
   // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
@@ -95,41 +97,46 @@ void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReaderFil
 void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
 {
   // Called by AliReconstruct after Reconstruct() and global tracking and vertxing 
-  //Creates the tracksegments and Recparticles
   
   Int_t eventNumber = runLoader->GetEventNumber() ;
 
   TString headerFile(runLoader->GetFileName()) ; 
   TString branchName(runLoader->GetEventFolder()->GetName()) ;  
 
-  AliEMCALPIDv1 pid(headerFile, branchName);
-
+  // PID is not implemented. Skipping for now
+  //AliEMCALPIDv1 pid(headerFile, branchName);
 
   // do current event; the loop over events is done by AliReconstruction::Run()
+  /*
   pid.SetEventRange(eventNumber, eventNumber) ; 
   if ( Debug() ) 
     pid.ExecuteTask("deb all") ;
   else 
     pid.ExecuteTask("") ;
-  // Creates AliESDtrack from AliEMCALRecParticles 
-  AliEMCALGetter::Instance()->Event(eventNumber, "P") ; 
-  TClonesArray *recParticles = AliEMCALGetter::Instance()->RecParticles();
-  Int_t nOfRecParticles = recParticles->GetEntries();
-  esd->SetNumberOfEMCALParticles(nOfRecParticles) ; 
+  */
+
+  // Creates AliESDtrack from AliEMCALRecPoints 
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
+  rl->LoadRecPoints();
+  rl->GetEvent(eventNumber);
+  TObjArray *clusters = emcalLoader->RecPoints();
+  Int_t nClusters = clusters->GetEntries();
+  esd->SetNumberOfEMCALParticles(nClusters) ; 
   esd->SetFirstEMCALParticle(esd->GetNumberOfTracks()) ; 
-  for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
-    AliEMCALRecParticle * rp = dynamic_cast<AliEMCALRecParticle*>(recParticles->At(recpart));
+  for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
+    const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust);
     if (Debug()) 
-      rp->Print();
+      clust->Print();
     AliESDtrack * et = new AliESDtrack() ; 
     // fills the ESDtrack
     Double_t xyz[3];
+    TVector3 gpos;
+    clust->GetGlobalPosition(gpos);
     for (Int_t ixyz=0; ixyz<3; ixyz++) 
-      xyz[ixyz] = rp->GetPos()[ixyz];
+      xyz[ixyz] = gpos[ixyz];
     et->SetEMCALposition(xyz) ; 
-    et->SetEMCALsignal  (rp->Energy()) ; 
-    et->SetEMCALpid     (rp->GetPID()) ;
+    et->SetEMCALsignal  (clust->GetEnergy()) ; 
     // add the track to the esd object
     esd->AddTrack(et);
     delete et;
index fad05183984438032c3ea80431724e154cfccc7b..c52b3ce425a751fafcaee28c1d749ca51372155e 100644 (file)
@@ -42,7 +42,7 @@ public:
   Bool_t                     Debug() const { return fDebug ; }
   virtual void               FillESD(AliRunLoader* runLoader, AliESD* esd) const ;
   virtual void               Reconstruct(AliRunLoader* runLoader) const ;
-  virtual void               Reconstruct(AliRunLoader* runLoader, AliRawReaderFile * rawreader) const ;
+  virtual void               Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const ;
   
   
   AliEMCALReconstructor & operator = (const AliEMCALReconstructor & /*rvalue*/)  {
index ea1b7e79e968191f2480398d83d0637f71def82e..103f1c76e6021685c66bfc89a673bfd495d2517f 100644 (file)
@@ -52,6 +52,7 @@
 #include "TBenchmark.h"
 #include "TH1.h"
 #include "TBrowser.h"
+#include "Riostream.h"
 //#include "TObjectTable.h"
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliLog.h"
+#include "AliRunLoader.h"
+#include "AliStack.h"
 #include "AliEMCALDigit.h"
-#include "AliEMCALGetter.h"
+#include "AliEMCALLoader.h"
 #include "AliEMCALHit.h"
 #include "AliEMCALSDigitizer.h"
 #include "AliEMCALGeometry.h"
 #include "AliEMCALJetMicroDst.h"
-//#include "AliMemoryWatcher.h"
 
 ClassImp(AliEMCALSDigitizer)
            
@@ -111,11 +113,9 @@ AliEMCALSDigitizer::AliEMCALSDigitizer(const AliEMCALSDigitizer & sd) : TTask(sd
 
 //____________________________________________________________________________ 
 AliEMCALSDigitizer::~AliEMCALSDigitizer() {
-  // dtor
-  AliEMCALGetter * gime = 
-    //   AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data());  
-    AliEMCALGetter::Instance();  
-  gime->EmcalLoader()->CleanSDigitizer();
+  AliLoader *emcalLoader=0;
+  if ((emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")))
+      emcalLoader->CleanSDigitizer();
 }
 
 //____________________________________________________________________________ 
@@ -129,28 +129,22 @@ void AliEMCALSDigitizer::Init(){
 
   fInit = kTRUE ; 
    
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data());  
-  if ( gime == 0 ) {
-    Fatal("Init", "Could not obtain the Getter objectfor file %s and event %s !", GetTitle(), fEventFolderName.Data()) ;  
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+
+  if ( emcalLoader == 0 ) {
+    Fatal("Init", "Could not obtain the AliEMCALLoader");
     return ;
   } 
   
-  TString opt("SDigits") ; 
-  if(gime->VersionExists(opt) ) { 
-    Error( "Init", "Give a version name different from %s", fEventFolderName.Data() ) ;
-    fInit = kFALSE ; 
-  }
-  
-  gime->PostSDigitizer(this);
-  gime->EmcalLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
+  emcalLoader->PostSDigitizer(this);
+  emcalLoader->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
   
 }
 
 //____________________________________________________________________________ 
 void AliEMCALSDigitizer::InitParameters()
 {
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
-  const AliEMCALGeometry * geom = gime->EMCALGeometry() ; 
+  const AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
   if (geom->GetSampling() == 0.) {
     Fatal("InitParameters", "Sampling factor not set !") ; 
   }
@@ -176,8 +170,8 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
   if(strstr(option,"tim"))
     gBenchmark->Start("EMCALSDigitizer");
 
-  //AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+  AliRunLoader *rl = AliRunLoader::GetRunLoader();
+  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
 
   //switch off reloading of this task while getting event
   if (!fInit) { // to prevent overwrite existing file
@@ -186,31 +180,39 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
     }
 
   if (fLastEvent == -1) 
-    fLastEvent = gime->MaxEvent() - 1 ;
+    fLastEvent = rl->GetNumberOfEvents() - 1 ;
   else {
-    fLastEvent = TMath::Min(fLastEvent, gime->MaxEvent()-1);
+    fLastEvent = TMath::Min(fLastEvent, rl->GetNumberOfEvents()-1);
   }
   Int_t nEvents   = fLastEvent - fFirstEvent + 1;
 
   Int_t ievent;
   Float_t energy=0.; // de * fSampling - 23-nov-04
+  rl->LoadKinematics();
+  rl->LoadHits("EMCAL");
+
   for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
-    gime->Event(ievent,"XH"); // read primaries and hits onl  
-    TTree * treeS = gime->TreeS(); 
-    TClonesArray * hits = gime->Hits() ; 
-    TClonesArray * sdigits = gime->SDigits() ;
+    rl->GetEvent(ievent);
+    TTree * treeS = emcalLoader->TreeS();
+    if ( !treeS ) { 
+      emcalLoader->MakeSDigitsContainer();
+      treeS = emcalLoader->TreeS();
+    }
+    TClonesArray * hits = emcalLoader->Hits() ; 
+    TClonesArray * sdigits = emcalLoader->SDigits() ;
     sdigits->Clear();
     Int_t nSdigits = 0 ;
     //Now make SDigits from hits, for EMCAL it is the same, so just copy    
-    Int_t nPrim =  static_cast<Int_t>((gime->TreeH())->GetEntries()) ; 
+    Int_t nPrim =  static_cast<Int_t>((emcalLoader->TreeH())->GetEntries()) ; 
+    // This is not true: there is only one list of hits (MvL jan 2006)
     // Attention nPrim is the number of primaries tracked by Geant 
-    // and this number could be different to the number of Primaries in TreeK;
+    // and this number could be different to the number of Primaries in TreeK; 
     Int_t iprim ;
     for ( iprim = 0 ; iprim < nPrim ; iprim++ ) { 
       //=========== Get the EMCAL branch from Hits Tree for the Primary iprim
-      gime->Track(iprim) ;
+      rl->Stack()->Particle(iprim) ;
       Int_t i;
-      AliEMCALGeometry *geom = gime->EMCALGeometry(); 
+      AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance(); 
       for ( i = 0 ; i < hits->GetEntries() ; i++ ) {
        AliEMCALHit * hit = dynamic_cast<AliEMCALHit*>(hits->At(i)) ;
        AliEMCALDigit * curSDigit = 0 ;
@@ -233,16 +235,16 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
        } else {
           Warning("Exec"," abs id %i is bad \n", hit->GetId());
           newsdigit = kFALSE;
+         curSDigit = 0;
         }
 
-       Int_t check = 0 ;
-
-       for(check= 0; check < nSdigits ; check++) {
-         sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(check)) ;
-          if(curSDigit != 0){
+       if(curSDigit != 0){
+         for(Int_t check= 0; check < nSdigits ; check++) {
+           sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(check)) ;
+           
            if( sdigit->GetId() == curSDigit->GetId()) { // Are we in the same ECAL tower ?              
-           *sdigit = *sdigit + *curSDigit;
-           newsdigit = kFALSE;
+             *sdigit = *sdigit + *curSDigit;
+             newsdigit = kFALSE;
            }
          }
        }
@@ -257,7 +259,6 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
     
     nSdigits = sdigits->GetEntriesFast() ;
     fSDigitsInRun += nSdigits ;  
-    sdigits->Expand(nSdigits) ;
 
     Int_t nPrimarymax = -1 ; 
     Int_t i ;
@@ -279,38 +280,36 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
       if (((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) > nPrimarymax)
        nPrimarymax = ((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) ;
     }
-    
+
     // Now write SDigits    
-    //First list of sdigits
 
     Int_t bufferSize = 32000 ;    
-    TBranch * sdigitsBranch = treeS->Branch("EMCAL",&sdigits,bufferSize);
+    TBranch * sdigitsBranch = treeS->GetBranch("EMCAL");
+    if (sdigitsBranch)
+      sdigitsBranch->SetAddress(&sdigits);
+    else
+      treeS->Branch("EMCAL",&sdigits,bufferSize);
  
-    sdigitsBranch->Fill() ;
-
-    gime->WriteSDigits("OVERWRITE");
+    treeS->Fill();
+    
+    emcalLoader->WriteSDigits("OVERWRITE");
     
     //NEXT - SDigitizer
-    gime->WriteSDigitizer("OVERWRITE");  // why in event cycle ?
+    emcalLoader->WriteSDigitizer("OVERWRITE");  // why in event cycle ?
     
     if(strstr(option,"deb"))
       PrintSDigits(option) ;  
   }
-  //  gime->WriteSDigitizer("OVERWRITE"); // 12-jan-04
 
   Unload();
   
-  gime->EmcalLoader()->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
+  emcalLoader->GetSDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE);
   
   if(strstr(option,"tim")){
     gBenchmark->Stop("EMCALSDigitizer"); 
     printf("\n Exec: took %f seconds for SDigitizing %f seconds per event\n", 
         gBenchmark->GetCpuTime("EMCALSDigitizer"), gBenchmark->GetCpuTime("EMCALSDigitizer")/nEvents ) ; 
   }
-
-  //TFile f("out.root","RECREATE");
-  //memwatcher.WriteToFile(); 
-  //f.Close();
 }
 
 
@@ -321,7 +320,7 @@ void AliEMCALSDigitizer::Print1(Option_t * option)
 }
 
 //__________________________________________________________________
-void AliEMCALSDigitizer::Print() const
+void AliEMCALSDigitizer::Print(Option_t *option) const
 { 
   // Prints parameters of SDigitizer
   printf("Print: \n------------------- %s -------------\n", GetName() ) ; 
@@ -354,11 +353,12 @@ void AliEMCALSDigitizer::PrintSDigits(Option_t * option)
   //Prints list of digits produced at the current pass of AliEMCALDigitizer
   
   
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
-  const TClonesArray * sdigits = gime->SDigits() ; 
+  // AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
+  AliEMCALLoader *rl = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  const TClonesArray * sdigits = rl->SDigits() ; 
   
   printf("\n") ;  
-  printf("event %i", gAlice->GetEvNumber()) ;
+  printf("event %i", rl->GetRunLoader()->GetEventNumber());
   printf(" Number of entries in SDigits list %i", sdigits->GetEntriesFast()); 
   if(strstr(option,"all")||strstr(option,"EMC")){
     
@@ -389,10 +389,9 @@ void AliEMCALSDigitizer::PrintSDigits(Option_t * option)
 void AliEMCALSDigitizer::Unload() const
 {
   // Unload Hits and SDigits from the folder
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
-  AliEMCALLoader * loader = gime->EmcalLoader() ; 
-  loader->UnloadHits() ; 
-  loader->UnloadSDigits() ; 
+  AliEMCALLoader *rl = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
+  rl->UnloadHits() ; 
+  rl->UnloadSDigits() ; 
 }
 
 void AliEMCALSDigitizer::Browse(TBrowser* b)
@@ -404,8 +403,7 @@ void AliEMCALSDigitizer::Browse(TBrowser* b)
 TList *AliEMCALSDigitizer::BookControlHists(int var)
 { // 22-nov-04
   gROOT->cd();
-  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName);
-  const AliEMCALGeometry *geom = gime->EMCALGeometry() ;
+  const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance() ;
   if(var>=1){
     new TH1F("HSDigiN",  "#EMCAL  sdigits ", 1001, -0.5, 1000.5);
     new TH1F("HSDigiSumEnergy","Sum.EMCAL energy", 1000, 0.0, 100.);
@@ -415,6 +413,7 @@ TList *AliEMCALSDigitizer::BookControlHists(int var)
     geom->GetNCells(), 0.5, Double_t(geom->GetNCells())+0.5);
   }
   fHists = sv::MoveHistsToList("EmcalSDigiControlHists", kFALSE);
+  fHists = 0;
   return fHists;
 }
 
index 3948176d8661a518047b58f99beb43839f05f18a..a983a4d7e8c29a8d3a142ef5efc6cdc63345d688 100644 (file)
@@ -38,7 +38,7 @@ public:
   Int_t         Digitize(Float_t energy)const { return (Int_t ) (fA + energy*fB); }
   virtual void  Exec(Option_t *option); 
   Int_t         GetSDigitsInRun() const {return fSDigitsInRun ;}  
-  virtual void  Print() const;
+  virtual void  Print(Option_t *option="") const;
   void          Print1(Option_t *option="all");  // *MENU*
   void          SetEventFolderName(TString name) { fEventFolderName = name ; }
   void          SetEventRange(Int_t first=0, Int_t last=-1) {fFirstEvent=first; fLastEvent=last; }
index 3a08bd38984622d915fdcf01486116bf3cfa0114..7a07521e46389c65407f9d39559fedd00df0ff42 100644 (file)
@@ -42,7 +42,6 @@
 #include "AliHeader.h"
 #include "AliMC.h"
 #include "AliPoints.h"
-#include "AliEMCALGetter.h"
 // for TRD1,2 case
 
 ClassImp(AliEMCALv2)
index 947ad2581147aa6b46df6d9c688240d53d85383f..167b09161334e4ee14549435499ef65223c27940 100644 (file)
@@ -9,11 +9,8 @@
 #pragma link C++ class AliEMCALv0+;
 #pragma link C++ class AliEMCALv1+;
 #pragma link C++ class AliEMCALv2+;
-//#pragma link C++ class AliEMCALv3+;
 #pragma link C++ class AliEMCALHit+;
-//#pragma link C++ class AliEMCALHitv1+;
 #pragma link C++ class AliEMCALLoader+;        
-#pragma link C++ class AliEMCALGetter+;
 #pragma link C++ class AliEMCALGeneratorFactory+;
 #pragma link C++ class AliEMCALShishKebabModule+;
 #pragma link C++ class AliEMCALShishKebabTrd1Module+;
@@ -24,8 +21,6 @@
 #pragma link C++ class AliEMCALRecPoint+;
 #pragma link C++ class AliEMCALRawStream+;
 #pragma link C++ class AliEMCALClusterizer+;
-#pragma link C++ class AliEMCALPID+;
-#pragma link C++ class AliEMCALTrackSegmentMaker+;
 #pragma link C++ class AliEMCALSDigitizer+;
 #pragma link C++ class AliEMCALDigitizer+;
 #pragma link C++ class AliEMCALDigit+;
index 1f14666d061097ca2301d25869c01f2c6599ee2c..339f1116ea16b74fc2f09d9437a17733a16d52ea 100644 (file)
@@ -14,6 +14,7 @@
 #pragma link C++ enum  AliEMCALJetFinderAlgoUA1FillUnitFlagType_t;
 // -
 #pragma link C++ class AliEMCALReconstructor+;
+#pragma link C++ class AliEMCALClusterizerv1+;
 #pragma link C++ class AliEMCALJetFinder+;
 #pragma link C++ class AliEMCALJetFinderInput+;
 #pragma link C++ class AliEMCALJetFinderInputPrep+;
 #pragma link C++ class AliEMCALJetFinderAlgoOmni+;
 #pragma link C++ class AliEMCALJetFinderAlgoUA1Unit+;
 #pragma link C++ class AliEMCALJetFinderPlots+;
-#pragma link C++ class AliEMCALClusterizerv1+;
-#pragma link C++ class AliEMCALLink+;          
-#pragma link C++ class AliEMCALTracker+;
-#pragma link C++ class AliEMCALTrackSegment+;          
-#pragma link C++ class AliEMCALTrackSegmentMakerv1+;           
-#pragma link C++ class AliEMCALRecParticle+;           
-#pragma link C++ class AliEMCALFastRecParticle+;               
-#pragma link C++ class AliEMCALPIDv1+;
 #pragma link C++ class AliEMCALJetMicroDst+;
 #pragma link C++ class AliEMCALHadronCorrection+;               
 #pragma link C++ class AliEMCALHadronCorrectionv0+;
index 4fb0d2205942c92e028490f12d1b778de8c8e1fc..c72ac14843a68701ef9613748da77df57abdd9eb 100644 (file)
@@ -8,7 +8,6 @@ AliEMCALv1.cxx \
 AliEMCALv2.cxx \
 AliEMCALHit.cxx \
 AliEMCALLoader.cxx \
-AliEMCALGetter.cxx \
 AliEMCALGeneratorFactory.cxx \
 AliEMCALShishKebabModule.cxx \
 AliEMCALShishKebabTrd1Module.cxx \
@@ -19,11 +18,9 @@ AliEMCALParton.cxx \
 AliEMCALRecPoint.cxx \
 AliEMCALRawStream.cxx \
 AliEMCALClusterizer.cxx \
-AliEMCALPID.cxx \
-AliEMCALTrackSegmentMaker.cxx \
 AliEMCALSDigitizer.cxx \
 AliEMCALDigitizer.cxx \
-AliEMCALDigit.cxx
+AliEMCALDigit.cxx 
 
 HDRS= $(SRCS:.cxx=.h) 
 
index 7fee40f9548537278da06e5b5ba094c3dc4bfe19..397538f134cb2313640e932ffb504aa31d470fbc 100644 (file)
@@ -3,6 +3,7 @@ FSRCS = jet_finder_ua1.F
 
 SRCS =\
 AliEMCALReconstructor.cxx \
+AliEMCALClusterizerv1.cxx \
 AliEMCALJetFinder.cxx \
 AliEMCALJetFinderInput.cxx \
 AliEMCALJetFinderInputSimPrep.cxx \
@@ -12,14 +13,6 @@ AliEMCALJetFinderAlgo.cxx \
 AliEMCALJetFinderAlgoOmni.cxx \
 AliEMCALJetFinderAlgoUA1Unit.cxx \
 AliEMCALJetFinderPlots.cxx \
-AliEMCALClusterizerv1.cxx \
-AliEMCALLink.cxx \
-AliEMCALTracker.cxx \
-AliEMCALTrackSegment.cxx \
-AliEMCALTrackSegmentMakerv1.cxx \
-AliEMCALRecParticle.cxx \
-AliEMCALFastRecParticle.cxx \
-AliEMCALPIDv1.cxx \
 AliEMCALJetMicroDst.cxx \
 AliEMCALHadronCorrection.cxx \
 AliEMCALHadronCorrectionv0.cxx \