コード例 #1
0
ファイル: Bezier.cpp プロジェクト: sandybisaria/CarDemo
bool Bezier::checkForProblems() const {
	MathVector<float,3> corners[4];
	corners[0] = points[0][0];
	corners[1] = points[0][3];
	corners[2] = points[3][3];
	corners[3] = points[3][0];

	bool problem = false;

	for (int i = 0; i < 4; ++i) {
		MathVector<float, 3> leg1(corners[(i+1)%4] - corners[i]);
		MathVector<float, 3> leg2(corners[(i+2)%4] - corners[i]);
		MathVector<float, 3> leg3(corners[(i+3)%4] - corners[i]);

		MathVector<float, 3> dir1 = leg1.cross(leg2);
		MathVector<float, 3> dir2 = leg1.cross(leg3);
		MathVector<float, 3> dir3 = leg2.cross(leg3);

		if (dir1.dot(dir2) < -0.0001) problem = true;
		if (dir1.dot(dir3) < -0.0001) problem = true;
		if (dir3.dot(dir2) < -0.0001) problem = true;
	}

	return problem;
}
コード例 #2
0
ファイル: bezier.cpp プロジェクト: ddxxpp/stuntrally
bool BEZIER::CheckForProblems() const
{
	//MATHVECTOR<float,3> fl (points[0][0]), fr(points[0][3]), br(points[3][3]), bl(points[3][0]);
	
	MATHVECTOR<float,3> corners[4];
	corners[0] = points[0][0];
	corners[1] = points[0][3];
	corners[2] = points[3][3];
	corners[3] = points[3][0];
	
	bool problem = false;
	
	for (int i = 0; i < 4; i++)
	{
		MATHVECTOR<float,3> leg1(corners[(i+1)%4] - corners[i]);
		MATHVECTOR<float,3> leg2(corners[(i+2)%4] - corners[i]);
		MATHVECTOR<float,3> leg3(corners[(i+3)%4] - corners[i]);
		
		MATHVECTOR<float,3> dir1 = leg1.cross(leg2);
		MATHVECTOR<float,3> dir2 = leg1.cross(leg3);
		MATHVECTOR<float,3> dir3 = leg2.cross(leg3);
		
		if (dir1.dot(dir2) < -0.0001)
			problem = true;
		if (dir1.dot(dir3) < -0.0001)
			problem = true;
		if (dir3.dot(dir2) < -0.0001)
			problem = true;
		
		/*if (problem)
		{
			std::cout << *this;
			std::cout << "i: " << i << ", " << (i+1)%4 << ", " << (i+2)%4 << std::endl;
			std::cout << corners[0] << std::endl;
			std::cout << corners[1] << std::endl;
			std::cout << corners[2] << std::endl;
			std::cout << corners[3] << std::endl;
			std::cout << leg1 << std::endl;
			std::cout << leg2 << std::endl;
			std::cout << dir1 << std::endl;
			std::cout << dir1.dot(dir2) << ", " <<dir1.dot(dir3) << ", " << dir3.dot(dir2) <<std::endl;
		}*/
	}
	
	//if (problem) cout << "Degenerate bezier patch detected" << endl;
	
	return problem;
}
コード例 #3
0
ファイル: plot.C プロジェクト: czczc/USDBPlots
void plot(const char* type = "eps")
{
  gROOT->ProcessLine(".x ../../style.C");

  TFile *f = new TFile("../../SharedRootFiles/Osc.root");

  TH1D *data[6];
  TH1D *predOsc[6];
  TH1D *acc[6];
  TH1D *li9[6];
  TH1D *fsn[6];
  TH1D *afn[6];
  TH1D *amc[6];

  data[0] = (TH1D*)f->Get("ibd_spectrum_site1_det1");
  data[1] = (TH1D*)f->Get("ibd_spectrum_site1_det2");
  data[2] = (TH1D*)f->Get("ibd_spectrum_site2_det1");
  data[3] = (TH1D*)f->Get("ibd_spectrum_site4_det1");
  data[4] = (TH1D*)f->Get("ibd_spectrum_site4_det2");
  data[5] = (TH1D*)f->Get("ibd_spectrum_site4_det3");

  predOsc[0] = (TH1D*)f->Get("total_spectrum_expected_AD1");
  predOsc[1] = (TH1D*)f->Get("total_spectrum_expected_AD2");
  predOsc[2] = (TH1D*)f->Get("total_spectrum_expected_AD3");
  predOsc[3] = (TH1D*)f->Get("total_spectrum_expected_AD4");
  predOsc[4] = (TH1D*)f->Get("total_spectrum_expected_AD5");
  predOsc[5] = (TH1D*)f->Get("total_spectrum_expected_AD6");

  acc[0] = (TH1D*)f->Get("acc_spectrum_expected_AD1");
  acc[1] = (TH1D*)f->Get("acc_spectrum_expected_AD2");
  acc[2] = (TH1D*)f->Get("acc_spectrum_expected_AD3");
  acc[3] = (TH1D*)f->Get("acc_spectrum_expected_AD4");
  acc[4] = (TH1D*)f->Get("acc_spectrum_expected_AD5");
  acc[5] = (TH1D*)f->Get("acc_spectrum_expected_AD6");

  li9[0] = (TH1D*)f->Get("li9he8_spectrum_expected_AD1");
  li9[1] = (TH1D*)f->Get("li9he8_spectrum_expected_AD2");
  li9[2] = (TH1D*)f->Get("li9he8_spectrum_expected_AD3");
  li9[3] = (TH1D*)f->Get("li9he8_spectrum_expected_AD4");
  li9[4] = (TH1D*)f->Get("li9he8_spectrum_expected_AD5");
  li9[5] = (TH1D*)f->Get("li9he8_spectrum_expected_AD6");

  fsn[0] = (TH1D*)f->Get("fastn_spectrum_expected_AD1");
  fsn[1] = (TH1D*)f->Get("fastn_spectrum_expected_AD2");
  fsn[2] = (TH1D*)f->Get("fastn_spectrum_expected_AD3");
  fsn[3] = (TH1D*)f->Get("fastn_spectrum_expected_AD4");
  fsn[4] = (TH1D*)f->Get("fastn_spectrum_expected_AD5");
  fsn[5] = (TH1D*)f->Get("fastn_spectrum_expected_AD6");

  amc[0] = (TH1D*)f->Get("amc_spectrum_expected_AD1");
  amc[1] = (TH1D*)f->Get("amc_spectrum_expected_AD2");
  amc[2] = (TH1D*)f->Get("amc_spectrum_expected_AD3");
  amc[3] = (TH1D*)f->Get("amc_spectrum_expected_AD4");
  amc[4] = (TH1D*)f->Get("amc_spectrum_expected_AD5");
  amc[5] = (TH1D*)f->Get("amc_spectrum_expected_AD6");

  afn[0] = (TH1D*)f->Get("alphan_spectrum_expected_AD1");
  afn[1] = (TH1D*)f->Get("alphan_spectrum_expected_AD2");
  afn[2] = (TH1D*)f->Get("alphan_spectrum_expected_AD3");
  afn[3] = (TH1D*)f->Get("alphan_spectrum_expected_AD4");
  afn[4] = (TH1D*)f->Get("alphan_spectrum_expected_AD5");
  afn[5] = (TH1D*)f->Get("alphan_spectrum_expected_AD6");


  TH1D *data_site1 = data[0]->Clone("data_site1");
  data_site1->GetXaxis()->SetTitle("Prompt Energy [MeV]");
  data_site1->GetYaxis()->SetTitle("Events / 50KeV");
  data_site1->SetTitle("IBDs at EH1");

  TH1D *data_site2 = data[2]->Clone("data_site2");
  data_site2->GetXaxis()->SetTitle("Prompt Energy [MeV]");
  data_site2->GetYaxis()->SetTitle("Events / 50KeV");
  data_site2->SetTitle("IBDs at EH2");

  TH1D *data_site3 = data[3]->Clone("data_site3");
  data_site3->GetXaxis()->SetTitle("Prompt Energy [MeV]");
  data_site3->GetYaxis()->SetTitle("Events / 50KeV");
  data_site3->SetTitle("IBDs at EH3");

  TH1D *pred_site1 = predOsc[0]->Clone("pred_site1");
  THStack *hs_site1 = new THStack("hs_site1", "");
  TH1D *acc_site1  = acc[0]->Clone("acc_site1");
  TH1D *li9_site1  = li9[0]->Clone("li9_site1");
  TH1D *fsn_site1  = fsn[0]->Clone("fsn_site1");
  TH1D *amc_site1  = amc[0]->Clone("amc_site1");
  TH1D *afn_site1  = afn[0]->Clone("afn_site1");

  TH1D *pred_site2 = predOsc[2]->Clone("pred_site2");
  THStack *hs_site2 = new THStack("hs_site2", "");
  TH1D *acc_site2  = acc[2]->Clone("acc_site2");
  TH1D *li9_site2  = li9[2]->Clone("li9_site2");
  TH1D *fsn_site2  = fsn[2]->Clone("fsn_site2");
  TH1D *amc_site2  = amc[2]->Clone("amc_site2");
  TH1D *afn_site2  = afn[2]->Clone("afn_site2");

  TH1D *pred_site3 = predOsc[3]->Clone("pred_site3");
  THStack *hs_site3 = new THStack("hs_site3", "");
  TH1D *acc_site3  = acc[3]->Clone("acc_site3");
  TH1D *li9_site3  = li9[3]->Clone("li9_site3");
  TH1D *fsn_site3  = fsn[3]->Clone("fsn_site3");
  TH1D *amc_site3  = amc[3]->Clone("amc_site3");
  TH1D *afn_site3  = afn[3]->Clone("afn_site3");

  data_site1->Reset();
  pred_site1->Reset();
  acc_site1->Reset();
  li9_site1->Reset();
  fsn_site1->Reset();
  amc_site1->Reset();
  afn_site1->Reset();

  data_site2->Reset();
  pred_site2->Reset();
  acc_site2->Reset();
  li9_site2->Reset();
  fsn_site2->Reset();
  amc_site2->Reset();
  afn_site2->Reset();

  data_site3->Reset();
  pred_site3->Reset();
  acc_site3->Reset();
  li9_site3->Reset();
  fsn_site3->Reset();
  amc_site3->Reset();
  afn_site3->Reset();


  pred_site1->SetLineColor(2);
  pred_site1->SetMarkerColor(2);

  acc_site1->SetLineColor(9);
  acc_site1->SetMarkerColor(9);
  acc_site1->SetFillColor(9);

  li9_site1->SetLineColor(5);
  li9_site1->SetMarkerColor(5);
  li9_site1->SetFillColor(5);

  fsn_site1->SetLineColor(6);
  fsn_site1->SetMarkerColor(6);
  fsn_site1->SetFillColor(6);

  amc_site1->SetLineColor(7);
  amc_site1->SetMarkerColor(7);
  amc_site1->SetFillColor(7);

  afn_site1->SetLineColor(8);
  afn_site1->SetLineColor(8);
  afn_site1->SetFillColor(8);



  pred_site2->SetLineColor(2);
  pred_site2->SetMarkerColor(2);

  acc_site2->SetLineColor(9);
  acc_site2->SetMarkerColor(9);
  acc_site2->SetFillColor(9);

  li9_site2->SetLineColor(5);
  li9_site2->SetMarkerColor(5);
  li9_site2->SetFillColor(5);

  fsn_site2->SetLineColor(6);
  fsn_site2->SetMarkerColor(6);
  fsn_site2->SetFillColor(6);

  amc_site2->SetLineColor(7);
  amc_site2->SetMarkerColor(7);
  amc_site2->SetFillColor(7);

  afn_site2->SetLineColor(8);
  afn_site2->SetLineColor(8);
  afn_site2->SetFillColor(8);


  pred_site3->SetLineColor(2);
  pred_site3->SetMarkerColor(2);

  acc_site3->SetLineColor(9);
  acc_site3->SetMarkerColor(9);
  acc_site3->SetFillColor(9);

  li9_site3->SetLineColor(5);
  li9_site3->SetMarkerColor(5);
  li9_site3->SetFillColor(5);

  fsn_site3->SetLineColor(6);
  fsn_site3->SetMarkerColor(6);
  fsn_site3->SetFillColor(6);

  amc_site3->SetLineColor(7);
  amc_site3->SetMarkerColor(7);
  amc_site3->SetFillColor(7);

  afn_site3->SetLineColor(8);
  afn_site3->SetLineColor(8);
  afn_site3->SetFillColor(8);


  for (int i=0; i<2; i++) {
    data_site1->Add(data[i]);
    pred_site1->Add(predOsc[i]);
    acc_site1->Add(acc[i]);
    li9_site1->Add(li9[i]);
    fsn_site1->Add(fsn[i]);
    amc_site1->Add(amc[i]);
    afn_site1->Add(afn[i]);
  }

  for (int i=2; i<3; i++) {
    data_site2->Add(data[i]);
    pred_site2->Add(predOsc[i]);
    acc_site2->Add(acc[i]);
    li9_site2->Add(li9[i]);
    fsn_site2->Add(fsn[i]);
    amc_site2->Add(amc[i]);
    afn_site2->Add(afn[i]);
  }

  for (int i=3; i<6; i++) {
    data_site3->Add(data[i]);
    pred_site3->Add(predOsc[i]);
    acc_site3->Add(acc[i]);
    li9_site3->Add(li9[i]);
    fsn_site3->Add(fsn[i]);
    amc_site3->Add(amc[i]);
    afn_site3->Add(afn[i]);
  }

  hs_site1->Add(fsn_site1);
  hs_site1->Add(afn_site1);
  hs_site1->Add(amc_site1);
  hs_site1->Add(li9_site1);
  hs_site1->Add(acc_site1);

  hs_site2->Add(fsn_site2);
  hs_site2->Add(afn_site2);
  hs_site2->Add(amc_site2);
  hs_site2->Add(li9_site2);
  hs_site2->Add(acc_site2);

  hs_site3->Add(fsn_site3);
  hs_site3->Add(afn_site3);
  hs_site3->Add(amc_site3);
  hs_site3->Add(li9_site3);
  hs_site3->Add(acc_site3);

  TCanvas c1("c1", "c1", 800, 800);
  TPad *can_1 = new TPad("can_1", "can_1",0, 0.66, 1, 0.99);
  TPad *can_2 = new TPad("can_2", "can_2",0, 0.33, 1, 0.66);
  TPad *can_3 = new TPad("can_3", "can_3",0, 0, 1, 0.33);

  can_1->Draw();
  can_1->cd();
  can_1->SetBottomMargin(1e-05);
  can_1->SetFrameBorderMode(0);
  can_1->SetBorderMode(0);
  data_site1->Draw();
  data_site1->SetTitle("");
  hs_site1->Draw("same");
  data_site1->Draw("same");
  // pred_site1->Draw("same");
  data_site1->GetXaxis()->SetLabelSize(0.09);
  data_site1->GetYaxis()->SetNdivisions(508);
  data_site1->GetYaxis()->SetTitleSize(0.08);
  data_site1->GetYaxis()->SetLabelSize(0.08);
  data_site1->GetYaxis()->SetTitleOffset(0.6);
  data_site1->GetYaxis()->CenterTitle(true);
  TLegend leg(0.65,0.85-0.20,0.85,0.85);
  leg.AddEntry(data_site1, " EH1", "lp");
  leg.AddEntry(acc_site1, " Acc. Bkgd", "f");
  leg.SetFillColor(kWhite);
  leg.Draw();
  can_1->Modified();
  c1.cd();

  can_2->Draw();
  can_2->cd();
  can_2->SetTopMargin(1e-05);
  can_2->SetBottomMargin(1e-05);
  can_2->SetFrameBorderMode(0);
  can_2->SetBorderMode(0);
  data_site2->Draw();
  hs_site2->Draw("same");
  data_site2->SetTitle("");
  // data_site2->Draw("same");
  // pred_site2->Draw("same");
  data_site2->GetXaxis()->SetLabelSize(0.09);
  data_site2->GetYaxis()->SetNdivisions(508);
  data_site2->GetYaxis()->SetTitleSize(0.08);
  data_site2->GetYaxis()->SetLabelSize(0.08);
  data_site2->GetYaxis()->SetTitleOffset(0.6);
  data_site2->GetYaxis()->CenterTitle(true);
  TLegend leg2(0.65,0.85-0.20,0.85,0.85);
  leg2.AddEntry(data_site2, " EH2", "lp");
  leg2.AddEntry(acc_site2, " Acc. Bkgd", "f");
  leg2.SetFillColor(kWhite);
  leg2.Draw();
  can_2->Modified();
  c1.cd();

  can_3->Draw();
  can_3->cd();
  can_3->SetTopMargin(1e-05);
  can_3->SetFrameBorderMode(0);
  can_3->SetBottomMargin(0.3);
  can_3->SetBorderMode(0);
  data_site3->Draw();
  hs_site3->Draw("same");
  data_site3->SetTitle("");
  // data_site3->Draw("same");
  // pred_site3->Draw("same");
  data_site3->GetXaxis()->SetTitle("Reconstructed Energy [MeV]");
  data_site3->GetXaxis()->SetTitleSize(0.09);
  data_site3->GetXaxis()->SetTitleOffset(1.45);
  data_site3->GetXaxis()->SetLabelSize(0.09);
  data_site3->GetXaxis()->Draw();
  data_site3->GetYaxis()->SetNdivisions(508);
  data_site3->GetYaxis()->SetLabelSize(0.08);
  data_site3->GetYaxis()->SetTitleSize(0.08);
  data_site3->GetYaxis()->SetTitleOffset(0.6);
  data_site3->GetYaxis()->CenterTitle(true);
  can_3->RedrawAxis();
  TLegend leg3(0.65,0.85-0.20,0.85,0.85);
  leg3.AddEntry(data_site3, " EH3", "lp");
  leg3.AddEntry(acc_site3, " Acc. Bkgd", "f");
  leg3.SetFillColor(kWhite);
  leg3.Draw();
  can_3->Modified();
  c1.cd();

  TString name("SpectraSite");
  // print 3 figures by default
  c1.SaveAs(name + ".eps");
  c1.SaveAs(name + ".pdf");
  c1.SaveAs(name + ".png");

  TString extra(type);
  if (! (extra == "eps" || extra == "pdf" || extra == "png")) {
    c1.SaveAs(name + "." + type);
  }
}
コード例 #4
0
void excludedRegionStop() {

  double stopMass = 173.0; // used for limit plots

  double data[32]  = { 70.,     470,    450,     30,   21,  60,   42,
		       100.,	530.,   480.,    38,   23,  70,   46,
		       150.,	550,    500.,    45,   25,  90,   50,
		       200.,	550,    510.,    36,   25,  72,   50};
	
  double e[4]           = { data[0], data[7], data[14], data[21] };
  double obs[4]         = { data[1], data[8], data[15], data[22]  };
  double exp[4]         = { data[2], data[9], data[16], data[23]  };
  double exp_1sig_hi[4] = { data[3], data[10], data[17], data[24]  };
  double exp_1sig_lo[4] = { data[4], data[11], data[18], data[25]  };
  double exp_2sig_hi[4] = { data[5], data[12], data[19], data[26]  };
  double exp_2sig_lo[4] = { data[6], data[13], data[20], data[27]  };
  
  double e_g[4]       = {175., 200., 300., 360. };
  
  cout << "Energy thresholds : " << e[0] << ", " << e[1] << ", " << e[2] << ", " << e[3] << std::endl;
  cout << "Obs limit         : " << obs[0] << ", " << obs[1] << ", " << obs[2] << ", " << obs[3] << std::endl;
  cout << "Exp limit         : " << exp[0] << ", " << exp[1] << ", " << exp[2] << ", " << exp[3] << std::endl;
  
  // plot as fn of E_cut
  TGraphAsymmErrors g_exp_1sig(4, &e[0], &exp[0], 0, 0, &exp_1sig_lo[0], &exp_1sig_hi[0]);
  TGraphAsymmErrors g_exp_2sig(4, &e[0], &exp[0], 0, 0, &exp_2sig_lo[0], &exp_2sig_hi[0]);
  TGraph g_exp(4, &e[0], &exp[0]); 
  TGraph g_obs(4, &e[0], &obs[0]); 
  // exclusion in m_stop, m_neutralino plane
	
  double m_chi0[100];
  double m_chi0sq[100];
  for (int i=0; i<100; i++) {
    m_chi0[i] = i*10;
    m_chi0sq[i] = (i*10)*(i*10);
  }
  
  
  // observed exclusion
  double obsExcl70[100];
  double obsExcl100[100];
  double obsExcl150[100];
  double obsExcl200[100];
  double obsExclFull[100];
  int npoints70=0;
  int npoints100=0;
  int npoints150=0;
  int npoints200=0;
  int npointsFull=0;

  int start70 = 0;
  int start100 = 0;
  int start150 = 0;
  int start200 = 0;
  int startFull = 0;

  for (int i=0; i<100; ++i) {
    double tmp = e_g[0] + sqrt(e_g[0]*e_g[0] + m_chi0sq[i]-stopMass*stopMass);
    if (isnan(tmp)) {
      start70 = i + 1;
      continue;
    }
    obsExcl70[i] = tmp;
   if (obsExcl70[i]>obs[0]) break;	
    npoints70++;
  }
  	
  for (int i=0; i<100; ++i) {
    double tmp = e_g[1] + sqrt(e_g[1]*e_g[1] + m_chi0sq[i]-stopMass*stopMass);
    if (isnan(tmp)) {
      start100 = i + 1;
      continue;
    }
    obsExcl100[i] = tmp;
    if (obsExcl100[i]>obs[1]) break;	
    npoints100++;
  }	
  
  // For small values of m_chi0, on-shell top mass is fine. 
  // But as m_chi0 increases, we need to decrease the top mass (take it off-shell)
  // Starting off-shell means that the calculated stop mass is larger than the limit
  for (int i=0; i<100; ++i) {
    double tmp = e_g[2] + sqrt(e_g[2]*e_g[2] + m_chi0sq[i]-stopMass*stopMass);
    if (isnan(tmp)) {
      start150 = i + 1;
      continue;
    }
    obsExcl150[i] = tmp;
    if (obsExcl150[i]>obs[2]) break;
    npoints150++;
  }
  
  for (int i=0; i<100; ++i) {
    double tmp = e_g[3] + sqrt(e_g[3]*e_g[3] + m_chi0sq[i]-stopMass*stopMass);
    if (isnan(tmp)) {
      start200 = i + 1;
      continue;
    }
    obsExcl200[i] = tmp;
    if (obsExcl200[i]>obs[2]) break;	
    npoints200++;	
  }

  for (int i=0; i<100; ++i) {
    double tmp = e_g[0] + sqrt(e_g[0]*e_g[0] + m_chi0sq[i]-stopMass*stopMass);
    if (isnan(tmp)) {
      startFull = i + 1;
      continue;
    }
    obsExclFull[i] = tmp;
    if (obsExclFull[i]>obs[1]) break;	
    npointsFull++;	
  }

	
	
  TGraph g_obsExcl70(npoints70+1, &m_chi0[start70], &obsExcl70[start70]);
  g_obsExcl70.SetPoint(npoints70, 0., obs[0]);
  TGraph g_obsExcl100(npoints100+1, &m_chi0[start100], &obsExcl100[start100]);
  g_obsExcl100.SetPoint(npoints100, 0., obs[1]);
  TGraph g_obsExcl150(npoints150+1, &m_chi0[start150], &obsExcl150[start150]);
  g_obsExcl150.SetPoint(npoints150, 0., obs[2]);
  TGraph g_obsExcl200(npoints200+1, &m_chi0[start200], &obsExcl200[start200]);
  g_obsExcl200.SetPoint(npoints200, 0., obs[3]);
  TGraph g_obsExclFull(npointsFull+1, &m_chi0[startFull], &obsExclFull[startFull]);
  g_obsExclFull.SetPoint(npointsFull, 0., obs[1]);


  TCanvas canvas3("excludedRegionStop", "");


  //-------------------------
  // MAKE ALL THE TEXT BLURBS
  //-------------------------
  TH1F h3("h3", "", 1, 0., 500.);
  h3.SetStats (0);
  h3.SetMinimum (0);
  h3.SetMaximum (600);
  h3.GetXaxis()->SetTitle("m_{#tilde{#chi}^{0}} [GeV]");
  h3.GetYaxis()->SetTitle("m_{#tilde{t}}   [GeV]  ");
  h3.Draw();

  TGraph disallowed(4);
  disallowed.SetPoint(0, 0., 0.);
  disallowed.SetPoint(1, 30000., 30000.);
  disallowed.SetPoint(2, 30000., 0.);
  //disallowed.SetPoint(3, 0., 0.);
  disallowed.SetFillColor(kGray);
  disallowed.SetFillStyle(3001);
  disallowed.Draw("FL");

  TText dislabel(0.65, 0.45, "Kinematically forbidden");
  dislabel.SetNDC(true);
  dislabel.SetTextFont(42);
  dislabel.SetTextSize(0.033);
  dislabel.SetTextAngle(30.2); //638 by 372
  dislabel.Draw();

  //	TPaveText blurb3(0.48, 0.15, 0.6, 0.37, "NDC");
  TPaveText blurb3(0.52, 0.15, 0.72, 0.37, "NDC");
  blurb3.AddText("CMS 2012");
  blurb3.AddText("#int L dt = 18.6 fb^{-1}");//,  #int L_{eff} dt = 935 pb^{-1}");
  //blurb3.AddText("L^{max}_{inst} = 3.5 #times 10^{33} cm^{-2}s^{-1}");
  blurb3.AddText("#sqrt{s} = 8 TeV");
  //blurb3.AddText("95% CL Exclusion contours");
  blurb3.SetTextFont(42);
  blurb3.SetBorderSize(0);
  blurb3.SetFillColor(kGray);
  blurb3.SetFillStyle(4001);
  blurb3.SetShadowColor(0);
  blurb3.SetTextAlign(12);
  blurb3.SetTextSize(0.033);
  blurb3.Draw();	
	
  TLegend leg3(0.72, 0.15, 0.92, 0.37,"95% CL Excluded","NDC");
  leg3.SetTextSize(0.033);
  leg3.SetBorderSize(0);
  leg3.SetTextFont(42);
  leg3.SetFillColor(kGray);
  leg3.SetFillStyle(4001);
  leg3.AddEntry(&g_obsExcl70, "E_{thresh} > 70 GeV", "lf");
  leg3.AddEntry(&g_obsExcl100, "E_{thresh} > 100 GeV", "lf");
  //leg3.AddEntry(&g_obsExcl150, "E_{thresh} > 150 GeV", "lf");
  //leg3.AddEntry(&g_obsExcl200, "E_{thresh} > 200 GeV", "lf");
  leg3.Draw();

  //----------------------
  //FORMAT AND DRAW GRAPHS
  //----------------------
  g_obsExclFull.SetLineWidth(302);
  g_obsExclFull.SetFillColor(kYellow);
  g_obsExclFull.SetLineColor(kYellow);
  //g_obsExclFull.Draw("f");

  TGraph* g_obs70y = (TGraph*)g_obsExcl70.Clone("70y");
  g_obs70y->SetFillColor(kYellow);
  g_obs70y->Draw("f");
  TGraph* g_obs100y = (TGraph*)g_obsExcl100.Clone("100y");
  g_obs100y->SetFillColor(kYellow);
  g_obs100y->Draw("f");
  
  g_obsExcl70.SetLineWidth(302);
  g_obsExcl70.SetFillStyle(3004);
  g_obsExcl70.SetFillColor(kGreen+2);
  g_obsExcl70.SetLineColor(kGreen+2);
  g_obsExcl70.Draw();
	
  g_obsExcl100.SetLineWidth(302);
  g_obsExcl100.SetFillStyle(3004);
  g_obsExcl100.SetFillColor(kBlue);
  g_obsExcl100.SetLineColor(kBlue);
  g_obsExcl100.Draw();
	
  g_obsExcl150.SetLineWidth(302);
  g_obsExcl150.SetFillStyle(3004);
  g_obsExcl150.SetFillColor(kBlack);
  g_obsExcl150.SetLineColor(kBlack);
  //g_obsExcl150.Draw();
	
  g_obsExcl200.SetLineWidth(302);
  g_obsExcl200.SetFillStyle(3005);
  g_obsExcl200.SetFillColor(kRed);
  g_obsExcl200.SetLineColor(kRed);
  //g_obsExcl200.Draw();
	
  TLatex t1(0.50, 0.44, "E_{thresh} > 70 GeV");
  t1.SetNDC(true);
  t1.SetTextFont(42);
  t1.SetTextSize(0.03);
  t1.SetTextAngle(25);
  t1.SetTextColor(kGreen+2);
  //t1.Draw();
	
  TLatex t2(0.36, 0.45, "E_{thresh} > 100 GeV");
  t2.SetNDC(true);
  t2.SetTextFont(42);
  t2.SetTextSize(0.03);
  t2.SetTextAngle(22);
  t2.SetTextColor(kBlue);
  //t2.Draw();
	
	
  TLatex t3(0.29, 0.55, "E_{thresh} > 150 GeV");
  t3.SetNDC(true);
  t3.SetTextFont(42);
  t3.SetTextSize(0.03);
  t3.SetTextAngle(14);
  t3.SetTextColor(kBlack);
  //t3.Draw();

  TLatex t4(0.2, 0.69, "E_{thresh} > 200 GeV");
  t4.SetNDC(true);
  t4.SetTextFont(42);
  t4.SetTextSize(0.03);
  t4.SetTextAngle(5);
  t4.SetTextColor(kRed);
  //t4.Draw();
			
  h3.Draw("sameaxis");
	
  canvas3.Print("excludedRegionStop.pdf");
	
}
コード例 #5
0
ファイル: Monitoring.cpp プロジェクト: ANNIEDAQ/ANNIEDAQ
void* Monitoring::MonitorThread(void* arg){
  
  //std::cout<<"d1"<<std::endl;
  monitor_thread_args* args= static_cast<monitor_thread_args*>(arg);  

  std::string outpath=args->outputpath;
  zmq::socket_t Ireceive (*(args->context), ZMQ_PAIR);
  Ireceive.connect("inproc://MonitorThread");
  
  //  std::vector<CardData*> carddata;

  std::map<int,std::vector<TH1F> > PedTime;
  std::map<int,std::vector<TH1F> > PedRMSTime;
  std::vector<TH1F> rates;
  std::vector<TH1F> averagesize;

  std::vector<TH1I> tfreqplots;
  std::map<int,std::vector<std::vector<float > > > pedpars;
  TCanvas c1("c1","c1",600,400);
  
  
  bool running=true;
  bool init=true;    

  std::vector<PMT> PMTInfo;
  /////////////////// Connect to sql ///////////////////////
//std::cout<<"d2"<<std::endl;

  pqxx::connection *C;
  std::stringstream tmp;
  tmp<<"dbname=annie"<<" hostaddr=127.0.0.1"<<" port=5432" ;
  C=new pqxx::connection(tmp.str().c_str());
  if (C->is_open()) {
    // std::cout << "Opened database successfully: " << C->dbname() << std::endl;
  }
  else {
    std::cout << "Can't open database" << std::endl;
    return false;
  }

  tmp.str("");

  pqxx::nontransaction N(*C);

  tmp<<"select gx,gy,gz,vmecard,vmechannel from pmtconnections order by channel; ";


  /* Execute SQL query */
  pqxx::result R( N.exec( tmp.str().c_str() ));

  //pqxx::result::const_iterator c = R.begin();


  ///////// Fill PMT Info//////////////// 
  for ( pqxx::result::const_iterator c = R.begin(); c != R.end(); ++c) {

    PMT tmp;
    tmp.gx= c[0].as<int>();
    tmp.gy= c[1].as<int>();
    tmp.gz= c[2].as<int>();
    tmp.card= c[3].as<int>();
    tmp.channel= c[4].as<int>()-1;
    PMTInfo.push_back(tmp);
  }

//std::cout<<"d3"<<std::endl;

  
  while (running){
    //std::cout<<"d4"<<std::endl;

    
    zmq::message_t comm;
    Ireceive.recv(&comm);
	
    std::istringstream iss(static_cast<char*>(comm.data()));
    std::string arg1="";
    iss>>arg1;

    //std::cout<<"d5"<<std::endl;
    

    if(arg1=="Data"){

      ////////// Setting up plots/////////
      std::vector<TGraph2D*> mg;
      TH2I EventDisplay ("Event Display", "Event Display", 10, -1, 8, 10, -1, 8);
      TH2I RMSDisplay ("RMS Display", "RMS Display", 10, -1, 8, 10, -1, 8);
      std::vector<TH1F> temporalplots;
      std::vector<TH1I> freqplots;
      CardData* carddata;
      int size=0;
      iss>>size;  
      
      //freqplots.clear();
  //std::cout<<"d6"<<std::endl;
  
      for(int i=0;i<size;i++){
	//std::cout<<"d7"<<std::endl;

	long long unsigned int pointer;
	iss>>std::hex>>pointer;
	
	carddata=(reinterpret_cast<CardData *>(pointer));
	
	if(init){ ////make initial freq  plot and ped vector ped time and ped rms////
	  for(int j=0;j<carddata->channels;j++){
	    std::stringstream tmp;
	    tmp<<"Channel "<<(i*4)+j<<" frequency";
	    TH1I tmpfreq(tmp.str().c_str(),tmp.str().c_str(),10,0,9);
	    tfreqplots.push_back(tmpfreq);

	    tmp.str("");
	    tmp<<"Channel "<<(i*4)+j<<" Pedistal";
	    TH1F tmppedtime(tmp.str().c_str(),tmp.str().c_str(),100,0,99);
	    PedTime[carddata->CardID].push_back(tmppedtime);

	    tmp.str("");
	    tmp<<"Channel "<<(i*4)+j<<" Pedistal RMS";
	    TH1F tmppedrmstime(tmp.str().c_str(),tmp.str().c_str(),100,0,99);
	    PedRMSTime[carddata->CardID].push_back(tmppedrmstime);
	    std::vector<float> tmppedpars;
	    tmppedpars.push_back(0);
	    tmppedpars.push_back(0);
	    pedpars[carddata->CardID].push_back(tmppedpars);
	  }
	  if(i==size-1)init=false;
	}

	//std::cout<<"d8"<<std::endl;

	//	std::cout<<"d1"<<std::endl;

	///////Make temporal plot //////////
	for(int j=0;j<carddata->channels;j++){
	  std::stringstream tmp;
	  tmp<<"Channel "<<(i*4)+j<<" temporal";
	  
	  TH1F temporal(tmp.str().c_str(),tmp.str().c_str(),carddata->buffersize,0,carddata->buffersize-1);
	  long sum=0;

	  //////////Make freq plot///////////////
	  tmp.str("");
	  tmp<<"Channel "<<(i*4)+j<<" frequency";
	  TH1I freq(tmp.str().c_str(),tmp.str().c_str(),200,200,399);

	
	  //  std::cout<<"d2"<<std::endl;

	  //std::cout<<"d9"<<std::endl;

	
	  ///// Calculate sum for event dispkay and fill freq plots /////////


	for(int k=0;k<carddata->buffersize;k++){
	  //std::cout<<"d10"<<std::endl;

	  //	  std::cout<<"i="<<i<<" j="<<j<<std::endl;
	  //std::cout<<"d2.5 "<<(i*4)+j<<" feqplot.size = "<<freqplots.size()<<std::endl;
	  if(carddata->Data[(j*carddata->buffersize)+k]>pedpars[carddata->CardID].at(j).at(0)+(pedpars[carddata->CardID].at(j).at(1)*5))sum+=carddata->Data[(j*carddata->buffersize)+k];  
	  freq.Fill(carddata->Data[(j*carddata->buffersize)+k]);

	  //temporal.SetBinContent(k,carddata->Data[(j*carddata->buffersize)+k]);	      
	}

	freqplots.push_back(freq);
	//////// find pedistall fill ped temporals//////////
	freq.Fit("gaus");
	TF1 *gaus = freq.GetFunction("gaus");
        pedpars[carddata->CardID].at(j).at(0)=(gaus->GetParameter(1));
        pedpars[carddata->CardID].at(j).at(1)=(gaus->GetParameter(2));
	gaus->SetLineColor(j+1);
       
	//std::cout<<"d11"<<std::endl;

	for(int bin=99;bin>0;bin--){
	  PedTime[carddata->CardID].at(j).SetBinContent(bin,PedTime[carddata->CardID].at(j).GetBinContent(bin-1));
	  PedRMSTime[carddata->CardID].at(j).SetBinContent(bin,PedRMSTime[carddata->CardID].at(j).GetBinContent(bin-1));
	}
	PedTime[carddata->CardID].at(j).SetBinContent(0, pedpars[carddata->CardID].at(j).at(0));
	PedRMSTime[carddata->CardID].at(j).SetBinContent(0, pedpars[carddata->CardID].at(j).at(1));

	//////// fill temporal plot/////////
	for(int k=0;k<carddata->buffersize/4;k++){
	  //std::cout<<"d12"<<std::endl;

          //std::cout<<"j*4 = "<<j*4<<std::endl;
          //std::cout<<"(i*BufferSize)+(j*4) = "<<(i*BufferSize)+(j*4)<<std::endl;
          //std::cout<<"i*BufferSize)+(j*4)+(BufferSize/2) = "<<(i*BufferSize)+(j*4)+(BufferSize/2)<<std::endl;
          //std::cout<<"(i*BufferSize)+(j*4)+(BufferSize/2)+1 = "<<(i*BufferSize)+(j*4)+(BufferSize/2)+1<<std::endl;
	  int offset=pedpars[carddata->CardID].at(j).at(0);
          double conversion=2.415/pow(2.0, 12.0);
	  temporal.SetBinContent(k*4,(carddata->Data[(j*carddata->buffersize)+(k*2)]-offset)*conversion);
	  temporal.SetBinContent((k*4)+1,(carddata->Data[(j*carddata->buffersize)+(k*2)+1]-offset)*conversion);
	  temporal.SetBinContent((k*4)+2,(carddata->Data[(j*carddata->buffersize)+(k*2)+(carddata->buffersize/2)]-offset)*conversion);
	  temporal.SetBinContent((k*4)+3,(carddata->Data[(j*carddata->buffersize)+(k*2)+(carddata->buffersize/2)+1]-offset)*conversion);

        }

	//std::cout<<"d13"<<std::endl;

	//std::cout<<"d3"<<std::endl;
	
	temporalplots.push_back(temporal);


	////// find x,y,z fill event display /////////
	int x=-10;
	int z=-10;
	int y=-10;
	for(int pmt=0;pmt<PMTInfo.size();pmt++){
	  //std::cout<<"d4"<<std::endl;

	  if(PMTInfo.at(pmt).card==carddata->CardID && PMTInfo.at(pmt).channel==j){
	    x=PMTInfo.at(pmt).gx;
	    z=PMTInfo.at(pmt).gz;
	    y=PMTInfo.at(pmt).gy;
	    //std::cout<<"d15"<<std::endl;
	  
}
	}

	/*
	int x=(((i*4)+j)%8);
	int y=(floor(((i*4)+j)/8.0));
	if(x==0 && y==0){x=-10;y=-10;}
	if(x==7 && y==0){x=-10;y=-10;}
	if(x==0 && y==7){x=-10;y=-10;}
	if(x==7 && y==7){x=-10;y=-10;}
	if (y>7){x=-10;y=-10;}
	std::cout<<"i="<<i<<" j="<<j<<" (i*4)+j)="<<((i*4)+j)<<" x="<<x<<" y="<<y<<" sum="<<sum<<std::endl;
	EventDisplay.SetBinContent(x+1,y+1,sum);
	//EventDisplay.SetBinContent(((i*4)+j),sum);
	*/
	//std::cout<<"d16"<<std::endl;

	if(x!=-10 && z!=-10){
	  //std::cout<<"d17"<<std::endl;

	  //std::cout<<"gx = "<<x<<" , gz="<<z<<std::endl;
	  EventDisplay.SetBinContent(x+2,z+2,sum);
	  RMSDisplay.SetBinContent(x+2,z+2,gaus->GetParameter(2)*100);

	  //// Attempted 2ne event display ///
	  TGraph2D *dt=new TGraph2D(1);
	  dt->SetPoint(0,x,z,z);
	  dt->SetMarkerStyle(20);
	  //dt->GetXaxis()->SetRangeUser(-1,8);
	  // dt->GetYaxis()->SetRangeUser(-1,8);
	  //dt->GetZaxis()->SetRangeUser(-1,8);
	  mg.push_back(dt);
	}	
	
	}
	
	//std::cout<<"d18"<<std::endl;

	

	///////Find max freq for scaling//////////

	int maxplot=0;
	long maxvalue=0;
	
	//std::cout<<"i="<<i<<" (i*4)="<<(i*4)<<" (i*4)+4="<<(i*4)+4<<" size="<<freqplots.size()<<std::endl;
	for(int j=(i*4);j<(i*4)+4;j++){
	  if (freqplots.at(j).GetMaximum()>maxvalue){
	    //std::cout<<"d19"<<std::endl;
	 
   maxvalue=freqplots.at(j).GetMaximum();
	    maxplot=j;
	  }
	}
	

	//std::cout<<"d20"<<std::endl;

	////////Find current time and plot frewuency plot

	time_t t = time(0);   // get time now
	struct tm * now = localtime( & t );
	std::stringstream title;
	title<<"Card "<<carddata->CardID<<" frequency: "<<(now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' <<  now->tm_mday<<','<<now->tm_hour<<':'<<now->tm_min<<':'<<now->tm_sec;
	//std::cout<<"d21"<<std::endl;
	freqplots.at(maxplot).SetTitle(title.str().c_str());
	freqplots.at(maxplot).GetXaxis()->SetTitle("ADC Value");
	freqplots.at(maxplot).GetYaxis()->SetTitle("Frequency");	
	freqplots.at(maxplot).SetLineColor((maxplot%4)+1);
	freqplots.at(maxplot).Draw();
	TLegend leg(0.8,0.4,1.0,0.7);
	//leg.SetHeader("The Legend Title");
	
	//std::cout<<"d22"<<std::endl;
for(int j=(i*4);j<(i*4)+4;j++){
  //std::cout<<"d23"<<std::endl;
	  std::stringstream legend;
	  legend<<"Channel "<<j-(i*4);
	  leg.AddEntry(&freqplots.at(j),legend.str().c_str(),"l");	  
	  freqplots.at(j).SetLineColor((j%4)+1);
	  if(j==maxplot){;}//freqplots.at(i).Draw();                                  
	  else freqplots.at(j).Draw("same");
	  
	}
	leg.Draw();
	//std::cout<<"d24"<<std::endl;
	std::stringstream tmp;
	tmp<<outpath<<carddata->CardID<<"freq.jpg";
	c1.SaveAs(tmp.str().c_str());


	//std::cout<<"d25"<<std::endl;



	///////find max tmporal plot for scaling
	
	///temporal
	maxplot=0;
	maxvalue=0;

	//std::cout<<"i="<<i<<" (i*4)="<<(i*4)<<" (i*4)+4="<<(i*4)+4<<" size="<<freqplots.size()<<std::endl;
        for(int j=(i*4);j<(i*4)+4;j++){
	  //std::cout<<"d26"<<std::endl;
          if (temporalplots.at(j).GetMaximum()>maxvalue){
            maxvalue=temporalplots.at(j).GetMaximum();
            maxplot=j;
          }
        }

	//std::cout<<"d27"<<std::endl;


	//////// Find time and plot temporal plot

	t = time(0);   // get time now
        now = localtime( & t );
	std::stringstream title2;
        title2<<"Card "<<carddata->CardID<<" Temporal: "<<(now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' <<  now->tm_mday<<','<<now->tm_hour<<':'<<now->tm_min<<':'<<now->tm_sec;
	//std::cout<<"d28"<<std::endl;
        temporalplots.at(maxplot).SetTitle(title2.str().c_str());
	temporalplots.at(maxplot).GetXaxis()->SetTitle("Samples");
	temporalplots.at(maxplot).GetYaxis()->SetTitle("Volate (V)");
        temporalplots.at(maxplot).SetLineColor((maxplot%4)+1);
        temporalplots.at(maxplot).Draw();
	TLegend leg2(0.8,0.4,1.0,0.7);
	//std::cout<<"d29"<<std::endl;
	for(int j=(i*4);j<(i*4)+4;j++){
	  //std::cout<<"d30"<<std::endl;
	  std::stringstream legend;
	  legend<<"Channel "<<j-(i*4);	  
	  leg2.AddEntry(&temporalplots.at(j),legend.str().c_str(),"l");
	  temporalplots.at(j).SetLineColor((j%4)+1);
	  if(j==0){;}
	  else temporalplots.at(j).Draw("same");

	}
	//std::cout<<"d31"<<std::endl;
	leg2.Draw();
	//std::cout<<"d6"<<std::endl;

	std::stringstream tmp2;
	tmp2<<outpath<<carddata->CardID<<"temporal.jpg";
	c1.SaveAs(tmp2.str().c_str());
	//std::cout<<"d32"<<std::endl;


	///////plotting PED time and ped rms time //////
        maxplot=0;
        maxvalue=0;

      
        for(int j=0;j<4;j++){
          //std::cout<<"d26"<<std::endl;
          if ( PedTime[carddata->CardID].at(j).GetMaximum()>maxvalue){
            maxvalue=PedTime[carddata->CardID].at(j).GetMaximum();
            maxplot=j;
          }
        }

	t = time(0);   // get time now
        now = localtime( & t );
	title2.str("");
        title2<<"Card "<<carddata->CardID<<" Pedistal Variation: "<<(now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' <<  now->tm_mday<<','<<now->tm_hour<<':'<<now->tm_min<<':'<<now->tm_sec;
        //std::cout<<"d28"<<std::endl;
        PedTime[carddata->CardID].at(maxplot).SetTitle(title2.str().c_str());
	PedTime[carddata->CardID].at(maxplot).GetXaxis()->SetTitle("Samples");
	PedTime[carddata->CardID].at(maxplot).GetYaxis()->SetTitle("ADC Value");
	PedTime[carddata->CardID].at(maxplot).SetLineColor((maxplot%4)+1);
	PedTime[carddata->CardID].at(maxplot).Draw();
        TLegend leg3(0.8,0.4,1.0,0.7);
        //std::cout<<"d29"<<std::endl;
	for(int j=0;j<4;j++){
          //std::cout<<"d30"<<std::endl;
	  std::stringstream legend;
          legend<<"Channel "<<j;
          leg3.AddEntry(&PedTime[carddata->CardID].at(j),legend.str().c_str(),"l");
	  PedTime[carddata->CardID].at(j).SetLineColor((j%4)+1);
          PedTime[carddata->CardID].at(j).Draw("same");

        }
        //std::cout<<"d31"<<std::endl;
        leg3.Draw();
        //std::cout<<"d6"<<std::endl;

	tmp2.str("");
	tmp2<<outpath<<"plots2/"<<carddata->CardID<<"PedTime.jpg";
	c1.SaveAs(tmp2.str().c_str());



	PedRMSTime[carddata->CardID].at(0).Draw();
	for (int channel=1;channel<4;channel++){
	  PedRMSTime[carddata->CardID].at(channel).Draw("same");
	}
	tmp2.str("");
	tmp2<<outpath<<"plots2/"<<carddata->CardID<<"PedRMSTime.jpg";
	c1.SaveAs(tmp2.str().c_str());

	delete carddata;

	
      } /// size i
      
      /*
      //std::cout<<"d4"<<std::endl;

      int maxplot=0;
      long maxvalue=0;
      for(int i=0;i<freqplots.size();i++){
	if (freqplots.at(i).GetMaximum()>maxvalue){
	  maxvalue=freqplots.at(i).GetMaximum();
	  maxplot=i;
	}
      }

      freqplots.at(maxplot).SetLineColor(maxplot+1);
      freqplots.at(maxplot).Draw();
      for(int i=0;i<freqplots.size();i++){

	//	Double_t scale = 1/freqplots.at(i).GetMaximum();
	//	freqplots.at(i).Scale(scale);
	freqplots.at(i).SetLineColor(i+1);
	if(i==maxplot);//freqplots.at(i).Draw();
	else freqplots.at(i).Draw("same");

	//freqplots.at(i).Scale((1.0/scale));
      }
      std::cout<<"d5"<<std::endl;

      std::stringstream tmp;
      tmp<<outpath<<"freq.jpg";
      c1.SaveAs(tmp.str().c_str());
      
      for(int i=0;i<temporalplots.size();i++){
	temporalplots.at(i).SetLineColor(i+1);
	if(i==0)temporalplots.at(i).Draw();
	else temporalplots.at(i).Draw("same");
	
      }	  

      std::cout<<"d6"<<std::endl;

      std::stringstream tmp2;
      tmp2<<outpath<<"temporal.jpg";
      c1.SaveAs(tmp2.str().c_str());
      */
      //std::cout<<"d33"<<std::endl;


      /////////plot event display /////////

      EventDisplay.Draw("COLZ");
      std::stringstream tmp3;
      tmp3<<outpath<<"0EventDisplay.jpg";
      c1.SaveAs(tmp3.str().c_str());
      

      //std::cout<<"d34 ="<<mg.size()<<std::endl;

/////////plot RMS display /////////
      RMSDisplay.Draw("COLZ");
      tmp3.str("");
      tmp3<<outpath<<"0RMSDisplay.jpg";
      c1.SaveAs(tmp3.str().c_str());

      ///plot  atempted 3d event display///////

      tmp3.str("");
      if(mg.size()>0)      mg.at(0)->Draw();
      for(int plots=1;plots<mg.size();plots++){
	mg.at(plots)->Draw("same");
	//std::cout<<"d35"<<std::endl;
      }
      tmp3<<outpath<<"0EventDisplay3D.jpg";
      //c1.SaveAs(tmp3.str().c_str());





    }
    
    
    
    else if(arg1=="Quit"){