]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALJetFinderAlgo.cxx
Reorganization + comment added
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALJetFinderAlgo.cxx
index a715ce8b66384cfb187fedd85187fe2d068c80e5..c176af93502287ec760929f6fd73929aa10e3b59 100755 (executable)
@@ -18,9 +18,9 @@
 
 //_________________________________________________________________________
 //  Base Class for JetFinder Algorithms     
-//                  
+// --                  
 //*-- Author: Mark Horner (LBL/UCT)
-
+// --
 
 
 
@@ -33,26 +33,45 @@ ClassImp(AliEMCALJetFinderAlgo)
 AliEMCALJetFinderAlgo::AliEMCALJetFinderAlgo()
 {
    fDebug =0;
+   fOutputPointer=0;
+   fInputPointer=0;
+   fOutputAllocated=kFALSE;
 }
-  AliEMCALJetFinderAlgo::~AliEMCALJetFinderAlgo()
+
+AliEMCALJetFinderAlgo::~AliEMCALJetFinderAlgo()
 {
+  if (fOutputAllocated)
+    delete fOutputPointer;
+}
 
+void AliEMCALJetFinderAlgo::SetOutput(AliEMCALJetFinderOutput* output) {
+  if (fOutputAllocated)
+    delete fOutputPointer;
+  fOutputPointer=output;
+  fOutputAllocated=kFALSE;
 }
 
 void AliEMCALJetFinderAlgo::InitInput(AliEMCALJetFinderInput* input)
-{      
+{
+// Take input data     
 if (fDebug>1) Info("InitInput","Beginning InitInput");         
-       fInputPointer = input; 
-       fOutputObject.Reset(kResetAll); 
+       fInputPointer = input;
+       if (fOutputPointer==0) {
+         
+         if (fDebug>1) Info("InitInput","Allocating output object");           
+         fOutputPointer=new AliEMCALJetFinderOutput();
+         fOutputAllocated=kTRUE;
+       }
+       fOutputPointer->Reset(kResetAll);       
        // automatically copy parton and particle info to output object
         
        for (Int_t counter = 0 ; counter < fInputPointer->GetNPartons();counter++)
        {
-               fOutputObject.AddParton(fInputPointer->GetParton(counter));
+               fOutputPointer->AddParton(fInputPointer->GetParton(counter));
        }
        for (Int_t counter = 0 ; counter < fInputPointer->GetNParticles();counter++)
        {
-               fOutputObject.AddParticle(fInputPointer->GetParticle(counter));
+               fOutputPointer->AddParticle(fInputPointer->GetParticle(counter));
        }
 }