]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
first running version
authorloizides <cloizides@lbl.gov>
Thu, 16 Jan 2014 08:38:55 +0000 (09:38 +0100)
committerloizides <cloizides@lbl.gov>
Thu, 16 Jan 2014 08:38:55 +0000 (09:38 +0100)
PWG/EMCAL/AliEmcalClusterMaker.cxx
PWG/EMCAL/macros/AddTaskEmcalClusterMaker.C [new file with mode: 0644]

index b1cb300bb87686e09106273b89a337299e49b765..24c69e6445ddff670d3531d6225ae96fe3de95de 100644 (file)
@@ -20,6 +20,7 @@ ClassImp(AliEmcalClusterMaker)
 AliEmcalClusterMaker::AliEmcalClusterMaker() : 
   AliAnalysisTaskEmcal("AliEmcalClusterMaker", kFALSE),
   fOutCaloName(),
+  fRecoUtils(0),
   fEsdMode(kTRUE),
   fOutClusters(0)
 {
@@ -30,6 +31,7 @@ AliEmcalClusterMaker::AliEmcalClusterMaker() :
 AliEmcalClusterMaker::AliEmcalClusterMaker(const char *name, Bool_t histo) : 
   AliAnalysisTaskEmcal(name, histo),
   fOutCaloName("EmcClusters"),
+  fRecoUtils(0),
   fEsdMode(kTRUE),
   fOutClusters(0)
 {
diff --git a/PWG/EMCAL/macros/AddTaskEmcalClusterMaker.C b/PWG/EMCAL/macros/AddTaskEmcalClusterMaker.C
new file mode 100644 (file)
index 0000000..d5236dc
--- /dev/null
@@ -0,0 +1,64 @@
+// $Id$
+
+AliEmcalClusterMaker* AddTaskEmcalClusterMaker(
+  const char *nClusters      = 0,
+  const char *outClusName    = "EmcCaloClusters",
+  const Bool_t   histo       = kFALSE,
+  const char *outputname     = "AnalysisResults.root"
+)
+{  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr)
+  {
+    ::Error("AddTaskHadCorr", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler())
+  {
+    ::Error("AddTaskHadCorr", "This task requires an input event handler");
+    return NULL;
+  }
+
+  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  if (nClusters==0) {
+    if (inputDataType != "ESD")
+      nClusters = "caloClusters";
+    else 
+      nClusters = "CaloClusters";
+  }
+  
+  //-------------------------------------------------------
+  // Init the task and do settings
+  //-------------------------------------------------------
+
+  TString name(Form("EmcalClusterMaker_%s", outClusName));
+  AliEmcalClusterMaker *ecm = new AliEmcalClusterMaker(name, histo);
+  ecm->SetOutClusName(outClusName);
+
+  AliClusterContainer *clusCont = ecm->AddClusterContainer(nClusters);
+  //if (clusCont) clusCont->SetParticlePtCut(minPt);
+
+  //-------------------------------------------------------
+  // Final settings, pass to manager and set the containers
+  //-------------------------------------------------------
+
+  mgr->AddTask(ecm);
+    
+  // Create containers for input/output
+  mgr->ConnectInput (ecm, 0, mgr->GetCommonInputContainer());
+
+  if (histo) {
+    AliAnalysisDataContainer *coecm = mgr->CreateContainer(name,
+                                                          TList::Class(),
+                                                          AliAnalysisManager::kOutputContainer,
+                                                          outputname);
+    mgr->ConnectOutput(ecm,1,coecm);
+  }
+    
+  return ecm;
+}