CMS 3D CMS Logo

List of all members | Public Member Functions
CMSG4RegionReporter Class Reference

#include <CMSG4RegionReporter.h>

Public Member Functions

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

Detailed Description

Definition at line 6 of file CMSG4RegionReporter.h.

Constructor & Destructor Documentation

◆ CMSG4RegionReporter()

CMSG4RegionReporter::CMSG4RegionReporter ( )

Definition at line 14 of file CMSG4RegionReporter.cc.

14 {}

◆ ~CMSG4RegionReporter()

CMSG4RegionReporter::~CMSG4RegionReporter ( )

Definition at line 16 of file CMSG4RegionReporter.cc.

16 {}

Member Function Documentation

◆ ReportRegions()

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

Definition at line 18 of file CMSG4RegionReporter.cc.

18  {
19  std::ofstream fout(ss.c_str(), std::ios::out);
20  if (fout.fail()) {
21  edm::LogWarning("SimG4CoreGeometry") << "CMSG4RegionReporter: file <" << ss
22  << "> is not opened - no report provided";
23  return;
24  }
25  G4RegionStore* regStore = G4RegionStore::GetInstance();
26 
27  unsigned int numRegions = regStore->size();
28 
29  unsigned int i;
30 
31  fout << "\n";
32  fout << "#---------------------------------------------------------------------";
33  fout << "------------------------------------"
34  << "\n";
35  fout << "## List of Regions, root logical volumes and cuts. "
36  << "\n";
37  fout << "## Number of regions = " << numRegions << "\n";
38 
39  // Banner
40  fout << "# " << std::setw(24) << " Region, " << std::setw(38) << " LogicalVolume, "
41  << " Cuts:Gamma, Electron, Positron, Proton, Units"
42  << "\n";
43  fout << "#---------------------------------------------------------------------";
44  fout << "------------------------------------"
45  << "\n";
46 
47  for (i = 0; i < numRegions; ++i) {
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 = region->GetRootLogicalVolumeIterator();
58  size_t numRootLV = region->GetNumberOfRootVolumes();
59 
60  for (size_t iLV = 0; iLV < numRootLV; ++iLV, ++rootLVItr) {
61  // Cover each root logical volume in this region
62 
63  //Set the couple to the proper logical volumes in that region
64  lv = *rootLVItr;
65 
66  // fout << " Region=" << region->GetName()
67  // << " Logical-Volume = " << lv->GetName();
68  char quote = '"';
69  std::ostringstream regName, lvName;
70  regName << quote << region->GetName() << quote;
71  lvName << quote << lv->GetName() << quote;
72  fout << " " << std::setw(26) << regName.str() << " ,";
73  fout << " " << std::setw(36) << lvName.str() << " ,";
74 
75  unsigned int ic;
76  for (ic = 0; ic < pmax; ++ic) {
77  G4double cutLength = prodCuts->GetProductionCut(ic);
78  fout << " " << std::setw(5) << cutLength / lengthUnit;
79  if (ic < pmax - 1) {
80  fout << " , ";
81  } else {
82  fout << " , " << lengthUnitName;
83  }
84  }
85  fout << "\n";
86  }
87  }
88  fout << "#---------------------------------------------------------------------";
89  fout << "------------------------------------"
90  << "\n";
91  fout << "\n";
92  fout.close();
93 }

References groupFilesInBlocks::fout, mps_fire::i, MillePedeFileConverter_cfg::out, HLT_FULL_cff::region, and contentValuesCheck::ss.

Referenced by CMSG4CheckOverlap::CMSG4CheckOverlap().

mps_fire.i
i
Definition: mps_fire.py:428
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31