Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CLHEP
CLHEP
Commits
3d221218
Commit
3d221218
authored
Mar 15, 2005
by
Lynn Garren
Browse files
use HepPDT particle ID translation method
parent
ef9dd209
Changes
3
Hide whitespace changes
Inline
Side-by-side
HepMC/HepMC/CBherwig.h
View file @
3d221218
// $Id: CBherwig.h,v 1.1.2.
2
2005/03/
03 20:19:40
garren Exp $
// $Id: CBherwig.h,v 1.1.2.
3
2005/03/
15 23:58:35
garren Exp $
// ----------------------------------------------------------------------
// CBherwig.h
// ----------------------------------------------------------------------
...
...
@@ -100,9 +100,6 @@ private:
bool
itsTrustMothers
;
bool
itsTrustMothersAndDaughters
;
bool
itsNoBarcodeGaps
;
// we need to use HepPDT translation instead
std
::
vector
<
int
>
m_herwig_to_pdg_id
;
std
::
set
<
int
>
m_no_antiparticles
;
// internal functions
GenParticle
*
createParticle
(
int
index
);
...
...
HepMC/HepMC/CBherwig.icc
View file @
3d221218
// $Id: CBherwig.icc,v 1.1.2.
3
2005/03/
03 20:19:40
garren Exp $
// $Id: CBherwig.icc,v 1.1.2.
4
2005/03/
15 23:58:35
garren Exp $
// ----------------------------------------------------------------------
// CBherwig.icc
// ----------------------------------------------------------------------
...
...
@@ -7,6 +7,7 @@
// In order to avoid overwriting the HEPEVT common block, we must make a copy
//
#include <stdio.h> // needed for formatted output using sprintf
#include "CLHEP/HepPDT/ParticleIDTranslations.hh"
namespace HepMC {
...
...
@@ -14,8 +15,7 @@ CBherwig::CBherwig()
: hptr( new hepevt_t ),
itsTrustMothers( false ),
itsTrustMothersAndDaughters( true ),
itsNoBarcodeGaps( true ),
m_herwig_to_pdg_id(100,0)
itsNoBarcodeGaps( true )
{
// make the actual copy of HEPEVT here, so we can access the info
hptr->nevhep = hepevt_.nevhep;
...
...
@@ -24,77 +24,21 @@ CBherwig::CBherwig()
for (i=0; i < NMXHEP; ++i) {
hptr->isthep[i] = hepevt_.isthep[i];
hptr->idhep[i] = hepevt_.idhep[i];
for( j=0; j < 2; ++j ) {
hptr->jmohep[i][j] = hepevt_.jmohep[i][j];
hptr->jdahep[i][j] = hepevt_.jdahep[i][j];
}
for( j=0; j < 5; ++j ) { hptr->phep[i][j] = hepevt_.phep[i][j]; }
for( j=0; j < 5; ++j ) { hptr->vhep[i][j] = hepevt_.vhep[i][j]; }
hptr->jmohep[i][0] = hepevt_.jmohep[i][0];
hptr->jmohep[i][1] = hepevt_.jmohep[i][1];
hptr->jdahep[i][0] = hepevt_.jdahep[i][0];
hptr->jdahep[i][1] = hepevt_.jdahep[i][1];
hptr->phep[i][0] = hepevt_.phep[i][0];
hptr->phep[i][1] = hepevt_.phep[i][1];
hptr->phep[i][2] = hepevt_.phep[i][2];
hptr->phep[i][3] = hepevt_.phep[i][3];
hptr->phep[i][4] = hepevt_.phep[i][4];
hptr->vhep[i][0] = hepevt_.vhep[i][0];
hptr->vhep[i][1] = hepevt_.vhep[i][1];
hptr->vhep[i][2] = hepevt_.vhep[i][2];
hptr->vhep[i][3] = hepevt_.vhep[i][3];
}
//
// HepPDT translation tables should be used instead
//
// These arrays are copied from Lynn Garren's stdhep 5.01.
// see http://www-pat.fnal.gov/stdhep.html
// Translation from HERWIG particle ID's to PDG particle ID's.
m_herwig_to_pdg_id[1] =1;
m_herwig_to_pdg_id[2] =2;
m_herwig_to_pdg_id[3] =3;
m_herwig_to_pdg_id[4] =4;
m_herwig_to_pdg_id[5] =5;
m_herwig_to_pdg_id[6] =6;
m_herwig_to_pdg_id[7] =7;
m_herwig_to_pdg_id[8] =8;
m_herwig_to_pdg_id[11] =11;
m_herwig_to_pdg_id[12] =12;
m_herwig_to_pdg_id[13] =13;
m_herwig_to_pdg_id[14] =14;
m_herwig_to_pdg_id[15] =15;
m_herwig_to_pdg_id[16] =16;
m_herwig_to_pdg_id[21] =21;
m_herwig_to_pdg_id[22] =22;
m_herwig_to_pdg_id[23] =23;
m_herwig_to_pdg_id[24] =24;
m_herwig_to_pdg_id[25] =25;
m_herwig_to_pdg_id[26] =51; // <--
m_herwig_to_pdg_id[32] =32;
m_herwig_to_pdg_id[35] =35;
m_herwig_to_pdg_id[36] =36;
m_herwig_to_pdg_id[37] =37;
m_herwig_to_pdg_id[39] =39;
m_herwig_to_pdg_id[81] =81;
m_herwig_to_pdg_id[82] =82;
m_herwig_to_pdg_id[83] =83;
m_herwig_to_pdg_id[84] =84;
m_herwig_to_pdg_id[85] =85;
m_herwig_to_pdg_id[86] =86;
m_herwig_to_pdg_id[87] =87;
m_herwig_to_pdg_id[88] =88;
m_herwig_to_pdg_id[89] =89;
m_herwig_to_pdg_id[90] =90;
m_herwig_to_pdg_id[91] =91;
m_herwig_to_pdg_id[92] =92;
m_herwig_to_pdg_id[93] =93;
m_herwig_to_pdg_id[94] =94;
m_herwig_to_pdg_id[95] =95;
m_herwig_to_pdg_id[96] =96;
m_herwig_to_pdg_id[97] =97;
m_herwig_to_pdg_id[98] =9920022; // <--
m_herwig_to_pdg_id[99] =9922212; // <--
// These particle ID's have no antiparticle, so aren't allowed.
m_no_antiparticles.insert(-21);
m_no_antiparticles.insert(-22);
m_no_antiparticles.insert(-23);
m_no_antiparticles.insert(-25);
m_no_antiparticles.insert(-51);
m_no_antiparticles.insert(-35);
m_no_antiparticles.insert(-36);
}
CBherwig::~CBherwig()
...
...
@@ -990,66 +934,11 @@ void CBherwig::zero_hepevt_entry( int i )
hptr->vhep[i][3] = 0;
}
// this needs to come from HepPDT
int CBherwig::translate_herwig_to_pdg_id( int id, bool printInconsistencyErrors ) const
{
// This routine is copied from Lynn Garren's stdhep 5.01.
// see http://www-pat.fnal.gov/stdhep.html
// example -9922212
int hwtran = id; // -9922212
int ida = abs(id); // 9922212
int j1 = ida%10; // 2
int i1 = (ida/10)%10; // 1
int i2 = (ida/100)%10; // 2
int i3 = (ida/1000)%10; // 2
//int i4 =(ida/10000)%10; // 2
//int i5 =(ida/100000)%10; // 9
//int k99 = (ida/100000)%100; // 9
int ksusy = (ida/1000000)%10; // 0
//int ku = (ida/10000000)%10; // 0
int kqn = (ida/1000000000)%10; // 0
if ( kqn==1 ) {
// ions not recognized
hwtran=0;
if ( printInconsistencyErrors ) {
std::cerr << "CBherwig::translate_herwig_to_pdg_id " << id
<< "nonallowed ion" << std::endl;
}
}
else if (ida < 100) {
// Higgs, etc.
hwtran = m_herwig_to_pdg_id[ida];
if ( id < 0 ) hwtran *= -1;
// check for illegal antiparticles
if ( id < 0 ) {
if ( hwtran>=-99 && hwtran<=-81) hwtran=0;
if ( m_no_antiparticles.count(hwtran) ) hwtran=0;
}
}
else if ( ksusy==1 || ksusy==2 ) { ; }
// SUSY
else if ( i1!=0 && i3!=0 && j1==2 ) {;}
// spin 1/2 baryons
else if ( i1!=0 && i3!=0 && j1==4 ) {;}
// spin 3/2 baryons
else if ( i1!=0 && i2!=0 && i3==0 ) {
// mesons
// check for illegal antiparticles
if ( i1==i2 && id<0) hwtran=0;
}
else if ( i2!=0 && i3!=0 && i1==0 ) {;}
// diquarks
else {
// undefined
hwtran=0;
}
// check for illegal anti KS, KL
if ( id==-130 || id==-310 ) hwtran=0;
int hwtran = HepPDT::translateHerwigtoPDT( id );
if ( hwtran==0 && id
a
!=0 && printInconsistencyErrors ) {
if ( hwtran==0 && id!=0 && printInconsistencyErrors ) {
std::cerr
<< "CBherwig::translate_herwig_to_pdg_id HERWIG particle "
<< id << " translates to zero." << std::endl;
...
...
HepMC/examples/GNUmakefile.example.in
View file @
3d221218
...
...
@@ -11,15 +11,6 @@
#
################################################################################
PLATFORM=$(shell uname)
ifeq "$(PLATFORM)" "IRIX"
IRIX6 = $(findstring 6,$(shell uname -r))
ifeq "$(IRIX6)" "6"
PLATFORM=IRIX64
endif
endif
################################################################################
ifndef DEBUG
SFX =
else
...
...
@@ -29,61 +20,59 @@ endif
################################################################################
CLHEP_BASE= @prefix@
CXX =
g++
CXX =
@CXX@
INCDIR = -I$(CLHEP_BASE)/include
HepMCinc = $(INCDIR)/CLHEP/HepMC
PythiaLIB = $(LULIB)/pydata.o $(LULIB)/liblund.a $(LULIB)/libpydum.a
HerwigLIB = $(HERWIG_DIR)/lib/libherwig.a $(HERWIG_DIR)/lib/libherdum.a $(HERWIG_DIR)/lib/timel.o
LIBNAME = -L$(CLHEP_BASE)/lib -lCLHEP-@VERSION@
LIBS = @AM_LDFLAGS@
################################################################################
CXXFLAGS = @AM_CXXFLAGS@ @CXXFLAGS@ $(INCDIR)
ifeq "$(CXX)" "g++"
F77 = g77
FFLAGS = $(DFLG) -fno-second-underscore $(INCDIR)
else
F77 = f77
FFLAGS = $(DFLG) $(INCDIR)
endif
################################################################################
PLATFORM=$(shell uname)
ifeq "$(PLATFORM)" "IRIX"
IRIX6 = $(findstring 6,$(shell uname -r))
ifeq "$(IRIX6)" "6"
PLATFORM=IRIX64
endif
endif
ifeq "$(PLATFORM)" "HP-UX"
F77=f77
F77FLAG=
FLAGS =
LINK_LIBS = -lg2c -lftn -lf
endif
ifeq "$(PLATFORM)" "IRIX"
F77=f77
F77FLAG=
FLAGS =
LINK_LIBS = -lg2c -lftn
endif
ifeq "$(PLATFORM)" "IRIX64"
F77=f77
F77FLAG= -n32
FLAGS =
LINK_LIBS = -lg2c -lftn
endif
ifeq "$(PLATFORM)" "Linux"
F77=g77
F77FLAG= -fno-second-underscore
ifeq "$(CXX)" "g++"
FLAGS = -O -ansi -pedantic-errors -Wall
endif
LOCAL = -lnsl
LINK_LIBS = -lg2c
endif
ifeq "$(PLATFORM)" "OSF1"
F77=f77
F77FLAG= -fpe2 -check underflow -check overflow
FLAGS =
LINK_LIBS = -lfor -lUfor
endif
ifeq "$(PLATFORM)" "SunOS"
F77=f77
F77FLAG=
FLAGS =
LOCAL= -L/opt/SUNWspro/lib -lm -lnsl -lsocket -lF77 -lM77 -ldbxFintr -lsunmath -R/opt/SUNWspro/lib
LINK_LIBS = -lg2c
endif
################################################################################
FFLAGS = $(filter-out -fPIC, $(F77FLAG))
HDRS = $(wildcard $(HepMCinc)/*.h) $(wildcard *.h)
examples = $(addsuffix .exe,$(basename $(wildcard example*.cc)))
examples += $(addsuffix .exe,$(basename $(wildcard test*.cc)))
...
...
@@ -106,62 +95,62 @@ example_MyHerwig.exe: example_MyHerwig$(SFX).o
@echo "Building $@ ..."
$(CXX) $(FLAGS) example_MyHerwig$(SFX).o \
$(LIBNAME) \
$(HerwigLIB) $(LINK_LIBS) -o $@
$(HerwigLIB) $(LINK_LIBS)
$(LIBS)
-o $@
example_MyPythia.exe: example_MyPythia$(SFX).o $(initpydata_OBJ) $(Ascii_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) example_MyPythia$(SFX).o $(initpydata_OBJ) $(Ascii_OBJ) \
$(LIBNAME) \
$(PythiaLIB) $(LINK_LIBS) -o $@
$(PythiaLIB) $(LINK_LIBS)
$(LIBS)
-o $@
example_MyPythiaOnlyToHepMC.exe: example_MyPythiaOnlyToHepMC$(SFX).o $(initpydata_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) example_MyPythiaOnlyToHepMC$(SFX).o $(initpydata_OBJ) \
$(LIBNAME) \
$(PythiaLIB) $(LINK_LIBS) -o $@
$(PythiaLIB) $(LINK_LIBS)
$(LIBS)
-o $@
example_MyPythiaWithEventSelection.exe: example_MyPythiaWithEventSelection$(SFX).o $(initpydata_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) example_MyPythiaWithEventSelection$(SFX).o $(initpydata_OBJ) \
$(LIBNAME) \
$(PythiaLIB) $(LINK_LIBS) -o $@
$(PythiaLIB) $(LINK_LIBS)
$(LIBS)
-o $@
example_EventSelection.exe: example_EventSelection$(SFX).o $(Ascii_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) example_EventSelection$(SFX).o $(Ascii_OBJ) \
$(LIBNAME) \
$(LINK_LIBS) -o $@
$(LINK_LIBS)
$(LIBS)
-o $@
example_UsingIterators.exe: example_UsingIterators$(SFX).o $(initpydata_OBJ) $(Ascii_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) example_UsingIterators$(SFX).o $(initpydata_OBJ) $(Ascii_OBJ) \
$(LIBNAME) \
$(PythiaLIB) $(LINK_LIBS) -o $@
$(PythiaLIB) $(LINK_LIBS)
$(LIBS)
-o $@
examplePythiaWriteHepMC.exe: examplePythiaWriteHepMC$(SFX).o $(initpydata_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) examplePythiaWriteHepMC$(SFX).o $(initpydata_OBJ) \
$(LIBNAME) \
$(PythiaLIB) $(LINK_LIBS) -o $@
$(PythiaLIB) $(LINK_LIBS)
$(LIBS)
-o $@
exampleReadHepMC.exe: exampleReadHepMC$(SFX).o
@echo "Building $@ ..."
$(CXX) $(FLAGS) exampleReadHepMC$(SFX).o \
$(LIBNAME) \
$(LINK_LIBS) -o $@
$(LINK_LIBS)
$(LIBS)
-o $@
test_MakeUsingIteratorsInput.exe: test_MakeUsingIteratorsInput$(SFX).o $(Ascii_OBJ) $(initpydata_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) test_MakeUsingIteratorsInput$(SFX).o $(Ascii_OBJ) $(initpydata_OBJ) \
$(LIBNAME) \
$(PythiaLIB) \
$(LINK_LIBS) -o $@
$(LINK_LIBS)
$(LIBS)
-o $@
testMethods.exe: testMethods$(SFX).o $(initpydata_OBJ)
@echo "Building $@ ..."
$(CXX) $(FLAGS) testMethods$(SFX).o $(initpydata_OBJ) \
$(LIBNAME) \
$(PythiaLIB) $(LINK_LIBS) -o $@
$(PythiaLIB) $(LINK_LIBS)
$(LIBS)
-o $@
cleanobjs:
rm -f *.o
...
...
@@ -232,17 +221,13 @@ runTestMethods: testMethods.exe
.SUFFIXES : .o .cc .F .inc .h .hh
%.o: %.F
@echo "Compiling $< with $(F77) ..."
$(F77) $(FFLAGS) $(INCDIR) -c $< -o $@
$(F77) $(FFLAGS) -c $< -o $@
%_g.o: %.F
@echo "Compiling $< with $(F77) ..."
$(F77) $(DEBUG) $(FFLAGS) $(INCDIR) -c $< -o $@
$(F77) $(DEBUG) $(FFLAGS) -c $< -o $@
%.o: %.cc $(HDRS)
@echo "Compiling $< with $(CXX) ..."
$(CXX) $(FLAGS) $(INCDIR) -c $< -o $@
$(CXX) $(CXXFLAGS) -c $< -o $@
%_g.o: %.cc $(HDRS)
@echo "Compiling $< with $(CXX) ..."
$(CXX) $(DEBUG) $(FLAGS) $(INCDIR) -c $< -o $@
$(CXX) $(DEBUG) $(CXXFLAGS) -c $< -o $@
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment