3 #include "AlidNdEtaAnalysisSelector.h"
12 #include <AliGenEventHeader.h>
14 #include "dNdEtaAnalysis.h"
16 ClassImp(AlidNdEtaAnalysisSelector)
18 AlidNdEtaAnalysisSelector::AlidNdEtaAnalysisSelector() :
21 fdNdEtaAnalysisFinal(0)
24 // Constructor. Initialization of pointers
28 AlidNdEtaAnalysisSelector::~AlidNdEtaAnalysisSelector()
34 // histograms are in the output list and deleted when the output
35 // list is deleted by the TSelector dtor
38 void AlidNdEtaAnalysisSelector::SlaveBegin(TTree * tree)
40 // The SlaveBegin() function is called after the Begin() function.
41 // When running with PROOF SlaveBegin() is called on each slave server.
42 // The tree argument is deprecated (on PROOF 0 is passed).
44 AliSelector::SlaveBegin(tree);
46 fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta");
49 void AlidNdEtaAnalysisSelector::SlaveTerminate()
51 // The SlaveTerminate() function is called after all entries or objects
52 // have been processed. When running with PROOF SlaveTerminate() is called
53 // on each slave server.
55 AliSelector::SlaveTerminate();
57 // Add the histograms to the output on each slave server
60 AliDebug(AliLog::kError, Form("ERROR: Output list not initialized."));
64 fOutput->Add(fdNdEtaAnalysis->GetEtaVsVtxHistogram());
65 fOutput->Add(fdNdEtaAnalysis->GetEtaVsVtxUncorrectedHistogram());
66 fOutput->Add(fdNdEtaAnalysis->GetVtxHistogram());
68 fdNdEtaAnalysis->GetVtxHistogram()->Print();
72 void AlidNdEtaAnalysisSelector::Terminate()
74 // The Terminate() function is the last function to be called during
75 // a query. It always runs on the client, it can be used to present
76 // the results graphically or save the results to file.
78 AliSelector::Terminate();
80 TH2F* etaVsVtxHistogram = dynamic_cast<TH2F*> (fOutput->FindObject("eta_vs_vtx"));
81 TH2F* etaVsVtxUncorrectedHistogram = dynamic_cast<TH2F*> (fOutput->FindObject("eta_vs_vtx_uncorrected"));
82 TH1D* vtxHistogram = dynamic_cast<TH1D*> (fOutput->FindObject("vtx"));
84 if (!etaVsVtxHistogram || !vtxHistogram || !etaVsVtxUncorrectedHistogram)
86 AliDebug(AliLog::kError, Form("ERROR: Histograms not available %p %p %p", (void*) etaVsVtxHistogram, (void*) etaVsVtxUncorrectedHistogram, (void*) vtxHistogram));
90 fdNdEtaAnalysisFinal = new dNdEtaAnalysis("dNdEtaResult");
92 fdNdEtaAnalysisFinal->SetEtaVsVtxHistogram(etaVsVtxHistogram);
93 fdNdEtaAnalysisFinal->SetEtaVsVtxUncorrectedHistogram(etaVsVtxUncorrectedHistogram);
94 fdNdEtaAnalysisFinal->SetVtxHistogram(vtxHistogram);
96 fdNdEtaAnalysisFinal->Finish();
98 TFile* fout = new TFile("out.root","RECREATE");
103 fdNdEtaAnalysisFinal->DrawHistograms();
106 void AlidNdEtaAnalysisSelector::WriteObjects()
108 // Write objects to output file
109 // this is an extra function to be overloaded...
112 fdNdEtaAnalysisFinal->SaveHistograms();