]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/KINK/AliAnalysisTaskKinkResonance.cxx
correction for passing arguments (P.Ganoti)
[u/mrichter/AliRoot.git] / PWG2 / KINK / AliAnalysisTaskKinkResonance.cxx
CommitLineData
f9afc48d 1/**************************************************************************
2 * Author: Paraskevi Ganoti, University of Athens (pganoti@phys.uoa.gr) *
3 * Contributors are mentioned in the code where appropriate. *
4 * *
5 * Permission to use, copy, modify and distribute this software and its *
6 * documentation strictly for non-commercial purposes is hereby granted *
7 * without fee, provided that the above copyright notice appears in all *
8 * copies and that both the copyright notice and this permission notice *
9 * appear in the supporting documentation. The authors make no claims *
10 * about the suitability of this software for any purpose. It is *
11 * provided "as is" without express or implied warranty. *
12 **************************************************************************/
13
14//----------------------------------------------------------------------------------------------------------------
15// class AliAnalysisTaskKinkResonance
16// Example of an analysis task for reconstructing resonances having at least one kaon-kink in their decay
92adf4f6 17// products.
f9afc48d 18//-----------------------------------------------------------------------------------------------------------------
894840ad 19#include "TCanvas.h"
20#include "TH1.h"
f9afc48d 21
92adf4f6 22#include "AliESDEvent.h"
f9afc48d 23#include "AliAnalysisTaskKinkResonance.h"
be1a7181 24#include "AliResonanceKink.h"
f9afc48d 25
26ClassImp(AliAnalysisTaskKinkResonance)
27
f9afc48d 28//______________________________________________________________________________
92adf4f6 29AliAnalysisTaskKinkResonance::AliAnalysisTaskKinkResonance(const char *dname)
30 : AliAnalysisTaskSE(dname), fList(0), fKinkResonance(0)
f9afc48d 31
32{
33 // Constructor
34
35 // Define input and output slots here
36 // Input slot #0 works with a TChain
92adf4f6 37 //DefineInput(0, TChain::Class());
f9afc48d 38 DefineOutput(1, TList::Class());
39}
40
41//________________________________________________________________________
92adf4f6 42void AliAnalysisTaskKinkResonance::UserCreateOutputObjects()
f9afc48d 43{
44 // Create histograms
45 // Called once
46
f9afc48d 47 fList= fKinkResonance->GetHistogramList();
48
49}
50
51//________________________________________________________________________
92adf4f6 52void AliAnalysisTaskKinkResonance::UserExec(Option_t *)
f9afc48d 53{
54 // Main loop
55 // Called for each event
56
92adf4f6 57 AliVEvent *event = InputEvent();
58 if (!event) {
59 Printf("ERROR: Could not retrieve event");
60 return;
61 }
62
63 AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
894840ad 64
92adf4f6 65 if (!esd) {
66 Printf("ERROR: Could not retrieve esd");
67 return;
68 }
e3c296cd 69
894840ad 70 if((fKinkResonance->GetAnalysisType() == "MC")||(fKinkResonance->GetAnalysisType() == "ESD")) {
71 AliMCEvent* mcEvent = MCEvent();
72 if (!mcEvent) {
73 Printf("ERROR: Could not retrieve MC event");
74 return;
75 }
76 fKinkResonance->SetDebugLevel(fDebug);
77 fKinkResonance->Analyse(esd, mcEvent);
78 }
79
80 if(fKinkResonance->GetAnalysisType() == "DATA") {
81 fKinkResonance->SetDebugLevel(fDebug);
82 fKinkResonance->Analyse(esd);
92adf4f6 83 }
f9afc48d 84
0aa3a5b9 85 PostData(1, fList);
f9afc48d 86
87}
88
89//________________________________________________________________________
90void AliAnalysisTaskKinkResonance::Terminate(Option_t *)
91{
92 // Draw result to the screen
93 // Called once at the end of the query
894840ad 94
f9afc48d 95 fList = dynamic_cast<TList*> (GetOutputData(1));
96
97 if (!fList) {
98 Printf("ERROR: fList not available");
99 return;
100 }
894840ad 101
102 TH1D* h=(TH1D *) fList->At(1);
103 TCanvas *c1 = new TCanvas("AliAnalysisTaskKinkResonance","Inv mass",10,10,510,510);
104 c1->cd(1);
105 if (h) h->DrawCopy("E");
106
f9afc48d 107}
108