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 E03b: new version with sensitive detectors" << endl;
66 cout <<
"--------------------------------------------------------------"
82 fMagField =
new TGeoUniformMagField();
89 fPrintModulo(origin.fPrintModulo),
91 fVerbose(origin.fVerbose),
93 fDetConstruction(origin.fDetConstruction),
97 fOldGeometry(origin.fOldGeometry),
128 fPrimaryGenerator(0),
130 fOldGeometry(kFALSE),
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);
310 std::cout <<
"--- Construct sensitive detectors" << std::endl;
318 gMC->SetSensitiveDetector(
"ABSO", calorimeterSD);
319 gMC->SetSensitiveDetector(
"GAPX", calorimeterSD);
344 gMC->DefineParticle(1000020050,
"He5", kPTHadron, 5.03427, 2.0, 0.002,
"Ion",
345 0.0, 0, 1, 0, 0, 0, 0, 0, 5, kFALSE);
351 for (Int_t kz = 0; kz < 6; kz++) {
358 mode[0][0] = kNeutron;
359 mode[0][1] = 1000020040;
361 gMC->SetDecayMode(1000020050, bratio, mode);
372 for (Int_t kz = 0; kz < 6; kz++) {
382 gMC->SetDecayMode(kK0Short, bratio2, mode2);
392 gMC->DefineIon(
"MyIon", 34, 70, 12, 0.);
416 if (TString(gMC->GetName()) ==
"TGeant3TGeo" &&
417 gGeoManager->GetListOfTracks() && gGeoManager->GetTrack(0) &&
418 ((TVirtualGeoTrack*)gGeoManager->GetTrack(0))->HasPoints()) {
420 gGeoManager->ClearTracks();
426 cout <<
"\n---> Begin of event: " <<
fEventNo << endl;
467 <<
" is a decay product of Parent ID = "
482 static Int_t trackId = 0;
483 if (TString(gMC->GetName()) ==
"TFluka" &&
484 gMC->GetStack()->GetCurrentTrackNumber() != trackId) {
486 trackId = gMC->GetStack()->GetCurrentTrackNumber();
533 if (TString(gMC->GetName()) ==
"TGeant3TGeo") {
536 gGeoManager->SetVisOption(0);
537 gGeoManager->SetTopVisible();
538 gGeoManager->GetTopVolume()->Draw();
543 if (gGeoManager->GetListOfTracks() && gGeoManager->GetTrack(0) &&
544 ((TVirtualGeoTrack*)gGeoManager->GetTrack(0))->HasPoints()) {
546 gGeoManager->DrawTracks(
"/*");
Definition of the Ex03bMCApplication class.
The old detector construction (via VMC functions)
void ConstructMaterials()
The detector construction (via TGeo )
Double_t GetCalorSizeYZ() const
void ConstructMaterials()
Double_t GetWorldSizeX() const
Implementation of the TVirtualMCStack interface.
virtual TParticle * GetCurrentTrack() const
virtual Int_t GetCurrentTrackNumber() const
virtual Int_t GetCurrentParentTrackNumber() const
TParticle * GetParticle(Int_t id) const
virtual void GeneratePrimaries(const TVector3 &worldSize)
Bool_t GetUserDecay() const
Return true if particle with user decay is activated.
The calorimeter sensitive detector.
void SetPrintModulo(Int_t value)
Implementation of the TVirtualMCApplication.
virtual void BeginPrimary()
virtual void GeneratePrimaries()
virtual TVirtualMCApplication * CloneForWorker() const
Ex03PrimaryGenerator * fPrimaryGenerator
Primary generator.
void InitMC(const char *setup)
Bool_t fIsControls
Option to activate special controls.
Ex03bCalorimeterSD * fCalorimeterSD
Calorimeter SD.
virtual void BeginEvent()
virtual ~Ex03bMCApplication()
TGeoUniformMagField * fMagField
Magnetic field.
virtual void InitGeometry()
Int_t fPrintModulo
The event modulus number to be printed.
Int_t fEventNo
Event counter.
void RunMC(Int_t nofEvents)
virtual void AddParticles()
virtual void FinishRunOnWorker()
virtual void FinishPrimary()
Bool_t fIsMaster
If is on master thread.
virtual void ConstructGeometry()
TMCRootManager * fRootManager
Root manager.
virtual void ConstructSensitiveDetectors()
Ex03DetectorConstruction * fDetConstruction
Dector construction.
virtual void FinishEvent()
Bool_t fOldGeometry
Option for geometry definition.
void RegisterStack() const
virtual void EndOfEvent()
TMCVerbose fVerbose
VMC verbose helper.
Ex03MCStack * fStack
VMC stack.
virtual void InitOnWorker()