void main_comp(double *A1, double *B1, int N, int n, int K, int ngrid, double data[], double data1[], int delta[], int **freq, double *grid, double **F, double **Fsmooth, double **hazard, const char *appdir) { int i,j,k,**ind,iterations,n_Iterations=1000; int *njumps; double phi,**fdens; double step,**p,**jumploc; double A,B,c,h; SampleTime *obs; delta[0]=0; data[0]=data1[0]=0; obs = new SampleTime[N]; for (i=0; i<N; i++) { obs[i].t = data[i+1]; obs[i].delta = delta[i+1]; } qsort(obs,N,sizeof(SampleTime),CompareTime); for (i=0; i<N; i++) { data[i+1]= obs[i].t ; delta[i+1] = obs[i].delta; } ind = new int *[K+2]; for (i=0;i<K+2;i++) ind[i]= new int[N+1]; for (k=1;k<=K+1;k++) F[k][0]=0; njumps = new int[K+2]; fdens= new double *[K+2]; p= new double *[K+2]; jumploc= new double *[K+2]; for (i=0;i<K+2;i++) { fdens[i]= new double[ngrid+1]; p[i]= new double[n+1]; jumploc[i]= new double[n+1]; } ICM(N,n,freq,K,ind,F,n_Iterations,&phi,&iterations); ofstream file2_("MLE.txt"); if (file2_.is_open()) { for (i=1;i<=n;i++) { if (F[K+1][i]>F[K+1][i-1]) { file2_ << setprecision(11) << setw(20) << data1[i]; for (k=1;k<=K+1;k++) file2_ << setprecision(11) << setw(20) << F[k][i]; file2_ << "\n"; } } file2_.close(); } for (k=1;k<=K+1;k++) { j=0; for (i=1;i<=n;i++) { if (F[k][i]>F[k][i-1]) { p[k][j]=F[k][i]-F[k][i-1]; jumploc[k][j]=data1[i]; j++; } } njumps[k]=j; } A=min(N,data); B=max(N,data); *A1=A; *B1=B; step=(B-A)/ngrid; c=B; for (i=0;i<=ngrid;i++) grid[i]=A+i*step; h = fmin(c*pow(N,-1.0/7),9.9); for (i=0;i<=ngrid;i++) { for (k=1;k<K+1;k++) fdens[k][i]=dens_estimate(A,B,k,njumps,jumploc,p,h,grid[i]); } h = B*pow(N,-1.0/5); for (i=0;i<=ngrid;i++) { for (k=1;k<=K;k++) Fsmooth[k][i]=bdf(A,B,k,njumps,jumploc,p,h,grid[i]); } for (i=0;i<=ngrid;i++) { for (k=1;k<=K;k++) hazard[k][i]=fdens[k][i]/(1-Fsmooth[k][i]); } ofstream file_("SMLE.txt"); if (file_.is_open()) { for (i=1;i<=ngrid;i++) { file_ << setprecision(10) << setw(20) << grid[i]; for (k=1;k<K+1;k++) file_ << setprecision(10) << setw(20) << Fsmooth[k][i]; file_ << "\n"; } file_.close(); } ofstream file1_("data.txt"); if (file1_.is_open()) { for (i=1;i<=N;i++) { file1_ << setprecision(11) << setw(20) << data[i]; file1_ << setw(10) << delta[i]; file1_ << "\n"; } file1_.close(); } ofstream file3_("hazard.txt"); if (file3_.is_open()) { for (i=1;i<=ngrid;i++) { file3_ << setprecision(10) << setw(20) << grid[i]; for (k=1;k<K+1;k++) file3_ << setprecision(10) << setw(20) << hazard[k][i]; file3_ << "\n"; } file3_.close(); } // free memory for (i = 0; i < K+2; i++) delete[] ind[i], delete[] p[i], delete[] jumploc[i], delete[] fdens[i]; delete[] ind, delete[] p, delete[] jumploc, delete[] njumps, delete[] fdens; delete[] obs; }
void makePlots() { // turn on/off batch mode gROOT->SetBatch(kTRUE); // set ROOT style style(); //******************************************** // root files //******************************************** // *** MC *** //string file0 = "$AXIGLUONDATA/axigluons_enujj/5fb-1_Summer11MC_AxigluonW_enujj_13092011/output_cutTable_axigluons_enujj/analysisClass_axigluons_enujj_plots.root"; string file0 = "$AXIGLUONDATA/axigluons_enujj/5fb-1_Summer11MC_AxigluonW_enujj_Mjj500cut_13092011_2/output_cutTable_axigluons_enujj/analysisClass_axigluons_enujj_plots.root"; // *** signal *** string file1 = file0; string file2 = file0; string file3 = file0; string file4 = file0; // string file1 = "$AXIGLUONDATA/axigluons_lnujj/AxigluonW_GenStudies_13092011/AG150WGen.root"; // string file2 = "$AXIGLUONDATA/axigluons_lnujj/AxigluonW_GenStudies_13092011/AG500WGen.root"; // string file3 = "$AXIGLUONDATA/axigluons_lnujj/AxigluonW_GenStudies_13092011/AG1000WGen.root"; // string file4 = "$AXIGLUONDATA/axigluons_lnujj/AxigluonW_GenStudies_13092011/AG1500WGen.root"; //******************************************** // make plots //******************************************** TFile file0_(file0.c_str()); TFile file1_(file1.c_str()); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Ele1_Pt" , "histo1D__AxigluonW_M150__Ele1_Pt", "histo1D__AxigluonW_M500__Ele1_Pt", "histo1D__AxigluonW_M1000__Ele1_Pt", "histo1D__AxigluonW_M1500__Ele1_Pt" , 0, 600, "Ele1 Pt (GeV)", "Ele1_Pt.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Ele1_Eta" , "histo1D__AxigluonW_M150__Ele1_Eta", "histo1D__AxigluonW_M500__Ele1_Eta", "histo1D__AxigluonW_M1000__Ele1_Eta", "histo1D__AxigluonW_M1500__Ele1_Eta" , -3, 3, "Ele1 \\eta (GeV)", "Ele1_Eta.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet1_Pt" , "histo1D__AxigluonW_M150__Jet1_Pt", "histo1D__AxigluonW_M500__Jet1_Pt", "histo1D__AxigluonW_M1000__Jet1_Pt", "histo1D__AxigluonW_M1500__Jet1_Pt" , 0, 1000, "Jet1 Pt (GeV)", "Jet1_Pt.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet2_Pt" , "histo1D__AxigluonW_M150__Jet2_Pt", "histo1D__AxigluonW_M500__Jet2_Pt", "histo1D__AxigluonW_M1000__Jet2_Pt", "histo1D__AxigluonW_M1500__Jet2_Pt" , 0, 1000, "Jet2 Pt (GeV)", "Jet2_Pt.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet1_Eta" , "histo1D__AxigluonW_M150__Jet1_Eta", "histo1D__AxigluonW_M500__Jet1_Eta", "histo1D__AxigluonW_M1000__Jet1_Eta", "histo1D__AxigluonW_M1500__Jet1_Eta" , -3, 3, "Jet1 \\eta (GeV)", "Jet1_Eta.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet2_Eta" , "histo1D__AxigluonW_M150__Jet2_Eta", "histo1D__AxigluonW_M500__Jet2_Eta", "histo1D__AxigluonW_M1000__Jet2_Eta", "histo1D__AxigluonW_M1500__Jet2_Eta" , -3, 3, "Jet2 \\eta (GeV)", "Jet2_Eta.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__mDEta_Jet1Jet2" , "histo1D__AxigluonW_M150__mDEta_Jet1Jet2", "histo1D__AxigluonW_M500__mDEta_Jet1Jet2", "histo1D__AxigluonW_M1000__mDEta_Jet1Jet2", "histo1D__AxigluonW_M1500__mDEta_Jet1Jet2" , 0, 5, "|\\Delta\\eta (j1,j2)|", "mDEta_Jet1Jet2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__mDPhi_Jet1Jet2" , "histo1D__AxigluonW_M150__mDPhi_Jet1Jet2", "histo1D__AxigluonW_M500__mDPhi_Jet1Jet2", "histo1D__AxigluonW_M1000__mDPhi_Jet1Jet2", "histo1D__AxigluonW_M1500__mDPhi_Jet1Jet2" , 0, 3.1416, "|\\Delta\\phi (j1,j2)|", "mDPhi_Jet1Jet2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__mDphi_BosonJet1" , "histo1D__AxigluonW_M150__mDphi_BosonJet1", "histo1D__AxigluonW_M500__mDphi_BosonJet1", "histo1D__AxigluonW_M1000__mDphi_BosonJet1", "histo1D__AxigluonW_M1500__mDphi_BosonJet1" , 0, 3.1416, "|\\Delta\\phi (boson,j1)|", "mDphi_BosonJet1.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__mDphi_BosonJet2" , "histo1D__AxigluonW_M150__mDphi_BosonJet2", "histo1D__AxigluonW_M500__mDphi_BosonJet2", "histo1D__AxigluonW_M1000__mDphi_BosonJet2", "histo1D__AxigluonW_M1500__mDphi_BosonJet2" , 0, 3.1416, "|\\Delta\\phi (boson,j2)|", "mDphi_BosonJet2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet1_Pt_over_Mj1j2" , "histo1D__AxigluonW_M150__Jet1_Pt_over_Mj1j2", "histo1D__AxigluonW_M500__Jet1_Pt_over_Mj1j2", "histo1D__AxigluonW_M1000__Jet1_Pt_over_Mj1j2", "histo1D__AxigluonW_M1500__Jet1_Pt_over_Mj1j2" , 0, 10, "Jet1 Pt / M_j1j2", "Jet1_Pt_over_Mj1j2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet2_Pt_over_Mj1j2" , "histo1D__AxigluonW_M150__Jet2_Pt_over_Mj1j2", "histo1D__AxigluonW_M500__Jet2_Pt_over_Mj1j2", "histo1D__AxigluonW_M1000__Jet2_Pt_over_Mj1j2", "histo1D__AxigluonW_M1500__Jet2_Pt_over_Mj1j2" , 0, 10, "Jet2 Pt / M_j1j2", "Jet2_Pt_over_Mj1j2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__M_j1j2" , "histo1D__AxigluonW_M150__M_j1j2", "histo1D__AxigluonW_M500__M_j1j2", "histo1D__AxigluonW_M1000__M_j1j2", "histo1D__AxigluonW_M1500__M_j1j2" , 0, 2000, "M_j1j2 (GeV)", "M_j1j2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__MT_Ele1MET" , "histo1D__AxigluonW_M150__MT_Ele1MET", "histo1D__AxigluonW_M500__MT_Ele1MET", "histo1D__AxigluonW_M1000__MT_Ele1MET", "histo1D__AxigluonW_M1500__MT_Ele1MET" , 0, 500, "M_{T}(e,MET) (GeV)", "MT_Ele1MET.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__MET_Pt" , "histo1D__AxigluonW_M150__MET_Pt", "histo1D__AxigluonW_M500__MET_Pt", "histo1D__AxigluonW_M1000__MET_Pt", "histo1D__AxigluonW_M1500__MET_Pt" , 0, 600, "PFMET (GeV)", "MET_Pt.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Pt_j1j2" , "histo1D__AxigluonW_M150__Pt_j1j2", "histo1D__AxigluonW_M500__Pt_j1j2", "histo1D__AxigluonW_M1000__Pt_j1j2", "histo1D__AxigluonW_M1500__Pt_j1j2" , 0, 600, "Pt(j1,j2) (GeV)", "Pt_j1j2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet1_E_over_Mj1j2" , "histo1D__AxigluonW_M150__Jet1_E_over_Mj1j2", "histo1D__AxigluonW_M500__Jet1_E_over_Mj1j2", "histo1D__AxigluonW_M1000__Jet1_E_over_Mj1j2", "histo1D__AxigluonW_M1500__Jet1_E_over_Mj1j2" , 0, 10, "Jet1 Energy / M_j1j2", "Jet1_E_over_Mj1j2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet1_E_over_Jet1_Pt" , "histo1D__AxigluonW_M150__Jet1_E_over_Jet1_Pt", "histo1D__AxigluonW_M500__Jet1_E_over_Jet1_Pt", "histo1D__AxigluonW_M1000__Jet1_E_over_Jet1_Pt", "histo1D__AxigluonW_M1500__Jet1_E_over_Jet1_Pt" , 0, 10, "Jet1 Energy / Jet1 Pt", "Jet1_E_over_Jet1_Pt.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet2_E_over_Mj1j2" , "histo1D__AxigluonW_M150__Jet2_E_over_Mj1j2", "histo1D__AxigluonW_M500__Jet2_E_over_Mj1j2", "histo1D__AxigluonW_M1000__Jet2_E_over_Mj1j2", "histo1D__AxigluonW_M1500__Jet2_E_over_Mj1j2" , 0, 10, "Jet2 Energy / M_j1j2", "Jet2_E_over_Mj1j2.png",0, 1, -99, -99, ""); overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__Jet2_E_over_Jet2_Pt" , "histo1D__AxigluonW_M150__Jet2_E_over_Jet2_Pt", "histo1D__AxigluonW_M500__Jet2_E_over_Jet2_Pt", "histo1D__AxigluonW_M1000__Jet2_E_over_Jet2_Pt", "histo1D__AxigluonW_M1500__Jet2_E_over_Jet2_Pt" , 0, 10, "Jet2 Energy / Jet2 Pt", "Jet2_E_over_Jet2_Pt.png",0, 1, -99, -99, ""); /* overlay_plots(file0, file1, file2, file3, file4, "histo1D__ALLBKG__M_j1j2" , "h1_Mass_AG", "h1_Mass_AG", "h1_Mass_AG", "h1_Mass_AG" , 0, 2000, "Axigluon Mass (GeV)", "M_j1j2.png",0, 1, -99, -99, ""); */ }