New classes and macros for the corrections (Marek)
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 6 Dec 2009 03:57:20 +0000 (03:57 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 6 Dec 2009 03:57:20 +0000 (03:57 +0000)
PWG2/PWG2spectraLinkDef.h
PWG2/SPECTRA/AliProtonCorrectionAnalysisTask.cxx [new file with mode: 0644]
PWG2/SPECTRA/AliProtonCorrectionAnalysisTask.h [new file with mode: 0644]
PWG2/SPECTRA/macros/AddTaskProtonCorrectionAnalysis.C [new file with mode: 0644]
PWG2/SPECTRA/macros/configProtonCorrectionAnalysisTask.C [new file with mode: 0644]
PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C
PWG2/SPECTRA/macros/runProtonsCorrectionAnalysis.C [new file with mode: 0644]
PWG2/libPWG2spectra.pkg

index a2c6c59..78bef61 100644 (file)
 #pragma link C++ class AliProtonFeedDownAnalysis+;
 #pragma link C++ class AliProtonAbsorptionCorrection+;
 #pragma link C++ class AliProtonSpectraCorrection+;
+#pragma link C++ class AliProtonCorrectionAnalysisTask+;
 #pragma link C++ class AliAnalysisCentralCutMC+;
 #pragma link C++ class AliAnalysisCentralCutESD+;
 #pragma link C++ class AliAnalysisCentralCutEvtMC+;
 #pragma link C++ class AliAnalysisCentralCutEvtESD+;
 #pragma link C++ class AliAnalysisCentralExtrapolate+;
 #pragma link C++ class AliAnalysisTaskCentral+;
-
 #endif
diff --git a/PWG2/SPECTRA/AliProtonCorrectionAnalysisTask.cxx b/PWG2/SPECTRA/AliProtonCorrectionAnalysisTask.cxx
new file mode 100644 (file)
index 0000000..d4a4058
--- /dev/null
@@ -0,0 +1,252 @@
+#include "TChain.h"\r
+#include "TTree.h"\r
+#include "TString.h"\r
+#include "TList.h"\r
+#include "TH2F.h"\r
+\r
+#include "AliAnalysisTask.h"\r
+#include "AliAnalysisManager.h"\r
+\r
+#include "AliESDEvent.h"\r
+#include "AliESDInputHandler.h"\r
+#include "AliAODEvent.h"\r
+#include "AliAODInputHandler.h"\r
+#include "AliMCEventHandler.h"\r
+#include "AliMCEvent.h"\r
+#include "AliStack.h"\r
+#include "AliESDVertex.h"\r
+\r
+#include "AliProtonFeedDownAnalysis.h"\r
+#include "AliProtonAnalysisBase.h"\r
+#include "AliProtonCorrectionAnalysisTask.h"\r
+\r
+#include "AliProtonAbsorptionCorrection.h"\r
+#include "AliProtonSpectraCorrection.h"\r
+\r
+#include <Riostream.h>\r
+\r
+ClassImp(AliProtonCorrectionAnalysisTask)\r
+  \r
+//________________________________________________________________________ \r
+AliProtonCorrectionAnalysisTask::AliProtonCorrectionAnalysisTask()\r
+  : AliAnalysisTask(), fESD(0), fAOD(0), fMC(0),\r
+    fList(0),fProtonAnalysisBase(0),fProtonAbsorptionCorrection(0), fProtonFeedDownAnalysis(0),fProtonSpectraCorrection(0),fStatHist(0),\r
+    fIsOn_AliProtonAbsorptionCorrection(0),fIsOn_AliProtonFeedDownAnalysis(0),fIsOn_AliProtonSpectraCorrection(0)\r
+ {\r
+  //Dummy constructor\r
+  \r
+}\r
+\r
+//________________________________________________________________________\r
+AliProtonCorrectionAnalysisTask::AliProtonCorrectionAnalysisTask(const char *name) \r
+  : AliAnalysisTask(name, ""), fESD(0), fAOD(0), fMC(0),\r
+    fList(0),fProtonAnalysisBase(0),fProtonAbsorptionCorrection(0), fProtonFeedDownAnalysis(0),fProtonSpectraCorrection(0),fStatHist(0),\r
+    fIsOn_AliProtonAbsorptionCorrection(0),fIsOn_AliProtonFeedDownAnalysis(0),fIsOn_AliProtonSpectraCorrection(0)\r
+    {\r
+       // Constructor\r
+       \r
+       // Define input and output slots here\r
+       // Input slot #0 works with a TChain\r
+       DefineInput(0, TChain::Class());\r
+       // Output slot #0 writes into a TList container\r
+       DefineOutput(0, TList::Class());\r
+}\r
+\r
+//________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::ConnectInputData(Option_t *) \r
+{\r
+       // Connect ESD or AOD here\r
+       // Called once\r
+       TString gAnalysisLevel = fProtonAnalysisBase->GetAnalysisLevel(); \r
+       \r
+       TTree* tree = dynamic_cast<TTree*> (GetInputData(0));\r
+       if (!tree) \r
+       {\r
+               Printf("ERROR: Could not read chain from input slot 0");\r
+       } \r
+       else \r
+       {\r
+               if(gAnalysisLevel == "ESD") \r
+               {\r
+                       AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());   \r
+                       if (!esdH) \r
+                       {\r
+                               Printf("ERROR: Could not get ESDInputHandler");\r
+                       } \r
+                       else\r
+                               fESD = esdH->GetEvent();\r
+                       AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());\r
+                       if (!mcH) \r
+                       {\r
+                               Printf("ERROR: Could not retrieve MC event handler");\r
+                       }\r
+                       else\r
+                               fMC = mcH->MCEvent();\r
+               }\r
+               else if(gAnalysisLevel == "AOD") \r
+               {\r
+                       AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());        \r
+                       if (!aodH) \r
+                       {\r
+                               Printf("ERROR: Could not get AODInputHandler");\r
+                       }\r
+                        else\r
+                               fAOD = aodH->GetEvent();\r
+               }\r
+               else\r
+                       Printf("Wrong analysis type: Only ESD, AOD  types are allowed!");\r
+       }\r
+}\r
+//________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::CreateOutputObjects() \r
+{\r
+       // Create output objects\r
+       // Called once\r
+       fList = new TList();\r
+       if(fIsOn_AliProtonAbsorptionCorrection)\r
+       {\r
+               fProtonAbsorptionCorrection->GetProtonContainer()->SetName("containerProtonsAbsorptionCorrection");\r
+               fList->Add(fProtonAbsorptionCorrection->GetProtonContainer());\r
+               fProtonAbsorptionCorrection->GetAntiProtonContainer()->SetName("containerAntiProtonsAbsorptionCorrection");\r
+               fList->Add(fProtonAbsorptionCorrection->GetAntiProtonContainer());\r
+       }\r
+       if(fIsOn_AliProtonFeedDownAnalysis)\r
+       {\r
+               fProtonFeedDownAnalysis->GetProtonContainer()->SetName("containerProtonsFeedDown");\r
+               fList->Add(fProtonFeedDownAnalysis->GetProtonContainer());\r
+               fProtonFeedDownAnalysis->GetAntiProtonContainer()->SetName("containerAntiProtonsFeedDown");\r
+               fList->Add(fProtonFeedDownAnalysis->GetAntiProtonContainer());\r
+               fList->Add(fProtonFeedDownAnalysis->GetLambdaHist());\r
+               fList->Add(fProtonFeedDownAnalysis->GetLambdaweightedHist());\r
+               fList->Add(fProtonFeedDownAnalysis->GetAntiLambdaHist());\r
+               fList->Add(fProtonFeedDownAnalysis->GetAntiLambdaweightedHist());\r
+       }\r
+       if(fIsOn_AliProtonSpectraCorrection)\r
+       {\r
+               fProtonSpectraCorrection->GetProtonContainer()->SetName("containerProtonsSpectraCorrection");\r
+               fList->Add(fProtonSpectraCorrection->GetProtonContainer());\r
+               fProtonSpectraCorrection->GetProtonContainer()->SetName("containerAntiProtonsSpectraCorrection");\r
+               fList->Add(fProtonSpectraCorrection->GetAntiProtonContainer());\r
+       }\r
+       fStatHist=new TH1F("StatsHist","StatsHist",10,-0.5,9.5);\r
+       fList->Add(fStatHist);\r
+       fStatHist->GetXaxis()->SetBinLabel(1,"level1cutESD");\r
+       fStatHist->GetXaxis()->SetBinLabel(2,"level2cutTrigger");\r
+       fStatHist->GetXaxis()->SetBinLabel(3,"level3cutVerstex");\r
+       fStatHist->GetXaxis()->SetBinLabel(4,"level4cutMC");\r
+}\r
+//________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::Exec(Option_t *) \r
+{\r
+       // Main loop\r
+       // Called for each event\r
+       TString gAnalysisLevel =fProtonAnalysisBase->GetAnalysisLevel(); \r
+       //TString gAnalysisLevel = (fProtonFeedDownAnalysis->GetProtonAnalysisBaseObject())->GetAnalysisLevel(); \r
+       if(gAnalysisLevel == "ESD") \r
+       {\r
+               if (!fESD) \r
+               {\r
+                       Printf("ERROR: fESD not available");\r
+                       return;\r
+               }\r
+               fStatHist->Fill(0);\r
+               if(fProtonAnalysisBase->IsEventTriggered(fESD,fProtonAnalysisBase->GetTriggerMode())) \r
+               {\r
+                       fStatHist->Fill(1);\r
+                       const AliESDVertex *vertex = fProtonAnalysisBase->GetVertex(fESD,fProtonAnalysisBase->GetAnalysisMode(),fProtonAnalysisBase->GetVxMax(),fProtonAnalysisBase->GetVyMax(),fProtonAnalysisBase->GetVzMax());\r
+                       if(vertex) \r
+                       {\r
+                               fStatHist->Fill(2);\r
+                               Printf("Proton ESD analysis task: There are %d tracks in this event", fESD->GetNumberOfTracks());\r
+                               AliStack* stack1=0x0;\r
+                               if(!fMC)\r
+                                       return;                 \r
+                               stack1 = fMC->Stack();\r
+                               if(!stack1)\r
+                                       return;\r
+                               fStatHist->Fill(3);\r
+                               if(fIsOn_AliProtonAbsorptionCorrection)\r
+                                       fProtonAbsorptionCorrection->FillAbsorptionMaps(fESD,vertex,fMC);\r
+                               if(fIsOn_AliProtonFeedDownAnalysis)\r
+                               {       \r
+                                       fProtonFeedDownAnalysis->Analyze(fESD,vertex,stack1);\r
+                                       fProtonFeedDownAnalysis->Analyze(stack1);\r
+                               }       \r
+                               if(fIsOn_AliProtonSpectraCorrection)\r
+                                       fProtonSpectraCorrection->FillCorrectionMaps(fESD,vertex,fMC);\r
+\r
+                       }//reconstructed vertex\r
+               }//triggered event\r
+       }//ESD analysis              \r
+       \r
+       else if(gAnalysisLevel == "AOD") \r
+       {\r
+               if (!fAOD) \r
+               {\r
+                       Printf("ERROR: fAOD not available");\r
+                       return;\r
+               }\r
+               Printf("Proton AOD analysis task: There are %d tracks in this event", fAOD->GetNumberOfTracks());\r
+               if(fIsOn_AliProtonAbsorptionCorrection)\r
+                       fProtonAbsorptionCorrection->FillAbsorptionMaps(fAOD);\r
+               if(fIsOn_AliProtonFeedDownAnalysis)\r
+                       fProtonFeedDownAnalysis->Analyze(fAOD);\r
+               if(fIsOn_AliProtonSpectraCorrection)\r
+                       fProtonSpectraCorrection->FillCorrectionMaps(fAOD);\r
+       }//AOD analysis\r
+                        \r
+       \r
+       // Post output data.\r
+       PostData(0, fList);\r
+}    \r
+//__________________________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::Terminate(Option_t *) \r
+{\r
+\r
+}\r
+//___________________________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::SetAnalysisObjectAbsorptionCorrection(AliProtonAbsorptionCorrection *const analysis) \r
+{\r
+       if (analysis&&fProtonAnalysisBase)\r
+       {\r
+               Printf("Absorption Correection ON\n");\r
+               fIsOn_AliProtonAbsorptionCorrection=kTRUE;\r
+               fProtonAbsorptionCorrection = analysis;\r
+               fProtonAbsorptionCorrection->SetBaseAnalysis(fProtonAnalysisBase);\r
+               fProtonAbsorptionCorrection->InitAnalysisHistograms(fProtonAnalysisBase->GetNBinsX(),fProtonAnalysisBase->GetMinX(),fProtonAnalysisBase->GetMaxX(),fProtonAnalysisBase->GetNBinsY(),fProtonAnalysisBase->GetMinY(),fProtonAnalysisBase->GetMaxY());\r
+       }\r
+       else\r
+               fIsOn_AliProtonAbsorptionCorrection=kFALSE;\r
+}\r
+//___________________________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::SetAnalysisObjectFeedDown(AliProtonFeedDownAnalysis *const analysis) \r
+{\r
+       if (analysis&&fProtonAnalysisBase)\r
+       {\r
+               Printf("Feed Down ON\n");\r
+                fIsOn_AliProtonFeedDownAnalysis=kTRUE;\r
+               fProtonFeedDownAnalysis = analysis;\r
+               fProtonFeedDownAnalysis->SetBaseAnalysis(fProtonAnalysisBase);\r
+               fProtonFeedDownAnalysis->InitAnalysisHistograms(fProtonAnalysisBase->GetNBinsX(),fProtonAnalysisBase->GetMinX(),fProtonAnalysisBase->GetMaxX(),fProtonAnalysisBase->GetNBinsY(),fProtonAnalysisBase->GetMinY(),fProtonAnalysisBase->GetMaxY());\r
+       }\r
+       else\r
+                fIsOn_AliProtonFeedDownAnalysis=kFALSE;\r
+}\r
+//___________________________________________________________________________________________\r
+void AliProtonCorrectionAnalysisTask::SetAnalysisObjectSpectraCorrection(AliProtonSpectraCorrection *const analysis) \r
+{ \r
+       if (analysis&&fProtonAnalysisBase)\r
+       {\r
+               Printf("Spectra Correection ON\n");\r
+               fIsOn_AliProtonSpectraCorrection=kTRUE;\r
+               fProtonSpectraCorrection= analysis;\r
+               fProtonSpectraCorrection->SetBaseAnalysis(fProtonAnalysisBase);\r
+               fProtonSpectraCorrection->InitAnalysisHistograms(fProtonAnalysisBase->GetNBinsX(),fProtonAnalysisBase->GetMinX(),fProtonAnalysisBase->GetMaxX(),fProtonAnalysisBase->GetNBinsY(),fProtonAnalysisBase->GetMinY(),fProtonAnalysisBase->GetMaxY());\r
+       }\r
+       else\r
+               fIsOn_AliProtonSpectraCorrection=kFALSE;\r
+}\r
+  \r
+\r
+\r
+\r
diff --git a/PWG2/SPECTRA/AliProtonCorrectionAnalysisTask.h b/PWG2/SPECTRA/AliProtonCorrectionAnalysisTask.h
new file mode 100644 (file)
index 0000000..fce5195
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef ALIPROTONCORRECTIONTASK_H\r
+#define ALIPROTONCORRECTIONTASK_H\r
+#include "AliAnalysisTask.h"\r
+\r
+class TList;\r
+class AliESDEvent;\r
+class AliAODEvent;\r
+class AliMCEvent;\r
+class AliProtonFeedDownAnalysis;\r
+class AliProtonAbsorptionCorrection;\r
+class AliProtonSpectraCorrection; \r
+class AliProtonAnalysisBase;\r
+\r
+\r
+\r
+class AliProtonCorrectionAnalysisTask : public AliAnalysisTask {\r
+ public:\r
+       AliProtonCorrectionAnalysisTask();\r
+       AliProtonCorrectionAnalysisTask(const char *name);\r
+       virtual ~AliProtonCorrectionAnalysisTask() {}\r
+       \r
+       virtual void   ConnectInputData(Option_t *);\r
+       virtual void   CreateOutputObjects();\r
+       virtual void   Exec(Option_t *option);\r
+       virtual void   Terminate(Option_t *);\r
+       \r
+       void SetAnalysisObjectAbsorptionCorrection(AliProtonAbsorptionCorrection* const analysis) ;\r
+       void SetAnalysisObjectFeedDown(AliProtonFeedDownAnalysis* const analysis); \r
+       void SetAnalysisObjectSpectraCorrection(AliProtonSpectraCorrection* const analysis);\r
+       void SetBaseAnalysis(AliProtonAnalysisBase* const baseAnalysis) { fProtonAnalysisBase = baseAnalysis;}\r
+ private:\r
+       AliESDEvent *fESD;    //ESD object \r
+       AliAODEvent *fAOD;    //AOD object\r
+       AliMCEvent  *fMC;     //MC object \r
+       \r
+       TList  *fList; //TList output object \r
+       \r
+       AliProtonAnalysisBase *fProtonAnalysisBase; //base analysis object\r
+       AliProtonAbsorptionCorrection *fProtonAbsorptionCorrection;//analysis object \r
+       AliProtonFeedDownAnalysis *fProtonFeedDownAnalysis; //analysis object \r
+       AliProtonSpectraCorrection *fProtonSpectraCorrection;//analysis object \r
+       \r
+       TH1F *fStatHist;\r
+       \r
+       \r
+       Bool_t fIsOn_AliProtonAbsorptionCorrection;\r
+       Bool_t fIsOn_AliProtonFeedDownAnalysis;\r
+       Bool_t fIsOn_AliProtonSpectraCorrection;\r
+       \r
+       AliProtonCorrectionAnalysisTask(const AliProtonCorrectionAnalysisTask&); // not implemented\r
+       AliProtonCorrectionAnalysisTask& operator=(const AliProtonCorrectionAnalysisTask&); // not implemented\r
+       \r
+ClassDef(AliProtonCorrectionAnalysisTask, 1); // example of analysis\r
+};\r
+\r
+#endif\r
+\r
+\r
+\r
diff --git a/PWG2/SPECTRA/macros/AddTaskProtonCorrectionAnalysis.C b/PWG2/SPECTRA/macros/AddTaskProtonCorrectionAnalysis.C
new file mode 100644 (file)
index 0000000..85ebedd
--- /dev/null
@@ -0,0 +1,48 @@
+AliProtonCorrectionAnalysisTask* AddTaskProtonCorrectionAnalysis(const char *analysisType="Hybrid",const char *pidMode="Bayesian",Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE)
+{
+  // 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("AddTaskProtons", "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/configProtonCorrectionAnalysisTask.C");
+  AliProtonCorrectionAnalysisTask *taskproton = 0;
+  if (type=="ESD") 
+        taskproton = GetAliProtonCorrectionAnalysisTask("ESD", analysisType, pidMode,fIsOn_AliProtonAbsorptionCorrection, fIsOn_AliProtonFeedDownAnalysis,fIsOn_AliProtonSpectraCorrection);
+  else if (type=="AOD") 
+       taskproton  = GetAliProtonCorrectionAnalysisTask("AOD", analysisType, pidMode,fIsOn_AliProtonAbsorptionCorrection,fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection);
+  else 
+       return NULL;
+
+  // Create the task, add it to manager and configure it.
+  //===========================================================================
+
+  mgr->AddTask(taskproton);
+  
+
+  // 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
+  //==============================================================================
+  TString outputFileName = AliAnalysisManager::GetCommonFileName();
+  outputFileName += ":PWG2BaryonRatioProtonCorrectionAnalysisAnalysis";
+  AliAnalysisDataContainer *cout_proton = mgr->CreateContainer("protonProtonCorrectionAnalysis", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
+  mgr->ConnectInput(taskproton, 0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(taskproton, 0, cout_proton);
+  
+  // Return task pointer at the end
+  return taskproton;
+}
diff --git a/PWG2/SPECTRA/macros/configProtonCorrectionAnalysisTask.C b/PWG2/SPECTRA/macros/configProtonCorrectionAnalysisTask.C
new file mode 100644 (file)
index 0000000..ad8a10f
--- /dev/null
@@ -0,0 +1,27 @@
+//______________________________________________________
+AliProtonCorrectionAnalysisTask* GetAliProtonCorrectionAnalysisTask(const char* mode = "ESD",const char* analysisType  = "Hybrid",const char* pidMode = "Bayesian",Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE) {
+  AliProtonCorrectionAnalysisTask *taskProtons = new AliProtonCorrectionAnalysisTask("TaskProtonsProtonCorrection");
+  if(fIsOn_AliProtonAbsorptionCorrection||fIsOn_AliProtonFeedDownAnalysis||fIsOn_AliProtonSpectraCorrection) {
+    gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
+    AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(mode,analysisType,pidMode);
+    taskProtons->SetBaseAnalysis(baseAnalysis);
+  }    
+  else
+    return 0x0;
+  if(fIsOn_AliProtonAbsorptionCorrection) {
+    AliProtonAbsorptionCorrection* absorptioncorrection=new AliProtonAbsorptionCorrection();
+    taskProtons->SetAnalysisObjectAbsorptionCorrection(absorptioncorrection);
+  }
+  if(fIsOn_AliProtonFeedDownAnalysis) {
+    gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C");
+    AliProtonFeedDownAnalysis* analysisFeedDown = GetProtonFeedDownAnalysisObject();
+    taskProtons->SetAnalysisObjectFeedDown(analysisFeedDown);
+  }    
+  if(fIsOn_AliProtonSpectraCorrection) {
+    AliProtonSpectraCorrection* spectracorrection=new AliProtonSpectraCorrection();
+    taskProtons->SetAnalysisObjectSpectraCorrection(spectracorrection);
+  }
+  return taskProtons;
+}
+
+
index 335cc73..8422d57 100644 (file)
@@ -21,22 +21,14 @@ Double_t test2(Double_t *x,Double_t *p)
 }
 
 //__________________________________________________//
-AliProtonFeedDownAnalysis *GetProtonFeedDownAnalysisObject(const char* analysisLevel = "ESD", 
-                                          const char* esdAnalysisType = "Hybrid", 
-                                          const char* pidMode = "Bayesian") {
-gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
+AliProtonFeedDownAnalysis *GetProtonFeedDownAnalysisObject() {
+//gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
   //Function to setup the AliProtonAnalysis object and return it
-  AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(analysisLevel,esdAnalysisType,pidMode);
+ // AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(analysisLevel,esdAnalysisType,pidMode);
 
   AliProtonFeedDownAnalysis *analysis = new AliProtonFeedDownAnalysis();
-  analysis->SetBaseAnalysis(baseAnalysis);
+//  analysis->SetBaseAnalysis(baseAnalysis);
   //if(analysisBase->GetEtaMode()) analysis->SetEtaMode();
-  analysis->InitAnalysisHistograms(baseAnalysis->GetNBinsX(),
-                                  baseAnalysis->GetMinX(),
-                                  baseAnalysis->GetMaxX(),
-                                  baseAnalysis->GetNBinsY(),
-                                  baseAnalysis->GetMinY(),
-                                  baseAnalysis->GetMaxY());
 TF1* weightfunction=new TF1("weightfunction","1");
 //TF1* weightfunction=new TF1("weightfunction",test1,0.5,4.0,0);       
 //TF1* weightfunction=new TF1("weightfunction",test2,0.5,4.0,0);                          
diff --git a/PWG2/SPECTRA/macros/runProtonsCorrectionAnalysis.C b/PWG2/SPECTRA/macros/runProtonsCorrectionAnalysis.C
new file mode 100644 (file)
index 0000000..e25c5c7
--- /dev/null
@@ -0,0 +1,449 @@
+void runProtonsCorrectionAnalysis(const char* analysisType  = "Hybrid",const char* pidMode = "Bayesian",Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE) 
+{
+  //Macro to run the proton feed-down analysis tested for local, proof & GRID.
+  //Local: Takes four arguments, the analysis mode, the type of the ESD 
+  //       analysis, the PID mode and the path where the tag and ESD or 
+  //       AOD files reside.
+  //Interactive: Takes four arguments, the analysis mode, the type of the ESD 
+  //             analysis, the PID mode and the name of the collection of tag 
+  //             files.
+  //Batch: Takes four arguments, the analysis mode, the type of the ESD 
+  //       analysis, the PID mode and the name of the collection file with 
+  //       the event list for each file.
+  //Proof: Takes five arguments, the analysis level, the analysis mode in 
+  //       case of ESD, the PID mode, the number of events and the dataset 
+  //       name and .  
+  //Analysis mode can be: "MC", "ESD", "AOD"
+  //ESD analysis type can be one of the three: "TPC", "Hybrid", "Global"
+  //PID mode can be one of the four: "Bayesian" (standard Bayesian approach) 
+  //   "Ratio" (ratio of measured over expected/theoretical dE/dx a la STAR) 
+  //   "Sigma1" (N-sigma area around the fitted dE/dx vs P band)
+  //   "Sigma2" (same as previous but taking into account the No of TPC points)
+  TStopwatch timer;
+  timer.Start();
+  
+  // runLocal("ESD","TPC","Bayesian","/home/mbroz/FeedDownAnalysis/",fIsOn_AliProtonAbsorptionCorrection,fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection);
+  runInteractive("ESD","TPC","Bayesian","/home/marek/Analysis/global_xml/tagtest81627.xml",fIsOn_AliProtonAbsorptionCorrection,fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection);
+  //runBatch("ESD","TPC","Bayesian","wn.xml",fIsOn_AliProtonAbsorptionCorrection,fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection);  
+  // runProof("ESD","TPC","Bayesian",200000,"/COMMON/COMMON/LHC09a4_run8101X",fIsOn_AliProtonAbsorptionCorrection,fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection);
+  
+  timer.Stop();
+  timer.Print();
+}
+
+//_________________________________________________//
+void runLocal(const char* mode = "ESD",const char* analysisType = 0x0,const char* pidMode = 0x0, const char* path = 0x0,Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE) 
+{
+       TString smode = mode;
+        TString outputFilename = "ProtonCorrection."; outputFilename += mode;
+       if(analysisType) 
+       {
+               outputFilename += "."; outputFilename += analysisType;
+       }
+       outputFilename += ".root";
+
+  //____________________________________________________//
+  //_____________Setting up the par files_______________//
+  //____________________________________________________//
+       //setupPar("STEERBase");
+       gSystem->Load("libSTEERBase.so");
+       //setupPar("ESD");
+       gSystem->Load("libVMC.so");
+       gSystem->Load("libESD.so");
+       //setupPar("AOD");
+       gSystem->Load("libAOD.so");
+       //setupPar("ANALYSIS");
+       gSystem->Load("libANALYSIS.so");
+       //setupPar("ANALYSISalice");
+       gSystem->Load("libANALYSISalice.so");
+       //setupPar("CORRFW");
+       gSystem->Load("libCORRFW.so");
+       //setupPar("PWG2spectra");
+       gSystem->Load("libPWG2spectra.so");
+  //____________________________________________________//  
+  
+  //____________________________________________//
+       AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD"); 
+       tagAnalysis->ChainLocalTags(path);
+       
+       AliRunTagCuts *runCuts = new AliRunTagCuts();
+       AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+       AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+       AliEventTagCuts *evCuts = new AliEventTagCuts();
+       
+       TChain* chain = 0x0;
+       chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
+       //chain->SetBranchStatus("*Calo*",0);
+
+       //____________________________________________//
+       // Make the analysis manager
+       AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerProtonCorrection");
+       AliVEventHandler* esdH = new AliESDInputHandler;
+       mgr->SetInputEventHandler(esdH);
+       AliMCEventHandler *mc = new AliMCEventHandler();
+       mgr->SetMCtruthEventHandler(mc);
+       
+       //____________________________________________//
+       /*AliProtonCorrectionAnalysisTask *taskProtons = new AliProtonCorrectionAnalysisTask("TaskProtonsProtonCorrection");
+
+       if(fIsOn_AliProtonAbsorptionCorrection||fIsOn_AliProtonFeedDownAnalysis||fIsOn_AliProtonSpectraCorrection)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
+               AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(mode,analysisType,pidMode);
+               taskProtons->SetBaseAnalysis(baseAnalysis);
+       }       
+       else
+               return;
+       if(fIsOn_AliProtonAbsorptionCorrection)
+       {
+                 AliProtonAbsorptionCorrection * absorptioncorrection=new AliProtonAbsorptionCorrection();
+                 taskProtons->SetAnalysisObjectAbsorptionCorrection(absorptioncorrection);
+       }
+       if(fIsOn_AliProtonFeedDownAnalysis)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C");
+               AliProtonFeedDownAnalysis *analysisFeedDown = GetProtonFeedDownAnalysisObject();
+               taskProtons->SetAnalysisObjectFeedDown(analysisFeedDown);
+       }       
+       if(fIsOn_AliProtonSpectraCorrection)
+       {
+               AliProtonSpectraCorrection* spectracorrection=new AliProtonSpectraCorrection();
+               taskProtons->SetAnalysisObjectSpectraCorrection(spectracorrection);
+       }*/
+       gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configAliProtonCorrectionAnalysisTask.C"); 
+       AliProtonCorrectionAnalysisTask* taskProtons=GetAliProtonCorrectionAnalysisTask(mode,analysisType,pidMode ,fIsOn_AliProtonAbsorptionCorrection, fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection); 
+       mgr->AddTask(taskProtons);
+
+  // Create containers for input/output
+       AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",TChain::Class(),AliAnalysisManager::kInputContainer);
+       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",TList::Class(),AliAnalysisManager::kOutputContainer,outputFilename.Data());
+
+  //____________________________________________//
+       mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
+       mgr->ConnectOutput(taskProtons,0,coutput1);
+       if (!mgr->InitAnalysis()) 
+               return;
+       mgr->PrintStatus();
+       mgr->StartAnalysis("local",chain);
+}
+
+//_________________________________________________//
+void runInteractive(const char* mode = "ESD",const char* analysisType = 0x0,const char* pidMode = 0x0,const char* collectionName = "tag.xml",Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE) 
+{
+        gSystem->Load("libProofPlayer.so");
+
+       TString smode = mode;
+       TString outputFilename = "ProtonCorrection."; outputFilename += mode;
+       if(analysisType) 
+       {
+               outputFilename += "."; outputFilename += analysisType;
+       }
+        outputFilename += ".root";
+
+       printf("*** Connect to AliEn ***\n");
+       TGrid::Connect("alien://");
+       
+       //____________________________________________________//
+       //_____________Setting up the par files_______________//
+       //____________________________________________________//
+       //setupPar("STEERBase");
+       gSystem->Load("libSTEERBase.so");
+       //setupPar("ESD");
+       gSystem->Load("libVMC.so");
+       gSystem->Load("libESD.so");
+       //setupPar("AOD");
+       gSystem->Load("libAOD.so");
+       //setupPar("ANALYSIS");
+       gSystem->Load("libANALYSIS.so");
+       //setupPar("ANALYSISalice");
+       gSystem->Load("libANALYSISalice.so");
+       //setupPar("CORRFW");
+       gSystem->Load("libCORRFW.so");
+       //setupPar("PWG2spectra");
+       gSystem->Load("libPWG2spectra.so");
+  //____________________________________________________//  
+  //____________________________________________//
+       AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
+       
+       AliRunTagCuts *runCuts = new AliRunTagCuts();
+       AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+       AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+       AliEventTagCuts *evCuts = new AliEventTagCuts();
+       
+       //grid tags
+       TAlienCollection* coll = TAlienCollection::Open(collectionName);
+       TGridResult* TagResult = coll->GetGridResult("",0,0);
+       tagAnalysis->ChainGridTags(TagResult);
+       TChain* chain = 0x0;
+       chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
+  //chain->SetBranchStatus("*Calo*",0);
+  
+  //____________________________________________//
+  // Make the analysis manager
+  // Make the analysis manager
+       AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerProtonCorrection");
+       AliVEventHandler* esdH = new AliESDInputHandler;
+       mgr->SetInputEventHandler(esdH);
+       AliMCEventHandler *mc = new AliMCEventHandler();
+       mgr->SetMCtruthEventHandler(mc);
+
+  //____________________________________________//
+       /*AliProtonCorrectionAnalysisTask *taskProtons = new AliProtonCorrectionAnalysisTask("TaskProtonsProtonCorrection");
+       if(fIsOn_AliProtonAbsorptionCorrection||fIsOn_AliProtonFeedDownAnalysis||fIsOn_AliProtonSpectraCorrection)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
+               AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(mode,analysisType,pidMode);
+               taskProtons->SetBaseAnalysis(baseAnalysis);
+       }       
+       else
+               return;
+       if(fIsOn_AliProtonAbsorptionCorrection)
+       {
+                 AliProtonAbsorptionCorrection* absorptioncorrection=new AliProtonAbsorptionCorrection();
+                 taskProtons->SetAnalysisObjectAbsorptionCorrection(absorptioncorrection);
+       }
+       if(fIsOn_AliProtonFeedDownAnalysis)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C");
+               AliProtonFeedDownAnalysis* analysisFeedDown = GetProtonFeedDownAnalysisObject();
+               taskProtons->SetAnalysisObjectFeedDown(analysisFeedDown);
+       }       
+       if(fIsOn_AliProtonSpectraCorrection)
+       {
+               AliProtonSpectraCorrection* spectracorrection=new AliProtonSpectraCorrection();
+               taskProtons->SetAnalysisObjectSpectraCorrection(spectracorrection);
+       }*/
+       gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configAliProtonCorrectionAnalysisTask.C"); 
+       AliProtonCorrectionAnalysisTask* taskProtons=GetAliProtonCorrectionAnalysisTask(mode,analysisType,pidMode ,fIsOn_AliProtonAbsorptionCorrection, fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection); 
+       mgr->AddTask(taskProtons);
+       
+       // Create containers for input/output
+       AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",TChain::Class(),AliAnalysisManager::kInputContainer);
+       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",TList::Class(),AliAnalysisManager::kOutputContainer,outputFilename.Data());
+       
+  //____________________________________________//
+       mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
+       mgr->ConnectOutput(taskProtons,0,coutput1);
+       if (!mgr->InitAnalysis()) 
+               return;
+       mgr->PrintStatus();
+       mgr->StartAnalysis("local",chain);
+}
+
+//_________________________________________________//
+void runBatch(const char* mode = "ESD",const char* analysisType = 0x0,const char* pidMode = 0x0,const char *collectionfile = "wn.xml",Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE) 
+{
+       TString smode = mode;
+       TString outputFilename = "ProtonCorrection."; outputFilename += mode;
+       if(analysisType) 
+       {
+               outputFilename += "."; outputFilename += analysisType;
+       }
+       outputFilename += ".root";
+       
+       printf("*** Connect to AliEn ***\n");
+       TGrid::Connect("alien://");
+       gSystem->Load("libProofPlayer.so");
+
+  //____________________________________________________//
+  //_____________Setting up the par files_______________//
+  //____________________________________________________//
+       gSystem->Load("libSTEERBase.so");
+       gSystem->Load("libESD.so");
+       gSystem->Load("libAOD.so");
+       gSystem->Load("libANALYSIS") ;
+       gSystem->Load("libANALYSISalice") ;
+       gSystem->Load("libCORRFW.so") ;
+
+       //setupPar("PWG2spectra");
+       gSystem->Load("libPWG2spectra.so");
+  //____________________________________________________//  
+
+  //____________________________________________//
+       AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
+       TChain *chain = 0x0;
+       chain = tagAnalysis->GetChainFromCollection(collectionfile,"esdTree");
+       
+       //____________________________________________//
+       // Make the analysis manager
+       AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerProtonCorrection");
+       AliVEventHandler* esdH = new AliESDInputHandler;
+       mgr->SetInputEventHandler(esdH);
+       AliMCEventHandler *mc = new AliMCEventHandler();
+       mgr->SetMCtruthEventHandler(mc);
+
+  //____________________________________________//
+       /*AliProtonCorrectionAnalysisTask *taskProtons = new AliProtonCorrectionAnalysisTask("TaskProtonsProtonCorrection");
+       if(fIsOn_AliProtonAbsorptionCorrection||fIsOn_AliProtonFeedDownAnalysis||fIsOn_AliProtonSpectraCorrection)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
+               AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(mode,analysisType ,pidMode);
+               taskProtons->SetBaseAnalysis(baseAnalysis);
+       }       
+       else
+               return;
+       if(fIsOn_AliProtonAbsorptionCorrection)
+       {
+                 AliProtonAbsorptionCorrection * absorptioncorrection=new AliProtonAbsorptionCorrection();
+                 taskProtons->SetAnalysisObjectAbsorptionCorrection(absorptioncorrection);
+       }
+       if(fIsOn_AliProtonFeedDownAnalysis)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C");
+               AliProtonFeedDownAnalysis *analysisFeedDown = GetProtonFeedDownAnalysisObject();
+               taskProtons->SetAnalysisObjectFeedDown(analysisFeedDown);
+       }       
+       if(fIsOn_AliProtonSpectraCorrection)
+       {
+               AliProtonSpectraCorrection* spectracorrection=new AliProtonSpectraCorrection();
+               taskProtons->SetAnalysisObjectSpectraCorrection(spectracorrection);
+       }*/
+       gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configAliProtonCorrectionAnalysisTask.C"); 
+       AliProtonCorrectionAnalysisTask* taskProtons=GetAliProtonCorrectionAnalysisTask(mode,analysisType,pidMode ,fIsOn_AliProtonAbsorptionCorrection, fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection); 
+       mgr->AddTask(taskProtons);
+
+  // Create containers for input/output
+       AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",TChain::Class(),AliAnalysisManager::kInputContainer);
+       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",TList::Class(),AliAnalysisManager::kOutputContainer,outputFilename.Data());
+
+  //____________________________________________//
+       mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
+       mgr->ConnectOutput(taskProtons,0,coutput1);
+       if (!mgr->InitAnalysis()) 
+               return;
+       mgr->PrintStatus();
+       mgr->StartAnalysis("local",chain);
+}
+
+//_________________________________________________//
+void runProof(const char* mode = "ESD",const char* analysisType = 0x0,const char* pidMode = 0x0,Int_t stats = 0, const char* dataset = 0x0,Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE) 
+{  
+       TString smode = mode;
+       TString outputFilename = "ProtonCorrection."; outputFilename += mode;
+       if(analysisType) 
+       {
+               outputFilename += "."; outputFilename += analysisType;
+       }
+        outputFilename += ".root";
+
+       printf("****** Connect to PROOF *******\n");
+       TProof::Open("alicecaf.cern.ch"); 
+       //gProof->SetParallel();
+       
+       // Enable the Analysis Package
+       gProof->UploadPackage("STEERBase.par");
+       gProof->EnablePackage("STEERBase");
+       gProof->UploadPackage("ESD.par");
+       gProof->EnablePackage("ESD");
+       gProof->UploadPackage("AOD.par");
+       gProof->EnablePackage("AOD");
+       gProof->UploadPackage("ANALYSIS.par");
+       gProof->EnablePackage("ANALYSIS");
+       gProof->UploadPackage("ANALYSISalice.par");
+       gProof->EnablePackage("ANALYSISalice");
+       gProof->UploadPackage("CORRFW.par");
+       gProof->EnablePackage("CORRFW");
+       gProof->UploadPackage("PWG2spectra.par");
+       gProof->EnablePackage("PWG2spectra");
+  
+  //____________________________________________//);
+  //____________________________________________//
+
+  //____________________________________________//
+  // Make the analysis manager
+       AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerProtonCorrection");
+       AliVEventHandler* esdH = new AliESDInputHandler;
+       mgr->SetInputEventHandler(esdH);
+       AliMCEventHandler *mc = new AliMCEventHandler();
+       mgr->SetMCtruthEventHandler(mc);
+  //____________________________________________//
+  //Create the proton task
+       /*AliProtonCorrectionAnalysisTask *taskProtons = new AliProtonCorrectionAnalysisTask("TaskProtonsProtonCorrection");
+       if(fIsOn_AliProtonAbsorptionCorrection||fIsOn_AliProtonFeedDownAnalysis||fIsOn_AliProtonSpectraCorrection)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C"); 
+               AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(mode,analysisType ,pidMode);
+               taskProtons->SetBaseAnalysis(baseAnalysis);
+       }       
+       else
+               return
+       if(fIsOn_AliProtonAbsorptionCorrection)
+       {
+                 AliProtonAbsorptionCorrection * absorptioncorrection=new AliProtonAbsorptionCorrection();
+                 taskProtons->SetAnalysisObjectAbsorptionCorrection(absorptioncorrection);
+       }
+       if(fIsOn_AliProtonFeedDownAnalysis)
+       {
+               gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C");
+               AliProtonFeedDownAnalysis *analysisFeedDown = GetProtonFeedDownAnalysisObject();
+               taskProtons->SetAnalysisObjectFeedDown(analysisFeedDown);
+       }       
+       if(fIsOn_AliProtonSpectraCorrection)
+       {
+               AliProtonSpectraCorrection* spectracorrection=new AliProtonSpectraCorrection();
+               taskProtons->SetAnalysisObjectSpectraCorrection(spectracorrection);
+       }*/
+       gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configAliProtonCorrectionAnalysisTask.C"); 
+       AliProtonCorrectionAnalysisTask* taskProtons=GetAliProtonCorrectionAnalysisTask(mode,analysisType,pidMode ,fIsOn_AliProtonAbsorptionCorrection, fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection); 
+       mgr->AddTask(taskProtons);
+
+  // Create containers for input/output
+       AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",TChain::Class(),AliAnalysisManager::kInputContainer);
+       AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",TList::Class(),AliAnalysisManager::kOutputContainer,outputFilename.Data());
+       
+       //____________________________________________//
+       mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
+       mgr->ConnectOutput(taskProtons,0,coutput1);
+       if (!mgr->InitAnalysis()) return;
+       mgr->PrintStatus();
+       
+       if(dataset)
+       mgr->StartAnalysis("proof",dataset,stats);
+       else {
+       // You should get this macro and the txt file from:
+       // http://aliceinfo.cern.ch/Offline/Analysis/CAF/
+       gROOT->LoadMacro("CreateESDChain.C");
+       TChain* chain = 0x0;
+       chain = CreateESDChain("ESD82XX_30K.txt",stats);
+       chain->SetBranchStatus("*Calo*",0);
+       
+       mgr->StartAnalysis("proof",chain);
+  }
+}
+
+//_________________________________________________//
+Int_t setupPar(const char* pararchivename) {
+  ///////////////////
+  // Setup PAR File//
+  ///////////////////
+  if (pararchivename) {
+    char processline[1024];
+    sprintf(processline,".! tar xvzf %s.par",pararchivename);
+    gROOT->ProcessLine(processline);
+    const char* ocwd = gSystem->WorkingDirectory();
+    gSystem->ChangeDirectory(pararchivename);
+    
+    // check for BUILD.sh and execute
+    if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
+      printf("*******************************\n");
+      printf("*** Building PAR archive    ***\n");
+      printf("*******************************\n");
+      
+      if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
+        Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
+        return -1;
+      }
+    }
+    // check for SETUP.C and execute
+    if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
+      printf("*******************************\n");
+      printf("*** Setup PAR archive       ***\n");
+      printf("*******************************\n");
+      gROOT->Macro("PROOF-INF/SETUP.C");
+    }
+    
+    gSystem->ChangeDirectory("../");
+  } 
+  return 1;
+}
index 42f618c..6c34388 100644 (file)
@@ -15,6 +15,7 @@ SRCS= SPECTRA/AliProtonAnalysisBase.cxx \
       SPECTRA/AliProtonFeedDownAnalysis.cxx \
       SPECTRA/AliProtonAbsorptionCorrection.cxx \
       SPECTRA/AliProtonSpectraCorrection.cxx \
+      SPECTRA/AliProtonCorrectionAnalysisTask.cxx \
       SPECTRA/AliAnalysisCentralCutMC.cxx \
       SPECTRA/AliAnalysisCentralCutESD.cxx \
       SPECTRA/AliAnalysisCentralCutEvtMC.cxx \