Support #1256
Projecting beams backwards (-ve Pz)
100%
Description
I'm trying to track a bunch of particles back through my geometry, which I do by flipping px, py, pz and the PID (particle -> anti-particle). This all seemed fine in G4MICE, but for some reason Maus doesn't seem to let me...
TRANSFORM/MERGE/OUTPUT: Processed 1 events so far, 1 events in buffer.
TRANSFORM/MERGE/OUTPUT: Processed 2 events so far, 1 events in buffer.
Traceback (most recent call last):
File "/home/carlisle/maus0.5/src/common_py/ErrorHandler.py", line 162, in HandleCppException
raise CppError(error_message)
ErrorHandler.CppError: Particle is outside world volume at MAUSPrimaryGeneratorAction::GeneratePrimaries
Traceback (most recent call last):
File "/home/carlisle/maus0.5/src/common_py/ErrorHandler.py", line 162, in HandleCppException
raise CppError(error_message)
ErrorHandler.CppError: In branch errors
Failed to convert json value to string at StringProcessor::JsonToCpp
TRANSFORM/MERGE/OUTPUT: Processed 3 events so far, 1 events in buffer.
I can input beams (in icool for003 format) and send them down the axis, but back up doesn't work...am I missing something basic/subtle? Cards & for003 file attached.
Thanks Chris
Files
Updated by Carlisle, Timothy over 10 years ago
- File Cards_31.py Cards_31.py added
- Description updated (diff)
Updated by Carlisle, Timothy over 10 years ago
- File StepIV_none__8m.dat StepIV_none__8m.dat added
Updated by Rogers, Chris over 10 years ago
- Category set to Simulation
- Target version set to Future MAUS release
I ran with --verbose_level 0
and got a bit more debugging output (below). Note the first error
ErrorHandler.CppError: Particle is outside world volume at MAUSPrimaryGeneratorAction::GeneratePrimaries
I tried setting the world volume to 6000*6000*31000 m and it looks like it works. You may have some bug in your for003 file (should be in [m]/[GeV] as per ICOOL specifications). Note I was missing some files so I couldn't run with the full geometry that you provided.
Stack trace:/home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZN4MAUS26MAUSPrimaryGeneratorAction17GeneratePrimariesEP7G4Event+0x247) [0x7fd6f108c387] /home/cr67/MAUS/maus_release/third_party/build/geant4.9.2.p04/lib/Linux-g++/libG4run.so(_ZN12G4RunManager13GenerateEventEi+0x10a) [0x7fd6ed19617a] /home/cr67/MAUS/maus_release/third_party/build/geant4.9.2.p04/lib/Linux-g++/libG4run.so(_ZN12G4RunManager11DoEventLoopEiPKci+0xb6) [0x7fd6ed195aa6] /home/cr67/MAUS/maus_release/third_party/build/geant4.9.2.p04/lib/Linux-g++/libG4run.so(_ZN12G4RunManager6BeamOnEiPKci+0x7c) [0x7fd6ed19566c] /home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZN4MAUS17MAUSGeant4Manager16RunManyParticlesEN4Json5ValueE+0x242) [0x7fd6f1091a72] /home/cr67/MAUS/maus_release/build/_MapCppSimulation.so(_ZN4MAUS16MapCppSimulation7processESs+0xe0) [0x7fd6dfffc1a0] /home/cr67/MAUS/maus_release/build/_MapCppSimulation.so(+0x77f2) [0x7fd6dffff7f2] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x52be) [0x7fd6fa497f0e] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x855) [0x7fd6fa499ce5] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5245) [0x7fd6fa497e95] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x629a) [0x7fd6fa498eea] Traceback (most recent call last): File "/home/cr67/MAUS/maus_release/src/common_py/ErrorHandler.py", line 162, in HandleCppException raise CppError(error_message) ErrorHandler.CppError: Particle is outside world volume at MAUSPrimaryGeneratorAction::GeneratePrimaries mc numevts = 1000 Stack trace:/home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZN4MAUS15StringProcessor9JsonToCppERKN4Json5ValueE+0x90) [0x7fd6f1135190] /home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZN4MAUS23ObjectMapValueProcessorISsE9JsonToCppERKN4Json5ValueE+0xd2) [0x7fd6f115e3c2] /home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZN4MAUS17ObjectProcessorNS9ValueItemINS_5SpillESt3mapISsSsSt4lessISsESaISt4pairIKSsSsEEEE12_SetCppChildERKN4Json5ValueERS2_+0x97) [0x7fd6f115c1a7] /home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZN4MAUS15ObjectProcessorINS_5SpillEE9JsonToCppERKN4Json5ValueE+0x60) [0x7fd6f115a9a0] /home/cr67/MAUS/maus_release/build/libMausCpp.so(_ZNK4MAUS21JsonCppSpillConverter8_convertEPKN4Json5ValueE+0x76) [0x7fd6f120de56] /home/cr67/MAUS/maus_release/build/_OutputCppRoot.so(_ZN4MAUS13OutputCppRoot11write_eventINS_21JsonCppSpillConverterENS_5SpillEEEbPNS_9MAUSEventIT0_EERKN4Json5ValueESs+0x1a4) [0x7fd6df2676d4] /home/cr67/MAUS/maus_release/build/_OutputCppRoot.so(_ZN4MAUS13OutputCppRoot5_saveESs+0x23a) [0x7fd6df262f8a] /home/cr67/MAUS/maus_release/build/_OutputCppRoot.so(_ZN4MAUS10OutputBaseISsE4saveESs+0x34) [0x7fd6df2638e4] /home/cr67/MAUS/maus_release/build/_OutputCppRoot.so(+0x15dd7) [0x7fd6df26cdd7] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x52be) [0x7fd6fa497f0e] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x855) [0x7fd6fa499ce5] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5245) [0x7fd6fa497e95] /home/cr67/MAUS/maus_release/third_party/install/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x629a) [0x7fd6fa498eea] Traceback (most recent call last): File "/home/cr67/MAUS/maus_release/src/common_py/ErrorHandler.py", line 162, in HandleCppException raise CppError(error_message) ErrorHandler.CppError: In branch errors Failed to convert json value to string at StringProcessor::JsonToCpp
Updated by Carlisle, Timothy over 10 years ago
Ah ok, never had volume be an issue before!
One (minor) thing, is there a way to apply a cut on the absolute value of a variable, i.e. for pz? Something like...cue incorrect pseudocode(!)...:
bunch.cut({ fabs('pz'):150.}, operator.le, global_cut=False)
If there isn't a simple Maus-way, I can work round it straightforwardly enough (if statement etc), just thought I'd ask.
Thanks
Updated by Rogers, Chris over 10 years ago
I think the pseudocode you posted was even correct. This will set statistical weight to 0. If you want to remove the particle altogether there is Bunch.conditional_remove
Updated by Rogers, Chris over 10 years ago
The documentation I linked to was crap. I rewrote it:
""" For when a cut is not good enough, remove hits from the bunch altogether if comparator(value, get([variable])) is True for any variable - variable_value_dict = dict of Bunch.get_variables() strings to the cut value; use hit['variable'] for the cut - comparator = comparator function; if comparator(Hit['variable']) is true, remove particle from the bunch - value_is_nsigma_bool = boolean; if True, value is the number of standard deviations e.g. bunch.cut({'energy':300, 'x':20.}, operator.ge) removes particles if they have energy >= 300 MeV OR x >= 20 mm. Here operator.ge is a functional representation of the >= operator. ge(hit.get('energy'), 300) is the same as (hit.get('energy') >= 300). A whole load of useful comparators can be found in the operator module. e.g. ge is >=; le is <=; etc. See also python built-in function "filter". """
Updated by Rogers, Chris over 10 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Closing the issue if that's okay.