Commiting the new analysis examples
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Nov 2007 15:54:49 +0000 (15:54 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Nov 2007 15:54:49 +0000 (15:54 +0000)
14 files changed:
PWG2/AnalysisMacros/Batch/analysisESD.jdl
PWG2/AnalysisMacros/Batch/global.xml [new file with mode: 0644]
PWG2/AnalysisMacros/Batch/runBatch.C [new file with mode: 0644]
PWG2/AnalysisMacros/Batch/validation.sh [new file with mode: 0644]
PWG2/AnalysisMacros/Interactive/runInteractive.C [new file with mode: 0644]
PWG2/AnalysisMacros/Interactive/tag.xml [new file with mode: 0644]
PWG2/AnalysisMacros/Kine/AliAnalysisTaskPtMC.cxx [new file with mode: 0644]
PWG2/AnalysisMacros/Kine/AliAnalysisTaskPtMC.h [new file with mode: 0644]
PWG2/AnalysisMacros/Kine/runKine.C [new file with mode: 0644]
PWG2/AnalysisMacros/Local/AliAnalysisTaskPt.cxx
PWG2/AnalysisMacros/Local/AliAnalysisTaskPt.h
PWG2/AnalysisMacros/Local/runLocal.C [new file with mode: 0644]
PWG2/AnalysisMacros/Proof/runProof.C [new file with mode: 0644]
PWG2/AnalysisMacros/README

index e11a333..511c965 100644 (file)
@@ -11,31 +11,43 @@ SplitMaxInputFileNumber="5";
 # this job has to run in the ANALYSIS partition
 Requirements=( member(other.GridPartitions,"Analysis") );
 
+# validation command
+Validationcommand ="/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/validation.sh";
+
 # we need ROOT and the API service configuration package
-Packages={"APISCONFIG::V2.4","VO_ALICE@ROOT::v5-15-08"};
+Packages={"APISCONFIG::V2.4","VO_ALICE@ROOT::v5-16-00"};
+
+# Time to live
 TTL = "30000";
 
+# Automatic merging
+Merge={"Pt.ESD.root:/alice/jdl/mergerootfile.jdl:Pt.ESD.Merged.root"};
+
+# Output dir of the automatic merging
+MergeOutputDir="/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/output/";
+
 #ROOT will read this collection file to know, which files to analyze
 InputDataList="wn.xml";
 
 #ROOT requires the collection file in the xml-single format
-InputDataListFormat="merge:/alice/cern.ch/user/p/pchrist/test/Rev-14/global.xml";
+InputDataListFormat="merge:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/global.xml";
 
 # this is our collection file containing the files to be analyzed
-InputDataCollection="LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/global.xml,nodownload";
+InputDataCollection="LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/global.xml,nodownload";
 
-InputFile= {"LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/runESDAnalysis.C",
-            "LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/demoESDBatch.C",
-            "LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/ESD.par",
-            "LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/ANALYSIS.par",
-            "LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/AliAnalysisTaskPt.h",
-            "LF:/alice/cern.ch/user/p/pchrist/test/Rev-14/AliAnalysisTaskPt.cxx"};
+InputFile= {"LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/runBatch.C",
+            "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/STEERBase.par",
+            "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ESD.par",
+            "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AOD.par",
+            "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/ANALYSIS.par",
+            "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.h",
+            "LF:/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/AliAnalysisTaskPt.cxx"};
 
 # Output archive           
-OutputArchive={"log_archive:stdout,stderr@Alice::CERN::se","root_archive.zip:*.root@Alice::CERN::se"};
+OutputArchive={"log_archive:stdout,stderr,*.log@Alice::CERN::se","root_archive.zip:*.root@Alice::CERN::se"};
 
 # Output directory
-OutputDir="/alice/cern.ch/user/p/pchrist/test/Rev-14/output/#alien_counter#";
+OutputDir="/alice/cern.ch/user/p/pchrist/Tutorial/BATCH/output/#alien_counter#";
 
 # email
 Email="Panos.Christakoglou@cern.ch";
diff --git a/PWG2/AnalysisMacros/Batch/global.xml b/PWG2/AnalysisMacros/Batch/global.xml
new file mode 100644 (file)
index 0000000..548c8eb
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<alien>
+  <collection name="global">
+    <event name="1">
+      <file name="AliESDs.root" guid="00529d2e-33c5-16dd-8001-89ab9e86beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/001/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/001/AliESDs.root" evlist="0,4,21,38,47,50,57,79,86,88" />
+    </event>
+    <event name="2">
+      <file name="AliESDs.root" guid="007ac006-639b-16d8-8001-b0c88e80beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/010/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/010/AliESDs.root" evlist="19,23,35,36,41,51,58,60,76" />
+    </event>
+    <event name="3">
+      <file name="AliESDs.root" guid="00751cd2-a3ee-16d8-8001-2101a8c0beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/002/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/002/AliESDs.root" evlist="16,20,45,52,84" />
+    </event>
+    <event name="4">
+      <file name="AliESDs.root" guid="0075f1a2-a063-16d8-8001-3301a8c0beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/003/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/003/AliESDs.root" evlist="42,54,55,63,93" />
+    </event>
+    <event name="5">
+      <file name="AliESDs.root" guid="004ff182-b048-16d8-8001-7f65010abeef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/004/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/004/AliESDs.root" evlist="0,6,10,35,47,74" />
+    </event>
+    <event name="6">
+      <file name="AliESDs.root" guid="003471dc-ec6f-16d8-8001-2301a8c0beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/005/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/005/AliESDs.root" evlist="16,18,24,32,43,52,64,72,82,86,98" />
+    </event>
+    <event name="7">
+      <file name="AliESDs.root" guid="002f608e-68d1-16d8-8001-1d858e80beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/006/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/006/AliESDs.root" evlist="6,19,22,51,52" />
+    </event>
+    <event name="8">
+      <file name="AliESDs.root" guid="000e3634-2eea-16dd-8001-f6ffff0abeef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/007/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/007/AliESDs.root" evlist="37,50,73,82,91,92" />
+    </event>
+    <event name="9">
+      <file name="AliESDs.root" guid="001a5b08-a411-16d8-9717-7064a8c0beef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/008/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/008/AliESDs.root" evlist="41,42,62,80" />
+    </event>
+    <event name="10">
+      <file name="AliESDs.root" guid="00025fee-6023-16d8-8001-b7275d9fbeef" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/009/AliESDs.root" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/009/AliESDs.root" evlist="19,20,21,45,47,60,65,77,81" />
+    </event>
+  </collection>
+</alien>
diff --git a/PWG2/AnalysisMacros/Batch/runBatch.C b/PWG2/AnalysisMacros/Batch/runBatch.C
new file mode 100644 (file)
index 0000000..2343d0b
--- /dev/null
@@ -0,0 +1,143 @@
+void runBatch() {
+  TStopwatch timer;
+  timer.Start();
+
+  printf("*** Connect to AliEn ***\n");
+  TGrid::Connect("alien://");
+  gSystem->Load("libProofPlayer.so");
+
+  //____________________________________________________//
+  //_____________Setting up STEERBase.par_______________//
+  //____________________________________________________//
+  setupPar("STEERBase");
+  gSystem->Load("libSTEERBase.so");
+
+  //____________________________________________________//
+  //_____________Setting up ESD.par_____________________//
+  //____________________________________________________//
+  setupPar("ESD");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libESD.so");
+
+  //____________________________________________________//
+  //_____________Setting up AOD.par_____________________//
+  //____________________________________________________//
+  setupPar("AOD");
+  gSystem->Load("libAOD.so");
+
+  //_____________________________________________________________//
+  //_____________Setting up ANALYSIS_NEW.par_____________________//
+  //_____________________________________________________________//
+  setupPar("ANALYSIS");
+  gSystem->Load("libANALYSIS.so");
+
+  gROOT->LoadMacro("AliAnalysisTaskPt.cxx+");
+
+  //CreateXML();
+  
+  //ANALYSIS PART
+  const char *collectionfile = "wn.xml";
+
+  //____________________________________________//
+  //Usage of event tags
+  AliTagAnalysis *analysis = new AliTagAnalysis();
+  TChain *chain = 0x0;
+  chain = analysis->GetChainFromCollection(collectionfile,"esdTree");
+  chain->SetBranchStatus("*Calo*",0);
+   
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);  
+  //____________________________________________//
+  // 1st Pt task
+  AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt");
+  mgr->AddTask(task1);
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");
+  
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local",chain);
+
+  timer.Stop();
+  timer.Print();
+}
+
+void CreateXML() {
+  // Create A tag analysis object and impose some selection criteria
+  AliTagAnalysis *tagAna = new AliTagAnalysis(); 
+
+  //Case where the tag files are stored locally
+  //TagAna->ChainLocalTags(".");
+
+  //Case where the tag files are stored in the file catalog
+  //pp.xml is the xml collection of tag files that was produced 
+  //by querying the file catalog.
+  TAlienCollection* coll = TAlienCollection::Open("tag.xml");
+  TGridResult* tagResult = coll->GetGridResult("",0,0);
+  tagAna->ChainGridTags(tagResult);
+
+  //__________________________//
+  //Usage of string statements//
+  //__________________________//
+  /*const char* fRunCuts = "fAliceRunId == 340";
+  const char* fEventCuts = "(fEventTag.fTopPtMin >= 1.0)&&(fEventTag.fNumberOfTracks >= 11)&&(fEven
+tTag.fNumberOfTracks <= 12)";
+  tagAna->CreateXMLCollection("global",fRunCuts,fEventCuts);*/
+
+  //________________________________________________//
+  //          Usage of Ali*TagCuts classes          //
+  //________________________________________________//
+  // create a RunTagCut object
+  AliRunTagCuts *runCuts = new AliRunTagCuts();
+  // create a LHCTagCut object
+  AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+  // create a DetectorTagCut object
+  AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+  // create an EventTagCut object
+  AliEventTagCuts *evCuts = new AliEventTagCuts();
+  evCuts->SetMultiplicityRange(11,12);
+  tagAna->CreateXMLCollection("global",runCuts,lhcCuts,detCuts,evCuts);
+}  
+
+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("runProcess","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;
+}
diff --git a/PWG2/AnalysisMacros/Batch/validation.sh b/PWG2/AnalysisMacros/Batch/validation.sh
new file mode 100644 (file)
index 0000000..4086b27
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+##################################################
+validateout=`dirname $0`
+validatetime=`date`
+validated="0";
+error=1
+if [ -z $validateout ]
+then
+    validateout="."
+fi
+
+cd $validateout;
+validateworkdir=`pwd`;
+
+echo "*******************************************************" >> stdout;
+echo "* AliRoot Validation Script V1.0                      *" >> stdout;
+echo "* Time:    $validatetime " >> stdout;
+echo "* Dir:     $validateout" >> stdout;
+echo "* Workdir: $validateworkdir" >> stdout;
+echo "* ----------------------------------------------------*" >> stdout;
+ls -la ./ >> stdout;
+echo "* ----------------------------------------------------*" >> stdout;
+
+##################################################
+if [ -f job.log ] 
+then 
+sv=`grep -i  "Segmentation violation" *.log`
+if [ "$sv" = "" ]
+    then
+    sf=`grep -i  "Segmentation fault" *.log`
+    if [ "$sf" = "" ]
+       then
+       be=`grep -i  "Bus error" *.log`
+       if [ "$be" = "" ]
+           then
+           ab=`grep -i "Abort" *.log`
+           if [ "$ab" = "" ]
+               then
+               fp=`grep -i  "Floating point exception" *.log`
+               if [ "$fp" = "" ]
+                   then
+                   kl=`grep -i  "Killed" *.log`
+                   if [ "$kl" = "" ]
+                       then
+                       bf=`grep -i "busy flag cleared" *.log`
+                       if [ "$bf" = "" ]
+                           then
+                           echo "* ----------------   Job Validated  ------------------*" >> stdout;
+                           error="0";
+                           else
+                           echo "* ----------------   Job Not Validated  ------------------*" >> stdout;                           
+                       fi
+                   fi;
+               fi
+           fi
+       fi
+    fi
+fi
+else
+    echo "* ########## Job not validated - no job.log  ###" >> stdout;
+fi
+if [ "$error" = "1" ] 
+    then
+    echo "* ################   Job not validated ################" >> stdout;
+fi
+echo "* ----------------------------------------------------*" >> stdout;
+echo "*******************************************************" >> stdout;
+sleep 15;
+cd -
+echo $error
+exit $error
diff --git a/PWG2/AnalysisMacros/Interactive/runInteractive.C b/PWG2/AnalysisMacros/Interactive/runInteractive.C
new file mode 100644 (file)
index 0000000..48dd03b
--- /dev/null
@@ -0,0 +1,111 @@
+void runInteractive() {
+  TStopwatch timer;
+  timer.Start();
+  gSystem->Load("libProofPlayer.so");
+
+  printf("*** Connect to AliEn ***\n");
+  TGrid::Connect("alien://");
+  //____________________________________________________//
+  //_____________Setting up STEERBase.par_______________//
+  //____________________________________________________//
+  setupPar("STEERBase");
+  gSystem->Load("libSTEERBase.so");
+
+  //____________________________________________________//
+  //_____________Setting up ESD.par_____________________//
+  //____________________________________________________//
+  setupPar("ESD");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libESD.so");
+
+  //____________________________________________________//
+  //_____________Setting up AOD.par_____________________//
+  //____________________________________________________//
+  setupPar("AOD");
+  gSystem->Load("libAOD.so");
+
+  //_____________________________________________________________//
+  //_____________Setting up ANALYSIS_NEW.par_____________________//
+  //_____________________________________________________________//
+  setupPar("ANALYSIS");
+  gSystem->Load("libANALYSIS.so");
+
+  gROOT->LoadMacro("AliAnalysisTaskPt.cxx+");
+  
+  //____________________________________________//
+  AliTagAnalysis *TagAna = new AliTagAnalysis("ESD");
+  AliRunTagCuts *runCuts = new AliRunTagCuts();
+  AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+  AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+  AliEventTagCuts *evCuts = new AliEventTagCuts();
+  evCuts->SetMultiplicityRange(11,12);
+
+  //grid tags
+  TAlienCollection* coll = TAlienCollection::Open("tag.xml");
+  TGridResult* TagResult = coll->GetGridResult("",0,0);
+  TagAna->ChainGridTags(TagResult);
+  TChain* chain = 0x0;
+  chain = TagAna->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
+  chain->SetBranchStatus("*Calo*",0);
+
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);  
+  //____________________________________________//
+  // 1st Pt task
+  AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt");
+  mgr->AddTask(task1);
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");
+  
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local",chain);
+
+  timer.Stop();
+  timer.Print();
+}
+
+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;
+}
diff --git a/PWG2/AnalysisMacros/Interactive/tag.xml b/PWG2/AnalysisMacros/Interactive/tag.xml
new file mode 100644 (file)
index 0000000..3b385f2
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<alien>
+  <collection name="tag">
+    <event name="1">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-04 12:42:49" dir="4443499" entryId="4443508" expiretime="" gowner="aliprod" guid="62FE4A2A-5AD3-11DC-A677-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/001/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23318" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/001/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="10">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-08-31 21:23:23" dir="4376483" entryId="4376492" expiretime="" gowner="aliprod" guid="981764F6-57F6-11DC-A546-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/010/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23559" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/010/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="2">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-01 01:41:05" dir="4397616" entryId="4397625" expiretime="" gowner="aliprod" guid="473620AC-581B-11DC-8F8F-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/002/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23386" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/002/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="3">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-01 01:40:24" dir="4397463" entryId="4397472" expiretime="" gowner="aliprod" guid="3ACFED58-581A-11DC-AAA7-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/003/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23377" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/003/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="4">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-01 02:46:20" dir="4407340" entryId="4407349" expiretime="" gowner="aliprod" guid="62B1F4F6-5824-11DC-AC01-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/004/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23535" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/004/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="5">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-01 06:54:05" dir="4430698" entryId="4430707" expiretime="" gowner="aliprod" guid="862CF3A0-5846-11DC-96C1-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/005/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23466" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/005/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="6">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-08-31 21:45:06" dir="4379238" entryId="4379247" expiretime="" gowner="aliprod" guid="38A1BA32-57F9-11DC-A3D4-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/006/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23477" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/006/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="7">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-04 12:35:07" dir="4442428" entryId="4442437" expiretime="" gowner="aliprod" guid="562DD348-5AD2-11DC-A649-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/007/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23411" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/007/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="8">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-09-01 03:06:58" dir="4410621" entryId="4410630" expiretime="" gowner="aliprod" guid="A79C7E90-5826-11DC-9133-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/008/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23302" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/008/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <event name="9">
+      <file name="Run8268.Event0_100.ESD.tag.root" aclId="" ctime="2007-08-31 21:01:48" dir="4374477" entryId="4374486" expiretime="" gowner="aliprod" guid="AA12A254-57F3-11DC-BD72-000423B5AB42" lfn="/alice/sim/2007/LHC07c/pp_minbias/8268/009/Run8268.Event0_100.ESD.tag.root" md5="" owner="aliprod" perm="755" replicated="0" size="23397" turl="alien:///alice/sim/2007/LHC07c/pp_minbias/8268/009/Run8268.Event0_100.ESD.tag.root" type="f" />
+    </event>
+    <info command="[/alice/cern.ch/user/p/pchrist/]: find -z -x tag -l 10 /alice/sim/2007/LHC07c/pp_minbias/8268/* *tag.root" creator="admin" date="Mon Oct 22 12:18:19 CEST 2007" timestamp="1193048299" />
+  </collection>
+</alien>
diff --git a/PWG2/AnalysisMacros/Kine/AliAnalysisTaskPtMC.cxx b/PWG2/AnalysisMacros/Kine/AliAnalysisTaskPtMC.cxx
new file mode 100644 (file)
index 0000000..d9bbef6
--- /dev/null
@@ -0,0 +1,121 @@
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TCanvas.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
+
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+
+#include "AliAnalysisTaskPtMC.h"
+
+// example of an analysis task creating a p_t spectrum
+// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing
+
+ClassImp(AliAnalysisTaskPtMC)
+
+//________________________________________________________________________
+AliAnalysisTaskPtMC::AliAnalysisTaskPtMC(const char *name) 
+  : AliAnalysisTask(name, ""), fESD(0), fHistPt(0)
+{
+  // Constructor
+
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
+  DefineInput(0, TChain::Class());
+  // Output slot #0 writes into a TH1 container
+  DefineOutput(0, TH1F::Class());
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskPtMC::ConnectInputData(Option_t *) 
+{
+  // Connect ESD or AOD here
+  // Called once
+
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } else {
+    // Disable all branches, we want to process only MC
+    tree->SetBranchStatus("*", kFALSE);
+
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+    if (!esdH) {
+      Printf("ERROR: Could not get ESDInputHandler");
+    } else
+      fESD = esdH->GetEvent();
+  }
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskPtMC::CreateOutputObjects() 
+{
+  // Create histograms
+  // Called once
+
+  fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
+  fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+  fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+  fHistPt->SetMarkerStyle(kFullCircle);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskPtMC::Exec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+
+  // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
+  // This handler can return the current MC event
+
+  AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  if (!eventHandler) {
+    Printf("ERROR: Could not retrieve MC event handler");
+    return;
+  }
+
+  AliMCEvent* mcEvent = eventHandler->MCEvent();
+  if (!mcEvent) {
+     Printf("ERROR: Could not retrieve MC event");
+     return;
+  }
+
+  Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
+
+  for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {
+    AliMCParticle* track = mcEvent->GetTrack(iTracks);
+    if (!track) {
+      Printf("ERROR: Could not receive track %d (mc loop)", iTracks);
+      continue;
+    }
+      
+    fHistPt->Fill(track->Pt());
+  } //track loop 
+
+  // Post output data.
+  PostData(0, fHistPt);
+}      
+
+//________________________________________________________________________
+void AliAnalysisTaskPtMC::Terminate(Option_t *) 
+{
+  // Draw result to the screen
+  // Called once at the end of the query
+
+  fHistPt = dynamic_cast<TH1F*> (GetOutputData(0));
+  if (!fHistPt) {
+    Printf("ERROR: fHistPt not available");
+    return;
+  }
+   
+  TCanvas *c1 = new TCanvas("AliAnalysisTaskPtMC","Pt MC",10,10,510,510);
+  c1->cd(1)->SetLogy();
+  fHistPt->DrawCopy("E");
+}
diff --git a/PWG2/AnalysisMacros/Kine/AliAnalysisTaskPtMC.h b/PWG2/AnalysisMacros/Kine/AliAnalysisTaskPtMC.h
new file mode 100644 (file)
index 0000000..d0c35eb
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef AliAnalysisTaskPtMC_cxx
+#define AliAnalysisTaskPtMC_cxx
+
+// example of an analysis task creating a p_t spectrum
+// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing
+
+class TH1F;
+class AliESDEvent;
+
+#include "AliAnalysisTask.h"
+
+class AliAnalysisTaskPtMC : public AliAnalysisTask {
+ public:
+  AliAnalysisTaskPtMC(const char *name = "AliAnalysisTaskPtMC");
+  virtual ~AliAnalysisTaskPtMC() {}
+  
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+  
+ private:
+  AliESDEvent *fESD;    //ESD object
+  TH1F        *fHistPt; //Pt spectrum
+   
+  AliAnalysisTaskPtMC(const AliAnalysisTaskPtMC&); // not implemented
+  AliAnalysisTaskPtMC& operator=(const AliAnalysisTaskPtMC&); // not implemented
+
+  ClassDef(AliAnalysisTaskPtMC, 1); // example of analysis
+};
+
+#endif
diff --git a/PWG2/AnalysisMacros/Kine/runKine.C b/PWG2/AnalysisMacros/Kine/runKine.C
new file mode 100644 (file)
index 0000000..ffb70d2
--- /dev/null
@@ -0,0 +1,104 @@
+void runKine() {
+  TStopwatch timer;
+  timer.Start();
+  gSystem->Load("libTree.so");
+  //____________________________________________________//
+  //_____________Setting up STEERBase.par_______________//
+  //____________________________________________________//
+  setupPar("STEERBase");
+  gSystem->Load("libSTEERBase.so");
+
+  //____________________________________________________//
+  //_____________Setting up ESD.par_____________________//
+  //____________________________________________________//
+  setupPar("ESD");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libESD.so");
+                                                                                 //____________________________________________________//
+  //_____________Setting up AOD.par_____________________//
+  //____________________________________________________//
+  setupPar("AOD");
+  gSystem->Load("libAOD.so");
+                                                                
+  //_____________________________________________________________//
+  //_____________Setting up ANALYSIS_NEW.par_____________________//
+  //_____________________________________________________________//
+  setupPar("ANALYSIS");
+  gSystem->Load("libANALYSIS.so");
+                                                                                                                                               
+  gROOT->LoadMacro("AliAnalysisTaskPtMC.cxx+");
+
+  //____________________________________________//
+  AliTagAnalysis *TagAna = new AliTagAnalysis("ESD"); 
+  TagAna->ChainLocalTags("../Tags");
+
+  AliRunTagCuts *runCuts = new AliRunTagCuts();
+  AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+  AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+  AliEventTagCuts *evCuts = new AliEventTagCuts();
+  evCuts->SetMultiplicityRange(11,12);  
+  
+  TChain* chain = 0x0;
+  chain = TagAna->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
+  chain->SetBranchStatus("*Calo*",0);
+
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);  
+  AliMCEventHandler *mc = new AliMCEventHandler();
+  mgr->SetMCtruthEventHandler(mc);
+  //____________________________________________//
+  // 1st Pt task
+  AliAnalysisTaskPtMC *task1 = new AliAnalysisTaskPtMC("TaskPtMC");
+  mgr->AddTask(task1);
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.MC.root");
+  
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local",chain);
+
+  timer.Stop();
+  timer.Print();
+}
+
+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 a857acb..c4cdd50 100644 (file)
-#define AliAnalysisTaskPt_cxx
-#include "TROOT.h"
 #include "TChain.h"
-#include "TH1.h"
+#include "TTree.h"
+#include "TH1F.h"
 #include "TCanvas.h"
-#include "TSystem.h"
-#include "Riostream.h"
 
 #include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
 
-#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliESDInputHandler.h"
 
 #include "AliAnalysisTaskPt.h"
 
+// example of an analysis task creating a p_t spectrum
+// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing
+
 ClassImp(AliAnalysisTaskPt)
 
 //________________________________________________________________________
-AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name) :AliAnalysisTask(name,""), fESD(0), fHistPt(0) {
-  // Constructor.
-  // Input slot #0 works with an Ntuple
+AliAnalysisTaskPt::AliAnalysisTaskPt(const char *name) 
+  : AliAnalysisTask(name, ""), fESD(0), fHistPt(0)
+{
+  // Constructor
+
+  // Define input and output slots here
+  // Input slot #0 works with a TChain
   DefineInput(0, TChain::Class());
   // Output slot #0 writes into a TH1 container
   DefineOutput(0, TH1F::Class());
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskPt::ConnectInputData(Option_t *) {
-  printf("   ConnectInputData %s\n", GetName());
+void AliAnalysisTaskPt::ConnectInputData(Option_t *) 
+{
+  // Connect ESD or AOD here
+  // Called once
 
-  char ** address = (char **)GetBranchAddress(0, "ESD");
-  if (address) {
-    fESD = (AliESD*)(*address);
-  }
-  else  {
-    fESD = new AliESD();
-    SetBranchAddress(0, "ESD", &fESD);
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } else {
+    // Disable all branches and enable only the needed ones
+    // The next two lines are different when data produced as AliESDEvent is read
+    tree->SetBranchStatus("*", kFALSE);
+    tree->SetBranchStatus("fTracks.*", kTRUE);
+
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+
+    if (!esdH) {
+      Printf("ERROR: Could not get ESDInputHandler");
+    } else
+      fESD = esdH->GetEvent();
   }
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskPt::CreateOutputObjects() {
-  if (!fHistPt) {
-    fHistPt = new TH1F("fHistPt","This is the Pt distribution",15,0.1,3.1);
-    fHistPt->SetStats(kTRUE);
-    fHistPt->GetXaxis()->SetTitle("P_{T} [GeV]");
-    fHistPt->GetYaxis()->SetTitle("#frac{dN}{dP_{T}}");
-    fHistPt->GetXaxis()->SetTitleColor(1);
-    fHistPt->SetMarkerStyle(kFullCircle);
-  }
+void AliAnalysisTaskPt::CreateOutputObjects()
+{
+  // Create histograms
+  // Called once
+
+  fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1);
+  fHistPt->GetXaxis()->SetTitle("P_{T} (GeV/c)");
+  fHistPt->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
+  fHistPt->SetMarkerStyle(kFullCircle);
 }
 
 //________________________________________________________________________
-void AliAnalysisTaskPt::Exec(Option_t *) {
-  // Task making a pt distribution.
-  // Get input data
-  TChain *chain = (TChain*)GetInputData(0);
-  Long64_t ientry = chain->GetReadEntry();
-  if (!fESD) return;
-
-  cout<<"Entry: "<<ientry<<" - Tracks: "<<fESD->GetNumberOfTracks()<<endl;
-  
-  for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
-    AliESDtrack * track = fESD->GetTrack(iTracks);
-    //UInt_t status = track->GetStatus();
-    Double_t momentum[3];
-    track->GetPxPyPz(momentum);
-    Double_t Pt = sqrt(pow(momentum[0],2) + pow(momentum[1],2));
-    fHistPt->Fill(Pt);
-  }//track loop 
-  // Post final data. It will be written to a file with option "RECREATE"
+void AliAnalysisTaskPt::Exec(Option_t *) 
+{
+  // Main loop
+  // Called for each event
+
+  if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+  Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
+
+  // Track loop to fill a pT spectrum
+  for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
+    AliESDtrack* track = fESD->GetTrack(iTracks);
+    if (!track) {
+      Printf("ERROR: Could not receive track %d", iTracks);
+      continue;
+    }
+
+    fHistPt->Fill(track->Pt());
+  } //track loop 
+
+  // Post output data.
   PostData(0, fHistPt);
 }      
 
 //________________________________________________________________________
-void AliAnalysisTaskPt::Terminate(Option_t *) {
-  // Draw some histogram at the end.
-  if (!gROOT->IsBatch()) {
-    TCanvas *c1 = new TCanvas("c1","Pt",10,10,510,510);
-    c1->SetFillColor(10); c1->SetHighLightColor(10);
-    c1->cd(1)->SetLeftMargin(0.15); c1->cd(1)->SetBottomMargin(0.15);  
-    c1->cd(1)->SetLogy();
-    fHistPt = (TH1F*)GetOutputData(0);
-    if (fHistPt) fHistPt->DrawCopy("E");
+void AliAnalysisTaskPt::Terminate(Option_t *) 
+{
+  // Draw result to the screen
+  // Called once at the end of the query
+
+  fHistPt = dynamic_cast<TH1F*> (GetOutputData(0));
+  if (!fHistPt) {
+    Printf("ERROR: fHistPt not available");
+    return;
   }
+   
+  TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","Pt",10,10,510,510);
+  c1->cd(1)->SetLogy();
+  fHistPt->DrawCopy("E");
 }
index dea1b95..f606ecc 100644 (file)
@@ -1,15 +1,17 @@
-#include "TH1.h"
+#ifndef AliAnalysisTaskPt_cxx
+#define AliAnalysisTaskPt_cxx
 
-#include "AliESD.h"
+// example of an analysis task creating a p_t spectrum
+// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing
+
+class TH1F;
+class AliESDEvent;
 
 #include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-#include "AliAnalysisDataContainer.h"
 
 class AliAnalysisTaskPt : public AliAnalysisTask {
  public:
-  AliAnalysisTaskPt() : AliAnalysisTask(), fESD(0), fHistPt(0) {}
-  AliAnalysisTaskPt(const char *name);
+  AliAnalysisTaskPt(const char *name = "AliAnalysisTaskPt");
   virtual ~AliAnalysisTaskPt() {}
   
   virtual void   ConnectInputData(Option_t *);
@@ -18,8 +20,13 @@ class AliAnalysisTaskPt : public AliAnalysisTask {
   virtual void   Terminate(Option_t *);
   
  private:
-  AliESD *fESD; //ESD object
-  TH1F   *fHistPt; //Pt spectrum
+  AliESDEvent *fESD;    //ESD object
+  TH1F        *fHistPt; //Pt spectrum
    
+  AliAnalysisTaskPt(const AliAnalysisTaskPt&); // not implemented
+  AliAnalysisTaskPt& operator=(const AliAnalysisTaskPt&); // not implemented
+  
   ClassDef(AliAnalysisTaskPt, 1); // example of analysis
 };
+
+#endif
diff --git a/PWG2/AnalysisMacros/Local/runLocal.C b/PWG2/AnalysisMacros/Local/runLocal.C
new file mode 100644 (file)
index 0000000..238eabe
--- /dev/null
@@ -0,0 +1,102 @@
+void runLocal() {
+  TStopwatch timer;
+  timer.Start();
+  gSystem->Load("libTree.so");
+  //____________________________________________________//
+  //_____________Setting up STEERBase.par_______________//
+  //____________________________________________________//
+  setupPar("STEERBase");
+  gSystem->Load("libSTEERBase.so");
+
+  //____________________________________________________//
+  //_____________Setting up ESD.par_____________________//
+  //____________________________________________________//
+  setupPar("ESD");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libESD.so");
+                                                                                 //____________________________________________________//
+  //_____________Setting up AOD.par_____________________//
+  //____________________________________________________//
+  setupPar("AOD");
+  gSystem->Load("libAOD.so");
+                                                                
+  //_____________________________________________________________//
+  //_____________Setting up ANALYSIS_NEW.par_____________________//
+  //_____________________________________________________________//
+  setupPar("ANALYSIS");
+  gSystem->Load("libANALYSIS.so");
+                                                                                                                                               
+  gROOT->LoadMacro("AliAnalysisTaskPt.cxx+");
+
+  //____________________________________________//
+  AliTagAnalysis *TagAna = new AliTagAnalysis("ESD"); 
+  TagAna->ChainLocalTags("../Tags");
+
+  AliRunTagCuts *runCuts = new AliRunTagCuts();
+  AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+  AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+  AliEventTagCuts *evCuts = new AliEventTagCuts();
+  evCuts->SetMultiplicityRange(11,12);  
+  
+  TChain* chain = 0x0;
+  chain = TagAna->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
+  chain->SetBranchStatus("*Calo*",0);
+
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);  
+  //____________________________________________//
+  // 1st Pt task
+  AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt");
+  mgr->AddTask(task1);
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");
+  
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local",chain);
+
+  timer.Stop();
+  timer.Print();
+}
+
+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;
+}
diff --git a/PWG2/AnalysisMacros/Proof/runProof.C b/PWG2/AnalysisMacros/Proof/runProof.C
new file mode 100644 (file)
index 0000000..b5822f3
--- /dev/null
@@ -0,0 +1,58 @@
+void runProof() {
+  TStopwatch timer;
+  timer.Start();
+  
+  runProofESD("AliAnalysisTaskPt.cxx++");
+
+  timer.Stop();
+  timer.Print();
+}
+
+//==========================================//
+void runProofESD(const char *file) {
+  //the next line should point to the local $ALICE_ROOT
+  //that contains the latest ANALYSIS developments
+  gSystem->AddIncludePath("-I\"$ALICE_ROOT/include\"");
+  printf("****** Connect to PROOF *******\n");
+  TProof::Open("proof://lxb6046.cern.ch"); 
+  gProof->SetParallel(1);
+
+  // 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");
+  
+  // 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",10);
+  chain->SetBranchStatus("*Calo*",0);
+
+  gROOT->LoadMacro(file);
+  //____________________________________________//
+  // Make the analysis manager
+  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+  AliVEventHandler* esdH = new AliESDInputHandler;
+  mgr->SetInputEventHandler(esdH);  
+  //____________________________________________//
+  // 1st Pt task
+  AliAnalysisTaskPt *task1 = new AliAnalysisTaskPt("TaskPt");
+  mgr->AddTask(task1);
+  // Create containers for input/output
+  AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist1", TH1::Class(),AliAnalysisManager::kOutputContainer,"Pt.ESD.root");
+  //____________________________________________//
+  mgr->ConnectInput(task1,0,cinput1);
+  mgr->ConnectOutput(task1,0,coutput1);
+  if (!mgr->InitAnalysis()) return;
+  mgr->PrintStatus();
+  mgr->SetDebugLevel(2);
+  mgr->StartAnalysis("proof",chain);
+}
index 91bdcf4..c2bda35 100644 (file)
@@ -6,24 +6,22 @@ The AnalysisMacros is divided into three sub-directories:
 o) Local
    Inside this directory you can find the files you need to run the following processes:
     i)  (Sub-dir Tags)Creation tag files for the locally stored ESDs - The two files are stored under the Tags directory. Run it by typing "root runTagCreator.C".
-    ii) Analysis of the locally stored ESDs using the previously created tag files - Run the example by typing "root runAnalysis.C"
+    ii) Analysis of the locally stored ESDs using the previously created tag files - Run the example by typing "root runLocal.C"
 
 o) Interactive
-   You can find the runAnalysis.C and demoInteractive.C files that use the root api to access the grid. You should also use the AliAnalysisTaskPt.* from the Local directory. Run the example by typing "alienroot runAnalysis.C" (you can find the alienroot executable in this directory - open it and change it accordingly - place it in a directory which is defined in your $PATH).
+   You can find the runInteractive.C file that uses the root api to access the grid as well as a collection of tag files to be querried (tag.xml). You should also use the AliAnalysisTaskPt.* from the Local directory. Run the example by typing "alienroot runInteractive.C" (you can find the alienroot executable in this directory - open it and change it accordingly - place it in a directory which is defined in your $PATH).
 
 o) Batch
-   You can find the executable (that you should store under your $HOME/bin  AliEn directory), the jdl, the jdl file (you must change it accordingly), as well as the macro runProcess.C. You should also use the AliAnalysisTaskPt.* from the Local directory and the xml file from the Kine directory. Everybody who wants to use these files should change them accordingly!!!
+   You can find the executable (that you should store under your $HOME/bin  AliEn directory), the jdl file (you must change it accordingly), as well as the macro runBatch.C. You should also use the AliAnalysisTaskPt.* from the Local directory and the global.xml file (information on how to create this file can be found in the tutorial slides - CreateXML function). Everybody who wants to use these files should change them accordingly!!!
 
 o) Proof
-   You can find the runAnalysis.C and the demoCAF.C macros to be used for CAF. Follow the instructions written in the first file for the correct env. variables and the additional files needed (CreateESDChain.C & the txt file containing the ESDs' location).
-
-In order to run the examples you should use the ESD.par as well as the ANALYSIS.par. You can creat both par files by typing "make ESD.par" and "make ANALYSIS.par" respectively under $ALICE_ROOT.
+   You can find the runProof.C macro to be used for CAF. The CreateESDChain.C & the txt file containing the ESDs' location in the cluster can be found in the CAF web page.
 
 o) Kine
-   You can find the runProcess.C and the demoLocal.C macros along with the AliAnalysisTaskRLPt class. Use the example to access the MC information. You have to run it with aliroot. The last additions are the executable (should be stored in your $HOME/bin AliEn directory), the xml collection (run $ALICE_ROOT/STEER/CreateXML.C), the jdl (you must change it accordingly) and the macro to be used as a template for the batch sessions.
+   You can find the runKine.C along with the AliAnalysisTaskPtMC class. Use the example to access the MC information. You have to run it with root. If you follow the instructions indicated in the Local - Interactive - Batch - Proof directories you will be able to access the MC information on all kinds of sessions.
 
 o) packages
-   You can find the ESD.par and ANALYSIS.par having the latest updates to be used with PDC06 data
+   You can find the par files coming from the v4-07-Release to be used with PDC06 and PDC07 data.
 
 ===========================================================
 For any questions send mails to: Panos.Christakoglou@cern.ch