19#include "Ex03DetectorConstructionOld.h"
20#include "Ex03MCStack.h"
21#include "Ex03PrimaryGenerator.h"
23#include <TMCRootManager.h>
26#include <TGeoManager.h>
27#include <TGeoUniformMagField.h>
28#include <TInterpreter.h>
34#include <TVirtualGeoTrack.h>
35#include <TVirtualMC.h>
63 cout <<
"--------------------------------------------------------------"
65 cout <<
" VMC Example E03" << endl;
66 cout <<
"--------------------------------------------------------------"
183 if (TString(setup) !=
"") {
184 gROOT->LoadMacro(setup);
185 gInterpreter->ProcessLine(
"Config()");
188 "InitMC",
"Processing Config() has failed. (No MC is instantiated.)");
193#if ROOT_VERSION_CODE >= 336402
196 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
201 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
221 gMC->ProcessRun(nofEvents);
250 fRootManager =
new TMCRootManager(GetName(), TMCRootManager::kWrite);
325 gMC->DefineParticle(1000020050,
"He5", kPTHadron, 5.03427, 2.0, 0.002,
"Ion",
326 0.0, 0, 1, 0, 0, 0, 0, 0, 5, kFALSE);
332 for (Int_t kz = 0; kz < 6; kz++) {
339 mode[0][0] = kNeutron;
340 mode[0][1] = 1000020040;
342 gMC->SetDecayMode(1000020050, bratio, mode);
353 for (Int_t kz = 0; kz < 6; kz++) {
363 gMC->SetDecayMode(kK0Short, bratio2, mode2);
373 gMC->DefineIon(
"MyIon", 34, 70, 12, 0.);
397 if (TString(gMC->GetName()) ==
"TGeant3TGeo" &&
398 gGeoManager->GetListOfTracks() && gGeoManager->GetTrack(0) &&
399 ((TVirtualGeoTrack*)gGeoManager->GetTrack(0))->HasPoints()) {
401 gGeoManager->ClearTracks();
407 cout <<
"\n---> Begin of event: " <<
fEventNo << endl;
423 cout <<
" Primary track ID = " <<
fStack->GetCurrentTrackNumber() << endl;
439 Int_t parentID =
fStack->GetCurrentParentTrackNumber();
442 fStack->GetParticle(parentID)->GetPdgCode() == kK0Short &&
443 fStack->GetCurrentTrack()->GetUniqueID() == kPDecay) {
447 cout <<
" Current track " <<
fStack->GetCurrentTrack()->GetName()
448 <<
" is a decay product of Parent ID = "
449 <<
fStack->GetCurrentParentTrackNumber() << endl;
463 static Int_t trackId = 0;
464 if (TString(gMC->GetName()) ==
"TFluka" &&
465 gMC->GetStack()->GetCurrentTrackNumber() != trackId) {
467 trackId = gMC->GetStack()->GetCurrentTrackNumber();
504 if (TString(gMC->GetName()) ==
"TGeant3TGeo") {
507 gGeoManager->SetVisOption(0);
508 gGeoManager->SetTopVisible();
509 gGeoManager->GetTopVolume()->Draw();
514 if (gGeoManager->GetListOfTracks() && gGeoManager->GetTrack(0) &&
515 ((TVirtualGeoTrack*)gGeoManager->GetTrack(0))->HasPoints()) {
517 gGeoManager->DrawTracks(
"/*");
Definition of the Ex03MCApplication class.
The calorimeter sensitive detector.
The old detector construction (via VMC functions)
void ConstructMaterials()
The detector construction (via TGeo )
Implementation of the TVirtualMCApplication.
Int_t fPrintModulo
The event modulus number to be printed.
virtual ~Ex03MCApplication()
TGeoUniformMagField * fMagField
Magnetic field.
Bool_t fIsControls
Option to activate special controls.
TMCVerbose fVerbose
VMC verbose helper.
Bool_t fIsMaster
If is on master thread.
Ex03PrimaryGenerator * fPrimaryGenerator
Primary generator.
void RegisterStack() const
Ex03MCStack * fStack
VMC stack.
Ex03CalorimeterSD * fCalorimeterSD
Calorimeter SD.
Ex03MCApplication(const char *name, const char *title)
Ex03DetectorConstruction * fDetConstruction
Dector construction.
Bool_t fOldGeometry
Option for geometry definition.
Int_t fEventNo
Event counter.
TMCRootManager * fRootManager
Root manager.
Implementation of the TVirtualMCStack interface.
virtual void BeginPrimary()
virtual void GeneratePrimaries()
virtual TVirtualMCApplication * CloneForWorker() const
void InitMC(const char *setup)
virtual void BeginEvent()
virtual void InitGeometry()
void RunMC(Int_t nofEvents)
virtual void AddParticles()
virtual void FinishRunOnWorker()
virtual void FinishPrimary()
virtual void ConstructGeometry()
virtual void FinishEvent()
void RegisterStack() const
virtual void InitOnWorker()