]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/mini/AddTaskLStarPPb.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddTaskLStarPPb.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 useLStar = 1;
16
17
18 AliRsnMiniAnalysisTask * AddTaskLStarPPb
19 (
20    Bool_t      isMC,
21    Bool_t      isPP,
22    const char *path,
23    Int_t       nmix = 0
24 )
25 {  
26    //
27    // -- INITIALIZATION ----------------------------------------------------------------------------
28    //
29    
30   //-------------------------------------------
31   // event cuts
32   //-------------------------------------------
33   UInt_t      triggerMask = AliVEvent::kINT7;
34   Bool_t      rmFirstEvtChunk = kTRUE; //needed for pA 2013
35   Bool_t      rejectPileUp = kTRUE; //best if used, for pA 2013
36   Int_t       MinPlpContribSPD = 5; //default value if used
37   Bool_t      useMVPileUpSelection = kFALSE; //
38   Int_t       MinPlpContribMV = 5; //default value if used
39   Bool_t      useVtxCut2013pA = kTRUE; //default use recommended 2013 pA vtx selection
40   Double_t    vtxZcut = 10.0; //cm, default cut on vtx z
41
42
43
44    // retrieve analysis manager
45    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
46
47    // create the task and connect with physics selection
48    AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask("RSN", isMC);
49
50    //task->UseESDTriggerMask(triggerMask); //ESD
51    task->SelectCollisionCandidates(triggerMask); //AOD  
52    
53    // settings
54    if (isPP) 
55       task->UseMultiplicity("QUALITY");
56    else
57       task->UseCentrality("V0M");
58    
59    // set mixing
60    task->UseContinuousMix();
61    //task->UseBinnedMix();
62    task->SetNMix(nmix);
63    task->SetMaxDiffVz(1.0);
64    task->SetMaxDiffMult(10.0);
65    //task->SetMaxDiffAngle(20);
66    //   if (!isPP) task->SetMaxDiffAngle(20.0*TMath::DegToRad()); //set angle diff in rad
67
68    mgr->AddTask(task);
69
70    //
71    // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
72    //
73    
74    // cut on primary vertex:
75    // - 2nd argument --> |Vz| range
76    // - 3rd argument --> minimum required number of contributors
77    // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
78    AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", vtxZcut, 0, kFALSE);
79    
80    // set the check for pileup
81    //if (isPP) cutVertex->SetCheckPileUp(kTRUE);
82
83    //set check for pileup in 2013  #############
84  
85    AliRsnCutEventUtils *cutEventUtils = new AliRsnCutEventUtils("cutEventUtils", rmFirstEvtChunk, rejectPileUp);
86    cutEventUtils->SetUseVertexSelection2013pA(useVtxCut2013pA);
87    ::Info("AddTaskLStarPPb", Form(":::::::::::::::::: Vertex cut as pA 2013: %s", (useVtxCut2013pA?"ON":"OFF")));   
88    if (useMVPileUpSelection){
89      cutEventUtils->SetUseMVPlpSelection(useMVPileUpSelection);
90      cutEventUtils->SetMinPlpContribMV(MinPlpContribMV);
91      cutEventUtils->SetMinPlpContribSPD(MinPlpContribSPD);
92      ::Info("AddTaskLStarPPb", Form("Multiple-vtx Pile-up rejection settings: MinPlpContribMV = %i, MinPlpContribSPD = %i", MinPlpContribMV, MinPlpContribSPD));
93    } else {
94      cutEventUtils->SetMinPlpContribSPD(MinPlpContribSPD);
95      ::Info("AddTaskLStarPPb", Form("SPD Pile-up rejection settings: MinPlpContribSPD = %i", MinPlpContribSPD));
96    }
97    ::Info("AddTaskLStarPPb", Form(":::::::::::::::::: Pile-up rejection mode: %s", (rejectPileUp?"ON":"OFF")));   
98    ::Info("AddTaskLStarPPb", Form("::::::::::::: Remove first event in chunk: %s", (rmFirstEvtChunk?"ON":"OFF")));   
99   
100
101
102
103    // define and fill cut set
104    AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
105    eventCuts->AddCut(cutEventUtils);
106    eventCuts->AddCut(cutVertex);
107    eventCuts->SetCutScheme(Form("%s&%s", cutEventUtils->GetName(), cutVertex->GetName()));
108    //eventCuts->SetCutScheme(cutVertex->GetName());
109    
110    // set cuts in task
111    task->SetEventCuts(eventCuts);
112    
113    //
114    // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
115    //
116    
117    // second argument tells if the value must be taken from MC
118    // (when this can be done)
119    // after creating the value, the task returns its ID
120
121    // VERTEX POSITION    
122    Int_t vertexID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
123    AliRsnMiniOutput *outVertex = task->CreateOutput("eventVertex", "HIST", "EVENT");
124    outVertex->AddAxis(vertexID, 400, -20.0, 20.0);
125
126
127    // initialize value computation for multiplicity/centrality
128    Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
129    AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
130    // set axes, by passing value ID and defining the binning
131    if (isPP) 
132       outMult->AddAxis(multID, 300, 0.0, 300.0);
133    else
134       outMult->AddAxis(multID, 100, 0.0, 100.0);
135    
136 //   TH2F* hvz=new TH2F("hVzVsCent","", 100, 0., 100., 240, -12.0, 12.0);
137 //   task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member
138
139 //   TH2F* hmc=new TH2F("MultiVsCent","", 400, 0., 400., 400, 0., 400.);
140 //   hmc->GetYaxis()->SetTitle("QUALITY");
141 //   task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member
142
143
144    //
145    // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
146    //
147    
148    AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
149    //cutY->SetRangeD(-0.5, 0.5);
150       cutY->SetRangeD(-0.465, 0.035);// 0 < y_cm < 0.5; y_cm = y_lab + 0.465
151
152    AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
153    cutsPair->AddCut(cutY);
154    cutsPair->SetCutScheme(cutY->GetName());
155    
156    //
157    // -- CONFIGS -----------------------------------------------------------------------------------
158    //
159    
160
161    if (useLStar) {
162       gROOT->LoadMacro(Form("%s/ConfigLStarPPb.C", path));
163       ConfigLStarPPb(task, isMC, isPP, "LStar", cutsPair);
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 }