4 /// @file setupPi0Flow.C
5 /// @author Matthias.Richter@cern.ch, modified for PHOSPi0Flow by Henrik.Qvigstad@cern.ch
7 /// @brief Setup the environment specifically for running Pi0Flow analysis
9 /// Helper macro to initialize the environment for Pi0Flow. The macro can just
10 /// prepend other macros like run-single-task in the command line.
12 /// aliroot -b -q -l setupPi0Flow.C'("localAodDirectory", nFiles)' run-single-task.C'(...)'
13 /// aliroot -b -q -l setupPi0Flow.C'("lhcPeriod", "mcPeriod")' run-single-task.C'(...)'
16 /// aliroot -b -q -l setupPi0Flow.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 Pi0Flow
34 const char* analysisName="PHOSPi0Flow";
35 const char* includePath="-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS -I$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPb";
36 const char* libraryDependencies="libCore.so libTree.so libGeom.so libVMC.so libPhysics.so libMinuit.so libGui.so libXMLParser.so libMinuit2.so libProof.so libSTEERBase.so libESD.so libAOD.so libOADB.so libANALYSIS.so libANALYSISalice.so libCDB.so libRAWDatabase.so libSTEER.so libCORRFW.so libPHOSUtils.so libPHOSbase.so libPHOSpi0Calib.so libPHOSrec.so libPHOSshuttle.so libPHOSsim.so libPWGGAPHOSTasks.so libTENDER.so libTRDbase.so libVZERObase.so libVZEROrec.so libTENDERSupplies.so libPWGGAUtils.so";
38 void setupPi0Flow(const char* localAodDirectory, int nFiles, const char* lhcPeriod, const char* mcProd="")
41 // adding include path and libraries
43 gSystem->AddIncludePath(includePath);
44 TString libraries=libraryDependencies;
45 TObjArray* pTokens=libraries.Tokenize(" ");
47 for (int i=0; i<pTokens->GetEntriesFast(); i++) {
48 if (gSystem->Load(pTokens->At(i)->GetName())==0) {
49 cout << "loading " << pTokens->At(i)->GetName() << endl;
57 // allow run-single-task to fetch the analysis name and library names
59 if (gDirectory) gDirectory->Add(new TNamed("analysis_name", analysisName));
60 if (gDirectory) gDirectory->Add(new TNamed("analysis_libraries", libraryDependencies));
64 // setting up the runs for the dpecified period
66 TString alienHandlerName(analysisName); alienHandlerName+="Handler";
67 AliAnalysisAlien* alienHandler=new AliAnalysisAlien(alienHandlerName);
68 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPb/macros/single-task/AddGoodRuns.C");
69 int nruns=AddGoodRuns(alienHandler, lhcPeriod, mcProd);
71 ::Error("setupPi0Flow.C", Form("can not find any good runs for period %s", lhcPeriod));
74 gDirectory->Add(alienHandler);
75 ::Info("setupPi0Flow.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()));
77 } else if (localAodDirectory) {
79 // create AOD tree from local files
80 // the created object is added automatically to gDirectory and can be fetched
83 //gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/MakeAODInputChain.C");
84 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPb/macros/single-task/MakeAODInputChain.C");
86 chain = MakeAODInputChain(localAodDirectory, nFiles);
87 // TString aodPathName(localAodDirectory);
88 // if (!aodPathName.EndsWith("/")) aodPathName+="/";
89 // aodPathName+="AliAOD.root";
91 // if (gSystem->AccessPathName(aodPathName)==0) {
92 // // Create a chain with one set of AliAOD.root and AliAOD.VertexingHF.root. The set needs
93 // // to be located in the same folder as you run from (physically or linked)
94 // ::Info("setupPi0Flow.C", Form("make chain from single chunk %s", aodPathName));
95 // chain = MakeAODInputChain(localAodDirectory ,1, -1);
97 // // Assume several folders containing different AODs.
98 // // The AODs need to be in folders named 1, 2,...
99 // ::Info("setupPi0Flow.C", Form("make chain from directory %s", localAodDirectory));
100 // chain=MakeAODInputChain(localAodDirectory, nFiles);
102 ::Info("setupPi0Flow.C", Form("local AOD chain: %d entries", chain->GetEntries()));
106 void setupPi0Flow(const char* lhcPeriod=NULL, const char* mcProd="")
108 // Grid mode with optional calling of AddGoodRuns for specified
110 setupPi0Flow(NULL, 0, lhcPeriod, mcProd);
113 void setupPi0Flow(const char* localAodDirectory, int nFiles)
115 // local mode for AOD data
116 setupPi0Flow(localAodDirectory, nFiles, NULL);