Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:27

0001 #if defined(__CINT__) && !defined(__MAKECINT__)
0002 class loadFWLite {
0003   public:
0004     loadFWLite() {
0005       gSystem->Load("libFWCoreFWLite");
0006       FWLiteEnabler::enable();
0007     }
0008 };
0009 
0010 static loadFWLite lfw;
0011 #endif
0012 
0013 #include "DataFormats/FWLite/interface/Handle.h"
0014 
0015 #include <string>
0016 #include <vector>
0017 #include <iostream>
0018 
0019 void triggerResultsByName_multi_cint()
0020 {
0021   std::vector<std::string> files1;
0022   files1.push_back(std::string("prodmerge.root"));
0023 
0024   std::vector<std::string> files2;
0025   files2.push_back(std::string("prod1.root"));
0026   files2.push_back(std::string("prod2.root"));
0027 
0028   fwlite::MultiChainEvent ev(files1, files2);
0029   fwlite::Handle<edm::TriggerResults> hTriggerResults;
0030   
0031   bool expectedValue[4] = { true, false, true, true };
0032   int iEvent = 0;
0033   for (ev.toBegin(); ! ev.atEnd(); ++ev) {
0034     bool accept = false;
0035 
0036     hTriggerResults.getByLabel(ev, "TriggerResults", "", "TEST");
0037 
0038     if (hTriggerResults.isValid()) {
0039 
0040       edm::TriggerResultsByName resultsByName = ev.triggerResultsByName(*hTriggerResults);
0041       std::cout << "From TriggerResultsByName, accept = "
0042                 << resultsByName.accept("p") << "\n";
0043       accept = resultsByName.accept("p");
0044     } else {
0045       std::cerr << "triggerResultsByName_multi_cint.C, invalid TriggerResults handle" << std::endl;
0046       abort();
0047     }
0048     if (iEvent < 4 && expectedValue[iEvent] != accept) {
0049       std::cerr << "triggerResultsByName_cint.C, trigger results do not match expected values" << std::endl;
0050       abort();
0051     }
0052     ++iEvent;
0053   }
0054 }