]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/fixed_rapidity/AddRsnAnalysisMult.C
Add some specific tasks for specific resonances and additional macros
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / LHC2010-7TeV-phi / fixed_rapidity / AddRsnAnalysisMult.C
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 AddRsnAnalysisMult
14 (
15   const char *options,
16   const char *configs = "RsnConfigNoSA.C RsnConfigSA.C",
17   const char *path    = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi"
18 )
19 {
20   // retrieve analysis manager
21   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
22   
23   // initialize multiplicity bins
24   Int_t multMin[] = {0, 0, 6, 10, 15, 23       ,  6, 11, 21, 31, 51,  76, 101, 126, 151, 201      };
25   Int_t multMax[] = {0, 5, 9, 14, 22, 100000000, 10, 20, 30, 50, 75, 100, 125, 150, 200, 100000000};
26   Int_t nmult = sizeof(multMin) / sizeof(multMin[0]);
27   
28   // initialize several tasks, each one with different multiplicity cut
29   // and all with the same primary vertex + pile-up cut
30   for (Int_t i = 0; i < nmult; i++)
31   {
32     // create the task and connect with physics selection
33     AliRsnAnalysisSE *task = new AliRsnAnalysisSE(Form("RsnAnalysis_%d", i));
34     task->SetZeroEventPercentWarning(100.0);
35     task->SelectCollisionCandidates();
36
37     // add the task to manager
38     mgr->AddTask(task);
39
40     // load and execute all required configuration macroes in the string (arg #2)
41     TString    sList   = configs;
42     TObjArray *list    = sList.Tokenize(" ");
43     Int_t      nConfig = list->GetEntries();
44     Int_t      iConfig = 0;
45     for (iConfig = 0; iConfig < nConfig; iConfig++)
46     {
47       TObjString *ostr = (TObjString*)list->At(iConfig);
48       
49       // the config macro is assumed to be stored in the path in argument #3
50       // and to have three arguments: task name, a free string of options and the path where it is stored
51       // --> all of them is a string, and then it must be passed with the quote marks
52       const char *macro     = ostr->GetString().Data();
53       const char *argName   = Form("\"%s\"", task->GetName());
54       const char *argOption = Form("\"%s\"", options);
55       const char *argPath   = Form("\"%s\"", path);
56       const char *argMult   = Form("%d, %d", multMin[i], multMax[i]);
57       gROOT->ProcessLine(Form(".x %s/%s(%s,%s,%s, %s)", path, macro, argName, argOption, argPath, argMult));
58     }
59
60     // connect input container according to source choice
61     mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
62
63     // create paths for the output in the common file
64     Char_t commonPath[500];
65     sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());
66
67     // create containers for output
68     AliAnalysisDataContainer *outputInfo = mgr->CreateContainer(Form("RsnInfo_%d", i), TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
69     AliAnalysisDataContainer *outputHist = mgr->CreateContainer(Form("RsnHist_%d", i), TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
70     mgr->ConnectOutput(task, 1, outputInfo);
71     mgr->ConnectOutput(task, 2, outputHist);
72     
73   } // end loop on tasks
74
75   return kTRUE;
76 }