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
|
#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 event_looping_cint() {
TFile f("good_a.root");
fwlite::Event e(&f);
int i = 0;
int returnValue = 0;
for (; e.isValid(); ++e, ++i) {
fwlite::Handle<vector<edmtest::Thing> > pThing;
//pThing.getByLabel(e,"Thing","","TEST"); //WORKS
pThing.getByLabel(e, "Thing");
for (int i = 0; i != pThing.ref().size(); ++i) {
cout << pThing.ref().at(i).a << " ";
}
cout << endl;
}
if (i == 0) {
cout << "First loop failed!" << endl;
returnValue = 1;
}
e.toBegin();
i = 0;
for (; e; ++e, ++i) {
}
if (i == 0) {
cout << "Second loop failed!" << endl;
returnValue = 1;
}
i = 0;
for (e.toBegin(); !e.atEnd(); ++e, ++i) {
fwlite::Handle<vector<edmtest::Thing> > pThing;
//pThing.getByLabel(e,"Thing","","TEST"); //WORKS
pThing.getByLabel(e, "Thing");
for (int i = 0; i != pThing.ref().size(); ++i) {
cout << pThing.ref().at(i).a << " ";
}
cout << endl;
//DOES NOT WORK
//for(vector<edmtest::Thing>::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) {
// cout <<(*it).a<<endl;
//}
}
if (i == 0) {
cout << "Third loop failed!" << endl;
returnValue = 1;
}
return returnValue;
}
|