00001 #define ProofFriends_cxx
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "ProofFriends.h"
00027 #include "TCanvas.h"
00028 #include "TColor.h"
00029 #include "TH1F.h"
00030 #include "TH2F.h"
00031 #include "TList.h"
00032 #include "TMath.h"
00033 #include "TString.h"
00034 #include "TStyle.h"
00035
00036
00037 ProofFriends::ProofFriends()
00038 {
00039
00040
00041 fXY = 0;
00042 fZ = 0;
00043 fR = 0;
00044 fRZ = 0;
00045 }
00046
00047 void ProofFriends::Begin(TTree * )
00048 {
00049
00050
00051
00052
00053 TString option = GetOption();
00054
00055 }
00056
00057 void ProofFriends::SlaveBegin(TTree * )
00058 {
00059
00060
00061
00062
00063 TString option = GetOption();
00064
00065
00066 fXY = new TH2F("histo1", "y:x", 50, 5., 15., 50, 10., 30.);
00067 fZ = new TH1F("histo2", "z , sqrt(dx*dx+dy*dy) < 1", 50, 0., 5.);
00068 fR = new TH1F("histo3", "Tfrnd.r , sqrt(dx*dx+dy*dy) < 1, z < 1", 50, 5., 15.);
00069 fRZ = new TH2F("histo4", "Tfrnd.r:z , sqrt(dx*dx+dy*dy) < 1, z < 1", 50, 0., 1., 50, 5., 15.);
00070 fZ->SetFillColor(kBlue);
00071 fR->SetFillColor(kRed);
00072 fOutput->Add(fXY);
00073 fOutput->Add(fZ);
00074 fOutput->Add(fR);
00075 fOutput->Add(fRZ);
00076
00077 }
00078
00079 Bool_t ProofFriends::Process(Long64_t entry)
00080 {
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 b_x->GetEntry(entry);
00101 b_y->GetEntry(entry);
00102 fXY->Fill(x, y, 1.);
00103 Double_t dx = x-10.;
00104 Double_t dy = y-20.;
00105 Double_t xpy = TMath::Sqrt(dx*dx + dy*dy);
00106 if (xpy > 1.) return kFALSE;
00107
00108
00109 b_z->GetEntry(entry);
00110 fZ->Fill(z, 1.);
00111 if (z > 1.) return kFALSE;
00112
00113
00114 b_r->GetEntry(entry);
00115 fR->Fill(r, 1.);
00116 fRZ->Fill(z, r, 1.);
00117
00118 return kTRUE;
00119 }
00120
00121 void ProofFriends::SlaveTerminate()
00122 {
00123
00124
00125
00126
00127 }
00128
00129 void ProofFriends::Terminate()
00130 {
00131
00132
00133
00134
00135 gStyle->SetOptStat(1110);
00136
00137 TCanvas *c1 = new TCanvas("c1","Proof ProofFriends canvas",200,10,700,700);
00138
00139 Int_t cb = TColor::GetColor("#ccffff");
00140 c1->SetFillColor(cb);
00141 c1->SetBorderMode(0);
00142
00143 c1->Divide(2, 2);
00144
00145 Int_t cf = TColor::GetColor("#99cccc");
00146 TPad *p1 = 0;
00147 if ((fXY = dynamic_cast<TH2F *>(fOutput->FindObject("histo1")))) {
00148 p1 = (TPad *) c1->cd(1);
00149 p1->SetBorderMode(0);
00150 p1->SetFrameFillColor(cf);
00151 fXY->GetXaxis()->SetTitle("x");
00152 fXY->GetYaxis()->SetTitle("y");
00153 fXY->Draw("");
00154 }
00155
00156 if ((fZ = dynamic_cast<TH1F *>(fOutput->FindObject("histo2")))) {
00157 p1 = (TPad *) c1->cd(2);
00158 p1->SetBorderMode(0);
00159 p1->SetFrameFillColor(cf);
00160 fZ->GetXaxis()->SetTitle("z");
00161 fZ->GetYaxis()->SetTitle("N / 0.1");
00162 fZ->Draw("");
00163 }
00164
00165 if ((fR = dynamic_cast<TH1F *>(fOutput->FindObject("histo3")))) {
00166 p1 = (TPad *) c1->cd(3);
00167 p1->SetBorderMode(0);
00168 p1->SetFrameFillColor(cf);
00169 fR->GetXaxis()->SetTitle("Tfrnd.r");
00170 fR->GetYaxis()->SetTitle("N / 0.2");
00171 fR->Draw();
00172 }
00173
00174 if ((fRZ = dynamic_cast<TH2F *>(fOutput->FindObject("histo4")))) {
00175 p1 = (TPad *) c1->cd(4);
00176 p1->SetBorderMode(0);
00177 p1->SetFrameFillColor(cf);
00178 fRZ->GetXaxis()->SetTitle("z");
00179 fRZ->GetXaxis()->CenterTitle(1);
00180 fRZ->GetXaxis()->SetTitleOffset(1.5);
00181 fRZ->GetYaxis()->SetTitle("Tfrnd.r");
00182 fRZ->GetYaxis()->CenterTitle(1);
00183 fRZ->GetYaxis()->SetTitleOffset(1.75);
00184 fRZ->GetZaxis()->SetTitle("N / 0.1 / 0.2");
00185 fRZ->GetZaxis()->SetTitleOffset(1.25);
00186 fRZ->Draw("lego");
00187 }
00188
00189
00190 c1->cd();
00191 c1->Update();
00192
00193 }