showTritium.cxx 7.29 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
#include "TSystem.h"
#include "TFile.h"
#include "TTree.h"
#include "TChain.h"
#include "TCanvas.h"
#include "TBox.h"
#include "TCut.h"
#include "TCutG.h"
#include "TROOT.h"

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

void showTritium(const Long64_t drawEntries = 100000)
{
//	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 *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");


	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;

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

	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;

/////////////////////////////////////////////////////////////////////
//	c1


	TCanvas *c1 = new TCanvas("c1", "tritium raw", 1600, 800);
	c1->Divide(4,2);

	for (Int_t i = 0; i < 8; i++) {
		c1->cd(i+1);

		varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip);
		condition.Form("NeEvent.CsI_R[%d]<4000 "
				"&& SQRXEsum<40 && SQRXmult==1 && SQRXE[0]<1 "
				"&& trigger==3",
				i+firstThinStrip);


		tr->SetMarkerColor(kBlack);
		tr->SetMarkerStyle(20);
		tr->SetMarkerSize(0.1);
		tr->Draw(varName, condition, "", drawEntries);
		c1->Update();
	}//*/
//	return;

/////////////////////////////////////////////////////////////////////
//	c2

96
	TCanvas *c2 = new TCanvas("c2", "time from right Si", 1600, 800);
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
	c2->Divide(4,2);

	for (Int_t i = 0; i < 8; i++) {
		c2->cd(i+1);
//		varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip);
		varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[0]", i+firstThinStrip, i+firstThinStrip);
		condition.Form("tSQX_R[%d]>0"
//				"&& SQLYEsum>1.1 && SQLYEsum<30 "
//				"&& SQLYE[0]<1. && SQLYE[15]<1."
//				"&& SQLYmult==1 && SQLXmult==1"
				"&& trigger==3",
				i+firstThinStrip);
		tr->SetMarkerColor(kBlack);
		tr->Draw(varName, condition, "", drawEntries);
//		tr->Draw(varName, condition, "", drawEntries);


		condition.Form(
//				"tSQX_R[%d]>0"
//				"&& 0.3*tSQX_R-0.125*tF5[0] <100 "
				//				"&& SQLYE[0]<1. && SQLYE[15]<1."
				//				"&& SQLYmult==1 && SQLXmult==1"
				"trigger==3 && %s",
//				i+firstThinStrip,
				timeSiCondition.Data());

		tr->SetMarkerColor(kRed);
		tr->Draw(varName, condition, "same", drawEntries);

		c2->Update();
	}//for */



//	return;

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

136
	TCanvas *c3 = new TCanvas("c3", "time from CsI", 1000, 900);
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
	c3->Divide(4,4);

//	gROOT->ProcessLine(".x cutPokus.cxx");



	for (Int_t i = 0; i < 16; i++) {
		c3->cd(i+1);
//		varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[]", i+firstThinStrip, i+firstThinStrip);
//		condition.Form("SQRXE[%d]>3 && trigger==3",
//				i+firstThinStrip);
		cutName.Form("cTime%d", i);
		currCut = (TCutG*)fCutsTime->Get(cutName);

		varName.Form("CsI_R[%d]:0.125*tCsI_R[%d]-0.125*tF5[0]", i, i);
		condition.Form("CsI_R[%d]>3 && 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->Draw(varName, condition, "", drawEntries);
//		tr->Draw(varName, condition, "", drawEntries);

		currCut->Draw("same");

		c3->Update();
	}//*/



//	return;

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

	TCanvas *c4 = new TCanvas("c4", "PID plot from CsI filtered for time", 1600, 800);
	c4->Divide(4,2);


	for (Int_t i = 0; i < 8; i++) {
		c4->cd(i+1);

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

		varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip);
		condition.Form("NeEvent.CsI_R[%d]<3500"
				"&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1"
				"&& trigger==3 && %s && %s",
				i+firstThinStrip, cutName.Data(), timeSiCondition.Data());
		tr->SetMarkerColor(kBlack);
		tr->Draw(varName, condition, "", drawEntries);
//		tr->Draw(varName, "", "", drawEntries);
		//		tr->Draw(varName, condition, "", drawEntries);

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

		cutName.Form("cutEnergy%d", i+firstThinStrip);
		currCut = (TCutG*)fCutsTritium->Get(cutName);

		currCut->Draw("same");

		c4->Update();
	}//*/

204
//	return;
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284

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

	TCanvas *c5 = new TCanvas("c5", "PID plot from CsI filtered for time", 1000, 1000);
	c5->Divide(4,4);

	TCutG *currCutTritium;
	TString cutNameTritium;

	TString cutHe("(cutHe0");
	TString cutNameHe;
	TFile *fCutsHelium = new TFile("cutsDeltaEhelium.root");
	TCutG *cutsHe[14];
	for (Int_t i = 0; i<14; i++) {
		cutNameHe.Form("cutHe%d", i);
		cutsHe[i] = (TCutG*)fCutsHelium->Get(cutNameHe);
		cutName.Form(" || %s", cutNameHe.Data());
		if (i>0) cutHe.Append(cutName);
	}
	cutHe.Append(")");

	cout << endl << endl << cutHe << endl;

	Int_t numberOfHe[16];

	for (Int_t i = 0; i < 16; i++) {
		c5->cd(i+1);

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

		cutNameTritium.Form("cutEnergy%d", i);
		currCutTritium = (TCutG*)fCutsTritium->Get(cutNameTritium);

		varName.Form("SQRXE:NeEvent.CsI_R[%d]", i);
		condition.Form("NeEvent.CsI_R[%d]<3500"
				"&& SQRXEsum<25 && SQRXEsum>1 && 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/100);
		//		tr->Draw(varName, "", "", drawEntries);
		//		tr->Draw(varName, condition, "", drawEntries);

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

//		cutName.Form("cutEnergy%d", i);
//		currCut = (TCutG*)fCutsTritium->Get(cutName);

		currCutTritium->Draw("same");
		c5->Update();

		condition.Form("NeEvent.CsI_R[%d]<3500"
				"&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1"
				"&& trigger==3 && %s && %s && %s && %s",
				i,
				cutName.Data(), timeSiCondition.Data(), cutNameTritium.Data(), cutHe.Data());
		tr->SetMarkerColor(kRed);
		tr->SetMarkerStyle(20);
		tr->SetMarkerSize(1);
		numberOfHe[i] = tr->Draw(varName, condition, "same", drawEntries);
		cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl;

		c5->Update();
	}

	cout << endl << endl;

	for (Int_t i = 0; i < 16; i++) {
		cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl;
	}


	return;

}