AliPhysics  d565ceb (d565ceb)
AliAnalysisTaskCountITStracks.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 <THashList.h>
16 #include <THistManager.h>
17 #include <TString.h>
18 
19 #include "AliAnalysisManager.h"
21 #include "AliAnalysisUtils.h"
22 #include "AliAODTrack.h"
23 #include "AliESDtrack.h"
24 #include "AliInputEventHandler.h"
25 #include "AliVEvent.h"
26 #include "AliVTrack.h"
27 #include "AliVVertex.h"
28 
30 
31 namespace EMCalTriggerPtAnalysis {
32 
33 AliAnalysisTaskCountITStracks::AliAnalysisTaskCountITStracks() :
35  fAnalysisUtils(nullptr),
36  fHistos(nullptr)
37 {
38 
39 }
40 
42  AliAnalysisTaskSE(name),
45 {
46  DefineOutput(1, TList::Class());
47 }
48 
50  if(fAnalysisUtils) delete fAnalysisUtils;
51  if(fHistos) delete fHistos;
52 }
53 
55  fAnalysisUtils = new AliAnalysisUtils;
56 
57  fHistos = new THistManager("CountITStracks");
58  fHistos->CreateTH1("countITStracksACside", "Total ITS track count for A- and C-side", 2, -0.5, 1.5);
59  fHistos->CreateTH1("countITStracksEventAside", "Multiplicity distribution ITS tracks in EMCAL area A-side", 101, 0.5, 100.5);
60  fHistos->CreateTH1("countITStracksEventCside", "Multiplicity distribution ITS tracks in EMCAL area C-side", 101, 0.5, 100.5);
61  PostData(1, fHistos->GetListOfHistograms());
62 }
63 
65  // idea: count number of ITS tracks for A- and C- side separately
66  // (above pt-threshold) in the EMCAL area
67  // In case of matching issues we should see an increase in the amount
68  // of ITS stand-alone tracks.
69 
70  const int kAside = 0, kCside = 1;
71 
72  // Select events
73  if(!(fInputHandler->IsEventSelected() & AliVEvent::kINT7)) return;
74  double vz = fInputEvent->GetPrimaryVertex()->GetZ();
75  if(TMath::Abs(vz) > 10.) return;
76  if(!fAnalysisUtils->IsVertexSelected2013pA(fInputEvent)) return;
77  if(fAnalysisUtils->IsPileUpEvent(fInputEvent)) return;
78 
79  int nTracksAside(0), nTracksCside(0);
80  int side(-1);
81  for(int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); itrk++){
82  AliVTrack *trk = static_cast<AliVTrack *>(fInputEvent->GetTrack(itrk));
83 
84  // require track to be within the EMCAL area
85  double eta = trk->Eta(), phi = trk->Phi();
86  if(TMath::Abs(eta) > 0.5) continue;
87  if(phi < 1.4 || phi > 3.1) continue;
88 
89  // check whether track is an ITS stand-alone track
90  AliESDtrack *esdtrack(nullptr);
91  AliAODTrack *aodtrack(nullptr);
92  float dr, dz;
93  if((esdtrack = static_cast<AliESDtrack *>(trk))) {
94  if(!esdtrack->GetStatus() & AliESDtrack::kITSpureSA) continue;
95  esdtrack->GetImpactParameters(dr, dz);
96  } else if((aodtrack = static_cast<AliAODTrack *>(trk))) {
97  if(!aodtrack->IsPureITSStandalone()) continue;
98  aodtrack->GetImpactParameters(dr, dz);
99  } else {
100  continue;
101  }
102 
103  // Check pointing to the primary vertex
104  if(TMath::Abs(dr) > 3.2) continue;
105  if(TMath::Abs(dz) > 2.) continue;
106 
107  // Apply pt-cut in order to reject low-pt ITS stand-alone tracks
108  if(TMath::Abs(trk->Pt()) < 0.5) continue;
109 
110  if(eta < 0){
111  side = kCside;
112  nTracksCside++;
113  }
114  else{
115  side = kAside;
116  nTracksAside++;
117  }
118 
119  fHistos->FillTH1("countITStracksACside", side);
120  }
121 
122  // Multiplicities
123  fHistos->FillTH1("countITStracksEventAside", nTracksAside);
124  fHistos->FillTH1("countITStracksEventCside", nTracksCside);
125 
126  PostData(1, fHistos->GetListOfHistograms());
127 }
128 
130  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
132  mgr->AddTask(task);
133 
134  TString outputcont = mgr->GetCommonFileName();
135  outputcont += ":CountITStracks";
136 
137  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
138  mgr->ConnectOutput(task, 1, mgr->CreateContainer("histosCountITStracks", TList::Class(), AliAnalysisManager::kOutputContainer, outputcont));
139  return task;
140 }
141 
142 } /* namespace EMCalTriggerPtAnalysis */
static AliAnalysisTaskCountITStracks * AddTaskCountITStracks(const char *name)
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
Analysis of high- tracks in triggered events.
Container class for histograms.
Definition: THistManager.h:99
const char Option_t
Definition: External.C:48