]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/macros/setupDxHFE.C
Update in D-electron correlation macros (Matthias)
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / macros / setupDxHFE.C
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 /// @file   setupDxHFE.C
5 /// @author Matthias.Richter@cern.ch
6 /// @date   2012-09-12
7 /// @brief  Setup the environment specifically for running DxHFE analysis
8 ///
9 /// Helper macro to initialize the environment for DxHFE. The macro can just
10 /// prepend other macros like run-single-task in the command line.
11 /// Usage:
12 /// aliroot -b -q -l setupDxHFE.C'("localAodDir")' run-single-task.C'(...)'
13 ///
14 /// Example:
15 /// aliroot -b -q -l setupDxHFE.C run-single-task.C'(...)'
16 ///
17 /// The macro has the following tasks:
18 /// - load the necessary libraries, in order to have those library names also
19 ///   available for the alien handler initialization, a specific configuration
20 ///   object is created
21 /// - setting a default analysis name via a configuration object
22 /// - the optional parameter 'localAodDir' allows to create an input chain from
23 ///   locakl AODs
24
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 //
27 // environment specific for DxHFE
28 //
29 const char* includePath="-I$ALICE_ROOT/PWGHF/vertexingHF -I$ALICE_ROOT/PWGHF/hfe";
30 const char* libraryDependencies=
31   "libSTEERBase "
32   "libESD "
33   "libAOD "
34   "libANALYSIS "
35   "libANALYSISalice "
36   "libPWGflowBase.so "
37   "libPWGflowTasks.so "
38   "libCORRFW.so "
39   "libPWGHFvertexingHF.so "
40   "libPWGHFhfe.so "
41   ;
42
43 void setupDxHFE(const char* aodDirectory=NULL)
44 {
45   gSystem->AddIncludePath(includePath);
46   TString libraries=libraryDependencies;
47   TObjArray* pTokens=libraries.Tokenize(" ");
48   if (pTokens) {
49     for (int i=0; i<pTokens->GetEntriesFast(); i++) {
50       if (gSystem->Load(pTokens->At(i)->GetName())==0) {
51         cout << "loading " << pTokens->At(i)->GetName() << endl;
52       }
53     }
54     delete pTokens;
55   }
56   libraries="";
57
58   // allow run-single-task to fetch the analysis name and library names
59   if (gDirectory) gDirectory->Add(new TNamed("analysis_name", "DxHFECorrelation"));
60   if (gDirectory) gDirectory->Add(new TNamed("analysis_libraries", libraryDependencies));
61
62   if (aodDirectory) {
63     // create AOD tree from local files
64     // the created object is added automatically to gDirectory and can be fetched
65     // from there later
66     // TODO: decide depending on running mode and input to be used
67     gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/MakeAODInputChain.C");
68     // Create a chain with one set of AliAOD.root and AliAOD.VertexingHF.root. The set needs 
69     // to be located in the same folder as you run from (physically or linked)
70     TChain* chain = MakeAODInputChain(aodDirectory ,1, -1);
71     // If you have several folders containing different AODs, use below. 
72     // From the MakeAODInputChain.C: The AODs need to be in folders named 1, 2,...
73     //if(useMC)chain =MakeAODInputChain("/scratch/Data/2010/MC/LHC10f7a/130375/AOD051/",1,2);//73
74     //chain =MakeAODInputChain("/scratch/Data/2010/MC/LHC10f6a/126437/AOD041/",1,10);//84
75     //else chain =MakeAODInputChain("/scratch/Data/2010/LHC10d/000126437/ESDs/pass2/AOD057/",1,10);//LHC10f7a/130375/AOD051/",1,20);
76     cout << "local AOD chain: " << chain->GetEntries() << " entries" << endl;
77   }
78 }