File indexing completed on 2025-02-21 05:46:28
0001 #include <vector>
0002 #include <TFile.h>
0003 using namespace std;
0004
0005 #if defined(__CINT__) && !defined(__MAKECINT__)
0006 class loadFWLite {
0007 public:
0008 loadFWLite() {
0009 gSystem->Load("libFWCoreFWLite");
0010 FWLiteEnabler::enable();
0011 }
0012 };
0013
0014 static loadFWLite lfw;
0015 #endif
0016
0017 #include "DataFormats/FWLite/interface/Handle.h"
0018
0019 #if !defined(__CINT__) && !defined(__MAKECINT__)
0020 #include "DataFormats/TestObjects/interface/ThingCollection.h"
0021 #endif
0022
0023 int event_looping_cint() {
0024 TFile f("good_a.root");
0025 fwlite::Event e(&f);
0026
0027 int i = 0;
0028 int returnValue = 0;
0029 for (; e.isValid(); ++e, ++i) {
0030 fwlite::Handle<vector<edmtest::Thing> > pThing;
0031
0032 pThing.getByLabel(e, "Thing");
0033
0034 for (int i = 0; i != pThing.ref().size(); ++i) {
0035 cout << pThing.ref().at(i).a << " ";
0036 }
0037 cout << endl;
0038 }
0039 if (i == 0) {
0040 cout << "First loop failed!" << endl;
0041 returnValue = 1;
0042 }
0043 e.toBegin();
0044
0045 i = 0;
0046 for (; e; ++e, ++i) {
0047 }
0048
0049 if (i == 0) {
0050 cout << "Second loop failed!" << endl;
0051 returnValue = 1;
0052 }
0053
0054 i = 0;
0055 for (e.toBegin(); !e.atEnd(); ++e, ++i) {
0056 fwlite::Handle<vector<edmtest::Thing> > pThing;
0057
0058 pThing.getByLabel(e, "Thing");
0059
0060 for (int i = 0; i != pThing.ref().size(); ++i) {
0061 cout << pThing.ref().at(i).a << " ";
0062 }
0063 cout << endl;
0064
0065
0066
0067
0068
0069 }
0070 if (i == 0) {
0071 cout << "Third loop failed!" << endl;
0072 returnValue = 1;
0073 }
0074 return returnValue;
0075 }