]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AddTaskLStarPP.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddTaskLStarPP.C
1 // 
2 // General macro to configure the RSN analysis task.
3 // It calls all configs desired by the user, by means
4 // of the boolean switches defined in the first lines.
5 // ---
6 // Inputs:
7 //  1) flag to know if running on MC or data
8 //  2) path where all configs are stored
9 // ---
10 // Returns:
11 //  kTRUE  --> initialization successful
12 //  kFALSE --> initialization failed (some config gave errors)
13 //
14
15 Bool_t usePhi   = 0;
16 Bool_t useKStar = 0;
17 Bool_t useLStar = 1;
18
19  //set to kTRUE if using data AOD049 - needed to enable centrality patch
20 Bool_t isAOD049 = 0;
21
22 AliRsnMiniAnalysisTask * AddTaskLStarPP
23 (
24    Bool_t      isMC,
25    Bool_t      isPP,
26    const char *path,
27    Int_t       nmix = 0
28 )
29 {  
30    //
31    // -- INITIALIZATION ----------------------------------------------------------------------------
32    //
33    
34    // retrieve analysis manager
35    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
36
37    // create the task and connect with physics selection
38    AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask("RSN", isMC);
39    if (isAOD049 && !isMC && !isPP){
40      task->SetUseCentralityPatch(kTRUE);
41    }
42 //S.K.
43 //   task->SelectCollisionCandidates(AliVEvent::kMB);
44    task->SelectCollisionCandidates(AliVEvent::kINT7);  // for pPb
45
46    mgr->AddTask(task);
47    
48    // settings
49    if (isPP) 
50       task->UseMultiplicity("QUALITY");
51    else
52 //      task->UseCentrality("V0M");
53       task->UseCentrality("V0A");  // for pPb
54    
55    // set mixing
56    task->UseContinuousMix();
57    //task->UseBinnedMix();
58    task->SetNMix(nmix);
59    task->SetMaxDiffVz(1.0);
60    task->SetMaxDiffMult(10.0);
61    task->SetMaxDiffAngle(1E20);
62    
63    //
64    // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
65    //
66    
67    // cut on primary vertex:
68    // - 2nd argument --> |Vz| range
69    // - 3rd argument --> minimum required number of contributors
70    // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
71    AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
72    
73    // set the check for pileup
74 //   if (isPP) cutVertex->SetCheckPileUp(kTRUE);
75 //S.K.
76
77    //set check for pileup in 2013
78    Bool_t      rmFirstEvtChunk = kTRUE; //needed for pA 2013
79    Bool_t      rejectPileUp = kTRUE; //best if used, for pA 2013
80    Int_t       MinPlpContribSPD = 5; //default value if used
81    Bool_t      useMVPileUpSelection = kFALSE; //
82    Bool_t      useVtxCut2013pA = kTRUE; //default use recommended 2013 pA vtx selection
83    AliRsnCutEventUtils *cutEventUtils = new AliRsnCutEventUtils("cutEventUtils", rmFirstEvtChunk, rejectPileUp);
84    cutEventUtils->SetUseVertexSelection2013pA(useVtxCut2013pA);
85    cutEventUtils->SetMinPlpContribSPD(MinPlpContribSPD);
86       
87    // define and fill cut set
88    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
89 //S.K.
90    eventCuts->AddCut(cutEventUtils);
91    eventCuts->AddCut(cutVertex);
92 //S.K.   eventCuts->SetCutScheme(cutVertex->GetName());
93    eventCuts->SetCutScheme(Form("%s&%s", cutEventUtils->GetName(), cutVertex->GetName()));
94    
95    // set cuts in task
96    task->SetEventCuts(eventCuts);
97    
98    //
99    // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
100    //
101    
102    // initialize value computation for multiplicity/centrality
103    // second argument tells if the value must be taken from MC
104    // (when this can be done)
105    // after creating the value, the task returns its ID
106    Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
107    
108    // create event-related output
109    AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
110    // set axes, by passing value ID and defining the binning
111    if (isPP) 
112       outMult->AddAxis(multID, 300, 0.0, 300.0);
113    else
114 //      outMult->AddAxis(multID, 100, 0.0, 100.0);
115       outMult->AddAxis(multID, 10, 0.0, 100.0);
116    
117    //
118    // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
119    //
120    
121    AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
122 //   cutY->SetRangeD(-0.5, 0.5);
123 //   cutY->SetRangeD(0.465, 0.965);
124    cutY->SetRangeD(-0.465, 0.035);
125    
126    AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
127    cutsPair->AddCut(cutY);
128    cutsPair->SetCutScheme(cutY->GetName());
129    
130    //
131    // -- CONFIGS -----------------------------------------------------------------------------------
132    //
133    
134    if (usePhi) {
135       if (isPP) {
136          gROOT->LoadMacro(Form("%s/ConfigPhi.C", path));
137          if (!ConfigPhi(task, isMC, "", cutsPair)) return 0x0;
138       } else {
139          gROOT->LoadMacro(Form("%s/ConfigPhiPbPb.C", path));
140          if (!ConfigPhiPbPb(task, isMC, "", cutsPair)) return 0x0;
141       }
142       if (isMC) {
143          gROOT->LoadMacro(Form("%s/ConfigPhiMC.C", path));
144          if (!ConfigPhiMC(task, isPP, "", cutsPair)) return 0x0;
145       }
146    }
147    
148    if (useKStar) {
149       gROOT->LoadMacro(Form("%s/ConfigKStar.C", path));
150       if (!ConfigKStar(task, isMC, "", cutsPair)) return 0x0;
151       if (isMC) {
152          gROOT->LoadMacro(Form("%s/ConfigKStarMC.C", path));
153          if (!ConfigKStarMC(task, isPP, "", cutsPair)) return 0x0;
154       }
155    }
156    
157    if (useLStar) {
158       gROOT->LoadMacro(Form("%s/ConfigLStarPP.C", path));
159       if (!ConfigLStarPP(task, isMC, "", cutsPair)) return 0x0;
160       if (isMC) {
161          gROOT->LoadMacro(Form("%s/ConfigLStarPP_MC.C", path));
162          if (!ConfigLStarPP_MC(task, isPP, "", cutsPair)) return 0x0;
163       }
164    }
165    
166    //
167    // -- CONTAINERS --------------------------------------------------------------------------------
168    //
169    
170    const char *file = AliAnalysisManager::GetCommonFileName();
171    AliAnalysisDataContainer *output = mgr->CreateContainer("RsnOut", TList::Class(), AliAnalysisManager::kOutputContainer, file);
172    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
173    mgr->ConnectOutput(task, 1, output);
174
175    return task;
176 }