-
Notifications
You must be signed in to change notification settings - Fork 142
feat: Add option to split pions and kaons in run_fixedTarget #1063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,16 @@ def get_work_dir(run_number, tag: str | None = None) -> str: | |
| ap.add_argument("-J", "--Jpsi-mainly", action=argparse.BooleanOptionalAction, dest="JpsiMainly", default=False) | ||
| ap.add_argument("-b", "--boostDiMuon", type=float, default=1.0, help="boost Di-muon branching ratios") | ||
| ap.add_argument("-X", "--boostFactor", type=float, default=1.0, help="boost Di-muon prod cross sections") | ||
| ap.add_argument( | ||
| "--kaon-pion-splits", | ||
| type=int, | ||
| default=0, | ||
| help="splitting factor for kaons and pions, in order to boost the number of muons stemming from their decays", | ||
| ) | ||
| ap.add_argument( | ||
| "--multiple-kpi-splits", action="store_true", help="split kaons and pions multiple times along the track path" | ||
| ) | ||
|
|
||
|
Comment on lines
+81
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Validate split-flag combinations at parse time. Lines 81-90 allow invalid combinations (e.g., negative 🔧 Proposed fix args = ap.parse_args()
+if args.kaon_pion_splits < 0:
+ ap.error("--kaon-pion-splits must be >= 0")
+if args.multiple_kpi_splits and args.kaon_pion_splits == 0:
+ ap.error("--multiple-kpi-splits requires --kaon-pion-splits > 0")🤖 Prompt for AI Agents |
||
| ap.add_argument("-C", "--charm", action=argparse.BooleanOptionalAction, default=False, help="generate charm decays") | ||
| ap.add_argument("-B", "--beauty", action=argparse.BooleanOptionalAction, default=False, help="generate beauty decays") | ||
| ap.add_argument( | ||
|
|
@@ -272,6 +282,8 @@ def get_work_dir(run_number, tag: str | None = None) -> str: | |
| if args.boostFactor > 1: | ||
| # Turn off UseGeneralProcess to access GammaToMuons directly when cross-sections need to be changed | ||
| os.environ["SET_GENERAL_PROCESS_TO_FALSE"] = "1" | ||
| if args.kaon_pion_splits > 0: | ||
| os.environ["KAON_PION_SPLITS"] = str(args.kaon_pion_splits) | ||
| run.SetUserConfig("g4Config.C") # user configuration file default g4Config.C | ||
| rtdb = run.GetRuntimeDb() | ||
|
|
||
|
|
@@ -342,6 +354,9 @@ def get_work_dir(run_number, tag: str | None = None) -> str: | |
|
|
||
|
|
||
| sensPlaneHA = ROOT.exitHadronAbsorber() | ||
| sensPlaneHA.SetNSplits(args.kaon_pion_splits) # type: ignore[missing-attribute] | ||
| if args.multiple_kpi_splits: | ||
| sensPlaneHA.SetSplitMultipleTimes() # type: ignore[missing-attribute] | ||
| sensPlaneHA.SetEnergyCut(args.ecut * u.GeV) | ||
| sensPlaneHA.SetVetoPointName("PlaneHA") | ||
|
|
||
|
|
@@ -422,6 +437,8 @@ def get_work_dir(run_number, tag: str | None = None) -> str: | |
| fStack = gMC.GetStack() | ||
| fStack.SetMinPoints(1) | ||
| fStack.SetEnergyCut(-1.0) | ||
| if args.kaon_pion_splits > 0: | ||
| fStack.SetSplitting() | ||
| # | ||
| import AddDiMuonDecayChannelsToG4 | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align
stackPopperactivation with positive split semantics.At Line 40,
fNsplits != 0enables+stackPoppereven for negative values, but downstream splitting paths are gated onfNsplits > 0. Use a strictly positive check to keep configuration behavior consistent.🔧 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents