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 runlumi_looping_cint() {
0024 TFile f("prodmerge.root");
0025 fwlite::Run r(&f);
0026 fwlite::LuminosityBlock l(&f);
0027
0028 int i = 0;
0029 int returnValue = 0;
0030 for (; r.isValid(); ++r, ++i) {
0031 cout << r.run() << endl;
0032 fwlite::Handle<vector<edmtest::Thing> > pThing;
0033 pThing.getByLabel(r, "Thing", "beginRun");
0034
0035 for (int i = 0; i != pThing.ref().size(); ++i) {
0036 cout << pThing.ref().at(i).a << " ";
0037 }
0038 cout << endl;
0039 }
0040 if (i == 0) {
0041 cout << "First run loop failed!" << endl;
0042 returnValue = 1;
0043 }
0044
0045 i = 0;
0046 returnValue = 0;
0047 for (; l.isValid(); ++l, ++i) {
0048 cout << l.id().run() << " " << l.id().luminosityBlock() << endl;
0049 fwlite::Handle<vector<edmtest::Thing> > pThing;
0050 pThing.getByLabel(l, "Thing", "beginLumi");
0051
0052 for (int i = 0; i != pThing.ref().size(); ++i) {
0053 cout << pThing.ref().at(i).a << " ";
0054 }
0055 cout << endl;
0056 }
0057 if (i == 0) {
0058 cout << "First lumi loop failed!" << endl;
0059 returnValue = 1;
0060 }
0061
0062 r.toBegin();
0063 i = 0;
0064 for (; r; ++r, ++i) {
0065 }
0066 if (i == 0) {
0067 cout << "Second run loop failed!" << endl;
0068 returnValue = 1;
0069 }
0070
0071 l.toBegin();
0072 i = 0;
0073 for (; l; ++l, ++i) {
0074 }
0075 if (i == 0) {
0076 cout << "Second lumi loop failed!" << endl;
0077 returnValue = 1;
0078 }
0079
0080 i = 0;
0081 for (r.toBegin(); !r.atEnd(); ++r, ++i) {
0082 cout << r.run() << endl;
0083 fwlite::Handle<vector<edmtest::Thing> > pThing;
0084 pThing.getByLabel(r, "Thing", "endRun");
0085
0086 for (int i = 0; i != pThing.ref().size(); ++i) {
0087 cout << pThing.ref().at(i).a << " ";
0088 }
0089 cout << endl;
0090 }
0091 if (i == 0) {
0092 cout << "Third run loop failed!" << endl;
0093 returnValue = 1;
0094 }
0095
0096 i = 0;
0097 for (l.toBegin(); !l.atEnd(); ++l, ++i) {
0098 cout << l.id().run() << " " << l.id().luminosityBlock() << endl;
0099 fwlite::Handle<vector<edmtest::Thing> > pThing;
0100 pThing.getByLabel(l, "Thing", "endLumi");
0101
0102 for (int i = 0; i != pThing.ref().size(); ++i) {
0103 cout << pThing.ref().at(i).a << " ";
0104 }
0105 cout << endl;
0106 }
0107 if (i == 0) {
0108 cout << "Third lumi loop failed!" << endl;
0109 returnValue = 1;
0110 }
0111
0112 return returnValue;
0113 }