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