#include <iostream>
#include <fstream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <time.h>
//#include <cmath>
#include "TH1.h"
#include "TFile.h"
#include "TLine.h"
#include "TTree.h"
#include "TROOT.h"
#include "TPostScript.h"
#include "TCanvas.h"
#include "TH2F.h"
#include "TText.h"
#include "TProfile.h"
#include "TGraphErrors.h"
#include "TRandom.h"
#include "TRandom2.h"
#include "TRandom3.h"
#include "TStyle.h"
#include "TVector3.h"
using namespace std;
TStyle* RootStyle();
TStyle *color=RootStyle();
double PI=3.1415926;
double R_EARTH=6.36E6;
TRandom3 *Rand3=new TRandom3();
int main(int argc, char *argv[]) {
gStyle=color;
gStyle->SetPalette(1);
TFile *f = new TFile("/Users/amyc/icemc/outputs/icefinal.root");
TTree *t1 = (TTree*)f->Get("passing_events");
double logweight,theta_in,costhetanu,cosalpha,phi_in;
double theta_rf_atbn;
double e_component,h_component;
double weight;
t1->SetBranchAddress("logweight",&logweight);
t1->SetBranchAddress("weight",&weight);
// t1->SetBranchAddress("theta_in",&theta_in);
//t1->SetBranchAddress("phi_in",&phi_in);
//t1->SetBranchAddress("costhetanu",&costhetanu);
t1->SetBranchAddress("cosalpha",&cosalpha);
t1->SetBranchAddress("theta_rf_atbn",&theta_rf_atbn);
t1->SetBranchAddress("e_component",&e_component);
t1->SetBranchAddress("h_component",&h_component);
TH2D *h2_weight_thetarf=new TH2D("h2_thetarf","h2_thetarf",100,50.,100.,100,-10.,1.);
TH2D *h2_weight_alpha=new TH2D("h2_alpha","h2_alpha",100,90.0,130.,100,-10.,1.);
TH1D *h2_ratio=new TH1D("h2_ratio","h2_ratio",100,-20.0,20.);
for (int i=0;i<t1->GetEntries();i++) {
t1->GetEvent(i);
h2_weight_thetarf->Fill(theta_rf_atbn*180./PI,logweight);
h2_weight_alpha->Fill(acos(cosalpha)*180./PI,logweight);
h2_ratio->Fill(e_component/h_component,1E5*weight);
cout << "weight, theta are " << logweight << "\t" << theta_rf_atbn << "\n";
}
TCanvas *c1=new TCanvas("c1","c1",800,800);
c1->Divide(1,2);
h2_weight_thetarf->SetXTitle("#theta_{rf at bn}");
h2_weight_thetarf->SetYTitle("Weight");
c1->cd(1);
h2_weight_thetarf->SetMarkerSize(0.5);
h2_weight_thetarf->Draw();
c1->cd(2);
h2_weight_alpha->SetXTitle("#theta_{#nu wrt up}");
h2_weight_alpha->SetYTitle("Weight");
h2_weight_alpha->Draw();
c1->cd(2);
h2_weight_alpha->SetXTitle("#alpha_{rf at bn}");
h2_weight_alpha->SetYTitle("Weight");
h2_weight_alpha->Draw();
c1->Print("stevenanddave.eps");
return 0;
}
TStyle* RootStyle() {
// const char* modified = "Borrowed and adapted from paus et al";
TStyle *RootStyle = new TStyle("Root-Style","The Perfect Style for Plots ;-)");
#ifdef __CINT__
TStyle *GloStyle;
GloStyle = gStyle; // save the global style reference
gStyle = RootStyle;
#endif
// otherwise you need to call TROOT::SetStyle("Root-Style")
// Paper size
RootStyle->SetPaperSize(TStyle::kUSLetter);
// Canvas
RootStyle->SetCanvasColor (0);
RootStyle->SetCanvasBorderSize(10);
RootStyle->SetCanvasBorderMode(0);
RootStyle->SetCanvasDefH (600);
RootStyle->SetCanvasDefW (600);
RootStyle->SetCanvasDefX (10);
RootStyle->SetCanvasDefY (10);
// Pads
RootStyle->SetPadColor (0);
RootStyle->SetPadBorderSize (10);
RootStyle->SetPadBorderMode (0);
// RootStyle->SetPadBottomMargin(0.13);
RootStyle->SetPadBottomMargin(0.16);
RootStyle->SetPadTopMargin (0.08);
RootStyle->SetPadLeftMargin (0.15);
RootStyle->SetPadRightMargin (0.15);
RootStyle->SetPadGridX (0);
RootStyle->SetPadGridY (0);
RootStyle->SetPadTickX (1);
RootStyle->SetPadTickY (1);
// Frames
RootStyle->SetFrameFillStyle ( 0);
RootStyle->SetFrameFillColor ( 0);
RootStyle->SetFrameLineColor ( 1);
RootStyle->SetFrameLineStyle ( 0);
RootStyle->SetFrameLineWidth ( 2);
RootStyle->SetFrameBorderSize(10);
RootStyle->SetFrameBorderMode( 0);
// Histograms
RootStyle->SetHistFillColor(0);
RootStyle->SetHistFillStyle(1);
RootStyle->SetHistLineColor(1);
RootStyle->SetHistLineStyle(0);
RootStyle->SetHistLineWidth(2);
// Functions
RootStyle->SetFuncColor(1);
RootStyle->SetFuncStyle(0);
RootStyle->SetFuncWidth(1);
//Legends
RootStyle->SetStatBorderSize(2);
RootStyle->SetStatFont (42);
// RootStyle->SetOptStat (111111);
RootStyle->SetOptStat (0);
RootStyle->SetStatColor (0);
RootStyle->SetStatX (0.93);
RootStyle->SetStatY (0.90);
RootStyle->SetStatFontSize (0.07);
// RootStyle->SetStatW (0.2);
// RootStyle->SetStatH (0.15);
// Labels, Ticks, and Titles
RootStyle->SetTickLength ( 0.015,"X");
RootStyle->SetTitleSize ( 0.055,"X");
RootStyle->SetTitleOffset( 1.00,"X");
RootStyle->SetTitleBorderSize(0);
// RootStyle->SetTitleFontSize((float)3.);
RootStyle->SetLabelOffset( 0.015,"X");
RootStyle->SetLabelSize ( 0.050,"X");
RootStyle->SetLabelFont ( 42 ,"X");
RootStyle->SetTickLength ( 0.015,"Y");
RootStyle->SetTitleSize ( 0.055,"Y");
RootStyle->SetTitleOffset( 1.300,"Y");
RootStyle->SetLabelOffset( 0.015,"Y");
RootStyle->SetLabelSize ( 0.050,"Y");
RootStyle->SetLabelFont ( 42 ,"Y");
RootStyle->SetTitleFont (42,"XYZ");
RootStyle->SetTitleColor (1);
// Options
RootStyle->SetOptFit (1);
RootStyle->SetMarkerStyle(20);
RootStyle->SetMarkerSize(0.8);
// cout << ">> Style initialized with the Root Style!" << endl;
// cout << ">> " << modified << endl << endl;
return RootStyle;
}
//need to get expected limit with sprinkling (counting exp and binned), observed limit given the two observed in the bins we saw them, observed limit including clustered events in passing events. try to do the same for dailey's?
|