]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
oving all the proton analysis related macros to the proper directory
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 08:56:52 +0000 (08:56 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 08:56:52 +0000 (08:56 +0000)
PWG2/SPECTRA/macros/AddTaskProtons.C [new file with mode: 0644]
PWG2/SPECTRA/macros/configProtonAnalysis.C [moved from PWG2/configProtonAnalysis.C with 100% similarity]
PWG2/SPECTRA/macros/drawProtonQAResults.C [moved from PWG2/drawProtonQAResults.C with 100% similarity]
PWG2/SPECTRA/macros/runProtonAnalysis.C [moved from PWG2/runProtonAnalysis.C with 100% similarity]
PWG2/SPECTRA/macros/runProtonAnalysisQA.C [moved from PWG2/runProtonAnalysisQA.C with 100% similarity]
PWG2/SPECTRA/macros/runProtonCorrection.C [moved from PWG2/runProtonCorrection.C with 100% similarity]

diff --git a/PWG2/SPECTRA/macros/AddTaskProtons.C b/PWG2/SPECTRA/macros/AddTaskProtons.C
new file mode 100644 (file)
index 0000000..6d890fc
--- /dev/null
@@ -0,0 +1,42 @@
+AliAnalysisTaskProtons *AddTaskProtons(const char *analysisType="Hybrid",
+                                      const char *pidMode="Bayesian")
+{
+  // Creates a proton analysis task and adds it to the analysis manager.
+  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskESDFilter", "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("AddTaskProtons", "This task requires an input event handler");
+    return NULL;
+  }   
+  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysis.C");
+  AliProtonAnalysis *pa = 0;
+  if (type=="ESD") pa = GetProtonAnalysisObject("ESD", analysisType, pidMode);
+  else if (type=="AOD") pa = GetProtonAnalysisObject("AOD", analysisType, pidMode);
+  else pa = GetProtonAnalysisObject("MC", analysisType, pidMode);
+
+  // Create the task, add it to manager and configure it.
+  //===========================================================================
+  AliAnalysisTaskProtons *taskproton = new AliAnalysisTaskProtons("TaskProtons");
+  mgr->AddTask(taskproton);
+  taskproton->SetAnalysisObject(pa);
+
+  // Create ONLY the output containers for the data produced by the task.
+  // Get and connect other common input/output containers via the manager as below
+  //==============================================================================
+  AliAnalysisDataContainer *cout_proton = mgr->CreateContainer("protonhist", TList::Class(),AliAnalysisManager::kOutputContainer,"protonhist.root");                              
+  mgr->ConnectInput(taskproton, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(taskproton, 0, cout_proton);
+  
+  // Return task pointer at the end
+  return taskproton;
+}