Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ProductionCutsTable.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4ProductionCutsTable class implementation
27//
28// Author: M.Asai, 5 October 2002 - First implementation
29// Modifications: H.Kurashige, 2004-2008
30// --------------------------------------------------------------------
31
33#include "G4ProductionCuts.hh"
37#include "G4ParticleTable.hh"
38#include "G4RegionStore.hh"
39#include "G4LogicalVolume.hh"
40#include "G4VPhysicalVolume.hh"
42#include "G4RToEConvForGamma.hh"
45#include "G4MaterialTable.hh"
46#include "G4Material.hh"
47#include "G4UnitsTable.hh"
48
49#include "G4Timer.hh"
50#include "G4SystemOfUnits.hh"
51#include "G4ios.hh"
52#include <iomanip>
53#include <fstream>
54
55G4ProductionCutsTable* G4ProductionCutsTable::fProductionCutsTable = nullptr;
56
57// --------------------------------------------------------------------
59{
60 static G4ProductionCutsTable theProductionCutsTable;
61 if(fProductionCutsTable == nullptr)
62 {
63 fProductionCutsTable = &theProductionCutsTable;
64 }
65 return fProductionCutsTable;
66}
67
68// --------------------------------------------------------------------
70{
71 for(std::size_t i=0; i< NumberOfG4CutIndex; ++i)
72 {
73 rangeCutTable.push_back(new std::vector<G4double>);
74 energyCutTable.push_back(new std::vector<G4double>);
75 rangeDoubleVector[i] = nullptr;
76 energyDoubleVector[i] = nullptr;
77 converters[i] = nullptr;
78 }
79 fG4RegionStore = G4RegionStore::GetInstance();
80 defaultProductionCuts = new G4ProductionCuts();
81
82 // add messenger for UI
83 fMessenger = new G4ProductionCutsTableMessenger(this);
84}
85
86// --------------------------------------------------------------------
88{
89 delete defaultProductionCuts;
90 defaultProductionCuts = nullptr;
91
92 for(auto itr=coupleTable.cbegin(); itr!=coupleTable.cend(); ++itr)
93 {
94 delete (*itr);
95 }
96 coupleTable.clear();
97
98 for(std::size_t i=0; i< NumberOfG4CutIndex; ++i)
99 {
100 delete rangeCutTable[i];
101 delete energyCutTable[i];
102 delete converters[i];
103 if(rangeDoubleVector[i] != nullptr) delete [] rangeDoubleVector[i];
104 if(energyDoubleVector[i] != nullptr) delete [] energyDoubleVector[i];
105 rangeCutTable[i] = nullptr;
106 energyCutTable[i] = nullptr;
107 converters[i] = nullptr;
108 rangeDoubleVector[i] = nullptr;
109 energyDoubleVector[i] = nullptr;
110 if(i < 4)
111 {
112 delete userEnergyCuts[i];
113 }
114 }
115 fProductionCutsTable = nullptr;
116
117 delete fMessenger;
118 fMessenger = nullptr;
119}
120
121// --------------------------------------------------------------------
122void G4ProductionCutsTable::SetEnergyCutVector(const std::vector<G4double>& cutE,
123 std::size_t idx)
124{
125 if (idx >= 4) {
127 ed << "Wrong index= " << idx << "; it should be < 4";
128 G4Exception("G4ProductionCutsTable::SetEnergyCutVector()",
129 "CUTS0100", FatalException, ed);
130 return;
131 }
132 userEnergyCuts[idx] = new std::vector<G4double>(cutE);
133}
134
135// --------------------------------------------------------------------
137{
138 // Reset "used" flags of all couples
139 for(auto CoupleItr=coupleTable.cbegin();
140 CoupleItr!=coupleTable.cend(); ++CoupleItr)
141 {
142 (*CoupleItr)->SetUseFlag(false);
143 }
144
145 // Update Material-Cut-Couple
146 for(auto rItr=fG4RegionStore->cbegin(); rItr!=fG4RegionStore->cend(); ++rItr)
147 {
148 // Material scan is to be done only for the regions appear in the
149 // current tracking world.
150 // if((*rItr)->GetWorldPhysical()!=currentWorld) continue;
151
152 if( (*rItr)->IsInMassGeometry() || (*rItr)->IsInParallelGeometry() )
153 {
154 G4ProductionCuts* fProductionCut = (*rItr)->GetProductionCuts();
155 auto mItr = (*rItr)->GetMaterialIterator();
156 std::size_t nMaterial = (*rItr)->GetNumberOfMaterials();
157 (*rItr)->ClearMap();
158
159 for(std::size_t iMate=0; iMate<nMaterial; ++iMate)
160 {
161 //check if this material cut couple has already been made
162 G4bool coupleAlreadyDefined = false;
163 G4MaterialCutsCouple* aCouple;
164 for(auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
165 {
166 if( (*cItr)->GetMaterial()==(*mItr)
167 && (*cItr)->GetProductionCuts()==fProductionCut)
168 {
169 coupleAlreadyDefined = true;
170 aCouple = *cItr;
171 break;
172 }
173 }
174
175 // If this combination is new, cleate and register a couple
176 if(!coupleAlreadyDefined)
177 {
178 aCouple = new G4MaterialCutsCouple((*mItr),fProductionCut);
179 coupleTable.push_back(aCouple);
180 aCouple->SetIndex(G4int(coupleTable.size()-1));
181 }
182
183 // Register this couple to the region
184 (*rItr)->RegisterMaterialCouplePair((*mItr),aCouple);
185
186 // Set the couple to the proper logical volumes in that region
187 aCouple->SetUseFlag();
188
189 auto rootLVItr = (*rItr)->GetRootLogicalVolumeIterator();
190 std::size_t nRootLV = (*rItr)->GetNumberOfRootVolumes();
191 for(std::size_t iLV=0; iLV<nRootLV; ++iLV)
192 {
193 // Set the couple to the proper logical volumes in that region
194 G4LogicalVolume* aLV = *rootLVItr;
195 G4Region* aR = *rItr;
196
197 ScanAndSetCouple(aLV,aCouple,aR);
198
199 // Proceed to the next root logical volume in this region
200 ++rootLVItr;
201 }
202
203 // Proceed to next material in this region
204 ++mItr;
205 }
206 }
207 }
208
209 // Check if sizes of Range/Energy cuts tables are equal to the size of
210 // the couple table. If new couples are made during the previous procedure,
211 // nCouple becomes larger then nTable
212
213 std::size_t nCouple = coupleTable.size();
214 std::size_t nTable = energyCutTable[0]->size();
215 G4bool newCoupleAppears = nCouple>nTable;
216 if(newCoupleAppears)
217 {
218 for(std::size_t n=nCouple-nTable; n>0; --n)
219 {
220 for(std::size_t nn=0; nn< NumberOfG4CutIndex; ++nn)
221 {
222 rangeCutTable[nn]->push_back(-1.);
223 energyCutTable[nn]->push_back(-1.);
224 }
225 }
226 }
227
228 // resize Range/Energy cuts double vectors if new couple is made
229 if(newCoupleAppears)
230 {
231 for(std::size_t ix=0; ix<NumberOfG4CutIndex; ++ix)
232 {
233 G4double* rangeVOld = rangeDoubleVector[ix];
234 G4double* energyVOld = energyDoubleVector[ix];
235 if(rangeVOld) delete [] rangeVOld;
236 if(energyVOld) delete [] energyVOld;
237 rangeDoubleVector[ix] = new G4double[(*(rangeCutTable[ix])).size()];
238 energyDoubleVector[ix] = new G4double[(*(energyCutTable[ix])).size()];
239 }
240 }
241}
242
243// --------------------------------------------------------------------
245{
247
248 if(firstUse)
249 {
250 if(G4ParticleTable::GetParticleTable()->FindParticle("gamma"))
251 {
252 converters[0] = new G4RToEConvForGamma();
253 converters[0]->SetVerboseLevel(GetVerboseLevel());
254 }
255 if(G4ParticleTable::GetParticleTable()->FindParticle("e-"))
256 {
257 converters[1] = new G4RToEConvForElectron();
258 converters[1]->SetVerboseLevel(GetVerboseLevel());
259 }
260 if(G4ParticleTable::GetParticleTable()->FindParticle("e+"))
261 {
262 converters[2] = new G4RToEConvForPositron();
263 converters[2]->SetVerboseLevel(GetVerboseLevel());
264 }
265 if(G4ParticleTable::GetParticleTable()->FindParticle("proton"))
266 {
267 converters[3] = new G4RToEConvForProton();
268 converters[3]->SetVerboseLevel(GetVerboseLevel());
269 }
270 firstUse = false;
271 }
272
273 // Force update of coupleTable if userEnergyCuts vectors are set
274 G4bool isRecalcNeeded = false;
275 for (const auto* userVector : userEnergyCuts) {
276 if (userVector != nullptr) {
277 isRecalcNeeded = true;
278 break;
279 }
280 }
281
282 // Update RangeEnergy cuts tables
283 std::size_t idx = 0;
284 G4Timer timer;
285 if (verboseLevel>2)
286 {
287 timer.Start();
288 }
289 for(auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
290 {
291 G4ProductionCuts* aCut = (*cItr)->GetProductionCuts();
292 const G4Material* aMat = (*cItr)->GetMaterial();
293 if((*cItr)->IsRecalcNeeded() || isRecalcNeeded)
294 {
295 for(std::size_t ptcl=0; ptcl< NumberOfG4CutIndex; ++ptcl)
296 {
297 G4double rCut = aCut->GetProductionCut((G4int)ptcl);
298 (*(rangeCutTable[ptcl]))[idx] = rCut;
299
300 if(nullptr != converters[ptcl])
301 {
302 // check user defined cut in energy
303 if(nullptr == userEnergyCuts[ptcl] || userEnergyCuts[ptcl]->size() <= idx)
304 {
305 (*(energyCutTable[ptcl]))[idx] = converters[ptcl]->Convert(rCut,aMat);
306 }
307 else
308 {
309 (*(energyCutTable[ptcl]))[idx] = (*(userEnergyCuts[ptcl]))[idx];
310 }
311 }
312 else
313 {
314 (*(energyCutTable[ptcl]))[idx] = -1.;
315 }
316 }
317 }
318 ++idx;
319 }
320 if (verboseLevel>2)
321 {
322 timer.Stop();
323 G4cout << "G4ProductionCutsTable::UpdateCoupleTable() - "
324 << "Elapsed time for calculation of energy cuts: " << G4endl;
325 G4cout << timer << G4endl;
326 }
327
328 // Update Range/Energy cuts double vectors
329 for(std::size_t ix=0; ix<NumberOfG4CutIndex; ++ix)
330 {
331 for(std::size_t ixx=0; ixx<(*(rangeCutTable[ix])).size(); ++ixx)
332 {
333 rangeDoubleVector[ix][ixx] = (*(rangeCutTable[ix]))[ixx];
334 energyDoubleVector[ix][ixx] = (*(energyCutTable[ix]))[ixx];
335 }
336 }
337}
338
339// --------------------------------------------------------------------
341 const G4ParticleDefinition* particle,
342 const G4Material* material,
343 G4double range )
344{
345 // This method gives energy corresponding to range value
346
347 // protection against premature call
348 if(firstUse)
349 {
350#ifdef G4VERBOSE
351 if(verboseLevel>0)
352 {
354 ed << "Invoked prematurely before it is fully initialized.";
355 G4Exception("G4ProductionCutsTable::ConvertRangeToEnergy()",
356 "CUTS0100", JustWarning, ed);
357 }
358#endif
359 return -1.0;
360 }
361
362 // check material
363 if (material == nullptr) return -1.0;
364
365 // check range
366 if (range == 0.0) return 0.0;
367 if (range <0.0) return -1.0;
368
369 // check particle
370 G4int index = G4ProductionCuts::GetIndex(particle);
371
372 if (index<0 || converters[index] == nullptr)
373 {
374#ifdef G4VERBOSE
375 if(verboseLevel>0)
376 {
378 ed << "Invoked ";
379 if(particle != nullptr)
380 { ed << "for particle <" << particle->GetParticleName() << ">."; }
381 else
382 { ed << "without valid particle pointer."; }
383 G4Exception("G4ProductionCutsTable::ConvertRangeToEnergy()",
384 "CUTS0101", JustWarning, ed);
385 }
386#endif
387 return -1.0;
388 }
389
390 return converters[index]->Convert(range, material);
391}
392
393// --------------------------------------------------------------------
396
397// --------------------------------------------------------------------
402
403// --------------------------------------------------------------------
408
409// --------------------------------------------------------------------
414
415// --------------------------------------------------------------------
416void G4ProductionCutsTable::ScanAndSetCouple(G4LogicalVolume* aLV,
417 G4MaterialCutsCouple* aCouple,
418 G4Region* aRegion)
419{
420 // Check whether or not this logical volume belongs to the same region
421 if((aRegion!=nullptr) && aLV->GetRegion()!=aRegion) return;
422
423 // Check if this particular volume has a material matched to the couple
424 if(aLV->GetMaterial()==aCouple->GetMaterial())
425 {
426 aLV->SetMaterialCutsCouple(aCouple);
427 }
428
429 std::size_t noDaughters = aLV->GetNoDaughters();
430 if(noDaughters==0) return;
431
432 // Loop over daughters with same region
433 for(std::size_t i=0; i<noDaughters; ++i)
434 {
435 G4LogicalVolume* daughterLVol = aLV->GetDaughter(i)->GetLogicalVolume();
436 ScanAndSetCouple(daughterLVol,aCouple,aRegion);
437 }
438}
439
440// --------------------------------------------------------------------
442{
443 G4cout << G4endl;
444 G4cout << "========= Table of registered couples ============================"
445 << G4endl;
446 for(auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
447 {
448 G4MaterialCutsCouple* aCouple = (*cItr);
449 G4ProductionCuts* aCut = aCouple->GetProductionCuts();
450 G4cout << G4endl;
451 G4cout << "Index : " << aCouple->GetIndex()
452 << " used in the geometry : ";
453 if(aCouple->IsUsed()) G4cout << "Yes";
454 else G4cout << "No ";
455//// G4cout << " recalculation needed : ";
456//// if(aCouple->IsRecalcNeeded()) G4cout << "Yes";
457//// else G4cout << "No ";
458 G4cout << G4endl;
459 G4cout << " Material : " << aCouple->GetMaterial()->GetName() << G4endl;
460 G4cout << " Range cuts : "
461 << " gamma " << G4BestUnit(aCut->GetProductionCut("gamma"),"Length")
462 << " e- " << G4BestUnit(aCut->GetProductionCut("e-"),"Length")
463 << " e+ " << G4BestUnit(aCut->GetProductionCut("e+"),"Length")
464 << " proton " << G4BestUnit(aCut->GetProductionCut("proton"),"Length")
465 << G4endl;
466 G4cout << " Energy thresholds : " ;
467//// if(aCouple->IsRecalcNeeded()) {
468//// G4cout << " is not ready to print";
469//// } else {
470 G4cout << " gamma " << G4BestUnit((*(energyCutTable[0]))[aCouple->GetIndex()],"Energy")
471 << " e- " << G4BestUnit((*(energyCutTable[1]))[aCouple->GetIndex()],"Energy")
472 << " e+ " << G4BestUnit((*(energyCutTable[2]))[aCouple->GetIndex()],"Energy")
473 << " proton " << G4BestUnit((*(energyCutTable[3]))[aCouple->GetIndex()],"Energy");
474//// }
475 G4cout << G4endl;
476
477 if(aCouple->IsUsed())
478 {
479 G4cout << " Region(s) which use this couple : " << G4endl;
480 for(auto rItr=fG4RegionStore->cbegin();
481 rItr!=fG4RegionStore->cend(); ++rItr)
482 {
483 if (IsCoupleUsedInTheRegion(aCouple, *rItr) )
484 {
485 G4cout << " " << (*rItr)->GetName() << G4endl;
486 }
487 }
488 }
489 }
490 G4cout << G4endl;
491 G4cout << "==================================================================" << G4endl;
492 G4cout << G4endl;
493}
494
495// --------------------------------------------------------------------
497 G4bool ascii)
498{
499 // Store cuts and material information in files under the specified directory
500
501 if (!StoreMaterialInfo(dir, ascii)) return false;
502 if (!StoreMaterialCutsCoupleInfo(dir, ascii)) return false;
503 if (!StoreCutsInfo(dir, ascii)) return false;
504
505#ifdef G4VERBOSE
506 if (verboseLevel >2)
507 {
508 G4cout << "G4ProductionCutsTable::StoreCutsTable()" << G4endl;
509 G4cout << " Material/Cuts information have been successfully stored ";
510 if (ascii)
511 {
512 G4cout << " in Ascii mode ";
513 }
514 else
515 {
516 G4cout << " in Binary mode ";
517 }
518 G4cout << " under " << dir << G4endl;
519 }
520#endif
521 return true;
522}
523
524// --------------------------------------------------------------------
526 G4bool ascii)
527{
528 if (!CheckForRetrieveCutsTable(dir, ascii)) return false;
529 if (!RetrieveCutsInfo(dir, ascii)) return false;
530#ifdef G4VERBOSE
531 if (verboseLevel >2)
532 {
533 G4cout << "G4ProductionCutsTable::RetrieveCutsTable()" << G4endl;
534 G4cout << " Material/Cuts information have been successfully retrieved ";
535 if (ascii)
536 {
537 G4cout << " in Ascii mode ";
538 }
539 else
540 {
541 G4cout << " in Binary mode ";
542 }
543 G4cout << " under " << dir << G4endl;
544 }
545#endif
546 return true;
547}
548
549// --------------------------------------------------------------------
550G4bool
552 G4bool ascii)
553{
554 // check stored material and cut values are consistent
555 // with the current detector setup
556
557 G4cerr << "G4ProductionCutsTable::CheckForRetrieveCutsTable()"<< G4endl;
558 // isNeedForRestoreCoupleInfo = false;
559 if (!CheckMaterialInfo(directory, ascii)) return false;
560 if (verboseLevel >2)
561 {
562 G4cerr << "G4ProductionCutsTable::CheckMaterialInfo passed !!"<< G4endl;
563 }
564 if (!CheckMaterialCutsCoupleInfo(directory, ascii)) return false;
565 if (verboseLevel >2)
566 {
567 G4cerr << "G4ProductionCutsTable::CheckMaterialCutsCoupleInfo passed !!"
568 << G4endl;
569 }
570 return true;
571}
572
573// --------------------------------------------------------------------
575 G4bool ascii)
576{
577 // Store material information in files under the specified directory
578
579 const G4String fileName = directory + "/" + "material.dat";
580 const G4String key = "MATERIAL-V3.0";
581 std::ofstream fOut;
582
583 // open output file
584 if (!ascii ) fOut.open(fileName,std::ios::out|std::ios::binary);
585 else fOut.open(fileName,std::ios::out);
586
587 // check if the file has been opened successfully
588 if (!fOut)
589 {
590#ifdef G4VERBOSE
591 if (verboseLevel>0)
592 {
593 G4cerr << "G4ProductionCutsTable::StoreMaterialInfo() - ";
594 G4cerr << "Cannot open file: " << fileName << G4endl;
595 }
596#endif
597 G4Exception( "G4ProductionCutsTable::StoreMaterialInfo()",
598 "ProcCuts102", JustWarning, "Cannot open file!");
599 return false;
600 }
601
603 // number of materials in the table
604 G4int numberOfMaterial = (G4int)matTable->size();
605
606 if (ascii)
607 {
608 /////////////// ASCII mode /////////////////
609 // key word
610 fOut << key << G4endl;
611
612 // number of materials in the table
613 fOut << numberOfMaterial << G4endl;
614
615 fOut.setf(std::ios::scientific);
616
617 // material name and density
618 for (std::size_t idx=0; static_cast<G4int>(idx)<numberOfMaterial; ++idx)
619 {
620 fOut << std::setw(FixedStringLengthForStore)
621 << ((*matTable)[idx])->GetName();
622 fOut << std::setw(FixedStringLengthForStore)
623 << ((*matTable)[idx])->GetDensity()/(g/cm3) << G4endl;
624 }
625
626 fOut.unsetf(std::ios::scientific);
627
628 }
629 else
630 {
631 /////////////// Binary mode /////////////////
632 char temp[FixedStringLengthForStore];
633 std::size_t i;
634
635 // key word
636 for (i=0; i<FixedStringLengthForStore; ++i)
637 {
638 temp[i] = '\0';
639 }
640 for (i=0; i<key.length() && i<FixedStringLengthForStore-1; ++i)
641 {
642 temp[i]=key[(G4int)i];
643 }
644 fOut.write(temp, FixedStringLengthForStore);
645
646 // number of materials in the table
647 fOut.write( (char*)(&numberOfMaterial), sizeof(G4int));
648
649 // material name and density
650 for (std::size_t imat=0; static_cast<G4int>(imat)<numberOfMaterial; ++imat)
651 {
652 G4String name = ((*matTable)[imat])->GetName();
653 G4double density = ((*matTable)[imat])->GetDensity();
654 for (i=0; i<FixedStringLengthForStore; ++i)
655 temp[i] = '\0';
656 for (i=0; i<name.length() && i<FixedStringLengthForStore-1; ++i)
657 temp[i]=name[(G4int)i];
658 fOut.write(temp, FixedStringLengthForStore);
659 fOut.write( (char*)(&density), sizeof(G4double));
660 }
661 }
662
663 fOut.close();
664 return true;
665}
666
667// --------------------------------------------------------------------
669 G4bool ascii)
670{
671 // Check stored material is consistent with the current detector setup
672
673 const G4String fileName = directory + "/" + "material.dat";
674 const G4String key = "MATERIAL-V3.0";
675 std::ifstream fIn;
676
677 // open input file
678 if (!ascii ) fIn.open(fileName,std::ios::in|std::ios::binary);
679 else fIn.open(fileName,std::ios::in);
680
681 // check if the file has been opened successfully
682 if (!fIn)
683 {
684#ifdef G4VERBOSE
685 if (verboseLevel >0)
686 {
687 G4cerr << "G4ProductionCutsTable::CheckMaterialInfo() - ";
688 G4cerr << "Cannot open file: " << fileName << G4endl;
689 }
690#endif
691 G4Exception( "G4ProductionCutsTable::CheckMaterialInfo()",
692 "ProcCuts102", JustWarning, "Cannot open file!");
693 return false;
694 }
695
696 char temp[FixedStringLengthForStore];
697
698 // key word
699 G4String keyword;
700 if (ascii)
701 {
702 fIn >> keyword;
703 }
704 else
705 {
706 fIn.read(temp, FixedStringLengthForStore);
707 keyword = (const char*)(temp);
708 }
709 if (key!=keyword)
710 {
711#ifdef G4VERBOSE
712 if (verboseLevel >0)
713 {
714 G4cerr << "G4ProductionCutsTable::CheckMaterialInfo() - ";
715 G4cerr << "Key word in " << fileName << "= " << keyword ;
716 G4cerr <<"( should be "<< key << ")" <<G4endl;
717 }
718#endif
719 G4Exception( "G4ProductionCutsTable::CheckMaterialInfo()",
720 "ProcCuts103", JustWarning, "Bad Data Format");
721 return false;
722 }
723
724 // number of materials in the table
725 G4int nmat;
726 if (ascii)
727 {
728 fIn >> nmat;
729 }
730 else
731 {
732 fIn.read( (char*)(&nmat), sizeof(G4int));
733 }
734 if ((nmat<=0) || (nmat >100000))
735 {
736 G4Exception( "G4ProductionCutsTable::CheckMaterialInfo()",
737 "ProcCuts108", JustWarning,
738 "Number of materials is less than zero or too big");
739 return false;
740 }
741
742 // list of material
743 for (G4int idx=0; idx<nmat ; ++idx)
744 {
745 // check eof
746 if(fIn.eof())
747 {
748#ifdef G4VERBOSE
749 if (verboseLevel >0)
750 {
751 G4cout << "G4ProductionCutsTable::CheckMaterialInfo() - ";
752 G4cout << "Encountered End of File " ;
753 G4cout << " at " << idx+1 << "th material "<< G4endl;
754 }
755#endif
756 fIn.close();
757 return false;
758 }
759
760 // check material name and density
761 char name[FixedStringLengthForStore];
762 G4double density;
763 if (ascii)
764 {
765 fIn >> name >> density;
766 density *= (g/cm3);
767
768 }
769 else
770 {
771 fIn.read(name, FixedStringLengthForStore);
772 fIn.read((char*)(&density), sizeof(G4double));
773 }
774 if (fIn.fail())
775 {
776#ifdef G4VERBOSE
777 if (verboseLevel >0)
778 {
779 G4cerr << "G4ProductionCutsTable::CheckMaterialInfo() - ";
780 G4cerr << "Bad data format ";
781 G4cerr << " at " << idx+1 << "th material "<< G4endl;
782 }
783#endif
784 G4Exception( "G4ProductionCutsTable::CheckMaterialInfo()",
785 "ProcCuts103", JustWarning, "Bad Data Format");
786 fIn.close();
787 return false;
788 }
789
790 G4Material* aMaterial = G4Material::GetMaterial(name);
791 if (aMaterial == nullptr ) continue;
792
793 G4double ratio = std::fabs(density/aMaterial->GetDensity() );
794 if ((0.999>ratio) || (ratio>1.001) )
795 {
796#ifdef G4VERBOSE
797 if (verboseLevel >0)
798 {
799 G4cerr << "G4ProductionCutsTable::CheckMaterialInfo() - ";
800 G4cerr << "Inconsistent material density" << G4endl;;
801 G4cerr << " at " << idx+1 << "th material "<< G4endl;
802 G4cerr << "Name: " << name << G4endl;
803 G4cerr << "Density:" << std::setiosflags(std::ios::scientific)
804 << density / (g/cm3) ;
805 G4cerr << "(should be " << aMaterial->GetDensity()/(g/cm3)<< ")"
806 << " [g/cm3]"<< G4endl;
807 G4cerr << std::resetiosflags(std::ios::scientific);
808 }
809#endif
810 G4Exception( "G4ProductionCutsTable::CheckMaterialInfo()",
811 "ProcCuts104", JustWarning, "Inconsistent material density");
812 fIn.close();
813 return false;
814 }
815 }
816
817 fIn.close();
818 return true;
819}
820
821// --------------------------------------------------------------------
822G4bool
824 G4bool ascii)
825{
826 // Store materialCutsCouple information in files under the specified directory
827
828 const G4String fileName = directory + "/" + "couple.dat";
829 const G4String key = "COUPLE-V3.0";
830 std::ofstream fOut;
831 char temp[FixedStringLengthForStore];
832
833 // open output file
834 if (!ascii ) fOut.open(fileName,std::ios::out|std::ios::binary);
835 else fOut.open(fileName,std::ios::out);
836
837
838 // check if the file has been opened successfully
839 if (!fOut)
840 {
841#ifdef G4VERBOSE
842 if (verboseLevel >0)
843 {
844 G4cerr << "G4ProductionCutsTable::StoreMaterialCutsCoupleInfo() - ";
845 G4cerr << "Cannot open file: " << fileName << G4endl;
846 }
847#endif
848 G4Exception( "G4ProductionCutsTable::StoreMaterialCutsCoupleInfo()",
849 "ProcCuts102",
850 JustWarning, "Cannot open file!");
851 return false;
852 }
853 G4int numberOfCouples = (G4int)coupleTable.size();
854 if (ascii)
855 {
856 /////////////// ASCII mode /////////////////
857 // key word
858 fOut << std::setw(FixedStringLengthForStore) << key << G4endl;
859
860 // number of couples in the table
861 fOut << numberOfCouples << G4endl;
862 }
863 else
864 {
865 /////////////// Binary mode /////////////////
866 // key word
867 std::size_t i;
868 for (i=0; i<FixedStringLengthForStore; ++i)
869 temp[i] = '\0';
870 for (i=0; i<key.length() && i<FixedStringLengthForStore-1; ++i)
871 temp[i]=key[(G4int)i];
872 fOut.write(temp, FixedStringLengthForStore);
873
874 // number of couples in the table
875 fOut.write( (char*)(&numberOfCouples), sizeof(G4int));
876 }
877
878 // Loop over all couples
879 for (auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
880 {
881 G4MaterialCutsCouple* aCouple = (*cItr);
882 G4int index = aCouple->GetIndex();
883 // cut value
884 G4ProductionCuts* aCut = aCouple->GetProductionCuts();
885 G4double cutValues[NumberOfG4CutIndex];
886 for (std::size_t idx=0; idx <NumberOfG4CutIndex; ++idx)
887 {
888 cutValues[idx] = aCut->GetProductionCut((G4int)idx);
889 }
890 // material/region info
891 G4String materialName = aCouple->GetMaterial()->GetName();
892 G4String regionName = "NONE";
893 if (aCouple->IsUsed())
894 {
895 for(auto rItr=fG4RegionStore->cbegin();
896 rItr!=fG4RegionStore->cend(); ++rItr)
897 {
898 if (IsCoupleUsedInTheRegion(aCouple, *rItr))
899 {
900 regionName = (*rItr)->GetName();
901 break;
902 }
903 }
904 }
905
906 if (ascii)
907 {
908 /////////////// ASCII mode /////////////////
909 // index number
910 fOut << index << G4endl;
911
912 // material name
913 fOut << std::setw(FixedStringLengthForStore) << materialName<< G4endl;
914
915 // region name
916 fOut << std::setw(FixedStringLengthForStore) << regionName<< G4endl;
917
918 fOut.setf(std::ios::scientific);
919 // cut values
920 for (std::size_t idx=0; idx< NumberOfG4CutIndex; ++idx)
921 {
922 fOut << std::setw(FixedStringLengthForStore) << cutValues[idx]/(mm)
923 << G4endl;
924 }
925 fOut.unsetf(std::ios::scientific);
926
927 }
928 else
929 {
930 /////////////// Binary mode /////////////////
931 // index
932 fOut.write( (char*)(&index), sizeof(G4int));
933
934 // material name
935 std::size_t i;
936 for (i=0; i<FixedStringLengthForStore; ++i)
937 temp[i] = '\0';
938 for (i=0; i<materialName.length() && i<FixedStringLengthForStore-1; ++i)
939 temp[i]=materialName[(G4int)i];
940 fOut.write(temp, FixedStringLengthForStore);
941
942 // region name
943 for (i=0; i<FixedStringLengthForStore; ++i)
944 temp[i] = '\0';
945 for (i=0; i<regionName.length() && i<FixedStringLengthForStore-1; ++i)
946 temp[i]=regionName[(G4int)i];
947 fOut.write(temp, FixedStringLengthForStore);
948
949 // cut values
950 for (std::size_t idx=0; idx< NumberOfG4CutIndex; ++idx)
951 {
952 fOut.write( (char*)(&(cutValues[idx])), sizeof(G4double));
953 }
954 }
955 }
956 fOut.close();
957 return true;
958}
959
960// --------------------------------------------------------------------
961G4bool
963 G4bool ascii)
964{
965 // Check stored materialCutsCouple is consistent
966 // with the current detector setup.
967
968 const G4String fileName = directory + "/" + "couple.dat";
969 const G4String key = "COUPLE-V3.0";
970 std::ifstream fIn;
971
972 // open input file
973 if (!ascii ) fIn.open(fileName,std::ios::in|std::ios::binary);
974 else fIn.open(fileName,std::ios::in);
975
976 // check if the file has been opened successfully
977 if (!fIn)
978 {
979#ifdef G4VERBOSE
980 if (verboseLevel >0)
981 {
982 G4cerr << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo() - ";
983 G4cerr << "Cannot open file!" << fileName << G4endl;
984 }
985#endif
986 G4Exception( "G4ProductionCutsTable::CheckMaterialCutsCoupleInfo()",
987 "ProcCuts102", JustWarning, "Cannot open file!");
988 return false;
989 }
990
991 char temp[FixedStringLengthForStore];
992
993 // key word
994 G4String keyword;
995 if (ascii)
996 {
997 fIn >> keyword;
998 }
999 else
1000 {
1001 fIn.read(temp, FixedStringLengthForStore);
1002 keyword = (const char*)(temp);
1003 }
1004 if (key!=keyword)
1005 {
1006#ifdef G4VERBOSE
1007 if (verboseLevel >0)
1008 {
1009 G4cerr << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo() - ";
1010 G4cerr << "Key word in " << fileName << "= " << keyword ;
1011 G4cerr <<"( should be "<< key << ")" << G4endl;
1012 }
1013#endif
1014 G4Exception( "G4ProductionCutsTable::CheckMaterialCutsCoupleInfo()",
1015 "ProcCuts103", JustWarning, "Bad Data Format");
1016 fIn.close();
1017 return false;
1018 }
1019
1020 // numberOfCouples
1021 G4int numberOfCouples;
1022 if (ascii)
1023 {
1024 fIn >> numberOfCouples;
1025 }
1026 else
1027 {
1028 fIn.read( (char*)(&numberOfCouples), sizeof(G4int));
1029 }
1030
1031 // Reset MCCIndexConversionTable
1032 mccConversionTable.Reset(numberOfCouples);
1033
1034 // Read in couple information
1035 for (G4int idx=0; idx<numberOfCouples; ++idx)
1036 {
1037 // read in index
1038 G4int index;
1039 if (ascii)
1040 {
1041 fIn >> index;
1042 }
1043 else
1044 {
1045 fIn.read( (char*)(&index), sizeof(G4int));
1046 }
1047 // read in index material name
1048 char mat_name[FixedStringLengthForStore];
1049 if (ascii)
1050 {
1051 fIn >> mat_name;
1052 }
1053 else
1054 {
1055 fIn.read(mat_name, FixedStringLengthForStore);
1056 }
1057 // read in index and region name
1058 char region_name[FixedStringLengthForStore];
1059 if (ascii)
1060 {
1061 fIn >> region_name;
1062 }
1063 else
1064 {
1065 fIn.read(region_name, FixedStringLengthForStore);
1066 }
1067 // cut value
1068 G4double cutValues[NumberOfG4CutIndex];
1069 for (std::size_t i=0; i< NumberOfG4CutIndex; ++i)
1070 {
1071 if (ascii)
1072 {
1073 fIn >> cutValues[i];
1074 cutValues[i] *= (mm);
1075 }
1076 else
1077 {
1078 fIn.read( (char*)(&(cutValues[i])), sizeof(G4double));
1079 }
1080 }
1081
1082 // Loop over all couples
1083 G4bool fOK = false;
1084 G4MaterialCutsCouple* aCouple = nullptr;
1085 for (auto cItr=coupleTable.cbegin(); cItr!=coupleTable.cend(); ++cItr)
1086 {
1087 aCouple = (*cItr);
1088 // check material name
1089 if ( mat_name != aCouple->GetMaterial()->GetName() ) continue;
1090 // check cut values
1091 G4ProductionCuts* aCut = aCouple->GetProductionCuts();
1092 G4bool fRatio = true;
1093 for (std::size_t j=0; j< NumberOfG4CutIndex; ++j)
1094 {
1095 // check ratio only if values are not the same
1096 if (cutValues[j] != aCut->GetProductionCut((G4int)j))
1097 {
1098 G4double ratio = cutValues[j]/aCut->GetProductionCut((G4int)j);
1099 fRatio = fRatio && (0.999<ratio) && (ratio<1.001) ;
1100 }
1101 }
1102 if (!fRatio) continue;
1103 // MCC matched
1104 fOK = true;
1105 mccConversionTable.SetNewIndex(index, aCouple->GetIndex());
1106 break;
1107 }
1108
1109 if (fOK)
1110 {
1111#ifdef G4VERBOSE
1112 // debug information
1113 if (verboseLevel >1)
1114 {
1115 G4String regionname(region_name);
1116 G4Region* fRegion = nullptr;
1117 if ( regionname != "NONE" )
1118 {
1119 fRegion = fG4RegionStore->GetRegion(region_name);
1120 if (fRegion == nullptr)
1121 {
1122 G4cout << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo() - ";
1123 G4cout << "Region " << regionname << " is not found ";
1124 G4cout << index << ": in " << fileName << G4endl;
1125 }
1126 }
1127 if (((regionname == "NONE") && (aCouple->IsUsed()))
1128 || ((fRegion!=nullptr) && !IsCoupleUsedInTheRegion(aCouple, fRegion)))
1129 {
1130 G4cout << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo()"
1131 << G4endl;
1132 G4cout << "A Couple is used different region in the current setup ";
1133 G4cout << index << ": in " << fileName << G4endl;
1134 G4cout << " material: " << mat_name ;
1135 G4cout << " region: " << region_name << G4endl;
1136 for (std::size_t ii=0; ii< NumberOfG4CutIndex; ++ii)
1137 {
1138 G4cout << "cut[" << ii << "]=" << cutValues[ii]/mm;
1139 G4cout << " mm : ";
1140 }
1141 G4cout << G4endl;
1142 }
1143 else if ( index != aCouple->GetIndex() )
1144 {
1145 G4cout << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo() - ";
1146 G4cout << "Index of couples was modified "<< G4endl;
1147 G4cout << aCouple->GetIndex() << ":"
1148 << aCouple->GetMaterial()->GetName();
1149 G4cout <<" is defined as " ;
1150 G4cout << index << ":" << mat_name << " in " << fileName << G4endl;
1151 }
1152 else
1153 {
1154 G4cout << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo() - ";
1155 G4cout << index << ":" << mat_name << " in " << fileName ;
1156 G4cout << " is consistent with current setup" << G4endl;
1157 }
1158 }
1159#endif
1160 }
1161 else
1162 {
1163#ifdef G4VERBOSE
1164 if (verboseLevel >0)
1165 {
1166 G4cout << "G4ProductionCutTable::CheckMaterialCutsCoupleInfo()"
1167 << G4endl;
1168 G4cout << "Couples are not defined in the current detector setup ";
1169 G4cout << index << ": in " << fileName << G4endl;
1170 G4cout << " material: " << mat_name ;
1171 G4cout << " region: " << region_name << G4endl;
1172 for (std::size_t ii=0; ii< NumberOfG4CutIndex; ++ii)
1173 {
1174 G4cout << "cut[" << ii << "]=" << cutValues[ii]/mm;
1175 G4cout << " mm : ";
1176 }
1177 G4cout << G4endl;
1178 }
1179#endif
1180 }
1181 }
1182 fIn.close();
1183 return true;
1184}
1185
1186// --------------------------------------------------------------------
1188 G4bool ascii)
1189{
1190 // Store cut values information in files under the specified directory
1191
1192 const G4String fileName = directory + "/" + "cut.dat";
1193 const G4String key = "CUT-V3.0";
1194 std::ofstream fOut;
1195 char temp[FixedStringLengthForStore];
1196
1197 // open output file
1198 if (!ascii ) fOut.open(fileName,std::ios::out|std::ios::binary);
1199 else fOut.open(fileName,std::ios::out);
1200
1201 // check if the file has been opened successfully
1202 if (!fOut)
1203 {
1204 if(verboseLevel>0)
1205 {
1206 G4cerr << "G4ProductionCutsTable::StoreCutsInfo() - ";
1207 G4cerr << "Cannot open file: " << fileName << G4endl;
1208 }
1209 G4Exception( "G4ProductionCutsTable::StoreCutsInfo()",
1210 "ProcCuts102", JustWarning, "Cannot open file!");
1211 return false;
1212 }
1213
1214 G4int numberOfCouples = (G4int)coupleTable.size();
1215 if (ascii)
1216 {
1217 /////////////// ASCII mode /////////////////
1218 // key word
1219 fOut << key << G4endl;
1220
1221 // number of couples in the table
1222 fOut << numberOfCouples << G4endl;
1223 }
1224 else
1225 {
1226 /////////////// Binary mode /////////////////
1227 // key word
1228 std::size_t i;
1229 for (i=0; i<FixedStringLengthForStore; ++i)
1230 temp[i] = '\0';
1231 for (i=0; i<key.length() && i<FixedStringLengthForStore-1; ++i)
1232 temp[i]=key[(G4int)i];
1233 fOut.write(temp, FixedStringLengthForStore);
1234
1235 // number of couples in the table
1236 fOut.write( (char*)(&numberOfCouples), sizeof(G4int));
1237 }
1238
1239 for (std::size_t idx=0; idx <NumberOfG4CutIndex; ++idx)
1240 {
1241 const std::vector<G4double>* fRange = GetRangeCutsVector(idx);
1242 const std::vector<G4double>* fEnergy = GetEnergyCutsVector(idx);
1243 std::size_t i=0;
1244 // Loop over all couples
1245 for (auto cItr=coupleTable.cbegin();cItr!=coupleTable.cend(); ++cItr, ++i)
1246 {
1247 if (ascii)
1248 {
1249 /////////////// ASCII mode /////////////////
1250 fOut.setf(std::ios::scientific);
1251 fOut << std::setw(20) << (*fRange)[i]/mm ;
1252 fOut << std::setw(20) << (*fEnergy)[i]/keV << G4endl;
1253 fOut.unsetf(std::ios::scientific);
1254 }
1255 else
1256 {
1257 /////////////// Binary mode /////////////////
1258 G4double cut = (*fRange)[i];
1259 fOut.write((char*)(&cut), sizeof(G4double));
1260 cut = (*fEnergy)[i];
1261 fOut.write((char*)(&cut), sizeof(G4double));
1262 }
1263 }
1264 }
1265 fOut.close();
1266 return true;
1267}
1268
1269// --------------------------------------------------------------------
1271 G4bool ascii)
1272{
1273 // Retrieve cut values information in files under the specified directory
1274
1275 const G4String fileName = directory + "/" + "cut.dat";
1276 const G4String key = "CUT-V3.0";
1277 std::ifstream fIn;
1278
1279 // open input file
1280 if (!ascii ) fIn.open(fileName,std::ios::in|std::ios::binary);
1281 else fIn.open(fileName,std::ios::in);
1282
1283 // check if the file has been opened successfully
1284 if (!fIn)
1285 {
1286 if (verboseLevel >0)
1287 {
1288 G4cerr << "G4ProductionCutTable::RetrieveCutsInfo() - ";
1289 G4cerr << "Cannot open file: " << fileName << G4endl;
1290 }
1291 G4Exception( "G4ProductionCutsTable::RetrieveCutsInfo()",
1292 "ProcCuts102", JustWarning, "Cannot open file!");
1293 return false;
1294 }
1295
1296 char temp[FixedStringLengthForStore];
1297
1298 // key word
1299 G4String keyword;
1300 if (ascii)
1301 {
1302 fIn >> keyword;
1303 }
1304 else
1305 {
1306 fIn.read(temp, FixedStringLengthForStore);
1307 keyword = (const char*)(temp);
1308 }
1309 if (key!=keyword)
1310 {
1311 if (verboseLevel >0)
1312 {
1313 G4cerr << "G4ProductionCutTable::RetrieveCutsInfo() - ";
1314 G4cerr << "Key word in " << fileName << "= " << keyword ;
1315 G4cerr <<"( should be "<< key << ")" << G4endl;
1316 }
1317 G4Exception( "G4ProductionCutsTable::RetrieveCutsInfo()",
1318 "ProcCuts103", JustWarning, "Bad Data Format");
1319 return false;
1320 }
1321
1322 // numberOfCouples
1323 G4int numberOfCouples;
1324 if (ascii)
1325 {
1326 fIn >> numberOfCouples;
1327 if (fIn.fail())
1328 {
1329 G4Exception( "G4ProductionCutsTable::RetrieveCutsInfo()",
1330 "ProcCuts103", JustWarning, "Bad Data Format");
1331 return false;
1332 }
1333 }
1334 else
1335 {
1336 fIn.read( (char*)(&numberOfCouples), sizeof(G4int));
1337 }
1338
1339 if (numberOfCouples > static_cast<G4int>(mccConversionTable.size()) )
1340 {
1341 G4Exception( "G4ProductionCutsTable::RetrieveCutsInfo()",
1342 "ProcCuts109", JustWarning,
1343 "Number of Couples in the file exceeds defined couples");
1344 }
1345 numberOfCouples = (G4int)mccConversionTable.size();
1346
1347 for (std::size_t idx=0; static_cast<G4int>(idx) <NumberOfG4CutIndex; ++idx)
1348 {
1349 std::vector<G4double>* fRange = rangeCutTable[idx];
1350 std::vector<G4double>* fEnergy = energyCutTable[idx];
1351 fRange->clear();
1352 fEnergy->clear();
1353
1354 // Loop over all couples
1355 for (std::size_t i=0; static_cast<G4int>(i)< numberOfCouples; ++i)
1356 {
1357 G4double rcut, ecut;
1358 if (ascii)
1359 {
1360 fIn >> rcut >> ecut;
1361 if (fIn.fail())
1362 {
1363 G4Exception( "G4ProductionCutsTable::RetrieveCutsInfo()",
1364 "ProcCuts103", JustWarning, "Bad Data Format");
1365 return false;
1366 }
1367 rcut *= mm;
1368 ecut *= keV;
1369 }
1370 else
1371 {
1372 fIn.read((char*)(&rcut), sizeof(G4double));
1373 fIn.read((char*)(&ecut), sizeof(G4double));
1374 }
1375 if (!mccConversionTable.IsUsed(i)) continue;
1376 std::size_t new_index = mccConversionTable.GetIndex(i);
1377 (*fRange)[new_index] = rcut;
1378 (*fEnergy)[new_index] = ecut;
1379 }
1380 }
1381 return true;
1382}
1383
1384// --------------------------------------------------------------------
1386{
1387 // Set same verbosity to all registered RangeToEnergyConverters
1388
1389 verboseLevel = value;
1390 for (G4int ip=0; ip< NumberOfG4CutIndex; ++ip)
1391 {
1392 if (converters[ip] != nullptr )
1393 {
1394 converters[ip]->SetVerboseLevel(value);
1395 }
1396 }
1397}
1398
1399// --------------------------------------------------------------------
1404
1405// --------------------------------------------------------------------
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::vector< G4Material * > G4MaterialTable
@ NumberOfG4CutIndex
#define G4BestUnit(a, b)
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
std::size_t GetNoDaughters() const
G4Region * GetRegion() const
G4Material * GetMaterial() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
void SetMaterialCutsCouple(G4MaterialCutsCouple *cuts)
const G4Material * GetMaterial() const
void SetUseFlag(G4bool flg=true)
G4ProductionCuts * GetProductionCuts() const
G4double GetDensity() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
const G4String & GetParticleName() const
static G4ParticleTable * GetParticleTable()
const std::vector< G4double > * GetRangeCutsVector(std::size_t pcIdx) const
virtual G4bool RetrieveCutsInfo(const G4String &directory, G4bool ascii=false)
G4bool RetrieveCutsTable(const G4String &directory, G4bool ascii=false)
virtual G4bool StoreCutsInfo(const G4String &directory, G4bool ascii=false)
void SetMaxEnergyCut(G4double value)
void UpdateCoupleTable(G4VPhysicalVolume *currentWorld)
virtual G4bool CheckMaterialInfo(const G4String &directory, G4bool ascii=false)
virtual G4bool StoreMaterialInfo(const G4String &directory, G4bool ascii=false)
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
G4bool StoreCutsTable(const G4String &directory, G4bool ascii=false)
G4bool CheckForRetrieveCutsTable(const G4String &directory, G4bool ascii=false)
void SetEnergyRange(G4double lowedge, G4double highedge)
static G4ProductionCutsTable * GetProductionCutsTable()
virtual G4bool CheckMaterialCutsCoupleInfo(const G4String &directory, G4bool ascii=false)
void SetEnergyCutVector(const std::vector< G4double > &cutE, std::size_t idx)
G4ProductionCutsTable(const G4ProductionCutsTable &)=delete
G4double ConvertRangeToEnergy(const G4ParticleDefinition *particle, const G4Material *material, G4double range)
virtual G4bool StoreMaterialCutsCoupleInfo(const G4String &directory, G4bool ascii=false)
static G4int GetIndex(const G4String &name)
G4double GetProductionCut(G4int index) const
const std::vector< G4double > & GetProductionCuts() const
static G4RegionStore * GetInstance()
G4Region defines a region or a group of regions in the detector geometry setup, sharing properties as...
Definition G4Region.hh:90
void Stop()
void Start()
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4LogicalVolume * GetLogicalVolume() const
static void SetMaxEnergyCut(const G4double value)
static void SetEnergyRange(const G4double lowedge, const G4double highedge)