5 /// @author Matthias.Richter@cern.ch
7 /// @brief Setup the environment specifically for running DxHFE analysis
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.
12 /// aliroot -b -q -l setupDxHFE.C'("localAodDirectory", nofDirectories)' run-single-task.C'(...)'
13 /// aliroot -b -q -l setupDxHFE.C'("lhcPeriod", "mcPeriod")' run-single-task.C'(...)'
16 /// aliroot -b -q -l setupDxHFE.C run-single-task.C'(...)'
18 /// The macro has the following tasks:
19 /// - load the necessary libraries, in order to have those library names also
20 /// available for the alien handler initialization, a specific configuration
22 /// - setting a default analysis name via a configuration object
23 /// - the optional parameter 'localAodDirectory' allows to create an input chain from
24 /// local AODs; either a single AliAOD.root, or a folder containing directories
25 /// named "1, 2, ...", the number of directories is specified as parameter
27 /// - loading the runs defined by AddGoodRuns of vertexingHF using lhcPeriod and
30 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 // environment specific for DxHFE
34 const char* analysisName="DxHFECorrelation";
35 const char* includePath="-I$ALICE_ROOT/PWGHF/correlationHF -I$ALICE_ROOT/PWGHF/vertexingHF -I$ALICE_ROOT/PWGHF/hfe";
36 const char* libraryDependencies=
45 "libPWGHFvertexingHF.so "
47 "libPWGHFcorrelationHF.so "
50 void setupDxHFE(const char* localAodDirectory, int nofDirectories, const char* lhcPeriod, const char* mcProd="")
53 // adding include path and libraries
55 gSystem->AddIncludePath(includePath);
56 TString libraries=libraryDependencies;
57 TObjArray* pTokens=libraries.Tokenize(" ");
59 for (int i=0; i<pTokens->GetEntriesFast(); i++) {
60 if (gSystem->Load(pTokens->At(i)->GetName())==0) {
61 cout << "loading " << pTokens->At(i)->GetName() << endl;
69 // allow run-single-task to fetch the analysis name and library names
71 if (gDirectory) gDirectory->Add(new TNamed("analysis_name", analysisName));
72 if (gDirectory) gDirectory->Add(new TNamed("analysis_libraries", libraryDependencies));
76 // setting up the runs for the dpecified period
78 TString alienHandlerName(analysisName); alienHandlerName+="Handler";
79 AliAnalysisAlien* alienHandler=new AliAnalysisAlien(alienHandlerName);
80 gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/AddGoodRuns.C");
81 int nruns=AddGoodRuns(alienHandler, lhcPeriod, mcProd);
83 ::Error("setupDxHFE.C", Form("can not find any good runs for period %s", lhcPeriod));
86 gDirectory->Add(alienHandler);
87 ::Info("setupDxHFE.C", Form("setting up alien plugin '%s' for period %s\n>>>>> please use '%s' as input parameter for run-single-task.C <<<<<<", alienHandlerName.Data(), lhcPeriod, alienHandlerName.Data()));
89 } else if (localAodDirectory) {
91 // create AOD tree from local files
92 // the created object is added automatically to gDirectory and can be fetched
95 gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/MakeAODInputChain.C");
96 TString aodPathName(localAodDirectory);
97 if (!aodPathName.EndsWith("/")) aodPathName+="/";
98 aodPathName+="AliAOD.root";
99 if (gSystem->AccessPathName(aodPathName)==0) {
100 // Create a chain with one set of AliAOD.root and AliAOD.VertexingHF.root. The set needs
101 // to be located in the same folder as you run from (physically or linked)
102 ::Info("setupDxHFE.C", Form("make chain from single chunk %s", aodPathName));
103 TChain* chain = MakeAODInputChain(localAodDirectory ,1, -1);
105 // Assume several folders containing different AODs.
106 // The AODs need to be in folders named 1, 2,...
107 ::Info("setupDxHFE.C", Form("make chain from directory %s", localAodDirectory));
108 chain=MakeAODInputChain(localAodDirectory, 1, nofDirectories);
110 ::Info("setupDxHFE.C", Form("local AOD chain: %d entries", chain->GetEntries()));
114 void setupDxHFE(const char* lhcPeriod=NULL, const char* mcProd="")
116 // Grid mode with optional calling of AddGoodRuns for specified
118 setupDxHFE(NULL, 0, lhcPeriod, mcProd);
121 void setupDxHFE(const char* localAodDirectory, int nofDirectories)
123 // local mode for AOD data
124 setupDxHFE(localAodDirectory, nofDirectories, NULL);