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="", const TString& dataType="AOD")
41 // adding include path and libraries
43 gSystem->AddIncludePath(includePath);
44 TString libraries=libraryDependencies;
45 TObjArray* pTokens=libraries.Tokenize(" ");
48 for (int i=0; i<pTokens->GetEntriesFast(); i++) {
49 buf = pTokens->At(i)->GetName();
50 buf.ReplaceAll(".so", "");
51 if (gSystem->Load(buf)==0) {
52 cout << "loading " << pTokens->At(i)->GetName() << endl;
60 // allow run-single-task to fetch the analysis name and library names
62 if (gDirectory) gDirectory->Add(new TNamed("analysis_name", analysisName));
63 if (gDirectory) gDirectory->Add(new TNamed("analysis_libraries", libraryDependencies));
67 // setting up the runs for the dpecified period
69 TString alienHandlerName(analysisName); alienHandlerName+="Handler";
70 AliAnalysisAlien* alienHandler=new AliAnalysisAlien(alienHandlerName);
71 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPb/macros/single-task/AddGoodRuns.C");
72 int nruns=AddGoodRuns(alienHandler, lhcPeriod, mcProd);
74 ::Error("setupPi0Flow.C", Form("can not find any good runs for period %s", lhcPeriod));
77 gDirectory->Add(alienHandler);
78 ::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()));
80 } else if (localAodDirectory) {
82 // create AOD tree from local files
83 // the created object is added automatically to gDirectory and can be fetched
86 //gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/MakeAODInputChain.C");
88 if( dataType.EqualTo("AOD") ) {
89 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/PHOSTasks/PHOS_PbPb/macros/single-task/MakeAODInputChain.C");
90 chain = MakeAODInputChain(localAodDirectory, nFiles);
92 else if ( dataType.EqualTo("ESD") ) {
93 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/CreateESDChain.C");
94 chain = CreateESDChain(localAodDirectory, nFiles);
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("setupPi0Flow.C", Form("make chain from single chunk %s", aodPathName));
103 // 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("setupPi0Flow.C", Form("make chain from directory %s", localAodDirectory));
108 // chain=MakeAODInputChain(localAodDirectory, nFiles);
110 ::Info("setupPi0Flow.C", Form("local AOD chain: %d entries", chain->GetEntries()));
114 void setupPi0Flow(const char* lhcPeriod=NULL, const char* mcProd="")
116 // Grid mode with optional calling of AddGoodRuns for specified
118 setupPi0Flow(NULL, 0, lhcPeriod, mcProd);
121 void setupPi0Flow(const char* localAodDirectory, int nFiles)
123 // local mode for AOD data
124 setupPi0Flow(localAodDirectory, nFiles, NULL);