1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // Using AliHFEpidQA and AliHFEMCpidQA
20 // Matus Kalisky <matus.kalisky@cern.ch>
21 // Markus Heide <mheide@uni-muenster.de>
22 // Markus Fasel <M.Fasel@gsi.de>
28 #include "AliAnalysisManager.h"
29 #include "AliMCEventHandler.h"
30 #include "AliHFEpidQA.h"
31 #include "AliHFEtools.h"
32 #include "AliESDInputHandler.h"
34 #include "AliHFEtrdPIDqa.h"
36 #include "AliAnalysisTaskHFEpidQA.h"
38 ClassImp(AliAnalysisTaskHFEpidQA)
40 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA():
41 AliAnalysisTaskSE("pidQAtask")
46 , fTRDTotalChargeInSlice0(kFALSE)
48 , fIsQAppMultiBin(kFALSE)
51 // Default Constructor
55 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name):
56 AliAnalysisTaskSE(name)
61 , fTRDTotalChargeInSlice0(kFALSE)
63 , fIsQAppMultiBin(kFALSE)
66 // Default Constructor
68 DefineOutput(1, TList::Class());
72 AliAnalysisTaskHFEpidQA::~AliAnalysisTaskHFEpidQA(){
76 if(fPIDqa) delete fPIDqa;
77 if(fOutput) delete fOutput;
80 void AliAnalysisTaskHFEpidQA::UserCreateOutputObjects(){
88 // Counter for number of events
89 fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2)));
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();
99 if(fIsQAppMultiBin) fPIDqa->SetPPMultiBin();
100 else fPIDqa->SetPP();
104 TList *tmp = fPIDqa->GetOutput();
105 tmp->SetName("PIDqa");
108 tmp = fPIDqa->GetV0pidQA();
109 tmp->SetName("V0pidQA");
113 tmp = fPIDqa->GetV0pidMC();
115 tmp->SetName("V0pidMC");
119 // Add TRD PID QA object to the output
120 fOutput->Add(fPIDqa->GetTRDQA());
123 Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){
126 //printf(" -D Current File Name: %s \n", CurrentFileName());
127 return AliAnalysisTask::Notify();
130 void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){
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));
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);
148 fPIDqa->SetEvent(fInputEvent);
151 PostData(1, fOutput);
154 void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){
156 // Do Post Processing