Example #1
0
void CheckNorm(double Min, double Max, double Step) {

  vector <double> Mass;
  vector <double> BranchingRatio;
  vector <double> XSection;
  for (double i=Min; i<Max; i+=Step) {
    Mass.push_back(i);
    BranchingRatio.push_back(GetBR(i));
    XSection.push_back(GetXsection(i));
  }

  TGraph* BranchGraph = new TGraph(Mass.size(),&Mass[0],&BranchingRatio[0]);
  TGraph* XSectionGraph = new TGraph(Mass.size(),&Mass[0],&XSection[0]);
  BranchGraph->SetTitle("Interpolated Branching Ratios");
  XSectionGraph->SetTitle("Interpolated Cross Sections");
  BranchGraph->SetMarkerStyle(20);
  XSectionGraph->SetMarkerStyle(20);
  BranchGraph->SetMarkerSize(1);
  XSectionGraph->SetMarkerSize(1);

  TCanvas* c1 = new TCanvas("c1","c1",800,650);
  c1->cd();
  BranchGraph->Draw("AP");
  c1->SaveAs("BranchingRatios.png");
  c1->Clear();
  XSectionGraph->Draw("AP");
  c1->SaveAs("XSections.png");

  delete BranchGraph;
  delete XSectionGraph;
  delete c1;

}
Example #2
0
void SetTitle(TGraph& g, TString Xtitle, TString Ytitle, TString title){
	g.GetXaxis()->SetTitle(Xtitle);
	g.GetYaxis()->SetTitle(Ytitle);
	g.GetXaxis()->CenterTitle();
	g.GetYaxis()->CenterTitle();
	g.SetTitle(title);
}
Example #3
0
//Return a graph of the llscan
TGraph * LLscanResult::GetGraph() 
{
	double*  pvs = new double[parameterValues.size()] ;
	double* llvs = new double[parameterValues.size()] ;
	double llmax = 0 ;	
	for(unsigned int i=0; i< parameterValues.size() ; ++i ){
		pvs[i] = parameterValues[i] ;
		llvs[i] = llvalues_offset[i] ;
		if( llvs[i] > llmax ) llmax = llvs[i] ;
	}	

	TGraph* gr = new TGraph( Int_t(parameterValues.size()), pvs, llvs ) ;
	//gr->SetTitle("LL Scan for Parameter xxx");	
	gr->SetMarkerStyle(1);
	gr->SetLineWidth(2);
	gr->SetMarkerColor(4);
	gr->SetLineColor(4);
	gr->GetYaxis()->SetRangeUser( 0., llmax*1.2 );
	gr->GetYaxis()->SetLimits( 0., llmax*1.2 );
	gr->SetMinimum( 0.0 );
	gr->SetMaximum( llmax*1.2 );
	gr->Draw("ALP");
	string title("LL Scan for Parameter ") ;
	title+=parameterName.c_str();
	gr->SetTitle(title.c_str());	
	gr->GetXaxis()->SetTitle(parameterName.c_str());

	return gr ;
}
void particleinteractions2() {
  //Draw a simple graph
  // To see the output of this macro, click begin_html <a href="gif/graph.gif">here</a>. end_html
  //Author: Rene Brun

  TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

  c1->SetFillColor(42);
  c1->SetGrid();

  const Int_t n = 1000;
  Double_t x[n], y[n];
  int minEnergy = ceil(mass*pow(c,2));
  for (Int_t i=0; i < 1000;i++) {
    double  energy = minEnergy+i;
    x[i] = energy;
    y[i] = exp(-mass*c/(lifetime*sqrt(energy*energy-mass*mass*pow(c, 4))));
    printf(" i %i %f %f \n",i,x[i],y[i]);
  }
  TGraph *gr = new TGraph(n,x,y);
  gr->SetLineColor(2);
  gr->SetLineWidth(4);
  gr->SetMarkerColor(4);
  gr->SetMarkerStyle(21);
  gr->SetTitle("Particle Decay Graph");
  gr->GetXaxis()->SetTitle("Energy (MeV)");
  gr->GetYaxis()->SetTitle("Probability");
  gr->Draw("ACP");

  // TCanvas::Update() draws the frame, after which one can change it
  c1->Update();
  c1->GetFrame()->SetFillColor(21);
  c1->GetFrame()->SetBorderSize(12);
  c1->Modified();
}
Example #5
0
void setGraphOptions(TGraph &g)
{
  g.SetTitle("");
  g.SetMarkerColor(1);
  g.SetMarkerStyle(24);
  g.SetMarkerSize(.5);
}
Example #6
0
int decroissance_pi(float _p_pi = 1.0){

  //	random.seed(60934386)
  TRandom3 rand;
  rand.SetSeed();
  //float _p_pi;
  //cout << "Entrez l'impulsion des pions (en GeV) : p = ";
  //cin >> _p_pi;

  double x[1000] = {0.0};
  double y[1000] = {0.0};

  for (int i=0;i<1000;i++){
    //double _theta_cm_mu = rand.Uniform(TMath::Pi());
    double _theta_cm_mu = TMath::ACos(gRandom->Uniform(2.0)-1.0);
    double _phi_cm_mu = rand.Uniform(2*TMath::Pi());
    if (i < 10){
      cout << "i: " << i <<  " th_cm_mu = " << _theta_cm_mu << endl;
    }
    double _theta_lab_mu = 0.0, _p_lab_mu = 0.0;
    ThetaLab_mu(_p_pi, _theta_cm_mu, _theta_lab_mu, _p_lab_mu);
    cout << "th_lab_mu= " << _theta_lab_mu << " _p_lab_mu= " << _p_lab_mu << endl;
    x[i] = 1000*_theta_lab_mu;
    y[i] = _p_lab_mu;
  }

  TGraph *graph = new TGraph(1000, x, y);
  graph->SetTitle("Theta vs p_{LAB}");

  graph->Draw("A*");

  return 0;

}
Example #7
0
/**
 * \brief Plots the data
 * Plots the data in data_x and data_y
 * \param bool autox , bool autoy actually not needed ;)
 * \return bool on success
 */
bool Plotter::plot(bool autox , bool autoy){
  for(size_t j = 0 ; j< graph.size(); j++){
    try{
      TGraph *gr = graph[j].get();
      for(size_t i = 0; i < data_x.size(); i++){
	gr->SetPoint(i,data_x[i], data_y[i]);
      }
      
      if(!opt.autox){
	
	gr->GetHistogram()->GetXaxis()->SetRangeUser(opt.startx, opt.stopx);
      }      
      if(!opt.autoy){
	gr->GetHistogram()->GetYaxis()->SetRangeUser(opt.starty, opt.stopy);
      }
      gr->SetMarkerSize(0.2);
      gr->GetHistogram()->SetXTitle(opt.xlabel.c_str());
      gr->GetHistogram()->SetYTitle(opt.ylabel.c_str());
      gr->SetTitle(opt.plot_name.c_str());
      gr->Draw("A*");
    }catch(std::runtime_error &e){
      std::cerr << e.what() << std::endl;
      return false;
    }
  }
  return true;
}
Example #8
0
void graph() {
   TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);

   c1->SetFillColor(42);
   c1->SetGrid();

   const Int_t n = 20;
   Double_t x[n], y[n];
   for (Int_t i=0;i<n;i++) {
     x[i] = i*0.1;
     y[i] = 10*sin(x[i]+0.2);
     printf(" i %i %f %f \n",i,x[i],y[i]);
   }
   TGraph *gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetLineWidth(4);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->SetTitle("a simple graph");
   gr->GetXaxis()->SetTitle("X title");
   gr->GetYaxis()->SetTitle("Y title");
   gr->Draw("ACP");

   // TCanvas::Update() draws the frame, after which one can change it
   c1->Update();
   c1->GetFrame()->SetFillColor(21);
   c1->GetFrame()->SetBorderSize(12);
   c1->Modified();
}
Example #9
0
void testing() { //new
   TCanvas *c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
   c1->SetFillColor(42);
   c1->SetGrid();
   
   const int n = 20;
   double x[n], y[n];
   for (int i=0;i<n;i++) {
      x[i] = i;
      y[i] = 2*i;
      cout<<x[i]<<"\t"<<y[i]<<endl;
   }
   
   TGraph *gr = new TGraph(n,x,y);
   gr->SetLineColor(2);
   gr->SetLineWidth(4);
   gr->SetMarkerColor(4);
   gr->SetMarkerStyle(21);
   gr->SetTitle("a simple graph");
   gr->GetXaxis()->SetTitle("X title");
   gr->GetYaxis()->SetTitle("Y title");
   gr->Draw("ACP");
   
   c1->Update();
   c1->Modified();
   c1->Connect("Closed()", "TApplication", gApplication, "Terminate()"); //new
}
Example #10
0
void KVCanvas::ProjectionX(TH2* hh)
{
   TString pname = Form("%s_px", hh->GetName());
   Int_t ip = 1;
   while (gROOT->FindObject(pname.Data())) {
      pname = Form("%s_px%d", hh->GetName(), ip);
      ip++;
   }

   TH1* px = hh->ProjectionX(pname.Data());
   if (!px) return;
   Double_t minY = (hh->GetYaxis()->GetXmin());
   Double_t maxY = (hh->GetYaxis()->GetXmax());
   Double_t dY = (maxY - minY) * 0.8;

   Double_t maxH = px->GetBinContent(px->GetMaximumBin());

   TGraph* gg = 0;
   if ((gg = (TGraph*)gROOT->FindObject(Form("%s_gjx", hh->GetName())))) gg->Delete();

   gg = new TGraph;
   for (int i = 0; i < px->GetNbinsX(); i++) {
      gg->SetPoint(i, px->GetBinCenter(i), minY + px->GetBinContent(i)*dY / maxH);
   }

   gg->SetName(Form("%s_gjx", hh->GetName()));
   gg->SetTitle(Form("%s_gjx", hh->GetName()));
   gg->SetLineColor(kBlack);
   gg->SetMarkerColor(kBlack);
   gg->SetMarkerStyle(8);
   gg->Draw("PL");

   Modified();
   Update();
}
Example #11
0
TGraph* 
makeGraph(const TArrayI& adcs, Int_t rate) 
{
  Int_t    last = adcs.fArray[0];
  TArrayI  counts(4);
  TGraph*  graph = new TGraph(rate * adcs.fN);
  graph->SetLineColor(rate);
  graph->SetMarkerColor(rate);
  graph->SetMarkerStyle(20+rate);
  graph->SetLineStyle(rate);
  graph->SetName(Form("rate%d", rate));
  graph->SetTitle(Form("Rate %d", rate));
  for (Int_t i = 0; i < adcs.fN; i++) { 
    counts.Reset(-1);
    convert(rate, adcs.fArray[i], last, counts);
    
    for (Int_t j = 0; j < rate; j++) { 
      Int_t    idx = (i * rate + j);
      Double_t x   = (i + (rate > 1 ? Float_t(j+1) / rate-1 : 0));
      graph->SetPoint(idx, x, counts[j]);
    }
    last = counts[rate - 1];
  }
  return graph;
}
Example #12
0
void treegraph(TString filename) {
   gROOT->SetStyle("Plain");
   gStyle->SetOptDate();


   Double_t x, y;
   Int_t nlines = 0;
   TFile *f = new TFile("graph.root","RECREATE");

   TCanvas *canvas_graph = new TCanvas("canvas_graph", "y vs x",467,89,400,700);

   TTree t;
   t.ReadFile(filename,"x:y");
   t.Draw("x:y","","goff");

   TGraph *g = new TGraph(t.GetSelectedRows(),t.GetV1(),t.GetV2());
   g->SetTitle(filename+": Y vs X");
   g->GetXaxis()->SetTitle("x[a.u.]");
   g->GetYaxis()->SetTitle("y[a.u.]");

   g->SetMarkerStyle(21);
   g->Draw("AP");

   f->Write();
}
TGraph *graphLH(std::string nuisname, double err ){

	w->loadSnapshot("bestfitall"); // SetTo BestFit values as start

	// Get The parameter we want 
	RooRealVar *nuis =(RooRealVar*) w->var(nuisname.c_str());
	double bf = nuis->getVal();
	double nll_0=nll->getVal();


	TGraph *gr = new TGraph(2*npoints+1);
	for (int i=-1*npoints;i<=npoints;i++){
		nuis->setVal(bf+err*( ((float)i)*nsigma/npoints));
		double nll_v = nll->getVal();
		gr->SetPoint(i+npoints,nuis->getVal(),nll_v-nll_0);
	}

	gr->SetTitle("");
	gr->GetYaxis()->SetTitle("NLL - obs data");
	gr->GetYaxis()->SetTitleOffset(1.1);
	gr->GetXaxis()->SetTitleSize(0.05);
	gr->GetYaxis()->SetTitleSize(0.05);
	gr->GetXaxis()->SetTitle(nuisname.c_str());
	gr->SetLineColor(4);
	gr->SetLineWidth(2);
	gr->SetMarkerStyle(21);
	gr->SetMarkerSize(0.6);
	
	return gr;
	
}
Example #14
0
TGraph* tgraph(const char* name, const char* title, int color)
{
    TGraph* t = new TGraph();
    t->SetName(name);
    t->SetTitle(title);
    t->SetLineColor(color);
    return t;
}
void draw_axis_lambda(const char *opt = "")
{
    const Int_t nn = 2;
    Double_t xx[nn] = {LAMBDA_MIN, LAMBDA_MAX};
    Double_t yy[nn] = {LAMBDA_INT_MIN, LAMBDA_INT_MAX};
    TGraph *ga = new TGraph(nn, xx, yy);
    ga->SetTitle(Form("Intensity (Lambda) %s", opt));
    ga->GetXaxis()->SetTitle("Lambda");
    ga->GetYaxis()->SetTitle("Intensity");
    ga->Draw("ap");
}
void draw_axis_tof(const char *opt = "")
{
    const Int_t nn = 2;
    Double_t xx[nn] = {TOF_MIN, TOF_MAX};
    Double_t yy[nn] = {TOF_INT_MIN, TOF_INT_MAX};
    TGraph *ga = new TGraph(nn, xx, yy);
    ga->SetTitle(Form("Intensity (TOF) %s", opt));
    ga->GetXaxis()->SetTitle("TOF");
    ga->GetYaxis()->SetTitle("Intensity");
    ga->Draw("ap");
}
//Make lepton interference graph
TGraph* make_HZZ_LeptonInterferenceGraph(){
  float x[leptonInterf_YR3_Size];
  float y[leptonInterf_YR3_Size];
  for (int a=0; a<leptonInterf_YR3_Size; a++){
    x[a] = leptonInterf_YR3[a][0];
    y[a] = leptonInterf_YR3[a][1];
  }
  TGraph* tg = new TGraph(leptonInterf_YR3_Size, x, y);
  tg->SetName("tgHZZ_LeptonInterference");
  tg->SetTitle("H#rightarrowZZ#rightarrow4l Lepton Interference Weight on 4e, 4#mu wrt. 2e2#mu");

  return tg;
}
Example #18
0
TGraph *
GetHydroSpectrum(TFile *file, Int_t part, Int_t charge, Int_t cent)
{
  TGraph *h = (TGraph *)file->Get(Form("%s_C%d", HydroPartName[part], cent));
  if (!h) return NULL;
  h->SetTitle("Hydro");
  h->SetLineWidth(2);
  h->SetLineColor(kYellow+1);
  h->SetMarkerStyle(24);
  h->SetMarkerColor(kYellow+1);
  h->SetFillStyle(0);
  h->SetFillColor(0);
  return h;
}
Example #19
0
//g++ allDataPrint.cpp `root-config --cflags --glibs`
int main(int argc, char** argv)
#endif
{
  int colore = 2;
  TMultiGraph *mg = new TMultiGraph("potenziale","Potenziali");
  cout<<"Carico i dati\n";
  ifstream filenames("infonamelist.txt");
  string filename = "settings.set";
  if(argc>1)
    filename  = argv[1];
  //carico il file di impostazioni, per ricompilare meno spesso
  while(!filenames.eof()){
    string fname;
    filenames >> fname;//fname non deve contenere spazi e ".txt"
    if(fname.find(".set")==string::npos)
      fname+=".set";
    if(fname!=".set"){
      impostazioni info("gauss.set", fname.c_str(),filename.c_str());
      cout << fname << ":" << endl;
      int ns = info.NL(), skip = info.spaceSkip();
      double step = info.spaceStep();
      TGraph *gV = new TGraph();
      int j=0;
      for(int i=0;i<ns;i+=skip){
	double x =  i*step;
	gV->SetPoint(j++,x,info.potenziale(i));
      }

      gV->SetTitle(("Potenziale per " +fname).c_str());    
      gV->SetLineColor(colore++);
      mg->Add(gV);
    }
  }
  TCanvas c1("c1","Confronto Potenziali",600,450);
  // c1.Divide(2,1);
  //c1.cd(1);
  // merr->Draw("apl");
    mg->Draw("apl");
  c1.BuildLegend();
  /*
    c1.cd(2);
    merr->Draw("apl");
    c1.BuildLegend();
  */
#ifndef __CINT__
  theApp.Run(true);
  return 0;
#endif
}
Example #20
0
void readGr() {

	TGraph *gr = new TGraph("graph.dat");//  read txt file
	TCanvas *c1 = new TCanvas();
	gr->SetLineColor(2);
    gr->SetLineWidth(4);
    gr->SetMarkerColor(4);
    gr->SetMarkerStyle(21);
    gr->SetTitle("Draw graph from ASCII file");
    gr->GetXaxis()->SetTitle("X title");
    gr->GetYaxis()->SetTitle("Y title");
		
	gr->Draw("LAP");   //A -> Axis P->Point L->Line(Default)

}
void plot_efficienze()
{
	TCanvas* c1 = new TCanvas;
	TGraph* graph = new TGraph;

	std::ifstream data ("efficienze_hit_miss_rettangolo.txt");

	TString stringa;

	data >> stringa;
	data >> stringa;
	data >> stringa;

	double x, n;
	int i;

	i = 0;

	while (1)
	{
		data >> x;
		if (data.eof())
		{break;}
		data >> x;
		data >> n;

		graph -> SetPoint (i, x, n/10000000.);
	
		i++;
	}

	graph -> SetMarkerStyle (20);
	graph -> SetMarkerColor (kBlue);
	graph -> SetMarkerSize (0.8);

	graph -> GetXaxis() -> SetTitle ("Semilarghezza intervallo");
	graph -> GetYaxis() -> SetTitle ("Efficienza");

	graph->SetTitle("Efficienze del metodo hit-and-miss");

	/*
	c1 -> SetLogy();
	c1 -> SetLogx();
	*/	

	graph -> Draw("apc");
	c1->Print("3_hitmiss_efficienze.pdf", "pdf");
}
TGraph *NCMatrix::plot(int xcol, int ycol)
{
	TGraph *result = new TGraph;
	int nrows = getNRows(),j;
	
	checkRange(0, xcol);
	checkRange(0, ycol);
	
	result->SetName(Form("x%dy%d",xcol,ycol));
	result->SetTitle(Form("x-axis col %d, y-axis col %d",xcol,ycol));
	
	for(j = 0; j < nrows; j++)
		result->SetPoint(j, getElement(j, xcol), getElement(j, ycol));
	
	return result;
} // plotRow()
Example #23
0
File: TrPdf.C Project: krafczyk/AMS
void TrPdf::FitLogLog(double min, double max) {
  TGraph* FluxLogLogTmp = new TGraph(GetGraph()->GetN());
  FluxLogLogTmp->SetName("spectrumloglogtmp");
  FluxLogLogTmp->SetTitle("spectrumloglogtmp");
  for (int ii=0; ii<Graph->GetN(); ii++) {
    double a,b;
    GetGraph()->GetPoint(ii,a,b);
    FluxLogLogTmp->SetPoint(ii,log10(a),log10(b));
  }
  TF1* LinFitTmp = new TF1("linfittmp","[0]+[1]*x+[2]*pow(x,2.)+[3]*pow(x,3.)+[4]*pow(x,4.)+[5]*pow(x,5.)",-2.,5.); 
  FluxLogLogTmp->Fit(LinFitTmp,"EQR","",log10(min),log10(max));
  LogLog = new TF1(Form("LogLog_%s",GetName().Data()),
    "pow(10.,[0]+[1]*log10(x)+[2]*pow(log10(x),2.)+[3]*pow(log10(x),3.)+[4]*pow(log10(x),4.)+[5]*pow(log10(x),5.))",1.e-2,1.e5);
  for (int i=0; i<6; i++) LogLog->SetParameter(i,LinFitTmp->GetParameter(i));
  delete LinFitTmp;
  delete FluxLogLogTmp;
}
Example #24
0
//main of the program
void gslSplineDemoV3(double stepSpline =.01)
{

    //initialize data arrays
    const int nControl=10;
    double xControl[nControl]= {1,2,3,4,5,6,7,8,9,10};
    double yControl[nControl];
	 int seed = 7898;
	 TRandom3 *jrand = new TRandom3(seed);
    jrand->RndmArray(nControl,yControl);    // make a random array

    //initialize the spline
    gsl_interp_accel *acc = gsl_interp_accel_alloc ();
    gsl_spline *spline = gsl_spline_alloc (gsl_interp_cspline, nControl);

    //compute the spline
    gsl_spline_init (spline, xControl, yControl, nControl);

    //evaluate the spline
    int nSpline = int((xControl[nControl-1]-xControl[0])/stepSpline);
    double xSpline[nSpline], ySpline[nSpline];
    for (int i= 0; i < nSpline; i++)
    {
        xSpline[i] = xControl[0]+i*stepSpline;
        ySpline[i] = gsl_spline_eval (spline, xSpline[i], acc);
    }
    
    //clear the spline
    gsl_spline_free (spline);
    gsl_interp_accel_free (acc);

    //load the graphs
    TGraph *grControlPoints = new TGraph(nControl,xControl,yControl);
    grControlPoints->SetMarkerStyle(20);

    TGraph *grSpline = new TGraph(nSpline,xSpline,ySpline);
    grSpline->SetTitle("");
    grSpline->GetXaxis()->SetTitle("X-axis  [A.U.]");
    grSpline->GetYaxis()->SetTitle("Y-axis  [A.U.]");

    //plot
    TCanvas *c1 = new TCanvas("c1", "Graph", 200, 10, 700, 500);
    c1->cd();
    grSpline->Draw("al");
    grControlPoints->Draw("same p");
}
Example #25
0
//g++ allDataPrint.cpp `root-config --cflags --glibs`
int main(int argc, char** argv)
#endif
{
  TCanvas c3("c3","Grafico",640,512);
  TCanvas c1("c1","Confronto",1280,512);
  c1.Divide(2,1);
  
  preparedraw myData (argv[1],
		      // preparedraw::doMax |
		      preparedraw::doFh |
		      preparedraw::doSh |
		      preparedraw::doErr);
  
  TGraph2D *g = myData.data();
  TGraph *gb = myData.firsthalf();//before
  TGraph *ga = myData.secondhalf();//after
  TGraph *gerrs = myData.errs();
  //  TGraph *maxs = myData.maximum();
  
  c3.cd();
  g->GetXaxis()->SetTitle("X");
  g->GetYaxis()->SetTitle("T");
  //g->Draw("cont1");
  g->Draw("pcol");
  //g->Draw();
  //grafo.Draw("surf1");

  cout<<"Disegno i grafici\n";
  TMultiGraph *mg = new TMultiGraph("integrali","Integrali prima e dopo la barriera");
  
  ga->SetLineColor(2);
  mg->Add(gb);
  mg->Add(ga);
  c1.cd(1);
  mg->Draw("apl");
    

  gerrs->SetTitle("Andamento degli errori");
  c1.cd(2);
  gerrs->Draw("apl");
#ifndef __CINT__
  theApp.Run(true);
  return 0;
#endif
}
Example #26
0
TGraph *roc(TH1F* iH0,TH1F *iH1,bool iSames=false) { 
  int lN = iH0->GetNbinsX(); 
  double *lX = new double[lN];
  double *lY = new double[lN];
  bool lFirst = true;
  for(int i0 = 1; i0 < iH0->GetNbinsX()+1; i0++) { 
    lX[i0-1] = (iH0->Integral(lN-i0,1e9))/iH0->Integral(0,1e9); 
    lY[i0-1] = (iH1->Integral(lN-i0,1e9))/iH1->Integral(0,1e9); 
    if(lY[i0-1] > 0.85 && lFirst) {cout << "---> Back at 85% : " << lX[i0-1] << endl; lFirst = false;}
  }
  TGraph *lGraph = new TGraph(lN,lX,lY); lGraph->SetLineColor(kRed); lGraph->SetLineWidth(3);
  if(iSames) lGraph->SetLineColor(kBlue);
  lGraph->SetTitle("");
  lGraph->GetXaxis()->SetTitle("#epsilon_{back}");
  lGraph->GetYaxis()->SetTitle("#epsilon_{sig}");
  if(!iSames) lGraph->Draw("al");
  if(iSames) lGraph->Draw("l");
}
Example #27
0
void QAnalysis::PlotPower() {
  TTree* tree = (TTree*)ReadTree(file);
  TGraph* gr  = new TGraph();

  int cnt = 0;
  for (int i=0; i<tree->GetEntries(); i++) {
    tree->GetEntry(i);
	if (posID[0]==1 && posID[1]==1 && posID[2]==18) {
      gr->SetPoint(cnt, time, R*current*current*1e-3);
	  cnt++;
	}
  }
  
  gr->SetTitle("; Time [sec]; Power [kW]");
  gr->SetLineWidth(2);
  gr->SetLineColor(kOrange);
  gr->Draw("al");
}
Example #28
0
void QAnalysis::PlotVoltage() {
  TTree* tree = ReadTree(file);
  TGraph* gr  = new TGraph();
  
  int cnt = 0;
  for (int i=0; i<tree->GetEntries(); i++) {
    tree->GetEntry(i);
	if ( posID[0]==1 && posID[1]==1 && posID[2]==18 ) {
      gr->SetPoint(cnt, time, R * current);
	  cnt += 1;
	}
  }

  gr->SetTitle("; Time [sec]; Voltage [V]");
  gr->SetLineWidth(2);
  gr->SetLineColor(kPink-1);
  gr->Draw("al");
}
Example #29
0
void
TestShaping(int max=4)
{
  TArrayI adcs(10);
  TGraph* orig = new TGraph(adcs.fN);
  orig->SetName("Original");
  orig->SetTitle("Original");
  orig->SetMarkerStyle(25);
  orig->SetMarkerColor(1);
  orig->SetMarkerSize(2);
  orig->SetLineColor(1);
  for (Int_t i = 0; i < adcs.fN; i++) { 
    adcs.fArray[i] = Int_t(gRandom->Uniform(0, 1023));
    orig->SetPoint(i, i, adcs.fArray[i]);
  }

  TCanvas* c = new TCanvas("c", "c");
  c->SetFillColor(0);
  c->SetTopMargin(.02);
  c->SetRightMargin(.02);
  
  TH1* h = new TH1F("frame","frame", adcs.fN+1, -2, adcs.fN);
  h->SetMinimum(0);
  h->SetMaximum(1300);
  h->SetStats(0);
  h->Draw("");
  orig->Draw("pl same");

  TLegend* l = new TLegend(adcs.fN*3./4, 1023, adcs.fN, 1300, "", "");
  l->SetFillColor(0);
  l->SetBorderSize(1);
  l->AddEntry(orig, orig->GetTitle(), "lp");
  
  for (int i = 1; i <= max; i++) {
    TGraph* g = makeGraph(adcs, i);
    g->Draw("pl same");
    l->AddEntry(g, g->GetTitle(), "lp");
  }
  l->Draw();
  
  c->Modified();
  c->Update();
  c->cd();
}
Example #30
0
void QAnalysis::PlotResistance() {
  TTree* tree = ReadTree(file);
  TGraph* gr  = new TGraph();
  
  int cnt = 0;
  for (int i=0; i<tree->GetEntries(); i++) {
    tree->GetEntry(i);
	if ( posID[0]==1 && posID[1]==1 && posID[2]==18 ) {
      gr->SetPoint(cnt, time, R);
	  cnt += 1;
	}
  }
  
  gr->GetXaxis()->SetLabelSize(0);
  gr->SetTitle("; ; Resistance [#Omega]");
  gr->SetLineWidth(2);
  gr->SetLineColor(kRed);
  gr->Draw("al");
}