/usr/share/doc/pythia8-root-interface/examples/tree.cc is in pythia8-root-interface 8.1.86-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | // File: tree.cc
// This is a simple test program.
// Modified by Rene Brun and Axcel Naumann to put the Pythia::event
// into a TTree.
// Copyright (C) 2014 Torbjorn Sjostrand
// Header file to access Pythia 8 program elements.
#include "Pythia8/Pythia.h"
// ROOT, for saving Pythia events as trees in a file.
#include "TTree.h"
#include "TFile.h"
using namespace Pythia8;
int main() {
// Create Pythia instance and set it up to generate hard QCD processes
// above pTHat = 20 GeV for pp collisions at 14 TeV.
Pythia pythia;
pythia.readString("HardQCD:all = on");
pythia.readString("PhaseSpace:pTHatMin = 20.");
pythia.readString("Beams:eCM = 14000.");
pythia.init();
// Set up the ROOT TFile and TTree.
TFile *file = TFile::Open("pytree.root","recreate");
Event *event = &pythia.event;
TTree *T = new TTree("T","ev1 Tree");
T->Branch("event",&event);
// Begin event loop. Generate event; skip if generation aborted.
for (int iEvent = 0; iEvent < 100; ++iEvent) {
if (!pythia.next()) continue;
// Fill the pythia event into the TTree.
// Warning: the files will rapidly become large if all events
// are saved. In some cases it may be convenient to do some
// processing of events and only save those that appear
// interesting for future analyses.
T->Fill();
// End event loop.
}
// Statistics on event generation.
pythia.stat();
// Write tree.
T->Print();
T->Write();
delete file;
// Done.
return 0;
}
|