]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliAnalysisTaskHFEpidQA.cxx
add jet trigger
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskHFEpidQA.cxx
CommitLineData
70da6c5a 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>
faee3b18 26#include <TFile.h>
70da6c5a 27
91c7e1ec 28#include "AliAnalysisManager.h"
29#include "AliMCEventHandler.h"
70da6c5a 30#include "AliHFEpidQA.h"
faee3b18 31#include "AliHFEtools.h"
32#include "AliESDInputHandler.h"
33
34#include "AliHFEtrdPIDqa.h"
35
36#include "AliAnalysisTaskHFEpidQA.h"
70da6c5a 37
38ClassImp(AliAnalysisTaskHFEpidQA)
39
40AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA():
faee3b18 41 AliAnalysisTaskSE("pidQAtask")
70da6c5a 42 , fPIDqa(NULL)
43 , fOutput(NULL)
44 , fEvents(NULL)
faee3b18 45 , fNNref(NULL)
e156c3bb 46 , fTRDTotalChargeInSlice0(kFALSE)
e17c1f86 47 , fIsQAPbPb(kFALSE)
48 , fIsQAppMultiBin(kFALSE)
70da6c5a 49{
50 //
51 // Default Constructor
52 //
70da6c5a 53}
54
55AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name):
faee3b18 56 AliAnalysisTaskSE(name)
70da6c5a 57 , fPIDqa(NULL)
58 , fOutput(NULL)
59 , fEvents(NULL)
faee3b18 60 , fNNref(NULL)
e156c3bb 61 , fTRDTotalChargeInSlice0(kFALSE)
e17c1f86 62 , fIsQAPbPb(kFALSE)
63 , fIsQAppMultiBin(kFALSE)
70da6c5a 64{
65 //
66 // Default Constructor
67 //
68 DefineOutput(1, TList::Class());
faee3b18 69
70da6c5a 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;
e156c3bb 86 fOutput->SetOwner();
70da6c5a 87
88 // Counter for number of events
89 fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2)));
90
91 fPIDqa = new AliHFEpidQA;
e156c3bb 92 if(fTRDTotalChargeInSlice0) fPIDqa->SetTRDTotalChargeInSlice0();
70da6c5a 93 if(HasV0pidQA()) fPIDqa->SetV0pidQA();
94 if(HasRecalculateTRDpid()) fPIDqa->SetRecalculateTRDpid();
faee3b18 95 if(fNNref) fPIDqa->SetNNref(fNNref);
e17c1f86 96 if(fIsQAPbPb) fPIDqa->SetPbPb();
97 else
98 {
99 if(fIsQAppMultiBin) fPIDqa->SetPPMultiBin();
100 else fPIDqa->SetPP();
101 }
70da6c5a 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 }
91c7e1ec 118
faee3b18 119 // Add TRD PID QA object to the output
120 fOutput->Add(fPIDqa->GetTRDQA());
91c7e1ec 121}
faee3b18 122
91c7e1ec 123Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){
faee3b18 124 // DEBUG
91c7e1ec 125 //printf("*****\n");
126 //printf(" -D Current File Name: %s \n", CurrentFileName());
127 return AliAnalysisTask::Notify();
70da6c5a 128}
129
130void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){
131 //
132 // Event Loop
91c7e1ec 133 //
134 AliMCEventHandler* mcHandler = (dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()));
faee3b18 135 AliESDInputHandler *inh = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
8c1c76e9 136 AliPIDResponse *workingPID = NULL;
137 if(inh && (workingPID = inh->GetPIDResponse()))
138 fPIDqa->SetPIDResponse(workingPID);
139 else fPIDqa->SetPIDResponse(AliHFEtools::GetDefaultPID(mcHandler ? kTRUE : kFALSE, kFALSE));
faee3b18 140
91c7e1ec 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;
70da6c5a 146 if(fMCEvent) fPIDqa->SetMCEvent(fMCEvent);
faee3b18 147
148 fPIDqa->SetEvent(fInputEvent);
149 fPIDqa->Process();
70da6c5a 150 fEvents->Fill(1.1);
151 PostData(1, fOutput);
152}
153
154void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){
155 //
156 // Do Post Processing
157 //
158}
159
91c7e1ec 160