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