AliPhysics  fde8a9f (fde8a9f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskQAPmdflow.cxx
Go to the documentation of this file.
1 #include "TMath.h"
2 #include "TH1D.h"
3 #include "TH2D.h"
4 #include "TSeqCollection.h"
5 #include "TObjArray.h"
6 #include "TObjArray.h"
7 #include "TChain.h"
8 #include "TMCProcess.h"
9 #include "TLorentzVector.h"
10 #include "TDirectory.h"
11 #include "TROOT.h"
12 #include "TNtuple.h"
13 
14 #include "AliLog.h"
15 #include "AliVParticle.h"
16 #include "AliMCParticle.h"
17 #include "AliStack.h"
18 #include "AliVEvent.h"
19 #include "AliESDEvent.h"
20 #include "AliMCEvent.h"
21 #include "AliESDVZERO.h"
22 #include "AliESDZDC.h"
23 #include "AliESDtrack.h"
24 #include "AliFlowTrackCuts.h"
25 #include "AliFlowEventCuts.h"
26 #include "AliMultiplicity.h"
27 #include "AliESDtrackCuts.h"
28 #include "AliVertex.h"
29 #include "AliFlowEventSimple.h"
30 #include "AliFlowEvent.h"
31 #include "AliFlowVector.h"
32 #include "AliESDPmdTrack.h"
33 #include "AliAnalysisTaskSE.h"
34 #include "AliAnalysisManager.h"
35 #include "AliInputEventHandler.h"
36 
38 
40 
41 //________________________________________________________________________
44  fOutput(NULL),
45  fEventCuts(NULL),
46  fRPTrackCuts(NULL),
47  fPOITrackCuts(NULL)
48 {
49  // Default constructor
50 }
51 
52 //________________________________________________________________________
54  : AliAnalysisTaskSE(name),
55  fOutput(NULL),
56  fEventCuts(NULL),
57  fRPTrackCuts(NULL),
58  fPOITrackCuts(NULL)
59 {
60  // Constructor
61  DefineOutput(1, TObjArray::Class());
62 }
63 
64 //________________________________________________________________________
66 {
67  // Called once at the beginning
68  fOutput=new TObjArray();
69 
70  //define histograms
71  TH1F* histB = new TH1F("PMD ADC cutB","PMD ADC cutB",500,0,10000);
72  fOutput->Add(histB);
73 
74  TH1F* histA = new TH1F("PMD ADC cutA","PMD ADC cutA",500,0,10000);
75  fOutput->Add(histA);
76 
77  TH1F* histCelB = new TH1F("PMD ncell CutB", "PMD ncell CutB",100,0,100);
78  fOutput->Add(histCelB);
79  TH1F* histCelA = new TH1F("PMD ncell CutA", "PMD ncell CutA",100,0,100);
80  fOutput->Add(histCelA);
81 
82  //post data here as it doesn't change anyway (the pointer to list anyway)
83 
84  PostData(1, fOutput);
85 }
86 
87 //________________________________________________________________________
89 {
90  //get teh input data
91  AliESDEvent* event = dynamic_cast<AliESDEvent*>(InputEvent());
92  if (!event)
93  {
94  AliFatal("no ESD event");
95  return;
96  }
97 
98  fRPTrackCuts->SetEvent(event);
99 
102  Bool_t PmdTrRp = kFALSE;
103  Bool_t PmdTrPoi = kFALSE;
104 
105  if(sourcePOI == 4) PmdTrPoi = kTRUE;
106  if(sourceRP == 4) PmdTrRp = kTRUE;
107  if((!PmdTrPoi) && (!PmdTrRp))
108  {
109  printf("Error : PMD track is not used as POI or RP");
110  return;
111  }
112 
113  TH1F* hPmdAdcB = static_cast<TH1F*>(fOutput->At(0));
114  TH1F* hPmdAdcA = static_cast<TH1F*>(fOutput->At(1));
115  TH1F* hPmdNcelB = static_cast<TH1F*>(fOutput->At(2));
116  TH1F* hPmdNcelA = static_cast<TH1F*>(fOutput->At(3));
117 
118  //Bool_t passevent = fEventCuts->IsSelected(event);
119  //Bool_t isSelectedEventSelection = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
120 
121  Int_t ntracks = 0;
122 
123  if(PmdTrRp) ntracks = fRPTrackCuts->GetNumberOfInputObjects();
124  if(PmdTrPoi) ntracks = fPOITrackCuts->GetNumberOfInputObjects();
125 
126  for (Int_t i=0; i < ntracks; i++)
127  {
128  Bool_t pass = kFALSE;
129  TObject* obj = 0x0;
130  if(PmdTrPoi){
131  obj = fPOITrackCuts->GetInputObject(i);
132  if (!obj) continue;
133  pass = fPOITrackCuts->IsSelected(obj,i);
134  }
135 
136  if(PmdTrRp){
137  obj = fRPTrackCuts->GetInputObject(i);
138  if (!obj) continue;
139  pass = fRPTrackCuts->IsSelected(obj,i);
140  }
141  AliESDPmdTrack* trackpmd = dynamic_cast<AliESDPmdTrack*>(obj);
142  if (trackpmd)
143  {
144  Int_t det = trackpmd->GetDetector();
145  Float_t adc = trackpmd->GetClusterADC();
146  Float_t ncel = trackpmd->GetClusterCells();
147  if(det == 0){
148  hPmdAdcB->Fill(adc); if(pass) hPmdAdcA->Fill(adc);
149  hPmdNcelB->Fill(ncel); if(pass) hPmdNcelA->Fill(ncel);
150  }
151  }
152  }
153 }
154 
155 //________________________________________________________________________
157 {
158  //terminate
159 
160 }
161 
162 //________________________________________________________________________
164 {
165  //dtor
166  delete fRPTrackCuts;
167  delete fPOITrackCuts;
168  delete fEventCuts;
169 }
170 
TObject * GetInputObject(Int_t i)
virtual Bool_t IsSelected(TObject *obj, Int_t id=-666)
trackParameterType GetParamType() const
Int_t GetNumberOfInputObjects() const
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
virtual void UserExec(Option_t *option)
void SetEvent(AliVEvent *event, AliMCEvent *mcEvent=NULL)
ClassImp(AliAnalysisTaskQAPmdflow) AliAnalysisTaskQAPmdflow
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
virtual void Terminate(Option_t *)