BeAnalysis.h 5.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * BeAnalysis.h
 *
 *  Created on: Jul 19, 2017
 *      Author: vratik
 */

#ifndef BE_BEANALYSIS_H_
#define BE_BEANALYSIS_H_

#include <iostream>

//#include <TObject.h>
#include "TChain.h"
15
#include "TCut.h"
16
#include "TCanvas.h"
17

18 19
#define NOINTERVALS 5;

20 21 22 23 24 25 26 27 28
using std::cout;
using std::endl;

class BeAnalysis {
public:
	BeAnalysis();
	virtual ~BeAnalysis();
	ClassDef(BeAnalysis, 1);

29 30 31 32 33 34 35 36
	void SetExpChain(TString files, Int_t minFnumber, Int_t maxFnumber);
	void SetSimChains(TString chainAl0name, TString chainNoAl0name,
			TString chainAl180name, TString chainNoAl180name,
			TString chainAl90name, TString chainNoAl90name);
	void SetInputChains(TString inputAl0name, TString inputNoAl0name,
			TString inputAl180name, TString inputNoAl180name,
			TString inputAl90name, TString inputNoAl90name);
	void SetNoSimFiles(Int_t *minFnumber = 0, Int_t *maxFnumber = 0);
37 38 39 40

	void OpenSimChains();
	void OpenExpChain();

41
	void SetNoBinsSpectra(Int_t noBins = 100) {noBinsSpectra = noBins;};
42 43
	void SetSpectraRange(Double_t minEnergy = 0., Double_t maxEnergy = 10.)
		{minSpectraEnergy = minEnergy; maxSpectraEnergy = maxEnergy;};
44
	void SetNoBinsCorrelations(Int_t noBins = 30) {noBinsCorr = noBins;};
45
	void SetNoBinsThetaA(Int_t noBins = 30) {noBinsThetaA = noBins;};
46

47 48
	TChain* GetExpChain() {return che;};
	TChain* GetSimChain(Int_t i) {return chs[i];};
49 50
	void SetChainsToDraw(Bool_t ch0 = 1, Bool_t ch1 = 1, Bool_t ch2 = 1, Bool_t ch3 = 1, Bool_t ch4 = 1, Bool_t ch5 = 1);

51
	void SetSimCuts(TString sEt[5]/*, TString sET0 = "", TString sET1 = "", TString sET2 = "", TString sET3 = "", TString sET4 = ""*/);
52
	void SetInputCuts(TString iEt[5]/*, TString sET0 = "", TString sET1 = "", TString sET2 = "", TString sET3 = "", TString sET4 = ""*/);
53 54

	void SetCMAngularRange(Int_t minAngle, Int_t maxAngle);
55

56 57
	void SetRangeProportion(Float_t rangeProportion = 1.1, Bool_t autoRange = 1);

58 59
	void SetNoExpEvents(Long64_t *noExpEvents = 0);
	void SetNoSimEvents(Long64_t *noSimEvents = 0);
60 61 62
	void SetRatiosGStoEX(TString sRatioAl0, TString sRatioNoAl0,
			TString sRatioAl180, TString sRatioNoAl180,
			TString sRatioAl90, TString sRatioNoAl90);
63

64 65
	void ExpEventsECuts(Long64_t noExpEvents[5][6] = 0);
	void SimEventsECuts(Long64_t noSimEvents[5][6] = 0);
66
	void EpsilonTRange();
67

68
	void SetSpectra(Bool_t kSpectra = 1) {spectra = kSpectra;};
69 70 71 72 73 74
	void SetEpsilonTintervals(Bool_t intervals[6] = 0);
	void SetCosThetaTkIntervals(Bool_t intervals[6] = 0);
	void SetEpsilonYintervals(Bool_t intervals[6] = 0);
	void SetCosThetaYkIntervals(Bool_t intervals[6] = 0);
	void SetThetaATintervals(Bool_t intervals[6] = 0);

75
	void Spectra();
76
	void EpsilonT();
77 78 79 80 81
	void CosThetaTk();
	void EpsilonY();
	void CosThetaYk();
	void ThetaAT();

82 83
	void SetFigures(TString figPath = "figures/", TString figFormat = ".eps", Bool_t kSave = 1);

84
	void SaveSpectrumHist(Int_t chain, TString outfilename = "figures/spectra.root");
85

86
	void SaveEpsilonTHist(Int_t interval, Int_t chain, TString outfilename = "figures/epsilonT.root");
87
	void SaveCosThetaTHist(Int_t interval, Int_t chain);
88

89 90
	void SaveEpsilonYHist(Int_t interval, Int_t chain);

91
	void SaveThetaAHist(Int_t interval, Int_t chain, TString outfilename = "figures/thetaA.root");
92

93

94
//
95
private:
96 97 98
	TChain *che;		//chain with experimental trees
	TChain *chs[6];		//array of chains with simulation trees
	TTree *ti[6];		//array of chains with simulation input
99
private:
100

101 102 103 104 105 106 107 108
	Int_t lowExpFile;
	Int_t upExpFile;
	TString expFiles;
	TString simFiles[6];
	TString inputFiles[6];
	Int_t lowSimFile[6];
	Int_t upSimFile[6];

109
	Int_t noBinsSpectra;
110 111
	Double_t minSpectraEnergy;
	Double_t maxSpectraEnergy;
112
	Int_t noBinsCorr;
113
	Int_t noBinsThetaA;
114

115 116 117
	Int_t kMinAngle;
	Int_t kMaxAngle;

118
//histograms
119 120 121
	TH1F *hsSpectra[6];	//!
	TH1F *heSpectra[6];	//!
	TH1F *hSdiff[6];	//!
122

123 124 125
	TH1F *hseT[5][6];	//!
	TH1F *heeT[5][6];	//!
	TH1F *hieT[5][6];	//!
126

127 128 129
	TH1F *hscoskT[5][6];	//!
	TH1F *hecoskT[5][6];	//!
	TH1F *hicoskT[5][6];	//!
130

131 132 133
	TH1F *hseY[5][6];	//!
	TH1F *heeY[5][6];	//!
	TH1F *hieY[5][6];	//!
134

135 136 137
	TH1F *hsthetaAT[5][6];	//!
	TH1F *hethetaAT[5][6];	//!
	TH1F *hithetaAT[5][6];	//!
138

139
//cuts
140 141 142 143
	TCut cAngles;
	TCut crAngles;

	Bool_t kChains[6];
144 145
	Int_t noIntervals;
	Bool_t *epsilonT;	//!
146 147
	Bool_t *cosThetaT;	//!
	Bool_t *epsilonY;	//!
148
	Bool_t *cosThetaY;	//!
149

150 151
	Bool_t *thetaAT;	//!

152 153
	Bool_t kAutoRange;
	Float_t kRangeProportion;
154 155
	Bool_t kVerbose;
	Float_t kRangeProportionIn;
156 157 158 159 160 161 162 163 164

	Long64_t eMaxEvents;
	Long64_t eEvents[6];

	Long64_t sMaxEvents;
	Long64_t sEvents[6];

	TCut sRatio[6];

165 166 167
	Long64_t eEventsECuts[5][6];		//!
	Long64_t sEventsECuts[5][6];		//!
	Double_t eTRange[5][6];				//!
168

169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
	//cuts
	TCut cBeWork;
	TCut cBeE[5];

	TCut cEpsilonT;
	TCut cEpsilonY;

	//raw files
	//energy cuts
	TCut crBeWork;
	TCut crBeE[5];
	//angular cuts

	TCut crEpsilonT;
	TCut crEpsilonY;

	//simulation input
	TCut ciBeE[5];

	TCut ciEpsilon;
189
//	TCut ciEpsilonY;
190 191 192 193 194 195 196 197 198 199

	TCut cQ;
	TCut cProtons;

	Bool_t spectra;

	//auxiliary strings
	TString drawCommand;
	TString hsName;
	TString heName;
200
	TString hiName;
201 202

	TString canvasName;
203
	TString canvasTitle;
204

205 206 207 208 209
	Bool_t kSaveFigures;
	TString figurePath;
	TString figureFormat;

private:
210 211 212

	void InitHistos();

213
	void SaveFigures(TCanvas *canvas, TString variable, Int_t interval);
214
	void CanvasDivision(TCanvas *c);
215

216 217 218
	void SetCuts();
	void SetCMAngularCuts();

219 220 221
};

#endif /* BE_BEANALYSIS_H_ */