diff --git a/Tau23Mu_pythia/Gen_BKG/Makefile b/Tau23Mu_pythia/Gen_BKG/Makefile index a36adf1..77cbd23 100644 --- a/Tau23Mu_pythia/Gen_BKG/Makefile +++ b/Tau23Mu_pythia/Gen_BKG/Makefile @@ -1,138 +1,79 @@ -# -# Examples Makefile. -# -# M. Kirsanov 07.04.2006 -# Modified 18.11.2006 -# 26.03.2008 CLHEP dependency removed +#---------------------------------------------------------------------- +# Przyklad linkowania bibliotek systemu ROOT z wlasnym programem +#---------------------------------------------------------------------- +.SUFFIXES: .o .c .cxx .cpp .C .f .l .s .sh .h .a .cc +#====================================================================== +# Biblioteki ROOTa dla linkera -SHELL = /bin/sh - --include config.mk -ifeq (x$(PYTHIA8LOCATION),x) - PYTHIA8LOCATION=/storage/Sim/pythia8186OB -endif --include $(PYTHIA8LOCATION)/config.mk - -# Location of directories. -TOPDIR=$(shell \pwd) +PYTHIA8LOCATION = /storage/Sim/pythia8186 INCDIR=include -SRCDIR=src -LIBDIR=lib -LIBDIRARCH=lib/archive -BINDIR=bin +LIBDIRARCH=lib/archive +-include config.mk +# 1) Jawnie: +## Sciezka to systemu ROOT - nalezy ja ustawic odpowiednio +RPATH = $(ROOTSYS) +RLIB= -L$(RPATH)/lib -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic -Wl,--no-as-needed $(ROOTGLIBS) -L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy +#2) Niejawnie, przy uzyciu root-config +#RLIB= `root-config --libs` -# 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" +#====================================================================== +# Nazwa biezacego katalogu +DIRNAME = ./ +#====================================================================== +# Nazwa rdzeniowa modulu programu +NAME1 = gen -# 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 \ - main80 gen: \ - $(PYTHIA8LOCATION)/$(LIBDIRARCH)/libpythia8.a - @mkdir -p $(BINDIR) - $(CXX) $(CXXFLAGS) -I$(PYTHIA8LOCATION)/$(INCDIR) $@.cc -o $(BINDIR)/$@.exe \ - -L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) - @ln -fs $(BINDIR)/$@.exe $@.exe +# Pliki objectowe (po kompilacji) +OBJT1 = $(NAME1).o -# 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 +# Pliki wykonawcze (po linkowaniu) +EXEC1 = $(NAME1).x +# Nazwa i opcje kompilatora +CXX = g++ +# 1) Jawnie +#CXXFLAGS = -O -Wall -pthread -I$(RPATH)include +# 2) Przy uzyciu root-config +CXXFLAGS = -O2 -Wall -I$(PYTHIA8LOCATION)/$(INCDIR) `root-config --cflags` +# Nazwa i opcje linkera +LD = $(CXX) +LDFLAGS = `root-config --ldflags` +#CXXFLAGS = -O2 -Wall -std=c++11 `root-config --cflags` +#EXTRALIBS += $(shell $(ROOTSYS)/bin/root-config --libs) +#LDFLAGS += $(shell $(ROOTSYS)/bin/root-config --libs) +#RLIB += $(shell $(ROOTSYS)/bin/root-config --libs) -L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy -# Create an executable that links to LHAPDF -main51 main52 main53 main54: $(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 +#============================================================================== +# Kompilacja dla modulow z plikami naglowkowymi +%.o: %.cxx %.h -# 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 + $(CXX) $(CXXFLAGS) -c $< +# Kompilacja dla modulow bez plikow naglowkowych +%.o: %.cxx + $(CXX) $(CXXFLAGS) -c $< +#============================================================================== +.PHONY: all run clean tar +all: ${EXEC1} +#============================================================================== +# Linkowanie +${EXEC1}: ${OBJT1} + @echo 'dupa' -# 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) $@.cc \ - `$(FASTJETLOCATION)/bin/fastjet-config --cxxflags --plugins` \ - $(CXXFLAGS) -Wno-shadow \ - -o $(BINDIR)/$@.exe \ - -L$(PYTHIA8LOCATION)/$(LIBDIRARCH) -lpythia8 -llhapdfdummy $(LIBGZIP) \ - -L$(FASTJETLOCATION)/lib \ - `$(FASTJETLOCATION)/bin/fastjet-config --libs --plugins` - @ln -fs $(BINDIR)/$@.exe $@.exe - @rm -f $@.o -else - main71 main72: - @echo ERROR, this target needs Fastjet, variable FASTJETLOCATION -endif + $(LD) -o $@ $(LDFLAGS) $^ $(RLIB) -# 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) $@.cc \ - `$(FASTJETLOCATION)/bin/fastjet-config --cxxflags --plugins` \ - $(CXXFLAGS) -Wno-shadow \ - -I$(PYTHIA8LOCATION)/$(INCDIR) -I$(HEPMCLOCATION)/include \ - -o $(BINDIR)/$@.exe \ - -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)/$@.exe $@.exe - @rm -f $@.o -else - main81 main82 main83 main84: - @echo ERROR, this target needs Fastjet, variable FASTJETLOCATION -endif - -# Clean up: remove executables and outdated files. -.PHONY: clean +#============================================================================== +# Uruchamianie +run: ${EXEC1} + ./${EXEC1} +#============================================================================== clean: - rm -rf $(BINDIR) - rm -rf *.exe - rm -f *~; rm -f \#*; rm -f core* + (rm -f *.o *.a *~ *.exe *.x core lmap *.dvi *.aux *.log a.out) +#============================================================================== +tar: clean + (cd ../; tar -cvzf $(DIRNAME).tar.gz $(DIRNAME) ) +#============================================================================== +# Wszelkie akcje jakie należy podjąć aby program zaprezentował swoje działanie: +test: run + @echo 'Test run finished' +#============================================================================== + diff --git a/Tau23Mu_pythia/Gen_BKG/gen.cc b/Tau23Mu_pythia/Gen_BKG/gen.cc index 7283fc1..4f056ec 100644 --- a/Tau23Mu_pythia/Gen_BKG/gen.cc +++ b/Tau23Mu_pythia/Gen_BKG/gen.cc @@ -7,14 +7,45 @@ // It studies event properties of LEP1 events. #include "Pythia8/Pythia.h" +#include "TFile.h" +#include "TTree.h" + using namespace Pythia8; +using namespace std; +int main(int argc, char *argv[]) +{ + // need seed + if(argc !=2) + { + cout<<"Wrong number of arguments"<Branch("PX", &PX, "PX[200]/D"); + t->Branch("PY", &PY, "PY[200]/D"); + t->Branch("PZ", &PZ, "PZ[200]/D"); + t->Branch("PZ", &PZ, "PZ[200]/D"); + t->Branch("PDG", &PDG, "PDG[200]/I"); + + + // Generator. Pythia pythia; - + // set deed + pythia.readString("Random:seed =" + seed_s); + // Allow no substructure in e+- beams: normal for corrected LEP data. pythia.readString("PDF:lepton = off"); // Process selection. @@ -23,7 +54,7 @@ pythia.readString("23:onMode = off"); pythia.readString("23:onIfAny = 1 2 3 4 5"); - // LEP1 initialization at Z0 mass. + // initialization at Z0 mass. pythia.readString("Beams:idA = 11"); pythia.readString("Beams:idB = -11"); double mZ = pythia.particleData.m0(23);