00001 #define ProofEventProc_cxx
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "ProofEventProc.h"
00014 #include <TStyle.h>
00015 #include "TCanvas.h"
00016 #include "TPad.h"
00017 #include "TH1F.h"
00018 #include "TH2F.h"
00019
00020
00021 void ProofEventProc::Begin(TTree *)
00022 {
00023
00024
00025
00026
00027 TString option = GetOption();
00028
00029 }
00030
00031 void ProofEventProc::SlaveBegin(TTree *tree)
00032 {
00033
00034
00035
00036
00037 Init(tree);
00038
00039
00040 fFullRead = kFALSE;
00041 TNamed *nm = 0;
00042 if (fInput)
00043 nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofEventProc_Read"));
00044 if (nm && !strcmp(nm->GetTitle(), "readall"))
00045 fFullRead = kTRUE;
00046 Info("SlaveBegin", "'%s' reading", (fFullRead ? "full" : "optimized"));
00047
00048 TString option = GetOption();
00049
00050 fPtHist = new TH1F("pt_dist","p_{T} Distribution",100,0,5);
00051 fPtHist->SetDirectory(0);
00052 fPtHist->GetXaxis()->SetTitle("p_{T}");
00053 fPtHist->GetYaxis()->SetTitle("dN/p_{T}dp_{T}");
00054
00055 fOutput->Add(fPtHist);
00056
00057 fPzHist = new TH1F("pz_dist","p_{Z} Distribution",100,0,5.);
00058 fPzHist->SetDirectory(0);
00059 fPzHist->GetXaxis()->SetTitle("p_{Z}");
00060 fPzHist->GetYaxis()->SetTitle("dN/dp_{Z}");
00061
00062 fOutput->Add(fPzHist);
00063
00064 fPxPyHist = new TH2F("px_py","p_{X} vs p_{Y} Distribution",100,-5.,5.,100,-5.,5.);
00065 fPxPyHist->SetDirectory(0);
00066 fPxPyHist->GetXaxis()->SetTitle("p_{X}");
00067 fPxPyHist->GetYaxis()->SetTitle("p_{Y}");
00068
00069 fOutput->Add(fPxPyHist);
00070
00071 }
00072
00073 Bool_t ProofEventProc::Process(Long64_t entry)
00074 {
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 if (fFullRead) {
00094 fChain->GetTree()->GetEntry(entry);
00095 } else {
00096 b_event_fNtrack->GetEntry(entry);
00097 }
00098
00099
00100 if (fNtrack > 0) {
00101 if (!fFullRead) b_fTracks->GetEntry(entry);
00102 if (fTracks) {
00103 for (Int_t j=0;j<fTracks->GetEntries();j++){
00104 Track *curtrack = dynamic_cast<Track*>(fTracks->At(j));
00105 if (curtrack) {
00106 fPtHist->Fill(curtrack->GetPt(),1./curtrack->GetPt());
00107 fPxPyHist->Fill(curtrack->GetPx(),curtrack->GetPy());
00108 fPzHist->Fill(curtrack->GetPz());
00109 }
00110 }
00111 fTracks->Clear("C");
00112 }
00113 }
00114
00115 return kTRUE;
00116 }
00117
00118 void ProofEventProc::SlaveTerminate()
00119 {
00120
00121
00122
00123
00124 }
00125
00126 void ProofEventProc::Terminate()
00127 {
00128
00129
00130
00131
00132 TCanvas* canvas = new TCanvas("event","event",800,10,700,780);
00133 canvas->Divide(2,2);
00134 TPad *pad1 = (TPad *) canvas->GetPad(1);
00135 TPad *pad2 = (TPad *) canvas->GetPad(2);
00136 TPad *pad3 = (TPad *) canvas->GetPad(3);
00137 TPad *pad4 = (TPad *) canvas->GetPad(4);
00138
00139
00140 pad1->cd();
00141 pad1->SetLogy();
00142 TH1F *hi = dynamic_cast<TH1F*>(fOutput->FindObject("pz_dist"));
00143 if (hi) {
00144 hi->SetFillColor(30);
00145 hi->SetLineColor(9);
00146 hi->SetLineWidth(2);
00147 hi->DrawCopy();
00148 } else { Warning("Terminate", "no pz dist found"); }
00149
00150
00151 pad2->cd();
00152 pad2->SetLogy();
00153 TH1F *hf = dynamic_cast<TH1F*>(fOutput->FindObject("pt_dist"));
00154 if (hf) {
00155 hf->SetFillColor(30);
00156 hf->SetLineColor(9);
00157 hf->SetLineWidth(2);
00158 hf->DrawCopy();
00159 } else { Warning("Terminate", "no pt dist found"); }
00160
00161
00162 TH2F *h2f = dynamic_cast<TH2F*>(fOutput->FindObject("px_py"));
00163 if (h2f) {
00164
00165 pad3->cd();
00166 h2f->DrawCopy("SURF1 ");
00167
00168 pad4->cd();
00169 h2f->DrawCopy("CONT2COL");
00170 } else {
00171 Warning("Terminate", "no px py found");
00172 }
00173
00174
00175 canvas->cd();
00176 canvas->Update();
00177 }