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