-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountAll.C
More file actions
118 lines (61 loc) · 1.35 KB
/
CountAll.C
File metadata and controls
118 lines (61 loc) · 1.35 KB
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
#ifndef __CINT__
#include "TROOT.h"
#include "TH1.h"
#include "TTree.h"
#include "TH2.h"
#include "TF1.h"
#include "TFile.h"
#include "TMath.h"
#include "TSystem.h"
#include "TVector2.h"
#include "TLorentzVector.h"
#include "TVector3.h"
#include "TRandom.h"
#include <iostream>
#include <fstream>
using namespace std;
using std::cout;
using std::endl;
#endif
void CountAll() {
int num;
int totalsum = 0;
const int Nfolder = 4;
int sum[Nfolder];
char inputfile[512];
int N[Nfolder];
N[0] = 0;
N[1] = 1500;
N[2] = 2500;
N[3] = 2000;
int FN[Nfolder];
FN[0] = 285090;
FN[1] = 285216;
FN[2] = 285244;
FN[3] = 285383;
for(int j=0; j < Nfolder; j++ ){
sum[j] =0;
for(int i=0; i < N[j]; i++){
sprintf(inputfile,"/afs/cern.ch/work/s/szhaozho/data/5TeV/%d/skim_HiForest_%d.root",FN[j],i);
//cout << inputfile << endl;
ifstream ifile(inputfile);
if(ifile){
TFile *fin = TFile::Open(inputfile);
TTree *t = (TTree *)fin->Get("ntHlt");
t->Draw("Event>>h1");
num = h1->GetEntries();
sum[j] = sum[j] + num;
cout << num << endl;
}
if (!ifile) {
i = i + 1;
cout << "File " << i << "does not exist" << endl;
}
cout << sum[j] << endl;
//cout << "index = " << i << endl;
}
cout << "folder " << j << " Totalevents = " << sum[j] << endl;
}
totalsum = totalsum + sum[j];
cout << "Run 2016 p - Pb Total Events = " << totalsum << endl;
}