BeAnalysis.cpp 31.7 KB
Newer Older
1 2 3 4 5 6 7 8
/*
 * BeAnalysis.cpp
 *
 *  Created on: Jul 19, 2017
 *      Author: vratik
 */

#include "BeAnalysis.h"
9

10
#include "BeWork.h"
11
#include "TCanvas.h"
12
#include "TGaxis.h"
13

14
BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(1) {
15 16
	// TODO Auto-generated constructor stub

17 18 19 20 21 22 23 24
	for (Int_t i = 0; i < 6; i++) {
		chs[i] = NULL;
		ti[i] = NULL;
	}

	SetCuts();
	SetChainsToDraw();

25 26 27 28 29 30 31 32
	noIntervals = 5;
	epsilonT = new Bool_t[noIntervals];
	for (Int_t i = 0; i < noIntervals; i++) {
		epsilonT[i] = 0;
	}
	epsilonT[0] = 1;
	epsilonT[2] = 1;

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

	cosThetaT = new Bool_t[noIntervals];
	for (Int_t i = 0; i < noIntervals; i++) {
		cosThetaT[i] = 0;
	}
	cosThetaT[0] = 1;
	cosThetaT[2] = 1;
	cosThetaT[4] = 1;

	epsilonY = new Bool_t[noIntervals];
	for (Int_t i = 0; i < noIntervals; i++) {
		epsilonY[i] = 0;
	}
	epsilonY[0] = 1;
	epsilonY[2] = 1;

49 50 51 52 53 54 55
	cosThetaY = new Bool_t[noIntervals];
	for (Int_t i = 0; i < noIntervals; i++) {
		cosThetaY[i] = 0;
	}
	cosThetaY[0] = 1;
	cosThetaY[2] = 1;
	cosThetaY[4] = 1;
56

57 58 59 60 61 62 63 64
	thetaAT = new Bool_t[noIntervals];
	for (Int_t i = 0; i < noIntervals; i++) {
		thetaAT[i] = 0;
	}
	thetaAT[0] = 1;
	thetaAT[2] = 1;
	thetaAT[4] = 1;

65 66 67
	kVerbose = 1;
	kRangeProportionIn = 2.0;

68 69 70 71
	kSaveFigures = 0;
	figurePath = "";
	figureFormat = "";

72 73 74 75 76 77 78 79
}

BeAnalysis::~BeAnalysis() {
	// TODO Auto-generated destructor stub
}

void BeAnalysis::OpenSimChains() {

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
//	const Int_t lowSimFile[6] = {0, 0, 0, 0, 0, 0};
//	const Int_t upSimFile[6] = {14, 14, 14, 14, 14, 14};
//
//	TString chainAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_0_50-85_";
//	TString inputTreeAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_0_50-85_000.root";
//	//isotropic, 0 degrees
//	TString chainNoAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_0_50-85_";
//	TString inputTreeNoAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_0_50-85_000.root";
//	//aligned, 180 degrees
//	TString chainAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_180_50-85_";
//	TString inputTreeAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_180_50-85_000.root";
//	//isotropic, 180 degrees
//	TString chainNoAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_180_50-85_";
//	TString inputTreeNoAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_180_50-85_000.root";
//	//isotropic, 90 degrees
//	TString chainAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_90_50-85_";
//	TString inputTreeAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_90_50-85_000.root";
//	//isotropic, 90 degrees
//	TString chainNoAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_90_50-85_";
//	TString inputTreeNoAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_90_50-85_000.root";


	for (Int_t i = 0; i < 6; i++) {
		chs[i] = BeWork::OpenChain(simFiles[i].Data(),
				lowSimFile[i], upSimFile[i], "simbe", 4, "sbeam");
		Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[i]->GetEntries(), chs[i]->GetName());
		ti[i] = BeWork::OpenTree(inputFiles[i].Data(), "sbeam", 2);
	}

//	chs[1] = BeWork::OpenChain(chainNoAl0name.Data(),
//			lowSimFile[1], upSimFile[1], "simbe", 4, "sbeam");
//	Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[1]->GetEntries(), chs[1]->GetName());
//	ti[1] = BeWork::OpenTree(inputTreeNoAl0name.Data(), "sbeam", 2);
//
//	chs[2] = BeWork::OpenChain(chainAl180name.Data(),
//			lowSimFile[2], upSimFile[2], "simbe", 4, "sbeam");
//	Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[2]->GetEntries(), chs[2]->GetName());
//	ti[2] = BeWork::OpenTree(inputTreeAl180name.Data(), "sbeam", 2);
//
//	chs[3] = BeWork::OpenChain(chainNoAl180name.Data(),
//			lowSimFile[3], upSimFile[3], "simbe", 4, "sbeam");
//	Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[3]->GetEntries(), chs[3]->GetName());
//	ti[3] = BeWork::OpenTree(inputTreeNoAl180name.Data(), "sbeam", 2);
//
//	chs[4] = BeWork::OpenChain(chainAl90name.Data(),
//			lowSimFile[4], upSimFile[4], "simbe", 4, "sbeam");
//	Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[4]->GetEntries(), chs[4]->GetName());
//	ti[4] = BeWork::OpenTree(inputTreeAl90name.Data(), "sbeam", 2);
//
//	chs[5] = BeWork::OpenChain(chainNoAl90name.Data(),
//			lowSimFile[5], upSimFile[5], "simbe", 4, "sbeam");
//	Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[5]->GetEntries(), chs[5]->GetName());
//	ti[5] = BeWork::OpenTree(inputTreeNoAl90name.Data(), "sbeam", 2);
133 134 135 136 137 138

}

void BeAnalysis::OpenExpChain() {

	//experimental chain
139 140
	che = BeWork::OpenChain(expFiles.Data(), lowExpFile, upExpFile, "beonly");										//original file
	Info("BeAnalysis::OpenExpChain", "%lld events in chain \"%s\" containing experimental data",
141 142 143
			che->GetEntries(), che->GetName());

}
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 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224

void BeAnalysis::SetCuts() {
	cBe20 = "fBeIM>0 && fBeIM<20";
	cBe3 = "fBeIM>0 && fBeIM<3";
	cBeWork = "fBeIM>0 && fBeIM<10";

	cBe0_14 = "fBeIM>0 && fBeIM<1.4";
	//	TCut cBe0_14 = "fBeIM>0 && fBeIM<1.6";
	//	TCut cBe0_14 = "fBeIM>0 && fBeIM<1.20";
	cBe14_19 = "fBeIM>1.4 && fBeIM<1.9";
	cBe19_25 = "fBeIM>1.9 && fBeIM<2.5";
	cBe25_31 = "fBeIM>2.5 && fBeIM<3.1";
	cBe31_37 = "fBeIM>3.1 && fBeIM<3.7";
	//array:
	cBeE[0] = cBe0_14;
	cBeE[1] = cBe14_19;
	cBeE[2] = cBe19_25;
	cBeE[3] = cBe25_31;
	cBeE[4] = cBe31_37;

	cEpsilonT = "fTpp/fBeIM<0.2";
	//	TCut cEpsilonT = "fTpp/fBeIM<1.";
	//	TCut cEpsilonY = "fTap/fBeIM<0.5";
	cEpsilonY = "fTap/fBeIM>0.7";

	//raw files
	//energy cuts
	crBe20 = "f6BeIM>0 && f6BeIM<20";
	crBe3 = "f6BeIM>0 && f6BeIM<3";
	crBeWork = "f6BeIM>0 && f6BeIM<10";

	crBe0_14 = "f6BeIM>0 && f6BeIM<1.4";
	//	TCut crBe0_14 = "f6BeIM>0 && f6BeIM<1.6";
	//	TCut crBe0_14 = "f6BeIM>0.5 && f6BeIM<1.20";
	crBe14_19 = "f6BeIM>1.4 && f6BeIM<1.9";
	crBe19_25 = "f6BeIM>1.9 && f6BeIM<2.5";
	crBe25_31 = "f6BeIM>2.5 && f6BeIM<3.1";
	crBe31_37 = "f6BeIM>3.1 && f6BeIM<3.7";
	//array:
	crBeE[0] = crBe0_14;
	crBeE[1] = crBe14_19;
	crBeE[2] = crBe19_25;
	crBeE[3] = crBe25_31;
	crBeE[4] = crBe31_37;
	//angular cuts


	//	TCut crEpsilonT = "fTpp/f6BeIM>0.8";
	crEpsilonT = "fTpp/f6BeIM<0.2";
	//	TCut crEpsilonT = "fTpp/f6BeIM<1.";
	//	TCut crEpsilonY = "fTap/f6BeIM<0.5";
	crEpsilonY = "fTap/f6BeIM>0.7";

	//simulation input
	ciBe0_14 = "E_IM>0 && E_IM<1.4";
	//	TCut ciBe0_14 = "E_IM>0 && E_IM<1.6";
	//	TCut ciBe0_14 = "E_IM>0.5 && E_IM<1.20";
	ciBe14_19 = "E_IM>1.4 && E_IM<1.9";
	ciBe19_25 = "E_IM>1.9 && E_IM<2.5";
	ciBe25_31 = "E_IM>2.5 && E_IM<3.1";
	ciBe31_37 = "E_IM>3.1 && E_IM<3.7";
	//array:
	ciBeE[5] = ciBe0_14;
	ciBeE[5] = ciBe14_19;
	ciBeE[5] = ciBe19_25;
	ciBeE[5] = ciBe25_31;
	ciBeE[5] = ciBe31_37;

	ciEpsilon = "sTpp/E_IM<0.2";
	//	TCut ciEpsilon = "sTpp/E_IM<1.";
	//	TCut ciEpsilonY = "sTap/E_IM<0.5";
	ciEpsilonY = "sTap/E_IM>0.7";

	cQ = "TMath::Abs(fQLiP)<10";
	cProtons = "fP1Lab.fE-938.272<50 && fP2Lab.fE-938.272<50";
	//	TCut cProtons = "fP1Lab.fE-938.272<34 && fP2Lab.fE-938.272<34 && fP1Lab.fE-938.272>1 && fP2Lab.fE-938.272>1";
}

void BeAnalysis::SetCMAngularRange(Int_t minAngle, Int_t maxAngle) {
	kMinAngle = minAngle;
	kMaxAngle = maxAngle;
225
	SetCMAngularCuts();
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
}

void BeAnalysis::SetChainsToDraw(Bool_t ch0, Bool_t ch1, Bool_t ch2, Bool_t ch3, Bool_t ch4,
		Bool_t ch5) {

	kChains[0] = ch0;
	kChains[1] = ch1;
	kChains[2] = ch2;
	kChains[3] = ch3;
	kChains[4] = ch4;
	kChains[5] = ch5;

}

void BeAnalysis::SetRangeProportion(Float_t rangeProportion, Bool_t autoRange) {
	kRangeProportion = rangeProportion;
	kAutoRange = autoRange;
}

245
void BeAnalysis::SetNoExpEvents(Long64_t *noExpEvents) {
246 247 248

	eMaxEvents = 5000000;

249 250 251 252 253 254 255
	if (!noExpEvents) {
		for (Int_t i = 0; i < 6; i++) {
			eEvents[i] = eMaxEvents;
		}
		Warning("BeAnalysis::SetNoExpEvents", "Default numbers of experimental events were set.");
		return;
	}
256

257 258 259 260 261
	for (Int_t i = 0; i < 6; i++) {
		eEvents[i] = noExpEvents[i];
//		cout << eEvents[i] << endl;
	}
	return;
262 263 264

}

265
void BeAnalysis::SetNoSimEvents(Long64_t *noSimEvents) {
266 267 268

	sMaxEvents = 3000000;

269 270 271 272 273 274 275 276
	if (!noSimEvents) {
		for (Int_t i = 0; i < 6; i++) {
			sEvents[i] = sMaxEvents;
			cout << sEvents[i] << endl;
		}
		Warning("BeAnalysis::SetNoSimEvents", "Default numbers of simulated events were set.");
		return;
	}
277

278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
	for (Int_t i = 0; i < 6; i++) {
		sEvents[i] = noSimEvents[i];
		cout << sEvents[i] << endl;
	}
	return;

//	sEventsAl0 = sMaxEvents;
//	sEventsNoAl0 = 2700000;
//	sEventsAl180 = sMaxEvents;
//	sEventsNoAl180 = 2700000;
//	sEventsAl90 = 2690000;
//	sEventsNoAl90 = 2710000;
//
//	sEvents[0] = sEventsAl0;
//	sEvents[1] = sEventsNoAl0;
//	sEvents[2] = sEventsAl180;
//	sEvents[3] = sEventsNoAl180;
//	sEvents[4] = sEventsAl90;
//	sEvents[5] = sEventsNoAl90;
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319

}

void BeAnalysis::SetRatiosGStoEX() {

	sRatioAl0 = "sRatio>0.051 && sRatio<0.101";
	//	TCut sRatioAl0 = "sRatio>0.060 && sRatio<0.110";
	sRatioNoAl0 = "sRatio>0.050 && sRatio<0.100";
	sRatioAl180 = "sRatio>0.047 && sRatio<0.097";
	sRatioNoAl180 = "sRatio>0.048 && sRatio<0.098";
	sRatioAl90 = "sRatio>0.051 && sRatio<0.101";
	sRatioNoAl90 = "sRatio>0.051 && sRatio<0.101";

	sRatio[0] = sRatioAl0;
	sRatio[1] = sRatioNoAl0;
	sRatio[2] = sRatioAl180;
	sRatio[3] = sRatioNoAl180;
	sRatio[4] = sRatioAl90;
	sRatio[5] = sRatioNoAl90;

}

void BeAnalysis::SetCMAngularCuts() {
320 321 322 323 324 325 326 327

	TString sAngles, srAngles;

	sAngles.Form("fBeThetaCM1>%d*TMath::DegToRad() && fBeThetaCM1<%d*TMath::DegToRad()", kMinAngle, kMaxAngle);
	srAngles.Form("f6BeThetaCM1>%d*TMath::DegToRad() && f6BeThetaCM1<%d*TMath::DegToRad()", kMinAngle, kMaxAngle);

	cAngles = sAngles.Data();
	crAngles = srAngles.Data();
328 329 330 331 332 333 334 335
}

void BeAnalysis::Spectra() {

	if (!spectra) {
		return;
	}

336 337 338 339 340 341 342 343 344 345 346
	if (!che) {
		Error("BeAnalysis::Spectra", "Chain with experimental data was not initialized.");
		return;
	}

	for (Int_t i = 0; i < 6; i++) {
			if (!chs[i]) {
				Error("BeAnalysis::Spectra", "Chain No. %d with simulated data was not initialized.", i);
				return;
			}
	}
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373

	TCanvas *cSpectra = new TCanvas();

	TH1F *hsSpectra[6];
	TH1F *heSpectra[6];
	TH1F *hSdiff[6];

	canvasTitle.Form("energy spectra fitting;\t(%d,%d) degrees", kMinAngle, kMaxAngle);
	cSpectra->SetTitle(canvasTitle.Data());
	cSpectra->Divide(2, 3);

	che->SetLineColor(kGreen);

	for (Int_t j = 0; j < 6; j++) {	//different files
		if (!kChains[j]) continue;
		cout << kChains[j] << endl;
		cSpectra->cd(j+1);
		chs[j]->SetLineColor(kBlue);
		chs[j]->SetFillColor(kWhite);
		hsName.Form("hsSpectra%d", j);
		drawCommand.Form("f6BeIM>>%s(200,0,10)", hsName.Data());
		//			chs[j]->Draw(drawCommand.Data(), cQ && crBeWork && crAngles && sRatio[j], "", sEvents[j]);
		chs[j]->Draw(drawCommand.Data(), cProtons && cQ && crBeWork && crAngles && sRatio[j], "", sEvents[j]);
		hsSpectra[j] = (TH1F*)gPad->FindObject(hsName.Data());
		heName.Form("heSpectra%d", j);
		drawCommand.Form("fBeIM>>%s(200,0,10)", heName.Data());
		//			che->Draw(drawCommand.Data(), cQ && cBeWork && cAngles, "same", eEvents[j]);
374

375
		che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]);
376 377 378 379 380

////		cout << drawCommand << "\t" << eEvents[j] << endl;
////		che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]);
//		che->Draw("fBeIM", "", "");
//		continue;
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
		heSpectra[j] = (TH1F*)gPad->FindObject(heName.Data());

		//			heSpectra[j]->Draw("");
		heSpectra[j]->Draw("E");
		heSpectra[j]->SetLineColor(1);
		heSpectra[j]->SetTitle("");
		heSpectra[j]->SetXTitle("E_{T} [MeV]");
		heSpectra[j]->GetXaxis()->SetTitleOffset(0.95);
		heSpectra[j]->GetXaxis()->CenterTitle();
		heSpectra[j]->SetYTitle("counts");
		heSpectra[j]->GetYaxis()->SetTitleOffset(0.7);
		heSpectra[j]->GetYaxis()->CenterTitle();
		hsSpectra[j]->SetLineColor(kGray+1);
		hsSpectra[j]->SetFillColor(kGray+1);
		hsSpectra[j]->Draw("same");
		heSpectra[j]->Draw("same E");

		if (kAutoRange) {
			Float_t leftMaxMC = kRangeProportion*hsSpectra[j]->GetMaximum();
			Float_t leftMaxE = kRangeProportion*heSpectra[j]->GetMaximum();
			leftMaxMC > leftMaxE ? heSpectra[j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : heSpectra[j]->GetYaxis()->SetRangeUser(0, leftMaxE);
		}


		hSdiff[j] = new TH1F(*heSpectra[j]);
		hSdiff[j]->Add(hsSpectra[j], -1);
		hSdiff[j]->SetLineColor(kRed);

		cSpectra->Update();

		cout << endl;
		Info("statesRatioFitting", "MC %d", j+1);
		Info("statesRatioFitting", "ground state: %3.1f (sim)/ %3.1f (exp) = %3.3f", hsSpectra[j]->Integral(0,40), heSpectra[j]->Integral(0,40), hsSpectra[j]->Integral(0,40)/heSpectra[j]->Integral(0,40) );
		Info("statesRatioFitting", "left slope: %3.1f (sim)/ %3.1f (exp) = %3.3f\n", hsSpectra[j]->Integral(50,70), heSpectra[j]->Integral(50,70), hsSpectra[j]->Integral(50,70)/heSpectra[j]->Integral(50,70) );
	}//for j

417
	SaveFigures(cSpectra, "Spectra", 1);
418 419 420 421

	Info("sfAngInt_spectra.cxx", "Finished.");

}
422 423 424 425

void BeAnalysis::EpsilonT() {


426 427
	TCanvas *canEpsilonT[noIntervals];
	for (Int_t i = 0; i<noIntervals; i++) {	//energy intervals (canvases)
428

429 430 431
		TH1F *hseT[noIntervals][6];
		TH1F *heeT[noIntervals][6];
		TH1F *hieT[noIntervals][6];
432 433

		if (!epsilonT[i]) continue;
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507

		canEpsilonT[i] = new TCanvas();

		canvasTitle.Form("epsilon in %s T-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle);
		canEpsilonT[i]->SetTitle(canvasTitle.Data());
		canEpsilonT[i]->Divide(2, 3);

		che->SetLineColor(kBlack);
		for (Int_t j = 0; j < 6; j++) {	//different files
			if (!kChains[j]) continue;
			canEpsilonT[i]->cd(j+1);
			chs[j]->SetLineColor(kGray+1);
			chs[j]->SetFillColor(kGray+1);
			hsName.Form("hseT%d_%d", i, j);
			drawCommand.Form("fTpp/f6BeIM>>%s(30,0,1)", hsName.Data());
			chs[j]->Draw(drawCommand.Data(), cProtons && cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]);
			hseT[i][j] = (TH1F*)gPad->FindObject(hsName.Data());
			heName.Form("heeT%d_%d", i, j);
			drawCommand.Form("fTpp/fBeIM>>%s", heName.Data());
			che->Draw(drawCommand.Data(), cProtons && cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]);
			heeT[i][j] = (TH1F*)gPad->FindObject(heName.Data());

			hseT[i][j]->Draw();
			hseT[i][j]->SetTitle("");
			hseT[i][j]->SetXTitle("\\varepsilon");
			hseT[i][j]->GetXaxis()->SetTitleOffset(0.95);
			hseT[i][j]->GetXaxis()->CenterTitle();
			hseT[i][j]->SetYTitle("counts");
			hseT[i][j]->GetYaxis()->SetTitleOffset(0.7);
			hseT[i][j]->GetYaxis()->CenterTitle();
			heeT[i][j]->Draw("E same");
			if (kAutoRange) {
				Float_t leftMaxMC = kRangeProportion*hseT[i][j]->GetMaximum();
				Float_t leftMaxE = kRangeProportion*heeT[i][j]->GetMaximum();
				hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
				leftMaxMC > leftMaxE ? hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
			}
			else {
				hseT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]);
			}
			canEpsilonT[i]->Update();


			hiName.Form("hieT%d_%d", i, j);
			drawCommand.Form("sTpp/E_IM>>%s", hiName.Data());
			ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same");
			hieT[i][j] = (TH1F*)gPad->FindObject(hiName.Data());
			Float_t rightmax = kRangeProportionIn*hieT[i][j]->GetMaximum();
			Float_t scale = canEpsilonT[i]->GetPad(j+1)->GetUymax()/rightmax;
			hieT[i][j]->SetLineColor(kRed);
			hieT[i][j]->Scale(scale);

			//draw an axis on the right side
			TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
					gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
			axis->SetLineColor(kRed);
			axis->SetLabelColor(kRed);
			axis->Draw();

			canEpsilonT[i]->Update();

			if (kVerbose) {
				Info("sfAngInt_epsilonT.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f",
						i, j, heeT[i][j]->Integral(0,heeT[i][j]->GetNbinsX()),
						hseT[i][j]->Integral(0,hseT[i][j]->GetNbinsX()),
						heeT[i][j]->Integral(0,heeT[i][j]->GetNbinsX())/hseT[i][j]->Integral(0,hseT[i][j]->GetNbinsX()) );
			}

		}//for j
		if (kVerbose) cout << endl;

		SaveFigures(canEpsilonT[i], "epsilonT", i);

		/*if (savePictures) {
508 509 510 511 512 513
				canvasName.Form("%sfig%depsilonT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data());
				cout << canvasName.Data() << endl;
				canEpsilonT[i]->SaveAs(canvasName.Data());
				canEpsilonT[i]->cd();
				canEpsilonT[i]->Close();
			}//if save pictures*/
514
		//		}//if
515 516 517
	}//for i

}
518 519 520

void BeAnalysis::CosThetaTk() {

521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593
	TCanvas *cThetaT[noIntervals];
	for (Int_t i = 0; i<noIntervals; i++) {	//energy intervals (canvases)

		TH1F *hscoskT[noIntervals][6];
		TH1F *hecoskT[noIntervals][6];
		TH1F *hicoskT[noIntervals][6];

		if (!cosThetaT[i]) continue;
		//		{

		cThetaT[i] = new TCanvas();

		canvasTitle.Form("cos thetak in %s T-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle);
		cThetaT[i]->SetTitle(canvasTitle.Data());
		cThetaT[i]->Divide(2, 3);

		che->SetLineColor(kBlack);
		for (Int_t j = 0; j < 6; j++) {	//different files
			if (!kChains[j]) continue;
			cThetaT[i]->cd(j+1);
			chs[j]->SetLineColor(kGray+1);
			chs[j]->SetFillColor(kGray+1);
			hsName.Form("hscoskT%d_%d", i, j);
			drawCommand.Form("fCosThetaTk>>%s(50,-1,1)", hsName.Data());
			chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]);
			hscoskT[i][j] = (TH1F*)gPad->FindObject(hsName.Data());
			heName.Form("hecoskT%d_%d", i, j);
			drawCommand.Form("fCosThetaTk>>%s(50,-1,1)", heName.Data());
			che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]);
			hecoskT[i][j] = (TH1F*)gPad->FindObject(heName.Data());

			hscoskT[i][j]->Draw();
			//				hscoskT[i][j]->GetYaxis()->SetRangeUser(0, coskTRange[i][j]);
			hecoskT[i][j]->Draw("E same");
			if (kAutoRange) {
				Float_t leftMaxMC = kRangeProportion*hecoskT[i][j]->GetMaximum();
				Float_t leftMaxE = kRangeProportion*hscoskT[i][j]->GetMaximum();
				hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
				leftMaxMC > leftMaxE ? hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
			}
			else {
				hscoskT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]);
			}
			cThetaT[i]->Update();


			hiName.Form("hicoskT%d_%d", i, j);
			drawCommand.Form("sCosThetaTk>>%s(50,0,1)", hiName.Data());
			ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same");
			hicoskT[i][j] = (TH1F*)gPad->FindObject(hiName.Data());
			Float_t rightmax = 1.1*hicoskT[i][j]->GetMaximum();
			Float_t scale = cThetaT[i]->GetPad(j+1)->GetUymax()/rightmax;
			hicoskT[i][j]->SetLineColor(kRed);
			hicoskT[i][j]->Scale(scale);

			//draw an axis on the right side
			TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
					gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
			axis->SetLineColor(kRed);
			axis->SetLabelColor(kRed);
			axis->Draw();

			cThetaT[i]->Update();

			if (kVerbose) {
				Info("sfAngInt_cosThetaTk.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f",
						i, j, hecoskT[i][j]->Integral(0,hecoskT[i][j]->GetNbinsX()),
						hscoskT[i][j]->Integral(0,hscoskT[i][j]->GetNbinsX()),
						hecoskT[i][j]->Integral(0,hecoskT[i][j]->GetNbinsX())/hscoskT[i][j]->Integral(0,hscoskT[i][j]->GetNbinsX()) );
			}

		}//for j

594 595
		SaveFigures(cThetaT[i], "cosThetakT", i);

596 597 598 599 600 601 602 603 604
		/*if (savePictures) {
			canvasName.Form("%sfig%dcosThetakT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data());
			cThetaT[i]->SaveAs(canvasName.Data());
			cThetaT[i]->cd();
			cThetaT[i]->Close();
		}*/
		//		}//if
	}//for i

605 606 607
}

void BeAnalysis::EpsilonY() {
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678

	TCanvas *canEpsilonY[noIntervals];
	for (Int_t i = 0; i<noIntervals; i++) {	//energy intervals (canvases)

		TH1F *hseY[noIntervals][6];
		TH1F *heeY[noIntervals][6];
		TH1F *hieY[noIntervals][6];

		if (!epsilonY[i]) continue;
		//		{

		canEpsilonY[i] = new TCanvas();

		canvasTitle.Form("epsilon in %s Y-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle);
		canEpsilonY[i]->SetTitle(canvasTitle.Data());
		canEpsilonY[i]->Divide(2, 3);

		che->SetLineColor(kBlack);
		for (Int_t j = 0; j < 6; j++) {	//different files
			canEpsilonY[i]->cd(j+1);
			chs[j]->SetLineColor(kGray+1);
			chs[j]->SetFillColor(kGray+1);
			hsName.Form("hseY%d_%d", i, j);
			drawCommand.Form("fTap/f6BeIM>>%s(50,0,1)", hsName.Data());
			chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEvents[j]);
			hseY[i][j] = (TH1F*)gPad->FindObject(hsName.Data());
			heName.Form("heeY%d_%d", i, j);
			drawCommand.Form("fTap/fBeIM>>%s(50,0,1)", heName.Data());
			che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEvents[j]);
			heeY[i][j] = (TH1F*)gPad->FindObject(heName.Data());

			hseY[i][j]->Draw();
			heeY[i][j]->Draw("E same");
			if (kAutoRange) {
				Float_t leftMaxMC = kRangeProportion*heeY[i][j]->GetMaximum();
				Float_t leftMaxE = kRangeProportion*hseY[i][j]->GetMaximum();
				hseY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
				leftMaxMC > leftMaxE ? hseY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hseY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
			}
			else {
				hseY[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]);
			}
			canEpsilonY[i]->Update();

			hiName.Form("hieY%d_%d", i, j);
			drawCommand.Form("sTap/E_IM>>%s(50,0,1)", hiName.Data());
			ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same");
			hieY[i][j] = (TH1F*)gPad->FindObject(hiName.Data());
			Float_t rightmax = 1.1*hieY[i][j]->GetMaximum();
			Float_t scale = canEpsilonY[i]->GetPad(j+1)->GetUymax()/rightmax;
			hieY[i][j]->SetLineColor(kRed);
			hieY[i][j]->Scale(scale);

			//draw an axis on the right side
			TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
					gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
			axis->SetLineColor(kRed);
			axis->SetLabelColor(kRed);
			axis->Draw();

			canEpsilonY[i]->Update();

			if (kVerbose) {
				Info("sfAngInt_epsilonY.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f",
						i, j, heeY[i][j]->Integral(0,heeY[i][j]->GetNbinsX()),
						hseY[i][j]->Integral(0,hseY[i][j]->GetNbinsX()),
						heeY[i][j]->Integral(0,heeY[i][j]->GetNbinsX())/hseY[i][j]->Integral(0,hseY[i][j]->GetNbinsX()) );
			}

		}//for j

679 680
		SaveFigures(canEpsilonY[i], "EpsilonY", i);

681 682 683 684 685 686 687 688 689 690 691
		/*if (savePictures) {
			canvasName.Form("%sfig%dEpsilonY:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data());
			cout << canvasName.Data() << endl;
			canEpsilonY[i]->SaveAs(canvasName.Data());
			canEpsilonY[i]->cd();
			canEpsilonY[i]->Close();
		}//if save pictures*/
		//		}//if
	}//for i


692 693 694
}

void BeAnalysis::CosThetaYk() {
695 696

	TCanvas *cThetaY[noIntervals];
697
	for (Int_t i = 0; i<noIntervals; i++) {	//energy intervals (canvases)
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766

		TH1F *hscoskY[noIntervals][6];
		TH1F *hecoskY[noIntervals][6];
		TH1F *hicoskY[noIntervals][6];

		if (cosThetaY[i]) continue;
		//			{

		cThetaY[i] = new TCanvas();

		canvasTitle.Form("cos thetak in %s Y-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle);
		cThetaY[i]->SetTitle(canvasTitle.Data());
		cThetaY[i]->Divide(2, 3);

		che->SetLineColor(kBlack);
		for (Int_t j = 0; j < 6; j++) {	//different files
			cThetaY[i]->cd(j+1);
			chs[j]->SetLineColor(kGray+1);
			chs[j]->SetFillColor(kGray+1);
			hsName.Form("hscoskY%d_%d", i, j);
			drawCommand.Form("fCosThetaYk>>%s(50,-1,1)", hsName.Data());
			chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEvents[j]);
			hscoskY[i][j] = (TH1F*)gPad->FindObject(hsName.Data());
			heName.Form("hecoskY%d_%d", i, j);
			drawCommand.Form("fCosThetaYk>>%s(50,-1,1)", heName.Data());
			che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEvents[j]);
			hecoskY[i][j] = (TH1F*)gPad->FindObject(heName.Data());

			hscoskY[i][j]->Draw();
			hecoskY[i][j]->Draw("E same");
			if (kAutoRange) {
				Float_t leftMaxMC = kRangeProportion*hecoskY[i][j]->GetMaximum();
				Float_t leftMaxE = kRangeProportion*hscoskY[i][j]->GetMaximum();
				hscoskY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
				leftMaxMC > leftMaxE ? hscoskY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hscoskY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
			}
			else {
				hscoskY[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]);
			}

			cThetaY[i]->Update();

			hiName.Form("hicoskY%d_%d", i, j);
			drawCommand.Form("sCosThetaYk>>%s", hiName.Data());
			ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same");
			hicoskY[i][j] = (TH1F*)gPad->FindObject(hiName.Data());
			Float_t rightmax = 1.1*hicoskY[i][j]->GetMaximum();
			Float_t scale = cThetaY[i]->GetPad(j+1)->GetUymax()/rightmax;
			hicoskY[i][j]->SetLineColor(kRed);
			hicoskY[i][j]->Scale(scale);

			//draw an axis on the right side
			TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
					gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
			axis->SetLineColor(kRed);
			axis->SetLabelColor(kRed);
			axis->Draw();

			cThetaY[i]->Update();

			if (kVerbose) {
				Info("sfAngInt_cosThetaYk.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f",
						i, j, hecoskY[i][j]->Integral(0,hecoskY[i][j]->GetNbinsX()),
						hscoskY[i][j]->Integral(0,hscoskY[i][j]->GetNbinsX()),
						hecoskY[i][j]->Integral(0,hecoskY[i][j]->GetNbinsX())/hscoskY[i][j]->Integral(0,hscoskY[i][j]->GetNbinsX()) );
			}


		}//for j
767 768 769 770

		SaveFigures(cThetaY[i], "cosThetakY", i);


771 772 773 774 775 776 777
		/*if (savePictures) {
					canvasName.Form("%sfig%dcosThetakY:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data());
					cThetaY[i]->SaveAs(canvasName.Data());
					cThetaY[i]->cd();
					cThetaY[i]->Close();
				}*/
		//			}//if
778
	}//for i
779

780 781
}

782 783 784
void BeAnalysis::ThetaAT() {

	TCanvas *cThetaAT[noIntervals];
785
	for (Int_t i = 0; i<noIntervals; i++) {	//energy intervals (canvases)
786 787 788 789 790

		TH1F *hsthetaAT[noIntervals][6];
		TH1F *hethetaAT[noIntervals][6];
		TH1F *hithetaAT[noIntervals][6];

791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
		if (!thetaAT[i]) continue;

		cThetaAT[i] = new TCanvas();

		canvasTitle.Form("cos theta alpha in %s T-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle);
		cThetaAT[i]->SetTitle(canvasTitle.Data());
		cThetaAT[i]->Divide(2, 3);

		che->SetLineColor(kBlack);
		for (Int_t j = 0; j < 6; j++) {	//different files
			if (!kChains[j]) continue;
			cThetaAT[i]->cd(j+1);
			hsName.Form("hsthetaAT%d_%d", i, j);
			hsthetaAT[i][j] = new TH1F(hsName.Data(), "title", 50, 0, 3.14);
			hsthetaAT[i][j]->SetLineColor(kGray+1);
			hsthetaAT[i][j]->SetFillColor(kGray+1);
			drawCommand.Form("fAThetaCM>>%s", hsthetaAT[i][j]->GetName());
			chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && crEpsilonT && sRatio[j], "goff", sEventsECuts[i][j]);
			heName.Form("hethetaAT%d_%d", i, j);
			hethetaAT[i][j] = new TH1F(heName.Data(), "title", 50, 0, 3.14);
			drawCommand.Form("fAThetaCM>>%s", hethetaAT[i][j]->GetName());
			che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles && cEpsilonT, "goff", eEventsECuts[i][j]);

			hsthetaAT[i][j]->Draw();
			hsthetaAT[i][j]->SetTitle("");
			hsthetaAT[i][j]->SetXTitle("\\theta_{\\alpha} [rad]");
			hsthetaAT[i][j]->GetXaxis()->SetTitleOffset(0.95);
			hsthetaAT[i][j]->GetXaxis()->CenterTitle();
			hsthetaAT[i][j]->SetYTitle("counts");
			//				hsthetaAT[i][j]->GetYaxis()->SetTitleOffset(1.09);
			hsthetaAT[i][j]->GetYaxis()->SetTitleOffset(0.7);
			hsthetaAT[i][j]->GetYaxis()->CenterTitle();

			hethetaAT[i][j]->Draw("E same");
			if (kAutoRange) {
				Float_t leftMaxMC = kRangeProportion*hethetaAT[i][j]->GetMaximum();
				Float_t leftMaxE = kRangeProportion*hsthetaAT[i][j]->GetMaximum();
				hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
				leftMaxMC > leftMaxE ? hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE);
			}
			else {
				hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]);
			}
			cThetaAT[i]->Update();

			hiName.Form("hithetaAT%d_%d", i, j);
			drawCommand.Form("sACM.Theta()>>%s(50,0,3.14)", hiName.Data());
			ti[j]->Draw(drawCommand.Data(), ciEpsilon && ciBeE[i] && sRatio[j], "same");
			hithetaAT[i][j] = (TH1F*)gPad->FindObject(hiName.Data());
			Float_t rightmax = 1.1*hithetaAT[i][j]->GetMaximum();
			Float_t scale = cThetaAT[i]->GetPad(j+1)->GetUymax()/rightmax;
			hithetaAT[i][j]->SetLineColor(kRed);
			hithetaAT[i][j]->Scale(scale);


			//draw an axis on the right side
			TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
					gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L");
			axis->SetLineColor(kRed);
			axis->SetLabelColor(kRed);
			axis->Draw();

			cThetaAT[i]->Update();

			if (kVerbose) {
				Info("sfAngInt_thetaAT.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f",
						i, j, hethetaAT[i][j]->Integral(0,hethetaAT[i][j]->GetNbinsX()),
						hsthetaAT[i][j]->Integral(0,hsthetaAT[i][j]->GetNbinsX()),
						hethetaAT[i][j]->Integral(0,hethetaAT[i][j]->GetNbinsX())/hsthetaAT[i][j]->Integral(0,hsthetaAT[i][j]->GetNbinsX()) );
			}

		}//for j

		SaveFigures(cThetaAT[i], "thetaAT", i);
		/*if (savePictures) {
866 867 868 869 870
					canvasName.Form("%sfig%dthetaAT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data());
					cThetaAT[i]->SaveAs(canvasName.Data());
					cThetaAT[i]->cd();
					cThetaAT[i]->Close();
				}*/
871
	}//for i
872

873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937
}

void BeAnalysis::ExpEventsECuts() {
	eEventsECuts[0][0] = 3950000;
	eEventsECuts[0][1] = 3950000;
	eEventsECuts[0][2] = 3800000;
	eEventsECuts[0][3] = 3850000;
	eEventsECuts[0][4] = 3950000;
	eEventsECuts[0][5] = 3900000;

	eEventsECuts[1][0] = eMaxEvents;
	eEventsECuts[1][1] = eMaxEvents;
	eEventsECuts[1][2] = 4100000;
	eEventsECuts[1][3] = eMaxEvents;
	eEventsECuts[1][4] = eMaxEvents;
	eEventsECuts[1][5] = eMaxEvents;

	eEventsECuts[2][0] = 3050000;
	eEventsECuts[2][1] = 3150000;
	eEventsECuts[2][2] = 3200000;
	eEventsECuts[2][3] = 3200000;
	eEventsECuts[2][4] = 3250000;
	eEventsECuts[2][5] = 3350000;

	eEventsECuts[3][0] = 3850000;
	eEventsECuts[3][1] = 3950000;
	eEventsECuts[3][2] = 3900000;
	eEventsECuts[3][3] = 3900000;
	eEventsECuts[3][4] = 4000000;
	eEventsECuts[3][5] = 4000000;

	eEventsECuts[4][0]	= 4100000;
	eEventsECuts[4][1]	= 4100000;
	eEventsECuts[4][2]	= 4000000;
	eEventsECuts[4][3]	= 4100000;
	eEventsECuts[4][4]	= eMaxEvents;
	eEventsECuts[4][5]	= eMaxEvents;
}

void BeAnalysis::SimEventsECuts() {

	for (Int_t i = 0; i < 5; i++) {
		for (Int_t j = 0; j < 6; j++) {
			sEventsECuts[i][j] = sMaxEvents;
		}
	}

	sEventsECuts[1][1] = 2630000;
	sEventsECuts[1][4] = 2660000;
	sEventsECuts[1][5] = 2660000;

}

void BeAnalysis::EpsilonTRange() {

	for (Int_t i = 0; i < 6; i++) {
		eTRange[0][i] = 300;
		eTRange[1][i] = 380;
		eTRange[2][i] = 300;
		eTRange[3][i] = 500;
		eTRange[4][i] = 500;
	}


}
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009

void BeAnalysis::SetFigures(TString figPath, TString figFormat,
		Bool_t kSave) {
	kSaveFigures = kSave;
	figureFormat = figFormat;
	figurePath = figPath;
}

void BeAnalysis::SetExpChain(TString files, Int_t minFnumber, Int_t maxFnumber) {

	lowExpFile = minFnumber;
	upExpFile = maxFnumber;
	expFiles = files;

}

void BeAnalysis::SetSimChains(TString chainAl0name, TString chainNoAl0name,
		TString chainAl180name, TString chainNoAl180name,
		TString chainAl90name, TString chainNoAl90name) {

	simFiles[0] = chainAl0name;
	simFiles[1] = chainNoAl0name;
	simFiles[2] = chainAl180name;
	simFiles[3] = chainNoAl180name;
	simFiles[4] = chainAl90name;
	simFiles[5] = chainNoAl90name;

}

void BeAnalysis::SetInputChains(TString inputAl0name, TString inputNoAl0name,
		TString inputAl180name, TString inputNoAl180name,
		TString inputAl90name, TString inputNoAl90name) {

	inputFiles[0] = inputAl0name;
	inputFiles[1] = inputNoAl0name;
	inputFiles[2] = inputAl180name;
	inputFiles[3] = inputNoAl180name;
	inputFiles[4] = inputAl90name;
	inputFiles[5] = inputNoAl90name;

}

void BeAnalysis::SetNoSimFiles(Int_t* minFnumber, Int_t* maxFnumber) {
	eMaxEvents = 5000000;

	if (!(minFnumber && maxFnumber)) {
		for (Int_t i = 0; i < 6; i++) {
			lowSimFile[i] = 0;
			upSimFile[i] = 14;
		}
		Info("BeAnalysis::SetNoSimFiles", "Default numbers of simfiles were set.");
		return;
	}

	for (Int_t i = 0; i < 6; i++) {
		lowSimFile[i] = minFnumber[i];
		upSimFile[i] = maxFnumber[i];
	}
	return;
}

void BeAnalysis::SaveFigures(TCanvas *canvas, TString variable, Int_t interval) {

	if (!kSaveFigures) return;

	canvasName.Form("%sfig%d%s:%d%d%s", figurePath.Data(), interval, variable.Data(), kMinAngle, kMaxAngle, figureFormat.Data());
	canvas->SaveAs(canvasName.Data());
	canvas->cd();
	canvas->Close();


}