Transition PWG0 -> PWGUD
[u/mrichter/AliRoot.git] / PWGUD / dNdPt / macros / AddTask_dNdPtCutAnalysisPbPb.C
CommitLineData
d4640855 1void AddTask_dNdPtCutAnalysisPbPb()
2{
3/*
4CheckLoadLibrary("libPWG0base");
5CheckLoadLibrary("libPWG0dep");
6CheckLoadLibrary("libPWG0selectors");
7*/
8
9 gSystem->Load("libPWG0base.so");
10 gSystem->Load("libPWG0dep.so");
11 gSystem->Load("libPWG0selectors.so");
12
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14
15 if (!mgr) {
16 Error("AddTask_dNdPtCutAnalysisPbPb", "No analysis manager found.");
17 return 0;
18 }
19
20 // Switch off all AliInfo (too much output!!!)
21 AliLog::SetGlobalLogLevel(AliLog::kError);
22 mgr->SetDebugLevel(0);
23
24 //
25 // Create physics trigger selection class
26 //
27 AliPhysicsSelection *physTrigSel = new AliPhysicsSelection();
28
29 //
30 // Create event cuts
31 //
32 Float_t zvWindow = 20. ;
33
34 AlidNdPtEventCuts *evtCuts = new AlidNdPtEventCuts("AlidNdPtEventCuts","Event cuts");
35 evtCuts->SetZvRange(-zvWindow,zvWindow);
36 evtCuts->SetMeanXYZv(0.0,0.0,0.0);
37 evtCuts->SetSigmaMeanXYZv(1.0,1.0,10.0);
38 evtCuts->SetTriggerRequired(kTRUE);
39
40 //
41 // Create geom. acceptance cuts
42 //
43 Float_t etaWindow = 1. ;
44 Float_t ptMin = 0.15 ;
45
46 AlidNdPtAcceptanceCuts *accCuts = new AlidNdPtAcceptanceCuts("AlidNdPtAcceptanceCuts","Geom. acceptance cuts");
47 accCuts->SetEtaRange(-etaWindow,etaWindow);
48 accCuts->SetPtRange(ptMin,1.e10);
49 accCuts->SetMaxDCAr(3.0);
50 accCuts->SetMaxDCAz(30.0);
51
52 //
53 // Create standard esd track cuts
54 //
55 Int_t cutMode = 23;
56
57 gROOT->LoadMacro("$ALICE_ROOT/PWG0/dNdPt/macros/CreatedNdPtTrackCuts.C");
58 AliESDtrackCuts* esdTrackCuts = CreatedNdPtTrackCuts(cutMode);
59 if (!esdTrackCuts) {
60 printf("ERROR: esdTrackCuts could not be created\n");
61 return;
62 } else {
63 esdTrackCuts->SetHistogramsOn(kTRUE);
64 }
65
66
67 Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
68
69 //
70 // Create task
71 //
72 AlidNdPtTask *task = new AlidNdPtTask("AlidNdPtTask");
73 task->SetUseMCInfo(hasMC);
74
75 // trigger
76 task->SelectCollisionCandidates(AliVEvent::kMB);
77
78 //
79 // set analysis options from the Helper here !!!
80 //
81 AlidNdPtHelper::OutputObject outputObject = AlidNdPtHelper::kCutAnalysisPbPb;
82 AlidNdPtHelper::AnalysisMode analysisMode = AlidNdPtHelper::kTPC ;
83 AlidNdPtHelper::ParticleMode particleMode = AlidNdPtHelper::kAllPart ;
84
85
86 //
87 // Create cut analysis object
88 //
89 if(outputObject==AlidNdPtHelper::kCutAnalysisPbPb) {
90
91 AlidNdPtCutAnalysisPbPb *fdNdPtAnalysisPbPb = new AlidNdPtCutAnalysisPbPb("dNdPtCutAnalysisPbPb","dN/dPt Analysis");
92 fdNdPtAnalysisPbPb->SetEventCuts(evtCuts);
93 fdNdPtAnalysisPbPb->SetAcceptanceCuts(accCuts);
94 fdNdPtAnalysisPbPb->SetTrackCuts(esdTrackCuts);
95 fdNdPtAnalysisPbPb->SetAnalysisMode(analysisMode);
96 fdNdPtAnalysisPbPb->SetParticleMode(particleMode);
97
98
99 if(hasMC)
100 {
101 physTrigSel->SetAnalyzeMC();
102 fdNdPtAnalysisPbPb->SetPhysicsTriggerSelection(physTrigSel);
103
104 fdNdPtAnalysisPbPb->SetUseMCInfo(kTRUE);
105 }else { // online trigger
106 fdNdPtAnalysisPbPb->SetPhysicsTriggerSelection(physTrigSel);
107 }
108
109 task->AddAnalysisObject( fdNdPtAnalysisPbPb );
110 }
111
112
113 // Centrality
114 task->SetUseCentrality(1); // 0=off, 1=VZERO, 2=SPD
115 task->SetUseCentralityBin(0); // Bin to be used 0,5,10,20,30,40,50,60,70,80,90,(100=SPDonly)
116 // 0 = most centrality
117
118 // Add task
119 mgr->AddTask(task);
120
121 // Create containers for input
122 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
123 mgr->ConnectInput(task, 0, cinput);
124
125 AliAnalysisDataContainer *coutput = mgr->CreateContainer("jotwinow_dNdPtCutAnalysisPbPb", TList::Class(), AliAnalysisManager::kOutputContainer, "jotwinow_dNdPtCutAnalysisPbPb.root");
126 mgr->ConnectOutput(task, 1, coutput);
127
128}
129