]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSLoader.cxx
Updated histogram limits (PHOS energy)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSLoader.cxx
index d76e6fa09c833ee7b7b0955a4a351508fdc07095..bd88259f52f6323e8ebb30ef860498dd1565af66 100644 (file)
@@ -73,7 +73,6 @@
 #include "AliPHOS.h"
 #include "AliPHOSHit.h"
 #include "AliPHOSCalibrationDB.h"
-#include "AliPHOSGetter.h"
 
 ClassImp(AliPHOSLoader)
 
@@ -91,29 +90,31 @@ const TString AliPHOSLoader::fgkCpvRecPointsBranchName("PHOSCpvRP");//Name for b
 const TString AliPHOSLoader::fgkTrackSegmentsBranchName("PHOSTS");//Name for branch with TrackSegments
 const TString AliPHOSLoader::fgkRecParticlesBranchName("PHOSRP");//Name for branch with Reconstructed Particles
 //____________________________________________________________________________ 
-AliPHOSLoader::AliPHOSLoader() : fBranchTitle(), fcdb(0), fDebug(0)
+AliPHOSLoader::AliPHOSLoader() : fBranchTitle(), fcdb(0), fDebug(0), fTmpHits(0x0)
 {
   //def ctor
+  fTmpHits =  new TClonesArray("AliPHOSHit",1000);
 }
 //____________________________________________________________________________ 
 AliPHOSLoader::AliPHOSLoader(const Char_t *detname,const Char_t *eventfoldername) :
       AliLoader(detname, eventfoldername),
-      fBranchTitle(), fcdb(0), fDebug(0)
+      fBranchTitle(), fcdb(0), fDebug(0), fTmpHits(0x0)
 {
   //ctor
 }
 //____________________________________________________________________________ 
 AliPHOSLoader::AliPHOSLoader(const Char_t *detname,TFolder *topfolder):
-      AliLoader(detname,topfolder),
-      fBranchTitle(), fcdb(0), fDebug(0)
+  AliLoader(detname,topfolder),
+  fBranchTitle(), fcdb(0), fDebug(0), fTmpHits(0x0)
 
 {
   //ctor
+  fTmpHits =  new TClonesArray("AliPHOSHit",1000);
 }
 //____________________________________________________________________________ 
 AliPHOSLoader::AliPHOSLoader(const AliPHOSLoader & obj):
   AliLoader(obj),fBranchTitle(obj.GetBranchTitle()),fcdb(obj.CalibrationDB()),
-  fDebug(obj.GetDebug())
+  fDebug(obj.GetDebug()),fTmpHits(obj.fTmpHits)
 {
   // Copy constructor
 }
@@ -130,10 +131,6 @@ AliPHOSLoader::~AliPHOSLoader()
   Clean(fgkTracksName);
   Clean(fgkRecParticlesName);
   CleanFolders() ;
-//   // set to 0x0 the objgetter in AliGetter ... weird isn it !
-//   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; // (AliLoader::GetRunLoader()->GetFileName()).Data()) ; 
-//   if (gime) 
-//     gime->Reset() ;
 }
 
 //____________________________________________________________________________ 
@@ -197,16 +194,16 @@ Int_t AliPHOSLoader::GetEvent()
   return 0;
 }
 
-//____________________________________________________________________________ 
-const AliPHOS * AliPHOSLoader::PHOS() 
-{
-  // returns the PHOS object 
-  AliPHOS * phos = dynamic_cast<AliPHOS*>(GetModulesFolder()->FindObject(fDetectorName));
-  if ( phos == 0x0) 
-    if (fDebug)
-      cout << "WARNING: AliPHOSLoader::PHOS -> PHOS module not found in Folders" << endl ; 
-  return phos ; 
-}  
+// //____________________________________________________________________________ 
+// const AliPHOS * AliPHOSLoader::PHOS() 
+// {
+//   // returns the PHOS object 
+//   AliPHOS * phos = dynamic_cast<AliPHOS*>(GetModulesFolder()->FindObject(fDetectorName));
+//   if ( phos == 0x0) 
+//     if (fDebug)
+//       cout << "WARNING: AliPHOSLoader::PHOS -> PHOS module not found in Folders" << endl ; 
+//   return phos ; 
+// }  
 
 //____________________________________________________________________________ 
 Int_t AliPHOSLoader::LoadHits(Option_t* opt)
@@ -407,58 +404,47 @@ Int_t AliPHOSLoader::ReadHits()
 // Reads data from TreeH and stores it in TClonesArray that sits in DetectorDataFolder
 //
   TObject** hitref = HitsRef();
-  if(hitref == 0x0)
-   {
-     MakeHitsArray();
-     hitref = HitsRef();
-   }
+  if(hitref == 0x0) {
+    MakeHitsArray();
+    hitref = HitsRef();
+  }
 
   TClonesArray* hits = dynamic_cast<TClonesArray*>(*hitref);
 
   TTree* treeh = TreeH();
   
-  if(treeh == 0)
-   {
+  if(treeh == 0) {
     AliError("Cannot read TreeH from folder");
     return 1;
   }
   
   TBranch * hitsbranch = treeh->GetBranch(fDetectorName);
-  if (hitsbranch == 0) 
-   {
+  if (hitsbranch == 0) {
     AliError("Cannot find branch PHOS"); 
     return 1;
   }
 
   AliDebug(1, "Reading Hits");
   
-  if (hitsbranch->GetEntries() > 1)
-   {
-    TClonesArray * tempo =  new TClonesArray("AliPHOSHit",1000);
+  if (hitsbranch->GetEntries() > 1) {
 
-    hitsbranch->SetAddress(&tempo);
+    hitsbranch->SetAddress(&fTmpHits);
     Int_t index = 0 ; 
-    Int_t i = 0 ;
-    for (i = 0 ; i < hitsbranch->GetEntries(); i++) 
-     {
+    for (Int_t i = 0 ; i < hitsbranch->GetEntries(); i++) {
       hitsbranch->GetEntry(i) ;
-      Int_t j = 0 ;
-      for ( j = 0 ; j < tempo->GetEntries() ; j++) 
-       {
-         AliPHOSHit* hit = (AliPHOSHit*)tempo->At(j); 
-         new((*hits)[index]) AliPHOSHit( *hit ) ;
-         index++ ; 
-       }
-     }
-    tempo->Delete();
-    delete tempo;
-   }
-  else 
-   {
+      for (Int_t j = 0 ; j < fTmpHits->GetEntriesFast() ; j++) {
+       AliPHOSHit* hit = (AliPHOSHit*)fTmpHits->At(j); 
+       new((*hits)[index]) AliPHOSHit( *hit ) ;
+       index++ ; 
+      }
+    }
+    fTmpHits->Clear();
+  }
+  else {
     hitsbranch->SetAddress(hitref);
     hitsbranch->GetEntry(0) ;
-   }
-
+  }
+  
   return 0;
 }
 //____________________________________________________________________________