-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
4,688 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import ROOT, sys | ||
|
||
inf = ROOT.TFile(sys.argv[1]) | ||
tree = inf.Get("events") | ||
|
||
tree.Print("ALL") | ||
|
||
pdgIdMap = { | ||
1: "d", | ||
2: "u", | ||
3: "s", | ||
4: "c", | ||
5: "b", | ||
6: "t", | ||
25: "h", | ||
24: "W", | ||
23: "Z", | ||
22: "gamma", | ||
21: "g", | ||
11: "e", | ||
12: "nue", | ||
13: "mu", | ||
14: "numu", | ||
15: "tau", | ||
16: "nutau", | ||
} | ||
|
||
def getParticleKind(id): | ||
aid = abs(id) | ||
r = pdgIdMap[aid] | ||
|
||
if r in ["W" ,"e", "mu", "tau"]: | ||
r = r + ("-" if id<0 else "+") | ||
if id < 0: | ||
if r in ["u", "d", "c", "s", "t", "b"]: | ||
r = "~" + r | ||
return r | ||
|
||
class Particle: | ||
def __init__(self, px, py, pz, e, status, id): | ||
self.px = px | ||
self.py = py | ||
self.pz = pz | ||
self.e = e | ||
self.status = status | ||
self.id = id | ||
self.mothers = [] | ||
|
||
def __str__(self): | ||
return "p[{6}] ({0:.2f}, {1:.2f}, {2:.2f}, {3:.2f}) {4} {5}".format( | ||
self.px, self.py, self.pz, self.e, self.status, | ||
[getParticleKind(m.id) for m in self.mothers ], | ||
getParticleKind(self.id) | ||
) | ||
|
||
nb = 0 | ||
nproc = 0 | ||
for iev in range(tree.GetEntries()): | ||
nb += tree.GetEntry(iev) | ||
nparticles = tree.n_particles | ||
|
||
particles = [] | ||
particles_s1 = [] | ||
particles_s2 = [] | ||
|
||
for ipt in range(nparticles): | ||
pid = tree.PID[ipt] | ||
px = tree.P_X[ipt] | ||
py = tree.P_Y[ipt] | ||
pz = tree.P_Z[ipt] | ||
e = tree.E[ipt] | ||
mid1 = tree.MID1[ipt] | ||
mid2 = tree.MID2[ipt] | ||
status = tree.STATUS[ipt] | ||
|
||
part = Particle(px, py, pz, e, status, pid) | ||
particles += [part] | ||
part.mothers = [mid1] | ||
if mid2!=mid1: | ||
part.mothers += [mid2] | ||
|
||
for part in particles: | ||
mids = part.mothers | ||
#Assign mothers | ||
#if mid = 0 -> no mother in LHE file | ||
#lhe indexing 1-based | ||
part.mothers = [particles[mid-1] for mid in mids if mid-1>=0] | ||
|
||
if part.status == 1: | ||
particles_s1 += [part] | ||
elif part.status == 2: | ||
particles_s2 += [part] | ||
|
||
print "---" | ||
for p in particles: | ||
print str(p) | ||
nproc += 1 | ||
|
||
print "processed {0} entries, read {1:.2f} Mb".format(nproc, nb/1024.0/1024.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
|
||
|
||
|
||
# | ||
# Examples Makefile. | ||
# | ||
# M. Kirsanov 07.04.2006 | ||
# Modified 18.11.2006 | ||
# 26.03.2008 CLHEP dependency removed | ||
|
||
SHELL = /bin/sh | ||
|
||
|
||
-include config.mk | ||
ifeq (x$(PYTHIA8LOCATION),x) | ||
PYTHIA8LOCATION=/home/mello/physics_programs/pythia_installation | ||
endif | ||
-include $(PYTHIA8LOCATION)/config.mk | ||
|
||
FASTJETLOCATION=/usr/local | ||
ROOTSYSHERE=/home/mello/physics_programs/root | ||
LHAPDFLOCATION=/usr/local/share | ||
# Location of directories. | ||
TOPDIR=$(shell \pwd) | ||
INCDIR=include | ||
SRCDIR=src | ||
LIBDIR=lib | ||
LIBDIRARCH=lib/archive | ||
BINDIR=bin | ||
|
||
# Libraries to include if GZIP support is enabled | ||
ifeq (x$(ENABLEGZIP),xyes) | ||
LIBGZIP=-L$(BOOSTLIBLOCATION) -lboost_iostreams -L$(ZLIBLOCATION) -lz | ||
endif | ||
|
||
# There is no default behaviour, so remind user. | ||
all: | ||
@echo "Usage: for NN = example number: make mainNN" | ||
|
||
# Create an executable for one of the normal test programs | ||
main00 main01 main02 main03 main04 main05 main06 main07 main08 main09 main10 \ | ||
main11 main12 main13 main14 main15 main16 main17 main18 main19 main20 \ | ||
main21 main22 main23 main24 main25 main26 main27 main28 main29 main30 \ | ||
main31 main32 main33 main34 main35 main36 main37 main38 main39 main40: \ | ||
$(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a | ||
@mkdir -p $(BINDIR) | ||
$(CXX) $(CXXFLAGS) `root-config --cflags` -I$(PYTHIA8LOCATION)/$(INCDIR) [email protected] -o $(BINDIR)/[email protected] \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) `root-config --libs` | ||
@ln -fs $(BINDIR)/[email protected] [email protected] | ||
|
||
# Create an executable linked to HepMC (if all goes well). | ||
# Owing to excessive warning output -Wshadow is not used for HepMC. | ||
ifneq (x$(HEPMCLOCATION),x) | ||
main41 main42: \ | ||
$(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8tohepmc.a | ||
@mkdir -p $(BINDIR) | ||
$(CXX) $(CXXFLAGS) -Wno-shadow -I$(PYTHIA8LOCATION)/$(INCDIR) -I$(HEPMCLOCATION)/include \ | ||
$@.cc -o $(BINDIR)/$@.exe \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) \ | ||
-lpythia8tohepmc \ | ||
-L$(HEPMCLOCATION)/lib -lHepMC | ||
@ln -fs $(BINDIR)/$@.exe $@.exe | ||
else | ||
main41 main42: | ||
@echo ERROR, this target needs HepMC, variable HEPMCLOCATION | ||
endif | ||
|
||
# Create an executable that links to LHAPDF | ||
main51 main52 main53: $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a | ||
@mkdir -p $(BINDIR) | ||
$(CXX) $(CXXFLAGS) -I$(PYTHIA8LOCATION)/$(INCDIR) $@.cc -o $(BINDIR)/$@.exe \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 $(LIBGZIP) \ | ||
-L$(LHAPDFLOCATION) $(LHAPDFLIBNAME) \ | ||
$(FLIBS) | ||
@ln -fs $(BINDIR)/$@.exe $@.exe | ||
|
||
# Create an executable that links to LHAPDF and HepMC | ||
main61 main62 main85 main86 main87 main88: \ | ||
$(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8tohepmc.a | ||
@mkdir -p $(BINDIR) | ||
$(CXX) $(CXXFLAGS) -Wno-shadow -I$(PYTHIA8LOCATION)/$(INCDIR) -I$(HEPMCLOCATION)/include \ | ||
$@.cc -o $(BINDIR)/$@.exe \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -lpythia8tohepmc $(LIBGZIP) \ | ||
-L$(LHAPDFLOCATION) $(LHAPDFLIBNAME) \ | ||
-L$(HEPMCLOCATION)/lib -lHepMC \ | ||
$(FLIBS) | ||
@ln -fs $(BINDIR)/$@.exe $@.exe | ||
|
||
# Create an executable that links to Fastjet | ||
# Owing to excessive warning output -Wshadow is not used for Fastjet. | ||
# (Fixed as of Fastjet 3.0.1, so will be modified eventually.) | ||
ifneq (x$(FASTJETLOCATION),x) | ||
main71 main72: $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a | ||
@mkdir -p $(BINDIR) | ||
# Note: $(CXXFLAGS) is after Fastjet flags as Fastjet includes | ||
# optimisation/debug flags which may be unwanted (e.g. -g -O2) | ||
$(CXX) -I$(PYTHIA8LOCATION)/$(INCDIR) [email protected] \ | ||
`$(FASTJETLOCATION)/bin/fastjet-config --cxxflags --plugins` \ | ||
$(CXXFLAGS) -Wno-shadow \ | ||
-o $(BINDIR)/[email protected] \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) \ | ||
-L$(FASTJETLOCATION)/lib \ | ||
`$(FASTJETLOCATION)/bin/fastjet-config --libs --plugins` | ||
@ln -fs $(BINDIR)/[email protected] [email protected] | ||
@rm -f [email protected] | ||
else | ||
main71 main72: | ||
@echo ERROR, this target needs Fastjet, variable FASTJETLOCATION | ||
endif | ||
|
||
INCLUDE_LIB= -L$(FASTJETLOCATION)/plugins/SISCone \ | ||
-L$(FASTJETLOCATION)/plugins/ | ||
# Create an executable that links to Fastjet | ||
# Owing to excessive warning output -Wshadow is not used for Fastjet. | ||
# (Fixed as of Fastjet 3.0.1, so will be modified eventually.) | ||
ifneq (x$(FASTJETLOCATION),x) | ||
marcel: $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a | ||
@mkdir -p $(BINDIR) | ||
# Note: $(CXXFLAGS) is after Fastjet flags as Fastjet includes | ||
# optimisation/debug flags which may be unwanted (e.g. -g -O2) | ||
$(CXX) -I$(PYTHIA8LOCATION)/include [email protected] \ | ||
`$(FASTJETLOCATION)/bin/fastjet-config --cxxflags --plugins` \ | ||
$(CXXFLAGS) -Wno-shadow \ | ||
-I$(FASTJETLOCATION)/include \ | ||
-I `$(ROOTSYSHERE)/bin/root-config --cflags` \ | ||
-o $(BINDIR)/[email protected] \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) \ | ||
-L$(FASTJETLOCATION)/lib \ | ||
`$(FASTJETLOCATION)/bin/fastjet-config --libs --plugins` \ | ||
`$(ROOTSYSHERE)/bin/root-config --libs` | ||
# -L$(FASTJETLOCATION)/plugins/ -lfastjetplugins \ | ||
@ln -fs $(BINDIR)/[email protected] [email protected] | ||
@rm -f [email protected] | ||
else | ||
marcel: | ||
@echo ERROR, this target needs Fastjet, variable FASTJETLOCATION | ||
endif | ||
|
||
# Create an executable that links to Fastjet | ||
# Owing to excessive warning output -Wshadow is not used for Fastjet. | ||
# (Fixed as of Fastjet 3.0.1, so will be modified eventually.) | ||
ifneq (x$(FASTJETLOCATION),x) | ||
higgs: $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a | ||
@mkdir -p $(BINDIR) | ||
# Note: $(CXXFLAGS) is after Fastjet flags as Fastjet includes | ||
# optimisation/debug flags which may be unwanted (e.g. -g -O2) | ||
$(CXX) -I$(PYTHIA8LOCATION)/$(INCDIR) [email protected] \ | ||
`$(FASTJETLOCATION)fastjet-config --cxxflags --plugins` \ | ||
$(CXXFLAGS) -Wno-shadow \ | ||
-I `$(ROOTSYS)/bin/root-config --cflags` \ | ||
-o $(BINDIR)/[email protected] \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) \ | ||
-L$(FASTJETLOCATION)/lib \ | ||
`$(FASTJETLOCATION)/fastjet-config --libs --plugins` \ | ||
`$(ROOTSYS)/bin/root-config --libs` | ||
@ln -fs $(BINDIR)/[email protected] [email protected] | ||
@rm -f [email protected] | ||
else | ||
higgs: | ||
@echo ERROR, this target needs Fastjet, variable FASTJETLOCATION | ||
endif | ||
|
||
# Create an executable that links to Fastjet, HepMC and LHApdf | ||
# Owing to excessive warning output -Wshadow is not used for Fastjet. | ||
# (Fixed as of Fastjet 3.0.1, so will be modified eventually.) | ||
ifneq (x$(FASTJETLOCATION),x) | ||
main81 main82 main83 main84: \ | ||
$(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8tohepmc.a | ||
@mkdir -p $(BINDIR) | ||
# Note: $(CXXFLAGS) is after Fastjet flags as Fastjet includes | ||
# optimisation/debug flags which may be unwanted (e.g. -g -O2) | ||
$(CXX) -I$(PYTHIA8LOCATION)/$(INCDIR) [email protected] \ | ||
`$(FASTJETLOCATION)/bin/fastjet-config --cxxflags --plugins` \ | ||
$(CXXFLAGS) -Wno-shadow \ | ||
-I$(PYTHIA8LOCATION)/$(INCDIR) -I$(HEPMCLOCATION)/include \ | ||
-o $(BINDIR)/[email protected] \ | ||
-L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 \ | ||
-L$(LHAPDFLOCATION) $(LHAPDFLIBNAME) \ | ||
-lpythia8tohepmc \ | ||
-L$(HEPMCLOCATION)/lib -lHepMC \ | ||
-L$(FASTJETLOCATION)/lib \ | ||
-L$(LHAPDFLOCATION)/lib \ | ||
`$(FASTJETLOCATION)/bin/fastjet-config --libs --plugins` | ||
@ln -fs $(BINDIR)/[email protected] [email protected] | ||
@rm -f [email protected] | ||
else | ||
main81 main82 main83 main84: | ||
@echo ERROR, this target needs Fastjet, variable FASTJETLOCATION | ||
endif | ||
|
||
# Clean up: remove executables and outdated files. | ||
.PHONY: clean | ||
clean: | ||
rm -rf $(BINDIR) | ||
rm -rf *.exe | ||
rm -f *~; rm -f \#*; rm -f core* |
Oops, something went wrong.