Skip to content

Commit

Permalink
Merge pull request #35032 from bsunanda/Run3-sim105
Browse files Browse the repository at this point in the history
Run3-sum105 Add a utility function to print all solids with their shape type
  • Loading branch information
cmsbuild committed Aug 30, 2021
2 parents ad8f999 + b8a9bf4 commit 209b393
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 241 deletions.
64 changes: 0 additions & 64 deletions SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h

This file was deleted.

51 changes: 0 additions & 51 deletions SimG4Core/PrintGeomInfo/interface/PrintGeomSummary.h

This file was deleted.

68 changes: 0 additions & 68 deletions SimG4Core/PrintGeomInfo/interface/PrintMaterialBudgetInfo.h

This file was deleted.

32 changes: 0 additions & 32 deletions SimG4Core/PrintGeomInfo/interface/PrintSensitive.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<flags EDM_PLUGIN="1"/>
<use name="DetectorDescription/Core"/>
<use name="DetectorDescription/DDCMS"/>
<use name="SimG4Core/Notification"/>
Expand All @@ -8,3 +7,6 @@
<use name="geant4core"/>
<use name="dd4hep"/>
<use name="boost"/>
<library file="*.cc" name="SimG4CorePrintGeomInfoPlugins">
<flags EDM_PLUGIN="1"/>
</library>
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include "SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h"

#include "SimG4Core/Notification/interface/BeginOfJob.h"
#include "SimG4Core/Notification/interface/BeginOfRun.h"
#include "SimG4Core/Notification/interface/Observer.h"
#include "SimG4Core/Watcher/interface/SimWatcher.h"

#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Math/interface/angle_units.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
Expand All @@ -19,26 +20,73 @@
#include "DD4hep/DD4hepUnits.h"
#include "DD4hep/Filter.h"

#include "G4Run.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#include "G4Material.hh"
#include "G4NavigationHistory.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4Run.hh"
#include "G4Track.hh"
#include "G4VisAttributes.hh"
#include "G4UserLimits.hh"
#include "G4TransportationManager.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4VPhysicalVolume.hh"

#include <algorithm>
#include <fstream>
#include <map>
#include <set>
#include <string>
#include <vector>

using angle_units::operators::convertRadToDeg;

typedef std::multimap<G4LogicalVolume *, G4VPhysicalVolume *, std::less<G4LogicalVolume *> > mmlvpv;

class PrintGeomInfoAction : public SimWatcher,
public Observer<const BeginOfJob *>,
public Observer<const BeginOfRun *> {
public:
PrintGeomInfoAction(edm::ParameterSet const &p);
~PrintGeomInfoAction() override;

private:
void update(const BeginOfJob *job) override;
void update(const BeginOfRun *run) override;
void dumpSummary(std::ostream &out = std::cout);
void dumpG4LVList(std::ostream &out = std::cout);
void dumpG4LVTree(std::ostream &out = std::cout);
void dumpMaterialList(std::ostream &out = std::cout);
void dumpG4LVLeaf(G4LogicalVolume *lv, unsigned int leafDepth, unsigned int count, std::ostream &out = std::cout);
int countNoTouchables();
void add1touchable(G4LogicalVolume *lv, int &nTouch);
void dumpHierarchyTreePVLV(std::ostream &out = std::cout);
void dumpHierarchyLeafPVLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = std::cout);
void dumpLV(G4LogicalVolume *lv, unsigned int leafDepth, std::ostream &out = std::cout);
void dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = std::cout);
void dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out = std::cout);
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out = std::cout);
void dumpInFile();
void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector<std::string> &touches);
std::string spacesFromLeafDepth(unsigned int leafDepth);
G4VPhysicalVolume *getTopPV();
G4LogicalVolume *getTopLV();

private:
bool dumpSummary_, dumpLVTree_, dumpLVList_, dumpMaterial_;
bool dumpLV_, dumpSolid_, dumpAtts_, dumpPV_;
bool dumpRotation_, dumpReplica_, dumpTouch_;
bool dumpSense_, dd4hep_;
std::string name_;
int nchar_;
std::string fileMat_, fileSolid_, fileLV_, filePV_, fileTouch_;
bool fileDetail_;
std::vector<std::string> names_;
G4VPhysicalVolume *theTopPV_;
G4NavigationHistory fHistory_;
};

PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) {
dumpSummary_ = p.getUntrackedParameter<bool>("DumpSummary", true);
dumpLVTree_ = p.getUntrackedParameter<bool>("DumpLVTree", true);
Expand Down Expand Up @@ -538,3 +586,8 @@ G4VPhysicalVolume *PrintGeomInfoAction::getTopPV() {
}

G4LogicalVolume *PrintGeomInfoAction::getTopLV() { return theTopPV_->GetLogicalVolume(); }

#include "SimG4Core/Watcher/interface/SimWatcherFactory.h"
#include "FWCore/PluginManager/interface/ModuleDef.h"

DEFINE_SIMWATCHER(PrintGeomInfoAction);

0 comments on commit 209b393

Please sign in to comment.