7 #include <G4SteppingManager.hh> 8 #include <G4SteppingVerbose.hh> 12 class Output :
public G4SteppingVerbose {
18 G4SteppingVerbose::TrackingStarted();
22 G4SteppingVerbose::StepInfo();
81 #include <G4AnalysisManager.hh> 83 auto manager = G4AnalysisManager::Instance();
84 manager->CreateNtuple(
"t",
"Geant4 step points");
85 manager->CreateNtupleIColumn(
"n");
86 manager->CreateNtupleIColumn(
"m");
87 manager->CreateNtupleIColumn(
"trk",
trk);
88 manager->CreateNtupleIColumn(
"stp",
stp);
89 manager->CreateNtupleIColumn(
"vlm",
vlm);
90 manager->CreateNtupleIColumn(
"pro",
pro);
91 manager->CreateNtupleIColumn(
"pdg",
pdg);
92 manager->CreateNtupleIColumn(
"pid",
pid);
93 manager->CreateNtupleDColumn(
"xx",
xx);
94 manager->CreateNtupleDColumn(
"yy",
yy);
95 manager->CreateNtupleDColumn(
"zz",
zz);
96 manager->CreateNtupleDColumn(
"dt",
dt);
97 manager->CreateNtupleDColumn(
"de",
de);
98 manager->CreateNtupleDColumn(
"dl",
dl);
99 manager->CreateNtupleDColumn(
"l",
l);
100 manager->CreateNtupleDColumn(
"x",
x);
101 manager->CreateNtupleDColumn(
"y",
y);
102 manager->CreateNtupleDColumn(
"z",
z);
103 manager->CreateNtupleDColumn(
"t",
t);
104 manager->CreateNtupleDColumn(
"k",
k);
105 manager->CreateNtupleDColumn(
"p",
p);
106 manager->CreateNtupleDColumn(
"px",
px);
107 manager->CreateNtupleDColumn(
"py",
py);
108 manager->CreateNtupleDColumn(
"pz",
pz);
109 manager->CreateNtupleDColumn(
"q",
q);
110 manager->CreateNtupleDColumn(
"et",
et);
111 manager->FinishNtuple();
115 #include <G4NavigationHistory.hh> 117 if (GetSilent() == 1)
120 G4TouchableHandle handle = fStep->GetPreStepPoint()->GetTouchableHandle();
121 int copyNo = handle->GetReplicaNumber();
124 if (
trk.size() >= 10000) {
125 G4cout <<
"GEARS: # of step points >=10000. Recording stopped." << G4endl;
126 fTrack->SetTrackStatus(fKillTrackAndSecondaries);
130 trk.push_back(fTrack->GetTrackID());
131 stp.push_back(fTrack->GetCurrentStepNumber());
132 vlm.push_back(copyNo);
133 pdg.push_back(fTrack->GetDefinition()->GetPDGEncoding());
134 pid.push_back(fTrack->GetParentID());
135 if (
stp.back() == 0) {
137 pro.push_back(fTrack->GetCreatorProcess()->GetProcessType() * 1000 +
138 fTrack->GetCreatorProcess()->GetProcessSubType());
142 const G4VProcess *pr = fStep->GetPostStepPoint()->GetProcessDefinedStep();
144 pro.push_back(pr->GetProcessType() * 1000 + pr->GetProcessSubType());
149 k.push_back(fTrack->GetKineticEnergy() / CLHEP::keV);
150 p.push_back(fTrack->GetMomentum().mag() / CLHEP::keV);
151 q.push_back(fStep->GetPostStepPoint()->GetCharge());
152 l.push_back(fTrack->GetTrackLength() / CLHEP::mm);
154 px.push_back(fTrack->GetMomentumDirection().x());
155 py.push_back(fTrack->GetMomentumDirection().y());
156 pz.push_back(fTrack->GetMomentumDirection().z());
157 de.push_back(fStep->GetTotalEnergyDeposit() / CLHEP::keV);
158 dl.push_back(fTrack->GetStepLength() / CLHEP::mm);
160 t.push_back(fTrack->GetGlobalTime() / CLHEP::ns);
161 x.push_back(fTrack->GetPosition().x() / CLHEP::mm);
162 y.push_back(fTrack->GetPosition().y() / CLHEP::mm);
163 z.push_back(fTrack->GetPosition().z() / CLHEP::mm);
165 G4ThreeVector pos = handle->GetHistory()->GetTopTransform().TransformPoint(
166 fStep->GetPostStepPoint()->GetPosition());
167 xx.push_back(pos.x() / CLHEP::mm);
168 yy.push_back(pos.y() / CLHEP::mm);
169 zz.push_back(pos.z() / CLHEP::mm);
170 dt.push_back(fTrack->GetLocalTime() / CLHEP::ns);
173 G4StrUtil::contains(handle->GetVolume()->GetName(),
"(S)")) {
174 if (
et.size() < (
unsigned int)copyNo + 1)
175 et.resize((
unsigned int)copyNo + 1);
176 et[copyNo] +=
de.back();
182 #include <G4OpticalSurface.hh> 197 #include <G4tgrLineProcessor.hh> 203 G4MaterialPropertiesTable *
204 CreateMaterialPropertiesTable(
const vector<G4String> &words,
227 G4bool ProcessLine(
const vector<G4String> &words);
232 #include <G4NistManager.hh> 233 #include <G4UImessenger.hh> 234 #include <G4tgbMaterialMgr.hh> 237 G4bool processed = G4tgrLineProcessor::ProcessLine(words);
242 G4String tag = words[0];
243 G4StrUtil::to_lower(tag);
244 if (tag.substr(0, 5) ==
":prop") {
245 G4NistManager *mgr = G4NistManager::Instance();
247 G4Material *m = mgr->FindOrBuildMaterial(words[1]);
249 m = G4tgbMaterialMgr::GetInstance()->FindOrBuildG4Material(words[1]);
250 G4cout <<
"GEARS: Set optical properties of " << words[1] <<
":" << G4endl;
251 m->SetMaterialPropertiesTable(CreateMaterialPropertiesTable(words, 2));
253 }
else if (tag.substr(0, 5) ==
":surf") {
257 bdr->
name = words[1];
260 bdr->optic =
new G4OpticalSurface(words[1]);
262 G4cout <<
"GEARS: Set optical properties of " << bdr->name <<
":"<< G4endl;
264 while (i < words.size()) {
265 G4String setting = words[i], value = words[i + 1];
266 G4StrUtil::to_lower(setting); G4StrUtil::to_lower(value);
267 if (setting ==
"property") {
270 }
else if (setting ==
"type") {
271 if (value ==
"dielectric_metal")
272 bdr->optic->SetType(dielectric_metal);
273 else if (value ==
"dielectric_dielectric")
274 bdr->optic->SetType(dielectric_dielectric);
275 else if (value ==
"dielectric_lut")
276 bdr->optic->SetType(dielectric_LUT);
277 else if (value ==
"dielectric_lutdavis")
278 bdr->optic->SetType(dielectric_LUTDAVIS);
279 else if (value ==
"dielectric_dichroic")
280 bdr->optic->SetType(dielectric_dichroic);
281 else if (value ==
"firsov")
282 bdr->optic->SetType(firsov);
283 else if (value ==
"x_ray")
284 bdr->optic->SetType(x_ray);
285 else if (value ==
"coated")
286 bdr->optic->SetType(coated);
288 G4cout <<
"GEARS: Ignore unknown surface type " << value << G4endl;
289 G4cout <<
"GEARS: type = " << value << G4endl;
290 }
else if (setting ==
"model") {
291 if (value ==
"glisur")
292 bdr->optic->SetModel(glisur);
293 else if (value ==
"unified")
294 bdr->optic->SetModel(unified);
295 else if (value ==
"lut")
296 bdr->optic->SetModel(LUT);
297 else if (value ==
"davis")
298 bdr->optic->SetModel(DAVIS);
299 else if (value ==
"dichroic")
300 bdr->optic->SetModel(dichroic);
302 G4cout <<
"GEARS: Ignore unknown surface model " << value << G4endl;
303 G4cout <<
"GEARS: model = " << value << G4endl;
304 }
else if (setting ==
"finish") {
305 if (value ==
"polished") bdr->optic->SetFinish(polished);
306 else if (value ==
"polishedfrontpainted") bdr->optic->SetFinish(polishedfrontpainted);
307 else if (value ==
"polishedbackpainted") bdr->optic->SetFinish(polishedbackpainted);
308 else if (value ==
"ground") bdr->optic->SetFinish(ground);
309 else if (value ==
"groundfrontpainted") bdr->optic->SetFinish(groundfrontpainted);
310 else if (value ==
"groundbackpainted") bdr->optic->SetFinish(groundbackpainted);
312 else if (value ==
"polishedlumirrorair") bdr->optic->SetFinish(polishedlumirrorair);
313 else if (value ==
"polishedlumirrorglue") bdr->optic->SetFinish(polishedlumirrorglue);
314 else if (value ==
"polishedair") bdr->optic->SetFinish(polishedair);
315 else if (value ==
"polishedteflonair") bdr->optic->SetFinish(polishedteflonair);
316 else if (value ==
"polishedtioair") bdr->optic->SetFinish(polishedtioair);
317 else if (value ==
"polishedtyvekair") bdr->optic->SetFinish(polishedtyvekair);
318 else if (value ==
"polishedvm2000air") bdr->optic->SetFinish(polishedvm2000air);
319 else if (value ==
"polishedvm2000glue") bdr->optic->SetFinish(polishedvm2000glue);
321 else if (value ==
"etchedlumirrorair") bdr->optic->SetFinish(etchedlumirrorair);
322 else if (value ==
"etchedlumirrorglue") bdr->optic->SetFinish(etchedlumirrorglue);
323 else if (value ==
"etchedair") bdr->optic->SetFinish(etchedair);
324 else if (value ==
"etchedteflonair") bdr->optic->SetFinish(etchedteflonair);
325 else if (value ==
"etchedtioair") bdr->optic->SetFinish(etchedtioair);
326 else if (value ==
"etchedtyvekair") bdr->optic->SetFinish(etchedtyvekair);
327 else if (value ==
"etchedvm2000air") bdr->optic->SetFinish(etchedvm2000air);
328 else if (value ==
"etchedvm2000glue") bdr->optic->SetFinish(etchedvm2000glue);
330 else if (value ==
"groundlumirrorair") bdr->optic->SetFinish(groundlumirrorair);
331 else if (value ==
"groundlumirrorglue") bdr->optic->SetFinish(groundlumirrorglue);
332 else if (value ==
"groundair") bdr->optic->SetFinish(groundair);
333 else if (value ==
"groundteflonair") bdr->optic->SetFinish(groundteflonair);
334 else if (value ==
"groundtioair") bdr->optic->SetFinish(groundtioair);
335 else if (value ==
"groundtyvekair") bdr->optic->SetFinish(groundtyvekair);
336 else if (value ==
"groundvm2000air") bdr->optic->SetFinish(groundvm2000air);
337 else if (value ==
"groundvm2000glue") bdr->optic->SetFinish(groundvm2000glue);
339 else if (value ==
"rough_lut") bdr->optic->SetFinish(Rough_LUT);
340 else if (value ==
"roughteflon_lut") bdr->optic->SetFinish(RoughTeflon_LUT);
341 else if (value ==
"roughesr_lut") bdr->optic->SetFinish(RoughESR_LUT);
342 else if (value ==
"roughesrgrease_lut") bdr->optic->SetFinish(RoughESRGrease_LUT);
343 else if (value ==
"polished_lut") bdr->optic->SetFinish(Polished_LUT);
344 else if (value ==
"polishedteflon_lut") bdr->optic->SetFinish(PolishedTeflon_LUT);
345 else if (value ==
"polishedesr_lut") bdr->optic->SetFinish(PolishedESR_LUT);
346 else if (value ==
"polishedesrgrease_lut") bdr->optic->SetFinish(PolishedESRGrease_LUT);
347 else if (value ==
"detector_lut") bdr->optic->SetFinish(Detector_LUT);
350 G4cout <<
"GEARS: Unknown surface finish: " << value <<
"!" << G4endl;
353 G4cout <<
"GEARS: finish = " << value << G4endl;
354 }
else if (setting ==
"sigma_alpha") {
355 bdr->optic->SetSigmaAlpha(G4UIcommand::ConvertToDouble(value));
356 G4cout<<
"GEARS: sigma_alpha = "<<bdr->optic->GetSigmaAlpha()<<G4endl;
358 G4cout <<
"GEARS: Ignore unknown surface setting " << value << G4endl;
361 if (i < words.size())
362 bdr->optic->SetMaterialPropertiesTable(
363 CreateMaterialPropertiesTable(words, i));
370 #include <G4tgrUtils.hh> 371 G4MaterialPropertiesTable *
372 LineProcessor::CreateMaterialPropertiesTable(
const vector<G4String> &words,
374 bool photonEnergyUnDefined =
true;
376 double *energies = NULL;
377 auto table =
new G4MaterialPropertiesTable();
378 for (
size_t i = idxOfWords; i < words.size(); i++) {
379 G4String
property = words[i];
380 G4StrUtil::to_upper(property);
381 if (G4StrUtil::contains(property,
"TIMECONSTANT") ||
382 G4StrUtil::contains(property,
"SCINTILLATIONYIELD") ||
383 property ==
"RESOLUTIONSCALE" || property ==
"YIELDRATIO") {
384 table->AddConstProperty(property, G4tgrUtils::GetDouble(words[i + 1]));
385 G4cout <<
"GEARS: " <<
property <<
" = " << words[i + 1] << G4endl;
387 }
else if (property.substr(0, 12) ==
"PHOTON_ENERG") {
388 photonEnergyUnDefined =
false;
389 cnt = G4UIcommand::ConvertToInt(words[i + 1]);
390 energies =
new double[cnt];
391 for (
int j = 0; j < cnt; j++)
392 energies[j] = G4tgrUtils::GetDouble(words[i + 2 + j]);
395 if (photonEnergyUnDefined) {
396 G4cout <<
"GEARS: photon energies undefined, " 397 <<
"ignore all wavelength-dependent properties!" << G4endl;
400 double *values =
new double[cnt];
401 for (
int j = 0; j < cnt; j++)
402 values[j] = G4tgrUtils::GetDouble(words[i + 1 + j]);
403 G4cout <<
"GEARS: " <<
property <<
" = " << values[0] <<
", " << values[1]
404 <<
", ..." << G4endl;
405 table->AddProperty(property, energies, values, cnt);
415 #include <G4tgbDetectorBuilder.hh> 425 const G4tgrVolume *ReadDetector();
429 G4VPhysicalVolume *ConstructDetector(
const G4tgrVolume *topVol);
436 #include <G4tgbVolumeMgr.hh> 437 #include <G4tgrFileReader.hh> 438 #include <G4tgrVolumeMgr.hh> 440 G4tgrFileReader *reader = G4tgrFileReader::GetInstance();
441 reader->SetLineProcessor(fLineProcessor);
443 G4tgrVolumeMgr *mgr = G4tgrVolumeMgr::GetInstance();
444 const G4tgrVolume *world = mgr->GetTopVolume();
449 #include <G4LogicalBorderSurface.hh> 452 G4VPhysicalVolume *world = G4tgbDetectorBuilder::ConstructDetector(topVol);
454 G4tgbVolumeMgr *tgbVolmgr = G4tgbVolumeMgr::GetInstance();
457 G4String physV1 = border->
v1.substr(0, border->
v1.find(
":"));
458 G4String physV2 = border->
v2.substr(0, border->
v2.find(
":"));
459 int copyNo1 = atoi(border->
v1.substr(border->
v1.find(
":") + 1).data());
460 int copyNo2 = atoi(border->
v2.substr(border->
v2.find(
":") + 1).data());
461 G4LogicalVolume *m1 = tgbVolmgr->FindG4PhysVol(physV1)->GetMotherLogical();
462 G4LogicalVolume *m2 = tgbVolmgr->FindG4PhysVol(physV2)->GetMotherLogical();
464 G4VPhysicalVolume *v1 = 0, *v2 = 0;
465 for (
int i = 0; i < (int)m1->GetNoDaughters(); i++) {
466 v1 = m1->GetDaughter(i);
467 if (v1->GetCopyNo() == copyNo1)
470 for (
int i = 0; i < (int)m2->GetNoDaughters(); i++) {
471 v2 = m2->GetDaughter(i);
472 if (v2->GetCopyNo() == copyNo2)
476 new G4LogicalBorderSurface(border->
name, v1, v2, border->
optic);
477 G4cout <<
"Border surface " << border->
name <<
" in between " << physV1
478 <<
":" << copyNo1 <<
" and " << physV2 <<
":" << copyNo2
479 <<
" added" << G4endl;
481 border = border->
next;
487 #include <G4UIcmdWith3VectorAndUnit.hh> 488 #include <G4UIcmdWithAString.hh> 489 #include <G4UIdirectory.hh> 490 #include <G4UImessenger.hh> 491 #include <G4VUserDetectorConstruction.hh> 506 class Detector :
public G4VUserDetectorConstruction,
public G4UImessenger {
514 G4VPhysicalVolume *Construct();
515 void SetNewValue(G4UIcommand *cmd, G4String value);
518 G4UIcmdWith3VectorAndUnit *fCmdSetB;
519 G4UIcmdWithAString *fCmdSrc;
520 G4UIcmdWithAString *fCmdOut;
521 G4UIcommand *fCmdLmt;
522 G4VPhysicalVolume *fWorld;
527 : G4VUserDetectorConstruction(), G4UImessenger(), fWorld(0) {
529 fCmdOut =
new G4UIcmdWithAString(
"/geometry/export",
this);
530 fCmdOut->SetGuidance(
"Export geometry gdml file name");
531 fCmdOut->SetParameterName(
"gdml geometry output",
false);
532 fCmdOut->AvailableForStates(G4State_Idle);
537 fCmdSrc =
new G4UIcmdWithAString(
"/geometry/source",
this);
538 fCmdSrc->SetGuidance(
"Set geometry source file name");
539 fCmdSrc->SetParameterName(
"text geometry input",
false);
540 fCmdSrc->AvailableForStates(G4State_PreInit);
542 fCmdLmt =
new G4UIcommand(
"/tracking/setStepLimit",
this);
543 fCmdLmt->SetGuidance(
"set max step length for a logical volume");
544 fCmdLmt->AvailableForStates(G4State_Idle);
545 G4UIparameter *p0 =
new G4UIparameter(
"logical volume name",
's',
false);
546 G4UIparameter *p1 =
new G4UIparameter(
"step length in mm",
'd',
false);
547 fCmdLmt->SetParameter(p0);
548 fCmdLmt->SetParameter(p1);
550 fCmdSetB =
new G4UIcmdWith3VectorAndUnit(
"/geometry/SetB",
this);
551 fCmdSetB->SetGuidance(
"Set uniform magnetic field value.");
552 fCmdSetB->SetParameterName(
"Bx",
"By",
"Bz",
false);
553 fCmdSetB->SetUnitCategory(
"Magnetic flux density");
557 #include <G4FieldManager.hh> 558 #include <G4LogicalVolumeStore.hh> 559 #include <G4TransportationManager.hh> 560 #include <G4UniformMagField.hh> 561 #include <G4UserLimits.hh> 563 #include "G4GDMLParser.hh" 566 if (cmd == fCmdSetB) {
567 auto field =
new G4UniformMagField(0, 0, 0);
568 field->SetFieldValue(fCmdSetB->GetNew3VectorValue(value));
569 G4FieldManager *mgr =
570 G4TransportationManager::GetTransportationManager()->GetFieldManager();
571 mgr->SetDetectorField(field);
572 mgr->CreateChordFinder(field);
573 G4cout <<
"GEARS: Magnetic field is set to " << value << G4endl;
575 }
else if (cmd == fCmdOut) {
577 paser.Write(value, fWorld);
579 }
else if (cmd == fCmdLmt) {
580 istringstream iss(value);
583 auto v = G4LogicalVolumeStore::GetInstance()->GetVolume(vlm);
585 v->SetUserLimits(
new G4UserLimits(stof(limit)));
586 G4cout <<
"GEARS: max step length in " << vlm <<
": " << limit <<
" mm" 590 if (value.substr(value.length() - 4) !=
"gdml") {
591 G4tgbVolumeMgr *mgr = G4tgbVolumeMgr::GetInstance();
592 mgr->AddTextFile(value);
594 mgr->SetDetectorBuilder(tgb);
595 fWorld = mgr->ReadAndConstructDetector();
600 fWorld = parser.GetWorldVolume();
608 #include "G4PVPlacement.hh" 610 if (fWorld == NULL) {
611 G4cout <<
"GEARS: no detector specified, set to a 10x10x10 m^3 box." 613 auto box =
new G4Box(
"hall", 5 * CLHEP::m, 5 * CLHEP::m, 5 * CLHEP::m);
614 G4NistManager *nist = G4NistManager::Instance();
615 G4Material *vacuum = nist->FindOrBuildMaterial(
"G4_Galactic");
616 auto v =
new G4LogicalVolume(box, vacuum,
"hall");
617 fWorld =
new G4PVPlacement(0, G4ThreeVector(), v,
"hall", 0, 0, 0);
623 #include <G4GeneralParticleSource.hh> 624 #include <G4VUserPrimaryGeneratorAction.hh> 628 class Generator :
public G4VUserPrimaryGeneratorAction {
630 G4GeneralParticleSource *fSource;
633 Generator() : G4VUserPrimaryGeneratorAction(), fSource(0) {
634 fSource =
new G4GeneralParticleSource;
638 fSource->GeneratePrimaryVertex(evt);
644 #include <G4RunManagerFactory.hh> 645 #include <G4UserRunAction.hh> 652 auto a = G4AnalysisManager::Instance();
653 if (a->GetFileName() ==
"")
656 Output *o = ((
Output *)G4VSteppingVerbose::GetInstance());
664 auto a = G4AnalysisManager::Instance();
665 if (a->GetFileName() !=
"") {
674 auto a = G4AnalysisManager::Instance();
675 Output *o = ((
Output *)G4VSteppingVerbose::GetInstance());
676 if (a->GetFileName() !=
"" && o->
stp.size() != 0) {
677 a->FillNtupleIColumn(0, o->
stp.size());
678 a->FillNtupleIColumn(1, o->
et.size() - 1);
685 #include <G4UserEventAction.hh> 695 #include <G4UIcmdWithADoubleAndUnit.hh> 696 #include <G4UserStackingAction.hh> 704 G4UIcmdWithADoubleAndUnit *fCmdT;
707 : G4UserStackingAction(), G4UImessenger(), fT0(0), fTimeWindow(0),
709 fCmdT =
new G4UIcmdWithADoubleAndUnit(
"/grdm/setTimeWindow",
this);
710 fCmdT->SetGuidance(
"Time window to split a radioactive decay chain.");
711 fCmdT->SetGuidance(
"If a daughter nucleus appears after the window,");
712 fCmdT->SetGuidance(
"it is saved in a new entry in the output ntuple.");
713 fCmdT->SetGuidance(
"---Set it to <=0 to disable the splitting---");
714 fCmdT->SetParameterName(
"time window",
false,
true);
715 fCmdT->SetDefaultUnit(
"s");
716 fCmdT->AvailableForStates(G4State_PreInit, G4State_Idle);
720 if (fTimeWindow <= 0)
722 if (trk->GetGlobalTime() > fT0 + fTimeWindow)
728 if (fTimeWindow <= 0)
730 Output *o = ((
Output *)G4VSteppingVerbose::GetInstance());
737 fTimeWindow = fCmdT->GetNewDoubleValue(value);
742 #include <G4VUserActionInitialization.hh> 743 class Action :
public G4VUserActionInitialization {
753 #include <G4PhysListFactory.hh> 754 #include <G4ScoringManager.hh> 755 #include <G4StepLimiterPhysics.hh> 756 #include <G4UIExecutive.hh> 757 #include <G4UImanager.hh> 758 #include <G4VisExecutive.hh> 762 int main(
int argc,
char **argv) {
764 G4VSteppingVerbose::SetInstance(
new Output);
766 G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
767 G4PhysListFactory factory;
768 auto physics = factory.ReferencePhysList();
769 physics->RegisterPhysics(
new G4StepLimiterPhysics());
770 run->SetUserInitialization(physics);
771 run->SetUserInitialization(
new Detector);
772 run->SetUserInitialization(
new Action);
773 G4ScoringManager::GetScoringManager();
774 G4UIExecutive *ui =
nullptr;
776 ui =
new G4UIExecutive(argc, argv);
778 auto vis =
new G4VisExecutive(
"quiet");
784 G4String cmd =
"/control/execute ";
785 G4UImanager::GetUIpointer()->ApplyCommand(cmd + argv[1]);
vector< double > l
length of track till this point [mm]
void EndOfEventAction(const G4Event *)
vector< double > p
momentum [keV]
vector< double > zz
z [mm] (origin: center of local volume)
void EndOfRunAction(const G4Run *)
Close output file.
vector< int > pid
parent particle's PDG encoding
BorderSurface * Border
pointer to a BorderSurface object
G4String v1
name of volume 1
vector< double > yy
y [mm] (origin: center of local volume)
G4bool ProcessLine(const vector< G4String > &words)
Overwrite G4tgrLineProcessor::ProcessLine to add new tags.
vector< int > pdg
PDG encoding.
vector< double > q
charge [elementary charge]
vector< double > px
x component of momentum direction
void Record()
Record simulated data.
G4OpticalSurface * optic
point to G4OpticalSurface object
vector< double > k
kinetic energy [keV]
vector< double > dt
time elapsed from previous step point [ns]
void BeginOfRunAction(const G4Run *)
enable output if output file name is not empty
vector< double > z
z [mm] (origin: center of the world)
Book keeping before and after a run.
void SetSteppingVerbose(int level)
vector< double > py
y component of momentum direction
Construct detector geometry.
vector< double > dl
step length [mm]
Dump simulation results to screen or a file.
vector< double > x
x [mm] (origin: center of the world)
vector< double > et
Total energy deposited in a volume [keV].
G4String v2
name of volume 2
G4VPhysicalVolume * ConstructDetector(const G4tgrVolume *topVol)
Construct detector based on text geometry description.
A link list of G4LogicalBorderSurface.
vector< double > y
y [mm] (origin: center of the world)
Book keeping before and after an event.
vector< double > de
energy deposited [keV]
const G4tgrVolume * ReadDetector()
Read text geometry input.
vector< double > xx
x [mm] (origin: center of local volume)
G4String name
name of the surface
Output()
use analysis manager to handle output
BorderSurface * next
link to next border surface
Split a radioactive decay chain to different events based on a time window.
vector< double > t
time elapsed from the beginning of an event [ns]
vector< int > vlm
volume copy number
Call Geant4 General Particle Source to generate particles.
void StepInfo()
Information of steps>0.
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *trk)
send a daughter particle to waiting stack if it appears too late
vector< int > stp
step number
vector< int > trk
track ID
int main(int argc, char **argv)
The main function that calls individual components.
StackingAction()
created macro /grdm/setTimeWindow
vector< int > pro
process ID * 100 + sub-process ID
void NewStage()
save and reset output before processing waiting tracks
vector< double > pz
z component of momentum direction
void SetNewValue(G4UIcommand *cmd, G4String value)
virtual void GeneratePrimaries(G4Event *evt)
add sources to an event
void TrackingStarted()
Information of step 0 (initStep)
Extension to default text geometry file line processor.
Construct detector based on text geometry description.
G4VPhysicalVolume * Construct()
called at /run/initialize
void SetNewValue(G4UIcommand *cmd, G4String value)
for G4UI
void SaveAndResetEvent()
save and then reset an event