]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/EMCALJetTasks/AliJetEmbeddingTask.cxx
name of task
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / AliJetEmbeddingTask.cxx
index 982f12c7ed0d40a466ec80c1c9352e7fdb7d82dd..3792a1762da2f2742d763ef6d66e1ef924147218 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Jet embedding task.
 //
-// Author: Salvatore Aiola, Constantin Loizides
+// Author: S.Aiola, C.Loizides
 
 #include <TClonesArray.h>
 #include <TLorentzVector.h>
@@ -43,6 +43,17 @@ AliJetEmbeddingTask::~AliJetEmbeddingTask()
   // Destructor
 }
 
+//________________________________________________________________________
+void AliJetEmbeddingTask::UserExec(Option_t *) 
+{
+  // Execute per event.
+
+  if (!fIsInit) {
+    ExecOnce();
+    fIsInit = 1;
+  }
+  Run();
+}
 
 //________________________________________________________________________
 void AliJetEmbeddingTask::Run() 
@@ -50,24 +61,18 @@ void AliJetEmbeddingTask::Run()
   // Embed particles.
   
   if (fNClusters > 0 && fOutClusters) {
+    if (fCopyArray) 
+      CopyClusters();
     for (Int_t i = 0; i < fNClusters; ++i) {
       AddCluster();
     }
   }
  
   if (fNTracks > 0 && fOutTracks) {
+    if (fCopyArray) 
+      CopyTracks();
     for (Int_t i = 0; i < fNTracks; ++i) {
       AddTrack();
     }
   }
 }
-
-//________________________________________________________________________
-void AliJetEmbeddingTask::UserExec(Option_t *) 
-{
-  // Execute per event.
-
-  Init();
-
-  Run();
-}