]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/QA/tasks/AliAnalysisTaskHLT.cxx
- fill more histograms to match the central barrel task output
[u/mrichter/AliRoot.git] / HLT / QA / tasks / AliAnalysisTaskHLT.cxx
1 // $Id$
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        *
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors: Zhongbao Yin <zbyin@mail.ccnu.edu.cn>,                *
7 //*                  Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no>          *
8 //*                  for The ALICE HLT Project.                            *
9 //*                                                                        *
10 //* Permission to use, copy, modify and distribute this software and its   *
11 //* documentation strictly for non-commercial purposes is hereby granted   *
12 //* without fee, provided that the above copyright notice appears in all   *
13 //* copies and that both the copyright notice and this permission notice   *
14 //* appear in the supporting documentation. The authors make no claims     *
15 //* about the suitability of this software for any purpose. It is          *
16 //* provided "as is" without express or implied warranty.                  *
17 //**************************************************************************
18
19 /** @file  AliAnalysisTaskHLT.cxx  
20     @author Kalliopi Kanaki, Hege Erdal
21     @date 
22     @brief An analysis task containing
23     loops over HLT and offline ESD trees for comparing
24     AliESDtrack properties.    
25 */
26
27 //#include <iostream>
28
29 class AliAnalysisTask;
30 class AliAnalysisManager;
31
32 #include "AliAnalysisTaskHLT.h"
33 #include "AliHLTGlobalTriggerDecision.h"
34 #include "TH1F.h"
35 #include "TH2F.h"
36 #include "TString.h"
37 #include "AliESDEvent.h"
38 #include "AliESDtrackCuts.h"
39 #include "AliESDInputHandler.h"
40 #include "AliTracker.h" 
41 #include "AliCentrality.h"
42
43 #include "TText.h"
44 #include "TTimeStamp.h"
45
46 ClassImp(AliAnalysisTaskHLT)
47
48 //===============================================================//
49
50 AliAnalysisTaskHLT::AliAnalysisTaskHLT()
51 :
52 AliAnalysisTaskSE()
53   ,fUseHLTTrigger(kFALSE)
54   //,fESDOfftrackCuts(0)
55   //,fESDHLTtrackCuts(0)
56   ,fOutputList(0)
57   ,fHistTrigger(0)
58   ,fChargeOff(0)  
59   ,fMomentumOff(0)
60   ,fDCArOff(0)          
61   ,fDCAzOff(0)          
62   ,fNclusterOff(0)
63   ,fNITSclusterOff(0)
64   ,fNclusterOffwCut(0)          
65   ,fPhiOff(0)   
66   ,fMultOff(0)  
67   ,fXYvertexOff(0)      
68   ,fXvertexOff(0)           
69   ,fYvertexOff(0)           
70   ,fZvertexOff(0)
71   ,fSPDXvertexOff(0)        
72   ,fSPDYvertexOff(0)        
73   ,fSPDZvertexOff(0)
74   ,fEtaOff(0)
75   ,fEtaMomentumcutOff(0)
76   ,fNclusVSphiOff(0)
77   ,fNclusVSthetaOff(0)
78   ,fEventSpecieOff(0)
79   ,fV0cent(0)  
80   
81   ,fChargeHLT(0)
82   ,fMomentumHLT(0)
83   ,fDCArHLT(0)  
84   ,fDCAzHLT(0)  
85   ,fNclusterHLT(0)
86   ,fNITSclusterHLT(0)
87   ,fNclusterHLTwCut(0)
88   ,fPhiHLT(0)     
89   ,fMultHLT(0)  
90   ,fXYvertexHLT(0)
91   ,fXvertexHLT(0)
92   ,fYvertexHLT(0)
93   ,fZvertexHLT(0)
94   ,fSPDXvertexHLT(0)     
95   ,fSPDYvertexHLT(0)     
96   ,fSPDZvertexHLT(0)
97   ,fEtaHLT(0)
98   ,fEtaMomentumcutHLT(0)
99   ,fNclusVSphiHLT(0)        
100   ,fNclusVSthetaHLT(0)
101   ,fEventSpecieHLT(0)
102   
103   ,fBeamType()
104   ,fTextBox(0)
105   ,fSwitch(kTRUE)
106   ,fCentrality()
107 {
108   // Constructor
109   // Define input and output slots here
110   // Input slot #0 works with a TChain
111   // DefineInput(0, TChain::Class());
112   // Output slot #0 writes into a TH1 container
113 }
114  
115 AliAnalysisTaskHLT::AliAnalysisTaskHLT(const char *name)
116   :
117   AliAnalysisTaskSE(name) 
118   ,fUseHLTTrigger(kFALSE)   
119   //,fESDOfftrackCuts(0)
120   //,fESDHLTtrackCuts(0)
121   ,fOutputList(0)
122   ,fHistTrigger(0)
123   ,fChargeOff(0)  
124   ,fMomentumOff(0)
125   ,fDCArOff(0) 
126   ,fDCAzOff(0) 
127   ,fNclusterOff(0)
128   ,fNITSclusterOff(0)
129   ,fNclusterOffwCut(0)  
130   ,fPhiOff(0)   
131   ,fMultOff(0)  
132   ,fXYvertexOff(0)      
133   ,fXvertexOff(0)           
134   ,fYvertexOff(0)           
135   ,fZvertexOff(0)
136   ,fEtaOff(0)
137   ,fEtaMomentumcutOff(0)
138   ,fNclusVSphiOff(0)
139   ,fNclusVSthetaOff(0)
140   ,fEventSpecieOff(0)
141   ,fV0cent(0)  
142   ,fNcontOff(0)
143   
144   ,fChargeHLT(0)      
145   ,fMomentumHLT(0)
146   ,fNclusterHLT(0)
147   ,fNITSclusterHLT(0)
148   ,fNclusterHLTwCut(0)
149   ,fPhiHLT(0)     
150   ,fMultHLT(0)  
151   ,fXYvertexHLT(0)
152   ,fXvertexHLT(0)
153   ,fYvertexHLT(0)
154   ,fZvertexHLT(0)
155   ,fEtaHLT(0)
156   ,fEtaMomentumcutHLT(0)
157   ,fNclusVSphiHLT(0)        
158   ,fNclusVSthetaHLT(0)
159   ,fEventSpecieHLT(0)
160   ,fNcontHLT(0)
161   
162   ,fBeamType()
163   ,fTextBox(0)
164   ,fSwitch(kTRUE)
165   ,fCentrality()
166
167   // Constructor
168   // Define input and output slots here
169   // Input slot #0 works with a TChain
170   // DefineInput(0, TChain::Class());
171   // Output slot #0 writes into a TH1 container
172   DefineOutput(1, TList::Class());
173 }
174
175 //------------------------------------------------------------------------//
176
177 void AliAnalysisTaskHLT::UserCreateOutputObjects(){
178   // Create histograms
179
180   OpenFile(1);
181   fOutputList = new TList();
182   fOutputList->SetOwner();
183   fOutputList->SetName(GetName());
184
185   /*
186   //0 mistriggered, 1 Good triggered, 2, triggered, 3 fake trigger, 
187   //4 events with offline track, 5 total events processed,
188   //6 offline track thru CE, 7 online track to CE
189   fHistTrigger = new TH1F("fHistTrigger", "Trigger Status", 8, -0.5, 7.5);
190   fHistTrigger->GetXaxis()->SetTitle("");
191   fHistTrigger->GetYaxis()->SetTitle("Events");
192   fHistTrigger->SetMarkerStyle(kFullCircle);
193   fHistTrigger->SetStats(0);
194   fHistTrigger->SetFillColor(2);
195   //fHistTrigger->SetDrawOption("B TEXT60");
196
197   //Set bin labels
198   (fHistTrigger->GetXaxis())->SetBinLabel(1,"missed");
199   (fHistTrigger->GetXaxis())->SetBinLabel(2,"triggerWofflTrk");
200   (fHistTrigger->GetXaxis())->SetBinLabel(3,"triggered");
201   (fHistTrigger->GetXaxis())->SetBinLabel(4,"triggerWOofflTrk");
202   (fHistTrigger->GetXaxis())->SetBinLabel(5,"NevWofflTrk");
203   (fHistTrigger->GetXaxis())->SetBinLabel(6,"Nevt");
204   (fHistTrigger->GetXaxis())->SetBinLabel(7,"offlTrkThruCE");
205   (fHistTrigger->GetXaxis())->SetBinLabel(8,"onlTrkThruCE"); 
206   */
207
208   fHistTrigger = new TH1F("fHistTrigger", "CTP trigger counter", 24, 0, 24);
209   fHistTrigger->GetXaxis()->SetTitle("");  
210   fHistTrigger->GetYaxis()->SetTitle("#Events"); 
211
212   //=========== event properties =================//
213
214   if(fBeamType.Contains("Pb")){
215      fMultOff  = new TH1F("fMult_off", "TPC track multiplicity (OFF)",200,0,2000);
216      fMultHLT  = new TH1F("fMult_hlt", "TPC track multiplicity (HLT)",200,0,2000);     
217      fNcontOff = new TH1F("fNcont_off","# of contributors (OFF)",200,0,2000);
218      fNcontHLT = new TH1F("fNcont_hlt","# of contributors (HLT)",200,0,2000);     
219      fV0cent   = new TH1F("fV0cent",   "V0 centrality",               100,0, 100);
220   } 
221   else {
222      fMultOff = new TH1F("fMult_off","TPC track multiplicity (OFF)",200,0,200);
223      fMultHLT = new TH1F("fMult_hlt","TPC track multiplicity (HLT)",200,0,200);    
224      fNcontOff = new TH1F("fNcont_off","# of contributors (OFF)",200,0,200);
225      fNcontHLT = new TH1F("fNcont_hlt","# of contributors (HLT)",200,0,200);
226   }
227  
228   fXYvertexOff = new TH2F("fXYvertex_off","XY primary vertex (OFF)",100,-1,1,100,-1,1);
229   fXYvertexHLT = new TH2F("fXYvertex_hlt","XY primary vertex (HLT)",100,-1,1,100,-1,1);
230   
231   fXvertexOff = new TH1F("fXvertex_off","X primary vertex (OFF)",200,-0.5,0.5);
232   fXvertexHLT = new TH1F("fXvertex_hlt","X primary vertex (HLT)",200,-0.5,0.5);
233  
234   fYvertexOff = new TH1F("fYvertex_off","Y primary vertex (OFF)",200,-0.5,0.5);
235   fYvertexHLT = new TH1F("fYvertex_hlt","Y primary vertex (HLT)",200,-0.5,0.5);
236  
237   fZvertexOff = new TH1F("fZvertex_off","Z primary vertex (OFF)",100,-20,20);
238   fZvertexHLT = new TH1F("fZvertex_hlt","Z primary vertex (HLT)",100,-20,20);
239
240   fSPDXvertexOff = new TH1F("fSPDXvertex_off","X SPD primary vertex (OFF)",200,-0.5,0.5);
241   fSPDXvertexHLT = new TH1F("fSPDXvertex_hlt","X SPD primary vertex (HLT)",200,-0.5,0.5);
242  
243   fSPDYvertexOff = new TH1F("fSPDYvertex_off","Y SPD primary vertex (OFF)",200,-0.5,0.5);
244   fSPDYvertexHLT = new TH1F("fSPDYvertex_hlt","Y SPD primary vertex (HLT)",200,-0.5,0.5);
245  
246   fSPDZvertexOff = new TH1F("fSPDZvertex_off","Z SPD primary vertex (OFF)",100,-20,20);
247   fSPDZvertexHLT = new TH1F("fSPDZvertex_hlt","Z SPD primary vertex (HLT)",100,-20,20);
248     
249   fEventSpecieOff = new TH1F("fEventSpecie_off","Eventspecie for OFF",18, 0, 18);
250   fEventSpecieHLT = new TH1F("fEventSpecie_hlt","Eventspecie for HLT",18, 0, 18);
251
252   //============== track properties =================//
253
254   fChargeOff = new TH1F("fCharge_off", "Charge distribution (OFF)", 3, -1.5, 1.5);  
255   fChargeHLT = new TH1F("fCharge_hlt", "Charge distribution (HLT)", 3, -1.5, 1.5);  
256   
257   fMomentumOff = new TH1F("fMomentum_off", "p_{T} (OFF)", 100, 0, 10);
258   fMomentumHLT = new TH1F("fMomentum_hlt", "p_{T} (HLT)", 100, 0, 10);
259  
260   fDCArOff = new TH1F("fDCAr_off", "DCAr to beam line (OFF)", 200, -15, 15);
261   fDCArHLT = new TH1F("fDCAr_hlt", "DCAr to beam line (HLT)", 200, -15, 15);
262
263   fDCAzOff = new TH1F("fDCAz_off", "DCAz to beam line (OFF)", 200, -15, 15);
264   fDCAzHLT = new TH1F("fDCAz_hlt", "DCAz to beam line (HLT)", 200, -15, 15);
265  
266   fNclusterOff = new TH1F("fNcluster_off","TPC clusters/track (OFF)", 200, 0, 200);
267   fNclusterHLT = new TH1F("fNcluster_hlt","TPC clusters/track (HLT)", 200, 0, 200);
268
269   fNITSclusterOff = new TH1F("fNITScluster_off","ITS clusters/track (OFF)", 10, 0, 10);
270   fNITSclusterHLT = new TH1F("fNITScluster_hlt","ITS clusters/track (HLT)", 10, 0, 10);
271  
272   fPhiOff = new TH1F("fPhi_off","azimuthal angle distribution (OFF)",90,0,360);
273   fPhiHLT = new TH1F("fPhi_hlt","azimuthal angle distribution (HLT)",    90,0,360);
274
275   fEtaOff = new TH1F("fEta_off","pseudorapidity (OFF)",100,-2,2);
276   fEtaHLT = new TH1F("fEta_hlt","pseudorapidity (HLT)",100,-2,2);
277
278
279  
280   fNclusterOffwCut = new TH1F("fNcluster_wcut_off","TPC clusters per track with cuts (OFF)", 200, 0, 200);
281   fNclusterHLTwCut = new TH1F("fNcluster_wcut_hlt","TPC clusters per track with cuts (HLT)", 200, 0, 200);
282
283   fEtaMomentumcutOff = new TH1F("fEtaMomentumcut_off","pseudorapidity DCAcut (OFF)",100,-2,2);
284   fEtaMomentumcutHLT = new TH1F("fEtaMomentumcut_hlt","pseudorapidity DCAcut (HLT)",    100,-2,2);
285
286   fNclusVSphiOff = new TH2F("fNclus_vs_phi_off","clusters per track vs. #phi (OFF)",360,0,360,160,0,160);
287   fNclusVSphiHLT = new TH2F("fNclus_vs_phi_hlt","clusters per track vs. #phi (HLT)",    360,0,360,160,0,160);
288   
289   fNclusVSthetaOff = new TH2F("fNclus_vs_theta_off","clusters per track vs. #theta (OFF)",180,0,180,160,0,160);
290   fNclusVSthetaHLT = new TH2F("fNclus_vs_theta_hlt","clusters per track vs. #theta (HLT)",    180,0,180,160,0,160);
291  
292   //--------------------------------------------------//
293   
294   fTextBox = new TText(); 
295
296   fOutputList->Add(fHistTrigger);
297
298   fOutputList->Add(fChargeOff);           fOutputList->Add(fChargeHLT);  
299   fOutputList->Add(fMomentumOff);         fOutputList->Add(fMomentumHLT); 
300   fOutputList->Add(fDCArOff);             fOutputList->Add(fDCArHLT);     
301   fOutputList->Add(fDCAzOff);             fOutputList->Add(fDCAzHLT);     
302   fOutputList->Add(fNclusterOff);         fOutputList->Add(fNclusterHLT); 
303   fOutputList->Add(fNITSclusterOff);      fOutputList->Add(fNITSclusterHLT); 
304   fOutputList->Add(fNclusterOffwCut);     fOutputList->Add(fNclusterHLTwCut); 
305   fOutputList->Add(fPhiOff);              fOutputList->Add(fPhiHLT);      
306   fOutputList->Add(fMultOff);             fOutputList->Add(fMultHLT);    
307   fOutputList->Add(fXYvertexOff);         fOutputList->Add(fXYvertexHLT); 
308   fOutputList->Add(fXvertexOff);          fOutputList->Add(fXvertexHLT);  
309   fOutputList->Add(fYvertexOff);          fOutputList->Add(fYvertexHLT);  
310   fOutputList->Add(fZvertexOff);          fOutputList->Add(fZvertexHLT);    
311   fOutputList->Add(fSPDXvertexOff);       fOutputList->Add(fSPDXvertexHLT);  
312   fOutputList->Add(fSPDYvertexOff);       fOutputList->Add(fSPDYvertexHLT);  
313   fOutputList->Add(fSPDZvertexOff);       fOutputList->Add(fSPDZvertexHLT);    
314   fOutputList->Add(fEtaOff);              fOutputList->Add(fEtaHLT);  
315   fOutputList->Add(fEtaMomentumcutOff);   fOutputList->Add(fEtaMomentumcutHLT);   
316   fOutputList->Add(fNclusVSphiOff);       fOutputList->Add(fNclusVSphiHLT);  
317   fOutputList->Add(fNclusVSthetaOff);     fOutputList->Add(fNclusVSthetaHLT);
318   fOutputList->Add(fEventSpecieOff);      fOutputList->Add(fEventSpecieHLT);  
319   fOutputList->Add(fNcontOff);            fOutputList->Add(fNcontHLT);  
320   
321   fOutputList->Add(fTextBox);
322   if(fBeamType.Contains("Pb")) fOutputList->Add(fV0cent);
323  
324   //SetupESDtrackCuts();
325   PostData(1, fOutputList);
326 }
327
328 void AliAnalysisTaskHLT::UserExec(Option_t *){
329   // see header file of AliAnalysisTask for documentation
330
331   AliESDEvent *esdOFF = dynamic_cast<AliESDEvent*>(InputEvent());  
332   if(!esdOFF){
333      printf("Error:UserExec OFF esd not available\n");
334      return;
335   }
336  
337   if(esdOFF->GetEventSpecie()==16) return; // skip calibration events, HLT doesn't set this flag yet
338
339   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>(fInputHandler);
340   if(!esdH){
341      printf("The ESD input handler is empty\n");
342      return;
343   }
344   
345   AliESDEvent *esdHLT = NULL;   
346   if(esdH) esdHLT = esdH->GetHLTEvent();   
347   if(!esdHLT){
348      printf("Error:UserExec HLT esd not available\n");
349      return;
350   }
351  
352   if(fSwitch==kTRUE){  
353      TTimeStamp *timestamp = new TTimeStamp(esdHLT->GetTimeStamp());
354      fTextBox->SetName("text");
355      TString s = Form("Run %d, Date %d", esdHLT->GetRunNumber(), timestamp->GetDate());
356      printf("You are analyzing run %d from date %d\n\n", esdHLT->GetRunNumber(), timestamp->GetDate());
357      fTextBox->SetTitle(s);
358      fSwitch=kFALSE;
359   }
360
361   Double_t bfield = esdOFF->GetMagneticField();
362  
363 //   UInt_t Statusnames[12]={AliESDtrack::kTPCin,
364 //                        AliESDtrack::kITSin,
365 //                        AliESDtrack::kTPCout,
366 //                        AliESDtrack::kITSout,
367 //                        AliESDtrack::kITSrefit,
368 //                        AliESDtrack::kTPCrefit,
369 //                        AliESDtrack::kTRDin,
370 //                        AliESDtrack::kTRDout,
371 //                        AliESDtrack::kTRDrefit,
372 //                        AliESDtrack::kTOFin,
373 //                        AliESDtrack::kTOFout,
374 //                        AliESDtrack::kTOFrefit};
375   
376
377
378   //---------------- HLT ESD tree -----------------------//
379
380   Int_t nr_tracksHLT = 0;        
381   const AliESDVertex *vertHLT = esdHLT->GetPrimaryVertexTracks();
382
383
384   if(vertHLT->GetStatus()==kTRUE){
385     fXYvertexHLT->Fill(vertHLT->GetX(), vertHLT->GetY() );
386     fXvertexHLT->Fill( vertHLT->GetX() );
387     fYvertexHLT->Fill( vertHLT->GetY() );
388     fZvertexHLT->Fill( vertHLT->GetZ() );
389     
390     fSPDXvertexHLT->Fill(esdHLT->GetPrimaryVertexSPD()->GetX());
391     fSPDYvertexHLT->Fill(esdHLT->GetPrimaryVertexSPD()->GetY());
392     fSPDZvertexHLT->Fill(esdHLT->GetPrimaryVertexSPD()->GetZ());
393     
394     fNcontHLT->Fill(vertHLT->GetNContributors());
395   }
396   //At the moment no constrains on vertex before filling histograms
397   //Should be changed. 
398
399   fEventSpecieHLT->Fill(esdHLT->GetEventSpecie());
400
401   for(Int_t i=0; i<esdHLT->GetNumberOfTracks(); i++){ 
402   
403     AliESDtrack *esdtrackHLT = esdHLT->GetTrack(i); 
404     if(!esdtrackHLT) continue;
405
406     //Fill which status flags that are set for an event
407     //for(int jjj=0;jjj<12;jjj++){
408     //  if(esdtrackHLT->GetStatus()&Statusnames[jjj]) fStatusHLT->Fill(jjj);
409     //} 
410
411     if(!(esdtrackHLT->GetStatus()&AliESDtrack::kTPCin)) continue; // only interested in tracks with kTPCin flag
412     if(esdtrackHLT->GetTPCNcls()<=0) continue; 
413     nr_tracksHLT++;
414  
415     //Calculating DCA "old" fashion
416     Float_t dca[2];
417     esdtrackHLT->GetDZ(esdHLT->GetPrimaryVertex()->GetXv(), esdHLT->GetPrimaryVertex()->GetYv(), esdHLT->GetPrimaryVertex()->GetZv(), bfield, dca);
418
419     fDCArHLT->Fill(dca[0]);  
420     fDCAzHLT->Fill(dca[1]);
421     
422     fChargeHLT->Fill(esdtrackHLT->Charge());
423     fNclusterHLT->Fill(esdtrackHLT->GetTPCNcls());
424     fNITSclusterHLT->Fill(esdtrackHLT->GetNcls(0));
425     fEtaHLT->Fill(esdtrackHLT->Eta()); 
426     fPhiHLT->Fill(esdtrackHLT->Phi()*TMath::RadToDeg());
427     fMomentumHLT->Fill(TMath::Abs(esdtrackHLT->Pt()));  
428   } // end of loop over hlt tracks
429
430   if(nr_tracksHLT>0) fMultHLT->Fill(nr_tracksHLT);
431
432   //----------------- OFFLINE ESD tree ----------------//
433   
434   Int_t nr_tracksOff = 0;
435   const AliESDVertex *vertOFF = esdOFF->GetPrimaryVertexTracks();
436    
437   if(fBeamType.Contains("Pb")){
438      fCentrality = esdOFF->GetCentrality(); 
439      // this information is only available from the offline ESD for 2010 PbPb data, the V0 info was not stored in the HLTesd (17.04.11, Kelly)
440      if(!fCentrality){
441         printf("Centrality pointer is empty\n");
442         return;
443      }
444      else fV0cent->Fill(fCentrality->GetCentralityPercentile("V0M"));
445   }
446   
447   if(vertOFF->GetStatus()==kTRUE){
448     fXYvertexOff->Fill(vertOFF->GetX(), vertOFF->GetY() );
449     fXvertexOff->Fill( vertOFF->GetX() );
450     fYvertexOff->Fill( vertOFF->GetY() );
451     fZvertexOff->Fill( vertOFF->GetZ() );
452   
453     fSPDXvertexOff->Fill(esdOFF->GetPrimaryVertexSPD()->GetX());
454     fSPDYvertexOff->Fill(esdOFF->GetPrimaryVertexSPD()->GetY());
455     fSPDZvertexOff->Fill(esdOFF->GetPrimaryVertexSPD()->GetZ());
456    
457     fNcontOff->Fill(vertOFF->GetNContributors());
458   }
459
460   fEventSpecieOff->Fill(esdOFF->GetEventSpecie());
461
462   for(Int_t i=0; i<esdOFF->GetNumberOfTracks(); i++){ 
463    
464     AliESDtrack *esdtrackOFF = esdOFF->GetTrack(i); 
465     if (!esdtrackOFF) continue;
466
467     if(!(esdtrackOFF->GetStatus()&AliESDtrack::kTPCin)) continue; 
468     if(esdtrackOFF->GetTPCNcls()<=0) continue; 
469     nr_tracksOff++;
470
471     Double_t x[3]; 
472     esdtrackOFF->GetXYZ(x);
473     Double_t b[3]; 
474     AliTracker::GetBxByBz(x,b);
475     Bool_t isOK = esdtrackOFF->RelateToVertexTPCBxByBz(vertOFF, b, kVeryBig);
476     if(!isOK) return;
477     
478     const AliExternalTrackParam *track = esdtrackOFF->GetTPCInnerParam();
479     if(!track) return;
480     
481     Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
482     esdtrackOFF->GetImpactParametersTPC(dca,cov);
483
484     fDCArOff->Fill(dca[0]);
485     fDCAzOff->Fill(dca[1]);
486     
487     fChargeOff->Fill(esdtrackOFF->Charge());
488     fNclusterOff->Fill(esdtrackOFF->GetTPCNcls()); 
489     fNITSclusterOff->Fill(esdtrackOFF->GetNcls(0)); 
490     fEtaOff->Fill(esdtrackOFF->Eta());          
491     fPhiOff->Fill(esdtrackOFF->Phi()*TMath::RadToDeg());
492     fMomentumOff->Fill( TMath::Abs(esdtrackOFF->Pt()) ); 
493
494   } // end of loop over offline tracks
495   
496   if(nr_tracksOff>0) fMultOff->Fill(nr_tracksOff);
497    
498   PostData(1, fOutputList);
499 }
500
501 void AliAnalysisTaskHLT::Terminate(Option_t *){
502 // see header file of AliAnalysisTask for documentation
503 }
504
505 // void AliAnalysisTaskHLT::SetupESDtrackCuts(){ // not called
506 //   // Setup ESD cuts
507 //   // NB! Work in progress!
508 // 
509 //   Bool_t selPrimaries = kTRUE;
510 //   
511 //   fESDOfftrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selPrimaries);
512 //   //To make Offline cuts = HLT cuts
513 //   fESDOfftrackCuts->SetRequireITSRefit(kFALSE); 
514 //   fESDOfftrackCuts->SetEtaRange(-0.9,+0.9);
515 //   
516 // 
517 //   //HLT
518 //   //NB! Need to understand this a bit more! Which cuts should we keep?
519 //   fESDHLTtrackCuts = new AliESDtrackCuts;
520 // 
521 //   // TPC  
522 //   fESDHLTtrackCuts->SetRequireTPCStandAlone(kTRUE); // to get chi2 and ncls of kTPCin
523 //   fESDHLTtrackCuts->SetMinNClustersTPC(70);
524 //   fESDHLTtrackCuts->SetMaxChi2PerClusterTPC(4);
525 //   fESDHLTtrackCuts->SetAcceptKinkDaughters(kFALSE);
526 // 
527 //   fESDHLTtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
528 //                                   AliESDtrackCuts::kAny);
529 // 
530 //   if(selPrimaries) { // 7*(0.0050+0.0060/pt^0.9)
531 //     fESDHLTtrackCuts->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9");
532 //   }
533 //   
534 //   fESDHLTtrackCuts->SetMaxDCAToVertexZ(1.e6);
535 //   fESDHLTtrackCuts->SetDCAToVertex2D(kFALSE);
536 //   fESDHLTtrackCuts->SetRequireSigmaToVertex(kFALSE);
537 //   fESDHLTtrackCuts->SetEtaRange(-0.9,+0.9);
538 // 
539 //   return;
540 // }