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 **************************************************************************/
20 // Using AliHFEpidQA and AliHFEMCpidQA
23 // Matus Kalisky <matus.kalisky@cern.ch>
24 // Markus Heide <mheide@uni-muenster.de>
25 // Markus Fasel <M.Fasel@gsi.de>
31 #include "AliAnalysisManager.h"
32 #include "AliMCEventHandler.h"
33 #include "AliHFEpidQA.h"
34 #include "AliHFEtools.h"
35 #include "AliESDInputHandler.h"
37 #include "AliHFEtrdPIDqa.h"
39 #include "AliAnalysisTaskHFEpidQA.h"
41 ClassImp(AliAnalysisTaskHFEpidQA)
43 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA():
44 AliAnalysisTaskSE("pidQAtask")
51 // Default Constructor
55 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name):
56 AliAnalysisTaskSE(name)
63 // Default Constructor
65 DefineOutput(1, TList::Class());
69 AliAnalysisTaskHFEpidQA::~AliAnalysisTaskHFEpidQA(){
73 if(fPIDqa) delete fPIDqa;
74 if(fOutput) delete fOutput;
77 void AliAnalysisTaskHFEpidQA::UserCreateOutputObjects(){
84 // Counter for number of events
85 fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2)));
87 fPIDqa = new AliHFEpidQA;
88 if(HasV0pidQA()) fPIDqa->SetV0pidQA();
89 if(HasRecalculateTRDpid()) fPIDqa->SetRecalculateTRDpid();
90 if(fNNref) fPIDqa->SetNNref(fNNref);
93 TList *tmp = fPIDqa->GetOutput();
94 tmp->SetName("PIDqa");
97 tmp = fPIDqa->GetV0pidQA();
98 tmp->SetName("V0pidQA");
102 tmp = fPIDqa->GetV0pidMC();
104 tmp->SetName("V0pidMC");
108 // Add TRD PID QA object to the output
109 fOutput->Add(fPIDqa->GetTRDQA());
112 Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){
115 //printf(" -D Current File Name: %s \n", CurrentFileName());
116 return AliAnalysisTask::Notify();
119 void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){
123 AliMCEventHandler* mcHandler = (dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()));
124 AliESDInputHandler *inh = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
125 AliESDpid *workingPID = NULL;
126 if(inh && (workingPID = inh->GetESDpid()))
127 fPIDqa->SetESDpid(workingPID);
128 else fPIDqa->SetESDpid(AliHFEtools::GetDefaultPID(mcHandler ? kTRUE : kFALSE));
131 if(fMCEvent && !mcHandler ) return;
132 if(fMCEvent && !mcHandler->InitOk() ) return;
133 if(fMCEvent && !mcHandler->TreeK() ) return;
134 if(fMCEvent && !mcHandler->TreeTR() ) return;
135 if(fMCEvent) fPIDqa->SetMCEvent(fMCEvent);
137 fPIDqa->SetEvent(fInputEvent);
140 PostData(1, fOutput);
143 void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){
145 // Do Post Processing