AliPhysics  vAN-20150822 (d56cf94)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskChargedParticlesRef.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2015, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <vector>
16 #include <map>
17 
18 #include <TArrayD.h>
19 #include <TMath.h>
20 #include <THashList.h>
21 #include <TString.h>
22 
23 #include "AliAnalysisUtils.h"
24 #include "AliAODTrack.h"
25 #include "AliESDtrackCuts.h"
26 #include "AliESDEvent.h"
27 #include "AliESDtrack.h"
28 #include "AliInputEventHandler.h"
29 #include "AliVVertex.h"
30 
31 #include "AliEMCalHistoContainer.h"
33 
37 
38 namespace EMCalTriggerPtAnalysis {
39 
43 AliAnalysisTaskChargedParticlesRef::AliAnalysisTaskChargedParticlesRef() :
44  AliAnalysisTaskSE(),
45  fTrackCuts(NULL),
46  fAnalysisUtil(NULL),
47  fHistos(NULL)
48 {
49 }
50 
56  AliAnalysisTaskSE(name),
57  fTrackCuts(NULL),
58  fAnalysisUtil(NULL),
59  fHistos(NULL)
60 {
61  DefineOutput(1, TList::Class());
62 }
63 
68  if(fTrackCuts) delete fTrackCuts;
69  if(fAnalysisUtil) delete fAnalysisUtil;
70  if(fHistos) delete fHistos;
71 }
72 
77  fAnalysisUtil = new AliAnalysisUtils;
78 
79  fTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(true, 1);
80  fTrackCuts->SetName("Standard Track cuts");
81  fTrackCuts->SetMinNCrossedRowsTPC(120);
82  fTrackCuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
83 
84  TArrayD oldbinning, newbinning;
85  CreateOldPtBinning(oldbinning);
86  CreateNewPtBinning(newbinning);
87 
88  fHistos = new AliEMCalHistoContainer("Ref");
89  TString triggers[5] = {"MB", "EJ1", "EJ2", "EG1", "EG2"};
90  for(TString *trg = triggers; trg < triggers+5; trg++){
91  fHistos->CreateTH1(Form("hEventCount%s", trg->Data()), Form("Event Counter for trigger class %s", trg->Data()), 1, 0.5, 1.5);
92  fHistos->CreateTH1(Form("hVertexBefore%s", trg->Data()), Form("Vertex distribution before z-cut for trigger class %s", trg->Data()), 500, -50, 50);
93  fHistos->CreateTH1(Form("hVertexAfter%s", trg->Data()), Form("Vertex distribution after z-cut for trigger class %s", trg->Data()), 100, -10, 10);
94  fHistos->CreateTH1(Form("hPtEtaAllOldBinning%s", trg->Data()), Form("Charged particle pt distribution all eta old binning trigger %s", trg->Data()), oldbinning);
95  fHistos->CreateTH1(Form("hPtEtaCentOldBinning%s", trg->Data()), Form("Charged particle pt distribution central eta old binning trigger %s", trg->Data()), oldbinning);
96  fHistos->CreateTH1(Form("hPtEtaAllNewBinning%s", trg->Data()), Form("Charged particle pt distribution all eta new binning trigger %s", trg->Data()), newbinning);
97  fHistos->CreateTH1(Form("hPtEtaCentNewBinning%s", trg->Data()), Form("Charged particle pt distribution central eta new binning trigger %s", trg->Data()), newbinning);
98  fHistos->CreateTH1(Form("hEtaDistAllPt1%s", trg->Data()), Form("Eta distribution without etacut for tracks with Pt above 1 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
99  fHistos->CreateTH1(Form("hEtaDistAllPt2%s", trg->Data()), Form("Eta distribution without etacut for tracks with Pt above 2 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
100  fHistos->CreateTH1(Form("hEtaDistAllPt5%s", trg->Data()), Form("Eta distribution without etacut for tracks with Pt above 5 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
101  fHistos->CreateTH1(Form("hEtaDistAllPt10%s", trg->Data()), Form("Eta distribution without etacut for tracks with Pt above 10 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
102  fHistos->CreateTH1(Form("hEtaDistAllPt20%s", trg->Data()), Form("Eta distribution without etacut for tracks with Pt above 20 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
103  fHistos->CreateTH1(Form("hEtaDistCutPt1%s", trg->Data()), Form("Eta distribution with etacut for tracks with Pt above 1 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
104  fHistos->CreateTH1(Form("hEtaDistCutPt2%s", trg->Data()), Form("Eta distribution with etacut for tracks with Pt above 2 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
105  fHistos->CreateTH1(Form("hEtaDistCutPt5%s", trg->Data()), Form("Eta distribution with etacut for tracks with Pt above 5 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
106  fHistos->CreateTH1(Form("hEtaDistCutPt10%s", trg->Data()), Form("Eta distribution with etacut for tracks with Pt above 10 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
107  fHistos->CreateTH1(Form("hEtaDistCutPt20%s", trg->Data()), Form("Eta distribution with etacut for tracks with Pt above 20 GeV/c trigger %s", trg->Data()), 100, -1., 1.);
108  }
109  PostData(1, fHistos->GetListOfHistograms());
110 }
111 
121  // Select event
122  TString triggerstring = fInputEvent->GetFiredTriggerClasses();
123  Bool_t isMinBias = fInputHandler->IsEventSelected() & AliVEvent::kINT7,
124  isEJ1 = triggerstring.Contains("EJ1"),
125  isEJ2 = triggerstring.Contains("EJ2"),
126  isEG1 = triggerstring.Contains("EG1"),
127  isEG2 = triggerstring.Contains("EG2");
128  if(!(isMinBias || isEG1 || isEG2 || isEJ1 || isEJ2)) return;
129  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
130  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
131  if(vtx->GetNContributors() < 1) return;
132  // Fill reference distribution for the primary vertex before any z-cut
133  if(isMinBias) fHistos->FillTH1("hVertexBeforeMB", vtx->GetZ());
134  if(isEJ1) fHistos->FillTH1("hVertexBeforeEJ1", vtx->GetZ());
135  if(isEJ2) fHistos->FillTH1("hVertexBeforeEJ2", vtx->GetZ());
136  if(isEG1) fHistos->FillTH1("hVertexBeforeEG1", vtx->GetZ());
137  if(isEG2) fHistos->FillTH1("hVertexBeforeEG2", vtx->GetZ());
138  if(!fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) return; // Apply new vertex cut
139  if(fAnalysisUtil->IsPileUpEvent(fInputEvent)) return; // Apply new vertex cut
140  // Apply vertex z cut
141  if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) return;
142 
143  // Fill Event counter and reference vertex distributions for the different trigger classes
144  if(isMinBias){
145  fHistos->FillTH1("hEventCountMB", 1);
146  fHistos->FillTH1("hVertexAfterMB", vtx->GetZ());
147  }
148  if(isEJ1){
149  fHistos->FillTH1("hEventCountEJ1", 1);
150  fHistos->FillTH1("hVertexAfterEJ1", vtx->GetZ());
151  }
152  if(isEJ2){
153  fHistos->FillTH1("hEventCountEJ2", 1);
154  fHistos->FillTH1("hVertexAfterEJ2", vtx->GetZ());
155  }
156  if(isEG1){
157  fHistos->FillTH1("hEventCountEG1", 1);
158  fHistos->FillTH1("hVertexAfterEG1", vtx->GetZ());
159  }
160  if(isEG2){
161  fHistos->FillTH1("hEventCountEG2", 1);
162  fHistos->FillTH1("hVertexAfterEG2", vtx->GetZ());
163  }
164 
165  // Loop over tracks, fill select particles
166  // Histograms
167  // - Full eta (-0.8, 0.8), new binning
168  // - Full eta (-0.8, 0.8), old binning
169  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
170  // - Central eta (-0.8, -0.2), new binning,
171  // - Central eta (-0.8, -0.2), old binning,
172  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
173  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
174  AliVTrack *checktrack(NULL);
175  int ptmin[5] = {1,2,5,10,20}; // for eta distributions
176  for(int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
177  checktrack = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(itrk));
178  if(!checktrack) continue;
179  if(TMath::Abs(checktrack->Eta()) > 0.8) continue;
180  if(TMath::Abs(checktrack->Pt()) < 0.1) continue;
181 
182  // Distinguish track selection for ESD and AOD tracks
183  AliESDtrack *esdtrack(NULL);
184  AliAODTrack *aodtrack(NULL);
185  if((esdtrack = dynamic_cast<AliESDtrack *>(checktrack))){
186  if(!TrackSelectionESD(esdtrack)) continue;
187  } else if((aodtrack = dynamic_cast<AliAODTrack *>(checktrack))){
188  if(!TrackSelectionAOD(aodtrack)) continue;
189  } else {
190  continue;
191  }
192 
193  // fill histograms allEta
194  if(isMinBias){
195  fHistos->FillTH1("hPtEtaAllNewBinningMB", TMath::Abs(checktrack->Pt()));
196  fHistos->FillTH1("hPtEtaAllOldBinningMB", TMath::Abs(checktrack->Pt()));
197  for(int icut = 0; icut < 5; icut++){
198  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
199  fHistos->FillTH1(Form("hEtaDistAllPt%dMB", ptmin[icut]), checktrack->Eta());
200  }
201  }
202  }
203  if(isEJ1){
204  fHistos->FillTH1("hPtEtaAllNewBinningEJ1", TMath::Abs(checktrack->Pt()));
205  fHistos->FillTH1("hPtEtaAllOldBinningEJ1", TMath::Abs(checktrack->Pt()));
206  for(int icut = 0; icut < 5; icut++){
207  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
208  fHistos->FillTH1(Form("hEtaDistAllPt%dEJ1", ptmin[icut]), checktrack->Eta());
209  }
210  }
211  }
212  if(isEJ2){
213  fHistos->FillTH1("hPtEtaAllNewBinningEJ2", TMath::Abs(checktrack->Pt()));
214  fHistos->FillTH1("hPtEtaAllOldBinningEJ2", TMath::Abs(checktrack->Pt()));
215  for(int icut = 0; icut < 5; icut++){
216  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
217  fHistos->FillTH1(Form("hEtaDistAllPt%dEJ2", ptmin[icut]), checktrack->Eta());
218  }
219  }
220  }
221  if(isEG1){
222  fHistos->FillTH1("hPtEtaAllNewBinningEG1", TMath::Abs(checktrack->Pt()));
223  fHistos->FillTH1("hPtEtaAllOldBinningEG1", TMath::Abs(checktrack->Pt()));
224  for(int icut = 0; icut < 5; icut++){
225  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
226  fHistos->FillTH1(Form("hEtaDistAllPt%dEG1", ptmin[icut]), checktrack->Eta());
227  }
228  }
229  }
230  if(isEG2){
231  fHistos->FillTH1("hPtEtaAllNewBinningEG2", TMath::Abs(checktrack->Pt()));
232  fHistos->FillTH1("hPtEtaAllOldBinningEG2", TMath::Abs(checktrack->Pt()));
233  for(int icut = 0; icut < 5; icut++){
234  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
235  fHistos->FillTH1(Form("hEtaDistAllPt%dEG2", ptmin[icut]), checktrack->Eta());
236  }
237  }
238  }
239 
240  if(checktrack->Eta() > -0.8 && checktrack->Eta() < -0.2){
241  // Fill Histograms in central eta
242  if(isMinBias){
243  fHistos->FillTH1("hPtEtaCentNewBinningMB", TMath::Abs(checktrack->Pt()));
244  fHistos->FillTH1("hPtEtaCentOldBinningMB", TMath::Abs(checktrack->Pt()));
245  for(int icut = 0; icut < 5; icut++){
246  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
247  fHistos->FillTH1(Form("hEtaDistCutPt%dMB", ptmin[icut]), checktrack->Eta());
248  }
249  }
250  }
251  if(isEJ1){
252  fHistos->FillTH1("hPtEtaCentNewBinningEJ1", TMath::Abs(checktrack->Pt()));
253  fHistos->FillTH1("hPtEtaCentOldBinningEJ1", TMath::Abs(checktrack->Pt()));
254  for(int icut = 0; icut < 5; icut++){
255  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
256  fHistos->FillTH1(Form("hEtaDistCutPt%dEJ1", ptmin[icut]), checktrack->Eta());
257  }
258  }
259  }
260  if(isEJ2){
261  fHistos->FillTH1("hPtEtaCentNewBinningEJ2", TMath::Abs(checktrack->Pt()));
262  fHistos->FillTH1("hPtEtaCentOldBinningEJ2", TMath::Abs(checktrack->Pt()));
263  for(int icut = 0; icut < 5; icut++){
264  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
265  fHistos->FillTH1(Form("hEtaDistCutPt%dEJ2", ptmin[icut]), checktrack->Eta());
266  }
267  }
268  }
269  if(isEG1){
270  fHistos->FillTH1("hPtEtaCentNewBinningEG1", TMath::Abs(checktrack->Pt()));
271  fHistos->FillTH1("hPtEtaCentOldBinningEG1", TMath::Abs(checktrack->Pt()));
272  for(int icut = 0; icut < 5; icut++){
273  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
274  fHistos->FillTH1(Form("hEtaDistCutPt%dEG1", ptmin[icut]), checktrack->Eta());
275  }
276  }
277  }
278  if(isEG2){
279  fHistos->FillTH1("hPtEtaCentNewBinningEG2", TMath::Abs(checktrack->Pt()));
280  fHistos->FillTH1("hPtEtaCentOldBinningEG2", TMath::Abs(checktrack->Pt()));
281  for(int icut = 0; icut < 5; icut++){
282  if(TMath::Abs(checktrack->Pt()) > static_cast<double>(ptmin[icut])){
283  fHistos->FillTH1(Form("hEtaDistCutPt%dEG2", ptmin[icut]), checktrack->Eta());
284  }
285  }
286  }
287  }
288  }
289  PostData(1, fHistos->GetListOfHistograms());
290 }
291 
297  std::vector<double> mybinning;
298  std::map<double,double> definitions;
299  definitions.insert(std::pair<double,double>(2.5, 0.1));
300  definitions.insert(std::pair<double,double>(7., 0.25));
301  definitions.insert(std::pair<double,double>(15., 0.5));
302  definitions.insert(std::pair<double,double>(25., 1.));
303  definitions.insert(std::pair<double,double>(40., 2.5));
304  definitions.insert(std::pair<double,double>(50., 5.));
305  definitions.insert(std::pair<double,double>(100., 10.));
306  double currentval = 0;
307  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
308  double limit = id->first, binwidth = id->second;
309  while(currentval < limit){
310  currentval += binwidth;
311  mybinning.push_back(currentval);
312  }
313  }
314  binning.Set(mybinning.size());
315  int ib = 0;
316  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
317  binning[ib++] = *it;
318 }
319 
325  std::vector<double> mybinning;
326  std::map<double,double> definitions;
327  definitions.insert(std::pair<double, double>(1, 0.05));
328  definitions.insert(std::pair<double, double>(2, 0.1));
329  definitions.insert(std::pair<double, double>(4, 0.2));
330  definitions.insert(std::pair<double, double>(7, 0.5));
331  definitions.insert(std::pair<double, double>(16, 1));
332  definitions.insert(std::pair<double, double>(36, 2));
333  definitions.insert(std::pair<double, double>(40, 4));
334  definitions.insert(std::pair<double, double>(50, 5));
335  definitions.insert(std::pair<double, double>(100, 10));
336  definitions.insert(std::pair<double, double>(200, 20));
337  double currentval = 0.;
338  mybinning.push_back(currentval);
339  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
340  double limit = id->first, binwidth = id->second;
341  while(currentval < limit){
342  currentval += binwidth;
343  mybinning.push_back(currentval);
344  }
345  }
346  binning.Set(mybinning.size());
347  int ib = 0;
348  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
349  binning[ib++] = *it;
350 }
351 
358  return fTrackCuts->AcceptTrack(track);
359 }
360 
367  if(!track->TestFilterBit(AliAODTrack::kTrkGlobal)) return false;
368  if(track->GetTPCNCrossedRows() < 120) return false;
369  return true;
370 }
371 
372 } /* namespace EMCalTriggerPtAnalysis */
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
void CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Container class for histograms for the high- charged particle analysis.
Declarartion of class AliEMCalHistoContainer.
const Double_t ptmin
void FillTH1(const char *hname, double x, double weight=1.)