Esempio n. 1
0
int main() {
	std::ifstream infile1("/home/moonwave/workspace/github/jon/lang/c++app/src/thispointer.com/thefile.txt");
	int a, b;
//	while (infile1 >> a >> b)
//	{
//		std::cout << a << ", " << b << std::endl;
//	    // process pair (a,b)
//	}
//
//	std::cout << std::endl;
	// http://stackoverflow.com/questions/7868936/read-file-line-by-line
	std::ifstream infile("/home/moonwave/workspace/github/jon/lang/c++app/src/thispointer.com/thefile.txt");
	std::string line;
	while (std::getline(infile, line))
	{
		std::cout << line << std::endl;

		std::cout << std::endl;
//	    std::istringstream iss(line);
//	    int a, b;
//	    if (!(iss >> a >> b)) {
//	    	break;
//	    } // error
//
//	    // process pair (a,b)
//		std::cout << a << ", " << b << std::endl;
	}

//	test();

}
Esempio n. 2
0
void ExtractMatchingPairs(
    const char* model_file,
    const char* scene_file,
    const T& threshold,
    const char* extracted_model_file,
    const char* extracted_scene_file) {

  std::ifstream infile1(model_file);
  vnl_matrix<T> model;
  model.read_ascii(infile1);

  std::ifstream infile2(scene_file);
  vnl_matrix<T> scene;
  scene.read_ascii(infile2);

  vnl_matrix<T> extracted_model, extracted_scene;
  ExtractMatchingPairs<T>(
      model, scene, threshold, extracted_model, extracted_scene);

  std::ofstream outfile1(extracted_model_file, std::ios_base::out);
  extracted_model.print(outfile1);

  std::ofstream outfile2(extracted_scene_file, std::ios_base::out);
  extracted_scene.print(outfile2);
}
Esempio n. 3
0
void plot_dyb_ls(){
  ifstream infile1("dyb_ls_slow.dat");
  ifstream infile2("dyb_ls_fast.dat");
  Double_t x[2][300],y[2][300];
  for (Int_t i=0;i!=273;i++){
    infile1 >> x[0][i] >> y[0][i];
    infile2 >> x[1][i] >> y[1][i];
    
    x[0][i] = 1240./x[0][i];
    x[1][i] = 1240./x[1][i];
    
  }
  TGraph *g1 = new TGraph(273,x[0],y[0]);
  g1->Draw("A*");
  
  TGraph *g2 = new TGraph(273,x[1],y[1]);
  g1->Draw("*same");
  g1->SetMarkerColor(2);
}
void checkOverlap(string file1, string file2){

  vector<TrackerStrip> vec1;
  vector<TrackerStrip> vec2;

  ifstream infile1 (file1.c_str());
  ifstream infile2 (file2.c_str());

  TrackerStrip* strip = new TrackerStrip();
  if(infile1.is_open()){
    while(!infile1.eof()){
      infile1 >> strip->fecCrate_ >> strip->fecSlot_ >> strip->fecRing_ >> strip->ccuAdd_ >> strip->ccuCh_ >> strip->fedKey_ >> strip->lldCh_ >> strip->apvid_ >> strip->stripid_ ;
      vec1.push_back(*strip);
    }
  }
  infile1.close();

  if(infile2.is_open()){
    while(!infile2.eof()){
      infile2 >> strip->fecCrate_ >> strip->fecSlot_ >> strip->fecRing_ >> strip->ccuAdd_ >> strip->ccuCh_ >> strip->fedKey_ >> strip->lldCh_ >> strip->apvid_ >> strip->stripid_ ;
      vec2.push_back(*strip);
    }
  }
  infile2.close();

  long int total_vec1 = vec1.size();
  long int total_vec2 = vec2.size();
  long int common_strip;

  for(auto element : vec1){
    if(std::find(vec2.begin(),vec2.end(),element) != vec2.end())
      common_strip++;
  }
  
  cout<<"Total number of strips from file 1 "<<total_vec1<<endl;
  cout<<"Total number of strips from file 2 "<<total_vec2<<endl;
  cout<<"Common tagged strips "<<common_strip<<endl;
  cout<<"Fraction wrt file 1 "<<double(common_strip)/total_vec1<<endl;
  cout<<"Fraction wrt file 2 "<<double(common_strip)/total_vec2<<endl;

}
Esempio n. 5
0
main()
{
     vector<textwords, allocator> sample;
     vector<string,allocator> 	  t1, t2; 
     string 			  t1fn, t2fn;

     cout << "text file #1: "; cin >> t1fn;
     cout << "text file #2: "; cin >> t2fn;

     ifstream infile1( t1fn.c_str());
     ifstream infile2( t2fn.c_str());

     istream_iterator< string, diff_type > input_set1( infile1 ), eos; 
     istream_iterator< string, diff_type > input_set2( infile2 );

     copy( input_set1, eos, back_inserter( t1 ));
     copy( input_set2, eos, back_inserter( t2 ));

     sample.push_back( t1 ); sample.push_back( t2 );
     process_vocab( &sample );
}
Esempio n. 6
0
void g( const char* model_file,
    const char* scene_file,
    double threshold,
    const char* extracted_model_file,
    const char* extracted_scene_file) {

  std::ifstream infile1(model_file);
  vnl_matrix<double> model;
  model.read_ascii(infile1);

  std::ifstream infile2(scene_file);
  vnl_matrix<double> scene;
  scene.read_ascii(infile2);

  vnl_matrix<double> extracted_model, extracted_scene;
  f(model, scene, threshold, extracted_model, extracted_scene);

  std::ofstream outfile1(extracted_model_file, std::ios_base::out);
  extracted_model.print(outfile1);

  std::ofstream outfile2(extracted_scene_file, std::ios_base::out);
  extracted_scene.print(outfile2);
}
void endpointFormat() {

	TFile infile1("tmp1.root","open");
	TFile infile2("tmp2.root","open");

	TTree* intree1 = (TTree*)infile1.Get("tree");
	TTree* intree2 = (TTree*)infile2.Get("tree");
		

	_OutType outTrk;	


	TFile outfile("endpoint.root","recreate");
	TTree* outTree1 = new TTree("muonsTrk","muonsTrk");
	TTree* outTree2 = new TTree("muonsOpt","muonsOpt");

	
	float k,eta,phi;
	intree1->SetBranchAddress("k",&k);
	intree1->SetBranchAddress("eta",&eta);
	intree1->SetBranchAddress("phi",&phi);

	outTree1->Branch("trk1",&outTrk,"k/F:eta:phi:ptErr");

	int numEntries = intree1->GetEntries();
	std::cout<<"num entries: "<<numEntries<<std::endl;

	outTrk.ptErr=1.;

	for (int jEntry =0; jEntry < numEntries; ++jEntry) {
		intree1->GetEntry(jEntry);
		outTrk.k=k;
		outTrk.eta=eta;
		outTrk.phi=phi;

		outTree1->Fill();
	}

	intree2->SetBranchAddress("k",&k);
	intree2->SetBranchAddress("eta",&eta);
	intree2->SetBranchAddress("phi",&phi);
	outTree2->Branch("trk1",&outTrk,"k/F:eta:phi:ptErr");

	numEntries = intree1->GetEntries();
	std::cout<<"num entries: "<<numEntries<<std::endl;

	outTrk.ptErr=1.;

	for (int jEntry =0; jEntry < numEntries; ++jEntry) {
		intree2->GetEntry(jEntry);
		outTrk.k=k;
		outTrk.eta=eta;
		outTrk.phi=phi;

		outTree2->Fill();
	}

	outTree1->Write();
	outTree2->Write();
	


/*
	_outTree->Branch("trk1",&_outTrk1, "k/F:eta:phi:ptErr");
	_outTree->Branch("trk2",&_outTrk2, "k/F:eta:phi:ptErr");
*/

}
Esempio n. 8
0
// ----------------------------------------------------------------------------
//	constructor
//  overload constructor for class FileReader
// ----------------------------------------------------------------------------
FileReader::FileReader(const string & filename)
{
	ifstream infile1(filename);
	in = &infile1;
}
void final_pdf_error(){
const int nPoints0 = 53;
double pdf00[nPoints0],pdf01[nPoints0];

const int nPoints1 = 101;
double pdf10[nPoints1],pdf11[nPoints1];

const int nPoints2 = 41;
double pdf20[nPoints2],pdf21[nPoints2];

const int nPoints3 = 2;
double pdf30[nPoints3],pdf31[nPoints3];

const int nPoints4 = 2;
double pdf40[nPoints4],pdf41[nPoints4];

const int nPoints5 = 2;
double pdf50[nPoints5],pdf51[nPoints5];

int i = 0;
ifstream infile0("pdf_cteq66.txt");
while (infile0>>pdf00[i]
              >>pdf01[i]){ i++;}

i = 0;
ifstream infile1("pdf_nnpdf.txt");
while (infile1>>pdf10[i]
              >>pdf11[i]){ i++;}
	     
i = 0;
ifstream infile2("pdf_mstw.txt");
while (infile2>>pdf20[i]
              >>pdf21[i]){ i++;}
	     
i = 0;
ifstream infile3("pdf_cteq66_alphas.txt");
while (infile3>>pdf30[i]
              >>pdf31[i]){ i++;}

i = 0;
ifstream infile4("pdf_nnpdf_alphas.txt");
while (infile4>>pdf40[i]
              >>pdf41[i]){ i++;}
	     
i = 0;
ifstream infile5("pdf_mstw_alphas.txt");
while (infile5>>pdf50[i]
              >>pdf51[i]){ i++;}

double results00[2],results10[2],results20[2];
mstw_cteq(pdf00, nPoints0, results00);
nnpdf    (pdf10, nPoints1, results10);
mstw_cteq(pdf20, nPoints2, results20);
double results01[2],results11[2],results21[2];
mstw_cteq(pdf01, nPoints0, results01);
nnpdf    (pdf11, nPoints1, results11);
mstw_cteq(pdf21, nPoints2, results21);

double resultsN00[2],resultsN10[2],resultsN20[2];
combined_syst(pdf00, nPoints0, false, resultsN00);
combined_syst(pdf10, nPoints1, true , resultsN10);
combined_syst(pdf20, nPoints2, false, resultsN20);
double resultsN01[2],resultsN11[2],resultsN21[2];
combined_syst(pdf01, nPoints0, false, resultsN01);
combined_syst(pdf11, nPoints1, true , resultsN11);
combined_syst(pdf21, nPoints2, false, resultsN21);

printf("CTEQ  Acc syst. => + %5.3f - %5.3f\n",results00[0],results00[1]);
printf("NNPDF Acc syst. => + %5.3f - %5.3f\n",results10[0],results10[1]);
printf("MSTW  Acc syst. => + %5.3f - %5.3f\n",results20[0],results20[1]);
printf("CTEQ  Rec syst. => + %5.3f - %5.3f\n",results01[0],results01[1]);
printf("NNPDF Rec syst. => + %5.3f - %5.3f\n",results11[0],results11[1]);
printf("MSTW  Rec syst. => + %5.3f - %5.3f\n",results21[0],results21[1]);

printf("CTEQ  Acc syst. => + %5.3f - %5.3f\n",resultsN00[0],resultsN00[1]);
printf("NNPDF Acc syst. => + %5.3f - %5.3f\n",resultsN10[0],resultsN10[1]);
printf("MSTW  Acc syst. => + %5.3f - %5.3f\n",resultsN20[0],resultsN20[1]);
printf("CTEQ  Rec syst. => + %5.3f - %5.3f\n",resultsN01[0],resultsN01[1]);
printf("NNPDF Rec syst. => + %5.3f - %5.3f\n",resultsN11[0],resultsN11[1]);
printf("MSTW  Rec syst. => + %5.3f - %5.3f\n",resultsN21[0],resultsN21[1]);

double alpha_s_acc[3] = {100*(pdf30[0]-pdf30[1])/2.0/pdf00[0],100*(pdf40[0]-pdf40[1])/2.0/pdf10[0],100*(pdf50[0]-pdf50[1])/2.0/pdf20[0]};
double alpha_s_rec[3] = {100*(pdf31[0]-pdf31[1])/2.0/pdf01[0],100*(pdf41[0]-pdf41[1])/2.0/pdf11[0],100*(pdf51[0]-pdf51[1])/2.0/pdf21[0]};

printf("CTEQ/NNPDF/MSTW  Acc-alphas syst. => %5.3f  %5.3f  %5.3f\n",alpha_s_acc[0],alpha_s_acc[1],alpha_s_acc[2]);
printf("CTEQ/NNPDF/MSTW  Rec-alphas syst. => %5.3f  %5.3f  %5.3f\n",alpha_s_rec[0],alpha_s_rec[1],alpha_s_rec[2]);

double Vmax_acc = (1.0+resultsN00[0]/100.)*pdf00[0];
if((1.0+resultsN10[0]/100.)*pdf10[0] > Vmax_acc) Vmax_acc = (resultsN10[0]/100.+1)*pdf10[0];
if((1.0+resultsN20[0]/100.)*pdf20[0] > Vmax_acc) Vmax_acc = (resultsN20[0]/100.+1)*pdf20[0];
double Vmin_acc = (1.0-resultsN00[1]/100.)*pdf00[0];
if((1.0-resultsN10[0]/100.)*pdf10[0] < Vmin_acc) Vmin_acc = (1.0-resultsN10[0]/100.)*pdf10[0];
if((1.0-resultsN20[0]/100.)*pdf20[0] < Vmin_acc) Vmin_acc = (1.0-resultsN20[0]/100.)*pdf20[0];

double sigma_acc     = (Vmax_acc-Vmin_acc)/2.;
double x_central_acc = (Vmax_acc+Vmin_acc)/2.;

printf("Acc-additional syst. x,sigma: %7.5f +/- %7.5f ==> %7.5f\n",x_central_acc,sigma_acc,100*sigma_acc/x_central_acc);

double Vmax_rec = (1.0+resultsN01[0]/100.)*pdf01[0];
if((1.0+resultsN11[0]/100.)*pdf11[0] > Vmax_rec) Vmax_rec = (resultsN11[0]/100.+1)*pdf11[0];
if((1.0+resultsN21[0]/100.)*pdf21[0] > Vmax_rec) Vmax_rec = (resultsN21[0]/100.+1)*pdf21[0];
double Vmin_rec = (1.0-resultsN01[1]/100.)*pdf01[0];
if((1.0-resultsN11[0]/100.)*pdf11[0] < Vmin_rec) Vmin_rec = (1.0-resultsN11[0]/100.)*pdf11[0];
if((1.0-resultsN21[0]/100.)*pdf21[0] < Vmin_rec) Vmin_rec = (1.0-resultsN21[0]/100.)*pdf21[0];

double sigma_rec     = (Vmax_rec-Vmin_rec)/2.;
double x_central_rec = (Vmax_rec+Vmin_rec)/2.;

printf("Rec-additional syst. x,sigma: %7.5f +/- %7.5f ==> %7.5f\n",x_central_rec,sigma_rec,100*sigma_rec/x_central_rec);

double total0[2] = {sqrt((resultsN00[0]+resultsN00[1])*(resultsN00[0]+resultsN00[1])/4.+alpha_s_acc[0]*alpha_s_acc[0]+(100*sigma_acc/x_central_acc)*(100*sigma_acc/x_central_acc)),
                    sqrt((resultsN01[0]+resultsN01[1])*(resultsN01[0]+resultsN01[1])/4.+alpha_s_rec[0]*alpha_s_rec[0]+(100*sigma_rec/x_central_rec)*(100*sigma_rec/x_central_rec))};
printf("Acc-total syst CTEQ: %5.3f\n",total0[0]);
printf("Rec-total syst CTEQ: %5.3f\n",total0[1]);

double total1[2] = {sqrt((resultsN10[0]+resultsN10[1])*(resultsN10[0]+resultsN10[1])/4.+alpha_s_acc[1]*alpha_s_acc[1]+(100*sigma_acc/x_central_acc)*(100*sigma_acc/x_central_acc)),
                    sqrt((resultsN11[0]+resultsN11[1])*(resultsN11[0]+resultsN11[1])/4.+alpha_s_rec[1]*alpha_s_rec[1]+(100*sigma_rec/x_central_rec)*(100*sigma_rec/x_central_rec))};
printf("Acc-total syst MSTW: %5.3f\n",total1[0]);
printf("Rec-total syst MSTW: %5.3f\n",total1[1]);

double total2[2] = {sqrt((resultsN20[0]+resultsN20[1])*(resultsN20[0]+resultsN20[1])/4.+alpha_s_acc[2]*alpha_s_acc[2]+(100*sigma_acc/x_central_acc)*(100*sigma_acc/x_central_acc)),
                    sqrt((resultsN21[0]+resultsN21[1])*(resultsN21[0]+resultsN21[1])/4.+alpha_s_rec[2]*alpha_s_rec[2]+(100*sigma_rec/x_central_rec)*(100*sigma_rec/x_central_rec))};
printf("Acc-total syst NNPDF: %5.3f\n",total2[0]);
printf("Rec-total syst NNPDF: %5.3f\n",total2[1]);


}
Esempio n. 10
0
void plot_result(){
  Double_t cons[7],cons_err[7];
  Double_t slope[40],slope_err[40];
  ifstream infile1("bestfit.dat");
  for (Int_t i=0;i!=7;i++){
    infile1 >> cons[i] >> cons_err[i];
  }
  Double_t dis[7]={5,7.5,10,15,20,30,60};
  Double_t E[40]={0.01,0.01,0.01,0.01,0.01,
		  0.01,0.01,0.01,0.01,0.01,
		  0.01,0.01,0.01,0.1,0.13296,
		  0.150231,0.200244,0.266907,0.299419,0.399098,
		  0.450941,0.498655,0.531961,0.601063,0.664661,
		  0.801161,0.931623,1.00101,1.09901,1.19795,
		  1.40307,1.46487,1.49679,1.99508,2.12834,
		  2.49276,2.7964,3.00469,3.46897,4.00498
		  };

  LAr argon;
  Double_t temperature = 89;
  Double_t calc[40];
  Double_t calcT[40];

  for (Int_t i=0;i!=40;i++){
    infile1 >> slope[i] >> slope_err[i];

    Double_t vel = argon.vDrift(temperature,E[i]);
    calc[i] = argon.Diffusion(temperature,E[i],2);
    calcT[i] = argon.Diffusion(temperature,E[i],1);
    slope[i] = slope[i];
    slope_err[i] = slope_err[i];
    
  }
  
 

  TCanvas *c1 = new TCanvas("c1","c1",1200,600);
  c1->Divide(2,1);
  c1->cd(1);
  TGraphErrors *g1 = new TGraphErrors(7,dis,cons,0,cons_err);
  g1->Draw("A*");
  g1->GetXaxis()->SetTitle("Drift Distance (mm)");
  g1->GetYaxis()->SetTitle("#sigma_{const} (ns)");
  g1->SetTitle();
  g1->SetMarkerColor(2);
  g1->SetMarkerStyle(20);
  g1->SetLineWidth(2.5);
 
  
  c1->cd(2);
  c1_2->SetLogx(1);
  c1_2->SetLogy(1);
  TGraphErrors *g2 = new TGraphErrors(40,E,slope,0,slope_err);
  g2->Draw("A*");
  TGraph *g3 = new TGraph(40,E,calc);
  g3->Draw("Lsame");
  g2->GetXaxis()->SetRangeUser(0.09,3.5);
  g2->GetYaxis()->SetRangeUser(0.007,0.1);
  TGraph *g4 = new TGraph(40,E,calcT);
  g4->Draw("Lsame");
  g2->SetMarkerColor(2);
  g2->SetMarkerStyle(20);
  g2->SetTitle("Electron Energy (eV)");
  g2->GetXaxis()->SetTitle("E field (kV/cm)");
  g2->SetLineWidth(2.5);
  g3->SetLineWidth(2.5);
  g3->SetLineColor(6);
  g4->SetLineWidth(2.5);
  g4->SetLineColor(4);
  
  TLegend *le1 = new TLegend(0.15,0.6,0.5,0.89);
  le1->SetFillColor(10);
  le1->AddEntry(g2,"This work (Long)","pl");
  le1->AddEntry(g3,"Long. Cal.","pl");
  le1->AddEntry(g4,"Tran. Cal.","pl");
  le1->Draw();
  
}
Esempio n. 11
0
File: Norm.C Progetto: TJHague/XGT2
/*int main{{{*/
void Check( TString Target_Name){

	/*Define{{{*/
	gROOT->SetStyle("Plain");
	gStyle->SetFillColor(0);
	TString Input_File = ""; 
	Input_File = Form("%s_L_kin5.1_unf.rho",Target_Name.Data()); 
	ifstream infile1(Input_File);
	Input_File = Form("../%s_Yield_L_All.out",Target_Name.Data()); 
	ifstream infile4(Input_File);

	Input_File = Form("%s.rho",Target_Name.Data()); 
	ofstream outfile(Input_File);
	
	const int bin = 60;
	double I1=0.;
	if(Target_Name=="H2"){
		I1=45.0;
	}
	else if(Target_Name=="He3"){
		I1=120.0;
	}
	else if(Target_Name=="He4"){
		I1 = 95.0; 
	}
	else
		cerr<<"***ERROR, Unknow Target!!!"<<endl;

	double *VZ1 = new double[bin];
	double *VZf = new double[bin];
	double *Rho1 = new double[bin];
	double *Rho1_Err = new double[bin];
	double *Rho0 = new double[bin];
	double *Rho0_Err = new double[bin];
	double *Rho0f = new double[bin];
	double *Rho0f_Err = new double[bin];
	double *Rho1f = new double[bin];
	double *Rho1f_Err = new double[bin];
	double *Zero = new double[bin];
	double *BF = new double[bin];
	double *BF_Err = new double[bin];

	double rho1_sum=0., rho0_sum=0.;
    double rho0f_sum=0.,rho1f_sum=0.;
    TString acom; infile4>>acom>>acom>>acom>>acom>>acom;
	/*}}}*/

	double aa=0;
	for(int i=0;i<bin;i++){
		infile1 >> VZ1[i] >> Rho1[i];	Rho1_Err[1]=sqrt(Rho1[i]);
		infile4 >> VZf[i] >> Rho0f[i] >> Rho0f_Err[i] >> BF[i] >> BF_Err[i];	

		Zero[i]=0.0;
		Rho0[i] = Correction_Inverse(Target_Name.Data(), VZ1[i], I1, Rho1[i] ); 
		Rho0_Err[i] = Rho0[i]/Rho1[i]*Rho1_Err[i];

		Rho1f[i] = Correction(Target_Name.Data(), VZf[i], I1, Rho0f[i] ); 
		Rho1f_Err[i] = Rho1f[i]/Rho0f[i]*Rho0f_Err[i];

		if(VZ1[i]>-0.075 && VZ1[i]<0.075){
           rho0_sum+=Rho0[i];
           rho1_sum+=Rho1[i];
		}
		else{
			Rho0[i]=0.0;
			Rho1[i]=0.0;
			Rho0_Err[i]=0.0;
			Rho1_Err[i]=0.0;
		}

		if(VZf[i]>-0.075 && VZf[i]<0.075){
           rho0f_sum+=Rho0f[i];
           rho1f_sum+=Rho1f[i];
		}
		else{
			Rho0f[i]=0.0;
			Rho1f[i]=0.0;
			Rho0f_Err[i]=0.0;
			Rho1f_Err[i]=0.0;
		}
	}
	infile1.close(); 

	cerr<<Form("Rho=%f, Rho1=%f, Rhof=%f, Rho1f=%f", rho0_sum, rho1_sum, rho0f_sum, rho1f_sum)<<endl;

	outfile<<Form("%12s %12s %12s %12s %12s", "VZ","Y0","Y0_Err","BF","BF_Err")<<endl; 
	for(int i=0;i<bin;i++){
		Rho0[i]/=rho0_sum;
		Rho0_Err[i]/=rho0_sum;
		Rho1[i]/=rho1_sum;
		Rho1_Err[i]/=rho1_sum;

		Rho0f[i]/=rho0f_sum;
		Rho0f_Err[i]/=rho0f_sum;
		Rho1f[i]/=rho1f_sum;
		Rho1f_Err[i]/=rho1f_sum;
		
		outfile<<Form("  %12.8f %12.8f %12.8f %12.8f %12.8f",VZf[i],Rho0f[i], Rho0f_Err[i], BF[i],BF_Err[i])<<endl; 
		}	
    outfile.close();

	TCanvas *c1 = new TCanvas("c1","c1",1200,700);
	c1->cd();
	TH2F *h1 = new TH2F("h1","",300,-0.12,0.12,300,-0.01,0.04);
	h1->SetStats(kFALSE);
	h1->SetXTitle("z_{react} (m)");
	h1->GetXaxis()->CenterTitle(1);
	h1->GetXaxis()->SetTitleFont(32);
	h1->GetXaxis()->SetTitleSize(0.06);
	h1->SetYTitle("#rho_{norm}");
	h1->GetYaxis()->CenterTitle(1);
	h1->GetYaxis()->SetTitleFont(32);
	h1->GetYaxis()->SetTitleSize(0.06);
	h1->GetYaxis()->SetTitleOffset(0.8);
	h1->SetLineWidth(1.5);
	h1->Draw();

	TGraphErrors *ex = new TGraphErrors(bin, VZ1, Rho0, Zero, Rho0_Err);
	ex->SetMarkerStyle(20);
	ex->SetMarkerColor(1);
	ex->SetLineColor(1);
	ex->SetLineWidth(1.5);

	TGraphErrors *ex4 = new TGraphErrors(bin, VZf, Rho0f, Zero, Rho0f_Err);
	ex4->SetMarkerStyle(20);
	ex4->SetMarkerColor(6);
	ex4->SetLineColor(6);
	ex4->SetLineWidth(1.5);
	

	TGraphErrors *ex1 = new TGraphErrors(bin, VZ1, Rho1, Zero, Rho1_Err);
	ex1->SetMarkerStyle(21);
	ex1->SetMarkerColor(6);
	ex1->SetLineColor(2);
	ex1->SetLineWidth(1.5);

	TGraphErrors *ex41 = new TGraphErrors(bin, VZf, Rho1f, Zero, Rho1f_Err);
	ex41->SetMarkerStyle(28);
	ex41->SetMarkerColor(4);
	ex41->SetLineColor(2);
	ex41->SetLineWidth(1.5);
	
	TLegend *l1  = new TLegend(0.33,0.2,0.72,0.45,Form("%s Density Profile:",Target_Name.Data()));
	l1->SetTextSize(0.03);
	l1->SetTextFont(32);

	c1->Clear(); h1->Draw();
	ex->Draw("l");
	l1->AddEntry(ex, Form("#rho_{0} calculated from #rho(%d uA) ",(int)(I1)),"l");
	ex4->Draw("p");
	l1->AddEntry(ex4, Form("#rho_{0} from Boiling Fitting"),"p");

	ex1->Draw("l");
	l1->AddEntry(ex1, Form("#rho(%d uA)  from data",(int) (I1)),"l");
	ex41->Draw("p");
	l1->AddEntry(ex41, Form("#rho(%d uA) calculated from Boiling Fitting",(int) (I1)),"p");

	l1->Draw();
//	c1->Print(Form("%s_Check_%d.png",Target_Name.Data(), (int) (I1)));
//	c1->Print(Form("%s_Check_%d.pdf",Target_Name.Data(), (int) (I1)));

	delete VZ1;
	delete VZf;
	delete Rho1;
	delete Rho0;  
	delete Rho1_Err;
	delete Rho0_Err;  
	delete Rho0f;  
	delete Rho1f;  
	delete Rho0f_Err;  
	delete Rho1f_Err;  
	delete Zero;
    delete BF;
    delete BF_Err;	
}