Running analysis exemple and exemple of generation of AOD files from ESD (Gines)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Oct 2007 12:56:38 +0000 (12:56 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Oct 2007 12:56:38 +0000 (12:56 +0000)
PWG3/RunAODGeneration.C [new file with mode: 0644]
PWG3/RunAnalysis.C [new file with mode: 0644]

diff --git a/PWG3/RunAODGeneration.C b/PWG3/RunAODGeneration.C
new file mode 100644 (file)
index 0000000..bd700fd
--- /dev/null
@@ -0,0 +1,52 @@
+//
+//  Macro for AOD generation 
+//  Gines Martinez, Subatech, October. 2007
+//  Generated from Andrea Morsch macro JetAnalysisManagerLoc.C
+//
+//  In this example the libraries PWG0base and PWG3base (not really needed in this version) 
+//  are supposed to be loaded from a par file via RunAnalysis
+//
+void RunAODGeneration(char* filein = "AliESDs.root", char* fileout = "AliAOD.root" )
+{
+    gSystem->Load("libTree");
+    gSystem->Load("libGeom");
+    gSystem->Load("libVMC");
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libSTEERBase");
+    gSystem->Load("libAOD");
+    gSystem->Load("libESD");  
+  
+    // Input ESD files
+    TChain* chain = new TChain("esdTree");
+    chain->Add(filein);
+    
+    // Make aod handler
+    AliAODHandler* aodHandler = new AliAODHandler();
+    aodHandler->SetOutputFileName(fileout);
+    
+    // Make the analysis manager
+    AliAnalysisManager *mgr  = new AliAnalysisManager("AOD Manager", "AOD Manager");
+    mgr->SetOutputEventHandler(aodHandler);
+    mgr-> SetDebugLevel(10);
+    
+    // Task for AOD generation from PWG0base directory
+    AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
+    esdfilter->SetDebugLevel(10);
+    mgr->AddTask(esdfilter);
+  
+    //
+    // Create containers for input/output
+    AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), 
+                                                            AliAnalysisManager::kInputContainer);
+    AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),
+                                                             AliAnalysisManager::kOutputContainer, "default");
+
+    mgr->ConnectInput  (esdfilter,  0, cinput1  );
+    mgr->ConnectOutput (esdfilter,  0, coutput1 );
+
+    
+    // Run the analysis    
+    mgr->InitAnalysis();
+    mgr->PrintStatus();
+    mgr->StartAnalysis("local",chain);
+}
diff --git a/PWG3/RunAnalysis.C b/PWG3/RunAnalysis.C
new file mode 100644 (file)
index 0000000..84cc707
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// Example to generate the PWG3base library from a par file
+// par file is created in ALICE_ROOT directory via make PGW3base.par
+// To run the generation of AOD you also need the PWG0base.par file
+// Gines Martinez, Nantes oct 2007
+//
+// Copy the par file to your working directory and execute root
+// .L $ALICE_ROOT/PWG3/RunAnalysis.C
+// setupPar("PWG3base")
+// setupPar("PWG0base") 
+// Now you can run you analysis macro
+// .L RunAODGeneration.C
+// 
+   
+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;
+}