]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliAnalysisTaskHFEpidQA.cxx
Fixes to cure warnings
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliAnalysisTaskHFEpidQA.cxx
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>
26
27 #include "AliAnalysisManager.h"
28 #include "AliMCEventHandler.h"
29 #include "AliLog.h"
30 #include "AliAnalysisTaskHFEpidQA.h"
31 #include "AliHFEpidQA.h"
32 #include "AliESDEvent.h"
33 #include "AliMCEvent.h"
34
35 ClassImp(AliAnalysisTaskHFEpidQA)
36
37 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA():
38     AliAnalysisTaskSE("pidQAtask")
39   , fPIDqa(NULL)
40   , fOutput(NULL)
41   , fEvents(NULL)
42 {
43   //
44   // Default Constructor
45   //
46   DefineOutput(1, TList::Class());
47 }
48
49 AliAnalysisTaskHFEpidQA::AliAnalysisTaskHFEpidQA(const Char_t *name):
50     AliAnalysisTaskSE(name)
51   , fPIDqa(NULL)
52   , fOutput(NULL)
53   , fEvents(NULL)
54 {
55   //
56   // Default Constructor
57   //
58   DefineOutput(1, TList::Class());
59 }
60
61 AliAnalysisTaskHFEpidQA::~AliAnalysisTaskHFEpidQA(){
62   //
63   // Destructor
64   //
65   if(fPIDqa) delete fPIDqa;
66   if(fOutput) delete fOutput;
67 }
68
69 void AliAnalysisTaskHFEpidQA::UserCreateOutputObjects(){
70   //
71   // Create the output
72   // Initialize PID QA
73   //
74   fOutput = new TList;
75
76   // Counter for number of events
77   fOutput->Add((fEvents = new TH1I("nEvents", "NumberOfEvents", 1, 1, 2)));
78
79   fPIDqa = new AliHFEpidQA;
80   if(HasV0pidQA()) fPIDqa->SetV0pidQA();
81   if(HasRecalculateTRDpid()) fPIDqa->SetRecalculateTRDpid();
82   fPIDqa->Init();
83
84   TList *tmp = fPIDqa->GetOutput();
85   tmp->SetName("PIDqa");
86   fOutput->Add(tmp);
87   if(HasV0pidQA()){
88     tmp = fPIDqa->GetV0pidQA();
89     tmp->SetName("V0pidQA");
90     fOutput->Add(tmp);
91   }
92   tmp = 0x0;
93   tmp = fPIDqa->GetV0pidMC();
94   if(tmp){
95     tmp->SetName("V0pidMC");
96     fOutput->Add(tmp);
97   }
98
99   
100 }
101 Bool_t AliAnalysisTaskHFEpidQA::UserNotify(){
102    // DEBUG
103   //printf("*****\n");
104   //printf(" -D Current File Name: %s \n", CurrentFileName());
105   return AliAnalysisTask::Notify();
106
107 }
108
109 void AliAnalysisTaskHFEpidQA::UserExec(Option_t *){
110   //
111   // Event Loop
112   // 
113   AliMCEventHandler* mcHandler = (dynamic_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()));
114   // check the MC data
115   if(fMCEvent && !mcHandler ) return;
116   if(fMCEvent &&  !mcHandler->InitOk() ) return;
117   if(fMCEvent &&  !mcHandler->TreeK() ) return;
118   if(fMCEvent &&  !mcHandler->TreeTR() ) return;
119   if(fMCEvent) fPIDqa->SetMCEvent(fMCEvent);
120   fPIDqa->SetRun((dynamic_cast<AliESDEvent*>(fInputEvent))->GetRunNumber());
121   fPIDqa->SetT0((dynamic_cast<AliESDEvent*>(fInputEvent))->GetT0());
122   fPIDqa->Process(fInputEvent);
123   fEvents->Fill(1.1);
124   PostData(1, fOutput);
125 }
126
127 void AliAnalysisTaskHFEpidQA::Terminate(Option_t *){
128   //
129   // Do Post Processing
130   //
131 }
132
133