示例#1
0
int main(int argc, char **argv) {
	int i;
	int hitme;
	char ch;
	prelim();

	if (argc > 1) { // look for -f option
		if (strcmp(argv[1], "-f")== 0) {
			coordfixed = 1;
			argc--;
			argv++;
		}
	}
					
	
	if (argc > 1) {
		fromcommandline = 1;
		line[0] = '\0';
		while (--argc > 0) {
			strcat(line, *(++argv));
			strcat(line, " ");
		}
	}
	else fromcommandline = 0;


	while (TRUE) { /* Play a game */
		setup();
		if (alldone) {
			score(0);
			alldone = 0;
		}
		else makemoves();
		skip(2);
		stars();
		skip(1);

		if (tourn && alldone) {
			printf("Do you want your score recorded?");
			if (ja()) {
				chew2();
				freeze(FALSE);
			}
		}
		printf("Do you want to play again?");
		if (!ja()) break;
	}
	skip(1);
	prout("May the Great Bird of the Galaxy roost upon your home planet.");
	return 0;
}
示例#2
0
文件: main.c 项目: c4tachan/spnkr
int main()
{
	char starlist[99];
	char starlist2[99];
	int fe1, fe2;
	configurator();

/* Get the Fe I list from the user and open it and the corresponding solar list */
	fprintf(stderr, "Where is the Fe-I lines list located?\n");
	scanf("%s", starlist);
	FILE *stellar = fopen(starlist, "r");
	FILE *solar = fopen(sunlst1, "r");

	
/* Get the Fe II list from the user and open it and the solar list */	
	fprintf(stderr, "Where is the Fe-II lines list located?\n");
	scanf("%s", starlist2);
	FILE *stellar2 = fopen(starlist2, "r");
	FILE *solar2 = fopen(sunlst2, "r");

	
	fprintf(stderr, "Thank you!\n");
	
	fe1 = sortlists(stellar, solar, 0);
	fclose(stellar);
	fclose(solar);
	
	fprintf(stderr, "Fe1 Lists are sorted. . . ");
	
	fe2 = sortlists(stellar2, solar2, 1);
	fclose(stellar2);
/*	fclose(solar2);*/
	
	fprintf(stderr, "Fe2 Lists are sorted. . . Continuing!\n");
	
	fprintf(stderr, "READY FOR PARAMS FUNCTION!\n");
	
	prelim(fe1, fe2);
	return 0;
}
void makeMuonTimingPlot (std::string fname)
{
    TFile file(fname.c_str());
    TDirectoryFile *dir = (TDirectoryFile*)file.Get("Muons");

    TList *hlist = dir->GetListOfKeys();
    TH1F *h1;
    bool foundHist = false;
    for (auto hist : *hlist)    
    {
        TString name = hist->GetName();
        if (!name.Contains("hMuTimeP")) continue;

        TH1F *h0 = (TH1F*)dir->Get(name.Data());        
        if (!foundHist)
        {
            h1 = (TH1F*)h0->Clone();
            h1->Sumw2();
            foundHist = true;
        }
        else
        {
            h1->Add(h0);
        }        
    }

    TH1F *h2 = new TH1F("h2", "h2", 200, -100, 100);
    h2->GetXaxis()->SetTitle("muon time (ns)");
    h2->GetYaxis()->SetTitle("Fraction of Muons/ns");
    h2->GetYaxis()->SetTitleOffset(1.1);
    h2->GetXaxis()->SetTitleOffset(0.8);        
    h2->SetTitle("CSC Muon Time");
    h2->SetTitleFont(42);
    h2->SetTitleSize(0.052);    
 
    h2->Sumw2();
    h2->SetLineColor(kCyan+3);
    h2->SetFillColor(kCyan+3);

    for (int ibin = 1; ibin <= 200; ibin++)
    {
        h2->SetBinContent(ibin, h1->GetBinContent(ibin));
        h2->SetBinError(ibin, h1->GetBinError(ibin));
        if (ibin == 200)
            h2->SetEntries(h1->GetEntries());
    }
    
    TCanvas c1("c1", "c1", 600, 400);
    gStyle->SetOptStat("");

    double rms = h2->GetRMS();
    double avg = h2->GetMean();
    
    TLatex cms(0.17, 0.83, "CMS");
    cms.SetNDC();
    cms.SetTextFont(61);
    cms.SetTextSize(0.06);

    TLatex prelim(0.17, 0.81, "Preliminary");
    prelim.SetNDC();
    prelim.SetTextAlign(13);
    prelim.SetTextFont(52);
    prelim.SetTextSize(0.0456);

    TLatex data(0.17, 0.76, "Data 2016");
    data.SetNDC();
    data.SetTextAlign(13);
    data.SetTextFont(52);
    data.SetTextSize(0.0456);

    TLatex lumi(0.9, 0.93, "4.0 fb^{-1} (13 TeV)");
    lumi.SetNDC();
    lumi.SetTextAlign(31);
    lumi.SetTextFont(42);
    lumi.SetTextSize(0.052);    

    TLatex mean(0.7, 0.81, Form("Mean  %2.1f", avg));
    mean.SetNDC();
    mean.SetTextAlign(11);
    mean.SetTextFont(61);
    mean.SetTextSize(0.06);

    TLatex stdev(0.7, 0.76, Form("RMS   %2.1f", rms));
    stdev.SetNDC();
    stdev.SetTextAlign(11);
    stdev.SetTextFont(61);
    stdev.SetTextSize(0.06);

    h2->GetXaxis()->SetRangeUser(-6*rms,6*rms);   
    TH1F* h2norm = (TH1F*)h2->DrawNormalized("hist");
    gPad->Update();
    cms.Draw();
    prelim.Draw();
    data.Draw();
    lumi.Draw();
    mean.Draw();
    stdev.Draw();
    
    TPaveText *title = (TPaveText*)gPad->GetPrimitive("title");
    title->SetBorderSize(0);
    title->SetFillColor(0);
    title->SetFillStyle(0);    
    title->SetX1NDC(0.13);
    title->SetY1NDC(0.88);
    title->SetX2NDC(0.9);
    title->SetY2NDC(0.98);
    title->SetTextFont(42);
    title->SetTextSize(0.052);    
    title->SetTextAlign(11);
    
    c1.Print("plots/muon_time_all.pdf");
    c1.Print("plots/muon_time_all.png");
    c1.Print("plots/muon_time_all.root");
}
void make1DLimitHH(TString combine_dir,bool blind=true){
  //TString combine_dir = "test_runSusyHgg/signalInj_sms_ChiHH_0_175/";

  TGraph obser( (275-125)/25 );
  TGraph graph( (275-125)/25 );
  TGraphAsymmErrors error( (275-125)/25 );

    for(int m=125;m<501;m+=25) {
      int i=(m-125)/25;
      TFile limit_file(Form("%s/higgsCombineChiHH_0_%d.Asymptotic.mH120.root",combine_dir.Data(),m) );
      TTree *limit_tree = (TTree*)limit_file.Get("limit");
      TTreeFormula limit_form("get_limit","limit",limit_tree);

      limit_tree->GetEntry(1);
      float down = limit_form.EvalInstance();
      limit_tree->GetEntry(2);
      float exp = limit_form.EvalInstance();
      limit_tree->GetEntry(3);
      float up = limit_form.EvalInstance();
      limit_tree->GetEntry(5);
      float obs = limit_form.EvalInstance();

      graph.SetPoint(i,float(m),exp);
      error.SetPoint(i,float(m),exp);
      error.SetPointError(i,0,0,exp-down,up-exp);

      obser.SetPoint(i,float(m),obs);
    }

    TGraphErrors* theo = getTheoXSec("/home/amott/HggApp/SusyHgg/xsecs/Higgsino.txt");

    TCanvas cv;
    cv.SetLogy();

    theo->SetMaximum(1e2);
    theo->SetMinimum(1e-2);
    theo->GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)");
    theo->GetXaxis()->SetTitle("m_{chargino}");
    theo->SetFillColor(kBlue);
    theo->SetLineStyle(kDotted);
    theo->SetLineWidth(2.0);
    
    error.SetMaximum(1e2);
    error.SetMinimum(1e-2);
    error.GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)");
    error.GetXaxis()->SetTitle("m_{chargino}");
    error.SetFillColor(kGreen);
    error.Draw("A3");

    theo->Draw("3C");

    graph.SetLineStyle(kDashed);
    graph.SetLineWidth(2);
    graph.Draw("C");

    obser.SetLineStyle(1);
    obser.SetLineWidth(2);
    if(!blind) obser.Draw("C");

    TLegend leg(0.7,0.7,0.85,0.85);
    leg.SetFillColor(0);
    leg.SetBorderSize(0);
    leg.AddEntry(&graph,"expected","l");
    leg.AddEntry(&error,"expected #pm1#sigma","F");
    leg.AddEntry(theo,"theoretical","f");
    if(!blind)     leg.AddEntry(&obser,"observed","l");

    leg.Draw("SAME");

    TLatex prelim(0.65,0.96,"CMS Preliminary");
    prelim.SetNDC();
    prelim.SetTextSize(0.045);
    prelim.Draw();

    TLatex lbl(0.5,0.86,"#sqrt{s} = 8 TeV  #int L dt = 19.78 fb^{-1}");
    lbl.SetNDC();
    lbl.SetTextSize(0.045);
    lbl.Draw();

    cv.SaveAs(combine_dir+"expected_exclusion_HH_1D.png");


}