Project
Loading...
Searching...
No Matches
O2MCApplication.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <cstdlib>
13#include <optional>
14#include <string>
15#include <utility>
16
18#include <fairmq/Channel.h>
19#include <fairmq/Message.h>
20#include <fairmq/Device.h>
21#include <fairmq/Parts.h>
23#include <TMessage.h>
24#include <sstream>
25#include <SimConfig/SimConfig.h>
30#include <cassert>
32#include <TGeoManager.h>
33#include <fstream>
34#include <FairVolume.h>
38#include <filesystem>
41#include <FairRunSim.h>
42#include <FairSink.h>
43#include <FairModule.h>
44#include <FairField.h> // full type: FairField derives from TVirtualMagField
45#include <TVirtualMC.h>
47#include <TGeoParallelWorld.h>
48#include <TGeoVolume.h>
49#include <TGeoVoxelFinder.h>
50#include <TBuffer3D.h>
51#include <TGeoTessellated.h>
53#include <unordered_set>
54#include "SimConfig/G4Params.h"
55#include "DetectorsBase/VMCSeederService.h" // per-track seeding of the engine
56#include <TLorentzVector.h>
57#include <TRandom.h>
58#include <cstring>
61#include <TRandom3.h>
62#include <mutex>
63
64namespace o2
65{
66namespace steer
67{
68// helper function to send trivial data
69template <typename T>
70void TypedVectorAttach(const char* name, fair::mq::Channel& channel, fair::mq::Parts& parts)
71{
72 auto mgr = FairRootManager::Instance();
73 auto vector = mgr->InitObjectAs<const std::vector<T>*>(name);
74 if (vector) {
75 auto buffer = (char*)&(*vector)[0];
76 auto buffersize = vector->size() * sizeof(T);
77 fair::mq::MessagePtr message(channel.NewMessage(
78 buffer, buffersize,
79 [](void* data, void* hint) {}, buffer));
80 parts.AddPart(std::move(message));
81 }
82}
83
85{
87
88 // check the max time of flight condition
89 const auto tof = fMC->TrackTime();
91 if (tof > params.TOFMAX) {
92 fMC->StopTrack();
93 return;
94 }
95
96 mLongestTrackTime = std::max((double)mLongestTrackTime, tof);
97
99 // we can kill tracks here based on our
100 // custom detector specificities
101
102 // Note that this is done in addition to the generic
103 // R + Z-cut mechanism at VMC level.
104
105 float x, y, z;
106 fMC->TrackPosition(x, y, z);
107
108 // this function is implementing a basic z-dependent R cut
109 // can be generalized later on
110 auto outOfR = [x, y, this](float z) {
111 // for the moment for cases when we have ZDC enabled
112 if (std::abs(z) > mCutParams.tunnelZ) {
114 return true;
115 }
116 }
117 return false;
118 };
119
120 if (z > mCutParams.ZmaxA ||
121 -z > mCutParams.ZmaxC ||
122 outOfR(z)) {
123 fMC->StopTrack();
124 return;
125 }
126 }
127
128 // an additional, user-provided criterion; only consulted when one is
129 // configured, so that SimCutParams.stepFilteringMacro being unset leaves the
130 // code above as the whole of the geometry cut
132 fMC->StopTrack();
133 return;
134 }
135
138 }
139
140 // dispatch now to stepping function in FairRoot
142}
143
144namespace
145{
146// Hash of a track's initial state (vertex, global time, momentum, PDG). Used as
147// the random seed for that track, so that a track's random stream depends only
148// on the track itself and not on how many randoms earlier tracks happened to
149// consume.
150//
151// The values are read from the transport engine, not from
152// o2::data::Stack::GetCurrentTrack(): under Geant4 the stack's "current track"
153// is only meaningful for primaries -- Stack::SetCurrentTrack() falls back to
154// mCurrentParticle0 (the last particle *pushed*) for anything beyond the
155// primary array, so every secondary would hash the wrong particle. Both engines
156// have the track's initial state loaded by the time PreTrack is called (Geant4
157// sets the step to kVertex first; Geant3 calls GLTRAC before GUTRAK).
158ULong_t hashCurrentTrack(TVirtualMC* vmc)
159{
160 auto asLong = [](double x) {
161 ULong_t l;
162 std::memcpy(&l, &x, sizeof(l));
163 return l;
164 };
165
166 TLorentzVector pos, mom;
167 vmc->TrackPosition(pos);
168 vmc->TrackMomentum(mom);
169
170 ULong_t hash = asLong(pos.X());
171 hash ^= asLong(pos.Y());
172 hash ^= asLong(pos.Z());
173 hash ^= asLong(pos.T());
174 hash ^= asLong(mom.Px());
175 hash ^= asLong(mom.Py());
176 hash ^= asLong(mom.Pz());
177 hash += (ULong_t)vmc->TrackPid();
178 return hash;
179}
180} // namespace
181
183{
184 // Geant3 seeds at stack-pop time, in o2::data::Stack::PopNextTrack(). That is
185 // strictly earlier than its PreTrack hook (gutrak).
186 // Do not seed Geant3 here as well -- it is already covered, and reseeding a
187 // second time mid-track would undo the first.
188 static const bool inPreTrack = [this]() {
189 const char* name = (fMC != nullptr) ? fMC->GetName() : "";
190 return strncmp(name, "TGeant3", 7) != 0;
191 }();
192 return inPreTrack;
193}
194
196{
197 if (auto& beginTrack = o2::base::MTWorkerHooks::instance().beginTrack) {
198 beginTrack();
199 }
201 // Per-track seeding for engines that do not go through
202 // o2::data::Stack::PopNextTrack(). Geant4 is one: it takes primaries via
203 // PopPrimaryForTracking and keeps secondaries internally, so the stack hook
204 // never fires and this is the only per-track hook available. It is called
205 // for primaries and secondaries alike
206 // (TG4TrackingAction::PreUserTrackingAction), and only on a track's first
207 // step, so a suspended track is not reseeded mid-flight.
208 auto hash = hashCurrentTrack(fMC);
209 // TRandom::SetSeed(0) means "seed from the clock" -- never let that happen.
210 o2::base::simRandom()->SetSeed(hash == 0 ? 1 : hash);
212 }
213
214 // dispatch now to function in FairRoot
216}
217
219{
220 // The transport engine constructs the geometry from inside its own
221 // constructor, long before FairMCApplication::InitMC() attaches the magnetic
222 // field to it. The media built below read the field through
223 // Detector::initFieldTrackingParams(), so without this they all silently fall
224 // back to hardcoded defaults. The run has known the field since
225 // build_geometry.C, which runs before Init() -- hand it over now.
226 if (auto* vmc = TVirtualMC::GetMC(); vmc != nullptr && vmc->GetMagField() == nullptr) {
227 auto* run = FairRunSim::Instance();
228 if (run != nullptr && run->GetField() != nullptr) {
229 vmc->SetMagField(run->GetField());
230 LOG(info) << "Magnetic field attached to the engine before media creation";
231 } else {
232 LOG(warn) << "No magnetic field available at geometry construction; media "
233 "will be initialised with default tracking parameters";
234 }
235 }
236
237 // fill the mapping
238 mModIdToName.clear();
240 for (int i = 0; i < fModules->GetEntries(); ++i) {
241 auto mod = static_cast<FairModule*>(fModules->At(i));
242 if (mod) {
243 mModIdToName[mod->GetModId()] = mod->GetName();
244 int did = o2::detectors::DetID::nameToID(mod->GetName());
245 if (did >= 0) {
246 dmask |= o2::detectors::DetID::getMask(did);
247 }
248 }
249 }
250 gGeoManager->SetUniqueID(dmask.to_ulong());
252
253 std::ofstream voltomodulefile("MCStepLoggerVolMap.dat");
254 // construct the volume name to module name mapping useful for StepAnalysis
255 auto vollist = gGeoManager->GetListOfVolumes();
256 for (int i = 0; i < vollist->GetEntries(); ++i) {
257 auto vol = static_cast<TGeoVolume*>(vollist->At(i));
258 auto iter = fModVolMap.find(vol->GetNumber());
259 voltomodulefile << vol->GetName() << ":" << mModIdToName[iter->second] << "\n";
260 }
261}
262
264{
265 if (mCutParams.stepFilteringMacro.empty()) {
266 return;
267 }
269 if (!std::filesystem::exists(macro)) {
270 LOG(error) << "Macro for step filtering does not exist at " << macro << "; ignoring it";
271 return;
272 }
273 LOG(info) << "Initializing step filtering from macro " << macro;
274 mKeepStepFcn = o2::conf::GetFromMacro<KeepStepFcn>(macro, "keepStep()",
275 "o2::steer::O2MCApplicationBase::KeepStepFcn",
276 "o2mc_stepping_keep_step");
277 if (!mKeepStepFcn) {
278 LOG(error) << "Could not set up keepStep() from " << macro << "; ignoring it";
279 return;
280 }
281 mHasStepFilterMacro = true;
282 LOG(info) << "Step filtering initialized from macro " << macro;
283}
284
286{
287 // set up the engine seeding here, on the main thread, so that transport threads never JIT-compile it
289 // load special cuts which might be given from the outside first.
290 // the media cuts are set up once, on the master; the worker threads of multithreaded Geant4 share them
292 if (IsMasterApplication()) {
293 matMgr.loadCutsAndProcessesFromJSON(o2::base::MaterialManager::ESpecial::kTRUE);
294 matMgr.SetLowEnergyNeutronTransport(mCutParams.lowneut);
295 }
296 // During the following, FairModule::SetSpecialPhysicsCuts will be called for each module
298 // now the sensitive volumes are set up in fVolMap and we can query them
299 for (auto e : fVolMap) {
300 // since fVolMap contains multiple entries (if multiple copies), this may
301 // write to the same entry multiple times
302 mSensitiveVolumes[e.first] = e.second->GetName();
303 }
304 if (!IsMasterApplication()) {
305 return;
306 }
307 matMgr.writeCutsAndProcessesToJSON();
308 std::ofstream sensvolfile("MCStepLoggerSenVol.dat");
309 for (auto e : mSensitiveVolumes) {
310 sensvolfile << e.first << ":" << e.second << "\n";
311 }
312}
313
315{
316 for (auto det : listDetectors) {
317 if (dynamic_cast<o2::base::Detector*>(det)) {
318 ((o2::base::Detector*)det)->addAlignableVolumes();
319 }
320 }
321
322 // we stream out both unaligned geometry (to allow for
323 // dynamic post-alignment) as well as the aligned version
324 // which can be used by digitization etc. immediately
325 auto& confref = o2::conf::SimConfig::Instance();
326 auto geomfile = o2::base::NameConf::getGeomFileName(confref.getOutPrefix());
327 // since in general the geometry is a CCDB object, it must be exported under the standard name
328 gGeoManager->SetName(std::string(o2::base::NameConf::CCDBOBJECT).c_str());
329 gGeoManager->Export(geomfile.c_str());
330
331 // apply alignment for included detectors AFTER exporting ideal geometry
332 auto& aligner = o2::base::Aligner::Instance();
333 // the simulation needs no original matrices, so the physical nodes are not kept
334 aligner.applyAlignment(confref.getTimestamp(), o2::detectors::DetID::FullMask, false);
335
336 // export aligned geometry into different file
337 auto alignedgeomfile = o2::base::NameConf::getAlignedGeomFileName(confref.getOutPrefix());
338 gGeoManager->Export(alignedgeomfile.c_str());
339
341
342 // fill parallel world geometry if activated
343 if (param.useParallelWorld) {
344 TGeoParallelWorld* pw = gGeoManager->CreateParallelWorld("priority_sensors");
345 if (param.usePwGeoBVH) {
346 pw->SetAccelerationMode(TGeoParallelWorld::AccelerationMode::kBVH);
347 }
348 if (param.usePwCaching) {
349 TGeoNavigator::SetPWSafetyCaching(true);
350 }
351 for (auto det : listDetectors) {
352 if (dynamic_cast<o2::base::Detector*>(det)) {
353 ((o2::base::Detector*)det)->fillParallelWorld();
354 }
355 }
356 gGeoManager->SetUseParallelWorldNav(true);
357 }
358
359 // performs possible optimizations (shape replacements on the runtime geometry)
361
362 // alignment leaves voxels and assembly boxes to be rebuilt lazily during navigation, which
363 // is a data race between Geant4 transport threads; rebuild them here once
364 TIter nextvol(gGeoManager->GetListOfVolumes());
365 while (auto vol = static_cast<TGeoVolume*>(nextvol())) {
366 if (vol->IsAssembly()) {
367 vol->GetShape()->ComputeBBox();
368 }
369 }
370 nextvol.Reset();
371 int nvoxelized = 0;
372 while (auto vol = static_cast<TGeoVolume*>(nextvol())) {
373 if (auto voxels = vol->GetVoxels(); voxels && voxels->NeedRebuild()) {
374 voxels->Voxelize();
375 ++nvoxelized;
376 }
377 }
378 LOG(info) << "Rebuilt the voxels of " << nvoxelized << " volumes after alignment";
379
380 // return original return value of misalignment procedure
381 return true;
382}
383
385{
386 auto& g4Params = o2::conf::G4Params::Instance();
387 if (g4Params.navmode != o2::conf::EG4Nav::kTGeo) {
388 return;
389 }
390
391 // Replace TGeo shapes by other ones for performance or other reasons.
392 // Should only affect runtime of simulation.
393
394 // TODO: make this configurable via external JSON rules/macro
395
396 // Also delete original shapes for memory reasons
397
398 // We follow a visitor pattern on a geom hierarchy
399 // for now replace a TGeoTessellate by our own implementation
400 std::unordered_set<TGeoVolume*> volumes_visited;
401 std::unordered_set<TGeoShape*> old_shape_pointers;
402
403 std::function<void(TGeoNode*)> visit;
404 visit = [&](TGeoNode* node) -> void {
405 if (!node) {
406 return;
407 }
408 auto vol = node->GetVolume();
409 if (volumes_visited.find(vol) != volumes_visited.end()) {
410 return;
411 }
412 volumes_visited.insert(vol);
413
414 // transform the shape of this volume
415 auto shape = vol->GetShape();
416 if (shape->IsA() == TGeoTessellated::Class()) {
417 auto tsl = static_cast<TGeoTessellated*>(shape);
418
419 // make a new O2Tessellated until ROOT has proper support for navigation in TGeoTessellated
420 std::cout << "Converting to O2Tessellated for vol " << vol->GetName() << "\n";
421 auto replacement_shape = new o2::base::O2Tessellated(*tsl, false);
422 vol->SetShape(replacement_shape);
423 old_shape_pointers.insert(shape);
424 }
425 // other cases could come here
426
427 for (int i = 0; i < vol->GetNdaughters(); ++i) {
428 auto child_node = vol->GetNode(i);
429 visit(child_node);
430 }
431 };
432
433 visit(gGeoManager->GetTopNode());
434
435 for (auto ptr : old_shape_pointers) {
436 delete ptr;
437 ptr = nullptr;
438 }
439}
440
442{
443 LOG(info) << "This event/chunk did " << mStepCounter << " steps";
444 LOG(info) << "Longest track time is " << mLongestTrackTime;
445
447 header->getMCEventStats().setNSteps(mStepCounter);
449
450 static_cast<o2::data::Stack*>(GetStack())->updateEventStats();
451
452 // Per-track seeding used to be wired to a stack callback that one of the two
453 // engines never invoked, and it failed silently. Never again: if it was asked
454 // for and nothing was seeded, say so.
457 mTrackSeedWarned = true;
458 LOG(warn) << "Per-track seeding (SimCutParams.trackSeed) was requested but not a single track "
459 "was seeded -- neither the stack nor the PreTrack hook fired for this engine. "
460 "Seeding is NOT active.";
461 }
462}
463
465{
467
469 auto& confref = o2::conf::SimConfig::Instance();
470
471 if (confref.isFilterOutNoHitEvents() && header->getMCEventStats().getNHits() == 0) {
472 LOG(info) << "Discarding current event due to no hits";
473 SetSaveCurrentEvent(false);
474 }
475
476 // dispatch to function in FairRoot
478}
479
481{
482 // dispatch first to function in FairRoot
484
485 // register event header with our stack
487 static_cast<o2::data::Stack*>(GetStack())->setMCEventStats(&header->getMCEventStats());
488
489 mStepCounter = 0;
491}
492
494{
495 //
496 // Add particles needed for ALICE (not present in Geant3 or Geant4)
497 // Code ported 1-1 from AliRoot
498 //
499
500 LOG(info) << "Adding custom particles to VMC";
501
502 //Hypertriton
503 TVirtualMC::GetMC()->DefineParticle(1010010030, "HyperTriton", kPTHadron, 2.991134, 1.0, 2.632e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 3, kFALSE);
504 //Anti-Hypertriton
505 TVirtualMC::GetMC()->DefineParticle(-1010010030, "AntiHyperTriton", kPTHadron, 2.991134, 1.0, 2.632e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 3, kFALSE);
506
507 //Hyper hydrogen 4 ground state
508 TVirtualMC::GetMC()->DefineParticle(1010010040, "Hyperhydrog4", kPTHadron, 3.922434, 1.0, 2.08e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
509 //Anti-Hyper hydrogen 4 ground state
510 TVirtualMC::GetMC()->DefineParticle(-1010010040, "AntiHyperhydrog4", kPTHadron, 3.922434, 1.0, 2.08e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
511
512 //Hyper helium 4 ground state
513 TVirtualMC::GetMC()->DefineParticle(1010020040, "Hyperhelium4", kPTHadron, 3.921728, 2.0, 2.50e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
514 //Anti-Hyper helium 4 ground state
515 TVirtualMC::GetMC()->DefineParticle(-1010020040, "AntiHyperhelium4", kPTHadron, 3.921728, 2.0, 2.50e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
516
517 // Lithium 4 ground state
518 TVirtualMC::GetMC()->DefineParticle(1000030040, "Lithium4", kPTHadron, 3.7513, 3.0, 9.1e-23, "Ion", 0.003, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
519 // Anti-Lithium 4 ground state
520 TVirtualMC::GetMC()->DefineParticle(-1000030040, "AntiLithium4", kPTHadron, 3.7513, 3.0, 9.1e-23, "Ion", 0.003, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
521
522 //Hyper helium 5
523 TVirtualMC::GetMC()->DefineParticle(1010020050, "Hyperhelium5", kPTHadron, 4.839961, 2.0, 2.74e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 5, kFALSE);
524 //Anti-Hyper helium 5
525 TVirtualMC::GetMC()->DefineParticle(-1010020050, "AntiHyperhelium5", kPTHadron, 4.839961, 2.0, 2.74e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 5, kFALSE);
526
527 //Double Hyper hydrogen 4
528 TVirtualMC::GetMC()->DefineParticle(1020010040, "DoubleHyperhydrogen4", kPTHadron, 4.106, 1.0, 2.632e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
529 //Double Anti-Hyper hydrogen 4
530 TVirtualMC::GetMC()->DefineParticle(-1020010040, "DoubleAntiHyperhydrogen4", kPTHadron, 4.106, 1.0, 2.632e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
531
532 // 4Xi(-)H
533 TVirtualMC::GetMC()->DefineParticle(1120010040, "4XiH", kPTHadron, 4.128, 1.0, 1.639e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
534 // Anti-4Xi(-)H
535 TVirtualMC::GetMC()->DefineParticle(-1120010040, "Anti4XiH", kPTHadron, 4.128, 1.0, 1.639e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
536 // 4Xi(-)He
537 TVirtualMC::GetMC()->DefineParticle(1120020040, "4XiHe", kPTHadron, 4.128, 1.0, 1.639e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
538 // Anti-4Xi(-)He
539 TVirtualMC::GetMC()->DefineParticle(-1120020040, "Anti4XiHe", kPTHadron, 4.128, 1.0, 1.639e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
540
541 // Hyper helium 4 sigma
542 TVirtualMC::GetMC()->DefineParticle(1110020040, "Hyperhelium4sigma", kPTHadron, 3.995, 2.0, 8.018e-11, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
543 // Anti-Hyper helium 4 sigma
544 TVirtualMC::GetMC()->DefineParticle(-1110020040, "AntiHyperhelium4sigma", kPTHadron, 3.995, 2.0, 8.018e-11, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 4, kFALSE);
545
546 //Lambda-Neutron
547 TVirtualMC::GetMC()->DefineParticle(1010000020, "LambdaNeutron", kPTNeutron, 2.054, 0.0, 2.632e-10, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
548
549 //Anti-Lambda-Neutron
550 TVirtualMC::GetMC()->DefineParticle(-1010000020, "AntiLambdaNeutron", kPTNeutron, 2.054, 0.0, 2.632e-10, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
551
552 //H-Dibaryon
553 TVirtualMC::GetMC()->DefineParticle(1020000020, "Hdibaryon", kPTNeutron, 2.23, 0.0, 2.632e-10, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
554
555 //Anti-H-Dibaryon
556 TVirtualMC::GetMC()->DefineParticle(-1020000020, "AntiHdibaryon", kPTNeutron, 2.23, 0.0, 2.632e-10, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
557
558 //Xi-Proton
559 TVirtualMC::GetMC()->DefineParticle(1020010020, "Xi0Proton", kPTHadron, 2.248, 1.0, 1.333e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
560
561 //Anti-Xi-Proton
562 TVirtualMC::GetMC()->DefineParticle(-1020010020, "AntiXi0Proton", kPTHadron, 2.248, 1.0, 1.333e-10, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
563
564 //Lambda-Neutron-Neutron
565 TVirtualMC::GetMC()->DefineParticle(1010000030, "LambdaNeutronNeutron", kPTNeutron, 2.99, 0.0, 2.632e-10, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 3, kFALSE);
566
567 //Anti-Lambda-Neutron-Neutron
568 TVirtualMC::GetMC()->DefineParticle(-1010000030, "AntiLambdaNeutronNeutron", kPTNeutron, 2.99, 0.0, 2.632e-10, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 3, kFALSE);
569
570 //Omega-Proton
571 TVirtualMC::GetMC()->DefineParticle(1030000020, "OmegaProton", kPTNeutron, 2.592, 0.0, 2.632e-10, "Hadron", 0.0, 2, 1, 0, 0, 0, 0, 0, 2, kFALSE);
572
573 //Anti-Omega-Proton
574 TVirtualMC::GetMC()->DefineParticle(-1030000020, "AntiOmegaProton", kPTNeutron, 2.592, 0.0, 2.632e-10, "Hadron", 0.0, 2, 1, 0, 0, 0, 0, 0, 2, kFALSE);
575
576 //Omega-Neutron
577 TVirtualMC::GetMC()->DefineParticle(1030010020, "OmegaNeutron", kPTHadron, 2.472, 1.0, 2.190e-22, "Hadron", 0.0, 2, 1, 0, 0, 0, 0, 0, 2, kFALSE);
578
579 //Anti-Omega-Neutron
580 TVirtualMC::GetMC()->DefineParticle(-1030010020, "AntiOmegaNeutron", kPTHadron, 2.472, 1.0, 2.190e-22, "Hadron", 0.0, 2, 1, 0, 0, 0, 0, 0, 2, kFALSE);
581
582 //Omega-Omega
583 TVirtualMC::GetMC()->DefineParticle(1060020020, "OmegaOmega", kPTHadron, 3.343, -2.0, 8.21e-11, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
584
585 //Anti-Omega-Omega
586 TVirtualMC::GetMC()->DefineParticle(-1060020020, "AntiOmegaOmega", kPTHadron, 3.343, 2.0, 8.21e-11, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
587
588 //Lambda(1405)-Proton
589 TVirtualMC::GetMC()->DefineParticle(1010010021, "Lambda1405Proton", kPTHadron, 2.295, 1.0, 1.316e-23, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
590
591 //Anti-Lambda(1405)-Proton
592 TVirtualMC::GetMC()->DefineParticle(-1010010021, "AntiLambda1405Proton", kPTHadron, 2.295, 1.0, 1.316e-23, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
593
594 //Lambda(1405)-Lambda(1405)
595 TVirtualMC::GetMC()->DefineParticle(1020000021, "Lambda1405Lambda1405", kPTNeutron, 2.693, 0.0, 1.316e-23, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
596
597 //Anti-Lambda(1405)-Lambda(1405)
598 TVirtualMC::GetMC()->DefineParticle(-1020000021, "AntiLambda1405Lambda1405", kPTNeutron, 2.693, 0.0, 1.316e-23, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
599
600 //c-deuteron
601 TVirtualMC::GetMC()->DefineParticle(2010010020, "CDeuteron", kPTHadron, 3.226, 1.0, 2.0e-13, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 3, kFALSE);
602 //Anti-c-deuteron
603 TVirtualMC::GetMC()->DefineParticle(-2010010020, "AntiCDeuteron", kPTHadron, 3.226, 1.0, 2.0e-13, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 3, kFALSE);
604
605 //c-triton
606 TVirtualMC::GetMC()->DefineParticle(2010010030, "CTriton", kPTHadron, 4.162, 1.0, 2.0e-13, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
607 //Anti-c-Hypertriton
608 TVirtualMC::GetMC()->DefineParticle(-2010010030, "AntiCTriton", kPTHadron, 4.162, 1.0, 2.0e-13, "Ion", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kFALSE);
609
610 //Resonances not in Generators
611 // f0(980) assume 70 MeV as width (PDG: 40 to 100 MeV)
612 TVirtualMC::GetMC()->DefineParticle(9010221, "f0_980", kPTNeutron, 0.98, 0.0, 9.403e-24, "Hadron", 7e-2, 0, 1, 1, 0, 0, 1, 0, 0, kTRUE);
613
614 // f2(1270) (PDG: width = 186 MeV)
615 TVirtualMC::GetMC()->DefineParticle(225, "f2_1270", kPTNeutron, 1.275, 0.0, 3.538e-24, "Hadron", 0.186, 2, 1, 1, 0, 0, 1, 0, 0, kTRUE);
616
617 // f1(1285) (PDG: width = 24.20 MeV) Spin/Parity might not be correct
618 TVirtualMC::GetMC()->DefineParticle(20223, "f1_1285", kPTNeutron, 1.28210, 0.0, 1e-24, "Hadron", 0.02420, 3, 1, 0, 0, 0, 0, 0, 1, kTRUE);
619 // f1(1420) (PDG: width = 54 MeV) Spin/Parity might not be correct
620 TVirtualMC::GetMC()->DefineParticle(20333, "f1_1420", kPTNeutron, 1.42640, 0.0, 1e-24, "Hadron", 0.05490, 3, 1, 0, 0, 0, 0, 0, 1, kTRUE);
621
622 // lambda1405 (PDG: width = 50 MeV)
623 TVirtualMC::GetMC()->DefineParticle(102132, "Lambda1405", kPTNeutron, 1.405, 0.0, 1.316e-23, "Hadron", 0.050, 0, 1, 0, 0, 0, 0, 0, 2, kTRUE);
624 TVirtualMC::GetMC()->DefineParticle(-102132, "AntiLambda1405", kPTNeutron, 1.405, 0.0, 1.316e-23, "Hadron", 0.050, 0, 1, 0, 0, 0, 0, 0, 2, kTRUE);
625
626 // Glueball hunting family
627 // Their life times are not known, so we set them to 1e-24
628 // f0(1370) (PDG: width = 200-500 MeV) Spin/Parity might not be correct
629 TVirtualMC::GetMC()->DefineParticle(10221, "f0_1370", kPTNeutron, 1.37, 0.0, 1e-24, "Hadron", 0.2, 1, 1, 1, 0, 0, 1, 0, 0, kTRUE);
630 // a2(1320) (PDG: width = 107.8 MeV)
631 TVirtualMC::GetMC()->DefineParticle(115, "a2_1320", kPTNeutron, 1.3182, 0.0, 6.1e-24, "Hadron", 0.1078, 2, 1, 1, 1, 0, -1, 0, 0, kTRUE);
632 // f0(1500) (PDG: width = 112 MeV)
633 TVirtualMC::GetMC()->DefineParticle(9030221, "f0_1500", kPTNeutron, 1.506, 0.0, 1e-24, "Hadron", 0.112, 0, 1, 1, 0, 0, 1, 0, 0, kTRUE);
634 // f0(1710) (PDG: width = 150 MeV)
635 TVirtualMC::GetMC()->DefineParticle(10331, "f0_1710", kPTNeutron, 1.71, 0.0, 4.4e-24, "Hadron", 0.150, 0, 1, 1, 0, 0, 1, 0, 0, kTRUE);
636 // f2(1525) (PDG: width = 84 MeV)
637 TVirtualMC::GetMC()->DefineParticle(335, "f2_1525", kPTNeutron, 1.525, 0.0, 7.798e-24, "Hadron", 0.084, 2, 1, 1, 0, 0, 1, 0, 0, kTRUE);
638
639 // Xi_0(1820)
640 TVirtualMC::GetMC()->DefineParticle(123324, "Xi_0_1820", kPTNeutron, 1.8234, 0.0, 2.742550e-23, "Hadron", 0.024, 3, -1, 0, 1, 1, 0, 0, 1, kTRUE);
641 TVirtualMC::GetMC()->DefineParticle(-123324, "Xi_0_Bar_1820", kPTNeutron, 1.8234, 0.0, 2.742550e-23, "Hadron", 0.024, 3, -1, 0, 1, -1, 0, 0, -1, kTRUE);
642
643 int xi_0_1820_mode[6][3] = {{0}};
644 float xi_0_1820_ratio[6] = {100.f, 0.f, 0.f, 0.f, 0.f, 0.f};
645 xi_0_1820_mode[0][0] = 3122; // Lambda
646 xi_0_1820_mode[0][1] = 310; // K0s
647 TVirtualMC::GetMC()->SetDecayMode(123324, xi_0_1820_ratio, xi_0_1820_mode);
648 xi_0_1820_mode[0][0] = -3122; // Lambda-bar
649 TVirtualMC::GetMC()->SetDecayMode(-123324, xi_0_1820_ratio, xi_0_1820_mode);
650
651 // Xi-+(1820)
652 TVirtualMC::GetMC()->DefineParticle(123314, "Xi_Minus_1820", kPTHadron, 1.8234, -1.0, 2.742550e-23, "Hadron", 0.024, 3, -1, 0, 1, -1, 0, 0, 1, kTRUE);
653 TVirtualMC::GetMC()->DefineParticle(-123314, "Xi_Plus_1820", kPTHadron, 1.8234, 1.0, 2.742550e-23, "Hadron", 0.024, 3, -1, 0, 1, 1, 0, 0, -1, kTRUE);
654
655 int xi_charged_1820_mode[6][3] = {{0}};
656 float xi_charged_1820_ratio[6] = {100.f, 0.f, 0.f, 0.f, 0.f, 0.f};
657 xi_charged_1820_mode[0][0] = 3122; // Lambda
658 xi_charged_1820_mode[0][1] = -321; // K-
659 TVirtualMC::GetMC()->SetDecayMode(123314, xi_charged_1820_ratio, xi_charged_1820_mode);
660 xi_charged_1820_mode[0][0] = -3122; // Lambda-bar
661 xi_charged_1820_mode[0][1] = 321; // K+
662 TVirtualMC::GetMC()->SetDecayMode(-123314, xi_charged_1820_ratio, xi_charged_1820_mode);
663
664 // Ps - hidden strange (s-sbar) pentaquarks
665 TVirtualMC::GetMC()->DefineParticle(9322134, "Ps_2100", kPTHadron, 2.1, 1.0, 1.6455e-23, "Hadron", 4.e-2, 3, -1, 0, 0, 0, 0, 0, 1, kTRUE);
666 TVirtualMC::GetMC()->DefineParticle(-9322134, "AntiPs_2100", kPTHadron, 2.1, -1.0, 1.6455e-23, "Hadron", 4.e-2, 3, -1, 0, 0, 0, 0, 0, -1, kTRUE);
667 TVirtualMC::GetMC()->DefineParticle(9322136, "Ps_2500", kPTHadron, 2.5, 1.0, 1.6455e-23, "Hadron", 4.e-2, 5, 1, 0, 0, 0, 0, 0, 1, kTRUE);
668 TVirtualMC::GetMC()->DefineParticle(-9322136, "AntiPs_2500", kPTHadron, 2.5, -1.0, 1.6455e-23, "Hadron", 4.e-2, 5, 1, 0, 0, 0, 0, 0, -1, kTRUE);
669
670 Int_t psmode[6][3] = {0};
671 Float_t psratio[6] = {0.f};
672 psratio[0] = 100.;
673
674 psmode[0][0] = 333; // phi
675 psmode[0][1] = 2212; // proton
676 TVirtualMC::GetMC()->SetDecayMode(9322134, psratio, psmode);
677 TVirtualMC::GetMC()->SetDecayMode(9322136, psratio, psmode);
678
679 psmode[0][1] = -2212; // anti-proton
680 TVirtualMC::GetMC()->SetDecayMode(-9322134, psratio, psmode);
681 TVirtualMC::GetMC()->SetDecayMode(-9322136, psratio, psmode);
682
683 //Omega(2012)
684 for (int j = 1; j < 6; j++) {
685 psmode[j][0] = psmode[j][1] = 0;
686 psratio[j] = 0.;
687 }
688
689 TVirtualMC::GetMC()->DefineParticle(123334, "Omega_Minus_2012", kPTHadron, 2.0125, -1.0, 1.0285e-22, "Hadron", 0.0064, 3, -1, 0, 0, 0, 0, 0, 1, kTRUE);
690 psmode[0][0] = 3312; // Xi-
691 psmode[0][1] = 310; // K0S
692 psratio[0] = 100.;
693 TVirtualMC::GetMC()->SetDecayMode(123334, psratio, psmode);
694
695 TVirtualMC::GetMC()->DefineParticle(-123334, "Omega_Plus_2012", kPTHadron, 2.0125, 1.0, 1.0285e-22, "Hadron", 0.0064, 3, 1, 0, 0, 0, 0, 0, -1, kTRUE);
696 psmode[0][0] = -3312; // anti-Xi+
697 psmode[0][1] = 310; // K0S
698 psratio[0] = 100.;
699 TVirtualMC::GetMC()->SetDecayMode(-123334, psratio, psmode);
700
701 // d*(2380) - dibaryon resonance
702 TVirtualMC::GetMC()->DefineParticle(900010020, "d*_2380", kPTHadron, 2.38, 1.0, 0.94e-23, "Ion", 0.07, 6, 1, 0, 0, 0, 0, 0, 2, kTRUE);
703 TVirtualMC::GetMC()->DefineParticle(-900010020, "d*_2380_bar", kPTHadron, 2.38, -1.0, 0.94e-23, "Ion", 0.07, 6, 1, 0, 0, 0, 0, 0, -2, kTRUE);
704
705 Int_t dstmode[6][3] = {0};
706 Float_t dstratio[6] = {0.f};
707 dstratio[0] = 100; // For now we implement only the mode of interest
708 // d* -> d pi+ pi-
709 dstmode[0][0] = 1000010020; // deuteron
710 dstmode[0][1] = -211; // negative pion
711 dstmode[0][2] = 211; // positive pion
712 TVirtualMC::GetMC()->SetDecayMode(900010020, dstratio, dstmode);
713
714 dstmode[0][0] = -1000010020; // anti-deuteron
715 TVirtualMC::GetMC()->SetDecayMode(-900010020, dstratio, dstmode);
716
717 // Heavy vector mesons
718 // D*+
719 TVirtualMC::GetMC()->DefineParticle(413, "D*+", kPTHadron, 2.0103, 1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
720 // D*-
721 TVirtualMC::GetMC()->DefineParticle(-413, "D*-", kPTHadron, 2.0103, -1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
722 // D*0
723 TVirtualMC::GetMC()->DefineParticle(423, "D*0", kPTHadron, 2.0007, 0.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
724 // D*0bar
725 TVirtualMC::GetMC()->DefineParticle(-423, "D*0bar", kPTHadron, 2.0007, 0.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
726 // D*_s+
727 TVirtualMC::GetMC()->DefineParticle(433, "D*_s+", kPTHadron, 2.1123, 1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
728 // D*_s-
729 TVirtualMC::GetMC()->DefineParticle(-433, "D*_s-", kPTHadron, 2.1123, -1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
730 // B*0
731 TVirtualMC::GetMC()->DefineParticle(513, "B*0", kPTHadron, 5.3251, 0.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
732 // B*0bar
733 TVirtualMC::GetMC()->DefineParticle(-513, "B*0bar", kPTHadron, 5.3251, 0.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
734 // B*+
735 TVirtualMC::GetMC()->DefineParticle(523, "B*+", kPTHadron, 5.3251, 1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
736 // B*-
737 TVirtualMC::GetMC()->DefineParticle(-523, "B*-", kPTHadron, 5.3251, -1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
738 // B*_s0
739 TVirtualMC::GetMC()->DefineParticle(533, "B*_s0", kPTHadron, 5.4128, 0.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
740 // B*_s0bar
741 TVirtualMC::GetMC()->DefineParticle(-533, "B*_s0bar", kPTHadron, 5.4128, 0.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
742 // B*_c+
743 TVirtualMC::GetMC()->DefineParticle(543, "B*_c+", kPTHadron, 6.6020, 1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
744 // B*_c-
745 TVirtualMC::GetMC()->DefineParticle(-543, "B*_c-", kPTHadron, 6.6020, -1.0, 0.0, "Hadron", 0.0, 1, -1, 0, 0, 0, 0, 0, 0, kTRUE);
746
747 // Charm pentaquarks
748 // Theta_c: isospin singlet with J=1/2+ (see https://arxiv.org/abs/hep-ph/0409121)
749 TVirtualMC::GetMC()->DefineParticle(9422111, "Anti-Theta_c_3100", kPTHadron, 3.099, 0., 6.9e-21, "Hadron", 83.e-6, 1, 1, 0, 0, 0, 0, 0, -1, kTRUE);
750 TVirtualMC::GetMC()->DefineParticle(-9422111, "Theta_c_3100", kPTHadron, 3.099, 0., 6.9e-21, "Hadron", 83.e-6, 1, 1, 0, 0, 0, 0, 0, 1, kTRUE);
751
752 for (int j = 1; j < 6; j++) {
753 psmode[j][0] = psmode[j][1] = 0;
754 psratio[j] = 0.;
755 }
756 psmode[0][0] = 413; // D*+
757 psmode[0][1] = -2212; // anti-p
758 psratio[0] = 100.;
759 TVirtualMC::GetMC()->SetDecayMode(9422111, psratio, psmode);
760 psmode[0][0] = -413; // D*-
761 psmode[0][1] = 2212; // p
762 TVirtualMC::GetMC()->SetDecayMode(-9422111, psratio, psmode);
763
764 // Define the 2- and 3-body phase space decay for the Hyper-Triton
765 Int_t mode[6][3];
766 Float_t bratio[6];
767
768 for (Int_t kz = 0; kz < 6; kz++) {
769 bratio[kz] = 0.;
770 mode[kz][0] = 0;
771 mode[kz][1] = 0;
772 mode[kz][2] = 0;
773 }
774 bratio[0] = 50.;
775 mode[0][0] = 1000020030; // Helium3
776 mode[0][1] = -211; // negative pion
777
778 bratio[1] = 50.;
779 mode[1][0] = 1000010020; // deuteron
780 mode[1][1] = 2212; // proton
781 mode[1][2] = -211; // negative pion
782
783 TVirtualMC::GetMC()->SetDecayMode(1010010030, bratio, mode);
784
785 // Define the 2- and 3-body phase space decay for the Anti-Hyper-Triton
786 Int_t amode[6][3];
787 Float_t abratio[6];
788
789 for (Int_t kz = 0; kz < 6; kz++) {
790 abratio[kz] = 0.;
791 amode[kz][0] = 0;
792 amode[kz][1] = 0;
793 amode[kz][2] = 0;
794 }
795 abratio[0] = 50.;
796 amode[0][0] = -1000020030; // anti- Helium3
797 amode[0][1] = 211; // positive pion
798 abratio[1] = 50.;
799 amode[1][0] = -1000010020; // anti-deuteron
800 amode[1][1] = -2212; // anti-proton
801 amode[1][2] = 211; // positive pion
802
803 TVirtualMC::GetMC()->SetDecayMode(-1010010030, abratio, amode);
804
806
807 // Define the 2- and 3-body phase space decay for the Hyper Hydrogen 4
808
809 Int_t mode3[6][3];
810 Float_t bratio3[6];
811
812 for (Int_t kz = 0; kz < 6; kz++) {
813 bratio3[kz] = 0.;
814 mode3[kz][0] = 0;
815 mode3[kz][1] = 0;
816 mode3[kz][2] = 0;
817 }
818 bratio3[0] = 50.;
819 mode3[0][0] = 1000020040; // Helium4
820 mode3[0][1] = -211; // negative pion
821
822 bratio3[1] = 50.;
823 mode3[1][0] = 1000010030; // tritium
824 mode3[1][1] = 2212; // proton
825 mode3[1][2] = -211; // negative pion
826
827 TVirtualMC::GetMC()->SetDecayMode(1010010040, bratio3, mode3);
828
829 // Define the 2- and 3-body phase space decay for the Hyper Hydrogen 4
830 Int_t amode3[6][3];
831 Float_t abratio3[6];
832
833 for (Int_t kz = 0; kz < 6; kz++) {
834 abratio3[kz] = 0.;
835 amode3[kz][0] = 0;
836 amode3[kz][1] = 0;
837 amode3[kz][2] = 0;
838 }
839 abratio3[0] = 50.;
840 amode3[0][0] = -1000020040; // anti- Helium4
841 amode3[0][1] = 211; // positive pion
842 abratio3[1] = 50.;
843 amode3[1][0] = -1000010030; // anti-tritium
844 amode3[1][1] = -2212; // anti-proton
845 amode3[1][2] = 211; // positive pion
846
847 TVirtualMC::GetMC()->SetDecayMode(-1010010040, abratio3, amode3);
848
849 // Define the 3-body phase space decay for the Hyper Helium 4
850 Int_t mode4[6][3];
851 Float_t bratio4[6];
852
853 for (Int_t kz = 0; kz < 6; kz++) {
854 bratio4[kz] = 0.;
855 mode4[kz][0] = 0;
856 mode4[kz][1] = 0;
857 mode4[kz][2] = 0;
858 }
859 bratio4[0] = 50.;
860 mode4[0][0] = 1000020030; // Helium3
861 mode4[0][1] = -211; // negative pion
862 mode4[0][2] = 2212; // proton
863
864 bratio4[1] = 50.;
865 mode4[1][0] = 1000030040; // lithium-4
866 mode4[1][1] = -211; // negative pion
867
868 TVirtualMC::GetMC()->SetDecayMode(1010020040, bratio4, mode4);
869
870 // Define the 2-body phase space decay for the Anti-Hyper Helium 4
871 Int_t amode4[6][3];
872 Float_t abratio4[6];
873
874 for (Int_t kz = 0; kz < 6; kz++) {
875 abratio4[kz] = 0.;
876 amode4[kz][0] = 0;
877 amode4[kz][1] = 0;
878 amode4[kz][2] = 0;
879 }
880 abratio4[0] = 50.;
881 amode4[0][0] = -1000020030; // anti-Helium 3
882 amode4[0][1] = 211; // positive pion
883 amode4[0][2] = -2212; // anti proton
884
885 abratio4[1] = 50.;
886 amode4[1][0] = -1000030040; // antilithium-4
887 amode4[1][1] = 211; // positive pion
888
889 TVirtualMC::GetMC()->SetDecayMode(-1010020040, abratio4, amode4);
890
891 // Define the 2-body phase space decay for the Lithium 4
892 Int_t model4[6][3];
893 Float_t bratiol4[6];
894
895 for (Int_t kz = 0; kz < 6; kz++) {
896 bratiol4[kz] = 0.;
897 model4[kz][0] = 0;
898 model4[kz][1] = 0;
899 model4[kz][2] = 0;
900 }
901 bratiol4[0] = 100.;
902 model4[0][0] = 1000020030; // Helium3
903 model4[0][1] = 2212; // proton
904
905 TVirtualMC::GetMC()->SetDecayMode(1000030040, bratiol4, model4);
906
907 // Define the 2-body phase space decay for the Anti-Lithium 4
908 Int_t amodel4[6][3];
909 Float_t abratiol4[6];
910
911 for (Int_t kz = 0; kz < 6; kz++) {
912 abratiol4[kz] = 0.;
913 amodel4[kz][0] = 0;
914 amodel4[kz][1] = 0;
915 amodel4[kz][2] = 0;
916 }
917 abratiol4[0] = 100.;
918 amodel4[0][0] = -1000020030; // Anti-Helium3
919 amodel4[0][1] = -2212; // Anti-proton
920
921 TVirtualMC::GetMC()->SetDecayMode(-1000030040, abratiol4, amodel4);
922
923 // Define the 3-body phase space decay for the Hyper Helium 5
924 Int_t mode41[6][3];
925 Float_t bratio41[6];
926
927 for (Int_t kz = 0; kz < 6; kz++) {
928 bratio41[kz] = 0.;
929 mode41[kz][0] = 0;
930 mode41[kz][1] = 0;
931 mode41[kz][2] = 0;
932 }
933 bratio41[0] = 50.;
934 mode41[0][0] = 1000020040; // Helium4
935 mode41[0][1] = -211; // negative pion
936 mode41[0][2] = 2212; // proton
937 bratio41[1] = 50.;
938 mode41[1][0] = 1000020030; // Helium3
939 mode41[1][1] = -211; // negative pion
940 mode41[1][2] = 1000010020; // Deuteron
941
942 TVirtualMC::GetMC()->SetDecayMode(1010020050, bratio41, mode41);
943
944 // Define the 2-body phase space decay for the Anti-Hyper Helium 5
945 Int_t amode41[6][3];
946 Float_t abratio41[6];
947
948 for (Int_t kz = 0; kz < 6; kz++) {
949 abratio41[kz] = 0.;
950 amode41[kz][0] = 0;
951 amode41[kz][1] = 0;
952 amode41[kz][2] = 0;
953 }
954 abratio41[0] = 50.;
955 amode41[0][0] = -1000020040; // anti-Helium 4
956 amode41[0][1] = 211; // positive pion
957 amode41[0][2] = -2212; // anti proton
958 abratio41[1] = 50.;
959 amode41[1][0] = -1000020030; // anti-Helium 3
960 amode41[1][1] = 211; // positive pion
961 amode41[1][2] = -1000010020; // anti deuteron
962
963 TVirtualMC::GetMC()->SetDecayMode(-1010020050, abratio41, amode41);
964
965 // Define the 3-body phase space decay for the Double Hyper Hydrogen 4
966 Int_t mode42[6][3];
967 Float_t bratio42[6];
968
969 for (Int_t kz = 0; kz < 6; kz++) {
970 bratio42[kz] = 0.;
971 mode42[kz][0] = 0;
972 mode42[kz][1] = 0;
973 mode42[kz][2] = 0;
974 }
975 bratio42[0] = 50.;
976 mode42[0][0] = 1010020040; // Hyper-Helium4
977 mode42[0][1] = -211; // negative pion
978
979 bratio42[1] = 50.;
980 mode42[1][0] = 1010010030; // Hypertriton
981 mode42[1][1] = 2212; // proton
982 mode42[1][2] = -211; // negative pion
983
984 TVirtualMC::GetMC()->SetDecayMode(1020010040, bratio42, mode42);
985
986 // Define the 2-body phase space decay for the Anti Double Hyper Hydrogen 4
987 Int_t amode42[6][3];
988 Float_t abratio42[6];
989
990 for (Int_t kz = 0; kz < 6; kz++) {
991 abratio42[kz] = 0.;
992 amode42[kz][0] = 0;
993 amode42[kz][1] = 0;
994 amode42[kz][2] = 0;
995 }
996 abratio42[0] = 50.;
997 amode42[0][0] = -1010020040; // anti-Hyper-Helium 4
998 amode42[0][1] = 211; // positive pion
999
1000 abratio42[1] = 50.;
1001 amode42[1][0] = -1010010030; // anti-Hypertriton
1002 amode42[1][1] = -2212; // antiproton
1003 amode42[1][2] = 211; // positive pion
1004
1005 TVirtualMC::GetMC()->SetDecayMode(-1020010040, abratio42, amode42);
1006
1007 // Define the decay for the 4Xi(-)He
1008 Int_t mode4XiHe[6][3];
1009 Float_t bratio4XiHe[6];
1010
1011 for (Int_t kz = 0; kz < 6; kz++) {
1012 bratio4XiHe[kz] = 0.;
1013 mode4XiHe[kz][0] = 0;
1014 mode4XiHe[kz][1] = 0;
1015 mode4XiHe[kz][2] = 0;
1016 }
1017 bratio4XiHe[0] = 33.;
1018 mode4XiHe[0][0] = 1010020040; // HyperHelium4
1019 mode4XiHe[0][1] = -211; // negative pion
1020
1021 bratio4XiHe[1] = 33.;
1022 mode4XiHe[1][0] = 3122; // lambda
1023 mode4XiHe[1][1] = 1000020030; // helium-3
1024 mode4XiHe[1][2] = -211; // negative pion
1025
1026 bratio4XiHe[2] = 33.;
1027 mode4XiHe[2][0] = 1000030040; // lithium-4
1028 mode4XiHe[2][1] = -211; // negative pion
1029 mode4XiHe[2][2] = -211; // negative pion
1030
1031 TVirtualMC::GetMC()->SetDecayMode(1120020040, bratio4XiHe, mode4XiHe);
1032
1033 // Define the decay for the Anti-4Xi(-)He
1034 Int_t amode4XiHe[6][3];
1035 Float_t abratio4XiHe[6];
1036
1037 for (Int_t kz = 0; kz < 6; kz++) {
1038 abratio4XiHe[kz] = 0.;
1039 amode4XiHe[kz][0] = 0;
1040 amode4XiHe[kz][1] = 0;
1041 amode4XiHe[kz][2] = 0;
1042 }
1043 abratio4XiHe[0] = 33.;
1044 amode4XiHe[0][0] = -1010020040; // antiHyperHelium-4
1045 amode4XiHe[0][1] = 211; // positive pion
1046
1047 abratio4XiHe[1] = 33.;
1048 amode4XiHe[1][0] = -3122; // antilambda
1049 amode4XiHe[1][1] = -1000020030; // antihelium-3
1050 amode4XiHe[1][2] = 211; // positive pion
1051
1052 abratio4XiHe[2] = 33.;
1053 amode4XiHe[2][0] = -1000030040; // antilithium-4
1054 amode4XiHe[2][1] = 211; // positive pion
1055 amode4XiHe[2][2] = 211; // positive pion
1056
1057 TVirtualMC::GetMC()->SetDecayMode(-1120020040, abratio4XiHe, amode4XiHe);
1058
1059 // Define the decay for the 4Xi(-)H
1060 Int_t mode4XiH[6][3];
1061 Float_t bratio4XiH[6];
1062
1063 for (Int_t kz = 0; kz < 6; kz++) {
1064 bratio4XiH[kz] = 0.;
1065 mode4XiH[kz][0] = 0;
1066 mode4XiH[kz][1] = 0;
1067 mode4XiH[kz][2] = 0;
1068 }
1069 bratio4XiH[0] = 33.;
1070 mode4XiH[0][0] = 1010010040; // HyperHydrogen4
1071 mode4XiH[0][1] = -211; // negative pion
1072
1073 bratio4XiH[1] = 33.;
1074 mode4XiH[1][0] = 3122; // lambda
1075 mode4XiH[1][1] = 1000010030; // triton
1076 mode4XiH[1][2] = -211; // negative pion
1077
1078 bratio4XiH[2] = 33.;
1079 mode4XiH[2][0] = 1000020040; // alpha
1080 mode4XiH[2][1] = -211; // negative pion
1081 mode4XiH[2][2] = -211; // negative pion
1082
1083 TVirtualMC::GetMC()->SetDecayMode(1120010040, bratio4XiH, mode4XiH);
1084
1085 // Define the decay for the Anti-4Xi(-)H
1086 Int_t amode4XiH[6][3];
1087 Float_t abratio4XiH[6];
1088
1089 for (Int_t kz = 0; kz < 6; kz++) {
1090 abratio4XiH[kz] = 0.;
1091 amode4XiH[kz][0] = 0;
1092 amode4XiH[kz][1] = 0;
1093 amode4XiH[kz][2] = 0;
1094 }
1095 abratio4XiH[0] = 33.;
1096 amode4XiH[0][0] = -1010010040; // antiHyperHydrogen-4
1097 amode4XiH[0][1] = 211; // positive pion
1098
1099 abratio4XiH[1] = 33.;
1100 amode4XiH[1][0] = -3122; // antilambda
1101 amode4XiH[1][1] = -1000010030; // antitriton
1102 amode4XiH[1][2] = 211; // positive pion
1103
1104 abratio4XiH[2] = 33.;
1105 amode4XiH[2][0] = -1000020040; // antialpha
1106 amode4XiH[2][1] = 211; // positive pion
1107 amode4XiH[2][2] = 211; // positive pion
1108
1109 TVirtualMC::GetMC()->SetDecayMode(-1120010040, abratio4XiH, amode4XiH);
1110
1111 // Define the 2- and 3-body phase space decay for the Hyper Helium 4 sigma
1112 Int_t mode4s[6][3];
1113 Float_t bratio4s[6];
1114
1115 for (Int_t kz = 0; kz < 6; kz++) {
1116 bratio4s[kz] = 0.;
1117 mode4s[kz][0] = 0;
1118 mode4s[kz][1] = 0;
1119 mode4s[kz][2] = 0;
1120 }
1121 bratio4s[0] = 20.;
1122 mode4s[0][0] = 1000020040; // Helium4
1123 mode4s[0][1] = 111; // pion0
1124 bratio4s[1] = 40.;
1125 mode4s[1][0] = 1000010030; // tritium
1126 mode4s[1][2] = 2212; // proton
1127 mode4s[1][1] = 111; // pion0
1128 bratio4s[2] = 40.;
1129 mode4s[2][0] = 1000010030; // tritium
1130 mode4s[2][2] = 211; // pion+
1131 mode4s[2][1] = 2112; // neutron
1132
1133 TVirtualMC::GetMC()->SetDecayMode(1110020040, bratio4s, mode4s);
1134
1135 // Define the 2- and 3-body phase space decay for the Anti Hyper Helium 4 sigma
1136 Int_t amode4s[6][3];
1137 Float_t abratio4s[6];
1138
1139 for (Int_t kz = 0; kz < 6; kz++) {
1140 abratio4s[kz] = 0.;
1141 amode4s[kz][0] = 0;
1142 amode4s[kz][1] = 0;
1143 amode4s[kz][2] = 0;
1144 }
1145 abratio4s[0] = 20.;
1146 amode4s[0][0] = -1000020040; // anti-Helium4
1147 amode4s[0][1] = 111; // pion0
1148 abratio4s[1] = 40.;
1149 amode4s[1][0] = -1000010030; // anti-tritium
1150 amode4s[1][2] = -2212; // anti-proton
1151 amode4s[1][1] = 111; // pion0
1152 abratio4s[2] = 40.;
1153 amode4s[2][0] = -1000010030; // anti-tritium
1154 amode4s[2][2] = -211; // pion-
1155 amode4s[2][1] = -2112; // anti-neutron
1156
1157 TVirtualMC::GetMC()->SetDecayMode(-1110020040, abratio4s, amode4s);
1158
1159 // Define the 2-body phase space decay for the Lambda-neutron boundstate
1160 Int_t mode1[6][3];
1161 Float_t bratio1[6];
1162
1163 for (Int_t kz = 0; kz < 6; kz++) {
1164 bratio1[kz] = 0.;
1165 mode1[kz][0] = 0;
1166 mode1[kz][1] = 0;
1167 mode1[kz][2] = 0;
1168 }
1169 bratio1[0] = 100.;
1170 mode1[0][0] = 1000010020; // deuteron
1171 mode1[0][1] = -211; // negative pion
1172
1173 TVirtualMC::GetMC()->SetDecayMode(1010000020, bratio1, mode1);
1174
1175 // Define the 2-body phase space decay for the Anti-Lambda-neutron boundstate
1176 Int_t amode1[6][3];
1177 Float_t abratio1[6];
1178
1179 for (Int_t kz = 0; kz < 6; kz++) {
1180 abratio1[kz] = 0.;
1181 amode1[kz][0] = 0;
1182 amode1[kz][1] = 0;
1183 amode1[kz][2] = 0;
1184 }
1185 abratio1[0] = 100.;
1186 amode1[0][0] = -1000010020; // anti-deuteron
1187 amode1[0][1] = 211; // positive pion
1188
1189 TVirtualMC::GetMC()->SetDecayMode(-1010000020, abratio1, amode1);
1190
1191 // Define the 2-body phase space decay for the H-Dibaryon
1192 Int_t mode2[6][3];
1193 Float_t bratio2[6];
1194
1195 for (Int_t kz = 0; kz < 6; kz++) {
1196 bratio2[kz] = 0.;
1197 mode2[kz][0] = 0;
1198 mode2[kz][1] = 0;
1199 mode2[kz][2] = 0;
1200 }
1201 bratio2[0] = 100.;
1202 mode2[0][0] = 3122; // Lambda
1203 mode2[0][1] = 2212; // proton
1204 mode2[0][2] = -211; // negative pion
1205
1206 TVirtualMC::GetMC()->SetDecayMode(1020000020, bratio2, mode2);
1207
1208 // Define the 2-body phase space decay for the Anti-H-Dibaryon
1209 Int_t amode2[6][3];
1210 Float_t abratio2[6];
1211
1212 for (Int_t kz = 0; kz < 6; kz++) {
1213 abratio2[kz] = 0.;
1214 amode2[kz][0] = 0;
1215 amode2[kz][1] = 0;
1216 amode2[kz][2] = 0;
1217 }
1218 abratio2[0] = 100.;
1219 amode2[0][0] = -3122; // anti-deuteron
1220 amode2[0][1] = -2212; // anti-proton
1221 amode2[0][2] = 211; // positive pion
1222
1223 TVirtualMC::GetMC()->SetDecayMode(-1020000020, abratio2, amode2);
1224
1225 // Define the 2-body phase space decay for the Xi0P
1226 Int_t mode5[6][3];
1227 Float_t bratio5[6];
1228
1229 for (Int_t kz = 0; kz < 6; kz++) {
1230 bratio5[kz] = 0.;
1231 mode5[kz][0] = 0;
1232 mode5[kz][1] = 0;
1233 mode5[kz][2] = 0;
1234 }
1235 bratio5[0] = 100.;
1236 mode5[0][0] = 3122; // Lambda
1237 mode5[0][1] = 2212; // proton
1238
1239 TVirtualMC::GetMC()->SetDecayMode(1020010020, bratio5, mode5);
1240
1241 // Define the 2-body phase space decay for the Anti-Xi0P
1242 Int_t amode5[6][3];
1243 Float_t abratio5[6];
1244
1245 for (Int_t kz = 0; kz < 6; kz++) {
1246 abratio5[kz] = 0.;
1247 amode5[kz][0] = 0;
1248 amode5[kz][1] = 0;
1249 amode5[kz][2] = 0;
1250 }
1251 abratio5[0] = 100.;
1252 amode5[0][0] = -3122; // anti-Lambda
1253 amode5[0][1] = -2212; // anti-proton
1254
1255 TVirtualMC::GetMC()->SetDecayMode(-1020010020, abratio5, amode5);
1256
1257 // Define the 2-body phase space decay for the Lambda-Neutron-Neutron
1258 Int_t mode6[6][3];
1259 Float_t bratio6[6];
1260
1261 for (Int_t kz = 0; kz < 6; kz++) {
1262 bratio6[kz] = 0.;
1263 mode6[kz][0] = 0;
1264 mode6[kz][1] = 0;
1265 mode6[kz][2] = 0;
1266 }
1267 bratio6[0] = 100.;
1268 mode6[0][0] = 1000010030; // triton
1269 mode6[0][1] = -211; // pion
1270
1271 TVirtualMC::GetMC()->SetDecayMode(1010000030, bratio6, mode6);
1272
1273 // Define the 2-body phase space decay for the Anti-Lambda-Neutron-Neutron
1274 Int_t amode6[6][3];
1275 Float_t abratio6[6];
1276
1277 for (Int_t kz = 0; kz < 6; kz++) {
1278 abratio6[kz] = 0.;
1279 amode6[kz][0] = 0;
1280 amode6[kz][1] = 0;
1281 amode6[kz][2] = 0;
1282 }
1283 abratio6[0] = 100.;
1284 amode6[0][0] = -1000010030; // anti-triton
1285 amode6[0][1] = 211; // pion
1286
1287 TVirtualMC::GetMC()->SetDecayMode(-1010000030, abratio6, amode6);
1288
1289 // Define the 3-body phase space decay for the Omega-Proton
1290 Int_t mode7[6][3];
1291 Float_t bratio7[6];
1292
1293 for (Int_t kz = 0; kz < 6; kz++) {
1294 bratio7[kz] = 0.;
1295 mode7[kz][0] = 0;
1296 mode7[kz][1] = 0;
1297 mode7[kz][2] = 0;
1298 }
1299 bratio7[0] = 100.;
1300 mode7[0][0] = 3122; // Lambda
1301 mode7[0][1] = -321; // negative Kaon
1302 mode7[0][2] = 2212; // proton
1303
1304 TVirtualMC::GetMC()->SetDecayMode(1030000020, bratio7, mode7);
1305
1306 // Define the 3-body phase space decay for the Anti-Omega-Proton
1307 Int_t amode7[6][3];
1308 Float_t abratio7[6];
1309
1310 for (Int_t kz = 0; kz < 6; kz++) {
1311 abratio7[kz] = 0.;
1312 amode7[kz][0] = 0;
1313 amode7[kz][1] = 0;
1314 amode7[kz][2] = 0;
1315 }
1316 abratio7[0] = 100.;
1317 amode7[0][0] = -3122; // anti-Lambda
1318 amode7[0][1] = 321; // positive kaon
1319 amode7[0][2] = -2212; // anti-proton
1320
1321 TVirtualMC::GetMC()->SetDecayMode(-1030000020, abratio7, amode7);
1322
1323 // Define the 2-body phase space decay for the Omega-Neutron
1324 Int_t mode8[6][3];
1325 Float_t bratio8[6];
1326
1327 for (Int_t kz = 0; kz < 6; kz++) {
1328 bratio8[kz] = 0.;
1329 mode8[kz][0] = 0;
1330 mode8[kz][1] = 0;
1331 mode8[kz][2] = 0;
1332 }
1333 bratio8[0] = 100.;
1334 mode8[0][0] = 3122; // Lambda
1335 mode8[0][1] = 3312; // negative Xi
1336
1337 TVirtualMC::GetMC()->SetDecayMode(1030010020, bratio8, mode8);
1338
1339 // Define the 2-body phase space decay for the Anti-Omega-Neutron
1340 Int_t amode8[6][3];
1341 Float_t abratio8[6];
1342
1343 for (Int_t kz = 0; kz < 6; kz++) {
1344 abratio8[kz] = 0.;
1345 amode8[kz][0] = 0;
1346 amode8[kz][1] = 0;
1347 amode8[kz][2] = 0;
1348 }
1349 abratio8[0] = 100.;
1350 amode8[0][0] = -3122; // anti-Lambda
1351 amode8[0][1] = -3312; // positive Xi
1352
1353 TVirtualMC::GetMC()->SetDecayMode(-1030010020, abratio8, amode8);
1354
1355 // Define the 3-body phase space decay for the Omega-Omega
1356 // Assuming that one of the Omegas decays freely inside the nucleus
1357 Int_t mode9[6][3];
1358 Float_t bratio9[6];
1359
1360 for (Int_t kz = 0; kz < 6; kz++) {
1361 bratio9[kz] = 0.;
1362 mode9[kz][0] = 0;
1363 mode9[kz][1] = 0;
1364 mode9[kz][2] = 0;
1365 }
1366 bratio9[0] = 68.;
1367 mode9[0][0] = 3334; // negative Omega
1368 mode9[0][1] = 3122; // Lambda
1369 mode9[0][2] = -321; // negative Kaon
1370 bratio9[1] = 24;
1371 mode9[1][0] = 3334; // negative Omega
1372 mode9[1][1] = 3322; // neutral Xi
1373 mode9[1][2] = -211; // negative pion
1374 bratio9[2] = 8.;
1375 mode9[2][0] = 3334; // negative Omega
1376 mode9[2][1] = 3312; // negative Xi
1377 mode9[2][2] = 111; // neutral pion
1378
1379 TVirtualMC::GetMC()->SetDecayMode(1060020020, bratio9, mode9);
1380
1381 // Define the 3-body phase space decay for the Anti-Omega-Omega
1382 Int_t amode9[6][3];
1383 Float_t abratio9[6];
1384
1385 for (Int_t kz = 0; kz < 6; kz++) {
1386 abratio9[kz] = 0.;
1387 amode9[kz][0] = 0;
1388 amode9[kz][1] = 0;
1389 amode9[kz][2] = 0;
1390 }
1391 abratio9[0] = 68.;
1392 amode9[0][0] = -3334; // positive Omega
1393 amode9[0][1] = -3122; // anti-Lambda
1394 amode9[0][2] = 321; // positive Kaon
1395 abratio9[1] = 24.;
1396 amode9[1][0] = -3334; // positive Omega
1397 amode9[1][1] = -3322; // anti-neutral Xi
1398 amode9[1][2] = 211; // positive pion
1399 abratio9[2] = 8.;
1400 amode9[2][0] = -3334; // positive Omega
1401 amode9[2][1] = -3312; // positive Xi
1402 amode9[2][2] = 111; // neutral pion
1403
1404 TVirtualMC::GetMC()->SetDecayMode(-1060020020, abratio9, amode9);
1405
1406 // Define the 2- and 3-body phase space decay for the Lambda(1405)-Proton
1407 Int_t mode10[6][3];
1408 Float_t bratio10[6];
1409
1410 for (Int_t kz = 0; kz < 6; kz++) {
1411 bratio10[kz] = 0.;
1412 mode10[kz][0] = 0;
1413 mode10[kz][1] = 0;
1414 mode10[kz][2] = 0;
1415 }
1416 bratio10[0] = 50.;
1417 mode10[0][0] = 3122; // Lambda
1418 mode10[0][1] = 2212; // proton
1419 bratio10[1] = 50.;
1420 mode10[1][0] = 2212; // proton
1421 mode10[1][1] = -321; // negative kaon
1422 mode10[1][2] = 2212; // proton
1423
1424 TVirtualMC::GetMC()->SetDecayMode(1010010021, bratio10, mode10);
1425
1426 // Define the 2- and 3-body phase space decay for the Anti-Lambda(1405)-Proton
1427 Int_t amode10[6][3];
1428 Float_t abratio10[6];
1429
1430 for (Int_t kz = 0; kz < 6; kz++) {
1431 abratio10[kz] = 0.;
1432 amode10[kz][0] = 0;
1433 amode10[kz][1] = 0;
1434 amode10[kz][2] = 0;
1435 }
1436 abratio10[0] = 50.;
1437 amode10[0][0] = -3122; // anti-Lambda
1438 amode10[0][1] = -2212; // anti-proton
1439 abratio10[1] = 50.;
1440 amode10[1][0] = -2212; // anti-proton
1441 amode10[1][1] = 321; // positive kaon
1442 amode10[1][2] = -2212; // anti-proton
1443
1444 TVirtualMC::GetMC()->SetDecayMode(-1010010021, abratio10, amode10);
1445
1446 // Define the 3-body phase space decay for the Lambda(1405)-Lambda(1405)
1447 Int_t mode11[6][3];
1448 Float_t bratio11[6];
1449
1450 for (Int_t kz = 0; kz < 6; kz++) {
1451 bratio11[kz] = 0.;
1452 mode11[kz][0] = 0;
1453 mode11[kz][1] = 0;
1454 mode11[kz][2] = 0;
1455 }
1456 bratio11[0] = 50.;
1457 mode11[0][0] = 3122; // Lambda
1458 mode11[0][1] = 3122; // Lambda
1459 bratio11[1] = 50.;
1460 mode11[1][0] = 3122; // Lambda
1461 mode11[1][1] = 2212; // proton
1462 mode11[1][2] = -211; // negative pion
1463
1464 TVirtualMC::GetMC()->SetDecayMode(1020000021, bratio11, mode11);
1465
1466 // Define the 3-body phase space decay for the Anti-Lambda(1405)-Lambda(1405)
1467 Int_t amode11[6][3];
1468 Float_t abratio11[6];
1469
1470 for (Int_t kz = 0; kz < 6; kz++) {
1471 abratio11[kz] = 0.;
1472 amode11[kz][0] = 0;
1473 amode11[kz][1] = 0;
1474 amode11[kz][2] = 0;
1475 }
1476 abratio11[0] = 50.;
1477 amode11[0][0] = -3122; // anti-Lambda
1478 amode11[0][1] = -3122; // anti-Lambda
1479 abratio11[1] = 50.;
1480 amode11[1][0] = -3122; // anti-Lambda
1481 amode11[1][1] = -2212; // anti-proton
1482 amode11[1][2] = 211; // positive pion
1483
1484 TVirtualMC::GetMC()->SetDecayMode(-1020000021, abratio11, amode11);
1485
1486 // Define the decays for the c-triton
1487 Int_t ctmode[6][3];
1488 Float_t ctbratio[6];
1489
1490 for (Int_t kz = 0; kz < 6; kz++) {
1491 ctbratio[kz] = 0.;
1492 ctmode[kz][0] = 0;
1493 ctmode[kz][1] = 0;
1494 ctmode[kz][2] = 0;
1495 }
1496 ctbratio[0] = 50.;
1497 ctmode[0][0] = 1000020030; // Helium3
1498 ctmode[0][1] = 310; // K0s
1499
1500 ctbratio[1] = 50.;
1501 ctmode[1][0] = 1000020030; // Helium3
1502 ctmode[1][1] = -321; // negative kaon
1503 ctmode[1][2] = 211; // positive pion
1504
1505 TVirtualMC::GetMC()->SetDecayMode(2010010030, ctbratio, ctmode);
1506
1507 // Define the decays for the anti-c-triton
1508 Int_t actmode[6][3];
1509 Float_t actbratio[6];
1510
1511 for (Int_t kz = 0; kz < 6; kz++) {
1512 actbratio[kz] = 0.;
1513 actmode[kz][0] = 0;
1514 actmode[kz][1] = 0;
1515 actmode[kz][2] = 0;
1516 }
1517 actbratio[0] = 50.;
1518 actmode[0][0] = -1000020030; // Helium3
1519 actmode[0][1] = 310; // K0s
1520
1521 actbratio[1] = 50.;
1522 actmode[1][0] = -1000020030; // Helium3
1523 actmode[1][1] = 321; // negative kaon
1524 actmode[1][2] = -211; // positive pion
1525
1526 TVirtualMC::GetMC()->SetDecayMode(-2010010030, actbratio, actmode);
1527
1528 // Define the decays for the c-deuteron
1529 Int_t cdmode[6][3];
1530 Float_t cdbratio[6];
1531
1532 for (Int_t kz = 0; kz < 6; kz++) {
1533 cdbratio[kz] = 0.;
1534 cdmode[kz][0] = 0;
1535 cdmode[kz][1] = 0;
1536 cdmode[kz][2] = 0;
1537 }
1538 cdbratio[0] = 50.;
1539 cdmode[0][0] = 1000010020; // deuteron
1540 cdmode[0][1] = -321; // negative kaon
1541 cdmode[0][2] = 211; // positive pion
1542
1543 cdbratio[1] = 50.;
1544 cdmode[1][0] = 1000010020; // deuteron
1545 cdmode[1][1] = 310; // K0s
1546
1547 TVirtualMC::GetMC()->SetDecayMode(2010010020, cdbratio, cdmode);
1548
1549 // Define the decays for the anti-c-deuteron
1550 Int_t acdmode[6][3];
1551 Float_t acdbratio[6];
1552
1553 for (Int_t kz = 0; kz < 6; kz++) {
1554 acdbratio[kz] = 0.;
1555 acdmode[kz][0] = 0;
1556 acdmode[kz][1] = 0;
1557 acdmode[kz][2] = 0;
1558 }
1559 acdbratio[0] = 50.;
1560 acdmode[0][0] = -1000010020; // deuteron
1561 acdmode[0][1] = 321; // negative kaon
1562 acdmode[0][2] = -211; // positive pion
1563
1564 acdbratio[1] = 50.;
1565 acdmode[1][0] = -1000010020; // deuteron
1566 acdmode[1][1] = 310; // K0s
1567
1568 TVirtualMC::GetMC()->SetDecayMode(-2010010020, acdbratio, acdmode);
1569
1571
1572 // Define the 2-body phase space decay for the f0(980)
1573 // Int_t mode[6][3];
1574 // Float_t bratio[6];
1575
1576 for (Int_t kz = 0; kz < 6; kz++) {
1577 bratio[kz] = 0.;
1578 mode[kz][0] = 0;
1579 mode[kz][1] = 0;
1580 mode[kz][2] = 0;
1581 }
1582 bratio[0] = 100.;
1583 mode[0][0] = 211; // pion
1584 mode[0][1] = -211; // pion
1585
1586 TVirtualMC::GetMC()->SetDecayMode(9010221, bratio, mode);
1587
1588 // Define the 2-body phase space decay for the f2(1270)
1589
1590 // for (Int_t kz = 0; kz < 6; kz++) {
1591 // bratio[kz] = 0.;
1592 // mode[kz][0] = 0;
1593 // mode[kz][1] = 0;
1594 // mode[kz][2] = 0;
1595 // }
1596 // bratio[0] = 100.;
1597 // mode[0][0] = 211; // pion
1598 // mode[0][1] = -211; // pion
1599
1600 // TVirtualMC::GetMC()->SetDecayMode(225, bratio, mode);
1601
1602 // Define the 2-body phase space decay for the resonances: f0(1500), f2(1525), f0(1710), f0(1370), a2(1320), f2(1270)
1603 for (Int_t kz = 0; kz < 6; kz++) {
1604 bratio[kz] = 0.;
1605 mode[kz][0] = 0;
1606 mode[kz][1] = 0;
1607 mode[kz][2] = 0;
1608 }
1609 bratio[0] = 100.;
1610 mode[0][0] = 310; // K0s
1611 mode[0][1] = 310; // K0s
1612
1613 TVirtualMC::GetMC()->SetDecayMode(9030221, bratio, mode); // f0(1500)
1614 TVirtualMC::GetMC()->SetDecayMode(335, bratio, mode); // f2(1525)
1615 TVirtualMC::GetMC()->SetDecayMode(10331, bratio, mode); // f0(1710)
1616 TVirtualMC::GetMC()->SetDecayMode(10221, bratio, mode); // f0(1370)
1617 TVirtualMC::GetMC()->SetDecayMode(115, bratio, mode); // a2(1320)
1618 TVirtualMC::GetMC()->SetDecayMode(225, bratio, mode); // f2(1270)
1619
1620 // Define the 3-body phase space decay for the resonances: f1(1285), f1(1420)
1621 for (Int_t kz = 0; kz < 6; kz++) {
1622 bratio[kz] = 0.;
1623 mode[kz][0] = 0;
1624 mode[kz][1] = 0;
1625 mode[kz][2] = 0;
1626 }
1627
1628 bratio2[0] = 50.;
1629 mode[0][0] = 310; // K0s
1630 mode[0][1] = -321; // anti-K
1631 mode[0][2] = 211; // pion+
1632
1633 bratio2[1] = 50.;
1634 mode[1][0] = 310; // K0s
1635 mode[1][1] = 321; // K
1636 mode[1][2] = -211; // pion-
1637
1638 TVirtualMC::GetMC()->SetDecayMode(20223, bratio2, mode); // f1(1285)
1639 TVirtualMC::GetMC()->SetDecayMode(20333, bratio2, mode); // f1(1420)
1640
1641 // Define the decay modes for the Lambda(1405)
1642 for (Int_t kz = 0; kz < 6; kz++) {
1643 bratio[kz] = 0.;
1644 mode[kz][0] = 0;
1645 mode[kz][1] = 0;
1646 mode[kz][2] = 0;
1647 }
1648 // 33.3 % sigma-pi+, sigma+pi-, sigma0pi0
1649 bratio[0] = 33.3;
1650 mode[0][0] = 3112; // Sigma-
1651 mode[0][1] = 211; // negative pion
1652 bratio[1] = 33.3;
1653 mode[1][0] = 3222; // Sigma+
1654 mode[1][1] = -211; // positive pion
1655 bratio[2] = 33.3;
1656 mode[2][0] = 3212; // Sigma0
1657 mode[2][1] = 111; // neutral pion
1658 TVirtualMC::GetMC()->SetDecayMode(102132, bratio, mode); // Lambda(1405)
1659 // Define the decay modes for the Anti-Lambda(1405)
1660 for (Int_t kz = 0; kz < 6; kz++) {
1661 abratio[kz] = 0.;
1662 amode[kz][0] = 0;
1663 amode[kz][1] = 0;
1664 amode[kz][2] = 0;
1665 }
1666 // 33.3 % sigma-pi-, sigma-pi+, sigma0pi0
1667 abratio[0] = 33.3;
1668 amode[0][0] = -3112; // AntiSigma-
1669 amode[0][1] = -211; // positive pion
1670 abratio[1] = 33.3;
1671 amode[1][0] = -3222; // AntiSigma+
1672 amode[1][1] = 211; // negative pion
1673 abratio[2] = 33.3;
1674 amode[2][0] = -3212; // Sigma0
1675 amode[2][1] = 111; // negative pion
1676 TVirtualMC::GetMC()->SetDecayMode(-102132, abratio, amode); // Anti-Lambda(1405)
1677
1678 // Lambda1520/Lambda1520bar
1679
1680 TVirtualMC::GetMC()->DefineParticle(102134, "Lambda1520", kPTNeutron, 1.5195, 0.0, 4.22e-23, "Hadron", 0.0156, 3, -1, 0, 0, 0, 0, 0, 1, kTRUE);
1681 TVirtualMC::GetMC()->DefineParticle(-102134, "Lambda1520bar", kPTNeutron, 1.5195, 0.0, 4.22e-23, "Hadron", 0.0156, 3, -1, 0, 0, 0, 0, 0, -1, kTRUE);
1682
1683 // Lambda1520 decay modes
1684 Int_t lmode[9][3];
1685 Float_t lbratio[9];
1686 for (Int_t kz = 0; kz < 9; kz++) {
1687 lbratio[kz] = 0.;
1688 lmode[kz][0] = 0;
1689 lmode[kz][1] = 0;
1690 lmode[kz][2] = 0;
1691 }
1692
1693 // L(1520) -> p K-
1694 lbratio[0] = 0.229944;
1695 lmode[0][0] = 2212;
1696 lmode[0][1] = -321;
1697
1698 // L(1520) -> n K0
1699 lbratio[1] = 0.229944;
1700 lmode[1][0] = 2112;
1701 lmode[1][1] = -311;
1702
1703 // L(1520) -> Sigma+ pi-
1704 lbratio[2] = 0.143076;
1705 lmode[2][0] = 3222;
1706 lmode[2][1] = -211;
1707
1708 // L(1520) -> Sigma0 pi0
1709 lbratio[3] = 0.143076;
1710 lmode[3][0] = 3212;
1711 lmode[3][1] = 111;
1712
1713 // L(1520) -> Sigma- pi+
1714 lbratio[4] = 0.143076;
1715 lmode[4][0] = 3112;
1716 lmode[4][1] = 211;
1717
1718 // L(1520) -> Sigma*- pi+
1719 lbratio[5] = 0.034066;
1720 lmode[5][0] = 3114;
1721 lmode[5][1] = 211;
1722
1723 // L(1520) -> Sigma*0 pi0
1724 lbratio[6] = 0.034066;
1725 lmode[6][0] = 3214;
1726 lmode[6][1] = 111;
1727
1728 // L(1520) -> Sigma*+ pi-
1729 lbratio[7] = 0.034066;
1730 lmode[7][0] = 3224;
1731 lmode[7][1] = -211;
1732
1733 // L(1520) -> Lambda gamma
1734 lbratio[8] = 0.008687;
1735 lmode[8][0] = 3122;
1736 lmode[8][1] = 22;
1737
1738 TVirtualMC::GetMC()->SetDecayMode(102134, lbratio, lmode);
1739
1740 // Lambda1520bar decay modes
1741
1742 // L(1520)bar -> p- K+
1743 lbratio[0] = 0.229944;
1744 lmode[0][0] = -2212;
1745 lmode[0][1] = 321;
1746
1747 // L(1520)bar -> nbar K0bar
1748 lbratio[1] = 0.229944;
1749 lmode[1][0] = -2112;
1750 lmode[1][1] = 311;
1751
1752 // L(1520)bar -> Sigmabar- pi+
1753 lbratio[2] = 0.143076;
1754 lmode[2][0] = -3222;
1755 lmode[2][1] = 211;
1756
1757 // L(1520)bar -> Sigma0bar pi0
1758 lbratio[3] = 0.143076;
1759 lmode[3][0] = -3212;
1760 lmode[3][1] = 111;
1761
1762 // L(1520)bar -> Sigmabar+ pi-
1763 lbratio[4] = 0.143076;
1764 lmode[4][0] = -3112;
1765 lmode[4][1] = -211;
1766
1767 // L(1520)bar -> anti-Sigma*- pi-
1768 lbratio[5] = 0.034066;
1769 lmode[5][0] = -3114;
1770 lmode[5][1] = -211;
1771
1772 // L(1520)bar -> anti-Sigma*0 pi0
1773 lbratio[6] = 0.034066;
1774 lmode[6][0] = -3214;
1775 lmode[6][1] = 111;
1776
1777 // L(1520)bar -> anti-Sigma*+ pi+
1778 lbratio[7] = 0.034066;
1779 lmode[7][0] = -3224;
1780 lmode[7][1] = 211;
1781
1782 // L(1520)bar -> Anti-Lambda gamma
1783 lbratio[8] = 0.008687;
1784 lmode[8][0] = -3122;
1785 lmode[8][1] = 22;
1786
1787 TVirtualMC::GetMC()->SetDecayMode(-102134, lbratio, lmode);
1788
1789 // --------------------------------------------------------------------
1790
1791 //Sexaquark (uuddss): compact, neutral and stable hypothetical bound state (arxiv.org/abs/1708.08951)
1792 TVirtualMC::GetMC()->DefineParticle(900000020, "Sexaquark", kPTUndefined, 2.0, 0.0, 4.35e+17, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, 2, kTRUE);
1793 TVirtualMC::GetMC()->DefineParticle(-900000020, "AntiSexaquark", kPTUndefined, 2.0, 0.0, 4.35e+17, "Hadron", 0.0, 0, 1, 0, 0, 0, 0, 0, -2, kTRUE);
1794
1795 // BSM Monopoles, defined only when their physics is enabled (G4.monopole=1), so that a
1796 // monopole primary without it is reported by the engine instead of crossing the detector unseen.
1797 // The transported mass has to match the one the generator used; see
1798 // G4Params.monopoleMass and o2::sim::MonopoleMassDefaultGeV.
1799 // To-do: find a way to define multiple masses for monopoles species
1800 if (!o2::conf::G4Params::Instance().monopole) {
1801 return;
1802 }
1803 const double monopoleMass = o2::conf::G4Params::Instance().monopoleMass;
1804 if (!(monopoleMass > 0.)) {
1805 LOG(fatal) << "G4.monopoleMass must be positive, got " << monopoleMass;
1806 }
1807 // kPTUndefined: Geant4-VMC attaches no process to them (a kPTHadron would get hIoni and hmsc);
1808 // their ionisation and transport are attached by O2MonopolePhysics
1809 // Symmetric monopoles: same electric and magnetic charge
1810 TVirtualMC::GetMC()->DefineParticle(4110000, "Monopole_symm", kPTUndefined, monopoleMass, 0.0, 1e10, "BSM", 0.0, 0, 0, 0, 0, 0, 0, 0, 0, kTRUE);
1811 TVirtualMC::GetMC()->DefineParticle(-4110000, "AntiMonopole_symm", kPTUndefined, monopoleMass, 0.0, 1e10, "BSM", 0.0, 0, 0, 0, 0, 0, 0, 0, 0, kTRUE);
1812 // Asymmetric monopoles: opposite electric and magnetic charge
1813 TVirtualMC::GetMC()->DefineParticle(4120000, "Monopole_asymm", kPTUndefined, monopoleMass, 0.0, 1e10, "BSM", 0.0, 0, 0, 0, 0, 0, 0, 0, 0, kTRUE);
1814 TVirtualMC::GetMC()->DefineParticle(-4120000, "AntiMonopole_asymm", kPTUndefined, monopoleMass, 0.0, 1e10, "BSM", 0.0, 0, 0, 0, 0, 0, 0, 0, 0, kTRUE);
1815}
1816
1818{
1819 // dispatch first to function in FairRoot
1821
1822 // register special particles for ALICE
1823 // TODO: try to make use of FairRoot if easier or more customizable
1825
1827 LOG(info) << "Printing \'SimUserDecay\' parameters";
1828 LOG(info) << param;
1829
1830 // check if there are PDG codes requested for user decay
1831 if (param.pdglist.empty()) {
1832 return;
1833 }
1834
1835 // loop over PDG codes in the string
1836 std::stringstream ss(param.pdglist);
1837 int pdg;
1838 while (ss >> pdg) {
1839 LOG(info) << "Setting user decay for PDG " << pdg;
1840 TVirtualMC::GetMC()->SetUserDecay(pdg);
1841 }
1842}
1843
1845{
1847 LOG(info) << "Initializing the hook for TrackReferences during stepping";
1848 auto expandedTrackRefHookFileName = o2::utils::expandShellVarsInFileName(mCutParams.stepTrackRefHookFile);
1849 if (std::filesystem::exists(expandedTrackRefHookFileName)) {
1850 // if this file exists we will compile the hook on the fly
1851 mTrackRefFcn = o2::conf::GetFromMacro<TrackRefFcn>(mCutParams.stepTrackRefHookFile, "trackRefHook()", "o2::steer::O2MCApplicationBase::TrackRefFcn", "o2mc_stepping_trackref_hook");
1852 LOG(info) << "Hook initialized from file " << expandedTrackRefHookFileName;
1853 } else {
1854 LOG(error) << "Did not file TrackRefHook file " << expandedTrackRefHookFileName << " ; Will not execute hook";
1855 mTrackRefFcn = [](TVirtualMC const*) {}; // do nothing
1856 }
1857 }
1858}
1859
1861{
1862 const bool isMT = fRun && fRun->IsMT();
1863 if (isMT) {
1864 // detectors are enabled for multithreaded Geant4 one by one; other modules make no hits
1865 for (auto det : listActiveDetectors) {
1866 auto o2det = dynamic_cast<o2::base::Detector*>(det);
1867 if (o2det && !o2det->isMTSafe()) {
1868 LOG(fatal) << "Detector " << det->GetName() << " is not yet supported in multithreaded mode (--isMT)";
1869 }
1870 }
1871 }
1873 if (isMT) {
1874 return; // the hit buffers belong to the detector clones of the worker threads
1875 }
1876 for (auto det : listActiveDetectors) {
1877 if (dynamic_cast<o2::base::Detector*>(det)) {
1878 ((o2::base::Detector*)det)->initializeLate();
1879 }
1880 }
1881}
1882
1883void O2MCApplication::attachSubEventInfo(fair::mq::Parts& parts, o2::data::SubEventInfo const& info) const
1884{
1885 // parts.AddPart(std::move(mSimDataChannel->NewSimpleMessage(info)));
1887}
1888
1889// helper function to fetch data from FairRootManager branch and serialize it
1890// returns handle to container
1891template <typename T>
1892const T* attachBranch(std::string const& name, fair::mq::Channel& channel, fair::mq::Parts& parts)
1893{
1894 auto mgr = FairRootManager::Instance();
1895 // check if branch is present
1896 if (mgr->GetBranchId(name) == -1) {
1897 LOG(error) << "Branch " << name << " not found";
1898 return nullptr;
1899 }
1900 auto data = mgr->InitObjectAs<const T*>(name.c_str());
1901 if (data) {
1902 o2::base::attachTMessage(*data, channel, parts);
1903 }
1904 return data;
1905}
1906
1908{
1909 mSubEventInfo = i;
1910 // being communicated a SubEventInfo also means we get a FairMCEventHeader
1912}
1913
1915{
1916 fair::mq::Parts simdataparts;
1917
1918 // fill these parts ... the receiver has to unpack similary
1919 // TODO: actually we could just loop over branches in FairRootManager at this moment?
1920 mSubEventInfo->npersistenttracks = static_cast<o2::data::Stack*>(GetStack())->getMCTracks()->size();
1921 mSubEventInfo->nprimarytracks = static_cast<o2::data::Stack*>(GetStack())->GetNprimary();
1922 attachSubEventInfo(simdataparts, *mSubEventInfo);
1923 auto tracks = attachBranch<std::vector<o2::MCTrack>>("MCTrack", *mSimDataChannel, simdataparts);
1924 attachBranch<std::vector<o2::TrackReference>>("TrackRefs", *mSimDataChannel, simdataparts);
1925 assert(tracks->size() == mSubEventInfo->npersistenttracks);
1926
1927 for (auto det : listActiveDetectors) {
1928 if (dynamic_cast<o2::base::Detector*>(det)) {
1929 ((o2::base::Detector*)det)->attachHits(*mSimDataChannel, simdataparts);
1930 }
1931 }
1932 LOG(info) << "sending message with " << simdataparts.Size() << " parts";
1933 mSimDataChannel->Send(simdataparts);
1934}
1935
1936namespace
1937{
1938// serialises the set-up of the worker threads of multithreaded Geant4
1939std::mutex gWorkerSetupMutex;
1940
1941// the sink of a worker thread in multithreaded mode: its output goes to the hit merger with every event
1942class WorkerSink : public FairSink
1943{
1944 public:
1945 Bool_t InitSink() override { return kTRUE; }
1946 void Close() override {}
1947 void Reset() override {}
1948 Sink_Type GetSinkType() override { return kONLINESINK; }
1949 void SetOutTree(TTree*) override {}
1950 void Fill() override {}
1951 Int_t Write(const char*, Int_t, Int_t) override { return 0; }
1952 void RegisterImpl(const char*, const char*, void*) override {}
1953 void RegisterAny(const char*, const std::type_info&, const std::type_info&, void*) override {}
1954 void WriteFolder() override {}
1955 bool CreatePersistentBranchesAny() override { return true; }
1956 void WriteObject(TObject*, const char*, Int_t) override {}
1957 void WriteGeometry() override {}
1958 FairSink* CloneSink() override { return new WorkerSink(); }
1959};
1960} // namespace
1961
1965
1967{
1968 std::lock_guard<std::mutex> lock(gWorkerSetupMutex);
1969 // the run object of the worker thread (FairRunSim::Instance() is thread-local), without generator
1970 auto workerRun = new FairRunSim(kFALSE);
1971 workerRun->SetName(fRun->GetName());
1972 workerRun->SetIsMT(kTRUE);
1973 workerRun->SetSink(new WorkerSink());
1974 return new O2MCApplication(*this);
1975}
1976
1978{
1979 std::lock_guard<std::mutex> lock(gWorkerSetupMutex);
1980 mIsMTWorker = true;
1984 fMC = TVirtualMC::GetMC();
1985 fMC->SetStack(fStack);
1986 fMC->SetMagField(fxField);
1987 // the modules were cloned before this thread's MC existed
1988 for (auto obj : *fModules) {
1989 if (auto module = dynamic_cast<FairModule*>(obj)) {
1990 module->SetMC(fMC);
1991 }
1992 }
1993 // the stack's output branches in this thread's FairRootManager
1994 fStack->Register();
1995 // this thread's own transport random generator
1996 mWorkerRandom = std::make_unique<TRandom3>();
1997 o2::base::setSimRandom(mWorkerRandom.get());
1998 // this thread's own external decayer; set here, before Geant4 builds the physics of this thread
1999 auto& hooks = o2::base::MTWorkerHooks::instance();
2000 if (hooks.makeDecayer) {
2001 fMC->SetExternalDecayer(hooks.makeDecayer());
2002 }
2003}
2004
2006{
2007 if (auto& hook = o2::base::MTWorkerHooks::instance().beginRunOnWorker) {
2008 hook();
2009 }
2010}
2011
2013{
2014 // nothing to finish on a worker: its output went to the hit merger with every event
2015}
2016
2018{
2019 if (mIsMTWorker) {
2020 fetchWorkerChunk();
2021 }
2023}
2024
2025bool O2MCApplication::isSelectedSubEvent(int eventID, int part)
2026{
2027 static const auto selection = []() -> std::optional<std::pair<int, int>> {
2028 auto env = getenv("O2SIM_RESTRICT_EVENTPART");
2029 if (!env) {
2030 return std::nullopt;
2031 }
2032 const std::string value(env);
2033 const auto pos = value.find(':');
2034 if (pos == std::string::npos) {
2035 return std::make_pair(0, 0);
2036 }
2037 return std::make_pair(std::atoi(value.substr(0, pos).c_str()), std::atoi(value.substr(pos + 1).c_str()));
2038 }();
2039 return !selection || (selection->first == eventID && selection->second == part);
2040}
2041
2042void O2MCApplication::fetchWorkerChunk()
2043{
2044 auto& hooks = o2::base::MTWorkerHooks::instance();
2045 if (!mWorkerInitialized) { // the first sub-event of this thread
2046 mSimDataChannel = hooks.dataChannel();
2047 for (auto det : listActiveDetectors) {
2048 if (auto o2det = dynamic_cast<o2::base::Detector*>(det)) {
2049 o2det->initializeLate();
2050 }
2051 }
2052 mWorkerInitialized = true;
2053 }
2054 auto chunk = hooks.fetchChunk();
2055 mIsEndOfWork = !chunk;
2056 if (mIsEndOfWork) {
2057 // transport an empty event and leave the event loop after it
2058 mPrimaries.clear();
2059 mWorkerSubEventInfo = o2::data::SubEventInfo{};
2060 setSubEventInfo(&mWorkerSubEventInfo);
2061 hooks.stopWorker();
2062 return;
2063 }
2064 mWorkerSubEventInfo = chunk->mSubEventInfo;
2065 if (isSelectedSubEvent(mWorkerSubEventInfo.eventID, mWorkerSubEventInfo.part)) {
2066 setPrimaries(std::move(chunk->mParticles));
2067 } else {
2068 setPrimaries(std::vector<TParticle>{});
2069 LOG(info) << "This chunk will be skipped";
2070 }
2071 setSubEventInfo(&mWorkerSubEventInfo);
2072 LOG(info) << "Processing " << mPrimaries.size() << " primary particles for event " << mWorkerSubEventInfo.eventID << "/"
2073 << mWorkerSubEventInfo.maxEvents << " part " << mWorkerSubEventInfo.part << "/" << mWorkerSubEventInfo.nparts;
2074 if (!getenv("O2_DISABLE_REPRODUCIBLE_SIM")) {
2075 o2::base::simRandom()->SetSeed(mWorkerSubEventInfo.seed);
2077 }
2078}
2079
2080} // namespace steer
2081} // namespace o2
Definition of the Detector class.
uint32_t hash
std::unique_ptr< expressions::Node > node
Sink_Type
Definition FairSink.h:33
@ kONLINESINK
Definition FairSink.h:34
std::vector< std::string > header
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
char error[CURL_ERROR_SIZE]
std::vector< o2::its::TrackITS > tracks
Definition of the Names Generator class.
uint16_t pos
Definition RawData.h:3
uint32_t j
Definition RawData.h:0
TBranch * ptr
virtual void Register()
virtual void AddParticles()
std::list< FairDetector * > listActiveDetectors
Bool_t IsMasterApplication() const
virtual void FinishEvent()
FairMCEventHeader * fMCEventHeader
FairGenericStack * fStack
virtual void BeginEvent()
std::map< Int_t, Int_t > fModVolMap
FairRootManager * fRootManager
std::list< FairDetector * > listDetectors
void SetSaveCurrentEvent(Bool_t set)
FairGenericStack * GetStack()
virtual void ConstructGeometry()
std::multimap< Int_t, FairVolume * > fVolMap
virtual void InitGeometry()
static FairRootManager * Instance()
Bool_t IsMT() const
Definition FairRunSim.h:180
static FairRunSim * Instance()
static std::vector< int > const & getDetId2HitBitIndex()
Definition Detector.h:244
static MaterialManager & Instance()
static std::string getAlignedGeomFileName(const std::string_view prefix="")
Definition NameConf.cxx:47
static std::string getGeomFileName(const std::string_view prefix="")
Definition NameConf.cxx:41
static constexpr std::string_view CCDBOBJECT
Definition NameConf.h:66
unsigned long long getSeedCount() const
how often a seed was propagated; lets callers detect a silent no-op
static VMCSeederService const & instance()
static SimConfig & Instance()
Definition SimConfig.h:112
static constexpr int nameToID(char const *name, int id=First)
Definition DetID.h:157
static mask_t getMask(const std::string_view detList)
detector masks from any non-alpha-num delimiter-separated list (empty if NONE is supplied)
Definition DetID.cxx:43
void finishEventCommon()
some common parts of finishEvent
o2::conf::SimCutParams const & mCutParams
std::map< int, std::string > mSensitiveVolumes
std::map< int, std::string > mModIdToName
o2::data::SubEventInfo * mSubEventInfo
generic channel on which to send sim data
fair::mq::Channel * mSimDataChannel
static bool isSelectedSubEvent(int eventID, int part)
whether a sub-event passes the O2SIM_RESTRICT_EVENTPART ("event:part") selection, a debugging aid
void BeginEvent() override
a worker thread asks the primary server for its sub-event here, as a worker process does before Proce...
void attachSubEventInfo(fair::mq::Parts &, o2::data::SubEventInfo const &info) const
void setPrimaries(std::vector< TParticle > const &p)
std::vector< TParticle > mPrimaries
O2MCApplication(const O2MCApplication &rhs)
TVirtualMCApplication * CloneForWorker() const override
void setSubEventInfo(o2::data::SubEventInfo *i)
static ShmManager & Instance()
Definition ShmManager.h:62
void occupySegment(bool wholeRegion=false)
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint const GLchar * name
Definition glcorearb.h:781
GLint y
Definition glcorearb.h:270
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLenum const GLfloat * params
Definition glcorearb.h:272
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint GLsizei const GLchar * message
Definition glcorearb.h:2517
GLenum GLfloat param
Definition glcorearb.h:271
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
void setSimRandom(TRandom *random)
Install the transport generator of the calling thread (not owned); nullptr reverts to gRandom.
Definition SimRandom.cxx:24
void attachTMessage(Container const &hits, fair::mq::Channel &channel, fair::mq::Parts &parts)
Definition Detector.h:292
TRandom * simRandom()
Definition SimRandom.cxx:22
const T * attachBranch(std::string const &name, fair::mq::Channel &channel, fair::mq::Parts &parts)
void addSpecialParticles()
void TypedVectorAttach(const char *name, fair::mq::Channel &channel, fair::mq::Parts &parts)
std::string expandShellVarsInFileName(std::string const &input)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static MTWorkerHooks & instance()
std::string stepFilteringMacro
Definition SimParams.h:26
std::string stepTrackRefHookFile
Definition SimParams.h:28
o2::dataformats::MCEventHeader mMCEventHeader
target1_1 Fill(5)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
ctfTree Write()