Skip to content
Snippets Groups Projects
Commit 04ef2518 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

modified: .gitlab-ci.yml

	new file:   calorimeters/zdc_neutrons_reader.cxx
parent c716e252
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,8 @@ get_data:
- sodium
script:
- git clone https://eicweb.phy.anl.gov/EIC/datasets.git datasets
- ln -s datasets/data
- mkdir -p results
# artifacts:
# paths:
# - datasets
......
#include "HepMC3/GenEvent.h"
#include "HepMC3/ReaderAscii.h"
#include "HepMC3/WriterAscii.h"
#include "HepMC3/Print.h"
#include "TH1F.h"
#include <iostream>
using namespace HepMC3;
void zdc_neutrons_reader(){
//-------------------------------------
ReaderAscii hepmc_input("data/neutrons_zdc.hepmc");
int events_parsed = 0;
GenEvent evt(Units::GEV, Units::MM);
TH1F* h_neutron_energy = new TH1F("n energy","; E [GeV]",100,0,200);
while(!hepmc_input.failed()) {
// Read event from input file
hepmc_input.read_event(evt);
// If reading failed - exit loop
if( hepmc_input.failed() ) break;
for(const auto& v : evt.vertices() ) {
for(const auto& p : v->particles_out() ) {
if(p->pid() == 2112) {
h_neutron_energy->Fill(p->momentum().e());
}
}
}
evt.clear();
events_parsed++;
}
std::cout << "Events parsed and written: " << events_parsed << std::endl;
TCanvas* c = new TCanvas();
h_neutron_energy->Draw();
c->SaveAs("results/zdc_neutrons_reader.png");
c->SaveAs("results/zdc_neutrons_reader.pdf");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment