UShort_t sys=0,
UShort_t sNN=0,
Short_t field=0,
- const char* config="CentralAODConfig.C")
+ const char* config="CentralAODConfig.C",
+ const char* corrs=0)
{
// --- Load libraries ----------------------------------------------
gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
return NULL;
}
- // --- Make the task and add it to the manager ---------------------
+ // --- Make the task -----------------------------------------------
AliCentralMultiplicityTask* task = 0;
if (!mc) task = new AliCentralMultiplicityTask("Central");
else task = new AliCentralMCMultiplicityTask("Central");
+ task->Configure(config);
+ mgr->AddTask(task);
+
+ // --- Set optional corrections path -------------------------------
+ AliCentralMultiplicityTask::Manager& cm = task->GetManager();
+ if (corrs && corrs[0] != '\0') {
+ cm->SetAcceptancePath(Form("%s/CentralAcceptance", corrs));
+ cm->SetSecMapPath(Form("%s/CentralSecMap", corrs));
+ }
+
+ // --- Prime the corrections ---------------------------------------
if(sys>0 && sNN > 0) {
- task->GetManager().Init(sys, sNN, field);
- if (!task->GetManager().HasSecondaryCorrection())
+ cm.Init(sys, sNN, field);
+ if (!cm.HasSecondaryCorrection())
Fatal("AddTaskCentralMult", "No secondary correction defined!");
- if (!task->GetManager().HasAcceptanceCorrection())
+ if (!cm.HasAcceptanceCorrection())
Fatal("AddTaskCentralMult", "No acceptance correction defined!");
}
- task->Configure(config);
- mgr->AddTask(task);
-
// --- Make the output container and connect it --------------------
TString outputfile = AliAnalysisManager::GetCommonFileName();
UShort_t sys=0,
UShort_t sNN=0,
Short_t field=0,
- const char* config="ForwardAODConfig.C")
+ const char* config="ForwardAODConfig.C",
+ const char* corrs=0)
{
// --- Load libraries ----------------------------------------------
gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
task->Configure(config);
mgr->AddTask(task);
+ // --- Set alternative corrections path ----------------------------
+ AliForwardCorrectionManager& cm = AliForwardCorrectionManager::Instance();
+ if (corrs && corrs[0] != '\0') cm.SetPrefix(corrs);
+
// --- Do a local initialisation with assumed values ---------------
if (sys > 0 && sNN > 0) {
UInt_t what = AliForwardCorrectionManager::kAll;
what ^= AliForwardCorrectionManager::kDoubleHit;
what ^= AliForwardCorrectionManager::kVertexBias;
what ^= AliForwardCorrectionManager::kMergingEfficiency;
- if (!AliForwardCorrectionManager::Instance().Init(sys,sNN,field,mc,what))
+ if (!cm.Init(sys,sNN,field,mc,what))
Fatal("AddTaskForwardMult", "Failed to initialize corrections");
}
{
fOptions.Add("aliroot", "VERSION", "AliROOT version", "last");
fOptions.Add("root", "VERISON", "ROOT version", "last");
+ fOptions.Add("nocache", "Disable tree cache");
}
virtual ~AAFHelper() {}
/**
TProof::Mgr(fUrl.GetHost())
->SetROOTVersion(Form("VO_ALICE@ROOT::%s", root.Data()));
- return ProofHelper::PreSetup();
+ if (!ProofHelper::PreSetup()) return false;
+
+ if (fOptions.Has("nocache"))
+ gProof->SetParameter("PROOF_UseTreeCache", 0);
+ return true;
}
/**
* @return URI help string
* @param opts Options
*/
GridHelper(const TUrl& url, Int_t verbose)
- : PluginHelper(url, verbose)
+ : PluginHelper(url, verbose), fRuns()
{
fOptions.Add("oper", "FULL|TERMINATE|SUBMIT", "Analysis operation", "FULL");
fOptions.Add("split", "N|max", "Max number of files before split","max");
fOptions.Add("concat", "Concatenate all runs");
fOptions.Add("mc", "Assume MC input");
}
+ GridHelper(const GridHelper& o)
+ : PluginHelper(o), fRuns()
+ {}
+ GridHelper& operator=(const GridHelper& o)
+ {
+ if (&o == this) return *this;
+ PluginHelper::operator=(o);
+ return *this;
+ }
virtual ~GridHelper() {}
/**
* Get the mode identifier
else if (oper.EqualTo("TEST", TString::kIgnoreCase)) return kTest;
return kFull;
}
+ void StoreRun(Int_t r)
+ {
+ TObject* o = new TObject;
+ o->SetUniqueID(r);
+ fRuns.Add(o);
+ }
/**
* Read run numbers
*
fHandler->SetRunRange(first, last);
ranges->Delete();
range = true;
+ for (Int_t r = first; r <= last; r++) StoreRun(r);
continue;
}
if (s.IsDigit()) { // single run
continue;
}
Info("GridHandler::RegisterRuns", "Adding run %s", s.Data());
- fHandler->AddRunNumber(s.Data());
+ fHandler->AddRunNumber(s.Atoi());
+ StoreRun(s.Atoi());
nRuns++;
individual = true;
continue;
in >> r;
Info("GridHelper::RegisterRuns", "Read %d, adding", r);
fHandler->AddRunNumber(r);
+ StoreRun(r);
nRuns++;
Char_t c;
in >> c;
fHandler->SetRunMode(operation);
// --- Add the run numbers ---------------------------------------
- fHandler->SetRunPrefix(mgr->GetMCtruthEventHandler() ? "%d" : "%09d");
+ fHandler->SetRunPrefix(mgr->GetMCtruthEventHandler() ? "" : "000");
Int_t nRun = RegisterRuns();
// --- Do not test copying ---------------------------------------
fHandler->Write("plugin");
plug->Close();
- std::ofstream o("Terminate.C");
- if (!o) {
+ std::ofstream t("Terminate.C");
+ if (!t) {
Error("GridHelper::AuxSave", "Failed to make terminate ROOT script");
return;
}
- o << "// Generated by GridHelper\n"
+ t << "// Generated by GridHelper\n"
<< "Bool_t LoadLib(const char* libName)\n"
<< "{\n"
<< " if (gSystem->Load(libName) < 0) {\n"
<< " if (gSystem->Load(\"libOADB\") < 0) return false;\n"
<< " if (gSystem->Load(\"libANALYSISalice\") < 0) return false;\n\n";
// Now load libraries
- o << " // Load libraries\n";
+ t << " // Load libraries\n";
TIter nextLib(&fExtraLibs);
TObjString* lib = 0;
while ((lib = static_cast<TObjString*>(nextLib()))) {
libName.Contains("libANALYSIS") ||
libName.Contains("libOADB") ||
libName.Contains("libANALYSISalice")) continue;
- if (libName.Contains(".so")) continue;
- o << " if(!LoadLib(\"" << libName << "\")) return false;\n";
+ if (!libName.Contains(".so")) continue;
+ t << " if(!LoadLib(\"" << libName << "\")) return false;\n";
}
// Now load PARs
- o << "\n"
+ t << "\n"
<< " // Load packages\n";
TIter nextPar(&fExtraPars);
TObjString* par = 0;
parName.Contains("ANALYSIS") ||
parName.Contains("OADB") ||
parName.Contains("ANALYSISalice")) continue;
- o << " if (!LoadPar(\"" << parName << "\")) return false;\n";
+ t << " if (!LoadPar(\"" << parName << "\")) return false;\n";
}
// Now load scripts
- o << "\n"
+ t << "\n"
<< " // Load sources\n";
TIter nextSrc(&fExtraSrcs);
TObjString* src = 0;
while ((src = static_cast<TObjString*>(nextSrc()))) {
const TString& srcName = src->String();
- o << " gROOT->ProcessLine(\".L " << srcName << "+g\");\n";
+ t << " gROOT->ProcessLine(\".L " << srcName << "+g\");\n";
}
// We're ready to load the analysis manager.
- o << " \n"
+ t << " \n"
<< " // Load the analysis manager from file\n"
<< " TString base(name);\n"
<< " base.Append(\".root\");\n"
<< "// EOF\n"
<< "//\n"
<< std::endl;
- o.close();
+ t.close();
if (!asShellScript) return;
<< "# Generated by GridHelper\n"
<< "nam=" << escaped << "\n"
<< "scr=Terminate.C\n"
- << "mgr=$name.root\n"
+ << "mgr=$nam.root\n"
<< "\n"
<< "if test ! -f $scr || test ! -f $mgr ; then\n"
<< " if test ! -d $nam ; then\n"
<< " echo \"Directory $nam not found\"\n"
<< " exit 1\n"
<< " fi\n\n"
- << " if test ! -f $nam/$scr || test -f $nam/$scr ; then\n"
- << " echo \"Script $nam/$scr, manager $nam/$scr not found\"\n"
+ << " if test ! -f $nam/$scr || test ! -f $nam/$mgr ; then\n"
+ << " echo \"Script $scr, manager $mgr not found in $nam\"\n"
<< " exit 1\n"
<< " fi\n\n"
<< " (cd $nam && aliroot -l $scr)\n"
<< std::endl;
s.close();
gSystem->Exec("chmod a+x terminate.sh");
+
+ std::ofstream d("Download.C");
+ if (!d) {
+ Error("GridHelper::AuxSave", "Failed to make ROOT script Download.C");
+ return;
+ }
+ d << "// Generated by GridHelper\n"
+ << "Bool_t GetOne(const TString& base, const TString& dir)\n"
+ << "{\n"
+ << " TString src(gSystem->ConcatFileName(base,dir));\n"
+ << " src = gSystem->ConcatFileName(src,\"root_archive.zip\");\n"
+ << " TString dest;\n"
+ << " dest.Form(\"root_archive_%s.zip\",dir.Data()));\n\n"
+ << " if (!TFile::Cp(src, dest)) {\n"
+ << " Error(\"GetOne\",\"Failed to download %s -> %s\",\n"
+ << " src.Data(), dest.Data());\n"
+ << " return false;\n"
+ << " }\n"
+ << " return true;\n"
+ << "}\n\n"
+ << "void Download()\n"
+ << "{\n"
+ << " TString base(\"" << fUrl.GetProtocol() << "://"
+ << OutputPath() << "\");\n\n";
+ TString format(fOptions.Has("mc") ? "%d" : "%09d");
+ if (fOptions.Has("concat")) {
+ Int_t first = fRuns.First()->GetUniqueID();
+ Int_t last = fRuns.Last()->GetUniqueID();
+ TString fmt(format); fmt.Append("_"); fmt.Append(format);
+ d << " GetOne(base, \"" << TString::Format(fmt, first, last)
+ << "\");\n";
+ }
+ else {
+ d << " const char* runs[] = { ";
+ TIter next(&fRuns);
+ TObject* o = 0;
+ while ((o = next()))
+ d << "\"" << Form(format, o->GetUniqueID())
+ << "\",\n ";
+ d << "0 };\n"
+ << " const char** run = runs;\n"
+ << " while (*run) { GetOne(base, *run); run++ }\n";
+ }
+ d << "}\n"
+ << std::endl;
+ d.close();
}
+ TList fRuns;
};
#endif
//
fOptions.Add("cent", "Use centrality");
fOptions.Add("tpc-ep", "Use TPC event plane");
fOptions.Add("satelitte", "Use satelitte interactions");
+ fOptions.Add("corr", "DIR", "Corrections dir", "");
fOptions.Set("type", "ESD");
}
protected:
UShort_t sys = fOptions.AsInt("sys", 0);
UShort_t sNN = fOptions.AsInt("snn", 0);
UShort_t fld = fOptions.AsInt("field", 0);
+ TString cor = "";
+ if (fOptions.Has("corr")) cor = fOptions.Get("corr");
// --- Add the task ----------------------------------------------
TString fwdConfig = fOptions.Get("forward-config");
- gROOT->Macro(Form("AddTaskForwardMult.C(%d,%d,%d,%d,\"%s\")",
- mc, sys, sNN, fld, fwdConfig.Data()));
+ gROOT->Macro(Form("AddTaskForwardMult.C(%d,%d,%d,%d,\"%s\",\"%s\")",
+ mc, sys, sNN, fld, fwdConfig.Data(), cor.Data()));
fHelper->LoadAux(gSystem->Which(gROOT->GetMacroPath(), fwdConfig));
// --- Add the task ----------------------------------------------
TString cenConfig = fOptions.Get("central-config");
- gROOT->Macro(Form("AddTaskCentralMult.C(%d,%d,%d,%d,\"%s\")",
- mc, sys, sNN, fld, cenConfig.Data()));
+ gROOT->Macro(Form("AddTaskCentralMult.C(%d,%d,%d,%d,\"%s\",\"%s\")",
+ mc, sys, sNN, fld, cenConfig.Data(), cor.Data()));
fHelper->LoadAux(gSystem->Which(gROOT->GetMacroPath(), cenConfig));
// --- Add MC particle task --------------------------------------
AliAnalysisManager::SetCommonFileName("forward_eloss.root");
// --- Load libraries/pars ---------------------------------------
- LoadLibrary("PWGLFforward2");
+ fHelper->LoadLibrary("PWGLFforward2");
// --- Set load path ---------------------------------------------
gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",
AliAnalysisManager::SetCommonFileName("forward_mccorr.root");
// --- Load libraries/pars ---------------------------------------
- LoadLibrary("PWGLFforward2");
+ fHelper->LoadLibrary("PWGLFforward2");
// --- Set load path ---------------------------------------------
gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2",