figKinematics.cxx 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
void figKinematics()
{

//	gSystem->Load("/home/vratik/workspace/daf/trunk/libUtilities.so");
//	gSystem->Load("/home/vratik/workspace/daf/trunk/libEvent.so");


	TStopwatch sw;
	sw.Start();

//	const Bool_t savePictures = 1;
	const Bool_t savePictures = 0;
	TString pictureName;
	TString picturePath = "figures/";
//	TString pictFormat = ".jpg";
//	TString pictFormat = ".eps";
	TString pictFormat = ".gif";

	const Bool_t kKinematics = 1;

//	if (kKinematics) {
		TCanvas *cKin = new TCanvas("kinematicsBe", "kinematics of (p,n) reaction");
		cKin->ToggleEditor();
		cKin->SetWindowSize(1500, 1000);


//		TFile fr("../simulace/kin.root");
		TFile *fr = new TFile("./kin.root");
		TTree *tr = (TTree*)fr->Get("kin");


		tr->SetMarkerStyle(20);
		tr->SetMarkerSize(0.4);

		TH2F *hKin = new TH2F("hKin", "", 1000, 0., 30., 1000, 4., 56.);
//		TCut cP = "p.fImpulse.Theta()*TMath::RadToDeg()>100";
//		TCut cP = "p.fImpulse.Theta()*TMath::RadToDeg()>0";

//		tr->Draw("(p1.fImpulse.T()-p1.fMass)/p1.fA:p1.fImpulse.Theta()*TMath::RadToDeg()>>hKin", "", "col");
//		hKin->Print();
//		return;

//		tr->SetMarkerColor(kRed);
//		tr->Draw("(p1.fImpulse.T()-p1.fMass)/p1.fA:p1.fImpulse.Theta()*TMath::RadToDeg()>>hKin", "", "scat");
		tr->Draw("(p1.fImpulse.T()-p1.fMass)/p1.fA:p1.fImpulse.Theta()*TMath::RadToDeg()>>hKin", "", "");
		hKin->SetMarkerColor(kRed);
		hKin->SetMarkerStyle(20);
		hKin->SetMarkerSize(0.4);

		tr->SetMarkerColor(kRed);
		tr->Draw("(p2.fImpulse.T()-p2.fMass)/p2.fA:p2.fImpulse.Theta()*TMath::RadToDeg()", "", "same");
		tr->SetMarkerColor(kGreen);
		tr->Draw("(4_He.fImpulse.T()-4_He.fMass)/4_He.fA:4_He.fImpulse.Theta()*TMath::RadToDeg()", "", "same");
		tr->SetMarkerColor(kBlue);
		tr->Draw("(6_Be.fImpulse.T()-6_Be.fMass)/6_Be.fA:6_Be.fImpulse.Theta()*TMath::RadToDeg()", "", "same");



		hKin->GetXaxis()->SetTitle("#it{#theta}_{lab} (deg)");
		hKin->GetXaxis()->CenterTitle();
		hKin->GetXaxis()->SetTitleSize(0.07);
		hKin->GetXaxis()->SetTitleOffset(0.79);
		hKin->GetXaxis()->SetLabelSize(0.05);

		hKin->GetYaxis()->SetTitle("#it{E}_{lab} (AMeV)");
		hKin->GetYaxis()->CenterTitle();
		hKin->GetYaxis()->SetTitleSize(0.07);
		hKin->GetYaxis()->SetTitleOffset(0.79);
		hKin->GetYaxis()->SetLabelSize(0.05);

		cKin->cd();

		cKin->Update();
		TCanvas *c1 = new TCanvas();
		c1->Update();
		delete c1;
		cKin->Update();

		if (savePictures) {
//			gStyle->SetCanvasDefW(649);
//			gStyle->SetCanvasDefH(727);
			pictureName.Form("%s%s%s", picturePath.Data(), cKin->GetName(), pictFormat.Data());
//			cKin->SaveAs(pictureName.Data());
			cKin->SaveAs("figures/PresKinematics.png");
			cKin->cd();
//			cKin->Close();
		}
//	}

}