]> 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 c0f7640fc1a1a27f48eceef560e01c19d9d96d93..3792a1762da2f2742d763ef6d66e1ef924147218 100644 (file)
@@ -43,30 +43,36 @@ AliJetEmbeddingTask::~AliJetEmbeddingTask()
   // Destructor
 }
 
+//________________________________________________________________________
+void AliJetEmbeddingTask::UserExec(Option_t *) 
+{
+  // Execute per event.
+
+  if (!fIsInit) {
+    ExecOnce();
+    fIsInit = 1;
+  }
+  Run();
+}
+
 //________________________________________________________________________
 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();
-}