19 namespace myAnalysis {
21 void init(
const string& inputFile);
23 void finalize(
const string &outputFile=
"test.root");
74 cout <<
"Start Init" << endl;
75 input = TFile::Open(inputFile.c_str());
78 data->SetBranchAddress(
"clusterPhi",&
clusterPhi);
79 data->SetBranchAddress(
"clusterEta",&
clusterEta);
80 data->SetBranchAddress(
"clusterE",&
clusterE);
81 data->SetBranchAddress(
"clustrPt",&
clusterPt);
96 hclusterChisq_2 =
new TH1F(
"hclusterChisq_2",
"Cluster #chi^{2}; #chi^{2}; Counts", 100, 0, 100);
97 hclusterChisq_3 =
new TH1F(
"hclusterChisq_3",
"Cluster #chi^{2} (500 #leq ADC < 16000); #chi^{2}; Counts", 100, 0, 100);
101 cout <<
"Finish Init" << endl;
105 cout <<
"Start Analyze" << endl;
108 nevents = (
nevents) ? nevents :
data->GetEntries();
110 Float_t clusterEta_min = 0;
111 Float_t clusterEta_max = 0;
112 Float_t clusterPhi_min = 0;
113 Float_t clusterPhi_max = 0;
114 Float_t clusterE_min = 0;
115 Float_t clusterE_max = 0;
116 Float_t clusterPt_min = 0;
117 Float_t clusterPt_max = 0;
118 Float_t clusterChisq_min = 0;
119 Float_t clusterChisq_max = 0;
120 cout <<
"Starting Event Loop" << endl;
123 if(
i%500 == 0) cout <<
"Progress: " <<
i*100./nevents <<
" %" << endl;
129 for (UInt_t
j = 0;
j < nclusters; ++
j) {
136 clusterEta_min =
min(clusterEta_min, clusterEta_val);
137 clusterEta_max = max(clusterEta_max, clusterEta_val);
138 clusterPhi_min =
min(clusterPhi_min, clusterPhi_val);
139 clusterPhi_max = max(clusterPhi_max, clusterPhi_val);
140 clusterE_min =
min(clusterE_min, clusterE_val);
141 clusterE_max = max(clusterE_max, clusterE_val);
142 clusterPt_min =
min(clusterPt_min, clusterPt_val);
143 clusterPt_max = max(clusterPt_max, clusterPt_val);
144 clusterChisq_min =
min(clusterChisq_min, clusterChisq_val);
145 clusterChisq_max = max(clusterChisq_max, clusterChisq_val);
160 if(clusterChisq_val < 10) {
164 if(clusterE_val >= 500 && clusterE_val < 16000) {
168 if(clusterChisq_val < 10 && clusterE_val >= 500 && clusterE_val < 16000) {
172 if(clusterChisq_val < 10 && clusterE_val >= 8.5e3 && clusterE_val < 9.5e3) {
178 cout <<
"events processed: " << nevents << endl;
179 cout <<
"clusterEta_min: " << clusterEta_min <<
" clusterEta_max: " << clusterEta_max << endl;
180 cout <<
"clusterPhi_min: " << clusterPhi_min <<
" clusterPhi_max: " << clusterPhi_max << endl;
181 cout <<
"clusterE_min: " << clusterE_min <<
" clusterE_max: " << clusterE_max << endl;
182 cout <<
"clusterPt_min: " << clusterPt_min <<
" clusterPt_max: " << clusterPt_max << endl;
183 cout <<
"clusterChisq_min: " << clusterChisq_min <<
" clusterChisq_max: " << clusterChisq_max << endl;
184 cout <<
"Finish Analyze" << endl;
188 TFile
output(outputFile.c_str(),
"recreate");
210 void QA(
const string &inputFile,
211 const string &outputFile=
"test.root",
220 int main(
int argc,
char* argv[]) {
221 if(argc < 2 || argc > 4){
222 cout <<
"usage: ./bin/QA inputFile outputFile events" << endl;
227 string output =
"test.root";
237 events = atoi(argv[3]);
240 QA(input, output, events);
242 cout <<
"done" << endl;