CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
G4RegionReporter Class Reference

#include <G4RegionReporter.h>

Public Member Functions

 G4RegionReporter ()
 
void ReportRegions (const std::string &ss)
 
 ~G4RegionReporter ()
 

Detailed Description

Definition at line 6 of file G4RegionReporter.h.

Constructor & Destructor Documentation

G4RegionReporter::G4RegionReporter ( )

Definition at line 13 of file G4RegionReporter.cc.

14 {}
G4RegionReporter::~G4RegionReporter ( )

Definition at line 16 of file G4RegionReporter.cc.

17 {}

Member Function Documentation

void G4RegionReporter::ReportRegions ( const std::string &  ss)

Definition at line 19 of file G4RegionReporter.cc.

References gather_cfg::cout, groupFilesInBlocks::fout, i, dbtoconf::out, and HLT_25ns14e33_v3_cff::region.

Referenced by RunManager::initG4(), and RunManagerMT::initG4().

20 {
21  std::ofstream fout(ss.c_str(), std::ios::out);
22  if(fout.fail()){
23  std::cout << "SimG4CoreApplication ReportRegions WARNING : "
24  << "error opening file <" << ss << ">" << std::endl;
25  return;
26  }
27  G4RegionStore* regStore = G4RegionStore::GetInstance();
28 
29  unsigned int numRegions= regStore->size();
30 
31  unsigned int i;
32 
33  fout << std::endl;
34  fout << "#---------------------------------------------------------------------";
35  fout << "------------------------------------" << std::endl;
36  fout << "## List of Regions, root logical volumes and cuts. " << std::endl;
37  fout << "## Number of regions = " << numRegions << std::endl;
38 
39  // Banner
40  fout << "# " << std::setw(24) << " Region, "
41  << std::setw(38) << " LogicalVolume, "
42  << " Cuts:Gamma, Electron, Positron, Proton, Units" << std::endl;
43  fout << "#---------------------------------------------------------------------";
44  fout << "------------------------------------" << std::endl;
45 
46  for( i=0; i<numRegions; ++i)
47  {
48  G4Region* region = regStore->at(i);
49  G4ProductionCuts* prodCuts = region->GetProductionCuts();
50 
51  G4LogicalVolume* lv;
52 
53  G4double lengthUnit = CLHEP::mm;
54  G4String lengthUnitName= "mm";
55  unsigned int pmax= 4; // g, e-, e+, proton
56 
57  std::vector<G4LogicalVolume*>::iterator rootLVItr
58  = region->GetRootLogicalVolumeIterator();
59  size_t numRootLV = region->GetNumberOfRootVolumes();
60 
61  for(size_t iLV=0; iLV < numRootLV; ++iLV, ++rootLVItr )
62  {
63  // Cover each root logical volume in this region
64 
65  //Set the couple to the proper logical volumes in that region
66  lv = *rootLVItr;
67 
68  // fout << " Region=" << region->GetName()
69  // << " Logical-Volume = " << lv->GetName();
70  char quote='"';
71  std::ostringstream regName, lvName;
72  regName << quote << region->GetName() << quote;
73  lvName << quote << lv->GetName() << quote;
74  fout << " " << std::setw(26) << regName.str() << " ,";
75  fout << " " << std::setw(36) << lvName.str() << " ,";
76 
77  unsigned int ic;
78  for( ic= 0; ic< pmax; ++ic)
79  {
80  G4double cutLength = prodCuts->GetProductionCut(ic);
81  fout << " " << std::setw(5) << cutLength / lengthUnit;
82  if (ic < pmax-1) {
83  fout << " , ";
84  } else {
85  fout << " , " << lengthUnitName;
86  }
87  }
88  fout << std::endl;
89  }
90  }
91  fout << "#---------------------------------------------------------------------";
92  fout << "------------------------------------" << std::endl;
93  fout << std::endl;
94  fout.close();
95 }
int i
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:121