Example #1
0
void TGG_Carb( Int_t chan)
{
	Int_t i, j, bin;
	Int_t egamma;
	Double_t pa_ratio[284], pa, yield;
	Double_t emin, emax, y1, ym, yy;
	Double_t junk, eg, energy[284];
	Double_t Tgg, Tgg_c12;
	Int_t xmin, xmax;
	Char_t filename[64], name[64], hist[64], string[64];

	TCanvas *c1 = new TCanvas ( "c1", "Subtraction", 20, 20, 900, 500);
   c1->SetFillColor( 38);
   c1->SetGrid();
   c1->GetFrame()->SetFillColor( 21);
   c1->GetFrame()->SetBorderSize( 12);

	strcpy( filename, "xs/chan_subt/chan_subt.out");
	ifstream inFile( filename);
	if ( !inFile.is_open()) {
		cout << "Error opening file ";
		cout << filename;
		cout << endl;
		break;
	}
	while( !inFile.eof()) {
		inFile >> i >> pa ;
		pa_ratio[i] = pa;
	}
	inFile.close();
	pa = pa_ratio[chan];

	strcpy( filename, "xs/tageng450.out");
	ifstream inFile( filename);
	if ( !inFile.is_open()) {
		cout << "Error opening file ";
		cout << filename;
		cout << endl;
		break;
	}
	while( !inFile.eof()) {
		inFile >> i >> junk >> junk >> junk >> eg ;
		energy[i] = eg;
	}
	inFile.close();

	eg = energy[chan];
	egamma = (int)(eg + 0.5);

	if ( eg >= E_thr( kMP_MEV, kMPI0_MEV))
		Tgg = Tgg_Min( qT_max(eg, kMP_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
	else Tgg = 180.;

	if ( eg >= E_thr( kM_C12_MEV, kMPI0_MEV))
		Tgg_c12 = Tgg_Min( qT_max(eg, kM_C12_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
	else Tgg_c12 = 180.;

	// Full
	//  Prompt
	h_p->GetXaxis()->SetRangeUser(0,180);	 // The entire ThetaCM range
	h_p->GetZaxis()->SetRangeUser(chan,chan);// The appropriate tagger channel
	TH1D *p_p = h_p->Project3D("y");

	//  Random
	h_r->GetXaxis()->SetRangeUser(0,180);	 // The entire ThetaCM range
	h_r->GetZaxis()->SetRangeUser(chan,chan);// The appropriate tagger channel
	TH1D *p_r = h_r->Project3D("y");

	cout << "Subtraction Ratio = " << pa << endl;

	p_p->Sumw2();
	p_p->Add( p_r, -pa);

	p_p->SetMarkerColor(4);
	p_p->SetLineColor(4);
	p_p->SetLineWidth(4);
	sprintf( string, "#theta_{#gamma#gamma} for E_{#gamma} = %5.1f MeV", eg);
	p_p->SetTitle(string);
	p_p->Draw();
	p_p->GetXaxis()->SetRangeUser(Tgg_c12-10,180);

	yy = p_p->GetMaximum();
	ym = yy*1.2;
	p_p->SetMaximum(ym);

	l5 = new TLine(Tgg_c12-10,0,180,0);
	l5->SetLineStyle(1);
	l5->SetLineWidth(1);
	l5->Draw();

	l6 = new TLine(Tgg,0,Tgg,ym);
	l6->SetLineStyle(2);
	l6->SetLineWidth(4);
	l6->Draw();

	l7 = new TLine(Tgg_c12,0,Tgg_c12,ym);
	l7->SetLineStyle(2);
	l7->SetLineWidth(4);
	l7->Draw();

	gStyle->SetOptStat(0);

//	sprintf( name, "plots/eps/TGG_C_%d.eps", egamma);
//	c1->Print( name);
}
Example #2
0
void SimCompTgg( Int_t chan)
{
	Int_t i, bin, egamma;
	Int_t ch1, ch2, ch3, ch4;
	Int_t cdat_c, cdat_h, csim_c, csim_h;
	Double_t Tgg, Tgg_c12;
	Double_t fact, junk, energy[284], eg;
	Double_t x1, x2, x3, a, b, max, min;
	Double_t pa, pa_ratio[284];
	Double_t y1, y2;
	Double_t c, d, e, f, g, h;
	Double_t t1, t2, t3, t4, t5;
	Double_t xx[1], yy[1], dxx[1], dyy[1];
	Char_t name[64], cond[] = "masscorr";

	TCanvas *c1 = new TCanvas ( "c1", "Simulation Comparison", 200, 0, 700, 500);
   c1->SetFillColor( 0);
   c1->SetGrid();
   c1->GetFrame()->SetFillColor( 21);
   c1->GetFrame()->SetBorderSize( 12);

	strcpy( name, "xs/chan_subt/chan_subt.out");
	ifstream inFile( name);
	if ( !inFile.is_open()) {
		cout << "Error opening file ";
		cout << name;
		cout << endl;
		break;
	}
	while( !inFile.eof()) {
		inFile >> i >> pa ;
		pa_ratio[i] = pa;
	}
	inFile.close();

	strcpy( name, "xs/tageng450.out");
	ifstream inFile( name);
	if ( !inFile.is_open()) {
		cout << "Error opening file ";
		cout << name;
		cout << endl;
		break;
	}
	while( !inFile.eof()) {
		inFile >> i >> junk >> junk >> junk >> eg ;
		energy[i] = eg;
	}
	inFile.close();

	eg = energy[chan];
	egamma = (int)(eg + 0.5);
	pa = pa_ratio[chan];

	if ( eg >= E_thr( kMP_MEV, kMPI0_MEV))
		Tgg = Tgg_Min( qT_max(eg, kMP_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
	else Tgg = 180.;

	if ( eg >= E_thr( kM_C12_MEV, kMPI0_MEV))
		Tgg_c12 = Tgg_Min( qT_max(eg, kM_C12_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
	else Tgg_c12 = 180.;

	// Prompt
	h3p->GetXaxis()->SetRangeUser(0,180);		// The entire ThetaCM range
	h3p->GetZaxis()->SetRangeUser(chan,chan);	// The appropriate tagger channel
	TH1D *h1p = h3p->Project3D("y");

	// Random
	h3r->GetXaxis()->SetRangeUser(0,180);
	h3r->GetZaxis()->SetRangeUser(chan,chan);
	TH1D *h1r = h3r->Project3D("y");

	a = Tgg_c12 - 10;
	b = 180;
	// Subtracted Tgg
	h1r->Sumw2();
	h1r->Scale( pa);
	h1p->Add( h1r, -1.0);
	h1p->SetLineStyle(1);
	h1p->SetLineWidth(3);
	h1p->GetXaxis()->SetRangeUser(a,b);
	Double_t max = h1p->GetMaximum();
	max *= 1.2;
	h1p->SetMaximum( max);
	sprintf( name, "#theta_{#gamma#gamma} for E_{#gamma} = %5.1f MeV", eg);
	h1p->SetTitle( name);
	h1p->Draw();
	h1p->GetXaxis()->SetTitle( "#theta_{#gamma#gamma} (deg)");
	h1p->GetXaxis()->CenterTitle();
	l3 = new TLine( a, 0, b, 0);
	l3->SetLineWidth(1);
	l3->Draw();

	l6 = new TLine(Tgg,0,Tgg,max);
	l6->SetLineStyle(2);
	l6->SetLineWidth(4);
	l6->SetLineColor(1);
	l6->Draw();

	l7 = new TLine(Tgg_c12,0,Tgg_c12,max);
	l7->SetLineStyle(2);
	l7->SetLineWidth(4);
	l7->SetLineColor(1);
	l7->Draw();

	cdat_h = h1p->Integral();

// Simulation
	// Hydrogen
	sprintf( name, "histograms/MonteCarlo/MCH_p_%s_%d.root", cond, egamma);
	sim_p = new TFile( name);
//	s3h = (TH3D*) sim_p->Get( "THits_TGG_ThetaCM_P");
//	s3h->GetXaxis()->SetRangeUser(0,180);		// The entire ThetaCM range
//	TH1D *s1h = s3h->Project3D("y2");
	s3h = (TH3D*) sim_p->Get( "EmPi0_TGG_ThetaCM");
	TH1D *s1h = s3h->Project3D("y2");

	// Carbon
	sprintf( name, "histograms/MonteCarlo/MCH_c_%s_%d.root", cond, egamma);
	sim_c = new TFile( name);
//	s3c = (TH3D*) sim_c->Get( "THits_TGG_ThetaCM_P");
//	s3c->GetXaxis()->SetRangeUser(0,180);		// The entire ThetaCM range
//	TH1D *s1c = s3c->Project3D("y3");
	s3c = (TH3D*) sim_c->Get( "EmPi0_TGG_ThetaCM");
	TH1D *s1c = s3c->Project3D("y3");

	s1h->SetFillStyle(3004);
	s1h->SetFillColor(4);
	s1h->SetLineColor(4);
	s1h->SetLineWidth(4);

	s1c->SetFillStyle(3005);
	s1c->SetFillColor(2);
	s1c->SetLineColor(2);
	s1c->SetLineWidth(4);

	TH1D *s1 = (TH1D*)s1h->Clone( "totsim");
	s1->Add(s1c, 1.0);

	y1 = s1->Integral();
//	y1 = s1h->Integral();

	fact = cdat_h/y1;

	s1->Scale( fact);
	s1c->Scale( fact);
	s1h->Scale( fact);

	s1h->SetFillStyle(3004);
	s1h->SetLineColor(4);
	s1h->SetLineWidth(4);

	s1h->GetXaxis()->SetRangeUser(a,b);
	sprintf( name, "Simulated #theta_{#gamma#gamma} for E_{#gamma} = %5.1f MeV",
			eg);
	s1h->SetTitle( name);
//	s1->Draw("same");
	s1c->Draw("same");
	s1h->Draw("same");

	if ( egamma < 165) t1 = 0.05;
	else t1 = 0.70;

	t2 = t1 + 0.05;
	t3 = t1 + 0.07;
	t4 = t1 + 0.14;
	t5 = t1 + 0.22;

	c = a+(b-a)*t1;
	d = a+(b-a)*t2;
	e = max*0.9;
	f = max*0.98;
	g = a+(b-a)*t3;
	h = a+(b-a)*t4;
	l4 = new TLine( c, e, d, e);
	l4->SetLineWidth(10);
	l4->SetLineColor(2);
	l4->Draw();
	pt1 = new TPaveText( g, e*0.95, h, f*0.95);
	pt1->AddText("^{12}C");
	pt1->SetBorderSize(0);
	pt1->Draw();

	e = max*0.8;
	f = max*0.88;
	l4 = new TLine( c, e, d, e);
	l4->SetLineWidth(10);
	l4->SetLineColor(4);
	l4->Draw();
	pt1 = new TPaveText( g, e*0.95, h, f*0.95);
	pt1->AddText("^{1}H");
	pt1->SetBorderSize(0);
	pt1->SetFillStyle(4000);
	pt1->Draw();

//	e = max*0.7;
//	f = max*0.78;
//	h = a+(b-a)*t5;
//	l4 = new TLine( c, e, d, e);
//	l4->SetLineWidth(10);
//	l4->SetLineColor(2);
//	l4->Draw();
//	pt1 = new TPaveText( g, e*0.95, h, f*0.95);
//	pt1->AddText("^{12}C + ^{1}H");
//	pt1->SetBorderSize(0);
//	pt1->Draw();

	gStyle->SetOptStat(0);
	xx[0] = (c+d)/2;
	yy[0] = max*0.60;
	dyy[0] = max*0.04;
	dxx[0] = (b-a)*0.01;
	pm = new TGraphErrors( 1, xx, yy, dxx, dyy);
//	pm->SetMarkerSize(1);
	pm->SetLineWidth(4);
	pm->Draw();
	e = max*0.6;
	f = max*0.68;
	pt1 = new TPaveText( g, e*0.95, h, f*0.95);
	pt1->AddText("Data");
	pt1->SetBorderSize(0);
	pt1->Draw();

	sprintf( name, "plots/eps/tgg_simcomp_%d.eps", egamma);
//	c1->Print( name);
}
Example #3
0
void TggThetaCM( Int_t chan)
{
	Int_t i, egamma;
	Double_t a, b;
	Double_t pa, pa_ratio[284];
	Double_t eg, junk, energy[284], Tgg, Tgg_c12;
	Char_t name[64], cond[] = "masscorr";

	strcpy( name, "xs/chan_subt/chan_subt.out");
	ifstream inFile( name);
	if ( !inFile.is_open()) {
		cout << "Error opening file ";
		cout << name;
		cout << endl;
		break;
	}
	while( !inFile.eof()) {
		inFile >> i >> pa ;
		pa_ratio[i] = pa;
	}
	inFile.close();

	strcpy( name, "xs/tageng450.out");
	ifstream inFile( name);
	if ( !inFile.is_open()) {
		cout << "Error opening file ";
		cout << name;
		cout << endl;
		break;
	}
	while( !inFile.eof()) {
		inFile >> i >> junk >> junk >> junk >> eg ;
		energy[i] = eg;
	}
	inFile.close();

	eg = energy[chan];
	egamma = (int)(eg + 0.5);
	pa = pa_ratio[chan];

	if ( eg >= E_thr( kMP_MEV, kMPI0_MEV))
		Tgg = Tgg_Min( qT_max(eg, kMP_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
	else Tgg = 180.;

	if ( eg >= E_thr( kM_C12_MEV, kMPI0_MEV))
		Tgg_c12 = Tgg_Min( qT_max(eg, kM_C12_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
	else Tgg_c12 = 180.;

	a = Tgg_c12 - 10;
	b = 180;

	TCanvas *c1 = new TCanvas ( "c1", "Simulation Comparison", 200, 0, 700, 700);
   c1->SetFillColor( 38);
   c1->SetGrid();
   c1->GetFrame()->SetFillColor( 21);
   c1->GetFrame()->SetBorderSize( 12);
	c1->Divide(1,3);

	// Prompt and Random
	h3p->GetZaxis()->SetRangeUser(chan,chan);	// The appropriate tagger channel
	TH2D *h2p = h3p->Project3D("xy");
	h3r->GetZaxis()->SetRangeUser(chan,chan);	// The appropriate tagger channel
	TH2D *h2r = h3r->Project3D("xy");

	h2r->Sumw2();
	h2r->Scale( pa);
	h2p->Add( h2r, -1.0);

	c1->cd(1);
	h2p->GetXaxis()->SetRangeUser(a,b);
	h2p->SetOption("col");
	h2p->Draw();

// Simulation
	// Hydrogen
	sprintf( name, "histograms/MonteCarlo/MCH_p_%s_%d.root", cond, egamma);
	sim_p = new TFile( name);
	s3h = (TH3D*) sim_p->Get( "THits_TGG_ThetaCM_P");
	TH2D *s2h = s3h->Project3D("xy2");
	s2h->SetTitle( "Hydrogen");
//	TH1D *s1h = s3h->Project3D("x");
//	s1h->SetTitle( "Hydrogen");

	// Carbon
	sprintf( name, "histograms/MonteCarlo/MCH_c_%s_%d.root", cond, egamma);
	sim_c = new TFile( name);
	s3c = (TH3D*) sim_c->Get( "THits_TGG_ThetaCM_P");
	TH2D *s2c = s3c->Project3D("xy3");
	s2c->SetTitle( "Carbon");
//	TH1D *s1c = s3c->Project3D("x2");
//	s1c->SetTitle( "Carbon");

	c1->cd(2);
	s2h->GetXaxis()->SetRangeUser(a,b);
	s2h->SetOption("col");
	s2h->Draw();
//	s1h->Draw();

	c1->cd(3);
	s2c->GetXaxis()->SetRangeUser(a,b);
	s2c->SetOption("col");
	s2c->Draw();
//	s1c->Draw();
}
Example #4
0
void CheckSim( Int_t eg, Char_t hist[32] = "TGG", Char_t cond[32] = "masscorr")
{
    Int_t col, ch1, ch2;
    Double_t max, x1, x2, x3, a, b, fact;
    Char_t name[64];

    sprintf( name, "histograms/MonteCarlo/MCH_p_%s_%d.root", cond, eg);
    prot = new TFile( name);
    sprintf( name, "histograms/MonteCarlo/MCH_c_%s_%d.root", cond, eg);
    carb = new TFile( name);

    TCanvas *c1 = new TCanvas ( "c1", "Simulation Comparison", 200, 0, 700, 500);
    c1->SetFillColor( 42);
    c1->SetGrid();
    c1->GetFrame()->SetFillColor( 21);
    c1->GetFrame()->SetBorderSize( 12);

    if ( strcmp( hist, "TGG") == 0) {

        h3p = (TH3D*) prot->Get( "EmPi0_TGG_ThetaCM");
        TH1D *h1 = h3p->Project3D("y");
        h3c = (TH3D*) carb->Get( "EmPi0_TGG_ThetaCM");
        TH1D *h2 = h3c->Project3D("y2");

        sprintf( name, "#Theta^{min}_{#gamma#gamma} for E_{#gamma} = %5.1f MeV",
                 eg);
        h1->SetTitle( name);
        x1 = Tgg_Min( qT_max(eg, kMP_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
        x2 = Tgg_Min( qT_max(eg, kM_C12_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
        col = 4;
        a = x2 - 10;
        b = 180;
    }
    else if ( strcmp( hist, "EmPi0") == 0) {

        h3p = (TH3D*) prot->Get( "EmPi0_TGG_ThetaCM");
        TH1D *h1 = h3p->Project3D("z");
        h3c = (TH3D*) carb->Get( "EmPi0_TGG_ThetaCM");
        TH1D *h2 = h3c->Project3D("z2");

        sprintf( name, "M_{miss} for E_{#gamma} = %5.1f MeV", eg);
        h1->SetTitle( name);
        x1 = Linear( 145, 933, 400, 880, eg);
        x2 = Linear( 145, 945, 400, 1000, eg);
        x3 = Linear( 145, 918, 400, 880, eg);
        col = 2;
        a = Linear( 145, 900, 400, 600, eg);
        b = Linear( 145, 950, 400, 1000, eg);
    }

    h1->SetLineWidth(2);
    h1->SetFillColor(2);
    h1->GetXaxis()->SetRangeUser(a,b);
    h1->Draw();

    ch1 = h1->Integral();
    ch2 = h2->Integral();
    fact = (double) ch1/ch2;

    h2->SetFillStyle(3001);
    h2->SetFillColor(4);
    h2->SetLineWidth(2);
    h2->SetLineStyle(1);
    h2->Scale( fact);
    h2->Draw("same");

    TH1D *h3 = (TH1D*)h1->Clone();
    h3->Sumw2();
    h3->Add(h2, 1.0);
    h3->Draw("same");

    max = h3->GetMaximum();

    max *= 1.10;
    h1->SetMaximum(max);

    l1 = new TLine( x1, 0, x1, max);
    l1->SetLineColor(2);
    l1->SetLineStyle(2);
    l1->SetLineWidth(4);
    l1->Draw();

    l2 = new TLine( x2, 0, x2, max);
    l2->SetLineColor(col);
    l2->SetLineStyle(2);
    l2->SetLineWidth(4);
    l2->Draw();

    if ( strcmp( hist, "EmPi0") == 0) {
        l3 = new TLine( x3, 0, x3, max);
        l3->SetLineColor(col);
        l3->SetLineStyle(2);
        l3->SetLineWidth(4);
        l3->Draw();
    }

    sprintf( name, "plots/eps/Sim_%s_%s_%d.eps", hist, cond, eg);
    c1->Print( name);
}
Example #5
0
Double_t CarbCont( Int_t tbin, Int_t pbin, Int_t plot)
{
    Int_t theta_lo, theta_hi;
    Int_t zl, zh, yl, yh;
    Int_t zcp, xcp, ycp;
    Int_t zcc, xcc, ycc;
    Double_t x1, x2, a, b, eg, effc, effp, ac, ap, max;
    Char_t name[64], cond[32] = "masscorr";

    if ( pbin == 2) {
        eg = 147;
        ap = 0.9089;
    }
    else if ( pbin == 3) {
        eg = 153;
        ap = 0.8816;
    }
    else if ( pbin == 4) {
        eg = 157;
        ap = 0.8567;
    }
    else if ( pbin == 5) {
        eg = 163;
        ap = 0.8482;
    }
    else if ( pbin == 6) {
        eg = 168;
        ap = 0.8164;
    }
    else {
        printf( "<E> CarbCont: Invalid Channel Number (2-6)\n");
        exit(-1);
    }
    ac = 1-ap;

    x1 = Tgg_Min( qT_max(eg, kMP_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;

    a = Linear( 145, 933, 400, 880, eg);
    b = Linear( 145, 945, 400, 1000, eg);

    theta_lo = (tbin-1)*20;
    theta_hi = tbin*20;

    Int_t pflag = 0;
    if ( pflag == 1) {
        sprintf( name, "histograms/MonteCarlo/MCH_p_%s_%d.root", cond, eg);
        pdat = new TFile( name);
        h3p = (TH3D*) pdat->Get( "EmPi0_TGG_ThetaCM");

        TH2D *h2p = h3p->Project3D("xz1");

        h3p->GetZaxis()->SetRangeUser(a,b);
        TH1D *hzp = h3p->Project3D( "z1");
        zl = hzp->GetXaxis()->FindBin( a);
        zh = hzp->GetXaxis()->FindBin( b);
        zcp = hzp->Integral(zl,zh);

        // zcp is the total number of proton counts in the energy window, i.e.
        // y^{tot}_p.  It is NOT a function of theta.  It is a function of the
        // tagger energy bin, and the missing mass window (which should not
        // chance).

        h3p->GetXaxis()->SetRangeUser(theta_lo,theta_hi);
//		TH1D *hxp = h3p->Project3D("x1");
//		xcp = hxp->Integral();

        // xcp is the total number of proton counts in the energy window AND
        // theta window.  It is a function of theta, and obviously tagger energy
        // bin and missing mass window.

        TH1D *hyp = h3p->Project3D("y1");
//		yl = hyp->GetXaxis()->FindBin( x1);
//		yh = hyp->GetXaxis()->FindBin( 180);
        ycp = hyp->Integral(x1,180);

        // ycp is the number of proton counts in the energy window AND theta
        // window that pass the tgg cut, i.e. y_p(theta).  It is also a function
        // of theta.

        // The efficiency factor f_p(theta) is then ycp/zcp

        effp = ap*ycp/zcp;

        cout << zcp;
//		cout << "  " << xcp;
        cout << "  " << ycp;
        cout << "  " << effp;
        cout << endl;
    }

    sprintf( name, "histograms/MonteCarlo/MCH_c_%s_%d.root", cond, eg);
    cdat = new TFile( name);
    h3c = (TH3D*)cdat->Get( "EmPi0_TGG_ThetaCM");

    TH2D *h2c = h3c->Project3D("xz2");
    TH3D *h3cc = (TH3D*)h3c->Clone( "3d");
    TH3D *h3ccc = (TH3D*)h3c->Clone( "3d");
    h3cc->GetZaxis()->SetRangeUser(875,950);

    h3c->GetZaxis()->SetRangeUser(a,b);
    TH1D *hzc = h3c->Project3D( "z2");
    zl = hzc->GetXaxis()->FindBin( a);
    zh = hzc->GetXaxis()->FindBin( b);
    zcc = hzc->Integral(zl,zh);

    TH1D *hzcc = h3cc->Project3D( "z3");
    sprintf( name, "M_{miss} for E_{#gamma} = %3d MeV\n", eg);
    hzcc->SetTitle( name);
    TH3D *h3ccc = (TH3D*)h3c->Clone( "3d");
    h3ccc->GetZaxis()->SetRangeUser(a,b);
    TH1D *hxcc = h3ccc->Project3D("x3");
    sprintf( name, " #theta*_{#pi} = %d - %d deg\n", theta_lo, theta_hi);
    hxcc->SetTitle( name);

    // zcc is the total number of carbon counts in the energy window, i.e.
    // y^{tot}_c.  It is NOT a function of theta.  It is a function of the
    // tagger energy bin, and the missing mass window (which should not chance).

    h3c->GetXaxis()->SetRangeUser(theta_lo,theta_hi);
    TH1D *hxc = h3c->Project3D("x2");
    xcc = hxc->Integral();

    // xcc is the total number of carbon counts in the energy window AND theta
    // window.  It is a function of theta, and obviously tagger energy bin and
    // missing mass window.

    TH1D *hyc = h3c->Project3D("y2");
    sprintf( name, " #theta_{#gamma#gamma} #geq %3d deg\n", (int) x1);
    hyc->SetTitle( name);
    yl = hyc->GetXaxis()->FindBin( x1);
    yh = hyc->GetXaxis()->FindBin( 180);
    ycc = hyc->Integral(x1,180);

    // ycc is the number of carbon counts in the energy window AND theta window
    // that pass the tgg cut, i.e. y_c(theta).

    // The efficiency factor f_c(theta) is then ycc/zcc

    effc = ac*ycc/zcc;

//	cout << zcc;
////	cout << "  " << xcc;
//	cout << "  " << ycc;
//	cout << "  " << effc;
//	cout << endl;

    if ( plot == 1) {
        TCanvas *c1 = new TCanvas ( "c1", "Simulation Comparison", 200, 0, 1000,
                                    500);
        c1->SetGrid();
        c1->GetFrame()->SetFillColor( 21);
        c1->GetFrame()->SetBorderSize( 12);
//		c1->Divide(3,2);
        c1->Divide(3,1);

        c1->cd(1);
        hzcc->SetLineWidth(2);
        hzcc->SetFillColor(29);
        hzcc->Draw();

        max = hzcc->GetMaximum();
        max *= 1.10;
        hzcc->SetMaximum(max);

        l = new TLine( a, 0, a, max);
        l->SetLineColor(2);
        l->SetLineStyle(2);
        l->SetLineWidth(4);
        l->Draw();

        l = new TLine( b, 0, b, max);
        l->SetLineColor(2);
        l->SetLineStyle(2);
        l->SetLineWidth(4);
        l->Draw();

        Char_t contstr[32];
        sprintf( contstr, "%d\n", zcc);
        pl = new TPaveLabel(0.2,0.4,0.4,0.5, contstr, "NDC");
        pl->SetBorderSize(0);
        pl->SetFillColor(0);
        pl->SetTextSize(0.4);
        pl->Draw();

        c1->cd(2);
        hxcc->Draw();
        hxcc->SetLineWidth(2);
        hxcc->SetFillColor(29);

        max = hxcc->GetMaximum();
        max *= 1.10;
        hxcc->SetMaximum(max);

        l = new TLine( theta_lo, 0, theta_lo, max);
        l->SetLineColor(2);
        l->SetLineStyle(2);
        l->SetLineWidth(4);
        l->Draw();

        l = new TLine( theta_hi, 0, theta_hi, max);
        l->SetLineColor(2);
        l->SetLineStyle(2);
        l->SetLineWidth(4);
        l->Draw();

        sprintf( contstr, "%d\n", xcc);
        pl = new TPaveLabel(0.7,0.4,0.9,0.5, contstr, "NDC");
        pl->SetBorderSize(0);
        pl->SetFillColor(0);
        pl->SetTextSize(0.4);
        pl->Draw();

        c1->cd(3);
        hyc->Draw();
        hyc->SetLineWidth(2);
        hyc->SetFillColor(29);

        max = hyc->GetMaximum();
        max *= 1.10;
        hyc->SetMaximum(max);

        l = new TLine( x1, 0, x1, max);
        l->SetLineColor(2);
        l->SetLineStyle(2);
        l->SetLineWidth(4);
        l->Draw();

        pt = new TPaveText(0.3,0.4,0.5,0.55, "brNDC");
        pt->SetBorderSize(0);
        pt->SetFillColor(0);
        pt->SetTextSize(0.06);
        sprintf( contstr, "%d\n", ycc);
        pt->AddText( contstr);
        sprintf( contstr, "f_{c} = %4.1f %%\n", effc*100);
        pt->AddText( contstr);
        pt->Draw();

//		c1->cd(4);
//		h2p->Draw();

//		c1->cd(5);
//		h2c->Draw();

        sprintf( name, "plots/eps/sim_eff_%d_%d.eps", eg,
                 (theta_lo + theta_hi)/2);
//		c1->Print( name);
    }

    return( effc);
}
Example #6
0
void CheckSimTgt( Int_t eg, Char_t tgt[2] = "p", Char_t hist[32] = "TGG",
                  Char_t cond[32] = "masscorr")
{
    Int_t col, ch1, ch2;
    Double_t max, x1, x2, x3, a, b, fact;
    Char_t name[64];

    sprintf( name, "histograms/MonteCarlo/MCH_%s_%s_%d.root", tgt, cond, eg);
    dat = new TFile( name);

    TCanvas *c1 = new TCanvas ( "c1", "Simulation Comparison", 200, 0, 700, 500);
    c1->SetFillColor( 42);
    c1->SetGrid();
    c1->GetFrame()->SetFillColor( 21);
    c1->GetFrame()->SetBorderSize( 12);

    if ( strcmp( hist, "TGG") == 0) {

        h3 = (TH3D*) dat->Get( "EmPi0_TGG_ThetaCM");
        TH1D *h = h3->Project3D("y");

        sprintf( name, "#Theta^{min}_{#gamma#gamma} for E_{#gamma} = %5.1f MeV",
                 eg);
        h->SetTitle( name);
        x1 = Tgg_Min( qT_max(eg, kMP_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
        x2 = Tgg_Min( qT_max(eg, kM_C12_MEV, kMPI0_MEV), kMPI0_MEV)/kD2R;
        col = 4;
        a = x2 - 50;
        b = 180;
    }
    else if ( strcmp( hist, "EmPi0") == 0) {

        h3 = (TH3D*) dat->Get( "EmPi0_TGG_ThetaCM");
        TH1D *h = h3->Project3D("z");

        sprintf( name, "M_{miss} for E_{#gamma} = %5.1f MeV", eg);
        h->SetTitle( name);
        x1 = Linear( 145, 933, 400, 880, eg);
        x2 = Linear( 145, 945, 400, 1000, eg);
        x3 = Linear( 145, 918, 400, 880, eg);
        col = 2;
        a = Linear( 135, 900, 400, 600, eg);
        b = Linear( 135, 950, 400, 1000, eg);
    }

    h->SetFillStyle(3001);
    h->SetFillColor(4);
    h->SetLineWidth(2);
    h->SetLineStyle(1);
    h->GetXaxis()->SetRangeUser(a,b);
    h->Draw();

    max = h->GetMaximum();

    max *= 1.10;
    h->SetMaximum(max);

    l = new TLine( x1, 0, x1, max);
    l->SetLineColor(2);
    l->SetLineStyle(2);
    l->SetLineWidth(4);
    l->Draw();

    l = new TLine( x2, 0, x2, max);
    l->SetLineColor(col);
    l->SetLineStyle(2);
    l->SetLineWidth(4);
    l->Draw();

    if ( strcmp( hist, "EmPi0") == 0) {
        l = new TLine( x3, 0, x3, max);
        l->SetLineColor(col);
        l->SetLineStyle(2);
        l->SetLineWidth(4);
        l->Draw();
    }

//	sprintf( name, "plots/eps/Sim_%s_%s_%d.eps", hist, cond, eg);
//	c1->Print( name);
}
Example #7
0
void Pi0HistSimComp( TString tgt = "subt", TString hist = "MMiss",
		UInt_t i = 308, UInt_t j = 0, Bool_t save = kFALSE)
{
	UInt_t tbin_lo, tbin_hi, rebin;
	Int_t th, dth;
	Double_t eg, deg;
	Double_t x1, x2, x3, left, right;
	Double_t x[2], y[2];
	Double_t q_pi, T_pi;
	Double_t TggCutOffset;
	Char_t tchar;
	TString name;

	TggCutOffset = 3;

	gStyle->SetOptStat( 0);

	if ( !gROOT->GetListOfCanvases()->IsEmpty()) {
		delete c1;
	}
	TCanvas *c1 = new TCanvas ( "c1", "Subtraction", 300, 20, 700, 500);
   c1->GetFrame()->SetFillColor( 21);
   c1->GetFrame()->SetBorderSize( 12);

	eg = tcd[i].energy;
	deg = tcd[i].denergy;

	th = theta[j].mid;
	dth = 20;

	if ( hist == "MMiss")
	{
		x1 = Linear( 145, 933, 400, 880, eg);
		x2 = Linear( 145, 945, 400, 1000, eg);
		x3 = Linear( 145, 918, 400, 880, eg);

		left = x1 - 30;
		right = x2 + 20;

		rebin = 1;
	}
	else if ( hist == "TGG")
	{
		// Proton Opening Angle
		q_pi = qp_thcm( eg, kMP_MEV, theta[j].lo, kMPI0_MEV);
		T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
		x1 = Tgg_Min( T_pi, kMPI0_MEV)/kD2R;
		cout << "tgg_min = " << x1;
		x1 += TggCutOffset;
		cout << " tgg_cut = " << x1;
		cout << endl;

		// 12-C Opening Angle
		q_pi = qp_thcm( eg, kM_C12_MEV, theta[j].lo, kMPI0_MEV);
		T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
		x3 = Tgg_Min( T_pi, kMPI0_MEV)/kD2R;

		x2 = 180;

		left = 0;
		right = 180;

		rebin = 4;
	}
	else if ( hist == "KECM")
	{
		if ( tgt == "subt")
			q_pi = qp_thcm( eg, kMP_MEV, theta[j].lo, kMPI0_MEV);
		else if ( tgt == "empty")
			q_pi = qp_thcm( eg, kM_C12_MEV, theta[j].lo, kMPI0_MEV);

		T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;

		x1 = 0;
		x2 = T_pi + 20;
		x3 = T_pi;

		left = 0;
		right = x2;

		rebin = 1;
	}

	l = new TLine( left, 0, right, 0);
	l->SetLineStyle( 2);

	Pi0Hist3D( i, j, hist);

	l->Draw();

	name = Form( "%s%d", (const char*) tgt, i);
	if ( tgt == "subt") TH1D *h3 = (TH1D*) shist->Clone( name);
	else if ( tgt == "empty") TH1D *h3 = (TH1D*) ehist->Clone( name);
	h3->SetMarkerStyle( 20);
	h3->SetMarkerSize( 1.5);
	h3->SetLineWidth( 4);
	h3->SetTitle();
	h3->GetXaxis()->SetTitleOffset( 1.2);
	h3->GetXaxis()->SetLabelSize( 0.03);
	h3->GetXaxis()->CenterTitle();
	if ( hist == "MMiss") name = "M_{miss} (MeV)";
	else if ( hist == "TGG") name = "#theta_{#gamma#gamma} (deg)";
	else if ( hist == "KECM") name = "CM T_{#pi} (MeV)";
	h3->GetXaxis()->SetTitle( name);
	h3->Rebin( rebin);
	h3->GetXaxis()->SetRangeUser( left, right);
	Double_t max = h3->GetMaximum();
	max *= 1.4;
	h3->SetMaximum( max);
	if ( ( hist == "TGG") && ( i > 306)) h3->SetMinimum( -50);
	h3->Draw();

	l1 = new TLine( x1, 0, x1, max);
	l1->SetLineStyle( 2);
	l1->Draw();
	l2 = new TLine( x2, 0, x2, max);
	l2->SetLineStyle( 2);
	if ( hist == "MMiss") l2->Draw();
	l3 = new TLine( x3, 0, x3, max);
	l3->SetLineStyle( 2);
//	if ( hist == "MMiss") l3->Draw();

	l->Draw();

	if ( hist == "KECM")
	{
		x[0] = 0.50;
		x[1] = 0.75;
	}
	else
	{
		x[0] = 0.15;
		x[1] = 0.40;
	}
	y[0] = 0.7;
	y[1] = 0.85;
	tl = new TLegend( x[0], y[0], x[1], y[1]);
	tl->SetFillStyle( 0);
	tl->SetBorderSize( 0);
	tl->SetTextSize( 0.06);
	tl->SetTextFont( 132);
	tl->AddEntry( h3, "Data");

	name = Form( "E_{#gamma} = %5.1f #pm %3.1f MeV", eg, deg/2);
	pl = new TPaveLabel( 0.15, 0.90, 0.45, 1.00, name, "NDC");
	pl->SetFillStyle( 0);
	pl->SetBorderSize( 0);
	pl->SetTextSize( 0.5);
	pl->SetTextFont( 132);
	pl->Draw();

	if ( j == 0) name = "#theta_{CM} = 0 - 180 deg";
	else name = Form( "#theta_{CM} = %d #pm %d deg", th, dth/2);
	pl2 = new TPaveLabel( 0.55, 0.90, 0.85, 1.00, name, "NDC");
	pl2->SetFillStyle( 0);
	pl2->SetBorderSize( 0);
	pl2->SetTextSize( 0.5);
	pl2->SetTextFont( 132);
	pl2->Draw();

	UInt_t bin_lo;
	UInt_t bin_hi;

	if ( ( hist == "MMiss") && ( tgt == "empty")) {
		bin_lo = h3->GetXaxis()->FindBin( left);
		bin_hi = h3->GetXaxis()->FindBin( right);
	}
	else {
		bin_lo = h3->GetXaxis()->FindBin( x1);
		bin_hi = h3->GetXaxis()->FindBin( x2);
	}
	Double_t cts1 = h3->Integral( bin_lo, bin_hi);

	if ( tgt == "subt") tchar = 'p';
	else if ( tgt == "empty") tchar = 'w';
	name = Form( "histograms/MonteCarlo/pi0/LH2_10cm/pi0_%c_chan%d.root", tchar,
			i);
	sim = new TFile( name);
	name = "THR_" + hist + "P_v_ThetaCMP";
	TH2D *h2sim = (TH2D*)sim->Get( name);
	tbin_lo = h2sim->GetXaxis()->FindBin( theta[j].lo);
	tbin_hi = h2sim->GetXaxis()->FindBin( theta[j].hi)-1;
	h2sim->GetXaxis()->SetRange( tbin_lo, tbin_hi);
	TH1D *h1sim = h2sim->ProjectionY( "simhist");
	h1sim->Rebin( rebin);

	Double_t cts2 = h1sim->Integral( bin_lo, bin_hi);

	Double_t fact = cts1/cts2;

	h1sim->Scale( fact);
	h1sim->SetFillStyle( 3004);
	h1sim->SetFillColor( 16);
	h1sim->SetLineWidth( 2);
	h1sim->Draw( "same");

	tl->AddEntry( h1sim, "Monte Carlo");
	tl->Draw();

	name = Form( "plots/Pi0_%c_%s_SimComp_chan%d_t%d", tchar,
			(const char*) hist, i, th);
//	name.Append( ".pdf");
	name.Append( ".eps");
	if ( save == kTRUE) c1->Print( name);
}
Example #8
0
void Pi0Hist4( TString hist = "MMiss", UInt_t lo = 308, UInt_t tbin = 0,
		Bool_t save = kFALSE)
{
	UInt_t i, j, rebin;
	Int_t th, dth;
	Double_t eg, deg;
	Double_t x1, x2, x3, left, right;
	Double_t x[2], y[2];
	Double_t q_pi, T_pi;
	Double_t TggCutOffset;
	TString name;

	TggCutOffset = 3;

	gStyle->SetOptStat( 0);

	if ( !gROOT->GetListOfCanvases()->IsEmpty()) {
		delete c1;
	}
	TCanvas *c1 = new TCanvas ( "c1", "Subtraction", 300, 20, 1200, 600);
   c1->SetGrid();
   c1->GetFrame()->SetFillColor( 21);
   c1->GetFrame()->SetBorderSize( 12);
	c1->Divide( 5, 2);

	th = theta[tbin].mid;
	dth = 20;

	j = 1;
	for ( i = lo; i > lo-5; i--)
	{
		eg = tcd[i].energy;
		deg = tcd[i].denergy;

		if ( hist == "MMiss")
		{
			x1 = Linear( 145, 933, 400, 880, eg);
			x2 = Linear( 145, 945, 400, 1000, eg);
			x3 = Linear( 145, 918, 400, 880, eg);

			left = x1 - 30;
			right = x2 + 20;

			rebin = 1;
		}
		else if ( hist == "TGG")
		{
			// Proton Opening Angle
			q_pi = qp_thcm( eg, kMP_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x1 = Tgg_Min( T_pi, kMPI0_MEV)/kD2R - TggCutOffset;

			// 12-C Opening Angle
			q_pi = qp_thcm( eg, kM_C12_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x2 = Tgg_Min( T_pi, kMPI0_MEV)/kD2R;

			x3 = -1;

			left = 0;
			right = 180;

			rebin = 4;
		}
		else if ( hist == "KECM")
		{
			// Proton
			q_pi = qp_thcm( eg, kMP_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x1 = T_pi;

			// 12-C
			q_pi = qp_thcm( eg, kM_C12_MEV, theta[j].lo, kMPI0_MEV);
			T_pi = Energy( q_pi, kMPI0_MEV) - kMPI0_MEV;
			x2 = T_pi;

			x3 = -1;

			left = 0;
			right = x2 + 20;

			rebin = 1;
		}

		l = new TLine( left, 0, right, 0);
		l->SetLineStyle( 2);

		Pi0Hist3D( i, tbin, hist);

		c1->cd( j);
		name = Form( "full%d", i);
		TH1D *h1 = (TH1D*) fhist->Clone( name);
		h1->SetMarkerStyle( 21);
		h1->SetMarkerColor( 2);
		h1->SetLineWidth( 3);
		h1->SetLineColor( 2);
		h1->SetTitle();
		h1->GetXaxis()->SetTitleOffset( 1.1);
		h1->GetXaxis()->SetLabelSize( 0.03);
		h1->GetXaxis()->CenterTitle();
		if ( hist == "MMiss") name = "M_{miss} (MeV)";
		else if ( hist == "TGG") name = "#theta_{#gamma#gamma} (deg)";
		else if ( hist == "KECM") name = "CM T_{#pi} (MeV)";
		h1->GetXaxis()->SetTitle( name);
		h1->Rebin( rebin);
		h1->GetXaxis()->SetRangeUser( left, right);
		Double_t max = h1->GetMaximum();
		max *= 1.4;
		h1->SetMaximum( max);
		h1->Draw();

		l1 = new TLine( x1, 0, x1, max);
		l1->SetLineStyle( 2);
		l1->Draw();
		l2 = new TLine( x2, 0, x2, max);
		l2->SetLineStyle( 2);
		l2->Draw();
		l3 = new TLine( x3, 0, x3, max);
		l3->SetLineStyle( 2);
//		l3->Draw();

		l->Draw();
		name = Form( "E_{#gamma} = %5.1f #pm %3.1f MeV", eg, deg/2);
		pl = new TPaveLabel( 0.15, 0.90, 0.45, 1.00, name, "NDC");
		pl->SetFillStyle( 0);
		pl->SetBorderSize( 0);
		pl->SetTextSize( 0.5);
		pl->SetTextFont( 132);
		pl->Draw();
		if ( tbin == 0) name = "#theta_{CM} = 0 - 180 deg";
		else name = Form( "#theta_{CM} = %d #pm %d deg", th, dth/2);
		pl2 = new TPaveLabel( 0.15, 0.90, 0.45, 1.00, name, "NDC");
		pl2->SetFillStyle( 0);
		pl2->SetBorderSize( 0);
		pl2->SetTextSize( 0.5);
		pl2->SetTextFont( 132);
		if ( j == 6) pl2->Draw();

		name = Form( "empty%d", i);
		TH1D *h2 = (TH1D*) ehist->Clone( name);
		h2->SetMarkerStyle( 22);
		h2->SetMarkerColor( 4);
		h2->SetLineWidth( 3);
		h2->SetLineColor( 4);
		h2->Rebin( rebin);
		h2->Draw( "same");

		x[0] = 0.15;
		x[1] = 0.40;
		y[0] = 0.6;
		y[1] = 0.75;
		tl = new TLegend( x[0], y[0], x[1], y[1]);
		tl->SetFillStyle( 0);
		tl->SetBorderSize( 0);
		tl->SetTextSize( 0.06);
		tl->SetTextFont( 132);
		tl->AddEntry( h1, "Full");
		tl->AddEntry( h2, "Empty");
		if ( j == 1) tl->Draw();

		c1->cd( j+5);
		name = Form( "subt%d", i);
		TH1D *h3 = (TH1D*) shist->Clone( name);
		h3->SetMarkerStyle( 20);
		h3->SetLineWidth( 3);
		h3->SetTitle();
		h3->GetXaxis()->SetTitleOffset( 1.1);
		h3->GetXaxis()->SetLabelSize( 0.03);
		h3->GetXaxis()->CenterTitle();
		if ( hist == "MMiss") name = "M_{miss} (MeV)";
		else if ( hist == "TGG") name = "#theta_{#gamma#gamma} (deg)";
		else if ( hist == "KECM") name = "CM T_{#pi} (MeV)";
		h3->GetXaxis()->SetTitle( name);
		h3->Rebin( rebin);
		h3->GetXaxis()->SetRangeUser( left, right);
		Double_t max = h3->GetMaximum();
		max *= 1.4;
		h3->SetMaximum( max);
		h3->Draw();

		l1 = new TLine( x1, 0, x1, max);
		l1->SetLineStyle( 2);
		l1->Draw();
		l2 = new TLine( x2, 0, x2, max);
		l2->SetLineStyle( 2);
		l2->Draw();
		l3 = new TLine( x3, 0, x3, max);
		l3->SetLineStyle( 2);
//		l3->Draw();

		l->Draw();
		tl = new TLegend( x[0], y[0], x[1], y[1]);
		tl->SetFillStyle( 0);
		tl->SetBorderSize( 0);
		tl->SetTextSize( 0.06);
		tl->SetTextFont( 132);
		tl->AddEntry( h3, "Subtracted");
		if ( j == 1) tl->Draw();

		j++;
	}

	name = Form( "plots/Pi0_%s_chan%d-%d_t%d", (const char*) hist, lo,
			lo-4, theta[tbin].mid);
//	name.Append( ".pdf");
	name.Append( ".eps");
	if ( save == kTRUE) c1->Print( name);
}