]>
Commit | Line | Data |
---|---|---|
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 | // | |
13 | Bool_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 | ||
23 | // interpret config string | |
24 | TString strDataLabel(options); | |
25 | Bool_t isSim = strDataLabel.Contains("sim"); | |
26 | Bool_t isMC = strDataLabel.Contains("MC"); | |
27 | ||
28 | // initialize task with all available slots, even if not all of them will be used: | |
29 | AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis"); | |
30 | task->SetZeroEventPercentWarning(100.0); | |
31 | task->SelectCollisionCandidates(); | |
32 | if (isMC) task->SetMCOnly(kTRUE); | |
33 | ||
34 | // if not MC kinematics, set cuts for events : primary vertex range and type | |
35 | if (!isMC) | |
36 | { | |
d0282f3d | 37 | gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C"); |
38 | AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE); | |
39 | AliRsnCutESDCutMultiplicity *cutMult = new AliRsnCutESDCutMultiplicity("cutMult", 0, 10); | |
40 | ||
41 | ConfigESDCutsTPC(cutMult->GetCuts()); | |
42 | ||
23cdfaf3 | 43 | task->GetEventCuts()->AddCut(cutVertex); |
d0282f3d | 44 | task->GetEventCuts()->AddCut(cutMult); |
45 | task->GetEventCuts()->SetCutScheme("cutVertex&cutMult"); | |
23cdfaf3 | 46 | } |
47 | ||
48 | // add the task to manager | |
49 | mgr->AddTask(task); | |
50 | ||
51 | // load and execute configuration macroes | |
52 | TString sList(configs); | |
53 | TObjArray *list = sList.Tokenize(" "); | |
54 | Int_t nConfig = list->GetEntries(); | |
55 | Int_t iConfig = 0; | |
56 | for (iConfig = 0; iConfig < nConfig; iConfig++) | |
57 | { | |
58 | TObjString *ostr = (TObjString*)list->At(iConfig); | |
59 | cout << "***** Processing config macro '" << ostr->GetString().Data() << endl; | |
52944696 | 60 | gROOT->ProcessLine(Form(".x %s/%s(\"%s\",\"%s\")", path, ostr->GetString().Data(), task->GetName(), options)); |
23cdfaf3 | 61 | } |
62 | ||
63 | // connect input container according to source choice | |
64 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); | |
65 | ||
66 | // create paths for the output in the common file | |
67 | Char_t commonPath[500]; | |
68 | sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName()); | |
69 | ||
70 | // create containers for output | |
71 | AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); | |
72 | AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath); | |
73 | mgr->ConnectOutput(task, 1, outputInfo); | |
74 | mgr->ConnectOutput(task, 2, outputHist); | |
75 | ||
76 | return kTRUE; | |
77 | } |