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")
48 // Default Constructor
52 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name):
53 AliAnalysisTaskSE(name)
60 // Default Constructor
62 DefineOutput(1, TList::Class());
66 AliAnalysisTaskHFEpidQA::~AliAnalysisTaskHFEpidQA(){
70 if(fPIDqa) delete fPIDqa;
71 if(fOutput) delete fOutput;
74 void AliAnalysisTaskHFEpidQA::UserCreateOutputObjects(){
81 // Counter for number of events
82 fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2)));
84 fPIDqa = new AliHFEpidQA;
85 if(HasV0pidQA()) fPIDqa->SetV0pidQA();
86 if(HasRecalculateTRDpid()) fPIDqa->SetRecalculateTRDpid();
87 if(fNNref) fPIDqa->SetNNref(fNNref);
90 TList *tmp = fPIDqa->GetOutput();
91 tmp->SetName("PIDqa");
94 tmp = fPIDqa->GetV0pidQA();
95 tmp->SetName("V0pidQA");
99 tmp = fPIDqa->GetV0pidMC();
101 tmp->SetName("V0pidMC");
105 // Add TRD PID QA object to the output
106 fOutput->Add(fPIDqa->GetTRDQA());
109 Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){
112 //printf(" -D Current File Name: %s \n", CurrentFileName());
113 return AliAnalysisTask::Notify();
116 void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){
120 AliMCEventHandler* mcHandler = (dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()));
121 AliESDInputHandler *inh = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
122 AliESDpid *workingPID = NULL;
123 if(inh && (workingPID = inh->GetESDpid()))
124 fPIDqa->SetESDpid(workingPID);
125 else fPIDqa->SetESDpid(AliHFEtools::GetDefaultPID(mcHandler ? kTRUE : kFALSE));
128 if(fMCEvent && !mcHandler ) return;
129 if(fMCEvent && !mcHandler->InitOk() ) return;
130 if(fMCEvent && !mcHandler->TreeK() ) return;
131 if(fMCEvent && !mcHandler->TreeTR() ) return;
132 if(fMCEvent) fPIDqa->SetMCEvent(fMCEvent);
134 fPIDqa->SetEvent(fInputEvent);
137 PostData(1, fOutput);
140 void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){
142 // Do Post Processing