Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:12

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_cint()
0020 {
0021   std::vector<std::string> files;
0022   files.push_back(std::string("prodmerge.root"));
0023   fwlite::ChainEvent ev(files);
0024 
0025   fwlite::Handle<edm::TriggerResults> hTriggerResults;
0026 
0027 
0028   bool expectedValue[4] = { true, false, true, true };
0029   int iEvent = 0;
0030   for (ev.toBegin(); ! ev.atEnd(); ++ev) {
0031 
0032     bool accept = false;
0033 
0034     hTriggerResults.getByLabel(ev, "TriggerResults", "", "TEST");
0035 
0036     if (hTriggerResults.isValid()) {
0037       edm::TriggerResultsByName resultsByName = ev.triggerResultsByName(*hTriggerResults);
0038       std::cout << "From TriggerResultsByName, accept = "
0039                 << resultsByName.accept("p") << "\n";
0040       accept = resultsByName.accept("p");
0041     } else {
0042       std::cerr << "triggerResultsByName_cint.C, invalid TriggerResults handle" << std::endl;
0043       abort();
0044     }
0045     if (iEvent < 4 && expectedValue[iEvent] != accept) {
0046       std::cerr << "triggerResultsByName_cint.C, trigger results do not match expected values" << std::endl;
0047       abort();
0048     }
0049     ++iEvent;
0050   }
0051 }