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
|
#include <vector>
#include <TFile.h>
using namespace std;
#if defined(__CINT__) && !defined(__MAKECINT__)
class loadFWLite {
public:
loadFWLite() {
gSystem->Load("libFWCoreFWLite");
FWLiteEnabler::enable();
}
};
static loadFWLite lfw;
#endif
#include "DataFormats/FWLite/interface/Handle.h"
#if !defined(__CINT__) && !defined(__MAKECINT__)
#include "DataFormats/TestObjects/interface/ThingCollection.h"
#endif
int runlumi_looping_cint() {
TFile f("prodmerge.root");
fwlite::Run r(&f);
fwlite::LuminosityBlock l(&f);
int i = 0;
int returnValue = 0;
for (; r.isValid(); ++r, ++i) {
cout << r.run() << endl;
fwlite::Handle<vector<edmtest::Thing> > pThing;
pThing.getByLabel(r, "Thing", "beginRun");
for (int i = 0; i != pThing.ref().size(); ++i) {
cout << pThing.ref().at(i).a << " ";
}
cout << endl;
}
if (i == 0) {
cout << "First run loop failed!" << endl;
returnValue = 1;
}
i = 0;
returnValue = 0;
for (; l.isValid(); ++l, ++i) {
cout << l.id().run() << " " << l.id().luminosityBlock() << endl;
fwlite::Handle<vector<edmtest::Thing> > pThing;
pThing.getByLabel(l, "Thing", "beginLumi");
for (int i = 0; i != pThing.ref().size(); ++i) {
cout << pThing.ref().at(i).a << " ";
}
cout << endl;
}
if (i == 0) {
cout << "First lumi loop failed!" << endl;
returnValue = 1;
}
r.toBegin();
i = 0;
for (; r; ++r, ++i) {
}
if (i == 0) {
cout << "Second run loop failed!" << endl;
returnValue = 1;
}
l.toBegin();
i = 0;
for (; l; ++l, ++i) {
}
if (i == 0) {
cout << "Second lumi loop failed!" << endl;
returnValue = 1;
}
i = 0;
for (r.toBegin(); !r.atEnd(); ++r, ++i) {
cout << r.run() << endl;
fwlite::Handle<vector<edmtest::Thing> > pThing;
pThing.getByLabel(r, "Thing", "endRun");
for (int i = 0; i != pThing.ref().size(); ++i) {
cout << pThing.ref().at(i).a << " ";
}
cout << endl;
}
if (i == 0) {
cout << "Third run loop failed!" << endl;
returnValue = 1;
}
i = 0;
for (l.toBegin(); !l.atEnd(); ++l, ++i) {
cout << l.id().run() << " " << l.id().luminosityBlock() << endl;
fwlite::Handle<vector<edmtest::Thing> > pThing;
pThing.getByLabel(l, "Thing", "endLumi");
for (int i = 0; i != pThing.ref().size(); ++i) {
cout << pThing.ref().at(i).a << " ";
}
cout << endl;
}
if (i == 0) {
cout << "Third lumi loop failed!" << endl;
returnValue = 1;
}
return returnValue;
}
|