CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrintG4Solids Class Reference
Inheritance diagram for PrintG4Solids:
SimWatcher Observer< const BeginOfRun *>

Public Member Functions

 PrintG4Solids (edm::ParameterSet const &p)
 
 ~PrintG4Solids () override=default
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfRun *>
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 

Private Member Functions

void dumpSummary (std::ostream &out=G4cout)
 
G4VPhysicalVolume * getTopPV ()
 
void update (const BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

G4VPhysicalVolume * theTopPV_
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 34 of file PrintG4Solids.cc.

Constructor & Destructor Documentation

◆ PrintG4Solids()

PrintG4Solids::PrintG4Solids ( edm::ParameterSet const &  p)

Definition at line 48 of file PrintG4Solids.cc.

References ecalTB2006H4_GenSimDigiReco_cfg::G4cout.

48  {
49  G4cout << "PrintG4Solids:: initialised for printing information about G4VSolids" << G4endl;
50 }

◆ ~PrintG4Solids()

PrintG4Solids::~PrintG4Solids ( )
overridedefault

Member Function Documentation

◆ dumpSummary()

void PrintG4Solids::dumpSummary ( std::ostream &  out = G4cout)
private

Definition at line 59 of file PrintG4Solids.cc.

References hltPFPuppi_cfi::cone, angle_units::operators::convertRadToDeg(), compareTotals::hist, dqmdumpme::k, EgammaValidation_cff::num, MillePedeFileConverter_cfg::out, and theTopPV_.

Referenced by update().

59  {
60  //---------- Dump number of objects of each class
61  out << " @@@@@@@@@@@@@@@@@@ Dumping G4 geometry objects Summary " << G4endl;
62  if (theTopPV_ == nullptr) {
63  out << " No volume created " << G4endl;
64  return;
65  }
66  out << " @@@ Geometry built inside world volume: " << theTopPV_->GetName() << G4endl;
67  // Get number of solids (< # LV if several LV share a solid)
68  const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance();
69  std::vector<G4LogicalVolume *>::const_iterator lvcite;
70  std::set<G4VSolid *> theSolids;
71  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
72  theSolids.insert((*lvcite)->GetSolid());
73  out << " Number of G4VSolid's: " << theSolids.size() << G4endl;
74  std::set<G4VSolid *>::const_iterator solid;
75  for (solid = theSolids.begin(); solid != theSolids.end(); solid++) {
76  G4String type = (*solid)->GetEntityType();
77  out << (*solid)->GetName() << ":" << type << " Volume " << (*solid)->GetCubicVolume();
78  if (type == "G4Box") {
79  const G4Box *box = static_cast<const G4Box *>(*solid);
80  out << " dx:dy:dz " << box->GetXHalfLength() << ":" << box->GetYHalfLength() << ":" << box->GetZHalfLength();
81  } else if (type == "G4Tubs") {
82  const G4Tubs *tube = static_cast<const G4Tubs *>(*solid);
83  out << " rin:rout:dz:phistart:dphi " << tube->GetInnerRadius() << ":" << tube->GetOuterRadius() << ":"
84  << tube->GetZHalfLength() << ":" << convertRadToDeg(tube->GetStartPhiAngle()) << ":"
85  << convertRadToDeg(tube->GetDeltaPhiAngle());
86  } else if (type == "G4Cons") {
87  const G4Cons *cone = static_cast<const G4Cons *>(*solid);
88  out << " rinminus:routminus:rinplus:routplus:dz:phistart:dphi " << cone->GetInnerRadiusMinusZ() << ":"
89  << cone->GetOuterRadiusMinusZ() << ":" << cone->GetInnerRadiusPlusZ() << ":" << cone->GetOuterRadiusPlusZ()
90  << ":" << cone->GetZHalfLength() << ":" << convertRadToDeg(cone->GetStartPhiAngle()) << ":"
91  << convertRadToDeg(cone->GetDeltaPhiAngle());
92  } else if (type == "G4Trap") {
93  const G4Trap *trap = static_cast<const G4Trap *>(*solid);
94  out << " zhalf:yl1:xl11:xl12:tana1:yl2:xl21:xl22:tana2 " << trap->GetZHalfLength() << ":"
95  << trap->GetYHalfLength1() << ":" << trap->GetXHalfLength1() << ":" << trap->GetXHalfLength2() << ":"
96  << trap->GetTanAlpha1() << ":" << trap->GetYHalfLength2() << ":" << trap->GetXHalfLength3() << ":"
97  << trap->GetXHalfLength4() << ":" << trap->GetTanAlpha2();
98  } else if (type == "G4Trd") {
99  const G4Trd *trd = static_cast<const G4Trd *>(*solid);
100  out << " xl1:xl2:yl1:yl2:zhalf " << trd->GetXHalfLength1() << ":" << trd->GetXHalfLength2() << ":"
101  << trd->GetYHalfLength1() << ":" << trd->GetYHalfLength2() << ":" << trd->GetZHalfLength();
102  } else if (type == "G4Polycone") {
103  const G4Polycone *cone = static_cast<const G4Polycone *>(*solid);
104  const auto hist = cone->GetOriginalParameters();
105  int num = hist->Num_z_planes;
106  out << " angle " << convertRadToDeg(hist->Start_angle) << ":" << convertRadToDeg(hist->Opening_angle) << " with "
107  << num << " planes:";
108  for (int k = 0; k < num; ++k)
109  out << " [" << k << "] " << hist->Z_values[k] << ":" << hist->Rmin[k] << ":" << hist->Rmax[k];
110  } else if (type == "G4Polyhedra") {
111  const G4Polyhedra *pgon = static_cast<const G4Polyhedra *>(*solid);
112  const auto hist = pgon->GetOriginalParameters();
113  int num = hist->Num_z_planes;
114  out << " angle " << convertRadToDeg(hist->Start_angle) << ":" << convertRadToDeg(hist->Opening_angle) << " with "
115  << hist->numSide << " sides and " << num << " planes:";
116  for (int k = 0; k < num; ++k)
117  out << " [" << k << "] " << hist->Z_values[k] << ":" << hist->Rmin[k] << ":" << hist->Rmax[k];
118  } else if (type == "G4ExtrudedSolid") {
119  const G4ExtrudedSolid *pgon = static_cast<const G4ExtrudedSolid *>(*solid);
120  int vert = pgon->GetNofVertices();
121  int numz = pgon->GetNofZSections();
122  out << " " << vert << " vertices:";
123  for (int k = 0; k < vert; ++k)
124  out << " [" << k << "] " << pgon->GetVertex(k);
125  out << "; and " << numz << " z-sections:";
126  for (int k = 0; k < numz; ++k) {
127  const auto &zsec = pgon->GetZSection(k);
128  out << " [" << k << "] " << zsec.fZ << ":" << zsec.fScale << ":" << zsec.fOffset;
129  }
130  }
131  out << G4endl;
132  }
133 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
G4VPhysicalVolume * theTopPV_

◆ getTopPV()

G4VPhysicalVolume * PrintG4Solids::getTopPV ( )
private

Definition at line 135 of file PrintG4Solids.cc.

Referenced by update().

135  {
136  return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
137 }

◆ update()

void PrintG4Solids::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun *>.

Definition at line 52 of file PrintG4Solids.cc.

References dumpSummary(), ecalTB2006H4_GenSimDigiReco_cfg::G4cout, getTopPV(), and theTopPV_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

52  {
53  //Now take action
54  theTopPV_ = getTopPV();
55 
57 }
void dumpSummary(std::ostream &out=G4cout)
G4VPhysicalVolume * theTopPV_
G4VPhysicalVolume * getTopPV()

Member Data Documentation

◆ theTopPV_

G4VPhysicalVolume* PrintG4Solids::theTopPV_
private

Definition at line 45 of file PrintG4Solids.cc.

Referenced by dumpSummary(), and update().