Пример #1
0
void gtime2(Int_t nsteps = 200, Int_t np=5000) {
   if (np > 5000) np = 5000;
   Int_t color[5000];
   Double_t cosphi[5000], sinphi[5000], speed[5000];
   TRandom3 r;
   Double_t xmin = 0, xmax = 10, ymin = -10, ymax = 10;
   TGraphTime *g = new TGraphTime(nsteps,xmin,ymin,xmax,ymax);
   g->SetTitle("TGraphTime demo 2;X;Y");
   Int_t i,s;
   Double_t phi,fact = xmax/Double_t(nsteps);
   for (i=0;i<np;i++) { //calculate some object parameters
      speed[i]  = r.Uniform(0.5,1);
      phi       = r.Gaus(0,TMath::Pi()/6.);
      cosphi[i] = fact*speed[i]*TMath::Cos(phi);
      sinphi[i] = fact*speed[i]*TMath::Sin(phi);
      Double_t rc = r.Rndm();
      color[i] = kRed;
      if (rc > 0.3) color[i] = kBlue;
      if (rc > 0.7) color[i] = kYellow;
   }
   for (s=0;s<nsteps;s++) { //fill the TGraphTime step by step
      for (i=0;i<np;i++) {
         Double_t xx = s*cosphi[i];
         if (xx < xmin) continue;
         Double_t yy = s*sinphi[i];
         TMarker *m = new TMarker(xx,yy,25);
         m->SetMarkerColor(color[i]);
         m->SetMarkerSize(1.5 -s/(speed[i]*nsteps));
         g->Add(m,s);
      }
      g->Add(new TPaveLabel(.70,.92,.98,.99,Form("shower at %5.3f nsec",3.*s/nsteps),"brNDC"),s);
   }
   g->Draw();
}
Пример #2
0
void DrawLabel(TString txt, double x, double y, int mstyle, int col, double msize) {
  TMarker *m = new TMarker(x,y,mstyle);
  m->SetNDC();
  m->SetMarkerSize(msize); m->SetMarkerColor(col);
  TLine *l = new TLine();
  l->SetLineWidth(2); l->SetLineColor(col);
  m->Draw();
  tex->SetTextSize(0.04);
  tex->SetTextAlign(12); tex->SetTextColor(col);
  tex->DrawLatex(x+0.025,y,txt);
  tex->SetTextColor(kBlack);
}
Пример #3
0
void drawEventRPhi(double vxlb, double vylb, double vxl0, double vyl0, double pmu1, double phimu1, double pmu2, double phimu2, double ppr, double phipr, double ppi, double phipi, int colors = 0)
{
    Color_t colMu1(1), colMu2(1), colPr(1), colPi(1), colL0(1), colLb(1);
    switch(colors)
    {
	case 0:
	    colLb=1; colL0=2; colMu1=2; colMu2=2; colPr=3; colPi=4; break;
	case 1:
	    colLb=11; colL0=50; colMu1=50; colMu2=50; colPr=8; colPi=9; break;
    }
    // draw the vertices
    TMarker *m;
    const double xlb = vxlb;
    const double ylb = vylb;
    m = new TMarker(xlb,ylb,7);
    m->SetMarkerColor(colLb);
    m->Draw();
    const double xl0 = vxl0;
    const double yl0 = vyl0;
    m = new TMarker(xl0,yl0,7);
    m->SetMarkerColor(colL0);
    m->Draw();
    // draw the l0 flight line
    TLine *l;
    l = new TLine(vxlb,vylb,vxl0,vyl0);
    l->SetLineColor(colL0);
    l->SetLineStyle(2);
    l->Draw();
    // draw the muons
    TArrow *a;
    const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(phimu1);
    const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(phimu1);
    a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">");
    a->SetLineColor(colMu1);
    a->Draw();
    const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(phimu2);
    const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(phimu2);
    a = new TArrow(xlb,ylb,xmu2,ymu2,.01,">");
    a->SetLineColor(colMu2);
    a->Draw();
    // draw the p and pi
    const double xpr = xl0 + scalepr * ppr * TMath::Cos(phipr);
    const double ypr = yl0 + scalepr * ppr * TMath::Sin(phipr);
    a = new TArrow(xl0,yl0,xpr,ypr,.01,">");
    a->SetLineColor(colPr);
    a->Draw();
    const double xpi = xl0 + scalepi * ppi * TMath::Cos(phipi);
    const double ypi = yl0 + scalepi * ppi * TMath::Sin(phipi);
    a = new TArrow(xl0,yl0,xpi,ypi,.01,">");
    a->SetLineColor(colPi);
    a->Draw();
}
Пример #4
0
// Draw on a given canvas the full set of working points
void   overlayWorkingPoints(TCanvas *c1, 
			    TTree *signalTree, TTree *backgroundTree, 
			    const TString *cutFileNames,
			    int markerColor, int markerStyle, 
			    TLegend *leg, const TString legendText){


  // Now loop over working points
  for(int iwp = 0; iwp<nWP; iwp++){
    
    // Load the working point from a ROOT file
    TFile *cutFile = new TFile(cutFileNames[iwp]);
    if( !cutFile )
      assert(0);
    VarCut *cutObject = (VarCut*)cutFile->Get("cuts");
    if( !cutObject )
      assert(0);
    
    // Compute the efficiencies
    float effSignal, effBackground;
    findEfficiencies(signalTree, backgroundTree, effSignal, effBackground,
		     cutObject);
    printf("Computed eff for cut from %s, effS= %.3f effB= %.3f\n",
	   cutFileNames[iwp].Data(), effSignal, effBackground);
    
    // Make a marker and draw it.
    TMarker *marker = new TMarker(effSignal, 1.0-effBackground, 20);
    marker->SetMarkerSize(2);
    marker->SetMarkerColor(markerColor);
    marker->SetMarkerStyle(markerStyle);
    marker->Draw("same");

    // Add marker to the legend only once. Do not draw the legend here,
    // it is drawn in the main function later
    if( iwp == 0 ){
      if( !leg )
	assert(0);
      leg->AddEntry(marker, legendText, "p");
    }

    c1->Update();
    
    cutFile->Close();
  }

  
}
void showHistogram1d(TH1* histogram, 
		     const std::string& xAxisTitle,
		     Float_t* genX, 
		     const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 800, 600);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);

  canvas->SetTopMargin(0.10);
  canvas->SetLeftMargin(0.16);
  canvas->SetRightMargin(0.14);
  canvas->SetBottomMargin(0.12);

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.15);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle("Sampling Points");
  yAxis->SetTitleOffset(1.60);

  histogram->SetLineColor(1);
  histogram->SetLineWidth(2);
  histogram->SetMarkerColor(1);
  histogram->SetMarkerStyle(20);
  histogram->Draw("e1p");

  TMarker* genMarker = 0;
  if ( genX ) {
    genMarker = new TMarker(*genX, 0.10, 34);
    genMarker->SetMarkerColor(1);
    genMarker->SetMarkerSize(2);
    genMarker->Draw();
  }

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());

  delete genMarker;
  delete canvas;  
}
Пример #6
0
void drawTransition(){
  TBox *bTrans = new TBox(0., 0., 0.97, 0.97);
  if(iColor)bTrans->SetFillColor(kYellow-9);
  if (! iColor)bTrans->SetFillStyle(4017);
  bTrans->Draw();

  TEllipse *eTrans1 = new TEllipse(0., 0., 0.9, 0.7, 70., 90., 0.);
  eTrans1->SetNoEdges();
  eTrans1->SetFillColor(17);
  eTrans1->SetLineWidth(2);
  eTrans1->SetLineStyle(7);
  eTrans1->Draw();

  TEllipse *eTrans2 = new TEllipse(0., 0., 0.9, 0.7, 0., 70., 0.);
  eTrans2->SetNoEdges();
  eTrans2->SetFillColor(17);
  eTrans2->SetLineWidth(2);
  eTrans2->Draw();

  TMarker *mCrit = new TMarker(0.29, 0.6625, 20);
  mCrit->SetMarkerSize(1.4);
  mCrit->Draw();
}
Пример #7
0
void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle, const char *text,Float_t msize)
{
  Double_t tsize=0.06;
  TMarker *marker = new TMarker(x-(0.4*tsize),y,8);
  marker->SetMarkerColor(color);  marker->SetNDC();
  marker->SetMarkerStyle(mstyle);
  marker->SetMarkerSize(msize);
  marker->Draw();

  TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize);
  l.SetNDC();
  l.DrawLatex(x,y,text);
}
Пример #8
0
void myMarkerText(Double_t x,Double_t y,Int_t color,Int_t mstyle,char *text) 
{
  //  printf("**myMarker: text= %s\ m ",text);

  Double_t tsize=0.06;
  TMarker *marker = new TMarker(x-(0.4*tsize),y,8);
  marker->SetMarkerColor(color);  marker->SetNDC();
  marker->SetMarkerStyle(mstyle);
  marker->SetMarkerSize(2.0);
  marker->Draw();

  TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize); 
  l.SetNDC();
  l.DrawLatex(x,y,text);
}
Пример #9
0
vector<TObject *> * mark_overflows(TH1F * histogram) {
  Double_t maximum_value = histogram->GetMaximum();
  Double_t minimum_value = histogram->GetMinimum();

  vector<TObject *> * overflow_markers = new vector<TObject *>();

  Float_t * bins = histogram->GetArray();
  Int_t number_of_bins = histogram->GetNbinsX();

  // note that the bins array has the following structure:
  // bins[0] is the underflow bin
  // bins[1] through bins[number_of_bins] are the actual bins
  // bins[number_of_bins + 1] is the overflow bin
  for(int j = 1; j <= number_of_bins; j++) {
    if (bins[j] > maximum_value || bins[j] < minimum_value) {
      Double_t x1 = histogram->GetXaxis()->GetBinLowEdge(j);
      Double_t x2 = histogram->GetXaxis()->GetBinUpEdge(j);

      TMarker * m = new TMarker();
      m->SetX((x2 + x1) / 2.0);
      m->SetMarkerColor(kRed);
      m->SetMarkerSize(MARKER_SIZE * 2);

      if(bins[j] > maximum_value) {
        m->SetY(maximum_value - MARKER_Y_SHIFT);
        m->SetMarkerStyle(22); // up arrow
      } else {
        m->SetY(minimum_value + MARKER_Y_SHIFT);
        m->SetMarkerStyle(23); // down arrow
      }

      overflow_markers->push_back(m);
    }
  }

  return overflow_markers;
}
Пример #10
0
// draw the same thing but after reco
void genPlots02(std::string fullPath, int nOverlay = 500, bool custBinning = false)
{
    const int fVerbose(1);
    setTDRStyle();
    gStyle->SetOptStat(112211);
    gStyle->SetPalette(1);
    // Canvas
    c = new TCanvas("c2","c2",1000,600);
    const unsigned int nPadX = 1;
    const unsigned int nPadY = 1;
    c->Divide(nPadX,nPadY);
    const unsigned int nPads=nPadX*nPadY;
    for(unsigned int i=1; i<=nPads; i++)
    {
	TPad* pad= (TPad*)c->cd(i);
	pad->SetTopMargin(0.10);
	pad->SetRightMargin(0.20);
	pad->SetLeftMargin(0.15);
    }
    // Open file
    TFile *f = TFile::Open(fullPath.c_str());
    if (f==0)
    {
	cout << "File " << fullPath << " not found -- exiting" << endl;
	return;
    }
    if(fVerbose>0)
	cout << "Succesfully opened file " << fullPath << endl;
    // Get TTree
    TTree* t = (TTree*) f->Get("events");
    if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;
    // Do a cut, if needed
    //t->Draw(">>lst","chi2lb>.1&&mlb>5.61&&mlb<5.63");
    //t->Draw(">>lst","chi2lb>.1&&isSig==1");
    t->Draw(">>lst","(rid1m&4)==4&&(rid2m&4)==4&&mjp>2.895&&mjp<3.295&&prob1m>0.1&&prob2m>0.1&&ptjp>2&&probjp>0.005&&ml0>1.101&&ml0<1.129&&probpr>0.02&&probpi>0.02&&rptpr>rptpi&&ptl0>3&&rptpr>1&&rptpi>0.5&&probl0>0.02&&alphal0<0.3&&d3l0>1&&d3l0/d3El0>10&&problb>0.001&&alphalb<0.3");
    TEventList *lst;
    lst = (TEventList*)gDirectory->Get("lst");
    t->SetEventList(lst);
    if(fVerbose>0) cout << "Got TTree with " << t->GetEntries() << " entries" << endl;

    // Do plots
    c->cd(1);
    //doPlot2d(t,"hrzL0vtx", "vrl0:TMath::Abs(vzl0)",30,0,300,30,0,120,"Tit","|z|","r","cm","cm");
    if (custBinning)
    {
	double newbinsX[]={0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50};
	const int newbinsX_size = sizeof(newbinsX)/sizeof(double);
	std::vector<double> binvecX(newbinsX,newbinsX+newbinsX_size);
	//double newbinsY[]={0,1,2,3,4,5,6,7,8,9,10};
	double newbinsY[]={0,0.5,1,2,4,8,16,32};
	const int newbinsY_size = sizeof(newbinsY)/sizeof(double);
	std::vector<double> binvecY(newbinsY,newbinsY+newbinsY_size);
	doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",binvecX, binvecY,"#Lambda vertices","|z|","r","cm","cm");
    }
    else
    {
	doPlot2d(t,"hrzL0vtxreco", "vrl0:TMath::Abs(vzl0)",30,0,50,30,0,30,"#Lambda vertices","|z|","r","cm","cm");
    }

    // add tracker
    TPad* pad;
    pad = (TPad*)c->cd(1);
    pad->Modified();
    pad->Update();
    repositionPalette("hrzL0vtxreco");
    pad->Update();
    pad->SetLogz();
    drawTracker(pad);

    if (nOverlay<=0) return;
    int maxN = nOverlay;
    if (maxN > t->GetEntries()) maxN = t->GetEntries();
    double vrl0,vzl0,ppr,ppi,etapr,etapi;
    t->SetBranchAddress("vrl0",&vrl0);
    t->SetBranchAddress("vzl0",&vzl0);
    t->SetBranchAddress("ppr",&ppr);
    t->SetBranchAddress("etapr",&etapr);
    t->SetBranchAddress("ppi",&ppi);
    t->SetBranchAddress("etapi",&etapi);
    double scalepr = 4;
    double scalepi = 8;

    { // reference indicator
	const double x1pr = 0; const double y1pr = -3;
	const double x2pr = scalepr; const double y2pr = y1pr;
	const double versatz = 14;
	const double x1pi = x1pr+versatz; const double y1pi = -3;
	const double x2pi = x2pr+versatz+scalepi; const double y2pi = y1pi;
	TArrow *a;
	a = new TArrow(x1pr,y1pr,x2pr,y2pr,.01,">");
	a->SetLineColor(24);
	a->Draw();
	TLatex tl;
	tl.SetTextSize(20);
	tl.SetTextFont(4);
	tl.DrawLatex(x1pr,y2pr-1.2,"p(p) / 1 GeV");
	a = new TArrow(x1pi,y1pi,x2pi,y2pi,.01,">");
	a->SetLineColor(20);
	a->Draw();
	tl.SetTextSize(20);
	tl.SetTextFont(4);
	tl.DrawLatex(x1pi,y2pi-1.2,"p(#pi) / 1 GeV");
    }
    for (int i = 0; i!=maxN; i++)
    {
	t->GetEntry(i);
	const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)));
	const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)));
	const double x1=TMath::Abs(vzl0);
	const double y1=vrl0;
	const double x2pr=x1+scalepr*ppr*TMath::Cos(thetapr);
	const double y2pr=y1+scalepr*ppr*TMath::Sin(thetapr);
	const double x2pi=x1+scalepi*ppi*TMath::Cos(thetapi);
	const double y2pi=y1+scalepi*ppi*TMath::Sin(thetapi);
	TArrow *a;
        a = new TArrow(x1,y1,x2pr,y2pr,.01,">");
	a->SetLineColor(24);
	a->Draw();
        a = new TArrow(x1,y1,x2pi,y2pi,.01,">");
	a->SetLineColor(20);
	a->Draw();
	TMarker *m = new TMarker(x1,y1,7);
	m->SetMarkerColor(28);
	m->Draw();
    }
}
Пример #11
0
void geugd_riordan() {
	gROOT->SetStyle("HALLA");
	TCanvas *cn = new TCanvas("cn");
	cn->Draw();
	cn->UseCurrentStyle();
	TH1F *frm = new TH1F("frm","",100,0.,12.);
	frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
	frm->GetXaxis()->CenterTitle();
	frm->GetYaxis()->SetTitle("G_{E}^{u}/G_{D}");
	frm->GetYaxis()->CenterTitle();
	frm->SetMinimum(.40);
	frm->SetMaximum(2.4);
	//frm->SetMaximum(0.3);
	frm->UseCurrentStyle();
	frm->Draw();
	frm->SetAxisRange(0.10,12.,"X");

	TF1* galster = new TF1("galster",
			"x/(4.*0.938*.938)*1.91/(1.+x/.71)^2/(1.+5.6*x/(4.*.938*.938))",
			0.,4.);
	galster->SetLineColor(kBlack);
	galster->SetLineStyle(kBlack);
	galster->SetLineWidth(2);

	TF1* gen0 = new TF1("gen0", f1dugen0, 0.,12.);
	gen0->SetLineColor(kBlack);
	gen0->SetLineStyle(kBlack);
	gen0->SetLineWidth(1);



	TF1 *genf = new TF1("genf",genff,1.,10.,1);
	genf->SetLineColor(kBlue);
	genf->SetLineStyle(1);
	genf->SetParameter(0,1.);
	// match to Madey point just below 1.5
	// genf->SetParameter(0,.0411/genf->Eval(1.45));
	//  genf->SetParameter(0,-0.558645);
	genf->SetParameter(0,-0.182645);

	TF1 *roberts_curve = new TF1("roberts",roberts_gen,0.035,12.344,1);
	roberts_curve->SetLineColor(kRed);
	roberts_curve->SetLineStyle(9);

	TF1 *ourfit = new TF1("ourfit",gen_ourfit,0.,10.,0);
	ourfit->SetLineColor(kBlue);
	ourfit->SetLineStyle(0);

	/*
	   TF1 *bbba05 = new TF1("BBBA05",gen_bbba05,0.,10.,0);
	   bbba05->SetLineColor(kGreen);
	   bbba05->SetLineStyle(3);
	   */

	//  TF1 *lomon = new TF1("Lomon",Lomon_GEn,0.,10.,0);
	// lomon->SetLineColor(7);
	// lomon->SetLineStyle(4);




	TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
	//TLegend *legDta = new TLegend(.3448,.6123,.6810,.9110,"","brNDC");
	TLegend *legDta = new TLegend(.6020,.4004,.9382,.9089,"","brNDC");

	TMultiGraph* wgr = mgrDta;
	TLegend *wlg = legDta;

	// the data
	legDta->SetBorderSize(0); // turn off border
	legDta->SetFillStyle(0);

	datafile_t *f = datafiles;
	TGraph* gr=0;
	TGraph* ogr=0;
	while ( f && f->filename ) {
		ogr=OneGraph(f);
		if (ogr) {
			gr = fromGEntransform(ogr);
			gr->SetLineStyle(0);
			if (f->lnpt) {
				mgrDta->Add(gr,f->lnpt);
				if( f->label[0] != 'x' )
					legDta->AddEntry(gr,f->label,f->lnpt);
			}
			mgrDta->Add(gr,"p");
			if( f->label[0] != 'x' )
				legDta->AddEntry(gr,f->label,"p");

			/*
			   else if (gr->GetMarkerStyle()>=20) {
			   mgrDta->Add(gr,"p");
			   if( f->label[0] != 'x' )
			   legDta->AddEntry(gr,f->label,"p");
			   }	
			   else {
			   mgrDta->Add(gr,"l");
			   if( f->label[0] != 'x' )
			   legDta->AddEntry(gr,f->label,"l");
			   }
			   */
		}
		f++;
	}


	mgrDta->Draw("p");
	legDta->Draw();

	TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
	//  TLegend *legThry = new TLegend(.546,.6208,.8822,.9195,"","brNDC");
	//	TLegend *legThry = new TLegend(.2055,.7013,.6020,.8893,"","brNDC");
	TLegend *legThry = new TLegend(.4267,.8453,.6236,.8962,"","brNDC");

	wgr = mgrThry;
	wlg = legThry;

	// the theory
	wlg->SetBorderSize(0); // turn off border
	wlg->SetFillStyle(0);

	f = theoryfiles1;
	gr=0;
	Bool_t isfill;
	while ( f && f->filename ) {
		gr=OneGraph(f);
		gr->SetLineWidth(2);
		isfill = kFALSE;
		if (gr) {
			TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
			if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
				gr = toerror_band(egr);
				gr->SetFillStyle(3000+f->style);
				gr->SetFillStyle(1);
				gr->SetFillColor(gr->GetLineColor());
				isfill = kTRUE;
			}
			if (f->lnpt) {
				wgr->Add(gr,f->lnpt);
				if( f->label[0] != 'x' )
					wlg->AddEntry(gr,f->label,f->lnpt);
			}
			else if (gr->GetMarkerStyle()>=20) {
				wgr->Add(gr,"p");
				if( f->label[0] != 'x' )
					wlg->AddEntry(gr,f->label,"p");
			}	
			else {
				if( isfill ){
					gr->SetLineStyle(0);
					wgr->Add(gr,"f");
					//				  wgr->Add( new TGraph(*egr),"l");
					if( f->label[0] != 'x' )
						wlg->AddEntry(gr,f->label,"lf");
				} else {
					wgr->Add(gr,"l");
					if( f->label[0] != 'x' )
						wlg->AddEntry(gr,f->label,"l");
				}
			}

		}
		f++;
	}


	TPaveLabel *prelim = new TPaveLabel( 0.3204, 0.1886, 0.9310, 0.4643, "PRELIMINARY", "NDC" );
	prelim->SetTextAngle(0);
	TColor *pink = new TColor(300, 1.0, 0.7, 0.7, "pink");
	prelim->SetTextColor(300);
	prelim->SetFillStyle(0);
	prelim->SetBorderSize(0);


#ifdef FAKE_SCHIAVILLA
	TGraph *schiagraph = draw_schiavilla();
	schiagraph->Draw("F");
	schiagraph = draw_schiavilla(1);
	schiagraph->Draw("C");
	legThry->AddEntry(schiagraph, "d(e,e'd) T_{20} - Schiavilla & Sick", "LF");
#endif

#ifdef PRELIMINARY
	prelim->Draw("same");
#endif

	TPaveLabel *nofsilab = new TPaveLabel( 0.4569, 0.1674, 0.7514, 0.2415, "No FSI Corrections", "NDC" );
	nofsilab->SetFillStyle(0);
	nofsilab->SetBorderSize(0);
	nofsilab->SetTextColor(kRed);

#ifdef NOFSI
	//  nofsilab->Draw("same");
#endif

#ifdef PQCD
	genf->Draw("same");
#endif
	mgrThry->Draw("c");
#ifdef GALSTER
	galster->Draw("same");
#endif
//	gen0->Draw("same");

#ifdef NEW_ROBERTS
	roberts_curve->Draw("same");
#endif
	//  ourfit->Draw("same");
	//  bbba05->Draw("same");
	//lomon->Draw("same");
	// bandi->Draw("same");
#ifdef PQCD  
	legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
#endif
#ifdef GALSTER
	legThry->AddEntry(galster,"Galster fit (1971)","l");
#endif
//	legThry->AddEntry(gen0,"G_{E}^{n} = 0","l");
#ifdef NEW_ROBERTS
	legThry->AddEntry(roberts_curve,"q(qq) Faddeev -  I. Cloet, ANL","l");
#endif
	//  legThry->AddEntry(bbba05,"BBBA05","l");
	//  legThry->AddEntry(lomon, "Lomon", "l");
	// legThry->AddEntry(ourfit, "Our Fit", "l");
	legThry->Draw();
	legDta->Draw();

	mgrDta->Draw("p");
	legDta->Draw();

	TEllipse *cir1 = new TEllipse(1.31, 0.0, 0.17, 0.0065);
	TEllipse *cir2 = new TEllipse(2.4, 0.0, 0.17, 0.0065);
	cir1->SetFillStyle(0);
	cir2->SetFillStyle(0);

#ifdef PLOTKIN1
	cir1->Draw("same");
	//  cir2->Draw("same");

	//  TPaveLabel *exacc = new TPaveLabel( 0.3779, 0.2691, 0.5963, 0.3114, "Expected Accuracy", "NDC");
	TPaveLabel *exacc = new TPaveLabel( 0.2716, 0.2733, 0.4899, 0.3136, "Expected Accuracy", "NDC");
	exacc->SetFillStyle(0);
	exacc->SetBorderSize(0);
	exacc->Draw("same");
#endif


	// draw a line at 1
	cn->Modified();

	cn->Update();
	cn->SaveAs(Form("%s.pdf",psfile));
	cn->SaveAs(Form("%s.eps",psfile));
	//  cn->SaveAs(Form("%s.root",psfile));
	//  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));

	//  cn->SaveAs("bogdan_gen.eps");
	return;  // LEAVING HERE

	// now an overlay, hopefully matching dimensions

	// remove everything but the graph
	cn->Update();
	TList *clist = cn->GetListOfPrimitives();
	TFrame* frame = cn->GetFrame();
	for (int i=0; i<clist->GetSize(); ) {
		if (clist->At(i) != frame) {
			clist->RemoveAt(i);
		} else i++;
	}
	// draw markers in the corners
	TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
	mkr->Draw();
	mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
	mkr->Draw();
	mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
	mkr->Draw();
	mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
	mkr->Draw();
	frame->SetLineColor(10);
	cn->Update();

	datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
		"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };

	gr = OneGraph(&miller);
	TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
	if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
		gr = toerror_band(egr);
		gr->SetLineStyle(1);
		gr->SetFillColor(gr->GetLineColor());
		gr->SetFillStyle(3000+miller.style);
	}

	gr->Draw("F");

	cn->Update();
	cn->SaveAs("gen_Miller_Overlay.pdf");
	cn->SaveAs("gen_Miller_Overlay.root");

}
void Show_SR(TString oredList,  TCanvas *can, float xlow, float xhigh, float ylow, float yhigh, bool useShape, TLegend *leg)
{
    Int_t c_myRed      = TColor::GetColor("#aa000");
    
    can->cd();

    TLatex lat;
    //lat.SetTextAlign( 11 );
    lat.SetTextSize( 0.0265 );
    lat.SetTextColor( 12 );
    lat.SetTextFont( 42 );

    cout << "Draw signal region labels." << endl;
    gROOT->ProcessLine(".L summary_harvest_tree_description.h+");
    gSystem->Load("libSusyFitter.so");

    TString txtfile=oredList;
    txtfile.ReplaceAll(".root","");

    TTree* tree = harvesttree( txtfile!=0 ? txtfile : 0 );
    if (tree==0) { 
        cout << "Cannot open list file. Exit." << endl;
        return;
    }

    Float_t fID;
    Float_t m0; 
    Float_t m12; 

    TBranch *b_m0;
    TBranch *b_m12;
    TBranch *b_fID;

    tree->SetBranchAddress("m0", &m0, &b_m0);
    tree->SetBranchAddress("m12", &m12, &b_m12);
    tree->SetBranchAddress("fID",  &fID,  &b_fID);

    bool drawMarker;

    for( Int_t i = 0; i < tree->GetEntries(); i++ ){
        drawMarker = false;
        
        tree->GetEntry( i );
        cout << m0 << " " << m12 << " " << fID << endl;
        
        TMarker marker;
        //marker.SetMarkerColor(4);
        marker.SetMarkerSize(2.5);
        marker.SetMarkerStyle(29);

        int _m0 = (int) m0;
        int _m12 = (int) m12;

        if(oredList.Contains("GG")){
            if( (_m0 == 700 && _m12 == 550) || (_m0 == 1162 && _m12 == 337) || (_m0 == 1250 && _m12 == 50) )
                drawMarker = true;
        } else if(oredList.Contains("SS")){
            if( (_m0 == 850 && _m12 == 100) || (_m0 == 450 && _m12 == 400))
                drawMarker = true;
        } else if(oredList.Contains("SG")){
            if( (_m0 == 1425 && _m12 == 525) || (_m0 == 1612 && _m12 == 37))
                drawMarker = true;
        }

        if (drawMarker)
            marker.DrawMarker(m0, m12);

        TString mySR = GetSRName(fID, useShape);
	lat.DrawLatex(m0,m12,mySR.Data());
	     
    }
    
    leg->Draw("same");
    // add up/down lines
    TLine *line1;
    TLine *line2;
    if (oredList.Contains("GG")) {
        line1 = new TLine( 972, 1412, 1062, 1412);
        line2 = new TLine( 972, 1355, 1062, 1355);
        cout << "GG line1" << endl;
        
    } else if (oredList.Contains("SS")) {
        line1 = new TLine( 793, 1128, 860, 1128); 
        line2 = new TLine( 793, 1081, 860, 1081); 
        cout << "SS line1" << endl;
    } else if (oredList.Contains("SG")) {
        line1 = new TLine( 1150, 1645, 1260, 1645); 
        line2 = new TLine( 1150, 1565, 1260, 1565); 
        cout << "SG line1" << endl;
    }
/*
    line1->SetLineWidth(2);
    line1->SetLineColor(c_myRed);
    line1->SetLineStyle(3);
    line1->Draw("SAME") ;

    line2->SetLineWidth(2);
    line2->SetLineColor(c_myRed);
    line2->SetLineStyle(3);
    line2->Draw("SAME") ;                
*/
}
Пример #13
0
void q4gmn_jan2009() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn");
  cn->Draw();
//  TH1F *frm = new TH1F("frm","",100,0.,5.5);
  TH1F *frm = new TH1F("frm","",100,0.,20.);
  frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
  frm->GetXaxis()->CenterTitle();
  frm->GetYaxis()->SetTitle("Q^{4} G_{M}^{n}/#mu_{n}");
  frm->GetYaxis()->CenterTitle();
  frm->SetMinimum(0.0);
  frm->SetMaximum(0.6);
  frm->UseCurrentStyle();
  frm->Draw();


  
  TMultiGraph* mgrDta = new TMultiGraph("Data","G_{M}^{n}/#mu_{n}G_{D}");
  TLegend *legDta = new TLegend(0.5029,.2076,.9095,.3877,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
    legDta->SetBorderSize(0); // turn off border
    legDta->SetFillStyle(0);

    datafile_t *f = datafiles;
    TGraph* gr=0;
    TGraph* ogr=0;
    while ( f && f->filename ) {
      ogr=OneGraph(f);
      if (ogr) {
	      gr = fromGMnGDtoQ4GMn(ogr);
	if (f->lnpt) {
	  mgrDta->Add(gr,f->lnpt);
	  legDta->AddEntry(gr,f->label,f->lnpt);
	}
	else if (gr->GetMarkerStyle()>=20) {
	  mgrDta->Add(gr,"p");
	  legDta->AddEntry(gr,f->label,"p");
	}	
	else {
	  mgrDta->Add(gr,"l");
	  legDta->AddEntry(gr,f->label,"l");
	}
      }
      f++;
    }
    

  mgrDta->Draw("p");
   legDta->Draw();  // don't draw the data legend
  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","");
  TLegend *legThry = new TLegend(0.1868,.1949,.5287,.3432,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
    wlg->SetBorderSize(0); // turn off border
    wlg->SetFillStyle(0);

    f = theoryfiles1;
    ogr=0;
    while ( f && f->filename ) {
      ogr=OneGraph(f);
      if (ogr) {
	      gr = fromGMnGDtoQ4GMn(ogr);
	TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
	if (egr && egr->GetEYhigh() && egr->GetEYhigh()[0]>0) {
 	  gr = toerror_band(egr);
	  gr->SetFillStyle(3000+f->style);
	}
	gr->SetLineWidth(2);
	if (f->lnpt) {
	  wgr->Add(gr,f->lnpt);
	  wlg->AddEntry(gr,f->label,f->lnpt);
	}
	else if (gr->GetMarkerStyle()>=20) {
	  wgr->Add(gr,"p");
	  wlg->AddEntry(gr,f->label,"p");
	}	
	else {
	  wgr->Add(gr,"l");
	  wlg->AddEntry(gr,f->label,"l");
	}
      }
      f++;
    }
  
  mgrThry->Draw("c");
  legThry->Draw();

  // draw a line at 1
  cn->Modified();
  cn->Update();
  TFrame* frame = gPad->GetFrame();

  TLine *line1 = new TLine(frame->GetX1(),1.,frame->GetX2(),1.);
  line1->SetLineStyle(1);
  line1->Draw();

  cn->Update();
  cn->SaveAs(Form("%s.eps",psfile));
  cn->SaveAs(Form("%s.root",psfile));
  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));

  return;

  // remove everything but the graph
  cn->Update();
  TList *clist = cn->GetListOfPrimitives();
  frame = cn->GetFrame();
  for (int i=0; i<clist->GetSize(); ) {
    if (clist->At(i) != frame) {
      clist->RemoveAt(i);
    } else i++;
  }
  // draw markers in the corners
  TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
  mkr->Draw();
  frame->SetLineColor(10);
  cn->Update();

  {
    datafile_t miller = { "figure_input/Miller/lattice.GMn.rtf","Miller",
			  "[0]","[1]/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
			  "([3]-[1])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
			  "([1]-[2])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
			  0,0,1,3,"F" };
    
    gr = OneGraph(&miller);
    TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
    if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
      gr = toerror_band(egr);
      gr->SetLineStyle(1);
      gr->SetFillColor(gr->GetLineColor());
      gr->SetFillStyle(3000+miller.style);
    }
    
    gr->Draw("F");
    
    cn->Update();
    cn->SaveAs("gmngd_Miller_Overlay.eps");
    cn->SaveAs("gmngd_Miller_Overlay.root");
    clist->Remove(gr);
  }

  {
    datafile_t miller_spl = { "figure_input/Miller/lattice.GMn.spl3","Miller",
			      "[0]","[1]/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
			      "([3]-[1])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
			      "([1]-[2])/(-1.91)*(1+[0]/.71)*(1+[0]/.71)",
			      0,0,1,3,"F" };
    
    gr = OneGraph(&miller_spl);
    TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
    if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
      gr = toerror_band(egr);
      gr->SetLineStyle(1);
      gr->SetFillColor(gr->GetLineColor());
      gr->SetFillStyle(3000+miller_spl.style);
    }
    
    gr->Draw("F");
    
    cn->Update();
    cn->SaveAs("gmngd_Miller_Overlay_spl.eps");
    cn->SaveAs("gmngd_Miller_Overlay_spl.root");
    clist->Remove(gr);
  }

}
Пример #14
0
void drawMeasurement(int i, double m[5], char label[2][100], int aux[5],
		     double vstep, TH2F* histo, TCanvas* canvas) {

 
    double lowY = (i+1)*vstep;
    double uppY = (i+2)*vstep;

  //double lowX = histo->GetBinLowEdge(1);
  //double uppX = histo->GetBinLowEdge(histo->GetNbinsX()) +
  //              histo->GetBinWidth(histo->GetNbinsX());
    double lowX = 0.25;
    double uppX = 2.80;
    double widthX = uppX - lowX;

 
  // y-range of the histogram is [0...1]

  double startX = lowX + 0.04*widthX;
  
  TPaveText* text = new TPaveText(startX, lowY,
				  startX, uppY, "BR");
  text->SetTextAlign(12);
  text->SetFillColor(aux[1]);
  text->SetTextColor(aux[0]);
  text->SetLineColor(1);
  text->SetBorderSize(0);
  TText* t0 = text->AddText("    ");
  t0->SetTextSize(0.08);
  t0->SetTextFont(aux[2]);
  TText* t1 = text->AddText(label[0]);
  t1->SetTextSize(0.08);
  t1->SetTextFont(aux[2]);
  TText* t2 = text->AddText(label[1]);
  t2->SetTextSize(0.08);
  t2->SetTextFont(aux[2]);
  text->Draw();


  double ypos = 0.5*(lowY+uppY);
  double mean = m[0];
  double nErr1 = m[1];
  double pErr1 = m[2];
  double nErr2 = sqrt(m[1]*m[1]+m[3]*m[3]);
  double pErr2 = sqrt(m[2]*m[2]+m[4]*m[4]);

  // draw TGraphAsymmErrors 1 (stat only) |---*---|
  TMarker* measurement = new TMarker(mean, ypos, aux[4]);
  measurement->SetMarkerColor(aux[0]);
  measurement->SetMarkerStyle(aux[4]);

  measurement->SetMarkerSize(1.5);
  //measurement->SetMarkerSize(1.75);
  measurement->Draw();

  double vsizeErr1 = 0.09*vstep;
  TLine* l1 = new TLine(mean, ypos, mean-nErr1, ypos);
  l1->SetLineWidth(aux[3]);
  l1->SetLineColor(aux[0]);
  l1->Draw();
  TLine* l2 = new TLine(mean, ypos, mean+pErr1, ypos);
  l2->SetLineWidth(aux[3]);
  l2->SetLineColor(aux[0]);
  l2->Draw();
  TLine* l3 = new TLine(mean-nErr1, ypos-vsizeErr1,
			mean-nErr1, ypos+vsizeErr1);
  l3->SetLineWidth(aux[3]);
  l3->SetLineColor(aux[0]);
  l3->Draw();
  TLine* l4 = new TLine(mean+pErr1, ypos-vsizeErr1,
			mean+pErr1, ypos+vsizeErr1);
  l4->SetLineWidth(aux[3]);
  l4->SetLineColor(aux[0]);
  l4->Draw();

  // overlay TGraphAsymmErrors 2 (stat+syst) |----*-----|
  double vsizeErr2 = 0.12*vstep; 
  TLine* l5 = new TLine(mean, ypos, mean-nErr2, ypos);
  l5->SetLineWidth(aux[3]);
  l5->SetLineColor(aux[0]);
  l5->Draw();
  TLine* l6 = new TLine(mean, ypos, mean+pErr2, ypos);
  l6->SetLineWidth(aux[3]);
  l6->SetLineColor(aux[0]);
  l6->Draw();
  TLine* l7 = new TLine(mean-nErr2, ypos-vsizeErr2,
			mean-nErr2, ypos+vsizeErr2);
  l7->SetLineWidth(aux[3]);
  l7->SetLineColor(aux[0]);
  l7->Draw();
  TLine* l8 = new TLine(mean+pErr2, ypos-vsizeErr2,
			mean+pErr2, ypos+vsizeErr2);
  l8->SetLineWidth(aux[3]);
  l8->SetLineColor(aux[0]);
  l8->Draw();

  // draw measurement label "XXX+/-YY+/-ZZ"
  TPaveText* num = new TPaveText(uppX-0.32*widthX,
				 lowY, uppX-0.02*widthX, uppY, "BR");
  num->SetTextAlign(12);
  num->SetFillColor(aux[1]);
  num->SetTextColor(aux[0]);
  num->SetLineColor(aux[0]);
  num->SetBorderSize(0);
  TString str;
  char s[100];

  sprintf(s, "%4.2f#color[%d]{X}", m[0], aux[1]); str +=s;
  if (m[1]==m[2]) { // sym. stat. errors
    sprintf(s, "#pm %4.2f",  m[1]); str +=s;
  } else {
    sprintf(s, "^{+%4.2f}",  m[2]); str +=s;
    sprintf(s, "_{-#color[%d]{|}%4.2f}", aux[1], m[1]); str +=s;
  }
  str += " (stat)";
  if (m[3]!=0.0 || m[4]!=0.0) {
    if (m[3]==m[4]) { // sym. syst. errors
      sprintf(s, "#color[%d]{X}#pm% 4.2f", aux[1], m[3]); str +=s;
    } else {
      sprintf(s, "#color[%d]{X}", aux[1]); str +=s;
      sprintf(s, "^{+%4.2f}",  m[4]); str +=s;
      sprintf(s, "_{-#color[%d]{|}%4.2f}", aux[1], m[3]); str +=s;
    }
  }
  str += " (syst)";


  TText* n0 = num->AddText(str);
  n0->SetTextFont(aux[2]);
  num->Draw();

  return;
}
Пример #15
0
void Drawing()
{
  frodo *fr = frodo::instance();
  fr->Y1.clear();
  fr->X1.clear();
  fr->Y2.clear();
  fr->X2.clear();
  fr->Y3.clear();
  fr->X3.clear();
  fr->Y4.clear();
  fr->X4.clear();
  fr->AllX.clear();
  fr->AllY.clear();
  
  //----------------------------------------------------------------------------------------------------

  TCanvas *HBD = new TCanvas("HBD","HBD Event Display",0,0,700,700);
  HBD->Range(-50000,-50000,50000,50000);

    
   double Qx1,Qx2,Qx3,Qx4,Qy1,Qy2,Qy3,Qy4;

   Qx1=Qx2=Qx3=Qx4=Qy1=Qy2=Qy3=Qy4=0;
  
   for(unsigned int i=0; i<60; i++)
     {
       Qx1 += fr->J1_XStrips[i].Q();
       Qx2 += fr->J2_XStrips[i].Q();
       Qx3 += fr->J3_XStrips[i].Q();
       Qx4 += fr->J4_XStrips[i].Q();
     }

   for(unsigned int i=0; i<60; i++)
     {
       Qy1 += fr->J1_YStrips[i].Q();
       Qy2 += fr->J2_YStrips[i].Q();
       Qy3 += fr->J3_YStrips[i].Q();
       Qy4 += fr->J4_YStrips[i].Q();
     }
  
   double Qtot1 = Qx1+Qy1;
   double Qtot2 = Qx2+Qy2;
  double Qtot3 = Qx3+Qy3;
   double Qtot4 = Qx4+Qy4;
  
  
  //J1 section:-------------------------------------------------------------------
  double X1 = -49100; //left
  double Y1 = -1375; //bottom
  double X2 = -1000; //right
  double Y2 = -1075; //top
  for(unsigned int i=0; i<60; i++)
    {
      double T = fr->J1_YStrips[i].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot1*100;
      if(Qfrac>0.04 && Qfrac<1)
 	{
 	  fr->J1_YStrips[i].Draw(X1,Y1,X2,Y2,1);
 	  HBD->Update();
	  fr->Y1.push_back(Coordinates(fr->J1_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J1_YStrips[i].YCenter()));
 	}
      
       else if(Qfrac>=1 && Qfrac<50)
 	{
 	  int index = int (Qfrac);
 	  fr->J1_YStrips[i].Draw(X1,Y1,X2,Y2,index);
 	  HBD->Update();
 	  fr->Y1.push_back(Coordinates(fr->J1_YStrips[i].YCenter()));
 	  fr->AllY.push_back(Coordinates(fr->J1_YStrips[i].YCenter()));
 	}
       else if(Qfrac>=50 && Qfrac<99.98)
 	{
 	  //int index = int (Qfrac) - 49;
 	  fr->J1_YStrips[i].Draw(X1,Y1,X2,Y2,2);
 	  HBD->Update();
 	  fr->Y1.push_back(Coordinates(fr->J1_YStrips[i].YCenter()));
 	  fr->AllY.push_back(Coordinates(fr->J1_YStrips[i].YCenter()));
 	}
      	  
	  Y2 = Y1 - 500;
	  Y1 = Y2 - 300; 
    }

  double x1 = -1900;
  double y1 = -48975;
  double x2 = -1200;
  double y2 = -48675;

  for(unsigned int j=0; j<60; j++)
    {
      
      double T = fr->J1_XStrips[j].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot1*100;
      if(Qfrac>0.04 && Qfrac<1)
	{
 	  fr->J1_XStrips[j].Draw(x1,y1,x2,y2,1);   
 	  HBD->Update();
	  fr->X1.push_back(Coordinates(fr->J1_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J1_XStrips[j].XCenter()));

 	}
	
      else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J1_XStrips[j].Draw(x1,y1,x2,y2,index);   
	  HBD->Update();
	  fr->X1.push_back(Coordinates(fr->J1_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J1_XStrips[j].XCenter()));
	}
      else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac) - 49;
	  fr->J1_XStrips[j].Draw(x1,y1,x2,y2,2);
	  HBD->Update();
	  fr->X1.push_back(Coordinates(fr->J1_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J1_XStrips[j].XCenter()));
	}
	
      
      x2 = x1 - 100;
      x1 = x2 - 700;
    }

  
  //J2 section:----------------------------------------------------------------
  //cout<<"J2: "<<endl;

  X1 = 900;
  Y1 = -1375;
  X2 = 49000;
  Y2 = -1075;
  for(unsigned int i=0; i<60; i++)
    {
      double T = fr->J2_YStrips[i].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot2*100;
      if(Qfrac>0.04 && Qfrac<1)
       	{
 	  fr->J2_YStrips[i].Draw(X1,Y1,X2,Y2,1);
 	  HBD->Update();
	  fr->Y2.push_back(Coordinates(fr->J2_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J2_YStrips[i].YCenter()));
	}
      
      else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J2_YStrips[i].Draw(X1,Y1,X2,Y2,index);
	  HBD->Update();
	  fr->Y2.push_back(Coordinates(fr->J2_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J2_YStrips[i].YCenter()));
	  
	}
      else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac)-49;
	  fr->J2_YStrips[i].Draw(X1,Y1,X2,Y2,2);
	  HBD->Update();
	  fr->Y2.push_back(Coordinates(fr->J2_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J2_YStrips[i].YCenter()));
	}
      

      Y2 = Y1 - 500;
      Y1 = Y2 - 300; 
    }

  x1 = 48100;
  y1 = -48975;
  x2 = 48800;
  y2 = -48675;

  for(unsigned int j=0; j<60; j++)
    {
      double T = fr->J2_XStrips[j].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot2*100;
      if(Qfrac>0.04 && Qfrac<1)
       	{
 	  fr->J2_XStrips[j].Draw(x1,y1,x2,y2,1);  
 	  HBD->Update();
	  fr->X2.push_back(Coordinates(fr->J2_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J2_XStrips[j].XCenter()));
 	}
      
      else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J2_XStrips[j].Draw(x1,y1,x2,y2,index);  
	  HBD->Update();
	  fr->X2.push_back(Coordinates(fr->J2_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J2_XStrips[j].XCenter()));
	}
      else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac)-49;
	  fr->J2_XStrips[j].Draw(x1,y1,x2,y2,2);
	  HBD->Update();
	  fr->X2.push_back(Coordinates(fr->J2_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J2_XStrips[j].XCenter()));
	}
      
      x2 = x1 - 100;
      x1 = x2 - 700;
    }
  
  //J3 section:----------------------------------------------------------------
  X1 = -49100;
  Y1 = 1125;
  X2 = -1000;
  Y2 = 1425;
  for(unsigned int i=0; i<60; i++)
    {
      double T = fr->J3_YStrips[i].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot3*100;
      if(Qfrac>0.04 && Qfrac<1)
       	{
 	  fr->J3_YStrips[i].Draw(X1,Y1,X2,Y2,1);
 	  HBD->Update();
	  fr->Y3.push_back(Coordinates(fr->J3_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J3_YStrips[i].YCenter()));
 	}
       
       else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J3_YStrips[i].Draw(X1,Y1,X2,Y2,index);
	  HBD->Update();
	  fr->Y3.push_back(Coordinates(fr->J3_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J3_YStrips[i].YCenter()));
	}
       else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac)-49;
	  fr->J3_YStrips[i].Draw(X1,Y1,X2,Y2,2);
	  HBD->Update();
	  fr->Y3.push_back(Coordinates(fr->J3_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J3_YStrips[i].YCenter()));
	}
       
      Y1 = Y2 + 500;
      Y2 = Y1 + 300; 
    }

  x1 = -49100;
  y1 = 1525;
  x2 = -48400;
  y2 = 1825;
  for(unsigned int j=0; j<60; j++)
    {
      double T = fr->J3_XStrips[j].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot3*100;
      if(Qfrac>0.04 && Qfrac<1)
       	{
 	  fr->J3_XStrips[j].Draw(x1,y1,x2,y2,1);   
 	  HBD->Update();
	  fr->X3.push_back(Coordinates(fr->J3_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J3_XStrips[j].XCenter()));
	}
      
       else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J3_XStrips[j].Draw(x1,y1,x2,y2,index);   
	  HBD->Update();
	  fr->X3.push_back(Coordinates(fr->J3_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J3_XStrips[j].XCenter()));
	}
       else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac)-49;
	  fr->J3_XStrips[j].Draw(x1,y1,x2,y2,2);
	  HBD->Update();
	  fr->X3.push_back(Coordinates(fr->J3_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J3_XStrips[j].XCenter()));
	}
      
      x1 = x2 + 100;
      x2 = x1 + 700;
    }

  //J4 section:-----------------------------------------------------------------
  X1 = 950;
  Y1 = 1125;
  X2 = 49050;
  Y2 = 1425;
  for(unsigned int i=0; i<60; i++)
    {
      double T = fr->J4_YStrips[i].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot4*100;
      if(Qfrac>0.04 && Qfrac<1)
       	{
 	  fr->J4_YStrips[i].Draw(X1,Y1,X2,Y2,1);
 	  HBD->Update();
	  fr->Y4.push_back(Coordinates(fr->J4_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J4_YStrips[i].YCenter()));
 	}
       
       else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J4_YStrips[i].Draw(X1,Y1,X2,Y2,index);
	  HBD->Update();
	  fr->Y4.push_back(Coordinates(fr->J4_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J4_YStrips[i].YCenter()));
	  
	}
       else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac)-49;
	  fr->J4_YStrips[i].Draw(X1,Y1,X2,Y2,2);
	  HBD->Update();
	  fr->Y4.push_back(Coordinates(fr->J4_YStrips[i].YCenter()));
	  fr->AllY.push_back(Coordinates(fr->J4_YStrips[i].YCenter()));
	}
       
      Y1 = Y2 + 500;
      Y2 = Y1 + 300; 
    }

  x1 = 950;
  y1 = 1525;
  x2 = 1650;
  y2 = 1825;
  for(unsigned int j=0; j<60; j++)
    {
      double T = fr->J4_XStrips[j].Q();
      //double Qfrac = exp(-T/20)*100;
      double Qfrac = T/Qtot4*100;
      if(Qfrac>0.04 && Qfrac<1)
       	{
 	  fr->J4_XStrips[j].Draw(x1,y1,x2,y2,1); 
 	  HBD->Update();
	  fr->X4.push_back(Coordinates(fr->J4_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J4_XStrips[j].XCenter()));
 	}
       
       else if(Qfrac>=1 && Qfrac<50)
	{
	  int index = int(Qfrac);
	  fr->J4_XStrips[j].Draw(x1,y1,x2,y2,index); 
	  HBD->Update();
	  fr->X4.push_back(Coordinates(fr->J4_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J4_XStrips[j].XCenter()));
	}
       else if(Qfrac>=50 && Qfrac<99.98)
	{
	  //int index = int(Qfrac)-49;
	  fr->J4_XStrips[j].Draw(x1,y1,x2,y2,2);
	  HBD->Update();
	  fr->X4.push_back(Coordinates(fr->J4_XStrips[j].XCenter()));
	  fr->AllX.push_back(Coordinates(fr->J4_XStrips[j].XCenter()));
	}
       
      x1 = x2 + 100;
      x2 = x1 + 700;
    }

  //Drawing the Central Cross:
  X1 = -49100;
  Y1 = -675;
  X2 = 49050;
  Y2 = 675;
  TBox Hori (X1,Y1, X2,Y2);
  Hori.SetFillColor(15);
  Hori.DrawBox(X1,Y1, X2,Y2);
  HBD->Update();

  X1 = -500;
  Y1 = -48975;
  X2 = 500;
  Y2 = 49025;
  TBox Vert (X1,Y1, X2,Y2);
  Vert.SetFillColor(15);
  Vert.DrawBox(X1,Y1, X2,Y2);
  HBD->Update();

  //Drawing the real positions of the photons:
  for(unsigned int a=0; a<fr->HBDParticles.size(); a++)
    {
      fr->HBDParticles[a].Draw();
      HBD->Update();
    }

  //Finding the ring:----------------------------------------------------------------------------------
  Hough = new TH3D ("Hough","Hough",500,-50000,50000,500,-50000,50000,500,0,50000);
  Houghxy = new TH2D ("Houghxy","Houghxy",100,-50000,50000,100,-50000,50000);
  Houghxr = new TH2D ("Houghxr","Houghxr",100,-50000,50000,100,0,50000);
  Houghyr = new TH2D ("Houghyr","Houghyr",100,-50000,50000,100,0,50000);
  
    
//Forming J1234 PseudoPoints:
  for(unsigned int s=0; s<fr->Y1.size(); s++)
    {
      for(unsigned int ps=0; ps<fr->X1.size(); ps++)
	{
	  fr->J1_PseudoPoints.push_back(TVector3(fr->X1[ps].Cor(),fr->Y1[s].Cor(),0));
	  
	}
    }
  //cout<<"J1 size:"<<fr->J1_PseudoPoints.size()<<endl;

  for(unsigned int s=0; s<fr->Y2.size(); s++)
    {
      for(unsigned int ps=0; ps<fr->X2.size(); ps++)
	{
	  fr->J2_PseudoPoints.push_back(TVector3(fr->X2[ps].Cor(),fr->Y2[s].Cor(),0));
	  
	}
    }
  //cout<<"J2 size:"<<fr->J2_PseudoPoints.size()<<endl;

  for(unsigned int s=0; s<fr->Y3.size(); s++)
    {
      for(unsigned int ps=0; ps<fr->X3.size(); ps++)
	{
	  fr->J3_PseudoPoints.push_back(TVector3(fr->X3[ps].Cor(),fr->Y3[s].Cor(),0));
	 
	}
    }
  //cout<<"J3 size:"<<fr->J3_PseudoPoints.size()<<endl;

  for(unsigned int s=0; s<fr->Y4.size(); s++)
    {
      for(unsigned int ps=0; ps<fr->X4.size(); ps++)
	{
	  fr->J4_PseudoPoints.push_back(TVector3(fr->X4[ps].Cor(),fr->Y4[s].Cor(),0));
	  
	}
    }
 
  //Selecting 3 PseudoPoints in three different quadrants:
  //J1,J2,J3:
  if(fr->J1_PseudoPoints.size() >= 1 && fr->J2_PseudoPoints.size() >= 1 && fr->J3_PseudoPoints.size() >= 1)
    {
      for(unsigned int i=0; i<fr->J1_PseudoPoints.size(); i++)
	{
	  for(unsigned int j=0; j<fr->J2_PseudoPoints.size(); j++)
	    {
	      for(unsigned int k=0; k<fr->J3_PseudoPoints.size(); k++)
		{
		  
		  double Rad  = FindR(fr->J1_PseudoPoints[i],fr->J2_PseudoPoints[j],fr->J3_PseudoPoints[k]);
		  double Xcen = FindX(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J2_PseudoPoints[j].X(),fr->J2_PseudoPoints[j].Y(),fr->J3_PseudoPoints[k].X(),fr->J3_PseudoPoints[k].Y());
		  double Ycen = FindY(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J2_PseudoPoints[j].X(),fr->J2_PseudoPoints[j].Y(),fr->J3_PseudoPoints[k].X(),fr->J3_PseudoPoints[k].Y());
		  Hough->Fill(Xcen,Ycen,Rad);
		  Houghxy->Fill(Xcen,Ycen);
		  Houghyr->Fill(Ycen,Rad);
		  Houghxr->Fill(Xcen,Rad);
		}
	    }
	}
    }
      
  //J1,J2,J4:
  if(fr->J1_PseudoPoints.size() >= 1 && fr->J2_PseudoPoints.size() >= 1 && fr->J4_PseudoPoints.size() >= 1)
    {
      for(unsigned int i=0; i<fr->J1_PseudoPoints.size(); i++)
	{
	  for(unsigned int j=0; j<fr->J2_PseudoPoints.size(); j++)
	    {
	      for(unsigned int k=0; k<fr->J4_PseudoPoints.size(); k++)
		{
		  double Rad  = FindR(fr->J1_PseudoPoints[i],fr->J2_PseudoPoints[j],fr->J4_PseudoPoints[k]);
		  double Xcen = FindX(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J2_PseudoPoints[j].X(),fr->J2_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
		  double Ycen = FindY(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J2_PseudoPoints[j].X(),fr->J2_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
		  Hough->Fill(Xcen,Ycen,Rad);
		  Houghxy->Fill(Xcen,Ycen);
		  Houghyr->Fill(Ycen,Rad);
		  Houghxr->Fill(Xcen,Rad);
		}
	    }
	}
    }
  
  //J1,J3,J4:
  if(fr->J1_PseudoPoints.size() >= 1 && fr->J3_PseudoPoints.size() >= 1 && fr->J4_PseudoPoints.size() >= 1)
    {
      for(unsigned int i=0; i<fr->J1_PseudoPoints.size(); i++)
	{
	  for(unsigned int j=0; j<fr->J3_PseudoPoints.size(); j++)
	    {
	      for(unsigned int k=0; k<fr->J4_PseudoPoints.size(); k++)
		{
		  double Rad  = FindR(fr->J1_PseudoPoints[i],fr->J3_PseudoPoints[j],fr->J4_PseudoPoints[k]);
		  double Xcen = FindX(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
		  double Ycen = FindY(fr->J1_PseudoPoints[i].X(),fr->J1_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
		  Hough->Fill(Xcen,Ycen,Rad);
		  Houghxy->Fill(Xcen,Ycen);
		  Houghyr->Fill(Ycen,Rad);
		  Houghxr->Fill(Xcen,Rad);
		}
	    }
	}
    }
  
  //J2,J3,J4;
  if(fr->J2_PseudoPoints.size() >= 1 && fr->J3_PseudoPoints.size() >= 1 && fr->J4_PseudoPoints.size() >= 1)
    {
      for(unsigned int i=0; i<fr->J2_PseudoPoints.size(); i++)
	{
	  for(unsigned int j=0; j<fr->J3_PseudoPoints.size(); j++)
	    {
	      for(unsigned int k=0; k<fr->J4_PseudoPoints.size(); k++)
		{
		  double Rad  = FindR(fr->J2_PseudoPoints[i],fr->J3_PseudoPoints[j],fr->J4_PseudoPoints[k]);
		  double Xcen = FindX(fr->J2_PseudoPoints[i].X(),fr->J2_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
		  double Ycen = FindY(fr->J2_PseudoPoints[i].X(),fr->J2_PseudoPoints[i].Y(),fr->J3_PseudoPoints[j].X(),fr->J3_PseudoPoints[j].Y(),fr->J4_PseudoPoints[k].X(),fr->J4_PseudoPoints[k].Y());
		  Hough->Fill(Xcen,Ycen,Rad);
		  Houghxy->Fill(Xcen,Ycen);
		  Houghyr->Fill(Ycen,Rad);
		  Houghxr->Fill(Xcen,Rad);
		}
	    }
	}
    }

  /*
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DO NOT ERASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  //Forming PseudoPoints:
  for(unsigned int ps=0; ps<fr->AllX.size(); ps++)
    {
      for(unsigned int s=0; s<fr->AllY.size(); s++)
	{
	   fr->PseudoPoints.push_back(TVector3(fr->AllX[ps].Cor(),fr->AllY[s].Cor(),0));
	}
    }
    
  //Full Combinatorial:
   for(unsigned int i=0; i<fr->PseudoPoints.size()-2; i++)
     {
       for(unsigned int j=i+1; j<fr->PseudoPoints.size()-1; j++)
 	{
 	  for(unsigned int k=j+1; k<fr->PseudoPoints.size(); k++)
 	    {
 	      double Rad = FindR(fr->PseudoPoints[i],fr->PseudoPoints[j],fr->PseudoPoints[k]);
 	      double Xcen = FindX(fr->PseudoPoints[i].X(),fr->PseudoPoints[i].Y(),fr->PseudoPoints[j].X(),fr->PseudoPoints[j].Y(),fr->PseudoPoints[k].X(),fr->PseudoPoints[k].Y());
 	      double Ycen = FindY(fr->PseudoPoints[i].X(),fr->PseudoPoints[i].Y(),fr->PseudoPoints[j].X(),fr->PseudoPoints[j].Y(),fr->PseudoPoints[k].X(),fr->PseudoPoints[k].Y());
 	      Hough->Fill(Xcen,Ycen,Rad);
 	      Houghxy->Fill(Xcen,Ycen);
 	      Houghyr->Fill(Ycen,Rad);
 	      Houghxr->Fill(Xcen,Rad);
	      }
 	}
     }
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  */      
  int xbin, ybin, zbin;
  xbin=0; ybin=0; zbin=0;
  Hough->GetMaximumBin(xbin, ybin, zbin);
  //cout << "xbin= " << xbin << " ybin= " << ybin << " zbin= " << zbin << endl;

  TAxis *xaxis = Hough->GetXaxis();  
  double Xrec=xaxis->GetBinCenter(xbin);
  cout<<"Xrec= "<< Xrec <<endl;

  TAxis *yaxis = Hough->GetYaxis();  
  double Yrec=yaxis->GetBinCenter(ybin);
  cout<<"Yrec= "<< Yrec <<endl;

  TAxis *zaxis = Hough->GetZaxis();  
  double Rrec=zaxis->GetBinCenter(zbin);
  cout<<"Rrec= "<< Rrec <<endl;

  //Drawing the founded ring and its center:
  TEllipse ring (Xrec,Yrec,Rrec,Rrec,1,360,0);
  ring.SetLineColor(2);
  ring.SetFillStyle(0);
  ring.DrawEllipse(Xrec,Yrec,Rrec,Rrec,0,360,0);
  HBD->Update();

  TMarker circumcenter (Xrec,Yrec,8);
  circumcenter.SetMarkerColor(2);
  circumcenter.SetMarkerSize(1);
  circumcenter.DrawMarker(Xrec,Yrec);
  HBD->Update();  
  
}
Пример #16
0
void /home/users/m/k/mkomm/Diff13/analysis/unfolding/result/nominal/multi_top_y_nol()
{
//=========Macro generated from canvas: cvMulti0.984295447508/
//=========  (Mon May 15 15:02:17 2017) by ROOT version6.02/05
   TCanvas *cvMulti0.984295447508 = new TCanvas("cvMulti0.984295447508", "",0,0,800,650);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   cvMulti0.984295447508->SetHighLightColor(2);
   cvMulti0.984295447508->Range(-0.5419355,-0.2962025,3.329032,1.982278);
   cvMulti0.984295447508->SetFillColor(0);
   cvMulti0.984295447508->SetBorderMode(0);
   cvMulti0.984295447508->SetBorderSize(2);
   cvMulti0.984295447508->SetTickx(1);
   cvMulti0.984295447508->SetTicky(1);
   cvMulti0.984295447508->SetLeftMargin(0.14);
   cvMulti0.984295447508->SetRightMargin(0.24);
   cvMulti0.984295447508->SetTopMargin(0.08);
   cvMulti0.984295447508->SetBottomMargin(0.13);
   cvMulti0.984295447508->SetFrameFillStyle(0);
   cvMulti0.984295447508->SetFrameLineWidth(0);
   cvMulti0.984295447508->SetFrameBorderMode(0);
   cvMulti0.984295447508->SetFrameBorderSize(0);
   cvMulti0.984295447508->SetFrameFillStyle(0);
   cvMulti0.984295447508->SetFrameLineWidth(0);
   cvMulti0.984295447508->SetFrameBorderMode(0);
   cvMulti0.984295447508->SetFrameBorderSize(0);
   
   TH2F *axis0.09336527505115 = new TH2F("axis0.09336527505115","",50,0,2.4,50,0,1.8);
   axis0.09336527505115->SetLineStyle(0);
   axis0.09336527505115->SetMarkerStyle(20);
   axis0.09336527505115->SetMarkerSize(0.16);
   axis0.09336527505115->GetXaxis()->SetTitle("top quark |y|");
   axis0.09336527505115->GetXaxis()->SetNdivisions(1005);
   axis0.09336527505115->GetXaxis()->SetLabelFont(43);
   axis0.09336527505115->GetXaxis()->SetLabelOffset(0.0077);
   axis0.09336527505115->GetXaxis()->SetLabelSize(32);
   axis0.09336527505115->GetXaxis()->SetTitleSize(35);
   axis0.09336527505115->GetXaxis()->SetTickLength(0.04032258);
   axis0.09336527505115->GetXaxis()->SetTitleOffset(1.15);
   axis0.09336527505115->GetXaxis()->SetTitleFont(43);
   axis0.09336527505115->GetYaxis()->SetTitle(" Scale factor");
   axis0.09336527505115->GetYaxis()->SetNdivisions(512);
   axis0.09336527505115->GetYaxis()->SetLabelFont(43);
   axis0.09336527505115->GetYaxis()->SetLabelOffset(0.0077);
   axis0.09336527505115->GetYaxis()->SetLabelSize(32);
   axis0.09336527505115->GetYaxis()->SetTitleSize(35);
   axis0.09336527505115->GetYaxis()->SetTickLength(0.03164557);
   axis0.09336527505115->GetYaxis()->SetTitleOffset(1.3);
   axis0.09336527505115->GetYaxis()->SetTitleFont(43);
   axis0.09336527505115->GetZaxis()->SetLabelFont(43);
   axis0.09336527505115->GetZaxis()->SetLabelOffset(0.0077);
   axis0.09336527505115->GetZaxis()->SetLabelSize(32);
   axis0.09336527505115->GetZaxis()->SetTitleSize(34);
   axis0.09336527505115->GetZaxis()->SetTitleOffset(1.3);
   axis0.09336527505115->GetZaxis()->SetTitleFont(43);
   axis0.09336527505115->Draw("AXIS");
   
   TF1 *tf13 = new TF1("tf1","1",0,2.4);
   tf13->SetFillColor(19);
   tf13->SetFillStyle(0);
   tf13->SetMarkerStyle(20);
   tf13->SetMarkerSize(0.16);
   tf13->SetLineWidth(1);
   tf13->GetXaxis()->SetNdivisions(505);
   tf13->GetXaxis()->SetLabelFont(43);
   tf13->GetXaxis()->SetLabelOffset(0.0077);
   tf13->GetXaxis()->SetLabelSize(32);
   tf13->GetXaxis()->SetTitleSize(34);
   tf13->GetXaxis()->SetTickLength(0.05);
   tf13->GetXaxis()->SetTitleOffset(1.15);
   tf13->GetXaxis()->SetTitleFont(43);
   tf13->GetYaxis()->SetNdivisions(512);
   tf13->GetYaxis()->SetLabelFont(43);
   tf13->GetYaxis()->SetLabelOffset(0.0077);
   tf13->GetYaxis()->SetLabelSize(32);
   tf13->GetYaxis()->SetTitleSize(34);
   tf13->GetYaxis()->SetTitleOffset(1.3);
   tf13->GetYaxis()->SetTitleFont(43);
   tf13->Draw("LSame");
   TMarker *marker = new TMarker(0.0892,0.9606917,20);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   TLine *line = new TLine(0.0892,0.9359605,0.0892,0.9854228);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.2,0,0.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.0892,0.9606917,0.3142,0.9554859);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.3142,0.9554859,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.3142,0.9323344,0.3142,0.9786374);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.45,0,0.45,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.3142,0.9554859,0.5642,0.9562376);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.5642,0.9562376,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.5642,0.9291835,0.5642,0.9832918);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.7,0,0.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.5642,0.9562376,0.8142,0.940729);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.8142,0.940729,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.8142,0.9117791,0.8142,0.9696789);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.95,0,0.95,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.8142,0.940729,1.0642,1.028565);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.0642,1.028565,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.0642,0.9987074,1.0642,1.058422);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.2,0,1.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.0642,1.028565,1.3392,1.024151);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.3392,1.024151,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.3392,0.9916412,1.3392,1.05666);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.5,0,1.5,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.3392,1.024151,1.5892,0.9990193);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.5892,0.9990193,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.5892,0.9494996,1.5892,1.048539);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.7,0,1.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.5892,0.9990193,2.0392,0.9212695);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(2.0392,0.9212695,20);

   ci = TColor::GetColor("#f9910c");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(2.0392,0.8767255,2.0392,0.9658136);

   ci = TColor::GetColor("#f9910c");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(2.4,0,2.4,1.8);
   line->SetLineStyle(2);
   line->Draw();
   marker = new TMarker(0.1036,1.197582,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.1036,1.070044,0.1036,1.325121);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.2,0,0.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.1036,1.197582,0.3286,1.07941);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.3286,1.07941,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.3286,0.9690778,0.3286,1.189742);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.45,0,0.45,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.3286,1.07941,0.5786,1.238685);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.5786,1.238685,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.5786,1.103282,0.5786,1.374089);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.7,0,0.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.5786,1.238685,0.8286,1.070291);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.8286,1.070291,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.8286,0.9410973,0.8286,1.199485);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.95,0,0.95,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.8286,1.070291,1.0786,0.7963992);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.0786,0.7963992,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.0786,0.6813629,1.0786,0.9114354);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.2,0,1.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.0786,0.7963992,1.3536,0.9233731);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.3536,0.9233731,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.3536,0.7879375,1.3536,1.058809);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.5,0,1.5,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.3536,0.9233731,1.6036,1.066334);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.6036,1.066334,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.6036,0.8539173,1.6036,1.278751);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.7,0,1.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.6036,1.066334,2.0536,1.283384);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(2.0536,1.283384,20);

   ci = TColor::GetColor("#0a9128");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(2.0536,1.067281,2.0536,1.499488);

   ci = TColor::GetColor("#0a9128");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(2.4,0,2.4,1.8);
   line->SetLineStyle(2);
   line->Draw();
   marker = new TMarker(0.118,0.1968883,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.118,0.1722209,0.118,0.2215558);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.2,0,0.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.118,0.1968883,0.343,0.2348717);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.343,0.2348717,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.343,0.2130683,0.343,0.2566752);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.45,0,0.45,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.343,0.2348717,0.593,0.2059685);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.593,0.2059685,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.593,0.1802414,0.593,0.2316957);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.7,0,0.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.593,0.2059685,0.843,0.2345659);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.843,0.2345659,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.843,0.208081,0.843,0.2610507);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.95,0,0.95,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.843,0.2345659,1.093,0.3094085);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.093,0.3094085,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.093,0.2799161,1.093,0.3389009);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.2,0,1.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.093,0.3094085,1.368,0.347837);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.368,0.347837,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.368,0.2999248,1.368,0.3957492);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.5,0,1.5,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.368,0.347837,1.618,0.5309299);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.618,0.5309299,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.618,0.4081874,1.618,0.6536723);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.7,0,1.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.618,0.5309299,2.068,0.2949066);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(2.068,0.2949066,20);

   ci = TColor::GetColor("#999999");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(2.068,0,2.068,0.7323252);

   ci = TColor::GetColor("#999999");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(2.4,0,2.4,1.8);
   line->SetLineStyle(2);
   line->Draw();
   marker = new TMarker(0.1252,0.9784018,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.1252,0.8521009,0.1252,1.104703);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.2,0,0.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.1252,0.9784018,0.3502,0.9447267);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.3502,0.9447267,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.3502,0.8411522,0.3502,1.048301);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.45,0,0.45,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.3502,0.9447267,0.6002,0.7547158);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.6002,0.7547158,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.6002,0.6180429,0.6002,0.8913887);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.7,0,0.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.6002,0.7547158,0.8502,1.12315);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(0.8502,1.12315,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(0.8502,0.9840732,0.8502,1.262226);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(0.95,0,0.95,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(0.8502,1.12315,1.1002,1.107947);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.1002,1.107947,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.1002,0.9620515,1.1002,1.253843);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.2,0,1.2,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.1002,1.107947,1.3752,0.6245485);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.3752,0.6245485,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.3752,0.462954,1.3752,0.786143);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.5,0,1.5,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.3752,0.6245485,1.6252,0.8379717);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(1.6252,0.8379717,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(1.6252,0.5506004,1.6252,1.125343);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(1.7,0,1.7,1.8);
   line->SetLineStyle(2);
   line->Draw();
   line = new TLine(1.6252,0.8379717,2.0752,0.3802364);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(3);
   line->Draw();
   marker = new TMarker(2.0752,0.3802364,20);

   ci = TColor::GetColor("#ff0505");
   marker->SetMarkerColor(ci);
   marker->SetMarkerStyle(20);
   marker->SetMarkerSize(1.2);
   marker->Draw();
   line = new TLine(2.0752,0.06910222,2.0752,0.6913706);

   ci = TColor::GetColor("#ff0505");
   line->SetLineColor(ci);
   line->SetLineWidth(2);
   line->Draw();
   line = new TLine(2.4,0,2.4,1.8);
   line->SetLineStyle(2);
   line->Draw();
   
   TH2F *axis0.0933652750511_copy6 = new TH2F("axis0.0933652750511_copy6","",50,0,2.4,50,0,1.8);
   axis0.0933652750511_copy6->SetDirectory(0);
   axis0.0933652750511_copy6->SetLineStyle(0);
   axis0.0933652750511_copy6->SetMarkerStyle(20);
   axis0.0933652750511_copy6->SetMarkerSize(0.16);
   axis0.0933652750511_copy6->GetXaxis()->SetTitle("top quark |y|");
   axis0.0933652750511_copy6->GetXaxis()->SetNdivisions(1005);
   axis0.0933652750511_copy6->GetXaxis()->SetLabelFont(43);
   axis0.0933652750511_copy6->GetXaxis()->SetLabelOffset(0.0077);
   axis0.0933652750511_copy6->GetXaxis()->SetLabelSize(32);
   axis0.0933652750511_copy6->GetXaxis()->SetTitleSize(35);
   axis0.0933652750511_copy6->GetXaxis()->SetTickLength(0.04032258);
   axis0.0933652750511_copy6->GetXaxis()->SetTitleOffset(1.15);
   axis0.0933652750511_copy6->GetXaxis()->SetTitleFont(43);
   axis0.0933652750511_copy6->GetYaxis()->SetTitle(" Scale factor");
   axis0.0933652750511_copy6->GetYaxis()->SetNdivisions(512);
   axis0.0933652750511_copy6->GetYaxis()->SetLabelFont(43);
   axis0.0933652750511_copy6->GetYaxis()->SetLabelOffset(0.0077);
   axis0.0933652750511_copy6->GetYaxis()->SetLabelSize(32);
   axis0.0933652750511_copy6->GetYaxis()->SetTitleSize(35);
   axis0.0933652750511_copy6->GetYaxis()->SetTickLength(0.03164557);
   axis0.0933652750511_copy6->GetYaxis()->SetTitleOffset(1.3);
   axis0.0933652750511_copy6->GetYaxis()->SetTitleFont(43);
   axis0.0933652750511_copy6->GetZaxis()->SetLabelFont(43);
   axis0.0933652750511_copy6->GetZaxis()->SetLabelOffset(0.0077);
   axis0.0933652750511_copy6->GetZaxis()->SetLabelSize(32);
   axis0.0933652750511_copy6->GetZaxis()->SetTitleSize(34);
   axis0.0933652750511_copy6->GetZaxis()->SetTitleOffset(1.3);
   axis0.0933652750511_copy6->GetZaxis()->SetTitleFont(43);
   axis0.0933652750511_copy6->Draw("sameaxis");
   
   TPaveText *pt = new TPaveText(0.14,0.94,0.14,0.94,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(11);
   pt->SetTextFont(63);
   pt->SetTextSize(34);
   TText *AText = pt->AddText("CMS");
   pt->Draw();
   
   pt = new TPaveText(0.24,0.94,0.24,0.94,"brNDC");
   pt->SetBorderSize(0);
   pt->SetFillColor(0);
   pt->SetTextAlign(11);
   pt->SetTextFont(53);
   pt->SetTextSize(34);
   AText = pt->AddText("Preliminary");
   pt->Draw();
   cvMulti0.984295447508->Modified();
   cvMulti0.984295447508->cd();
   cvMulti0.984295447508->SetSelected(cvMulti0.984295447508);
}
void showHistogram2d(TH2* histogram, 
		     const std::string& xAxisTitle, const std::string& yAxisTitle,
		     int zAxisNormOption, double zMin, double zMax, 
		     Float_t* genX, Float_t* genY, 
		     const std::string& outputFileName)
{
  TCanvas* canvas = new TCanvas("canvas", "canvas", 900, 800);
  canvas->SetFillColor(10);
  canvas->SetBorderSize(2);

  canvas->SetTopMargin(0.10);
  canvas->SetLeftMargin(0.12);
  canvas->SetRightMargin(0.14);
  canvas->SetBottomMargin(0.12);

  histogram->SetTitle("");
  histogram->SetStats(false);
  int numBinsX = histogram->GetNbinsX();
  int numBinsY = histogram->GetNbinsY();
  if ( zAxisNormOption == kNormByQuantiles ) {
    std::vector<double> binContents;
    for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
      for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
	binContents.push_back(histogram->GetBinContent(iBinX, iBinY));
      }
    }
    std::sort(binContents.begin(), binContents.end());
    histogram->SetMinimum(binContents[TMath::Nint(0.05*binContents.size())]);
    histogram->SetMaximum(binContents[TMath::Nint(0.95*binContents.size())]);
  } else if ( zAxisNormOption == kNormByNegLogMax ) {
    double maxBinContent = 0.;
    for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
      for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
	double binContent = histogram->GetBinContent(iBinX, iBinY);
	if ( binContent > maxBinContent ) {
	  std::cout << "binX = " << iBinX << " (x = " << histogram->GetXaxis()->GetBinCenter(iBinX) << ")," 
		    << " binY = " << iBinY << " (y = " << histogram->GetYaxis()->GetBinCenter(iBinY) << "): maxBinContent = " << maxBinContent << std::endl;
	  maxBinContent = binContent;
	}
      }
    }
    double logMaxBinContent = TMath::Log(maxBinContent);
    for ( int iBinX = 1; iBinX <= numBinsX; ++iBinX ) {
      for ( int iBinY = 1; iBinY <= numBinsY; ++iBinY ) {
	double binContent = histogram->GetBinContent(iBinX, iBinY);
	if ( binContent > 0. ) {
	  histogram->SetBinContent(iBinX, iBinY, -TMath::Log(binContent) + logMaxBinContent);
	} else {
	  histogram->SetBinContent(iBinX, iBinY, -1.);
	}
      }
    }
    histogram->SetMinimum(0.);
    histogram->SetMaximum(zMax);
  } else if ( zAxisNormOption == kNormByValue ) {
    histogram->SetMinimum(zMin);
    histogram->SetMaximum(zMax);
  } else assert(0);

  TAxis* xAxis = histogram->GetXaxis();
  xAxis->SetTitle(xAxisTitle.data());
  xAxis->SetTitleOffset(1.15);

  TAxis* yAxis = histogram->GetYaxis();
  yAxis->SetTitle(yAxisTitle.data());
  yAxis->SetTitleOffset(1.30);

  gStyle->SetPalette(1,0);
  histogram->Draw("COLZ");

  TMarker* genMarker = 0;
  if ( genX && genY ) {
    genMarker = new TMarker(*genX, *genY, 34);
    genMarker->SetMarkerColor(1);
    genMarker->SetMarkerSize(2);
    genMarker->Draw();
  }

  canvas->Update();
  size_t idx = outputFileName.find_last_of('.');
  std::string outputFileName_plot = std::string(outputFileName, 0, idx);
  if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
  canvas->Print(std::string(outputFileName_plot).append(".png").data());
  canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
  canvas->Print(std::string(outputFileName_plot).append(".root").data());

  delete genMarker;
  delete canvas;  
}
Пример #18
0
void marker(void) {
    TCanvas *c = new TCanvas("c","Marker types",0,0,500,200);
    TMarker marker;
    marker.DisplayMarkerTypes();
    return c;
}
Пример #19
0
TMarker *buildMark(double x1,double x2, Color_t color = kBlack, Style_t style=20){
TMarker *out = new TMarker(x1,x2,style);
out->SetMarkerColor(color);
return out;
};
void PrintVertexRosenbrock()
{
	// open file

	std::ifstream data ("Vertex.txt", std::ios::in);
	
	double buf;
	std::vector<double> x1;
	std::vector<double> x2;
	std::vector<double> x3;
	std::vector<double> y1;
	std::vector<double> y2;
	std::vector<double> y3;

	// loop on file
	while (1)
	{
		data >> buf;
		if (data.eof())
		{break;}
		x1.push_back(buf);
		data >> buf;
		y1.push_back(buf);
		data >> buf;
		x2.push_back(buf);
		data >> buf;
		y2.push_back(buf);
		data >> buf;
		x3.push_back(buf);
		data >> buf;
		y3.push_back(buf);	
	}

	// functions
	//TF2* f = new TF2 ("himmelblau", "(x*x + y - 11)*(x*x + y - 11) + (x + y*y - 7)*(x + y*y - 7)", 0, 10, 0, 10); // himmelblau
	gStyle->SetOptTitle(0);	
	TF2* f = new TF2 ("rosenbrock", "100*(y-x*x)*(y-x*x) + (1-x)*(1-x)", -1.5, 2.2, -0.5, 2.2); // rosenbrock
 	f->SetNpx(1000);
	f->SetNpy(1000);
	f->GetXaxis()->SetTitle("x");
	f->GetYaxis()->SetTitle("y");
	TCanvas* c1 = new TCanvas;
	c1->SetLogz();	
	rosenbrock->Draw("COLZ");

	
	// loop on vertex
	std::vector<TLine*> vl1;
	std::vector<TLine*> vl2;
	std::vector<TLine*> vl3;
	TLine* l1;
	TLine* l2;
	TLine* l3;	
	for (int i = 0; i < x1.size(); i++)
	{
		l1 = new TLine(0,0,0,0);
		l2 = new TLine(0,0,0,0);
		l3 = new TLine(0,0,0,0);	
		
		l1->SetLineWidth(1.5);
		l2->SetLineWidth(1.5);
		l3->SetLineWidth(1.5);

		l1->SetLineColor(kBlue -10 + i);
		l2->SetLineColor(kBlue -10 + i);
		l3->SetLineColor(kBlue -10 + i);

		l1->SetX1(x1.at(i));
		l1->SetY1(y1.at(i));
		l1->SetX2(x2.at(i));
		l1->SetY2(y2.at(i));

		l2->SetX1(x2.at(i));
		l2->SetY1(y2.at(i));
		l2->SetX2(x3.at(i));
		l2->SetY2(y3.at(i));

		l3->SetX1(x3.at(i));
		l3->SetY1(y3.at(i));
		l3->SetX2(x1.at(i));
		l3->SetY2(y1.at(i));

		l1->Draw("same");
		l2->Draw("same");
		l3->Draw("same");
	}

	TMarker* min = new TMarker (1,1,0);
	min ->SetMarkerColor (kBlue);
	min->SetMarkerStyle(20);
	min->SetMarkerSize (1.0);
	min->Draw();

}
// Working at 2D scan by first copying the original ProbScan
int MethodDatasetsProbScan::scan2d()
{
    if ( arg->debug ) cout << "MethodDatasetsProbScan::scan2d() : starting ..." << endl;
    nScansDone++;
    sanityChecks();
    if ( startPars ) delete startPars;

    // Define whether the 2d contours in hCL are "1D sigma" (ndof=1) or "2D sigma" (ndof=2).
    // Titus: Change this to 2, since there is no reason to do wrong hCL contours.
    int ndof = 2;

    // Set up storage for fit results of this particular
    // scan. This is used for the drag start parameters.
    // We cannot use the curveResults2d member because that
    // only holds better results.
    vector<vector<RooSlimFitResult*> > mycurveResults2d;
    for ( int i=0; i<nPoints2dx; i++ ){
        vector<RooSlimFitResult*> tmp;
        for ( int j=0; j<nPoints2dy; j++ ) tmp.push_back(0);
        mycurveResults2d.push_back(tmp);
    }

    // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // // Titus: Saving is done via saveSolutions2d() in the combination, but maybe we need it inline for now \todo: implement a saving function
    // // Define outputfile
    // system("mkdir -p root");
    // TString probResName = Form("root/scan1dDatasetsProb_" + this->pdf->getName() + "_%ip" + "_" + scanVar1 + ".root", arg->npoints1d);
    // TFile* outputFile = new TFile(probResName, "RECREATE");

    // // Set up toy root tree
    // this->probScanTree = new ToyTree(this->pdf, arg);
    // this->probScanTree->init();
    // this->probScanTree->nrun = -999; //\todo: why does this branch even exist in the output tree of the prob scan?
    // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // store start parameters so we can reset them later
    startPars = new RooDataSet("startPars", "startPars", *w->set(parsName));
    startPars->add(*w->set(parsName));

    // // start scan from global minimum (not always a good idea as we need to set from other places as well)
    // setParameters(w, parsName, globalMin);

    // Define scan parameters and scan range:
    RooRealVar *par1 = w->var(scanVar1);
    RooRealVar *par2 = w->var(scanVar2);

    // Set limit to all parameters.
    this->loadParameterLimits();

    // fix scan parameters
    par1->setConstant(true);
    par2->setConstant(true);

    // Report on the smallest new minimum we come across while scanning.
    // Sometimes the scan doesn't find the minimum
    // that was found before. Warn if this happens.
    double bestMinOld = chi2minGlobal;
    double bestMinFoundInScan = 100.;

    // for the status bar
    int nSteps = 0;
    float nTotalSteps = nPoints2dx*nPoints2dy;
    float printFreq = nTotalSteps>100 && !arg->probforce ? 100 : nTotalSteps; ///< number of messages

    // initialize some control plots
    gStyle->SetOptTitle(1);
    TCanvas *cDbg = newNoWarnTCanvas(getUniqueRootName(), Form("DeltaChi2 for 2D scan %i",nScansDone));
    cDbg->SetMargin(0.1,0.15,0.1,0.1);
    float hChi2min2dMin = hChi2min2d->GetMinimum();
    bool firstScanDone = hChi2min2dMin<1e5;
    TH2F *hDbgChi2min2d = histHardCopy(hChi2min2d, firstScanDone);
    hDbgChi2min2d->SetTitle(Form("#Delta#chi^{2} for scan %i, %s",nScansDone,title.Data()));
    if ( firstScanDone ) hDbgChi2min2d->GetZaxis()->SetRangeUser(hChi2min2dMin,hChi2min2dMin+25);
    hDbgChi2min2d->GetXaxis()->SetTitle(par1->GetTitle());
    hDbgChi2min2d->GetYaxis()->SetTitle(par2->GetTitle());
    hDbgChi2min2d->GetZaxis()->SetTitle("#Delta#chi^{2}");
    TH2F *hDbgStart = histHardCopy(hChi2min2d, false);


    // start coordinates //Titus: start at the global minimum
    // don't allow the under/overflow bins
    int iStart = min(hCL2d->GetXaxis()->FindBin(par1->getVal()), hCL2d->GetNbinsX());
    int jStart = min(hCL2d->GetYaxis()->FindBin(par2->getVal()), hCL2d->GetNbinsY());
    iStart = max(iStart, 1);
    jStart = max(jStart, 1);
    hDbgStart->SetBinContent(iStart, jStart, 500.);
    TMarker *startpointmark = new TMarker(par1->getVal(),par2->getVal(),3);

    // timer
    TStopwatch tFit;
    TStopwatch tSlimResult;
    TStopwatch tScan;
    TStopwatch tMemory;

    // set up the scan spiral
    int X = 2*nPoints2dx;
    int Y = 2*nPoints2dy;
    int x,y,dx,dy;
    x = y = dx = 0;
    dy = -1;
    int t = std::max(X,Y);
    int maxI = t*t;

    for ( int spiralstep=0; spiralstep<maxI; spiralstep++ )
    {
        if ((-X/2 <= x) && (x <= X/2) && (-Y/2 <= y) && (y <= Y/2))
        {
            int i = x+iStart;
            int j = y+jStart;
            if ( i>0 && i<=nPoints2dx && j>0 && j<=nPoints2dy )
            {
                tScan.Start(false);

                // status bar
                if (((int)nSteps % (int)(nTotalSteps/printFreq)) == 0){
                    cout << Form("MethodDatasetsProbScan::scan2d() : scanning %3.0f%%", (float)nSteps/(float)nTotalSteps*100.)
                                                             << "       \r" << flush;
                }
                nSteps++;

                // status histogram
                if ( spiralstep>0 ) hDbgStart->SetBinContent(i, j, 500./*firstScan ? 1. : hChi2min2dMin+36*/);

                // set start parameters from inner turn of the spiral
                int xStartPars, yStartPars;
                computeInnerTurnCoords(iStart, jStart, i, j, xStartPars, yStartPars, 1);
                RooSlimFitResult *rStartPars = mycurveResults2d[xStartPars-1][yStartPars-1];
                if ( rStartPars ) setParameters(w, parsName, rStartPars);

                // memory management:
                tMemory.Start(false);
                // delete old, inner fit results, that we don't need for start parameters anymore
                // for this we take the second-inner-most turn.
                int iOld, jOld;
                bool innerTurnExists = computeInnerTurnCoords(iStart, jStart, i, j, iOld, jOld, 2);
                if ( innerTurnExists ){
                    deleteIfNotInCurveResults2d(mycurveResults2d[iOld-1][jOld-1]);
                    mycurveResults2d[iOld-1][jOld-1] = 0;
                }
                tMemory.Stop();

                // alternative choice for start parameters: always from what we found at function call
                // setParameters(w, parsName, startPars->get(0));

                // set scan point
                float scanvalue1 = hCL2d->GetXaxis()->GetBinCenter(i);
                float scanvalue2 = hCL2d->GetYaxis()->GetBinCenter(j);
                par1->setVal(scanvalue1);
                par2->setVal(scanvalue2);

                // fit!
                tFit.Start(false);
                RooFitResult *fr;
                // if ( !arg->probforce ) fr = fitToMinBringBackAngles(w->pdf(pdfName), false, -1);
                // else                   fr = fitToMinForce(w, combiner->getPdfName());

                fr = this->loadAndFit(this->pdf);   //Titus: change fitting strategy to the one from the datasets \todo: should be possible to use the fittominforce etc methods
                // double chi2minScan = 2 * fr->minNll(); //Titus: take 2*minNll vs. minNll? Where is the squared in the main gammacombo?
                double chi2minScan = 2 * pdf->getMinNll();
                tFit.Stop();
                tSlimResult.Start(false);
                RooSlimFitResult *r = new RooSlimFitResult(fr); // try to save memory by using the slim fit result
                tSlimResult.Stop();
                delete fr;
                allResults.push_back(r);
                bestMinFoundInScan = TMath::Min((double)chi2minScan, (double)bestMinFoundInScan);
                mycurveResults2d[i-1][j-1] = r;

                // If we find a new global minumum, this means that all
                // previous 1-CL values are too high. We'll save the new possible solution, adjust the global
                // minimum, return a status code, and stop.
                // if ( chi2minScan > -500 && chi2minScan<chi2minGlobal ){      //Titus: the hard coded minimum chi2 to avoid ridiculous minima (e.g. at boundaries) only sensible when using the Utils::fitToMin, since the chi2 of the best fit with that fitting method is nominally 0.
                if ( chi2minScan<chi2minGlobal ){
                    // warn only if there was a significant improvement
                    if ( arg->debug || chi2minScan<chi2minGlobal-1e-2 ){
                        if ( arg->verbose ) cout << "MethodDatasetsProbScan::scan2d() : WARNING : '" << title << "' new global minimum found! chi2minGlobal="
                                                            << chi2minGlobal << " chi2minScan=" << chi2minScan << endl;
                    }
                    chi2minGlobal = chi2minScan;
                    // recompute previous 1-CL values
                    for ( int k=1; k<=hCL2d->GetNbinsX(); k++ )
                        for ( int l=1; l<=hCL2d->GetNbinsY(); l++ ){
                            hCL2d->SetBinContent(k, l, TMath::Prob(hChi2min2d->GetBinContent(k,l)-chi2minGlobal, ndof));
                            hCLs2d->SetBinContent(k, l, TMath::Prob(hChi2min2d->GetBinContent(k,l)-chi2minBkg, ndof));
                        }
                }

                double deltaChi2 = chi2minScan - chi2minGlobal;
                double oneMinusCL = TMath::Prob(deltaChi2, ndof);
                // if ( arg->debug ) {
                //     cout << "chi2minScan: " << chi2minScan << endl;
                //     cout << "chi2minGlobal: " << chi2minGlobal << endl;
                //     cout << "deltaChi2: " << deltaChi2 << endl;
                //     cout << "ndof: " << ndof << endl;
                //     cout << "oneMinusCL: " << oneMinusCL << endl << endl;
                // }


                // Save the 1-CL value. But only if better than before!
                if ( hCL2d->GetBinContent(i, j) < oneMinusCL ){
                    hCL2d->SetBinContent(i, j, oneMinusCL);
                    double cls_pval = chi2minScan > chi2minBkg ? chi2minScan - chi2minBkg : 0.;
                    hCLs2d->SetBinContent(i, j, TMath::Prob(cls_pval, ndof));
                    hChi2min2d->SetBinContent(i, j, chi2minScan);
                    hDbgChi2min2d->SetBinContent(i, j, chi2minScan);
                    curveResults2d[i-1][j-1] = r;
                }

                // draw/update histograms - doing only every 10th update saves
                // a lot of time for small combinations
                if ( ( arg->interactive && ((int)nSteps % 10 == 0) ) || nSteps==nTotalSteps ){
                    hDbgChi2min2d->Draw("colz");
                    hDbgStart->Draw("boxsame");
                    startpointmark->Draw();
                    cDbg->Update();
                }
                tScan.Stop();
            }
        }
        // spiral stuff:
        if( (x == y) || ((x < 0) && (x == -y)) || ((x > 0) && (x == 1-y)))
        {
            t = dx;
            dx = -dy;
            dy = t;
        }
        x += dx;
        y += dy;
    }
    cout << "MethodDatasetsProbScan::scan2d() : scan done.            " << endl;
    if ( arg->debug ){
        cout << "MethodDatasetsProbScan::scan2d() : full scan time:             "; tScan.Print();
        cout << "MethodDatasetsProbScan::scan2d() : - fitting:                  "; tFit.Print();
        cout << "MethodDatasetsProbScan::scan2d() : - create RooSlimFitResults: "; tSlimResult.Print();
        cout << "MethodDatasetsProbScan::scan2d() : - memory management:        "; tMemory.Print();
    }
    setParameters(w, parsName, startPars->get(0));

    saveSolutions2d();
    if ( arg->debug ) printLocalMinima();
    // confirmSolutions(); //Titus: Leave this out for now, since using it requires compatibility to Utils:fitToMin(), which is not achieved yet

    // clean all fit results that didn't make it into the final result
    for ( int i=0; i<allResults.size(); i++ ){
        deleteIfNotInCurveResults2d(allResults[i]);
    }

    if ( bestMinFoundInScan-bestMinOld > 0.1 )
    {
        cout << "MethodDatasetsProbScan::scan2d() : WARNING: Scan didn't find minimum that was found before!" << endl;
        cout << "MethodDatasetsProbScan::scan2d() :          Are you using too strict parameter limits?" << endl;
        cout << "MethodDatasetsProbScan::scan2d() :          min chi2 found in scan: " << bestMinFoundInScan << ", old min chi2: " << bestMinOld << endl;
        return 1;
    }
    return 0;
}
Пример #22
0
void plotFit(TString filename = "fp-d", TString pltmd = "tph") {

// CHECK FOR RIGHT INPUT ////////////////////////////////////////////////

   string strpltmd = pltmd;

   if( strpltmd.compare("tph")  != 0 &&
       strpltmd.compare("s2b")  != 0 &&
       strpltmd.compare("mmp") != 0 ) {error(4);};
   
// OPEN THE ROOT FILE  //////////////////////////////////////////////////

   gROOT->Reset();
   gROOT->SetStyle("Plain");
   gStyle->SetTitleBorderSize(0);
   gStyle->SetPalette(1);

   TCanvas *MyC = new TCanvas("MyC","Plot of the GAPP fit",200,10,700,500);

// Still to do: Automate the frame boundaries. 
   
   string strfile = filename, rootname = strfile + ".root";

   TFile *rootfile = TFile::Open(rootname.c_str());
      
   if(rootfile == NULL) error(1);
      
   TTree *tree = (TTree*)rootfile->Get(strfile.c_str());
   
   if(tree == NULL) error(2);
   
   TBranch *fits2bbranch = (TBranch*)tree->GetBranch("fits2b");
   
   TBranch *fittphbranch = (TBranch*)tree->GetBranch("fittph");
   
   TBranch *fitxbranch   = (TBranch*)tree->GetBranch("fitx");
   
   if( (fits2bbranch == NULL) || (fittphbranch == NULL) || (fitxbranch == NULL) ) error(3);
   
   Float_t fits2b, fittph, fitx;
      
   tree->SetBranchAddress("fits2b",&fits2b);

   tree->SetBranchAddress("fittph",&fittph);
   
   tree->SetBranchAddress("fitx",  &fitx);
   
   
// GET GRID /////////////////////////////////////////////////////////////

   Int_t Npoints = (Int_t)tree->GetEntries();

   Int_t point, zSteps = 0, ySteps = 0;

   Float_t fitxMin = 100000, fitxMax = -1.0, s2bMin = 100000, tphMin = 100000;

   Float_t s2bMax = -1.0, tphMax = -1.0;

   for(point=0; point<Npoints; point++) {
      
      tree->GetEntry(point);
      
      if( fits2b > s2bMax ) {zSteps++; s2bMax = fits2b;}

      if( fittph > tphMax ) {ySteps++; tphMax = fittph;}
      
   };

   const int s2bSteps = zSteps, tphSteps = ySteps, mmpSteps = Npoints;

   Float_t s2bValues[s2bSteps], tphValues[tphSteps];

   s2bMax = -1.0, tphMax = -1.0;

   int s2bStep = 0, tphStep = 0;

   for(point=0; point<Npoints; point++) {
      
      tree->GetEntry(point);
      
      if( fits2b > s2bMax ) {s2bValues[s2bStep] = fits2b; s2bStep++; s2bMax = fits2b;}

      if( fittph > tphMax ) {tphValues[tphStep] = fittph; tphStep++; tphMax = fittph;}
      
   };

// PREPARE PLOT /////////////////////////////////////////////////////////

   string plottitle = "Model: " + strfile + "  |  Plot: ";

   if( strpltmd.compare("tph") == 0 ) {

      plottitle += "tan^{2}(#phi) over x for fixed sin^{2}(2#beta)";

   }

   if( strpltmd.compare("s2b") == 0 ) {

      plottitle += "sin^{2}(2#beta) over x for fixed tan^{2}(#phi)";

   }

   if( strpltmd.compare("mmp") == 0 ) {

      plottitle += "Masses of the new heavy gauge bosons";

   }

//  PLOT DATA ///////////////////////////////////////////////////////////

   if (strpltmd.compare("tph") == 0) {

      tphMax = -1.0;

//    TGraph *tphplots[s2bSteps];
      TGraph *tphplots[s2bSteps-30];

//    for(s2bStep=0; s2bStep<s2bSteps; s2bStep++) {
      for(s2bStep=0; s2bStep<s2bSteps-30; s2bStep++) {

         Float_t tphArray[tphSteps], fitxArray[tphSteps];

         tphStep = 0;

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);
      
            if(fits2b == s2bValues[s2bStep]) {

//             tphArray[tphStep]  = fittph;
               tphArray[tphStep]  = sqrt(1.0/(1.0+fittph));

               if (fittph < tphMin) tphMin = fittph;

               if (fittph > tphMax) tphMax = fittph;

               fitxArray[tphStep] = fitx;

               if (fitx < fitxMin) fitxMin = fitx;

               if (fitx > fitxMax) fitxMax = fitx;

               tphStep++;


              TMarker *m = new TMarker(fitxArray[tphStep],tphArray[tphStep],20);
              m->SetMarkerSize(2);
              m->SetMarkerColor(31+tphStep);
              m->Draw();



            }
         }

         if (s2bStep == 0) {

            TH1F* frame = MyC->DrawFrame(0.0,0.0,1.1*fitxMax,1.1);
//          TH1F* frame = MyC->DrawFrame(0.7*fitxMin,0.7*tphMin,1.1*fitxMax,1.1*tphMax);

            TAxis *xaxis = frame->GetXaxis();
            TAxis *yaxis = frame->GetYaxis();
   
            xaxis->SetTitle("x = u^{2}/v^{2}");
            xaxis->CenterTitle();
            xaxis->SetTitleOffset(1.);
            xaxis->SetDecimals();
            xaxis->SetLabelSize(0.03);
            xaxis->SetLabelOffset(0.01);
        
            yaxis->SetTitle("tan^{2}(#phi)");
            yaxis->CenterTitle();
            yaxis->SetTitleOffset(1.);
            yaxis->SetDecimals();
            yaxis->SetLabelSize(0.03);
            yaxis->SetLabelOffset(0.01);

            frame->SetTitle(plottitle.c_str());

         }

         tphplots[s2bStep] = new TGraph(tphSteps,fitxArray,tphArray);

         tphplots[s2bStep]->SetMarkerStyle(20);

         tphplots[s2bStep]->SetMarkerSize(0.4);
   
         tphplots[s2bStep]->Draw("CP");

      }
   }

   else if (strpltmd.compare("s2b") == 0) {

      s2bMax = -1.0;

      TGraph *s2bplots[tphSteps-100];

      for(tphStep=0; tphStep<tphSteps-100; tphStep++) {

         Float_t s2bArray[s2bSteps], fitxArray[s2bSteps];

         s2bStep = 0;

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);
      
            if(fittph == tphValues[tphStep+20]) {

               s2bArray[s2bStep]  = fits2b;

               if (fits2b < s2bMin) s2bMin = fits2b;

               if (fits2b > s2bMax) s2bMax = fits2b;

               fitxArray[s2bStep] = fitx;

               if (fitx < fitxMin) fitxMin = fitx;

               if (fitx > fitxMax) fitxMax = fitx;

               s2bStep++;              

            }
         }

         if (tphStep == 0) {

            TH1F* frame = MyC->DrawFrame(0.8*fitxMin,0.95*s2bMin,1.2*fitxMax,1.05*s2bMax);

            TAxis *xaxis = frame->GetXaxis();
            TAxis *yaxis = frame->GetYaxis();
   
            xaxis->SetTitle("x = u^{2}/v^{2}");
            xaxis->CenterTitle();
            xaxis->SetTitleOffset(1.);
            xaxis->SetDecimals();
            xaxis->SetLabelSize(0.03);
            xaxis->SetLabelOffset(0.01);

            yaxis->SetTitle("sin^{2}(2#beta)");
            yaxis->CenterTitle();
            yaxis->SetTitleOffset(1.25);
            yaxis->SetDecimals();
            yaxis->SetLabelSize(0.03);
            yaxis->SetLabelOffset(0.01);

            frame->SetTitle(plottitle.c_str());

         }

         s2bplots[tphStep] = new TGraph(s2bSteps,fitxArray,s2bArray);

         s2bplots[tphStep]->SetMarkerStyle(20);

         s2bplots[tphStep]->SetMarkerSize(0.4);

         s2bplots[tphStep]->Draw("C");

      }
   }

   else if (strpltmd.compare("mmp") == 0) {

      Float_t mzpArray[mmpSteps], mwpArray[mmpSteps];

      Float_t mzpMin = 100000, mzpMax = -1.0, mwpMin = 100000, mwpMax = -1.0;

      Float_t fitsph, fitcph; 

      Float_t Cz1, Cz2, Cz3, Cw1, Cw2, Cw3, Cw4, C1, C2;

      string mdl(strfile,0,2);

      if ( (mdl.compare("lr") == 0) ||
           (mdl.compare("lp") == 0) ||
           (mdl.compare("hp") == 0) ||
           (mdl.compare("fp") == 0) ) {

         string Higgs(strfile,3,1);

         if (Higgs.compare("d") == 0) {

            Cz1 = 11.95349795785275;
            Cz2 = 30.63269990028513;
            Cz3 = 42.58619785813789;
            Cw1 = 21.29309892906894;
            Cw2 = 9.339600971216193;
            Cw3 = 30.63269990028513;
            Cw4 = 42.58619785813789;

         }

         else if (Higgs.compare("t") == 0) {

            Cz1 = 5.976748978926375;
            Cz2 = 30.63269990028513;
            Cz3 = 85.17239571627579;
            Cw1 = 15.05649464522066;
            Cw2 = 3.302047590161717;
            Cw3 = 21.66058982554409;
            Cw4 = 60.22597858088265;

         } else {error(6);}

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);

            fitsph = fittph / (1.0 + fittph);

            fitcph = 1.0 - fitsph;

            if (fitsph != 0.0) {

               mzpArray[point] = (0.001/sqrt(fitsph*fitcph*fitx)) * (Cz1*fitcph*fitcph + Cz2*fits2b + Cz3*fitx);

               if (mzpArray[point] < mzpMin) mzpMin = mzpArray[point];

               if (mzpArray[point] > mzpMax) mzpMax = mzpArray[point];

               mwpArray[point] = (0.001/sqrt(fitsph*fitx))  * (Cw1 - Cw2*fitcph*fitcph + Cw3*fits2b + Cw4*fitx);

               if (mwpArray[point] < mwpMin) mwpMin = mwpArray[point];

               if (mwpArray[point] > mwpMax) mwpMax = mwpArray[point];

            } else {

               mzpArray[point] = 0.0;

               mwpArray[point] = 0.0;

            }
         }
      } 

      else if ( (mdl.compare("uu") == 0) ||
                (mdl.compare("nu") == 0) ) {

         C1 = 94.0397928463607
         C2 = 77.1253849720165

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);

            fitsph = fittph / (1.0+fittph);

            fitcph = 1.0 - fitsph;

            if (fitsph != 0.0) {

               mzpArray[point] = (0.001/sqrt(fitsph*fitcph*fitx)) * (C1*fitsph*fitsph + C2*fitx);

               if (mzpArray[point] < mzpMin) mzpMin = mzpArray[point];

               if (mzpArray[point] > mzpMax) mzpMax = mzpArray[point];

               mwpArray[point] = (0.001/sqrt(fitsph*fitcph*fitx)) * (C1*fitsph*fitsph + C2*fitx);

               if (mwpArray[point] < mwpMin) mwpMin = mwpArray[point];

               if (mwpArray[point] > mwpMax) mwpMax = mwpArray[point];

            } else {

               mzpArray[point] = 0.0;

               mwpArray[point] = 0.0;

            }
         }
      }
Пример #23
0
void q4gep_jan2009() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn");
  cn->Draw();
  TH1F *frm = new TH1F("frm","",100,0.,15.);
#ifndef DIFF_LAB
  frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
#endif
#ifdef DIFF_LAB
  frm->GetXaxis()->SetTitle("Q^{2} in GeV^{2}");
#endif

  frm->GetXaxis()->CenterTitle();
#ifndef DIFF_LAB
  frm->GetYaxis()->SetTitle("Q^{4} G_{E}^{p}");
#endif
#ifdef DIFF_LAB
  frm->GetYaxis()->SetTitle("#muG_{Ep}/G_{Mp}");
#endif
  frm->GetYaxis()->CenterTitle();
  frm->SetMinimum(-0.1);
  frm->SetMaximum(0.4);
  frm->UseCurrentStyle();
  frm->Draw();

  TF1 *ff = new TF1("ff",fff,1.,10.,1.);
  ff->SetLineColor(2);
  ff->SetLineStyle(2);
  ff->SetParameter(0,1.);
  ff->SetParameter(1,.3);
  // match to Gayou point at 5.54 GeV^2
  ff->SetParameter(0,.1035);

  
  TMultiGraph* mgrDta = new TMultiGraph("Data","#frac{#mu_{p}G_{E}^{p}}{G_{M}^{p}}");
  //TLegend *legDta = new TLegend(.58,.565,.875,.9,"","brNDC");
  TLegend *legDta = new TLegend(.648,.682,.945,.900,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
  legDta->SetBorderSize(0); // turn off border
  legDta->SetFillStyle(0);
  
  datafile_t *f = datafiles;
  TGraph* gr=0;
  TGraph* ogr=0;
  while ( f && f->filename ) {
    ogr=OneGraph(f);
    if (ogr) {
	    gr = fromGEpGMptoQ4GEp(ogr);
 	gr->SetLineWidth(2);
      if (f->lnpt) {
	mgrDta->Add(gr,f->lnpt);
	legDta->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	mgrDta->Add(gr,"p");
	legDta->AddEntry(gr,f->label,"p");
      }	
      else {
	mgrDta->Add(gr,"l");
	legDta->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }
  

  mgrDta->Draw("p");
   legDta->Draw();//   don't draw the data legend
  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","#frac{#mu_{p}G_{E}^{p}}{G_{M}^{p}}");
//  TLegend *legThry = new TLegend(.585,.6,.9,.9,"","brNDC");
  TLegend *legThry = new TLegend(.335,.689,.649,.911,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
  wlg->SetBorderSize(0); // turn off border
  wlg->SetFillStyle(0);
  
  f = theoryfiles1;
  ogr=0;
  while ( f && f->filename ) {
    ogr=OneGraph(f);
    if (ogr) {
	    gr = fromGEpGMptoQ4GEp(ogr);
      TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
      if (egr && egr->GetEYhigh() && egr->GetEYhigh()[0]>0) {
	gr = toerror_band(egr);
	gr->SetFillStyle(3000+f->style);
      }
      gr->SetLineWidth(2);
      if (f->lnpt) {
		      wgr->Add(gr,f->lnpt);
	      if( f->label[0] != 'x' ){
		      wlg->AddEntry(gr,f->label,f->lnpt);
	      }
      }
      else if (gr->GetMarkerStyle()>=20) {
		      wgr->Add(gr,"p");
	      if( f->label[0] != 'x' ){
		      wlg->AddEntry(gr,f->label,"p");
	      }
      }	
      else {
		      wgr->Add(gr,"l");
	      if( f->label[0] != 'x' ){
		      wlg->AddEntry(gr,f->label,"l");
	      }
      }
    }
    f++;
  }

  mgrThry->Draw("c");
#ifdef PQCD
  ff->Draw("same");
  legThry->AddEntry(ff,"F2/F1 #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
#endif// PQCD
  legThry->Draw();



  cn->Modified();
  cn->Update();
  TFrame* frame = gPad->GetFrame();

  // draw a line at 1
  TLine *line1 = new TLine(frame->GetX1(),1.,frame->GetX2(),1.);
  line1->SetLineStyle(1);
  line1->Draw();

  return;
  cn->Update();
  cn->SaveAs(Form("%s.eps",psfile));
  cn->SaveAs(Form("%s.root",psfile));
  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));

  // now an overlay, hopefully matching dimensions
  // remove everything except the frame
  cn->Update();
  TList *clist = cn->GetListOfPrimitives();
  frame = cn->GetFrame();
  for (int i=0; i<clist->GetSize(); ) {
	  if (clist->At(i) != frame) {
		  clist->RemoveAt(i);
	  } else i++;
  }
  // draw markers in the corners
  TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
  mkr->Draw();
  frame->SetLineColor(10);


  {
	  datafile_t goeckeler = { "figure_input/Goeckeler/goeckeler.dat","Goeckeler",
		  "[0]","[1]","[1]-[2]","[3]-[1]",0,0,1,4,"F" };

	  gr = OneGraph(&goeckeler);
	  TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
	  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
		  gr = toerror_band(egr);
		  gr->SetLineStyle(1);
		  gr->SetFillColor(gr->GetLineColor());
		  gr->SetFillStyle(3000+goeckeler.style);
	  }

	  gr->Draw("F");
	  cn->Update();
	  cn->SaveAs("mup_gep_gmp_goeckeler_Overlay.eps");
	  cn->SaveAs("mup_gep_gmp_goeckeler_Overlay.root");

	  // remove Goeckeler curve from plot
	  clist->Remove(gr);
  }

  {
	  datafile_t miller = { "figure_input/Miller/lattice.GEp_GMp.rtf","Miller",
		  "[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };

	  gr = OneGraph(&miller);
	  TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
	  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
		  gr = toerror_band(egr);
		  gr->SetLineStyle(1);
		  gr->SetFillColor(gr->GetLineColor());
		  gr->SetFillStyle(3000+miller.style);
	  }

	  gr->Draw("F");
	  cn->Update();
	  cn->SaveAs("mup_gep_gmp_Miller_Overlay.eps");
	  cn->SaveAs("mup_gep_gmp_Miller_Overlay.root");
	  clist->Remove(gr);
  }
  {
	  datafile_t zanotti = { "figure_input/Zanotti/zanotti_gepgmp.dat","Zanotti",
		  "[0]","[1]","[1]-[2]","[3]-[1]",0,0,1,6,"F" };

	  gr = OneGraph(&zanotti);
	  TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
	  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
		  gr = toerror_band(egr);
		  gr->SetLineStyle(1);
		  gr->SetFillColor(gr->GetLineColor());
		  gr->SetFillStyle(3000+zanotti.style);
	  }

	  gr->Draw("F");
	  cn->Update();
	  cn->SaveAs("mup_gep_gmp_Zanotti_Overlay.eps");
	  cn->SaveAs("mup_gep_gmp_Zanotti_Overlay.root");
	  clist->Remove(gr);
  }

}
Пример #24
0
void EventDisplayForBaby(bool sig=false, bool truth=true, bool fatjet=true, int event=-1)
{

    gInterpreter->ExecuteMacro("~/macros/rootlogon.C");
    
    // chain      
    TChain *ch        = new TChain("tree");
    if(!sig) ch->Add("babies/small_quick_cfA_746p1_nleps1_trig0ON.root");
    if(sig) ch->Add("~/scratch/plots/1d_2015d_13Jan2016/2d/48ipb/*.root");
    
    InitBaby(ch); 
   
    Int_t nentries = (Int_t)ch->GetEntries();
    for(int i = 0; i<nentries; i++)
    {
        ch->GetEntry(i); 

        // apply selections (event==-1 && mj_>xxx && ht_>yyy && ...)
        // or 
        // select an event (event!=-1 && event_=xxxxxx)
        // "event" is one of the arguments  
        
        if(event>0 && event_!=event) continue; 

        // 
        //  Event Display
        // 
        float start=0.62;
        float nextline = start;
        float increment = 0.04;
        float offset=0.02;
        int npert;
        int LSPcol[2] = {kCyan+1,kOrange-4};
        if(!sig) npert = 5;
        else npert=3;
        float xalign = 0.82;
        vector<TMarker> constituents, genpart;
        TEllipse *cone[fjets_pt_->size()]; 
        TH2F *h_fatjets = new TH2F("h_fatjets","h_fatjets", 230, -5.0, 5.0, 144, -3.141592, 3.141592); 
        cout << event_ << endl;
        for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
        {   if(ifj==0) cout << "... Fatjets info(pT, eta, phi, mj)" << endl;
            h_fatjets->Fill(fjets_eta_->at(ifj),fjets_phi_->at(ifj), fjets_m_->at(ifj));
            cout << fjets_pt_->at(ifj) << " " << fjets_eta_->at(ifj) << " " 
                 <<  fjets_phi_->at(ifj) << " " << fjets_m_->at(ifj) << endl;
        }

        TString cname = Form("Event_%lli_",event_);
        TCanvas *c = new TCanvas(cname,cname,1640,760);
        gPad->SetRightMargin(0.35);
        h_fatjets->SetZTitle("m_{j} [GeV]");
        h_fatjets->GetZaxis()->SetTitleSize(0.05);
        h_fatjets->GetZaxis()->SetTitleOffset(0.55);
        h_fatjets->GetYaxis()->SetTitleOffset(0.6);
        h_fatjets->Draw("colz");
        h_fatjets->GetZaxis()->SetRangeUser(0,1.1*h_fatjets->GetMaximum());
        h_fatjets->Draw("colz");
        gPad->Update();

        TPaletteAxis *palette = (TPaletteAxis*)h_fatjets->GetListOfFunctions()->FindObject("palette");
        for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
        {
            cone[ifj] = new TEllipse(fjets_eta_->at(ifj),fjets_phi_->at(ifj), 1.2, 1.2);
            //  cone[ifj]->SetFillStyle(3003);
            cone[ifj]->SetFillStyle(0);
            Int_t binx,biny,binz;
            h_fatjets->GetBinXYZ(h_fatjets->FindBin(fjets_eta_->at(ifj),fjets_phi_->at(ifj)),binx,biny,binz);
            //cout<<"bin x bin y "<<binx<<" "<<biny<<endl;
            //cout<<"content "<<h_fatjets->GetBinContent(binx,biny)<<endl;

            //cout<<palette<<endl;
            Int_t ci = palette->GetBinColor(binx,biny);
            if(ifj==0) ci = palette->GetBinColor(binx,biny);
            //cout<<"color"<<ci<<endl;
            cone[ifj]->SetFillColor(kGray);
            cone[ifj]->SetLineColor(ci);
        }


        float lepPt, lepEta, lepPhi; 
        if(nels_==1)  
        {
            for(int i=0; i<(int)els_pt_->size(); i++) 
            {
                if(els_miniso_->at(i)>0.1) continue;
                if(els_sigid_->at(i)!=1) continue;
                if(els_pt_->at(i)<20) continue; 
                lepPt   =els_pt_->at(i);
                lepEta  =els_eta_->at(i);
                lepPhi  =els_phi_->at(i); 
            }
        }
        if(nmus_==1)  
        {
            for(int i=0; i<(int)mus_pt_->size(); i++) 
            {
                if(mus_miniso_->at(i)>0.2) continue;
                if(mus_sigid_->at(i)!=1) continue;
                if(mus_pt_->at(i)<20) continue;
                lepPt   =mus_pt_->at(i);
                lepEta  =mus_eta_->at(i);
                lepPhi  =mus_phi_->at(i); 
            }
        }



        myText(xalign+0.01,0.96,Form("H_{T} = %.0f GeV",ht_),1,0.04);
        myText(xalign+0.01,0.91,Form("M_{J} = %.0f GeV",mj_),1,0.04);
        myText(xalign+0.01,0.86,Form("#slash{E}_{T} = %.0f GeV",met_),1,0.04);
        myText(xalign+0.01,0.81,Form("m_{T} = %.0f GeV",mt_),1,0.04);
        myText(xalign+0.01,0.76,Form("reco %s p_{T} = %.0f GeV", nmus_==1?"#mu":"e", lepPt), kBlack, 0.04); 
        nextline=0.76;
        TMarker recolep = TMarker(lepEta, lepPhi, 27);
        recolep.SetMarkerSize(4);
        recolep.SetMarkerColor(kRed);
        genpart.push_back(recolep);
        TMarker mumark = TMarker(xalign,nextline,27);
        mumark.SetNDC();
        mumark.SetX(xalign);
        mumark.SetY(nextline+0.01);
        mumark.SetMarkerSize(2);
        mumark.SetMarkerColor(kRed);
        genpart.push_back(mumark);
        myText(xalign+0.01,0.71,Form("-- large-R jets --"),1,0.04); 
        myText(xalign+0.01,0.67,Form("(pT, eta, phi, mass)"),1,0.03); 
        nextline=0.635;
        for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
        {
            myText(xalign+0.01,nextline,Form("%3.0f, %2.1f, %2.1f, %3.0f",
                   fjets_pt_->at(ifj),fjets_eta_->at(ifj),fjets_phi_->at(ifj),fjets_m_->at(ifj)),1,0.03); 
            nextline=nextline-0.035;
        } 
        nextline=nextline-0.015;
        myText(xalign+0.01,nextline,Form("-- AK4 jets --"),1,0.04); 
        nextline=nextline-0.04;
        myText(xalign+0.01,nextline,Form("(pT, eta, phi)"),1,0.03); 
        nextline=nextline-0.035;
        for(int ij = 0; ij< (int)jets_pt_->size(); ij++)
        {            
            if(jets_islep_->at(ij)==1) continue;
            myText(xalign+0.01,nextline,Form("%3.0f, %2.1f, %2.1f",
                   jets_pt_->at(ij),jets_eta_->at(ij),jets_phi_->at(ij)),1,0.03); 
            nextline=nextline-0.035;
        }
        
        if(truth) myText(xalign,0.68,"Gen  p_{T} [GeV]",1,0.04);



        
        if(truth) myText(xalign,0.68,"Gen  p_{T} [GeV]",1,0.04);



        TArrow line1 = TArrow();
        if(truth)line1.DrawLineNDC(xalign-0.02,start+0.035,xalign+0.14,start+0.035);
        TMarker met = TMarker(0, met_phi_, 27);
        met.SetMarkerSize(4);
        met.SetMarkerColor(kMagenta);
        genpart.push_back(met);
        TMarker metmark = TMarker(0.81,0.86,27);
        metmark.SetNDC();
        metmark.SetX(xalign);
        metmark.SetY(0.87);
        metmark.SetMarkerSize(2);
        metmark.SetMarkerColor(kMagenta);
        genpart.push_back(metmark);

        TMarker jetmark = TMarker(0.5,0.5,20);
        jetmark.SetNDC();
        jetmark.SetMarkerSize(1.2);
        jetmark.SetX(0.12);
        jetmark.SetY(0.2);
        genpart.push_back(jetmark);
        myText(0.13,0.19,"AK4 Jets",kBlack,0.04);
        TMarker bjetmark = TMarker(0.5,0.5,20);
        bjetmark.SetNDC();
        bjetmark.SetMarkerSize(1.2);
        bjetmark.SetMarkerColor(8);
        bjetmark.SetX(0.12);
        bjetmark.SetY(0.16);
        genpart.push_back(bjetmark);
        myText(0.13,0.15,"CSVM AK4",kBlack,0.04);
        myText(0.08,0.94,"Ring color indicates FJ mass",kBlack,0.04);

        // if(sig) nextline = start - (4*npert+2)*increment-0.02-offset;
        //else nextline = start - 2*npert*increment-offset;


        for(int ij=0;ij<(int)jets_pt_->size();ij++)
        {
            if(jets_islep_->at(ij)==1) continue;
            if(ij==0) cout << "... skinny jet info (pT eta phi)" << endl;
            cout << jets_pt_->at(ij) << " " << jets_eta_->at(ij) << " " <<  jets_phi_->at(ij) << endl;
                TMarker jet = TMarker(jets_eta_->at(ij),jets_phi_->at(ij),20);
                jet.SetMarkerSize(1.2);
                if(jets_csv_->at(ij)>0.890) jet.SetMarkerColor(8);
                constituents.push_back(jet);
        }

/*
        bool drawn=false;
        for(int ifj = 0; ifj< (int)fjets.size(); ifj++){
            vector<fastjet::PseudoJet> cons = fjets[ifj].constituents();
            for(int ics = 0; ics<(int)cons.size();ics++){
                for(int ifj2=0; ifj2<(int)fjets.size(); ifj2++){
                    if(ifj2==ifj) continue;
                    TArrow first = TArrow(cons[ics].eta(),cons[ics].phi_std(), fjets[ifj].eta(),fjets[ifj].phi_std(),0.04,">");
                    if(deltaR(cons[ics].eta(),cons[ics].phi_std(), fjets[ifj2].eta(),fjets[ifj2].phi_std()) < 1.25){
                        //cout<<"type 1 line: con eta phi FJ eta phi"<<cons[ics].eta()<<" "<<cons[ics].phi_std()<<" "<<fjets[ifj2].eta()<<" "<<fjets[ifj2].phi_std()<<endl;
                        first.DrawArrow(cons[ics].eta(),cons[ics].phi_std(), fjets[ifj].eta(),fjets[ifj].phi_std(),0.0045,"|>");
                        drawn=true;
                        break;
                    }
                    else if(deltaR(cons[ics].eta(),cons[ics].phi_std(), fjets[ifj].eta(),fjets[ifj].phi_std()) > 1.15){
                        //cout<<"type 2 line: con eta phi FJ eta phi"<<cons[ics].eta()<<" "<<cons[ics].phi_std()<<" "<<fjets[ifj].eta()<<" "<<fjets[ifj].phi_std()<<endl;
                        first.DrawArrow(cons[ics].eta(),cons[ics].phi_std(), fjets[ifj].eta(),fjets[ifj].phi_std(),0.0045,"|>");
                        drawn=true;
                        break;}
                }
            }
            cons.clear();
        }
        if(drawn) myText(0.12,0.04,"Arrows indicate ambiguous clustering ownership",kBlack,0.03);

*/

        if(truth)
        {
            int col[4] = {30,38,44,46};
            if(!sig) col[1]=46;
            int LSP,top,b,W,Wda,gl;
            LSP=0;top=0;b=0;W=0;Wda=0;gl=0;
            TLorentzVector vgl[2];
            TLorentzVector vt[4];
            TLorentzVector vLSP[2];

            for(unsigned int imc = 0; imc < mc_id_->size(); imc++)
            {
                int id= (int)mc_id_->at(imc);
                int absid = abs(id);
                int mid = (int)mc_mom_->at(imc);
                int absmid= abs(mid);
                if(id!=mid)
                {
                    int marknum=0;
                    TString partname;
                    int color=0;
                    bool flag=false;
                    if(id==1000021){
                        if(gl<2) vgl[gl].SetPtEtaPhiM(mc_pt_->at(imc), mc_eta_->at(imc), mc_phi_->at(imc), 1500);
                        gl++;
                    }  

                    if(id==1000022)
                    {
                        color = LSPcol[LSP];
                        partname = "#tilde{#chi}^{0}_{1}";
                        if(LSP==0) nextline=start-2*npert*increment;
                        else nextline = start - (4*npert+1)*increment-offset;
                        LSP++;
                        flag=true;
                        marknum=25;//27;

                    }
                    if(absid == 6)
                    {
                        //top
                        marknum=22;
                        partname = "t";
                        flag =true;
                        nextline = start - npert*top*increment;
                        color = col[top];
                        if(!sig) {}
                        if(sig) {if(top>1){ nextline-=(increment+offset);}}
                        if(top<4)vt[top].SetPtEtaPhiM(mc_pt_->at(imc), mc_eta_->at(imc), mc_phi_->at(imc), 172.5); 
                        top++;
                    }

                    if(absid==5  && (mid==6 || mid==(-6)))
                    {
                        //b from top
                        marknum=23;
                        partname="b";
                        flag=true;
                        color = col[b];
                        nextline = start - npert*b*increment - 2*increment;
                        // if(!sig){}
                        if(sig) {if(b>1){ nextline-=(increment+offset);}}
                        b++;

                    }
                    if(absid==24  && (mid==6 || mid==(-6)))
                    {
                        //W
                        marknum=34;
                        partname = "W";
                        flag=true;
                        color = col[W];
                        nextline = start - npert*W*increment - increment;
                        // if(!sig){}
                        if(sig){if(W>1){ nextline-=(increment+offset);}}
                        W++;
                    }


                    if((absid==13 || absid== 11 || absid==15) && absmid==24)
                    {
                        marknum=29;
                        if(absid==13) partname = "#mu";
                        else if(absid==11) partname = "e";
                        else partname = "#tau";
                        if(!sig) flag =true;
                        color = col[TMath::FloorNint(Wda/2)];
                        nextline = start - npert*increment*TMath::FloorNint(Wda/2)-3*increment;
                        if(TMath::FloorNint(Wda/2) != Wda/2) nextline-=increment;
                        Wda++;

                    }

                    if((absid==12 || absid== 14 || absid==16) && absmid==24)
                    {
                        marknum=30;
                        partname = "#nu";     
                        if(!sig) flag =true;
                        color = col[TMath::FloorNint(Wda/2)];
                        nextline = start - npert*increment*TMath::FloorNint(Wda/2)-4*increment;
                        //if(TMath::FloorNint(Wda/2) != Wda/2) nextline-=increment;
                        Wda++;

                    }
                    if((absid>0 && absid<5) && absmid==24)
                    {
                        marknum=3;
                        if(absid==1) partname="d";
                        if(absid==2) partname="u";
                        if(absid==3) partname="s";
                        if(absid==4) partname="c";

                        if(!sig) flag =true;
                        color = col[TMath::FloorNint(Wda/2)];
                        nextline = start - npert*increment*TMath::FloorNint(Wda/2)-3*increment;
                        // if(TMath::FloorNint(Wda/2) != Wda/2) nextline-=increment;
                        if(absid % 2 ==1) nextline-=increment; 
                        Wda++;

                    }

                    if(flag)
                    {
                        TMarker temp = TMarker(mc_eta_->at(imc),mc_phi_->at(imc), marknum);
                        TMarker legmark = TMarker(0.81,nextline,marknum);
                        legmark.SetNDC();
                        legmark.SetX(xalign+0.01);
                        legmark.SetY(nextline+0.011);
                        TString label = partname + "  " + Form("%.0f",mc_pt_->at(imc));
                        myText(xalign+0.03,nextline,partname,color,0.04);
                        myText(xalign+0.07,nextline,Form("%.0f",mc_pt_->at(imc)),color,0.04);
                        temp.SetMarkerColor(color);
                        legmark.SetMarkerColor(color);
                        temp.SetMarkerSize(2);
                        legmark.SetMarkerSize(2);

                        if(absid==6 || absid==13 || absid==1000022){ temp.SetMarkerSize(3);} 
                        genpart.push_back(temp);
                        genpart.push_back(legmark);
                        flag=false;
                    }
                }
            }
            if(sig && LSP==0){
                int color = LSPcol[LSP];
                TString partname = "#tilde{#chi}^{0}_{1}";
                if(LSP==0) nextline=start-2*npert*increment;
                else nextline = start - (4*npert+1)*increment-offset;
                LSP++;
                int  marknum=25;//27;
                // TMarker temp = TMarker(mc_doc_eta->at(imc),mc_doc_phi->at(imc), marknum);
                vLSP[0]= vgl[0]-vt[0]-vt[1];
                TMarker temp = TMarker(vLSP[0].Eta(),vLSP[0].Phi(), marknum);
                TMarker legmark = TMarker(0.81,nextline,marknum);
                legmark.SetNDC();
                legmark.SetX(xalign+0.01);
                legmark.SetY(nextline+0.011);
                TString label = partname + "  " + Form("%.0f",vLSP[0].Pt());
                myText(xalign+0.03,nextline,partname,color,0.04);
                myText(xalign+0.07,nextline,Form("%.0f",vLSP[0].Pt()),color,0.04);
                temp.SetMarkerColor(color);
                legmark.SetMarkerColor(color);
                temp.SetMarkerSize(3);
                legmark.SetMarkerSize(2);


                genpart.push_back(temp);
                genpart.push_back(legmark);

            }
            if(sig && LSP==1){
                int color = LSPcol[LSP];
                TString partname = "#tilde{#chi}^{0}_{1}";
                if(LSP==0) nextline=start-2*npert*increment;
                else nextline = start - (4*npert+1)*increment-offset;
                LSP++;
                int marknum=25;//27;
                // TMarker temp = TMarker(mc_doc_eta->at(imc),mc_doc_phi->at(imc), marknum);
                vLSP[1]= vgl[1]-vt[2]-vt[3];
                TMarker temp = TMarker(vLSP[1].Eta(),vLSP[1].Phi(), marknum);
                TMarker legmark = TMarker(0.81,nextline,marknum);
                legmark.SetNDC();
                legmark.SetX(xalign+0.01);
                legmark.SetY(nextline+0.011);
                TString label = partname + "  " + Form("%.0f",vLSP[1].Pt());
                myText(xalign+0.03,nextline,partname,color,0.04);
                myText(xalign+0.07,nextline,Form("%.0f",vLSP[1].Pt()),color,0.04);
                temp.SetMarkerColor(color);
                legmark.SetMarkerColor(color);
                temp.SetMarkerSize(3);
                legmark.SetMarkerSize(2);


                genpart.push_back(temp);
                genpart.push_back(legmark);

            }
        }

        for(int ix=0;ix<(int)genpart.size();ix++)
        {
            genpart[ix].Draw("same");
        }
        for(int iy=0;iy<(int)constituents.size();iy++)
        {
            constituents[iy].Draw("same");
        }

        for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
        {
            if(fatjet) cone[ifj]->Draw();
        }
        h_fatjets->Draw("colz same");
        h_fatjets->SetTitle(Form("Event %lli",event_));

        h_fatjets->SetStats(0); 
        h_fatjets->SetXTitle("#eta"); 
        h_fatjets->SetYTitle("#phi"); 

        TString savename;
        if(!sig) savename = "fig/EventDisplay_"+cname+Form("%i_FJ",nfjets_); 
        else  savename = "fig/EventDisplay_"+cname+Form("%i_FJ",nfjets_);
        if(truth) savename+="_truth";
        else savename+="_notruth";	  
        if(fatjet) savename+="_fatjet";
        else savename+="_nofatjet";
        c->Print(savename+".pdf");
        //c->Print(savename+".C");

        c->Close();
        h_fatjets->Delete();
    }
}
void plotAnitaEventMap(Adu5Pat *patPtr,double phi,double theta){

  double sourceLon,sourceLat,headLon,headLat,phi10Lon,phi10Lat,phi6Lon,phi6Lat,phi14Lon,phi14Lat,actualLat,actualLon,actual2Lat,actual2Lon;
  float xEvent,yEvent,xAnita,yAnita,anitaLat,anitaLon,anitaAlt,xHead,yHead,x10,y10,x6,y6,x14,y14,yActual,xActual,yActual2,xActual2;

  anitaLat = patPtr->latitude;
  anitaLon = patPtr->longitude;
  anitaAlt = patPtr->altitude;

  UsefulAdu5Pat usefulPat(patPtr);
  std::cout << "source " << std::endl;
  //int sourceLoc = usefulPat.getSourceLonAndLatAltZero((180-phi)/180.*PI,(theta)/180.*PI,sourceLon,sourceLat);
  int sourceLoc = usefulPat.getSourceLonAndLatAltZero((phi)/180.*PI,(theta)/180.*PI,sourceLon,sourceLat);
  std::cout << std::endl << "heading " << std::endl;
  int headLoc = usefulPat.getSourceLonAndLatAltZero(0./180.*PI,10./180.*PI,headLon,headLat);
  std::cout << std::endl << "phi 10 " << std::endl;
  int headLoc10 = usefulPat.getSourceLonAndLatAltZero(180./180.*PI,10./180.*PI,phi10Lon,phi10Lat);
  std::cout << std::endl << "phi 14 " << std::endl;
  int headLoc14 = usefulPat.getSourceLonAndLatAltZero(270./180.*PI,10./180.*PI,phi14Lon,phi14Lat);
  std::cout << std::endl << "phi 6 " << std::endl;
  int headLoc6 = usefulPat.getSourceLonAndLatAltZero(90./180.*PI,10./180.*PI,phi6Lon,phi6Lat);
  std::cout << std::endl << "actual 14.5 " << std::endl;
  int actualLoc = usefulPat.getSourceLonAndLatAltZero(phi/180.*PI,12.5/180.*PI,actualLon,actualLat);
  std::cout << std::endl << "actual 4.5 " << std::endl;
  int actualLoc2 = usefulPat.getSourceLonAndLatAltZero(phi/180.*PI,7.5/180.*PI,actual2Lon,actual2Lat);
  //int sourceLoc = usefulPat.getSourceLonAndLatAltZero((phi)/180.*PI,(TMath::PiOver2()-theta)/180.*PI,sourceLon,sourceLat);
  TImage *map = TImage::Open("/home/mottram/work/eventCorrelator/macros/antarcticaIceMap.png");

  std::cout << "sourceLoc " << sourceLoc << " phi " << phi << " theta " << theta << " lon " << sourceLon << " lat " << sourceLat << std::endl;
  gStyle->SetMarkerColor(kBlack);
  //gStyle->SetMarkerSize(2);
  gStyle->SetTextSize(0.02);
  TMarker *anitaPos = new TMarker(xAnita,yAnita,23);

  getRelXYFromLatLong(anitaLat,anitaLon,xAnita,yAnita);
  getRelXYFromLatLong(static_cast<float>(sourceLat),static_cast<float>(sourceLon),xEvent,yEvent);
  getRelXYFromLatLong(static_cast<float>(headLat),static_cast<float>(headLon),xHead,yHead);
  getRelXYFromLatLong(static_cast<float>(phi10Lat),static_cast<float>(phi10Lon),x10,y10);
  getRelXYFromLatLong(static_cast<float>(phi14Lat),static_cast<float>(phi14Lon),x14,y14);
  getRelXYFromLatLong(static_cast<float>(phi6Lat),static_cast<float>(phi6Lon),x6,y6);
  getRelXYFromLatLong(static_cast<float>(actualLat),static_cast<float>(actualLon),xActual,yActual);
  getRelXYFromLatLong(static_cast<float>(actual2Lat),static_cast<float>(actual2Lon),xActual2,yActual2);

  TCanvas *canMap=(TCanvas*)gROOT->FindObject("canMap");
  if(!canMap)
     canMap = new TCanvas("canMap","canMap",(int)xSize,(int)ySize);
  canMap->Clear();
  canMap->SetLogz();
  canMap->SetTopMargin(0);
  canMap->SetBottomMargin(0);
  canMap->SetLeftMargin(0);
  canMap->SetRightMargin(0);

  map->Draw("");

  TMarker *headingPos = new TMarker(xHead,yHead,29);
  TMarker *heading14Pos = new TMarker(x14,y14,29);
  TMarker *heading10Pos = new TMarker(x10,y10,29);
  TMarker *heading6Pos = new TMarker(x6,y6,29);
  TMarker *actualPos = new TMarker(xActual,yActual,29);
  TMarker *actual2Pos = new TMarker(xActual2,yActual2,29);
  headingPos->SetMarkerColor(kRed);
  heading14Pos->SetMarkerColor(kGray);
  heading10Pos->SetMarkerColor(kGray+2);
  heading6Pos->SetMarkerColor(kViolet);
  actualPos->SetMarkerColor(kRed+2);//12.5 theta
  actual2Pos->SetMarkerColor(kBlue+2);//7.5 theta

  headingPos->Draw("");
  heading14Pos->Draw("");
  heading10Pos->Draw("");
  heading6Pos->Draw("");
  actualPos->Draw("");
  actual2Pos->Draw("");
  anitaPos->DrawMarker(xAnita,yAnita);
  

  TLatex *positionLabel=0;
  char label[FILENAME_MAX];

  if(sourceLoc==0){
    if(anitaAlt<0){
      sprintf(label,"Could not get event position, ANITA below 0 altitude!");
    }
    else if(theta>0){
      sprintf(label,"Pointing upwards!  Cannot locate source at ground position");
    }
    else{
      sprintf(label,"Unkown error, cannot position source at 0 altitude");
    }
    positionLabel = new TLatex();
    positionLabel->DrawLatex(0.05,0.95,label);
    return;
  }

  TMarker *eventPos = new TMarker(xEvent,yEvent,29);
  eventPos->SetMarkerColor(kBlack);
  eventPos->Draw("");

  sprintf(label,"ANITA location: lat %f; long %f; alt %f, x %f, y %f",anitaLat,anitaLon,anitaAlt,xAnita,yAnita);
  positionLabel = new TLatex();
  positionLabel->DrawLatex(0.05,0.97,label);
  sprintf(label,"Event location: lat %f; long %f, x %f, y %f",sourceLat,sourceLon,xEvent,yEvent);
  positionLabel->DrawLatex(0.05,0.94,label);

}
Пример #26
0
void kees_gen() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn");
  cn->Draw();
  cn->UseCurrentStyle();
  TH1F *frm = new TH1F("frm","",100,0.,10.);
  frm->GetXaxis()->SetTitle("Q^{2}  [GeV^{2}]");
  frm->GetYaxis()->SetTitle("G_{E}^{n}");
  frm->SetMinimum(-.02);
  frm->SetMaximum(0.1);
  frm->UseCurrentStyle();
  frm->Draw();
  frm->SetAxisRange(0.,5.,"X");

  TF1 *genf = new TF1("genf",genff,1.,10.,1);
  genf->SetLineColor(2);
  genf->SetLineStyle(2);
  genf->SetParameter(0,1.);
  genf->SetParameter(1,.3);
  genf->SetParameter(0,-0.632);
  // match to Madey point just below 1.5
  //  genf->SetParameter(0,.0411/genf->Eval(1.45));
  
  TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
  TLegend *legDta = new TLegend(.54,.6,.875,.90,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
  legDta->SetBorderSize(0); // turn off border
  legDta->SetFillStyle(0);
  
  datafile_t *f = datafiles;
  TGraph* gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      if (f->lnpt) {
	mgrDta->Add(gr,f->lnpt);
	legDta->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	mgrDta->Add(gr,"p");
	legDta->AddEntry(gr,f->label,"p");
      }	
      else {
	mgrDta->Add(gr,"l");
	legDta->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }
    

  mgrDta->Draw("p");
  //  legDta->Draw();   don't draw the data legend
  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
  TLegend *legThry = new TLegend(.54,.6,.875,.9,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
  wlg->SetBorderSize(0); // turn off border
  wlg->SetFillStyle(0);
  
  f = theoryfiles1;
  gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
      if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
	gr = toerror_band(egr);
	gr->SetFillStyle(3000+f->style);
      }
      if (f->lnpt) {
	wgr->Add(gr,f->lnpt);
	wlg->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	wgr->Add(gr,"p");
	wlg->AddEntry(gr,f->label,"p");
      }	
      else {
	wgr->Add(gr,"l");
	wlg->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }

  genf->Draw("same");
  mgrThry->Draw("c");
  legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
  legThry->Draw();

  // draw a line at 1
  cn->Modified();

  cn->Update();
  cn->SaveAs(Form("%s.eps",psfile));
  cn->SaveAs(Form("%s.root",psfile));
  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));
  // now an overlay, hopefully matching dimensions

  // remove everything but the graph
  cn->Update();
  TList *clist = cn->GetListOfPrimitives();
  TFrame* frame = cn->GetFrame();
  for (int i=0; i<clist->GetSize(); ) {
    if (clist->At(i) != frame) {
      clist->RemoveAt(i);
    } else i++;
  }
  // draw markers in the corners
  TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
  mkr->Draw();
  frame->SetLineColor(10);
  cn->Update();

  datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
			"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };

  gr = OneGraph(&miller);
  TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
    gr = toerror_band(egr);
    gr->SetLineStyle(1);
    gr->SetFillColor(gr->GetLineColor());
    gr->SetFillStyle(3000+miller.style);
  }
  
  gr->Draw("F");

  cn->Update();
  cn->SaveAs("gen_Miller_Overlay.eps");
  cn->SaveAs("gen_Miller_Overlay.root");
  
}
Пример #27
0
void drawEventZR(double vrlb, double vzlb, double vrl0, double vzl0, double pmu1, double etamu1, double pmu2, double etamu2, double ppr, double etapr, double ppi, double etapi, int colors = 0)
{
    Color_t colMu1(1), colMu2(1), colPr(1), colPi(1), colL0(1), colLb(1);
    switch(colors)
    {
	case 0:
	    colLb=1; colL0=2; colMu1=2; colMu2=2; colPr=3; colPi=4; break;
	case 1:
	    colLb=11; colL0=50; colMu1=50; colMu2=50; colPr=8; colPi=9; break;
    }
    cout << etamu1 << " " << etamu2 << " " << etapr << " " << etapi << endl;
    const double thetamu1 = 2*TMath::ATan(TMath::Exp(-etamu1));
    const double thetamu2 = 2*TMath::ATan(TMath::Exp(-etamu2));
    const double thetapr = 2*TMath::ATan(TMath::Exp(-etapr));
    const double thetapi = 2*TMath::ATan(TMath::Exp(-etapi));
    //const double thetamu1 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu1)))*sign(etamu1);
    //const double thetamu2 = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etamu2)))*sign(etamu2);
    //const double thetapr = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapr)))*sign(etapr);
    //const double thetapi = 2*TMath::ATan(TMath::Exp(-TMath::Abs(etapi)))*sign(etapi);
    // draw the vertices
    TMarker *m;
    const double xlb = vzlb;
    const double ylb = vrlb;
    m = new TMarker(xlb,ylb,7);
    m->SetMarkerColor(colLb);
    m->Draw();
    const double xl0 = vzl0;
    const double yl0 = vrl0;
    m = new TMarker(xl0,yl0,7);
    m->SetMarkerColor(colL0);
    m->Draw();
    // draw the l0 flight line
    TLine *l;
    l = new TLine(vzlb,vrlb,vzl0,vrl0);
    l->SetLineColor(colL0);
    l->SetLineStyle(2);
    l->Draw();
    // draw the muons
    TArrow *a;
    const double xmu1 = xlb + scalemu * pmu1 * TMath::Cos(thetamu1);
    const double ymu1 = ylb + scalemu * pmu1 * TMath::Sin(thetamu1);
    a = new TArrow(xlb,ylb,xmu1,ymu1,.01,">");
    a->SetLineColor(colMu1);
    a->Draw();
    const double xmu2 = xlb + scalemu * pmu2 * TMath::Cos(thetamu2);
    const double ymu2 = ylb + scalemu * pmu2 * TMath::Sin(thetamu2);
    a = new TArrow(xlb,ylb,xmu2,ymu2,.01,">");
    a->SetLineColor(colMu2);
    a->Draw();
    // draw the p and pi
    const double xpr = xl0 + scalepr * ppr * TMath::Cos(thetapr);
    const double ypr = yl0 + scalepr * ppr * TMath::Sin(thetapr);
    a = new TArrow(xl0,yl0,xpr,ypr,.01,">");
    a->SetLineColor(colPr);
    a->Draw();
    const double xpi = xl0 + scalepi * ppi * TMath::Cos(thetapi);
    const double ypi = yl0 + scalepi * ppi * TMath::Sin(thetapi);
    a = new TArrow(xl0,yl0,xpi,ypi,.01,">");
    a->SetLineColor(colPi);
    a->Draw();
}
Пример #28
0
void CsIProj()
{
  TFile *file = new TFile("../root/NZ_55_New.root");
  TFile *gates = new TFile("../gates/zlines.root");
  TFile *gates2 = new TFile("../gates/zlines_new.root");

  ofstream ofile("CsI_55A_New.dat");
  
  TCanvas *mycan = (TCanvas*)gROOT->FindObjectAny("mycan");
  if(!mycan)
    {
      mycan = new TCanvas("mycan","mycan");
      mycan->Divide(1,2);
    }
  
  
  ostringstream outstring;
  string name;
  int p1= 30, p2=50; //+- fit limits up to 2 peaks. May be different.
  int const num_par = 5; //number of peaks times 2(pol1)+3(gaus).
  
  for(int ic =0;ic<56;ic++)
    {
      
      outstring.str("");
      outstring << "dEE/dEE_" << ic;
      name = outstring.str();
      
      mycan->cd(1);
      TH2I *hist = (TH2I*)file->Get(name.c_str());
      hist->Draw("col");  
      hist->GetXaxis()->SetRangeUser(200.,1800.); 
      hist->GetYaxis()->SetRangeUser(5.,50.); 
   
      
      if(ic <16 || ic > 31)
	TCutG *mycut = (TCutG*)gates->Get(Form("Zline_%i_2_4",ic));
      else 
	TCutG *mycut = (TCutG*)gates2->Get(Form("Zline_%i_2_4",ic));
      mycut->Draw();

      file->cd();
      outstring.str("");
      outstring << "CsI/CsIGate/ECsI_" << ic << "_Gate";
      name = outstring.str();
      gPad->SetLogz();

      mycan->cd(2);
      TH1I * proj = (TH1I*)file->Get(name.c_str());
      proj->Draw();
      proj->Rebin(4);
      proj->GetXaxis()->SetRangeUser(700.,1800.);

      mycan->Modified();
      mycan->Update();

      TMarker * mark;
      mark=(TMarker*)mycan->WaitPrimitive("TMarker"); //Get the Background limits
      int bkg_lo = mark->GetX();
      delete mark;  
      mark=(TMarker*)mycan->WaitPrimitive("TMarker");
      int bkg_hi = mark->GetX();
      delete mark;
      mark=(TMarker*)mycan->WaitPrimitive("TMarker"); // Get the 1st peak initial guess
      int peak1 = mark->GetX();
      delete mark;
      
      
      double par[num_par] = {0.};
      double out[num_par] = {0.}; 
      int peak1_lo = peak1 - p1, peak1_hi = peak1 + p1; // Peak center and limits
      
      
      TF1 *l1 = new TF1("l1", "pol1", bkg_lo, bkg_hi);
      TF1 *g1 = new TF1("g1", "gaus", peak1_lo,peak1_hi);
      
      TF1 *total = new TF1("total", "pol1(0)+gaus(2)", bkg_lo,bkg_hi);
      
      proj->Fit(l1,"R");
      proj->Fit(g1,"R+");
      
      l1->GetParameters(&par[0]);
      g1->GetParameters(&par[2]);
      
      total->SetParameters(par);
      proj->Fit(total,"R");
      total->GetParameters(out);
      
      
      ofile << ic << " " << out[3] << endl;
      
      outstring.str("");
      outstring << "55A_" << ic;
      name = outstring.str();
      total->SetName(name.c_str());
      total->Draw("same");
      mycan->Modified();
      mycan->Update();
      
      bool IsGood = 0;

      cout << "Good fit?" << endl;
      cin >> IsGood;
  

      if(IsGood)
	{
      ofile << ic << " " << out[3] << endl;
	}      
      else
	ofile << ic << " " << -1 << endl;      

   

    }
  
  
  return;
}
Пример #29
0
void long_Ay_nu_05() {
  gROOT->SetStyle("HALLA");
  TCanvas *cn = new TCanvas("cn","cn",540,360);
  cn->Draw();
  cn->UseCurrentStyle();
  TH1F *frm = new TH1F("frm","",100,0.,10.);
  frm->GetXaxis()->SetTitle("#nu (GeV)");
  frm->GetYaxis()->SetTitle("Ay for Q2=0.456 (GeV/c)2");
  frm->SetMinimum(0);
//  frm->SetMinimum(0);
//  frm->SetMaximum(1.0);
  frm->SetMaximum(0.35);
  frm->UseCurrentStyle();
  frm->Draw();
  frm->SetAxisRange(0.120,0.350,"X");
//  frm->SetAxisRange(0.5,1.1,"X");

//  TF1* galster = new TF1("galster","x/(4.*0.938*.938)*1.91/(1.+x/.71)^2/(1.+5.6*x/(4.*.938*.938))",0.,4.);
//  galster->SetLineColor(6);
//  galster->SetLineStyle(3);
//  galster->SetLineWidth(2);


  TF1 *genf = new TF1("genf",genff,1.,10.,1);
  genf->SetLineColor(2);
  genf->SetLineStyle(2);
  genf->SetParameter(0,1.);
  // match to Madey point just below 1.5
  // genf->SetParameter(0,.0411/genf->Eval(1.45));
  genf->SetParameter(0,-0.558645);

//  TF1 *bbba05 = new TF1("BBBA05",gen_bbba05,0.,10.,0);
//  bbba05->SetLineColor(7);
//  bbba05->SetLineStyle(3);

  
  TMultiGraph* mgrDta = new TMultiGraph("Data","G_{E}^{n}");
  TLegend *legDta = new TLegend(.54,.6,.875,.90,"","brNDC");

  TMultiGraph* wgr = mgrDta;
  TLegend *wlg = legDta;

   // the data
  legDta->SetBorderSize(0); // turn off border
  legDta->SetFillStyle(0);
  
  datafile_t *f = datafiles;
  TGraph* gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      if (f->lnpt) {
	mgrDta->Add(gr,f->lnpt);
	legDta->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	mgrDta->Add(gr,"p");
	legDta->AddEntry(gr,f->label,"p");
      }	
      else {
	mgrDta->Add(gr,"l");
	legDta->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }
    

  mgrDta->Draw("p");
//  legDta->Draw();
  TF1 *theFit = new TF1("theFit","pol0");
  gr->Fit(theFit);
  theFit->Draw("same");  
  TMultiGraph* mgrThry = new TMultiGraph("Theory","G_{E}^{n}");
  TLegend *legThry = new TLegend(.54,.3,.875,.6,"","brNDC");

  wgr = mgrThry;
  wlg = legThry;

  // the theory
  wlg->SetBorderSize(0); // turn off border
  wlg->SetFillStyle(0);
  
  f = theoryfiles1;
  gr=0;
  while ( f && f->filename ) {
    gr=OneGraph(f);
    if (gr) {
      TGraphAsymmErrors *egr = dynamic_cast<TGraphAsymmErrors*>(gr);
      if (egr && egr->GetN()>1 && egr->GetEYhigh() && egr->GetEYhigh()[1]>0) {
	gr = toerror_band(egr);
	gr->SetFillStyle(3000+f->style);
      }
      if (f->lnpt) {
	wgr->Add(gr,f->lnpt);
	wlg->AddEntry(gr,f->label,f->lnpt);
      }
      else if (gr->GetMarkerStyle()>=20) {
	wgr->Add(gr,"p");
	wlg->AddEntry(gr,f->label,"p");
      }	
      else {
	wgr->Add(gr,"l");
	wlg->AddEntry(gr,f->label,"l");
      }
    }
    f++;
  }

//  genf->Draw("same");
  mgrThry->Draw("c");
//  galster->Draw("same");
//  bbba05->Draw("same");
//  legThry->AddEntry(genf,"F_{2}/F_{1} #propto ln^{2}(Q^{2}/#Lambda^{2})/Q^{2}","l");
//  legThry->AddEntry(galster,"Galster fit","l");
//  legThry->AddEntry(bbba05,"BBBA05","l");
//  legThry->Draw();
//  legDta->Draw();
  
  // draw a line at 1
  cn->Modified();

  cn->Update();
  cn->SaveAs(Form("%s.eps",psfile));
  cn->SaveAs(Form("%s.root",psfile));
  gSystem->Exec(Form("./replace_symbols.pl %s.eps",psfile));

  return;  // LEAVING HERE

  // now an overlay, hopefully matching dimensions

  // remove everything but the graph
  cn->Update();
  TList *clist = cn->GetListOfPrimitives();
  TFrame* frame = cn->GetFrame();
  for (int i=0; i<clist->GetSize(); ) {
    if (clist->At(i) != frame) {
      clist->RemoveAt(i);
    } else i++;
  }
  // draw markers in the corners
  TMarker *mkr = new TMarker(frame->GetX1(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY1(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX1(),frame->GetY2(),2);
  mkr->Draw();
  mkr = new TMarker(frame->GetX2(),frame->GetY2(),2);
  mkr->Draw();
  frame->SetLineColor(10);
  cn->Update();

  datafile_t miller = { "figure_input/Miller/lattice.GEn.rtf","Miller",
			"[0]","[1]","[1]-[3]","[2]-[1]",0,0,1,3,"F" };

  gr = OneGraph(&miller);
  TGraphAsymmErrors* egr = dynamic_cast<TGraphAsymmErrors*>(gr);
  if (egr && egr->GetEYhigh() && egr->GetEYhigh()[egr->GetN()/2]>0) {
    gr = toerror_band(egr);
    gr->SetLineStyle(1);
    gr->SetFillColor(gr->GetLineColor());
    gr->SetFillStyle(3000+miller.style);
  }
  
  gr->Draw("F");

  cn->Update();
  cn->SaveAs("gen_Miller_Overlay.eps");
  cn->SaveAs("gen_Miller_Overlay.root");
  
}
Пример #30
0
void Neutrals (/*TH1 *h1*/)//const char *part="e")//,int nevent = 1000)
{
  cout << "TEST VII" << endl; 
  char infile[100];
  int pz[9] = {1,2,4,8,12,16,32,40,50};
  double x[9];
  double means[9] = {0};
  double y[9];
  double mval = 0;
  int lastbincont = 0;
  bool lastbin = false;
  int var = 11;
  double intnum[1000]  = {0};
  double varnum[1000] = {0};
  char *part[] = {"gamma","neutron","anti_neutron"};
  int i = 0;
  int w =4;
  //TCanvas *c3 = new TCanvas("TresGraphitos","stupid graph",1);
  // TH1F *h4 = new TH1F("histo","histo",1000,0,.5);
  //TH2F *h3 = new TH2F("HistoGraph","HistoGraph",1000,0,.55,1000,0,1.2);
  // TMarker *grmark = new TMarker();
  //	  TCanvas *c19 = new TCanvas();
  // h3->Draw();
  for (int q=0; q<3; q++) 
  {
    for (int w=0; w<9;w++)
    {
      cout << "TEST VI" << endl;
      char ffile[100];
      sprintf(ffile,"/phenix/u/jpinkenburg/sPHENIX/analysis/AntiSigma/macros/HistoBaseFiles/%s_ThinBins.root", part[q]);
      TFile *f = TFile::Open(ffile);
      char hname[100];
      sprintf(hname,"%s%dd",part[q],pz[w]);
      TH1F *h1 = (TH1F *)f->Get(hname);
      var = 11;
      i = 0;
      while (var <= 8001)
      {

	if (i<1000)
	{
	  varnum[i] = .005*(i);
	  intnum[i] = (h1->Integral(var-10,var))/10000.;//(h1->Integral());
	  i++;
	}
	var+=10;
      }
      // varnum[0] = 0;
      // intnum[0] = 0;
      char fname [100];
      sprintf(fname, "Gamma_Neutron_Hijing_Energy_Graphs.root");
      TFile *fout = TFile::Open(fname,"UPDATE");
      // h1->Write();
      //fout->Write();
      f->Close();
      //char hname[100];
      //sprintf(hname,"%s%dGeV",part[q],pz[w]);
      // cout << h1->Integral() << " "  <<  hname << " " << pz[i] << endl;
      //TH2 *h2 = new TH2F("hname","hname",1,0,5,1,0,1.2);
      gStyle->SetOptStat(0);

	  
      TMarker *mean = new TMarker();
      mean->SetMarkerStyle(20);
      mean->SetMarkerColor(3);
      char canvname[100];
      sprintf(canvname,"%s%d",part[q],pz[w]);
      //TCanvas *c3 = new TCanvas(canvname,"stupid graph",1);
      //double dtot[9] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9}; 
      cout << "TEST V" << endl;
      TGraph *gr = new TGraph((i-2),varnum,intnum);
      char gtitle[100];
      sprintf(gtitle,"%s%dGeV;ConeSize;Percentage of Energy Deposited",part[q],pz[w]);
      char gname[100];
      sprintf(gname,"%s%dGeV",part[q],pz[w]);
      cout << intnum[50] << " " << varnum[50] << endl;
      gr->SetTitle(gtitle);
      gr->SetName(gname);
      gr->SetMarkerStyle(20);
      if (part[q] == "anti_neutron")
      {
	gr->SetMarkerColor(4);
      }
      else if (part[q] == "neutron")
      {
	gr->SetMarkerColor(2);
      }
      else if (part[q] == "gamma")
      {
	gr->SetMarkerColor(3);
      }
      else 
      {
	cout << "idiot" << endl;
      }
//	  gr->SetMaximum(1.2);
      //h2->Draw();
      //gr->Draw("A*");
      gr->Draw("ALP");
      //c3->DrawFrame(0,0,0.5,1.2);
      // gr->PaintGrapHist((i-1),varnum,intnum,"chopt");
      //	  gr->SetHistogram(h4);
      //h4->Write();
      gr->Write();
      cout << "TEST 1" << endl;
      //  TH2F *h3 = (TH2F *) "HistoGraph";
      cout << "TEST II" << endl;

      cout << "TEST III" << endl;
      //h3->Write();
      cout << "TEST IV" << endl;
      //double x;
      //double y;
      //gr()->GetPoint(

      fout->Write();
      fout->Close();
      //	  gr->Close();
      for (int a=0;a<1000;a++)
      {
	intnum[a] = 0;
	varnum[a] = 0;
      }
	  
    }
  }
}