diff --git a/DataFormats/FWLite/test/chainevent_looping_cint.C b/DataFormats/FWLite/test/chainevent_looping_cint.C index 68c1a1db4cf..bf8c8896585 100644 --- a/DataFormats/FWLite/test/chainevent_looping_cint.C +++ b/DataFormats/FWLite/test/chainevent_looping_cint.C @@ -4,11 +4,11 @@ using namespace std; #if defined(__CINT__) && !defined(__MAKECINT__) class loadFWLite { - public: - loadFWLite() { - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -20,93 +20,93 @@ static loadFWLite lfw; #include "DataFormats/TestObjects/interface/ThingCollection.h" #endif -int chainevent_looping_cint() -{ -vector files; -files.push_back("empty_a.root"); -files.push_back("good_a.root"); -files.push_back("empty_a.root"); -files.push_back("good_b.root"); -files.push_back("empty_a.root"); -fwlite::ChainEvent e(files); +int chainevent_looping_cint() { + vector files; + files.push_back("empty_a.root"); + files.push_back("good_a.root"); + files.push_back("empty_a.root"); + files.push_back("good_b.root"); + files.push_back("empty_a.root"); + fwlite::ChainEvent e(files); + + int i = 0; + int returnValue = 0; + TFile* f = 0; -int i =0; -int returnValue = 0; -TFile* f = 0; + for (; e.isValid(); ++e, ++i) { + if (e.getTFile() != f) { + f = e.getTFile(); + cout << "New file " << f->GetName() << endl; + } -for( ;e.isValid();++e,++i) { - if (e.getTFile() != f) { - f = e.getTFile(); - cout << "New file " << f->GetName() << endl; + fwlite::Handle > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); + + for (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(); - fwlite::Handle > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); -i=0; -for(e.toBegin(); !e.atEnd();++e,++i) { - fwlite::Handle > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(i=0; i!=pThing.ref().size();++i) { - cout <::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { - // cout <<(*it).a<::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { + // cout <<(*it).a<Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -20,57 +20,56 @@ static loadFWLite lfw; #include "DataFormats/TestObjects/interface/ThingCollection.h" #endif -int event_looping_cint() -{ -TFile f("good_a.root"); -fwlite::Event e(&f); +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 > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); -int i =0; -int returnValue = 0; -for( ;e.isValid();++e,++i) { - fwlite::Handle > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; - //pThing.getByLabel(e,"Thing","","TEST"); //WORKS - pThing.getByLabel(e,"Thing"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + //pThing.getByLabel(e,"Thing","","TEST"); //WORKS + pThing.getByLabel(e, "Thing"); - //DOES NOT WORK - //for(vector::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { - // cout <<(*it).a<::const_iterator it = pThing.data()->begin(); it != pThing.data()->end();++it) { + // cout <<(*it).a<Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -20,96 +20,94 @@ static loadFWLite lfw; #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 > pThing; - pThing.getByLabel(r,"Thing","beginRun"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(r, "Thing", "beginRun"); - i =0; - returnValue = 0; - for( ;l.isValid();++l,++i) { - cout << l.id().run() << " " << l.id().luminosityBlock() << endl; - fwlite::Handle > pThing; - pThing.getByLabel(l,"Thing","beginLumi"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(l, "Thing", "beginLumi"); - r.toBegin(); - i=0; - for( ;r;++r,++i) { - } - if (i==0) { - cout <<"Second run loop failed!"< > pThing; - pThing.getByLabel(r,"Thing","endRun"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > pThing; + pThing.getByLabel(r, "Thing", "endRun"); - i=0; - for(l.toBegin(); !l.atEnd();++l,++i) { - cout << l.id().run() << " " << l.id().luminosityBlock() << endl; - fwlite::Handle > pThing; - pThing.getByLabel(l,"Thing","endLumi"); - - for(int i=0; i!=pThing.ref().size();++i) { - cout < > 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; + return returnValue; } diff --git a/DataFormats/FWLite/test/triggernames_cint.C b/DataFormats/FWLite/test/triggernames_cint.C index 89e3c66f96b..ce09fe38c52 100644 --- a/DataFormats/FWLite/test/triggernames_cint.C +++ b/DataFormats/FWLite/test/triggernames_cint.C @@ -1,10 +1,10 @@ #if defined(__CINT__) && !defined(__MAKECINT__) class loadFWLite { - public: - loadFWLite() { - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -16,8 +16,7 @@ static loadFWLite lfw; #include #include -int triggernames_cint() -{ +int triggernames_cint() { // TFile f1("prodmerge.root"); // fwlite::Event ev(&f1); @@ -26,12 +25,12 @@ int triggernames_cint() fwlite::ChainEvent ev(files); fwlite::Handle hTriggerResults; - + int iEvent = 0; - for (ev.toBegin(); ! ev.atEnd(); ++ev) { + for (ev.toBegin(); !ev.atEnd(); ++ev) { ++iEvent; - hTriggerResults.getByLabel(ev,"TriggerResults","","TEST"); - edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); + hTriggerResults.getByLabel(ev, "TriggerResults", "", "TEST"); + edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); std::vector const& names = triggerNames.triggerNames(); for (unsigned i = 0; i < triggerNames.size(); ++i) { @@ -43,18 +42,12 @@ int triggernames_cint() std::cout << "index for p2 = " << triggerNames.triggerIndex("p2") << std::endl; if (iEvent == 1) { - if (triggerNames.size() != 3U || - names[0] != "p" || - names[1] != "p1" || - names[2] != "p2" || - triggerNames.triggerName(0) != "p" || - triggerNames.triggerName(1) != "p1" || - triggerNames.triggerName(2) != "p2" || - triggerNames.triggerIndex("p") != 0 || - triggerNames.triggerIndex("p1") != 1 || - triggerNames.triggerIndex("p2") != 2) { - std::cout << "Trigger names do match expected values\n"; - std::cout << "In script triggernames_cint.C\n"; + if (triggerNames.size() != 3U || names[0] != "p" || names[1] != "p1" || names[2] != "p2" || + triggerNames.triggerName(0) != "p" || triggerNames.triggerName(1) != "p1" || + triggerNames.triggerName(2) != "p2" || triggerNames.triggerIndex("p") != 0 || + triggerNames.triggerIndex("p1") != 1 || triggerNames.triggerIndex("p2") != 2) { + std::cout << "Trigger names do match expected values\n"; + std::cout << "In script triggernames_cint.C\n"; return 1; } } diff --git a/DataFormats/FWLite/test/triggernames_multi_cint.C b/DataFormats/FWLite/test/triggernames_multi_cint.C index 80d9a165306..696af4f01a8 100644 --- a/DataFormats/FWLite/test/triggernames_multi_cint.C +++ b/DataFormats/FWLite/test/triggernames_multi_cint.C @@ -1,10 +1,10 @@ #if defined(__CINT__) && !defined(__MAKECINT__) class loadFWLite { - public: - loadFWLite() { - gSystem->Load("libFWCoreFWLite"); - FWLiteEnabler::enable(); - } +public: + loadFWLite() { + gSystem->Load("libFWCoreFWLite"); + FWLiteEnabler::enable(); + } }; static loadFWLite lfw; @@ -16,8 +16,7 @@ static loadFWLite lfw; #include #include -int triggernames_multi_cint() -{ +int triggernames_multi_cint() { std::vector files1; files1.push_back(std::string("prodmerge.root")); @@ -27,12 +26,12 @@ int triggernames_multi_cint() fwlite::MultiChainEvent ev(files1, files2); fwlite::Handle hTriggerResults; - + int iEvent = 0; - for (ev.toBegin(); ! ev.atEnd(); ++ev) { + for (ev.toBegin(); !ev.atEnd(); ++ev) { ++iEvent; - hTriggerResults.getByLabel(ev,"TriggerResults","","TEST"); - edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); + hTriggerResults.getByLabel(ev, "TriggerResults", "", "TEST"); + edm::TriggerNames const& triggerNames = ev.triggerNames(*hTriggerResults); std::vector const& names = triggerNames.triggerNames(); for (unsigned i = 0; i < triggerNames.size(); ++i) { @@ -44,18 +43,12 @@ int triggernames_multi_cint() std::cout << "index for p2 = " << triggerNames.triggerIndex("p2") << std::endl; if (iEvent == 1) { - if (triggerNames.size() != 3U || - names[0] != "p" || - names[1] != "p1" || - names[2] != "p2" || - triggerNames.triggerName(0) != "p" || - triggerNames.triggerName(1) != "p1" || - triggerNames.triggerName(2) != "p2" || - triggerNames.triggerIndex("p") != 0 || - triggerNames.triggerIndex("p1") != 1 || - triggerNames.triggerIndex("p2") != 2) { - std::cout << "Trigger names do match expected values\n"; - std::cout << "In script triggernames_multi_cint.C\n"; + if (triggerNames.size() != 3U || names[0] != "p" || names[1] != "p1" || names[2] != "p2" || + triggerNames.triggerName(0) != "p" || triggerNames.triggerName(1) != "p1" || + triggerNames.triggerName(2) != "p2" || triggerNames.triggerIndex("p") != 0 || + triggerNames.triggerIndex("p1") != 1 || triggerNames.triggerIndex("p2") != 2) { + std::cout << "Trigger names do match expected values\n"; + std::cout << "In script triggernames_multi_cint.C\n"; return 1; } }