]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added wagon configuration macros. To be adopted by responsables and moved to PWGn...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 07:59:37 +0000 (07:59 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Apr 2009 07:59:37 +0000 (07:59 +0000)
ANALYSIS/macros/AddTaskGammaHadronCorr.C [new file with mode: 0644]
ANALYSIS/macros/AddTaskPi0.C [new file with mode: 0644]
ANALYSIS/macros/AddTaskProtons.C [new file with mode: 0644]

diff --git a/ANALYSIS/macros/AddTaskGammaHadronCorr.C b/ANALYSIS/macros/AddTaskGammaHadronCorr.C
new file mode 100644 (file)
index 0000000..97e0de9
--- /dev/null
@@ -0,0 +1,42 @@
+AliAnalysisTaskParticleCorrelation *AddTaskGammaHadronCorr()
+{
+// Creates a gamma-hadron correlations 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("AddTaskGammaHadronCorr", "No analysis manager to connect to.");
+      return NULL;
+   }   
+
+   // This task requires an ESD input handler and an AOD output handler.
+   // Check this using the analysis manager.
+   //===============================================================================
+   TString type = mgr->GetInputEventHandler()->GetDataType();
+   if (!type.Contains("ESD")) {
+      Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler.");
+      return NULL;
+   }   
+   // Check if AOD output handler exist.
+   AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
+   if (!aod_h) {
+      Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler.");
+      return NULL;
+   }   
+   
+   // Create the task, add it to the manager and configure it.
+   //===========================================================================
+   AliAnalysisTaskParticleCorrelation * taskpartcorr = new AliAnalysisTaskParticleCorrelation ("ParticleCorrelations");
+   mgr->AddTask(taskpartcorr);
+   taskpartcorr->SetConfigFileName("ConfigAnalysisGammaHadronCorrelation");
+   // Output histograms list for particle correlation analysis                       
+   AliAnalysisDataContainer *cout_partcorr = mgr->CreateContainer("partcorrhist", TList::Class(),
+                             AliAnalysisManager::kOutputContainer, "partcorrhist.root");
+   
+   // Connect to data containers
+   mgr->ConnectInput  (taskpartcorr,  0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (taskpartcorr,  1, cout_partcorr );
+   return taskpartcorr;
+}
+   
diff --git a/ANALYSIS/macros/AddTaskPi0.C b/ANALYSIS/macros/AddTaskPi0.C
new file mode 100644 (file)
index 0000000..cc4e64d
--- /dev/null
@@ -0,0 +1,42 @@
+AliAnalysisTaskParticleCorrelation *AddTaskPi0()
+{
+// Creates a Pi0->gg identification 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("AddTaskGammaHadronCorr", "No analysis manager to connect to.");
+      return NULL;
+   }   
+
+   // This task requires an ESD input handler and an AOD output handler.
+   // Check this using the analysis manager.
+   //===============================================================================
+   TString type = mgr->GetInputEventHandler()->GetDataType();
+   if (!type.Contains("ESD")) {
+      Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler.");
+      return NULL;
+   }   
+   // Check if AOD output handler exist.
+   AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
+   if (!aod_h) {
+      Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler.");
+      return NULL;
+   }   
+   
+   // Create the task, add it to the manager and configure it.
+   //===========================================================================
+   AliAnalysisTaskParticleCorrelation * taskpartcorr = new AliAnalysisTaskParticleCorrelation ("PWG4-Pi0");
+   mgr->AddTask(taskpartcorr);
+   taskpartcorr->SetConfigFileName("ConfigAnalysisPi0");
+   // Output histograms list for particle correlation analysis                       
+   AliAnalysisDataContainer *cout_partcorr = mgr->CreateContainer("pi0histos", TList::Class(),
+                             AliAnalysisManager::kOutputContainer, "pi0histos.root");
+   
+   // Connect to data containers
+   mgr->ConnectInput  (taskpartcorr,  0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (taskpartcorr,  1, cout_partcorr );
+   return taskpartcorr;
+}
+   
diff --git a/ANALYSIS/macros/AddTaskProtons.C b/ANALYSIS/macros/AddTaskProtons.C
new file mode 100644 (file)
index 0000000..161f37e
--- /dev/null
@@ -0,0 +1,43 @@
+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/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;
+}