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