Пример #1
0
//____________________________________________________________________
void fitCircle(Int_t n=10000) {
   //generates n points around a circle and fit them
   TCanvas *c1 = new TCanvas("c1","c1",600,600);
   c1->SetGrid();
   gr = new TGraph(n);
   if (n> 999) gr->SetMarkerStyle(1);
   else        gr->SetMarkerStyle(3);
   TRandom3 r;
   Double_t x,y;
   for (Int_t i=0;i<n;i++) {
      r.Circle(x,y,r.Gaus(4,0.3));
      gr->SetPoint(i,x,y);
   }
   c1->DrawFrame(-5,-5,5,5);
   gr->Draw("p");

   //Fit a circle to the graph points
   TVirtualFitter::SetDefaultFitter("Minuit");  //default is Minuit
   TVirtualFitter *fitter = TVirtualFitter::Fitter(0, 3);
   fitter->SetFCN(myfcn);

   fitter->SetParameter(0, "x0",   0, 0.1, 0,0);
   fitter->SetParameter(1, "y0",   0, 0.1, 0,0);
   fitter->SetParameter(2, "R",    1, 0.1, 0,0);

   Double_t arglist[1] = {0};
   fitter->ExecuteCommand("MIGRAD", arglist, 0);

   //Draw the circle on top of the points
   TArc *arc = new TArc(fitter->GetParameter(0),
      fitter->GetParameter(1),fitter->GetParameter(2));
   arc->SetLineColor(kRed);
   arc->SetLineWidth(4);
   arc->Draw();
}
Пример #2
0
//____________________________________________________________________
void fitCircle(Int_t n=10000) {
   //generates n points around a circle and fit them
   TCanvas *c1 = new TCanvas("c1","c1",600,600);
   c1->SetGrid();
   gr = new TGraph(n);
   if (n> 999) gr->SetMarkerStyle(1);
   else        gr->SetMarkerStyle(3);
   TRandom3 r;
   Double_t x,y;
   for (Int_t i=0;i<n;i++) {
      r.Circle(x,y,r.Gaus(4,0.3));
      gr->SetPoint(i,x,y);
   }
   c1->DrawFrame(-5,-5,5,5);
   gr->Draw("p");


   auto chi2Function = [&](const Double_t *par) {
      //minimisation function computing the sum of squares of residuals
      // looping at the graph points
      Int_t np = gr->GetN();
      Double_t f = 0;
      Double_t *x = gr->GetX();
      Double_t *y = gr->GetY();
      for (Int_t i=0;i<np;i++) {
         Double_t u = x[i] - par[0];
         Double_t v = y[i] - par[1];
         Double_t dr = par[2] - std::sqrt(u*u+v*v);
         f += dr*dr;
      }
      return f;
   };

   // wrap chi2 funciton in a function object for the fit
   // 3 is the number of fit parameters (size of array par)
   ROOT::Math::Functor fcn(chi2Function,3);
   ROOT::Fit::Fitter  fitter;


   double pStart[3] = {0,0,1};
   fitter.SetFCN(fcn, pStart);
   fitter.Config().ParSettings(0).SetName("x0");
   fitter.Config().ParSettings(1).SetName("y0");
   fitter.Config().ParSettings(2).SetName("R");

   // do the fit 
   bool ok = fitter.FitFCN();
   if (!ok) {
      Error("line3Dfit","Line3D Fit failed");
   }   

   const ROOT::Fit::FitResult & result = fitter.Result();
   result.Print(std::cout);

   //Draw the circle on top of the points
   TArc *arc = new TArc(result.Parameter(0),result.Parameter(1),result.Parameter(2));
   arc->SetLineColor(kRed);
   arc->SetLineWidth(4);
   arc->Draw();
}
Пример #3
0
void feynman()
{
   //Draw Feynman diagrams
   // To see the output of this macro, click begin_html <a href="gif/feynman.gif">here</a>. end_html
   //Author: Otto Schaile

   TCanvas *c1 = new TCanvas("c1", "A canvas", 10,10, 600, 300);
   c1->Range(0, 0, 140, 60);
   Int_t linsav = gStyle->GetLineWidth();
   gStyle->SetLineWidth(3);
   TLatex t;
   t.SetTextAlign(22);
   t.SetTextSize(0.1);
   TLine * l;
   l = new TLine(10, 10, 30, 30); l->Draw();
   l = new TLine(10, 50, 30, 30); l->Draw();
   TCurlyArc *ginit = new TCurlyArc(30, 30, 12.5*sqrt(2), 135, 225);
   ginit->SetWavy();
   ginit->Draw();
   t.DrawLatex(7,6,"e^{-}");
   t.DrawLatex(7,55,"e^{+}");
   t.DrawLatex(7,30,"#gamma");

   TCurlyLine *gamma = new TCurlyLine(30, 30, 55, 30);
   gamma->SetWavy();
   gamma->Draw();
   t.DrawLatex(42.5,37.7,"#gamma");

   TArc *a = new TArc(70, 30, 15);
   a->Draw();
   t.DrawLatex(55, 45,"#bar{q}");
   t.DrawLatex(85, 15,"q");
   TCurlyLine *gluon = new TCurlyLine(70, 45, 70, 15);
   gluon->Draw();
   t.DrawLatex(77.5,30,"g");

   TCurlyLine *z0 = new TCurlyLine(85, 30, 110, 30);
   z0->SetWavy();
   z0->Draw();
   t.DrawLatex(100, 37.5,"Z^{0}");

   l = new TLine(110, 30, 130, 10); l->Draw();
   l = new TLine(110, 30, 130, 50); l->Draw();

   TCurlyArc *gluon1 = new TCurlyArc(110, 30, 12.5*sqrt(2), 315, 45);
   gluon1->Draw();

   t.DrawLatex(135,6,"#bar{q}");
   t.DrawLatex(135,55,"q");
   t.DrawLatex(135,30,"g");
   c1->Update();
   gStyle->SetLineWidth(linsav);
}
Пример #4
0
void drawtorroidmollers_rings(TString infilename="0", TString outfilenamestem="0")
{
	if (infilename=="0" || outfilenamestem=="0") {
		printf("Usage:\n\t.x drawtorroidmollers_rings_stamps.C(infilename, outfilename)\n\n");
		printf("Where infilename is a .root file \n");
		printf("  and outfilenamestem is the base name of an image file.\n");
		return;
	}  

	gROOT->Reset();
	char inifilename[200];//, outfilenamestem[200], parttype[100];

	Bool_t debug=0;

//	Bool_t doproton=0;
//	Bool_t dopostscript=0;
	Double_t deltaZwindowsize=20; //in mm

	sprintf(inifilename,"%s",infilename.Data());

	const Int_t totplots=6;
	Double_t distance[totplots]={6000,9000,14500,20000,24000,28250};
	TH2F* histos[totplots];

// 	const Int_t totplots=1;
// 	Double_t distance[totplots]={28479};

	char pstitle[200];

	printf("Using data file %s\n",inifilename);
	gROOT->SetStyle("Plain");
	gStyle->SetPalette(1);
	gStyle->SetOptStat(kFALSE);
	TFile *file0 = TFile::Open(inifilename);
	TCanvas *canvas = new TCanvas("canvas","Moller plots",800,800);

	char title[100];
	char weight[200];
	TGraph* scat[totplots];
	TLine line;
	TArc arc;
	arc.SetFillStyle(4000);
	arc.SetNoEdges(kFALSE);
	Double_t pi=3.14159265358979323846;
	Double_t length=600, openingangle=pi/14.;
	Double_t ymin, ymax, xmin, xmax;
	TTree *geant = (TTree*)file0->Get("geant");
	geant->SetMarkerStyle(20);
	geant->SetMarkerSize(0.15);
	for (int i=0; i<totplots; i++) {
		char drawstring[200];
		sprintf(drawstring,"y/1000:x/1000:1000*acos(pz2/sqrt(px2*px2+py2*py2+pz2*pz2))>>htemp%i",i);
		sprintf(weight,"(z>(%.0f)&&z<(%.0f)&&type==0)",distance[i]-deltaZwindowsize,distance[i]+deltaZwindowsize);
		if (debug) printf("%s\n%s\n",drawstring,weight);
		canvas->cd(i+1);
		Int_t num = geant->Draw(drawstring,weight,"colz");
		histos[i]=(TH2F*)gPad->GetPrimitive(Form("htemp%i",i));
		if (num<=0) {
			printf("\n%.0f doesn't seem to be a good choice!\n\n",distance[i]);
		} else {
			if (debug) printf("%i successful events\n",num);
			gPad->SetRightMargin(0.12);
			gPad->SetLeftMargin(0.12);
			gPad->SetTopMargin(0.12);
			gPad->SetBottomMargin(0.12);
			canvas->Update();
			ymin=gPad->GetUymin();
			ymax=gPad->GetUymax();
			xmin=gPad->GetUxmin();
			xmax=gPad->GetUxmax();
			printf("xmin %f, xmax %f, ymin %f, ymax %f, deltax %f, deltay %f\n",xmin,xmax,ymin,ymax,xmax-xmin,ymax-ymin);
		}
		sprintf(title,"z=%.2f m;x  (m);y   (m)", distance[i]/1000.);
		histos[i]->SetTitle(title);
		canvas->Update();
		canvas->Print(Form("%s_%.2fm.png",outfilenamestem.Data(),distance[i]/1000.));
	}	
}
void drawtorroidmollers_rings_compare(TString infilename1="0", TString infilename2="0", 
									  TString outfilenamestem="0", TString usercut="1")
{
	if (infilename1=="0" || infilename2=="0" || outfilenamestem=="0") {
		printf("Usage:\n\t.x drawtorroidmollers_rings_stamps.C(infilename1, infilename2, outfilename, [cut])\n\n");
		printf("Where infilenames is a .root file \n");
		printf("      outfilenamestem is the base name of an image file, and\n");
		printf("      cut is a cut string applied to the tree.\n");
		return;
	}  

	gROOT->Reset();
	Bool_t debug=1;
	Double_t deltaZwindowsize=25; //in mm

	const Int_t totplots=4;
	Double_t distance[totplots]={14500,20000,24000,28250};

// 	const Int_t totplots=1;
// 	Double_t distance[totplots]={28479};

	char pstitle[200];

	printf("Using data files %s\n             and %s \n\n",infilename1.Data(), infilename2.Data());
	gROOT->SetStyle("Plain");
	gStyle->SetPalette(1);
	gStyle->SetOptStat(kFALSE);
	TFile *file1 = TFile::Open(infilename1.Data());
	TTree *tree1 = (TTree*)file1->Get("geant");
	TFile *file2 = TFile::Open(infilename2.Data());
	TTree *tree2 = (TTree*)file2->Get("geant");
	TH2F* file1histos[totplots];
	TH2F* file2histos[totplots];

	Int_t Palette1[100],Palette2[100];
	UInt_t Number = 2;
	Int_t nb=20;

	Double_t Red[]    = { 1.00, 1.00};
	Double_t Green[]  = { 0.00, 0.00};
	Double_t Blue[]   = { 1.00, 0.00};
	Double_t Length[] = { 0.00, 1.00};
	Int_t FI = TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
	for (int i=0;i<nb;i++) Palette1[i] = FI+i;
	
	Double_t Red[]    = { 0.00, 0.00};
	Double_t Green[]  = { 1.00, 0.00};
	Double_t Blue[]   = { 1.00, 1.00};
	TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
	Int_t FI = TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
	for (int i=0;i<nb;i++) Palette2[i] = FI+i;
	
	TCanvas *canvas = new TCanvas("canvas","Moller plots",800,800);
	char title[100];
	char weight[200];
	TGraph* scat[totplots];
	TLine line;
	TArc arc;
	arc.SetFillStyle(4000);
	arc.SetNoEdges(kFALSE);
	Double_t pi=3.14159265358979323846;
	Double_t ymin, ymax, xmin, xmax;

	tree1->SetMarkerStyle(20);
	tree1->SetMarkerSize(0.15);
	tree2->SetMarkerStyle(20);
	tree2->SetMarkerSize(0.15);
	for (int i=0; i<totplots; i++) {
		char drawstring[400];
		gStyle->SetPalette(nb, Palette1);
		sprintf(drawstring,"y/1000:x/1000:1000*acos(pz2/sqrt(px2*px2+py2*py2+pz2*pz2))>>file1hist%i",i);
//		sprintf(drawstring,"y/1000:x/1000:5>>file1hist%i",i);
		sprintf(weight,"(z>(%.0f)&&z<(%.0f)&&type==0)&&(%s)",distance[i]-deltaZwindowsize,distance[i]+deltaZwindowsize,usercut.Data());
		if (debug) printf("%s\n%s\n",drawstring,weight);
		Int_t num1 = tree2->Draw(drawstring,weight,"col");
		file1histos[i]=(TH2F*)gPad->GetPrimitive(Form("file1hist%i",i));

		gStyle->SetPalette(nb, Palette2);
		sprintf(drawstring,"y/1000:x/1000:1000*acos(pz2/sqrt(px2*px2+py2*py2+pz2*pz2))>>file2hist%i",i);
//		sprintf(drawstring,"y/1000:x/1000:3>>file2hist%i",i);
		if (debug) printf("%s\n%s\n",drawstring,weight);
		Int_t num2 = tree1->Draw(drawstring,weight,"col");
		file2histos[i]=(TH2F*)gPad->GetPrimitive(Form("file2hist%i",i));

		if (num1<=0 || num2<=0) {
			printf("%i and %i successful events\n",num1,num2);
			printf("\n%.0f doesn't seem to be a good choice!\n\n",distance[i]);
		} else {
			if (debug) printf("%i and %i successful events\n",num1,num2);
			gPad->SetRightMargin(0.1);
			gPad->SetLeftMargin(0.1);
			gPad->SetTopMargin(0.1);
			gPad->SetBottomMargin(0.1);
			canvas->Update();
			ymin=gPad->GetUymin();
			ymax=gPad->GetUymax();
			xmin=gPad->GetUxmin();
			xmax=gPad->GetUxmax();
			printf("xmin %f, xmax %f, ymin %f, ymax %f, deltax %f, deltay %f\n",xmin,xmax,ymin,ymax,xmax-xmin,ymax-ymin);
// 			if (xmin>0) {
// // 				file1histos[i]->SetAxisRange(0,xmax,"X");
// // 				file2histos[i]->SetAxisRange(0,xmax,"X");
// 				file1histos[i]->GetXaxis()->SetRangeUser(0,xmax);
// 				file2histos[i]->GetXaxis()->SetRangeUser(0,xmax);
// 			}
			sprintf(title,"z=%.2f m;x  (m);y   (m)", distance[i]/1000.);
			file1histos[i]->SetTitle(title);
			file2histos[i]->SetTitle(title);
			canvas->Clear();
			file1histos[i]->Draw("colz");
// 			if (xmin>0) //file1histos[i]->GetXaxis()->SetRangeUser(0,xmax);
// 				gPad->SetUxmin(0);//file1histos[i]->SetAxisRange(0,xmax,"X");
			canvas->Update();
			canvas->Print(Form("%s_%.2fm_1.png",outfilenamestem.Data(),distance[i]/1000.));
			file2histos[i]->Draw("col,same");
			canvas->Update();
			canvas->Print(Form("%s_%.2fm.png",outfilenamestem.Data(),distance[i]/1000.));
			canvas->Clear();
			file2histos[i]->Draw("colz");
// 			if (xmin>0) //file2histos[i]->GetXaxis()->SetRangeUser(0,xmax);
// 				gPad->SetUxmin(0);//file1histos[i]->SetAxisRange(0,xmax,"X");
			canvas->Update();
			canvas->Print(Form("%s_%.2fm_2.png",outfilenamestem.Data(),distance[i]/1000.));
		}
	}	
}
Пример #6
0
void much_draw_digis(
  TString mcFileName   = "data/mc.root",
  TString digiFileName = "data/much_digi_sector.root",
  TString rcFileName   = "data/hits.root",
  Int_t iEvent = 0,
  Int_t iStationSelected = 0,
  Int_t iLayerSelected = 2,
  Int_t iSideSelected = 0, // 0 - front, 1 - back, 2 - both
  Double_t xmin = -250,
  Double_t xmax = 250,
  Double_t ymin = -250,
  Double_t ymax = 250
){
  TString paramDir = gSystem->Getenv("VMCWORKDIR");
  TString digiFileName = paramDir+"/parameters/much/much_v12c.digi.root";

  
  gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
  basiclibs();
  gROOT->LoadMacro("$VMCWORKDIR/macro/much/muchlibs.C");
  muchlibs();

  // init digi scheme
  TFile* digiFile = new TFile(digiFileName);
  TObjArray* stations = (TObjArray*) digiFile->Get("stations");
  CbmMuchGeoScheme* digiScheme = CbmMuchGeoScheme::Instance();
  digiScheme->Init(stations);
  
  // get TClonesArrays from trees
  TFile* mcFile = new TFile(mcFileName);
  TFile* rcFile = new TFile(rcFileName);
  TTree* mcTree = mcFile ? (TTree*) mcFile->Get("cbmsim") : 0;
  TTree* rcTree = rcFile ? (TTree*) rcFile->Get("cbmsim") : 0;
  TClonesArray* points = new TClonesArray("CbmMuchPoint");
  TClonesArray* digis  = new TClonesArray("CbmMuchDigi");
  TClonesArray* hits   = new TClonesArray("CbmMuchPixelHit");
  if (mcTree) mcTree->SetBranchAddress("MuchPoint",&points);
  if (rcTree) rcTree->SetBranchAddress("MuchDigi",&digis);
  if (rcTree) rcTree->SetBranchAddress("MuchPixelHit",&hits);
  if (mcTree) mcTree->GetEntry(iEvent);
  if (rcTree) rcTree->GetEntry(iEvent);
  

  // Draw pads
  TCanvas* c1 = new TCanvas("station","station",1000*(xmax-xmin)/(ymax-ymin),1000);
  c1->Range(xmin,ymin,xmax,ymax);
  for (Int_t iSide=1;iSide>=0;iSide--){
    if (iSideSelected!=2 && iSide!=iSideSelected)continue;
    CbmMuchLayerSide* side = digiScheme->GetLayerSide(iStationSelected,iLayerSelected,iSide);
    for (Int_t iModule=0;iModule<side->GetNModules();++iModule) {
      CbmMuchModuleGem* module = (CbmMuchModuleGem*) side->GetModule(iModule);
      if (!module) continue;
      module->Draw();
      printf("%i\n",module->GetNPads());
    }
  }
  return;
  // Mark fired pads
  for (Int_t i=0;i<digis->GetEntriesFast();i++){
    CbmMuchDigi* digi = (CbmMuchDigi*) digis->At(i);
    // Filter out points
    Int_t detId = digi->GetDetectorId();
    if (!IsSelected(detId,iStationSelected,iLayerSelected,iSideSelected)) continue;
    CbmMuchModuleGem* module = (CbmMuchModuleGem*)digiScheme->GetModuleByDetId(detId);
    if (!module) continue;
    module->SetPadFired(digi->GetChannelId(),i,digi->GetADCCharge());
  }

  // Draw points
  for (Int_t i=0;i<points->GetEntriesFast();i++){
    CbmMuchPoint* point = (CbmMuchPoint*) points->At(i);
    Int_t detId = point->GetDetectorId();
    if (!IsSelected(detId,iStationSelected,iLayerSelected,iSideSelected)) continue;
    TLine* l = new TLine(point->GetXIn()-0.1,point->GetYIn()-0.1,point->GetXOut()+0.1,point->GetYOut()+0.1);
    l->SetLineColor(kBlack);
    l->SetLineWidth(3);
    l->Draw();
  }

  // Draw hits
  for (Int_t i=0;i<hits->GetEntriesFast();i++){
    CbmMuchPixelHit* hit = (CbmMuchPixelHit*) hits->At(i);
    Int_t detId = hit->GetDetectorId();
    if (!IsSelected(detId,iStationSelected,iLayerSelected,iSideSelected)) continue;
    TEllipse* p = new TEllipse(hit->GetX(),hit->GetY(),0.08);
    p->SetFillColor(kRed);
    p->SetLineColor(kRed);
    p->Draw();
  }

  
  // Draw a hole
  TArc* holeArc = new TArc(0.,0.,digiScheme->GetStation(iStationSelected)->GetRmin());
  holeArc->Draw();
  c1->Print("station.png");
}
void makegraph_xyhits_mchamp1000(){

  //bool save_plots = false;
  bool save_plots = true;

  TCanvas* canvas = new TCanvas("c1","c1",10,10,700,550);
  //canvas_style(canvas);

  //TH2* h1=new TH2F("h1","",2000,0,2000,2000,-1000,1000);
  TH2* h1=new TH2F("h1","",1000,-1000,0,1000,0,1000);
  h1->SetStats(kFALSE);
  h1->SetTitle(";x [cm];y [cm]");
  //h2_style(h1,3,1,1,1001,50,-1111.,-1111.,510,510,20,1,1.4,0);

  const Int_t n_hits = 20;
  Float_t x[n_hits] = {-522.992,
		       -524.292,
		       -525.592,
		       -526.892,
		       -606.525,
		       -607.825,
		       -609.124,
		       -610.424,
		       -630.144,
		       -631.444,
		       -632.744,
		       -634.044,
		       -741.681,
		       -743.086,
		       -744.378,
		       -745.665,
		       -765.758,
		       -767.126,
		       -768.413,
		       -769.755};
  
  Float_t y[n_hits] = {82.024,
		       82.388,
		       82.661,
		       82.971,
		       101.400,
		       101.678,
		       101.929,
		       102.318,
		       106.826,
		       107.214,
		       107.421,
		       107.769,
		       132.755,
		       132.924,
		       133.286,
		       133.657,
		       138.406,
		       138.637,
		       139.007,
		       139.285};

  graph = new TGraph(n_hits, x, y);
  //gr_style(graph,1,1,1,1001,50,-1111,-1111,510,510,20,1,1.3,1);
  graph->SetMarkerStyle(20);
  graph->SetMarkerSize(1);
  graph->SetMarkerColor(1);
  graph->SetTitle(";x [cm];y [cm]");
  //graph->GetYaxis()->SetRangeUser(0,20);


  //Fit a circle to the graph points
  TVirtualFitter::SetDefaultFitter("Minuit");  //default is Minuit
  TVirtualFitter *fitter = TVirtualFitter::Fitter(0, 3);
  Int_t a,c;
  Double_t b,f,par;
  fitter->SetFCN(myfcn);

  fitter->SetParameter(0, "x0",   0,    0.1, -1000, 1000);
  fitter->SetParameter(1, "y0",   1000, 0.1, 0,     2000);
  fitter->SetParameter(2, "R",    1000, 0.1, 0,     1000);

  Double_t arglist[1] = {0};
  fitter->ExecuteCommand("MIGRAD", arglist, 0);

  //Draw the circle on top of the points
  TArc *arc = new TArc(fitter->GetParameter(0),
		       fitter->GetParameter(1),fitter->GetParameter(2));
  arc->SetLineColor(kRed);
  arc->SetLineWidth(4);



  Leg1 = new TLegend(0.45,0.75,0.75,0.85);
  //Leg1->AddEntry(graph_noChaCut,"Average Before TS","p");
  Leg1->AddEntry(graph,"After TS","p");
  //Leg1->AddEntry(graph_predicted,"Predicted After TS","p");
  Leg1->SetBorderSize(0);
  Leg1->SetTextSize(0.04);
  Leg1->SetFillColor(0);


  //TPaveLabel *text1 = new TPaveLabel(.17,.85,.37,.89,"CMS Preliminary    #sqrt{s}=8 TeV","NDC");
  //TPaveLabel *text1 = new TPaveLabel(.17,.85,.37,.89,"CMS Preliminary    #sqrt{s}=8 TeV    3.4 fb^{-1}","NDC");
  //TPaveLabel *text1 = new TPaveLabel(.17,.85,.37,.89,"CMS Preliminary    #sqrt{s}=8 TeV    4.4 fb^{-1}","NDC");
  TPaveLabel *text1 = new TPaveLabel(.17,.85,.37,.89,"CMS Preliminary    #sqrt{s}=8 TeV","NDC");
  text1->SetBorderSize(0);
  text1->SetTextSize(0.7);
  text1->SetFillColor(0);

  TPaveLabel *text2 = new TPaveLabel(.17,.85,.37,.89,"1000 GeV H++, Event 58654","NDC");
  text2->SetBorderSize(0);
  text2->SetTextSize(0.7);
  text2->SetFillColor(0);


  TPaveText* text1a = new TPaveText(-500,500,-300,700);
  text1a->SetBorderSize(0);
  text1a->SetTextSize(0.05);
  text1a->SetFillColor(0);
  double p0  = fitter->GetParameter(0);
  double p1  = fitter->GetParameter(1);
  double p2  = fitter->GetParameter(2);
  double e0  = fitter->GetParError(0);
  double e1  = fitter->GetParError(1);
  double e2  = fitter->GetParError(2);
  char p0name[50], p1name[50], p2name[50];
  sprintf(p0name,"x0 = %.2f #pm %.2f",p0,e0);
  sprintf(p1name,"y0 = %.2f #pm %.2f",p1,e1);
  sprintf(p2name,"R = %.2f #pm %.2f",p2,e2);
  text1a->AddText(p0name);
  text1a->AddText(p1name);
  text1a->AddText(p2name);


  canvas->cd();
  h1->Draw();
  arc->Draw("same");
  graph->Draw("Psame");
  //text1->Draw();
  text1a->Draw();
  text2->Draw();
  //Leg1->Draw();
  if(save_plots) canvas->SaveAs("../plots/hits_xy_mchamp1000.eps");

  //return 0;

}