]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/macros/train/LHC2010-7TeV-kstar/RsnConfigMC.C
Coverity fixes 14823 to 14837
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / LHC2010-7TeV-kstar / RsnConfigMC.C
CommitLineData
ea7840dc 1//
2// This function configures the entire task for all resonances the user is interested in.
3// This is done by creating all configuration objects which are defined in the package.
4//
5// Generally speaking, one has to define the following objects for each resonance:
6//
7// 1 - an AliRsnPairDef to define the resonance decay channel to be studied
8// 2 - an AliRsnPair{Ntuple|Functions} where the output is stored
9// 3 - one or more AliRsnCut objects to define track selections
10// which will have then to be organized into AliRsnCutSet objects
11// 4 - an AliRsnCutManager to include all cuts to be applied (see point 3)
12// 5 - definitions to build the TNtuple or histograms which are returned
13//
14// The return value is used to know if the configuration was successful
15//
16Bool_t RsnConfigMC(const char *taskName, const char *options)
17{
18 // info
19 Info("RsnConfig2010PhiFcnMC", "Starting configuration");
20
21 // retrieve analysis manager & task
22 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
23 AliRsnAnalysisSE *task = (AliRsnAnalysisSE*)mgr->GetTask(taskName);
24
25 // for safety, return if no task is passed
26 if (!task)
27 {
28 Error("ConfigTaskRsn", "Task not found");
29 return kFALSE;
30 }
31
32 // interpret the useful information from second argument
33 TString opt(options);
34 Bool_t isMC = opt.Contains("MC");
35 Bool_t isSim = opt.Contains("sim");
36 Bool_t isData = opt.Contains("data");
37 Bool_t isPass1 = opt.Contains("pass1");
38 Bool_t isPass2 = opt.Contains("pass2");
39 if (!isMC)
40 {
41 Info("RsnConfig2010PhiFcnMC", "Config skipped for not pure MonteCarlo samples");
42 return kTRUE;
43 }
44
45 //
46 // -- Setup pairs ---------------------------------------------------------------------------------
47 //
48
49 // decay channels
50 AliRsnPairDef *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
51 AliRsnPairDef *pairDefPP = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '+', 333, 1.019455);
52 AliRsnPairDef *pairDefMM = new AliRsnPairDef(AliPID::kKaon, '-', AliPID::kKaon, '-', 333, 1.019455);
53
54 // computation objects
55 AliRsnPairFunctions *pairPM = new AliRsnPairFunctions("PairPM_mc", pairDefPM);
56 AliRsnPairFunctions *truePM = new AliRsnPairFunctions("TruePM_mc", pairDefPM);
57 AliRsnPairFunctions *pairPP = new AliRsnPairFunctions("PairPP_mc", pairDefPP);
58 AliRsnPairFunctions *pairMM = new AliRsnPairFunctions("PairMM_mc", pairDefMM);
59
60 //
61 // -- Setup cuts ----------------------------------------------------------------------------------
62 //
63
64 // track cut -----------------------------
65 // --> perfect PID for check of PID issues
66 AliRsnCutPID *cutPID = new AliRsnCutPID("cutPID", AliPID::kKaon, 0.0, kTRUE);
67
68 // cut sets ---------------------------------
69 // --> only common cuts for tracks are needed
70 // --> standard 2010 cuts are applied only when working on ESD
71 AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
72 cutSetDaughterCommon->AddCut(cutPID);
73 cutSetDaughterCommon->SetCutScheme("cutPID");
74 cout << "Cut scheme: " << cutSetDaughterCommon->GetCutScheme() << endl;
75
76 // configure cut managers -------------------
77 pairPM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
78 truePM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
79 pairPP->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
80 pairMM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
81
82 // set additional option for true pairs when needed
83 truePM->SetOnlyTrue (kTRUE);
84 truePM->SetCheckDecay(kTRUE);
85
86 //
87 // -- Setup functions -----------------------------------------------------------------------------
88 //
89
90 // function axes
91 Double_t y[] = {-0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8};
92 Int_t ny = sizeof(y) / sizeof(y[0]);
93 AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMass, 2000, 0.9, 2.9);
94 AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt, 100, 0.0, 10.0);
95 AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY, ny, y);
96
97 // create function and add axes
98 AliRsnFunction *fcnImPtY = new AliRsnFunction;
99 fcnImPtY->AddAxis(axisIM);
100 fcnImPtY->AddAxis(axisPt);
101 fcnImPtY->AddAxis(axisY);
102
103 // add functions to pairs
104 pairPM->AddFunction(fcnImPtY);
105 truePM->AddFunction(fcnImPtY);
106 pairPP->AddFunction(fcnImPtY);
107 pairMM->AddFunction(fcnImPtY);
108
109 //
110 // -- Conclusion ----------------------------------------------------------------------------------
111 //
112
113 // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task
114 task->GetAnalysisManager()->Add(pairPM);
115 task->GetAnalysisManager()->Add(pairPP);
116 task->GetAnalysisManager()->Add(pairMM);
117 task->GetAnalysisManager()->Add(truePM);
118
119 return kTRUE;
120}