code cleanup
[u/mrichter/AliRoot.git] / PWG0 / multiplicity / run.C
index faa4074..3268523 100644 (file)
@@ -12,17 +12,24 @@ void run(Char_t* data, Long64_t nRuns = -1, Long64_t offset = 0, Bool_t aDebug =
     TProof::Open("lxb6046");
 
     // Enable the needed package
-    /*gProof->UploadPackage("STEERBase");
-    gProof->EnablePackage("STEERBase");
-    gProof->UploadPackage("ESD");
-    gProof->EnablePackage("ESD");
-    gProof->UploadPackage("AOD");
-    gProof->EnablePackage("AOD");
-    gProof->UploadPackage("ANALYSIS");
-    gProof->EnablePackage("ANALYSIS");*/
-
-    gProof->UploadPackage("$ALICE_ROOT/AF-v4-12");
-    gProof->EnablePackage("$ALICE_ROOT/AF-v4-12");
+    if (1)
+    {
+      gProof->UploadPackage("$ALICE_ROOT/STEERBase");
+      gProof->EnablePackage("$ALICE_ROOT/STEERBase");
+      gProof->UploadPackage("$ALICE_ROOT/ESD");
+      gProof->EnablePackage("$ALICE_ROOT/ESD");
+      gProof->UploadPackage("$ALICE_ROOT/AOD");
+      gProof->EnablePackage("$ALICE_ROOT/AOD");
+      gProof->UploadPackage("$ALICE_ROOT/ANALYSIS");
+      gProof->EnablePackage("$ALICE_ROOT/ANALYSIS");
+      gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice");
+      gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice");
+    }
+    else
+    {
+      gProof->UploadPackage("$ALICE_ROOT/AF-v4-12");
+      gProof->EnablePackage("$ALICE_ROOT/AF-v4-12");
+    }
 
     gProof->UploadPackage("$ALICE_ROOT/PWG0base");
     gProof->EnablePackage("$ALICE_ROOT/PWG0base");
@@ -33,12 +40,14 @@ void run(Char_t* data, Long64_t nRuns = -1, Long64_t offset = 0, Bool_t aDebug =
     gSystem->Load("libTree");
     gSystem->Load("libSTEERBase");
     gSystem->Load("libESD");
+    gSystem->Load("libAOD");
     gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
     gSystem->Load("libPWG0base");
   }
 
   // Create the analysis manager
-  mgr = new AliAnalysisManager("testAnalysis");
+  mgr = new AliAnalysisManager;
 
   AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD;
 
@@ -77,6 +86,37 @@ void run(Char_t* data, Long64_t nRuns = -1, Long64_t offset = 0, Bool_t aDebug =
     mgr->SetMCtruthEventHandler(handler);
   }
 
+  // pt study
+  TString optionStr(option);
+  if (optionStr.Contains("pt-spectrum-func"))
+  {
+    //TF1* func = new TF1("func", "0.7 + x", 0, 0.3);
+    //TF1* func = new TF1("func", "1.3 - x", 0, 0.3);
+    //TF1* func = new TF1("func", "1", 0, 0.3);
+    //new TCanvas; func->Draw();
+    //inputList.Add(func->GetHistogram()->Clone("pt-spectrum"));
+
+    TFile* file = TFile::Open("ptspectrum_fit.root");
+    if (!file)
+    {
+      Printf("Could not open ptspectrum_fit.root");
+      return;
+    }
+
+    TString subStr(optionStr(optionStr.Index("pt-spectrum-func")+17, 3));
+    TString histName(Form("ptspectrum_%s", subStr.Data()));
+    Printf("Pt-Spectrum modification. Using %s.", histName.Data());
+    TH1* hist = (TH1*) file->Get(histName);
+    if (!hist)
+    {
+      Printf("Could not read histogram.");
+      return;
+    }
+
+    new TCanvas; hist->Draw();
+    task->SetPtSpectrum((TH1*) hist->Clone("pt-spectrum"));
+  }
+
   // Add ESD handler
   AliESDInputHandler* esdH = new AliESDInputHandler;
   mgr->SetInputEventHandler(esdH);
@@ -112,5 +152,4 @@ void run(Char_t* data, Long64_t nRuns = -1, Long64_t offset = 0, Bool_t aDebug =
 
     mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain);
   }
-
 }