]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/AddRsnAnalysis.C
Update to analysis macros
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / LHC2010-7TeV-phi / AddRsnAnalysis.C
CommitLineData
23cdfaf3 1//
2// This macro serves to add the RSN analysis task to the steering macro.
3//
4// Inputs:
5// - dataLabel = a string with informations about the type of data
6// which could be needed to be ported to the config macro
7// to set up some cuts
8// - configMacro = macro which configures the analysis; it has *ALWAYS*
9// defined inside a function named 'RsnConfigTask()',
10// whatever the name of the macro itself, whose first two
11// arguments must have to be the task and the 'dataLabel' argument.
12//
13Bool_t AddRsnAnalysis
14(
15 const char *options,
52944696 16 const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C",
17 const char *path = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi"
23cdfaf3 18)
19{
20 // retrieve analysis manager
21 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
22
23cdfaf3 23 // initialize task with all available slots, even if not all of them will be used:
24 AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis");
25 task->SetZeroEventPercentWarning(100.0);
26 task->SelectCollisionCandidates();
23cdfaf3 27
32992791 28 // set cuts for events : primary vertex range and type
0dbf1f87 29 gROOT->LoadMacro(Form("%s/ConfigESDCutsTPC.C", path);
32992791 30 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
0dbf1f87 31 cutVertex->SetCheckPileUp(kTRUE);
32992791 32 task->GetEventCuts()->AddCut(cutVertex);
33 task->GetEventCuts()->SetCutScheme(cutVertex->GetName());
23cdfaf3 34
35 // add the task to manager
36 mgr->AddTask(task);
37
38 // load and execute configuration macroes
39 TString sList(configs);
40 TObjArray *list = sList.Tokenize(" ");
41 Int_t nConfig = list->GetEntries();
42 Int_t iConfig = 0;
43 for (iConfig = 0; iConfig < nConfig; iConfig++)
44 {
45 TObjString *ostr = (TObjString*)list->At(iConfig);
46 cout << "***** Processing config macro '" << ostr->GetString().Data() << endl;
52944696 47 gROOT->ProcessLine(Form(".x %s/%s(\"%s\",\"%s\")", path, ostr->GetString().Data(), task->GetName(), options));
23cdfaf3 48 }
49
50 // connect input container according to source choice
51 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
52
53 // create paths for the output in the common file
54 Char_t commonPath[500];
55 sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());
56
57 // create containers for output
58 AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
59 AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
60 mgr->ConnectOutput(task, 1, outputInfo);
61 mgr->ConnectOutput(task, 2, outputHist);
62
63 return kTRUE;
64}