makeCutsTritium.cxx 3.79 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
#include "TSystem.h"
#include "TFile.h"
#include "TTree.h"
#include "TChain.h"
#include "TCanvas.h"
#include "TBox.h"
#include "TCut.h"
#include "TCutG.h"

using std::cout;
using std::endl;

void makeCutsTritium(const Long64_t drawEntries = 5000000)
{
//	const Long64_t drawEntries = 100000;

//	TFile *fr = new TFile("~/data/exp1804/h5_11_00.root");
	TChain *tr = new TChain("AnalysisxTree");
	tr->Add("~/data/exp1804/h5_14_0?.root");
//	tr->Add("~/data/exp1804/be10_0?_?0.root");


	TChain *trCal = new TChain("cal");
//	trCal->Add("~/data/exp1804/h5_11_0?_calib.root");
	trCal->Add("~/data/exp1804/h5_14_0?_calib.root");
//	trCal->Add("~/data/exp1804/be10_0?_?0_calib.root");

	tr->AddFriend(trCal);

//	TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03_calib.root");
//	TTree *tAlphaCal = (TTree*)fcal->Get("cal");
//	tAlphaCal->SetMarkerColor(kRed);
//	tAlphaCal->SetMarkerStyle(20);
//	tAlphaCal->SetMarkerSize(.6);

	TFile *fc = new TFile("cutsIdentification.root", "READ");
	TCutG *cUS = (TCutG*)fc->Get("c7UpperShadow");
	TCutG *cLS = (TCutG*)fc->Get("c7LowerShadow");
	cLS->SetLineColor(kMagenta);
	TCutG *cMA = (TCutG*)fc->Get("c7MainAlpha");
	TCutG *cA = (TCutG*)fc->Get("c7All");
	TCutG *cBL = (TCutG*)fc->Get("cBeamLeft");
	TCutG *cBR = (TCutG*)fc->Get("cBeamRight");


//	const Int_t drawEntries = 6000000;
//	const Int_t drawEntries = tr->GetEntries();

	tr->GetListOfFiles()->Print();
	trCal->GetListOfFiles()->Print();

	cout << tr->GetEntries() << " events." << endl;
	cout << trCal->GetEntries() << " calibrated events." << endl;

	TString varName;
	TString condition;

	cout << drawEntries << " entries in input chain will be processed." << endl;

//	const Int_t firstThinStrip = 5;

	TString canName;
	TString canTitle;

	TString timeSiCondition;
	timeSiCondition.Form("0.3*tSQX_R[0]-0.125*tF5[0]<100");
	//	TString auxCon;
	for (Int_t j = 1; j<32; j++) {
		condition.Form(" && 0.3*tSQX_R[%d]-0.125*tF5[0]<100", j);
		timeSiCondition.Append(condition);
	}
	cout << timeSiCondition << endl;

/////////////////////////////////////////////////////////////////////
//	c3



	/*TCanvas *c3[16];
//	c3->Divide(4,4);

	for (Int_t i = 0; i < 16; i++) {
		canName.Form("c3_%d", i);
		canTitle.Form("time from CsI: %d", i);
		c3[i] = new TCanvas(canName, canTitle, 1000, 900);
		c3[i]->cd();

		varName.Form("CsI_R[%d]:0.125*tCsI_R[%d]-0.125*tF5[0]", i, i);
		condition.Form("CsI_R[%d]>250 && trigger==3"
				"&& 0.125*tCsI_R[%d]-0.125*tF5[0] > -80"
				"&& 0.125*tCsI_R[%d]-0.125*tF5[0] < 0"
				"&& CsI_R[%d] < 4500",
				i, i, i, i);

		tr->SetMarkerColor(kBlack);
		tr->SetMarkerStyle(20);
		tr->SetMarkerSize(.4);
		tr->Draw(varName, condition, "", drawEntries);

		c3[i]->Update();
	}//*/

//	return;

/////////////////////////////////////////////////////////////////////
	//	c4

	TCanvas *c4[16];

	TFile *fCutsTime = new TFile("cutsTimeCsI.root");
	TCutG *currCut;
	TString cutName;


	for (Int_t i = 4; i < 16; i++) {
		canName.Form("c4_%d", i);
		canTitle.Form("PID plot from CsI filtered for time: %d", i);
		c4[i] = new TCanvas(canName, canTitle, 1000, 900);
		c4[i]->cd();

		cutName.Form("cTime%d", i);
		currCut = (TCutG*)fCutsTime->Get(cutName);

		varName.Form("SQRXE:NeEvent.CsI_R[%d]", i);
		condition.Form("NeEvent.CsI_R[%d]<3500"
//				"&& 0.125*tCsI_R[%d]-0.125*tF5[0] > -70"
//				"&& 0.125*tCsI_R[%d]-0.125*tF5[0] < -40"
				"&& SQRXEsum<25 && SQRXmult==1"
				"&& trigger==3  && %s && %s",
				i, cutName.Data(), timeSiCondition.Data());
		tr->SetMarkerColor(kBlack);
		tr->SetMarkerStyle(20);
		tr->SetMarkerSize(.4);

		tr->Draw(varName, condition, "", drawEntries);
//		tr->Draw(varName, "", "", drawEntries);
		//		tr->Draw(varName, condition, "", drawEntries);

//		tAlphaCal->Draw(varName, "", "same");

		c4[i]->Update();
	}//*/

	return;

/////////////////////////////////////////////////////////////////////
//	c5


	return;

}