Fix in spread function integral calculation (parameters order)
[u/mrichter/AliRoot.git] / PWGJE / macros / AddTaskFastEmbedding.C
CommitLineData
2cc9dfde 1
2AliAnalysisTaskFastEmbedding* AddTaskFastEmbedding(){
3
31b9d515 4 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5 if(!mgr){
6 ::Error("AddTaskCentralitySelection", "No analysis manager to connect ot.");
7 return NULL;
8 }
9 if(!mgr->GetInputEventHandler()){
10 ::Error("AddTaskCentralitySelection", "This task requires an input event handler.");
11 return NULL;
12 }
13
14
15 AliAnalysisTaskFastEmbedding *task = new AliAnalysisTaskFastEmbedding("FastEmbedding");
16 // ## set embedding mode ##
17 // kAODFull=0, kAODJetTracks, kAODJet4Mom, kToySingle4Mom
18 task->SetEmbedMode(AliAnalysisTaskFastEmbedding::kToyTracks);
19
20 // ## set ranges for toy ##
21 //SetToyTrackRanges(
22 Double_t minPt = 50.; Double_t maxPt = 100.;
23 Double_t minEta = -0.5; Double_t maxEta = 0.5;
24 //Double_t minEta = -0.4; Double_t maxEta = 0.4; // for LHC10h pass1
25 Double_t minPhi = 0.; Double_t maxPhi = 2*TMath::Pi();
26 //fToyDistributionTrackPt: 0 = uniform distribution
27 // else = exponential / power law (not implemented yet)
28 //task->SetToyNumberOfTrackRange(4,4);
29 //task->SetToyTrackRanges(0.15, 300., 5,-.9, .9, 0., 2*TMath::Pi());
30 task->SetToyTrackRanges(minPt,maxPt,0.,minEta,maxEta,minPhi,maxPhi);
31 task->SetToyFilterMap((1<<32)-1);
32
33 // ## set event selection for events of the addition AOD ##
34 // kEventsAll=0; kEventsJetPt
35 task->SetEvtSelecMode(AliAnalysisTaskFastEmbedding::kEventsJetPt);
36
37 // ## set jet pT range for event selection ##
38 // SetEvtSelJetPtRange(Float_t minPt, Float_t maxPt)
39 task->SetEvtSelJetPtRange(50.,110.);
40 //task->SetEvtSelJetEtaRange(-0.4, 0.4); // smaller eta window for LHC10h pass1
41 task->SetEvtSelJetEtaRange(-0.5, 0.5);
42
43 task->SetTrackFilterMap(272);
44
45 // event selection
46 task->SetOfflineTrgMask(AliVEvent::kMB);
47 task->SetCentMin(0.);
48 task->SetCentMax(80.);
49
50 //task->SetVtxMin(-10.);
51 //task->SetVtxMax(10.);
52
53 mgr->AddTask(task);
54
55 // ## create the output containers ##
56 AliAnalysisDataContainer *coutputFastEmbedding = mgr->CreateContainer(
57 "fastembedding", TList::Class(), AliAnalysisManager::kOutputContainer,
5c4489e2 58 Form("%s:PWGJE_FastEmbedding", AliAnalysisManager::GetCommonFileName()));
31b9d515 59
60 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
61 mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());
62 mgr->ConnectOutput(task, 1, coutputFastEmbedding);
63
64
65 return task;
2cc9dfde 66
67}
68
69AliAnalysisTaskFastEmbedding* AddTaskFastEmbedding(TObjArray* aodarray){
70
31b9d515 71 AliAnalysisTaskFastEmbedding *task = AddTaskFastEmbedding();
72 if(aodarray){
2cc9dfde 73 task->SetArrayOfAODPaths(aodarray);
74 task->SetEmbedMode(AliAnalysisTaskFastEmbedding::kAODFull);
31b9d515 75 }
2cc9dfde 76
31b9d515 77 return task;
2cc9dfde 78}
79
80
1a2bb6d5 81AliAnalysisTaskFastEmbedding* AddTaskFastEmbedding(const char* filepath, Int_t mode = 0){
2cc9dfde 82
31b9d515 83 AliAnalysisTaskFastEmbedding *task = AddTaskFastEmbedding();
84 if(strlen(filepath)){
85
86 if(mode==0){ // path to single AOD
87 task->SetAODPath(filepath);
88 }
89 if(mode==1){ // path to text file with list of paths of multiple AODs
90 Printf("Read aod paths from file %s", filepath);
91 TObjArray* array = new TObjArray();
92 TObjString* ostr = 0;
93 TString line;
94 ifstream in;
95 in.open(filepath);
96 while(in.good()){
97 in >> line;
98 if(line.Length() == 0) continue;
99 Printf("found aod path %s", line.Data());
100 ostr = new TObjString(line.Data());
101 array->Add(ostr);
102 }
103 Printf("-> %d aod paths found", array->GetEntries());
104
105 task->SetArrayOfAODPaths(array);
106 }
107
108 task->SetEmbedMode(AliAnalysisTaskFastEmbedding::kAODFull);
109 }
110
111 return task;
112}
113
114AliAnalysisTaskFastEmbedding* AddTaskFastEmbedding(const char* aodpath, const char* entriespath){
115
116 AliAnalysisTaskFastEmbedding *task = AddTaskFastEmbedding(aodpath, 1);
117
118 Printf("Read entries of aod files from %s", entriespath);
119 TArrayI* array = new TArrayI();
120 Int_t count = 0;
121 Int_t iEntry = -1;
122 Int_t iEntrySum = 0;
123 Int_t iEntryMax = 0;
124 TString line;
125 ifstream in;
126 in.open(entriespath);
127 while(in.good()){
128 in >> line;
129 iEntry = line.Atoi();
130
131 array->Set(count+1);
132 array->AddAt(iEntry,count);
133 count++;
134 iEntrySum += iEntry;
135 if(iEntry>iEntryMax) iEntryMax = iEntry;
136 }
137
138 task->SetArrayOfAODEntries(array);
139 task->SetAODEntriesSum(iEntrySum);
140 task->SetAODEntriesMax(iEntryMax);
141
142 return task;
2cc9dfde 143}
144