Compatibility with ROOT trunk
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveEMCALData.cxx
index 029da42..ea40eaf 100644 (file)
@@ -19,6 +19,7 @@
 #include <TLorentzVector.h>
 
 #include "AliRunLoader.h"
+#include "AliEMCAL.h"
 #include "AliEMCALLoader.h"
 #include "AliESDVertex.h"
 #include "AliEMCALHit.h"
@@ -41,7 +42,8 @@ class AliEMCAL;
 class AliEMCALGeometry;
 class AliEveEMCALSModule;
 
-
+using std::cout;
+using std::endl;
 ClassImp(AliEveEMCALData)
 
 //______________________________________________________________________________
@@ -356,34 +358,44 @@ void AliEveEMCALData::LoadHitsFromEMCALLoader(AliEMCALLoader* const emcl)
   // Get hit information from EMCAL Loader
   //
 
-  AliEMCALHit* hit;
+       AliEMCALHit* hit;
   
-  //Fill array of hits                                                                        
-  TClonesArray *hits = (TClonesArray*)emcl->Hits();
-
-  //Get hits from the list                                                                    
-  for(Int_t ihit = 0; ihit< hits->GetEntries();ihit++){
-
-    hit = static_cast<AliEMCALHit *>(hits->At(ihit)) ;
+       //Fill array of hits                                                                        
+       TClonesArray *hits = 0;//(TClonesArray*)emcl->Hits();
+       TTree *treeH = emcl->TreeH();   
+       if (treeH) {
+               Int_t nTrack = treeH->GetEntries();  // TreeH has array of hits for every primary
+               TBranch * branchH = treeH->GetBranch("EMCAL");
+               //if(fHits)fHits->Clear();
+               branchH->SetAddress(&hits);
+               for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
+                       branchH->GetEntry(iTrack);
+                       
+                       //Get hits from the list                                                                    
+                       for(Int_t ihit = 0; ihit< hits->GetEntries();ihit++){
+
+                               hit = static_cast<AliEMCALHit *>(hits->At(ihit)) ;
     
-    if(hit != 0){
-      if(fDebug>1) cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl;
-
-      Int_t id = hit->GetId();
-      // These are local coordinates
-      Double_t xl = 0.; Double_t yl = 0.; Double_t zl = 0.;
-      // Get global coordinates
-      Double_t x = hit->X();
-      Double_t y = hit->Y();
-      Double_t z = hit->Z();
-      Double_t amp = hit->GetEnergy();
-      Int_t iSupMod = 0;
-      // Get SM Id
-      GetGeomInfo(id,iSupMod,xl,yl,zl);
-      fSM[iSupMod]->RegisterHit(id,iSupMod,amp,x,y,z);
-    }
-  }
-  
+                               if(hit != 0){
+                                       if(fDebug>1) cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl;
+
+                                       Int_t id = hit->GetId();
+                                       // These are local coordinates
+                                       Double_t xl = 0.; Double_t yl = 0.; Double_t zl = 0.;
+                                       // Get global coordinates
+                                       Double_t x = hit->X();
+                                       Double_t y = hit->Y();
+                                       Double_t z = hit->Z();
+                                       Double_t amp = hit->GetEnergy();
+                                       Int_t iSupMod = 0;
+                                       // Get SM Id
+                                       GetGeomInfo(id,iSupMod,xl,yl,zl);
+                                       fSM[iSupMod]->RegisterHit(id,iSupMod,amp,x,y,z);
+                               }//hit exists
+                       }//hit loop
+                       hits->Clear();
+               }// track loop
+       }//treeH exists
 }
 
 //______________________________________________________________________________
@@ -464,7 +476,7 @@ void AliEveEMCALData::LoadDigitsFromEMCALLoader(AliEMCALLoader* const emcl)
      dig = static_cast<AliEMCALDigit *>(digits->At(idig)) ;
 
      if(dig != 0){
-       if(fDebug>1) cout << "Digit info " << dig->GetId() << " " << dig->GetAmp() << endl;
+       if(fDebug>1) cout << "Digit info " << dig->GetId() << " " << dig->GetAmplitude() << endl;
        id   = dig->GetId() ; //cell (digit) label
        // adc
        ampFlo  = dig->GetAmplitude(); //amplitude in cell (digit)
@@ -631,8 +643,6 @@ void AliEveEMCALData::LoadRecPointsFromESD()
   Int_t nclus = caloClusters->GetEntries();
   cout << "nclus: " << nclus << endl; 
   
-  if(!caloClusters) return;
-
   for (Int_t iclus =  0; iclus <  nclus; iclus++) 
     {
       AliESDCaloCluster *clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; 
@@ -642,7 +652,7 @@ void AliEveEMCALData::LoadRecPointsFromESD()
       // adc
       //      Int_t   eneInt = (Int_t)energy*500+0.5;
       Double_t eneInt = energy/0.0153; // To be modified with correct OCDB conversion
-      Double_t disp   = clus->GetClusterDisp() ;
+      Double_t disp   = clus->GetDispersion() ;
       
       clus->GetPosition(pos) ; // Global position
       TVector3 vpos(pos[0],pos[1],pos[2]) ;