]>
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 | **************************************************************************/ | |
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 | |
38 | ClassImp(AliAnalysisTaskHFEpidQA) | |
39 | ||
40 | AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(): | |
faee3b18 | 41 | AliAnalysisTaskSE("pidQAtask") |
70da6c5a | 42 | , fPIDqa(NULL) |
43 | , fOutput(NULL) | |
44 | , fEvents(NULL) | |
faee3b18 | 45 | , fNNref(NULL) |
70da6c5a | 46 | { |
47 | // | |
48 | // Default Constructor | |
49 | // | |
70da6c5a | 50 | } |
51 | ||
52 | AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name): | |
faee3b18 | 53 | AliAnalysisTaskSE(name) |
70da6c5a | 54 | , fPIDqa(NULL) |
55 | , fOutput(NULL) | |
56 | , fEvents(NULL) | |
faee3b18 | 57 | , fNNref(NULL) |
70da6c5a | 58 | { |
59 | // | |
60 | // Default Constructor | |
61 | // | |
62 | DefineOutput(1, TList::Class()); | |
faee3b18 | 63 | |
70da6c5a | 64 | } |
65 | ||
66 | AliAnalysisTaskHFEpidQA::~AliAnalysisTaskHFEpidQA(){ | |
67 | // | |
68 | // Destructor | |
69 | // | |
70 | if(fPIDqa) delete fPIDqa; | |
71 | if(fOutput) delete fOutput; | |
72 | } | |
73 | ||
74 | void AliAnalysisTaskHFEpidQA::UserCreateOutputObjects(){ | |
75 | // | |
76 | // Create the output | |
77 | // Initialize PID QA | |
78 | // | |
79 | fOutput = new TList; | |
80 | ||
81 | // Counter for number of events | |
82 | fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2))); | |
83 | ||
84 | fPIDqa = new AliHFEpidQA; | |
85 | if(HasV0pidQA()) fPIDqa->SetV0pidQA(); | |
86 | if(HasRecalculateTRDpid()) fPIDqa->SetRecalculateTRDpid(); | |
faee3b18 | 87 | if(fNNref) fPIDqa->SetNNref(fNNref); |
70da6c5a | 88 | fPIDqa->Init(); |
89 | ||
90 | TList *tmp = fPIDqa->GetOutput(); | |
91 | tmp->SetName("PIDqa"); | |
92 | fOutput->Add(tmp); | |
93 | if(HasV0pidQA()){ | |
94 | tmp = fPIDqa->GetV0pidQA(); | |
95 | tmp->SetName("V0pidQA"); | |
96 | fOutput->Add(tmp); | |
97 | } | |
98 | tmp = 0x0; | |
99 | tmp = fPIDqa->GetV0pidMC(); | |
100 | if(tmp){ | |
101 | tmp->SetName("V0pidMC"); | |
102 | fOutput->Add(tmp); | |
103 | } | |
91c7e1ec | 104 | |
faee3b18 | 105 | // Add TRD PID QA object to the output |
106 | fOutput->Add(fPIDqa->GetTRDQA()); | |
91c7e1ec | 107 | } |
faee3b18 | 108 | |
91c7e1ec | 109 | Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){ |
faee3b18 | 110 | // DEBUG |
91c7e1ec | 111 | //printf("*****\n"); |
112 | //printf(" -D Current File Name: %s \n", CurrentFileName()); | |
113 | return AliAnalysisTask::Notify(); | |
70da6c5a | 114 | } |
115 | ||
116 | void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){ | |
117 | // | |
118 | // Event Loop | |
91c7e1ec | 119 | // |
120 | AliMCEventHandler* mcHandler = (dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())); | |
faee3b18 | 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)); | |
126 | ||
91c7e1ec | 127 | // check the MC data |
128 | if(fMCEvent && !mcHandler ) return; | |
129 | if(fMCEvent && !mcHandler->InitOk() ) return; | |
130 | if(fMCEvent && !mcHandler->TreeK() ) return; | |
131 | if(fMCEvent && !mcHandler->TreeTR() ) return; | |
70da6c5a | 132 | if(fMCEvent) fPIDqa->SetMCEvent(fMCEvent); |
faee3b18 | 133 | |
134 | fPIDqa->SetEvent(fInputEvent); | |
135 | fPIDqa->Process(); | |
70da6c5a | 136 | fEvents->Fill(1.1); |
137 | PostData(1, fOutput); | |
138 | } | |
139 | ||
140 | void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){ | |
141 | // | |
142 | // Do Post Processing | |
143 | // | |
144 | } | |
145 | ||
91c7e1ec | 146 |