Add PHOSTender for AOD
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / AliPHOSTenderTask.cxx
1 // Task to hold TenderSupply in case of running on AOD.
2 // 
3 // Author: D.Peressounko after EMCAL Tender task
4
5 #include <TChain.h>
6 #include <TFile.h>
7
8 #include "AliAnalysisManager.h"
9 #include "TenderSupplies/AliPHOSTenderSupply.h"
10 #include "AliAODEvent.h"
11
12 #include "AliPHOSTenderTask.h"
13
14 ClassImp(AliPHOSTenderTask)
15
16 //______________________________________________________________________________
17 AliPHOSTenderTask::AliPHOSTenderTask():
18   AliAnalysisTaskSE(),
19   fPHOSTender(NULL)
20 {
21   // Default constructor.
22 }
23
24 //______________________________________________________________________________
25 AliPHOSTenderTask::AliPHOSTenderTask(const char* name):
26   AliAnalysisTaskSE(name),
27   fPHOSTender(NULL)
28 {
29   // Constructor.
30   DefineOutput(1,  AliAODEvent::Class());
31 }
32
33 //______________________________________________________________________________
34 AliPHOSTenderTask::~AliPHOSTenderTask()
35 {
36   // Destructor
37
38   if (fPHOSTender)
39     fPHOSTender->Delete();
40 }
41
42 //______________________________________________________________________________
43 void AliPHOSTenderTask::SetPHOSTenderSupply(AliPHOSTenderSupply *supply)
44 {
45   // Set tender supply.
46
47   fPHOSTender = supply;
48   supply->SetTask(this);
49 }
50    
51 //______________________________________________________________________________
52 void AliPHOSTenderTask::ConnectInputData(Option_t *option)
53 {
54   // Connect input data.
55
56   AliAnalysisTaskSE::ConnectInputData(option);
57   fPHOSTender->Init();
58 }
59
60 //______________________________________________________________________________
61 void AliPHOSTenderTask::UserCreateOutputObjects()
62 {
63   // Nothing to be done.
64 }
65
66 //______________________________________________________________________________
67 void AliPHOSTenderTask::UserExec(Option_t*)
68 {
69   // Process the event.
70
71   fPHOSTender->ProcessEvent();
72 }
73 //______________________________________________________________________________
74 void AliPHOSTenderTask::NotifyRun(){
75  //Change of the run number 
76   
77  fPHOSTender->InitTender(); 
78 }