]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Base/AliFlowAnalysisTemplate.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowAnalysisTemplate.cxx
1 /*************************************************************************
2 * Copyright(c) 1998-2008, 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 #define AliFlowAnalysisTemplate_CXX
17
18 // root includes
19 #include "TFile.h"      
20 #include "TList.h"
21 #include "TMath.h"
22 #include "TProfile.h"
23 // aliroot includes
24 #include "AliFlowCommonConstants.h"
25 #include "AliFlowEventSimple.h"
26 #include "AliFlowTrackSimple.h"
27 #include "AliFlowCommonHist.h"
28 #include "AliFlowCommonHistResults.h"
29 #include "AliFlowAnalysisTemplate.h"
30
31 // Description: Template maker to serve as a starting point for flow analysis
32 // Author:      Redmer Alexander Bertens, Utrecht University, 2013
33 //              rbertens@cern.ch, rbertens@nikhef.nl, r.a.bertens@uu.nl 
34
35
36 ClassImp(AliFlowAnalysisTemplate)
37
38 AliFlowAnalysisTemplate::AliFlowAnalysisTemplate() :
39     fDebug                      (0),
40     fUsePhiWeights              (kFALSE),
41     fApplyCorrectionForNUA      (kFALSE),
42     fHarmonic                   (2),
43     fWeightsList                (0x0),
44     fHistList                   (0x0),
45     fCommonHists                (0x0),
46     fCommonHistsRes             (0x0)
47 { /* constructor */ }
48 //_____________________________________________________________________________
49 AliFlowAnalysisTemplate::~AliFlowAnalysisTemplate() 
50 {
51   // destructor
52 }
53 //_____________________________________________________________________________
54 void AliFlowAnalysisTemplate::Init() 
55 {
56     // initialize the histograms
57     fHistList = new TList();
58     fHistList->SetName("TemplateList");
59     fHistList->SetOwner();
60
61     // common histogram container
62     fCommonHists = new AliFlowCommonHist("AliFlowCommonHist_Template","AliFlowCommonHist");
63     (fCommonHists->GetHarmonic())->Fill(0.5,fHarmonic); // store harmonic 
64     fHistList->Add(fCommonHists);
65     
66     // common results container
67     fCommonHistsRes = new AliFlowCommonHistResults("AliFlowCommonHistResults_Template","",fHarmonic);
68     fHistList->Add(fCommonHistsRes);
69 }
70 //_____________________________________________________________________________
71 void AliFlowAnalysisTemplate::Make(AliFlowEventSimple* anEvent) 
72 {
73   // core method, called for each event
74   if (!anEvent) return;
75   // test statement
76   printf("Numer of POIs %i", anEvent->NumberOfTracks());
77 }
78 //_____________________________________________________________________________
79 void AliFlowAnalysisTemplate::GetOutputHistograms(TList *outputListHistos)
80 {
81     //get pointers to all output histograms (called before Finish())
82     fHistList = outputListHistos;
83     fCommonHists = (AliFlowCommonHist*) fHistList->FindObject("AliFlowCommonHist_SP");
84     fCommonHistsRes = (AliFlowCommonHistResults*) fHistList->FindObject("AliFlowCommonHistResults_SP");
85 }   
86 //_____________________________________________________________________________
87 void AliFlowAnalysisTemplate::Finish() {
88     // calculate flow and fill the AliFlowCommonHistResults
89 }
90 //_____________________________________________________________________________
91 void AliFlowAnalysisTemplate::WriteHistograms(TDirectoryFile *outputFileName) const {
92     // store the final results in output .root file
93     outputFileName->Add(fHistList);
94     outputFileName->Write(outputFileName->GetName(), TObject::kSingleKey);
95 }
96 //_____________________________________________________________________________