]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/KINK/AliAnalysisTaskKinkResonance.cxx
0a1dfd175dc587c07c566fe7ee668b0d10798ff6
[u/mrichter/AliRoot.git] / PWG2 / KINK / AliAnalysisTaskKinkResonance.cxx
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 
17 //        products. 
18 //-----------------------------------------------------------------------------------------------------------------
19
20 #include "AliESDEvent.h"
21
22 #include "AliAnalysisTaskKinkResonance.h"
23 #include "AliResonanceKink.h"
24
25 ClassImp(AliAnalysisTaskKinkResonance)
26
27 //______________________________________________________________________________
28 AliAnalysisTaskKinkResonance::AliAnalysisTaskKinkResonance(const char *dname) 
29   : AliAnalysisTaskSE(dname), fList(0), fKinkResonance(0)
30
31 {
32   // Constructor
33
34   // Define input and output slots here
35   // Input slot #0 works with a TChain
36   //DefineInput(0, TChain::Class());
37   DefineOutput(1, TList::Class());
38 }
39
40 //________________________________________________________________________
41 void AliAnalysisTaskKinkResonance::UserCreateOutputObjects() 
42 {
43   // Create histograms
44   // Called once
45   
46   fList= fKinkResonance->GetHistogramList();
47    
48 }
49
50 //________________________________________________________________________
51 void AliAnalysisTaskKinkResonance::UserExec(Option_t *) 
52 {
53   // Main loop
54   // Called for each event
55    
56   AliVEvent *event = InputEvent();
57   if (!event) {
58      Printf("ERROR: Could not retrieve event");
59      return;
60   }
61
62   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
63   if (!esd) {
64      Printf("ERROR: Could not retrieve esd");
65      return;
66   }
67
68   AliMCEvent* mcEvent = MCEvent();
69   if (!mcEvent) {
70      Printf("ERROR: Could not retrieve MC event");
71      return;
72   }
73
74   fKinkResonance->SetDebugLevel(fDebug);
75   fKinkResonance->Analyse(esd, mcEvent);
76    
77   PostData(1, fList);
78    
79 }      
80
81 //________________________________________________________________________
82 void AliAnalysisTaskKinkResonance::Terminate(Option_t *) 
83 {
84   // Draw result to the screen 
85   // Called once at the end of the query
86   fList = dynamic_cast<TList*> (GetOutputData(1));
87
88   if (!fList) {
89     Printf("ERROR: fList not available");
90     return;
91   }
92   //TH1D* h=(TH1D *) fList->At(15);
93   //TCanvas *c1 = new TCanvas("AliAnalysisTaskKinkResonance","Pt MC",10,10,510,510);
94   //c1->cd(1);
95   //if (h) h->DrawCopy("E");
96
97 }
98