updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / bdsim / fix.patch
blob4d45eafbd2ba7d337e67921209eb49016ea45ca7
1 diff --git a/bdsim.cc b/bdsim.cc
2 index 2ef0704..da1e337 100644
3 --- a/bdsim.cc
4 +++ b/bdsim.cc
5 @@ -55,6 +55,7 @@
7 #include "parser/gmad.h" // GMAD parser
9 +#include <ctime>
13 diff --git a/configure b/configure
14 index 4dc1b6f..0f0207b 100755
15 --- a/configure
16 +++ b/configure
17 @@ -165,11 +165,15 @@ if test "$value" == "y"; then
19 ROOT_sys="$ROOTSYS"
21 -printf "\n\n What is your ROOT installation directory?\n"
24 -read -p "[$ROOT_sys]" value
26 +if which root-config 2> /dev/null; then
27 + printf " Using `which root-config`"
28 + tmp=`which root-config`
29 + value=${tmp%/bin/root-config}
30 +else
31 + printf "\n\n What is your ROOT installation directory?\n"
32 + read -p "[$ROOT_sys]" value
33 +fi
35 if test "$value" == ""; then
36 value=$ROOT_sys
37 diff --git a/parser/parser.l b/parser/parser.l
38 index 65fd985..d029b99 100644
39 --- a/parser/parser.l
40 +++ b/parser/parser.l
41 @@ -109,7 +109,7 @@ include BEGIN(incl); //reserved commands
42 beam { return BEAM; }
43 option { return OPTION; }
44 print { return PRINT; }
45 -echo { return ECHO; }
46 +echo { return PRINT; }
47 "return" { return STOP; }
48 stop {return STOP;}
49 use { return USE; }
50 diff --git a/patches/Makefile.diff b/patches/Makefile.diff
51 new file mode 100644
52 index 0000000..e6e430b
53 --- /dev/null
54 +++ b/patches/Makefile.diff
55 @@ -0,0 +1,44 @@
56 +diff --git a/src/Makefile.in b/src/Makefile.in
57 +index 664523f..1675f0c 100644
58 +--- a/src/Makefile.in
59 ++++ b/src/Makefile.in
60 +@@ -1,9 +1,16 @@
61 + name=bdsim
62 + G4TARGET=$(name)
63 + G4EXLIB=true
65 ++ifndef G4TMP
66 ++ G4TMP=@BINDIR@/tmp
67 ++endif
68 ++ifndef G4LIBDIR
69 ++ G4LIBDIR=@G4LIBDIR@
70 ++endif
71 + G4WORKDIR=@BINDIR@
72 +-G4INSTALL=@G4INSTALL@
73 ++ifndef G4INSTALL
74 ++ G4INSTALL=@G4INSTALL@
75 ++endif
76 + ROOTSYS=@ROOTSYS@
77 + G4VERSION=@G4VERSION@
78 + G4MINORVERSION=@G4MINORVERSION@
79 +@@ -53,16 +61,18 @@ LDLIBS3 += $(ROOTLIBS)
81 + # standard Geant4 make procedure
82 + include $(G4INSTALL)/config/binmake.gmk
83 ++include $(G4INSTALL)/config/architecture.gmk
86 + CPPFLAGS += -DG4VERSION=$(G4VERSION) -DG4MINORVERSION=$(G4MINORVERSION)
87 + CPPFLAGS += @USE_ROOT@ -DCLHEP_VERSION=@CLHEP_VERSION@
88 + CPPFLAGS += -I./parser
89 ++CPPFLAGS += -I./include
90 + CPPFLAGS += $(ROOTCFLAGS)
91 + CPPFLAGS += @USE_GDML@ @USE_LCDD@ @LCDD_CFLAGS@
92 +-CPPFLAGS += -g -Wall -Wno-non-virtual-dtor -I.
93 ++CPPFLAGS += -g -Wno-non-virtual-dtor -I.
95 +-LDFLAGS += -L$(G4LIBDIR) -L./parser -lgmad @LCDD_LIBS@
96 ++LDFLAGS += -L./parser -lgmad @LCDD_LIBS@ -L$(G4LIB)
98 + ifeq ($(G4SYSTEM),Darwin-g++)
99 + OGLLIBS=@OGLLIBS@
100 \ No newline at end of file
101 diff --git a/patches/samplerdebug.diff b/patches/samplerdebug.diff
102 new file mode 100644
103 index 0000000..ad49a17
104 --- /dev/null
105 +++ b/patches/samplerdebug.diff
106 @@ -0,0 +1,32 @@
107 +diff --git a/src/src/BDSSamplerSD.cc b/src/src/BDSSamplerSD.cc
108 +index 6488918..c0d18e9 100755
109 +--- a/src/src/BDSSamplerSD.cc
110 ++++ b/src/src/BDSSamplerSD.cc
111 +@@ -77,6 +77,7 @@ G4bool BDSSamplerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
112 + //total track energy
113 + G4double energy = theTrack->GetKineticEnergy()+
114 + theTrack->GetDefinition()->GetPDGMass();
115 ++ G4cout << "BDSSamplerSD::ProcessHits():> energy = " << energy << G4endl;
116 + //current particle position (global)
117 + G4ThreeVector pos = theTrack->GetPosition();
118 + //total track length
119 +@@ -109,6 +110,10 @@ G4bool BDSSamplerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
120 + G4double xPrime=LocalDirection.x();
121 + G4double yPrime=LocalDirection.y();
122 + G4double zPrime=LocalDirection.z();
123 ++ G4cout << "BDSSamplerSD::ProcessHits():> Primes = " << xPrime << " " << yPrime << " " << zPrime << G4endl;
124 ++ G4cout << "BDSSamplerSD::ProcessHits():> Pos = " << x << " " << y << " " << z << G4endl;
125 ++ G4cout << "BDSSamplerSD::tf:> Netrotation = " << tf.NetRotation() << G4endl;
126 ++ G4cout << "BDSSamplerSD::tf:> NetTranslation = "<< tf.NetTranslation().x() << " " << tf.NetTranslation().y() << " " << tf.NetTranslation().z() << G4endl;
128 + // Changed z output by Samplers to be the position of the sampler
129 + // not time of flight of the particle JCC 15/10/05
130 +@@ -192,6 +197,8 @@ G4bool BDSSamplerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
131 + smpHit->SetGlobalYPrime(momDir.y());
132 + smpHit->SetGlobalZPrime(momDir.z());
133 + smpHit->SetType(itsType);
134 ++ G4cout << "BDSSamplerSD::ProcessHits():> GlobPrimes = " << momDir.x() << " " << momDir.y() << " " << momDir.z() << G4endl;
135 ++ G4cout << "BDSSamplerSD::ProcessHits():> GlobPos = " << pos.x() << " " << pos.y() << " " << pos.z() << G4endl;
137 + SamplerCollection->insert(smpHit);
138 + if(theTrack->GetVolume()!=theTrack->GetNextVolume())StoreHit=true;
139 diff --git a/src/BDSOutput.cc b/src/BDSOutput.cc
140 index 24bfedf..cc9297f 100755
141 --- a/src/BDSOutput.cc
142 +++ b/src/BDSOutput.cc
143 @@ -39,7 +39,7 @@ void BDSOutput::SetFormat(G4int val)
144 G4cout<<"output format ASCII, filename: "<<filename<<G4endl;
145 of.open(filename);
146 of<<"### BDSIM output created "<<ctime(&tm)<<" ####"<<G4endl;
147 - of<<"# PT E[GeV] X[mum] Y[mum] Z[m] Xp[rad] Yp[rad] "<<G4endl;
148 + of<<"# EventID PT E[GeV] X[mum] Y[mum] Z[m] Xp[rad] Yp[rad] "<<G4endl;
151 if( format == _ROOT)
152 @@ -171,7 +171,9 @@ void BDSOutput::WriteHits(BDSSamplerHitsCollection *hc)
154 for (G4int i=0; i<hc->entries(); i++)
156 - of<<(*hc)[i]->GetPDGtype()
157 + of<<(*hc)[i]->GetEventNo()
158 + <<" "
159 + <<(*hc)[i]->GetPDGtype()
160 <<" "
161 <<(*hc)[i]->GetMom()/GeV
162 <<" "
163 @@ -393,7 +395,7 @@ void BDSOutput::WriteEnergyLoss(BDSEnergyCounterHitsCollection* hc)
164 G4int partID = (*hc)[i]->GetPartID();
165 G4int parentID = (*hc)[i]->GetParentID();
167 - of<<EWeightZ/m<<" "<<Energy/GeV<<" "<<partID<<" "<<parentID<<G4endl;
168 +// of<<EWeightZ/m<<" "<<Energy/GeV<<" "<<partID<<" "<<parentID<<G4endl;
171 of.flush();
172 diff --git a/src/ggmad.cc b/src/ggmad.cc
173 index a6e13f6..26884bb 100755
174 --- a/src/ggmad.cc
175 +++ b/src/ggmad.cc
176 @@ -14,6 +14,7 @@
178 #include "BDSAcceleratorComponent.hh"
179 #include "ggmad.hh"
180 +#include <cstring>
182 using namespace std;