CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrintSensitive Class Reference
Inheritance diagram for PrintSensitive:
SimWatcher Observer< const BeginOfRun *>

Public Member Functions

 PrintSensitive (edm::ParameterSet const &p)
 
 ~PrintSensitive () override
 
- 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

int dumpTouch (G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, 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

bool dd4hep_
 
G4NavigationHistory fHistory
 
std::string name_
 
int nchar_
 

Additional Inherited Members

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

Detailed Description

Definition at line 16 of file PrintSensitive.cc.

Constructor & Destructor Documentation

◆ PrintSensitive()

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

Definition at line 33 of file PrintSensitive.cc.

References dd4hep_, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, name_, nchar_, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

33  {
34  name_ = p.getParameter<std::string>("Name");
35  dd4hep_ = p.getParameter<bool>("DD4hep");
36  nchar_ = name_.find('*');
37  name_.assign(name_, 0, nchar_);
38  G4cout << "PrintSensitive:: Print position of all Sensitive Touchables: "
39  << " for names (0-" << nchar_ << ") = " << name_ << " dd4hep " << dd4hep_ << G4endl;
40 }
std::string name_

◆ ~PrintSensitive()

PrintSensitive::~PrintSensitive ( )
override

Definition at line 42 of file PrintSensitive.cc.

42 {}

Member Function Documentation

◆ dumpTouch()

int PrintSensitive::dumpTouch ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth,
bool  printIt,
int  ns,
std::ostream &  out = G4cout 
)
private

Definition at line 50 of file PrintSensitive.cc.

References dd4hep_, fHistory, name_, DD4hep2DDDName::nameSolid(), nchar_, MillePedeFileConverter_cfg::out, riemannFit::printIt(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by update().

50  {
51  if (leafDepth == 0)
52  fHistory.SetFirstEntry(pv);
53  else
54  fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
55 
56  int nsens(ns);
57  G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
58  G4LogicalVolume *lv = pv->GetLogicalVolume();
59 
60  std::string mother = (pv->GetMotherLogical())
62  static_cast<std::string>(pv->GetMotherLogical()->GetSolid()->GetName()), dd4hep_))
63  : "World";
64  std::string lvname = DD4hep2DDDName::nameSolid(static_cast<std::string>(lv->GetSolid()->GetName()), dd4hep_);
65  if (nchar_ > 0) {
66  lvname.assign(lvname, 0, nchar_);
67  if (lvname == name_)
68  printIt = true;
69  } else {
70  printIt = true;
71  }
72 
73  if (lv->GetSensitiveDetector() && printIt) {
74  ++nsens;
75  lvname = DD4hep2DDDName::nameSolid(static_cast<std::string>(lv->GetName()), dd4hep_);
76  out << nsens << ":" << leafDepth << " ### VOLUME = " << lvname << " Copy No " << pv->GetCopyNo() << " in " << mother
77  << " global position of centre " << globalpoint << " (r=" << globalpoint.perp()
78  << ", phi=" << globalpoint.phi() / CLHEP::deg << ")\n";
79  }
80 
81  int NoDaughters = lv->GetNoDaughters();
82  while ((NoDaughters--) > 0) {
83  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
84  if (!pvD->IsReplicated())
85  nsens = dumpTouch(pvD, leafDepth + 1, printIt, nsens, out);
86  }
87 
88  if (leafDepth > 0)
89  fHistory.BackLevel();
90  return nsens;
91 }
G4NavigationHistory fHistory
std::string name_
int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out=G4cout)
std::string nameSolid(const std::string &name, bool dd4hep)
__host__ __device__ void printIt(C *m, const char *prefix="")
Definition: FitUtils.h:53

◆ getTopPV()

G4VPhysicalVolume * PrintSensitive::getTopPV ( )
private

Definition at line 93 of file PrintSensitive.cc.

Referenced by update().

93  {
94  return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
95 }

◆ update()

void PrintSensitive::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun *>.

Definition at line 44 of file PrintSensitive.cc.

References dumpTouch(), ecalTB2006H4_GenSimDigiReco_cfg::G4cout, getTopPV(), and name_.

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

44  {
45  G4VPhysicalVolume *theTopPV = getTopPV();
46  int nsens = dumpTouch(theTopPV, 0, false, 0, G4cout);
47  G4cout << "\nTotal number of sensitive detector volumes for " << name_ << " is " << nsens << G4endl;
48 }
G4VPhysicalVolume * getTopPV()
std::string name_
int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out=G4cout)

Member Data Documentation

◆ dd4hep_

bool PrintSensitive::dd4hep_
private

Definition at line 28 of file PrintSensitive.cc.

Referenced by dumpTouch(), and PrintSensitive().

◆ fHistory

G4NavigationHistory PrintSensitive::fHistory
private

Definition at line 30 of file PrintSensitive.cc.

Referenced by dumpTouch().

◆ name_

std::string PrintSensitive::name_
private

Definition at line 27 of file PrintSensitive.cc.

Referenced by dumpTouch(), PrintSensitive(), and update().

◆ nchar_

int PrintSensitive::nchar_
private

Definition at line 29 of file PrintSensitive.cc.

Referenced by dumpTouch(), and PrintSensitive().