bool ini_write_string_section(const char *p_file, const char *p_section, const char *p_template, const char *p_value) { int ret; FFILE f_orig(NULL, p_file, "r", FALSE); if (!f_orig) return(FALSE); FFILE f_new(tmpfile()); if (!f_new) return(FALSE); ret = file_copy(f_orig, f_new); if(!ret) { fclose(f_orig); fclose(f_new); return(FALSE); } f_orig.close(); if(f_orig.open(NULL, p_file, "w", FALSE)) { ret = ini_write_string_section(f_new, f_orig, p_section, p_template, p_value); fclose(f_orig); } fclose(f_new); return (ret); }
int execute_modifier(int mod) { int success = 1; switch(mod) { case F_EXIT: success = f_exit(); break; case F_COPY: success = f_copy(); break; case F_CUT: success = f_cut(); break; case F_PASTE: success = f_paste(); break; case F_FIND: success = f_find(); break; case F_GOTO: success = f_goto(); break; case F_HELP: success = f_help(); break; case F_MORE: success = f_more(); break; case F_NEW: success = f_new(); break; case F_OPEN: success = f_open(); break; case F_NEXTPAGE: success = f_nextpage(); break; case F_PREVPAGE: success = f_prevpage(); break; case F_RUN: success = f_run(); break; case F_SAVE: success = f_save(); break; case F_SAVEAS: success = f_saveas(); break; case F_UNDO: success = f_undo(); break; default: success = 0; /* Don't want the program to close for any other key */ break; } return success; }
Vector& BkStressLimSurface2D::getEvolDirection(Vector &f_new) { // -1 => Radial Evolution // 0 => From geometric center (~ normal) // 1 => Constant-P v2(0) = 0.0; if(direction >= 0) v2(1) = direction*f_new(1); else v2(1) = direction*translate_init(1); return v2; }
//13 void DrawMine(TString muname, TString ename, TString sel, TString chan, TString var,TCanvas *canvas){ TString fileE = "/home/nadjieh/work/Orso8TeV/macro/forAdding/emtw/TreesEle_"+ename+"_plots.root"; TString fileMu = "/home/nadjieh/work/Orso8TeV/macro/forAdding/TreesMu_"+muname+"_plots.root"; //TString fileE = "/home/nadjieh/work/Orso8TeV/macro/systematics/emtw/up/ewknorm/TreesEle_"+ename+"_RW.root"; //TString fileMu = "/home/nadjieh/work/Orso8TeV/macro/systematics/emtw/TreesEle_"+muname+"_RW.root"; TString step ="Default_allW/Default_allW"; //TString step ="DefaultTrue_allW/DefaultTrue_allW"; //TString step ="Default_Def/Default_Def"; //TString fileE = "/home/nadjieh/work/Orso8TeV/macro/SevenTeV/emtw/forLVLT/TreesEle_"+ename+"_plots.root"; //TString fileMu = "/home/nadjieh/work/Orso8TeV/macro/SevenTeV/SelectionStudies/forLVLT/TreesMu_"+muname+"_plots.root"; TFile f_old(fileMu); TFile f_new(fileE); TH1* h_old = 0; TH1* h_new = 0; cout<<var<<endl; if(var == "otherTop"){ h_old = ((TH3*)f_old.Get(step+"cosTheta3D"))->ProjectionZ(chan+"_muZ"); h_new = ((TH3*)f_new.Get(step+"cosTheta3D"))->ProjectionZ(chan+"_eZ"); h_old->Rebin(10); h_new->Rebin(10); } else if(var == "Reco"){ h_old = ((TH2*)f_old.Get(step+"cosTheta2D"))->ProjectionY(chan+"_muY"); h_new = ((TH2*)f_new.Get(step+"cosTheta2D"))->ProjectionY(chan+"_eY"); } else if(var == "Gen"){ h_old = ((TH2*)f_old.Get(step+"cosTheta2D"))->ProjectionX(chan+"_muX"); h_new = ((TH2*)f_new.Get(step+"cosTheta2D"))->ProjectionX(chan+"_eX"); h_old->Rebin(100); h_new->Rebin(100); } else if(var == "topMass" || var == "Wmass"){ h_old = (TH1F*)f_old.Get(step+"_"+var); h_new = (TH1F*)f_new.Get(step+"_"+var); } else if(var == "Reco"){ h_old = ((TH2*)f_old.Get(step+"cosTheta2D"))->ProjectionY(chan+"_muY"); h_new = ((TH2*)f_new.Get(step+"cosTheta2D"))->ProjectionY(chan+"_eY"); } else if(var == "Bkg"){ h_old = (TH1*)f_old.Get(step+"cosTheta"); h_new = (TH1*)f_new.Get(step+"cosTheta"); } else if(var == "both"){ h_old = ((TH2*)f_old.Get(step+"cosTheta2D"))->ProjectionY(chan+"_muY"); h_new = ((TH2*)f_new.Get(step+"cosTheta2D"))->ProjectionY(chan+"_eY"); h_old->Add((TH1*)f_old.Get(step+"cosTheta")); h_new->Add((TH1*)f_new.Get(step+"cosTheta")); //h_old->Rebin(10); //h_new->Rebin(10); } else { h_old = (TH1F*)f_old.Get(var); h_new = (TH1F*)f_new.Get(var); } if(h_old->Integral() != 0 && h_new->Integral()) { h_old->Scale(1./h_old->Integral()); h_new->Scale(1./h_new->Integral()); } TLegend *tleg = new TLegend(0.35,0.75,0.5,0.89); tleg->SetTextSize(0.045); tleg->SetBorderSize(0); tleg->SetFillColor(10); tleg->AddEntry(h_new, "ele_"+chan , "lp"); tleg->AddEntry(h_old, "mu_"+chan , "le"); double max = -999.; if( h_old->GetMaximum()>h_new->GetMaximum() ) max = h_old->GetMaximum(); else max = h_new->GetMaximum(); h_old->SetMaximum(max*1.3); h_old->SetMinimum(0); h_old->SetLineColor(kBlue); h_old->SetLineWidth(3); h_old->SetMarkerStyle(20); h_old->SetMarkerSize(2); h_old->SetMarkerColor(kBlue); h_old->Draw("h"); h_new->SetLineColor(kRed); h_new->SetMarkerStyle(23); h_new->SetMarkerSize(2); h_new->SetMarkerColor(kRed); h_new->SetLineWidth(3); h_new->Draw("sames"); gPad->Update(); TPaveStats* stats1 = (TPaveStats*)gPad->GetPrimitive("stats"); Double_t coords[4]; coords[0] = stats1->GetX1NDC(); coords[1] = stats1->GetX2NDC(); coords[2] = stats1->GetY1NDC(); coords[3] = stats1->GetY2NDC(); stats1->Draw(); gPad->Update(); TPaveStats* stats2 =(TPaveStats*)gPad->GetPrimitive("stats"); //stats2->SetX1NDC(coords[0]); stats2->SetX1NDC(2 * coords[0] - coords[1]); stats2->SetX2NDC(coords[0]); //stats2->SetY1NDC(2 * coords[2] - coords[3]); stats2->SetY1NDC(coords[2]); stats2->SetY2NDC(coords[3]); //stats2->SetY2NDC(coords[2]); stats2->SetTextColor(kBlue); stats2->Draw(); tleg->Draw("same"); TLatex* text_norm = new TLatex(0.92, 0.43, "Normalized to Unity"); text_norm->SetTextAngle(270); text_norm->SetNDC(true); text_norm->SetTextFont(42); text_norm->SetTextSize(0.04); text_norm->Draw("same"); canvas->Print(sel + "/" + sel + ".ps"); }