-// $Id$
-
AliAnalysisTaskScale* AddTaskScale(
const char *nTracks = "Tracks",
const char *nClusters = "CaloClustersCorr",
Double_t trackptcut = 0.150,
Double_t clusptcut = 0.150,
const char *taskname = "Scale",
- const char *outfilename = "AnalysisResults.root"
+ const char *sfuncPath = 0,
+ const char *sfuncName = 0
)
{
// Get the pointer to the existing analysis manager via the static access method.
AliClusterContainer *ccont = scaletask->AddClusterContainer(nClusters);
if(ccont) ccont->SetClusPtCut(clusptcut);
+ if (sfuncPath != 0 && sfuncName != 0) {
+ TFile *file = TFile::Open(sfuncPath);
+ if (file && !file->IsZombie()) {
+ TF1* sfunc = dynamic_cast<TF1*>(file->Get(sfuncName));
+
+ if (sfunc) {
+ scaletask->SetScaleFunction(sfunc);
+ ::Info("AddTaskScale", Form("Scale function %s loaded from file %s.", sfuncName, sfuncPath));
+ }
+ else {
+ ::Error("AddTaskScale", Form("Scale function %s not found in file %s.", sfuncName, sfuncPath));
+ }
+
+ file->Close();
+ delete file;
+ file = 0;
+ }
+ else {
+ ::Warning("AddTaskScale", "Could not open scale function file");
+ }
+ }
+
//-------------------------------------------------------
// Final settings, pass to manager and set the containers
//-------------------------------------------------------
AliAnalysisDataContainer *coscale = mgr->CreateContainer(contname,
TList::Class(),
AliAnalysisManager::kOutputContainer,
- outfilename);
+ Form("%s", AliAnalysisManager::GetCommonFileName()));
mgr->ConnectOutput(scaletask,1,coscale);
return scaletask;