Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptation to root5 and convenience runAnalysis #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@
*.root
*.xml
*.pcm
*.sh
*.jdl

.cproject
.project


myAnalysis.C
myTask_merge.C
outputs_valid
stderr

5 changes: 5 additions & 0 deletions AddMyTask.C
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#if !defined (__CINT__) || defined (__CLING__)
#include "AliAnalysisManager.h"
#include "AliAnalysisTaskMyTask.h"
#endif

AliAnalysisTaskMyTask* AddMyTask(TString name = "name")
{
// get the manager via the static access member. since it's static, you don't need
Expand Down
1 change: 1 addition & 0 deletions AliAnalysisTaskMyTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "TH1F.h"
#include "TList.h"
#include "AliAnalysisTask.h"
#include "AliAnalysisTaskSE.h"
#include "AliAnalysisManager.h"
#include "AliAODEvent.h"
#include "AliAODInputHandler.h"
Expand Down
2 changes: 2 additions & 0 deletions AliAnalysisTaskMyTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#ifndef AliAnalysisTaskMyTask_H
#define AliAnalysisTaskMyTask_H

#if !defined (__CINT__) || defined (__CLING__)
#include "AliAnalysisTaskSE.h"
#endif

class AliAnalysisTaskMyTask : public AliAnalysisTaskSE
{
Expand Down
36 changes: 28 additions & 8 deletions runAnalysis.C
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
#include "TROOT.h"
#include "TSystem.h"
#if !defined (__CINT__) || defined (__CLING__)
#include "TInterpreter.h"
#include "TChain.h"
#include "AliAnalysisAlien.h"
#include "AliAnalysisManager.h"
#include "AliAODInputHandler.h"
// include the header of your analysis task here! for classes already compiled by aliBuild,
// precompiled header files (with extension pcm) are available, so that you do not need to
// specify includes for those. for your own task however, you (probably) have not generated a
// pcm file, so we need to include it explicitly
#include "AliAnalysisTaskMyTask.h"
#endif


void runAnalysis()
// run your analysis in the mode 'mode'
// if 'mode' is 'grid' the results will be merged via jdl on the grid if gridMerge is true
// available modes: "grid", "local", "test", "terminate"
// mode "grid" : self-explained
// mode "local" : expects an AliAOD.root data file in the current directory
// mode "test" : your laptop will behave as a grid node running the analysis on data
// files downloaded from the grid
// mode "terminate" : when your analysis is finished on the grid iterate calls with this mode
// until your jobs are merged then make a final call with this mode and
// gridMerge kFALSE to bring home your results

void runAnalysis(const char *mode = "grid", Bool_t gridMerge = kTRUE)
{
// set if you want to run the analysis locally (kTRUE), or on grid (kFALSE)
Bool_t local = kTRUE;
Bool_t local = (TString(mode).EqualTo("local")) ? kTRUE : kFALSE;
// if you run on grid, specify test mode (kTRUE) or full grid model (kFALSE)
Bool_t gridTest = kTRUE;
Bool_t gridTest = (TString(mode).EqualTo("test")) ? kTRUE : kFALSE;

// since we will compile a class, tell root where to look for headers
#if !defined (__CINT__) || defined (__CLING__)
Expand Down Expand Up @@ -62,9 +83,8 @@ void runAnalysis()
alienHandler->SetAnalysisSource("AliAnalysisTaskMyTask.cxx");
// select the aliphysics version. all other packages
// are LOADED AUTOMATICALLY!
alienHandler->SetAliPhysicsVersion("vAN-20181028_ROOT6-1");
// set the Alien API version
alienHandler->SetAPIVersion("V1.1x");
alienHandler->SetAliPhysicsVersion("vAN-20190122_ROOT6-1");

// select the input data
alienHandler->SetGridDataDir("/alice/data/2015/LHC15o");
alienHandler->SetDataPattern("*pass1/AOD194/*AOD.root");
Expand All @@ -85,8 +105,8 @@ void runAnalysis()
// after re-running the jobs in SetRunMode("terminate")
// (see below) mode, set SetMergeViaJDL(kFALSE)
// to collect final results
alienHandler->SetMaxMergeStages(1);
alienHandler->SetMergeViaJDL(kTRUE);
alienHandler->SetMaxMergeStages(2);
alienHandler->SetMergeViaJDL(gridMerge);

// define the output folders
alienHandler->SetGridWorkingDir("myWorkingDir");
Expand Down