Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19250552
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/test/testApi.cc b/test/testApi.cc
--- a/test/testApi.cc
+++ b/test/testApi.cc
@@ -1,34 +1,37 @@
#include "Rivet/AnalysisHandler.hh"
#include "HepMC/GenEvent.h"
#include "HepMC/IO_GenEvent.h"
using namespace std;
int main() {
string fname = "out";
Rivet::AnalysisHandler rivet(fname, "", Rivet::AIDAML);
// specify the analyses to be used
rivet.addAnalysis("D0_2008_S7554427");
vector<string> moreanalyses(1, "D0_2007_S7075677");
rivet.addAnalyses(moreanalyses);
rivet.init(); // obsolete, but allowed for compatibility
std::istream* file = new std::fstream("testApi.hepmc", std::ios::in);
HepMC::IO_GenEvent hepmcio(*file);
- HepMC::GenEvent evt;
+ HepMC::GenEvent* evt = hepmcio.read_next_event();
double sum_of_weights = 0.0;
- while (hepmcio.fill_next_event(&evt)) {
- rivet.analyze(evt);
- sum_of_weights+=evt.weights()[0];
+ while (evt) {
+ rivet.analyze(*evt);
+ sum_of_weights+=evt->weights()[0];
+ // clean up and get next event
+ delete evt;
+ hepmcio >> evt;
}
delete file;
rivet.setCrossSection(1.0);
rivet.setSumOfWeights(sum_of_weights); // not necessary, but allowed
rivet.finalize();
rivet.commitData();
return 0;
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Sep 30, 5:42 AM (1 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6566263
Default Alt Text
(1 KB)
Attached To
Mode
rRIVETHG rivethg
Attached
Detach File
Event Timeline
Log In to Comment