]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWGHF/hfe/AliAnalysisTaskHFEpidQA.cxx
Fix of sigmaZ for crossing tracklets from Alex
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskHFEpidQA.cxx
... / ...
CommitLineData
1/**************************************************************************
2* Copyright(c) 1998-1999, 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//
16// Task for PID QA
17// Using AliHFEpidQA and AliHFEMCpidQA
18//
19// Authors
20// Matus Kalisky <matus.kalisky@cern.ch>
21// Markus Heide <mheide@uni-muenster.de>
22// Markus Fasel <M.Fasel@gsi.de>
23//
24#include <TH1I.h>
25#include <TList.h>
26#include <TFile.h>
27
28#include "AliAnalysisManager.h"
29#include "AliMCEventHandler.h"
30#include "AliHFEpidQA.h"
31#include "AliHFEtools.h"
32#include "AliESDInputHandler.h"
33
34#include "AliHFEtrdPIDqa.h"
35
36#include "AliAnalysisTaskHFEpidQA.h"
37
38ClassImp(AliAnalysisTaskHFEpidQA)
39
40AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA():
41 AliAnalysisTaskSE("pidQAtask")
42 , fPIDqa(NULL)
43 , fOutput(NULL)
44 , fEvents(NULL)
45 , fNNref(NULL)
46 , fTRDTotalChargeInSlice0(kFALSE)
47 , fIsQAPbPb(kFALSE)
48 , fIsQAppMultiBin(kFALSE)
49{
50 //
51 // Default Constructor
52 //
53}
54
55AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name):
56 AliAnalysisTaskSE(name)
57 , fPIDqa(NULL)
58 , fOutput(NULL)
59 , fEvents(NULL)
60 , fNNref(NULL)
61 , fTRDTotalChargeInSlice0(kFALSE)
62 , fIsQAPbPb(kFALSE)
63 , fIsQAppMultiBin(kFALSE)
64{
65 //
66 // Default Constructor
67 //
68 DefineOutput(1, TList::Class());
69
70}
71
72AliAnalysisTaskHFEpidQA::~AliAnalysisTaskHFEpidQA(){
73 //
74 // Destructor
75 //
76 if(fPIDqa) delete fPIDqa;
77 if(fOutput) delete fOutput;
78}
79
80void AliAnalysisTaskHFEpidQA::UserCreateOutputObjects(){
81 //
82 // Create the output
83 // Initialize PID QA
84 //
85 fOutput = new TList;
86 fOutput->SetOwner();
87
88 // Counter for number of events
89 fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2)));
90
91 fPIDqa = new AliHFEpidQA;
92 if(fTRDTotalChargeInSlice0) fPIDqa->SetTRDTotalChargeInSlice0();
93 if(HasV0pidQA()) fPIDqa->SetV0pidQA();
94 if(HasRecalculateTRDpid()) fPIDqa->SetRecalculateTRDpid();
95 if(fNNref) fPIDqa->SetNNref(fNNref);
96 if(fIsQAPbPb) fPIDqa->SetPbPb();
97 else
98 {
99 if(fIsQAppMultiBin) fPIDqa->SetPPMultiBin();
100 else fPIDqa->SetPP();
101 }
102 fPIDqa->Init();
103
104 TList *tmp = fPIDqa->GetOutput();
105 tmp->SetName("PIDqa");
106 fOutput->Add(tmp);
107 if(HasV0pidQA()){
108 tmp = fPIDqa->GetV0pidQA();
109 tmp->SetName("V0pidQA");
110 fOutput->Add(tmp);
111 }
112 tmp = 0x0;
113 tmp = fPIDqa->GetV0pidMC();
114 if(tmp){
115 tmp->SetName("V0pidMC");
116 fOutput->Add(tmp);
117 }
118
119 // Add TRD PID QA object to the output
120 fOutput->Add(fPIDqa->GetTRDQA());
121}
122
123Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){
124 // DEBUG
125 //printf("*****\n");
126 //printf(" -D Current File Name: %s \n", CurrentFileName());
127 return AliAnalysisTask::Notify();
128}
129
130void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){
131 //
132 // Event Loop
133 //
134 AliMCEventHandler* mcHandler = (dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()));
135 AliESDInputHandler *inh = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
136 AliPIDResponse *workingPID = NULL;
137 if(inh && (workingPID = inh->GetPIDResponse()))
138 fPIDqa->SetPIDResponse(workingPID);
139 else fPIDqa->SetPIDResponse(AliHFEtools::GetDefaultPID(mcHandler ? kTRUE : kFALSE, kFALSE));
140
141 // check the MC data
142 if(fMCEvent && !mcHandler ) return;
143 if(fMCEvent && !mcHandler->InitOk() ) return;
144 if(fMCEvent && !mcHandler->TreeK() ) return;
145 if(fMCEvent && !mcHandler->TreeTR() ) return;
146 if(fMCEvent) fPIDqa->SetMCEvent(fMCEvent);
147
148 fPIDqa->SetEvent(fInputEvent);
149 fPIDqa->Process();
150 fEvents->Fill(1.1);
151 PostData(1, fOutput);
152}
153
154void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){
155 //
156 // Do Post Processing
157 //
158}
159
160