]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/AliAnalysisTaskDxHFEParticleSelection.cxx
Code skeleton for D0-electron correlations (Matthias)
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / AliAnalysisTaskDxHFEParticleSelection.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE Project            * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //*                                                                        *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
8 //*                  Sedat Altinpinar <Sedat.Altinpinar@cern.ch>           *
9 //*                  Hege Erdal       <hege.erdal@gmail.com>               *
10 //*                                                                        *
11 //* Permission to use, copy, modify and distribute this software and its   *
12 //* documentation strictly for non-commercial purposes is hereby granted   *
13 //* without fee, provided that the above copyright notice appears in all   *
14 //* copies and that both the copyright notice and this permission notice   *
15 //* appear in the supporting documentation. The authors make no claims     *
16 //* about the suitability of this software for any purpose. It is          *
17 //* provided "as is" without express or implied warranty.                  *
18 //**************************************************************************
19
20 /// @file   AliAnalysisTaskDxHFEParticleSelection.cxx
21 /// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
22 /// @date   2012-03-19
23 /// @brief  AnalysisTask electron selection for D0 - HFE correlation
24 ///
25
26 #include "AliAnalysisTaskDxHFEParticleSelection.h"
27 #include "AliDxHFEParticleSelection.h"
28 #include "AliAnalysisManager.h"
29 #include "AliLog.h"
30 #include "AliESDInputHandler.h"
31 #include "TChain.h"
32 #include "TSystem.h"
33 #include "TFile.h"
34
35 /// ROOT macro for the implementation of ROOT specific class methods
36 ClassImp(AliAnalysisTaskDxHFEParticleSelection)
37
38 AliAnalysisTaskDxHFEParticleSelection::AliAnalysisTaskDxHFEParticleSelection(const char* opt)
39   : AliAnalysisTaskSE("AliAnalysisTaskDxHFEParticleSelection")
40   , fOutput(0)
41   , fOption(opt)
42   , fSelector(NULL)
43 {
44   // constructor
45   //
46   //
47
48   DefineSlots();
49 }
50
51 int AliAnalysisTaskDxHFEParticleSelection::DefineSlots()
52 {
53   // define the data slots
54   DefineInput(0, TChain::Class());
55   DefineOutput(1, TList::Class());
56   return 0;
57 }
58
59 AliAnalysisTaskDxHFEParticleSelection::~AliAnalysisTaskDxHFEParticleSelection()
60 {
61   // destructor
62   //
63   //
64
65   // histograms are in the output list and deleted when the output
66   // list is deleted by the TSelector dtor
67
68   if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
69     delete fOutput;
70     fOutput = 0;
71   }
72
73   if (fSelector) {
74     fSelector->Clear();
75     delete fSelector;
76     fSelector=NULL;
77   }
78 }
79
80 void AliAnalysisTaskDxHFEParticleSelection::UserCreateOutputObjects()
81 {
82   // create result objects and add to output list
83
84   fOutput = new TList;
85   fOutput->SetOwner();
86   
87   // all tasks must post data once for all outputs
88   PostData(1, fOutput);
89 }
90
91 void AliAnalysisTaskDxHFEParticleSelection::UserExec(Option_t* /*option*/)
92 {
93   // process the event
94
95   // TODO: implement correct input, this is likely not to be the
96   // ESD
97   TObject* pInput=InputEvent();
98   if (!pInput) {
99     AliError("failed to get input");
100     return;
101   }
102   AliVEvent *pEvent = dynamic_cast<AliVEvent*>(pInput);
103   if(!pEvent){
104     AliError(Form("input of wrong class type %s, expecting AliVEvent", pInput->ClassName()));
105     return;
106   }
107
108   PostData(1, fOutput);
109 }
110
111 void AliAnalysisTaskDxHFEParticleSelection::FinishTaskOutput()
112 {
113   // end of the processing
114 }
115
116 void AliAnalysisTaskDxHFEParticleSelection::Terminate(Option_t *)
117 {
118   // last action on the client
119   fOutput = dynamic_cast<TList*> (GetOutputData(1));
120   if (!fOutput) {
121     AliFatal("failed to get output container");
122     return;
123   }
124
125 }