]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdEta/AlidNdEtaAnalysisSelector.cxx
coding conventions (Alberto)
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaAnalysisSelector.cxx
CommitLineData
dc740de4 1/* $Id$ */
2
75e130df 3#include "AlidNdEtaAnalysisSelector.h"
4
5#include <TStyle.h>
6#include <TSystem.h>
7#include <TCanvas.h>
75e130df 8#include <TVector3.h>
dc740de4 9#include <TH2F.h>
7029240a 10#include <TChain.h>
11#include <TFile.h>
75e130df 12
13#include <AliLog.h>
14#include <AliGenEventHeader.h>
7029240a 15#include <AliHeader.h>
75e130df 16
75e130df 17#include "dNdEtaAnalysis.h"
18
19ClassImp(AlidNdEtaAnalysisSelector)
20
dc740de4 21AlidNdEtaAnalysisSelector::AlidNdEtaAnalysisSelector() :
75e130df 22 AliSelector(),
5fbd0b17 23 fdNdEtaAnalysis(0)
75e130df 24{
25 //
26 // Constructor. Initialization of pointers
27 //
28}
29
30AlidNdEtaAnalysisSelector::~AlidNdEtaAnalysisSelector()
31{
32 //
33 // Destructor
34 //
35
36 // histograms are in the output list and deleted when the output
37 // list is deleted by the TSelector dtor
38}
39
40void AlidNdEtaAnalysisSelector::SlaveBegin(TTree * tree)
41{
42 // The SlaveBegin() function is called after the Begin() function.
43 // When running with PROOF SlaveBegin() is called on each slave server.
44 // The tree argument is deprecated (on PROOF 0 is passed).
45
46 AliSelector::SlaveBegin(tree);
47
7029240a 48 fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
75e130df 49}
50
51void AlidNdEtaAnalysisSelector::SlaveTerminate()
52{
53 // The SlaveTerminate() function is called after all entries or objects
54 // have been processed. When running with PROOF SlaveTerminate() is called
55 // on each slave server.
56
57 AliSelector::SlaveTerminate();
58
59 // Add the histograms to the output on each slave server
60 if (!fOutput)
61 {
b8e8168f 62 AliDebug(AliLog::kError, Form("ERROR: Output list not initialized."));
75e130df 63 return;
64 }
65
7029240a 66 fOutput->Add(fdNdEtaAnalysis);
75e130df 67}
68
69void AlidNdEtaAnalysisSelector::Terminate()
70{
71 // The Terminate() function is the last function to be called during
72 // a query. It always runs on the client, it can be used to present
73 // the results graphically or save the results to file.
74
75 AliSelector::Terminate();
76
7029240a 77 fdNdEtaAnalysis = dynamic_cast<dNdEtaAnalysis*> (fOutput->FindObject("dndeta"));
75e130df 78
7029240a 79 if (!fdNdEtaAnalysis)
75e130df 80 {
7029240a 81 AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p", (void*) fdNdEtaAnalysis));
75e130df 82 return;
83 }
84
75e130df 85 TFile* fout = new TFile("out.root","RECREATE");
dc740de4 86 WriteObjects();
75e130df 87 fout->Write();
88 fout->Close();
75e130df 89}
dc740de4 90
91void AlidNdEtaAnalysisSelector::WriteObjects()
92{
93 // Write objects to output file
94 // this is an extra function to be overloaded...
95 //
96
7029240a 97 fdNdEtaAnalysis->SaveHistograms();
dc740de4 98}