CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PrintSensitive Class Reference

#include <PrintSensitive.h>

Inheritance diagram for PrintSensitive:
SimWatcher Observer< const BeginOfRun * >

Public Member Functions

 PrintSensitive (edm::ParameterSet const &p)
 
 ~PrintSensitive () override
 
- Public Member Functions inherited from SimWatcher
const SimWatcheroperator= (const SimWatcher &)=delete
 
 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=std::cout)
 
G4VPhysicalVolume * getTopPV ()
 
void update (const BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

G4NavigationHistory fHistory
 
std::string name_
 
int nchar_
 

Additional Inherited Members

Detailed Description

Definition at line 16 of file PrintSensitive.h.

Constructor & Destructor Documentation

◆ PrintSensitive()

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

Definition at line 13 of file PrintSensitive.cc.

13  {
14  name_ = p.getUntrackedParameter<std::string>("Name", "*");
15  nchar_ = name_.find('*');
16  name_.assign(name_, 0, nchar_);
17  std::cout << "PrintSensitive:: Print position of all Sensitive Touchables: "
18  << " for names (0-" << nchar_ << ") = " << name_ << "\n";
19 }

References gather_cfg::cout, name_, nchar_, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~PrintSensitive()

PrintSensitive::~PrintSensitive ( )
override

Definition at line 21 of file PrintSensitive.cc.

21 {}

Member Function Documentation

◆ dumpTouch()

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

Definition at line 29 of file PrintSensitive.cc.

29  {
30  if (leafDepth == 0)
31  fHistory.SetFirstEntry(pv);
32  else
33  fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
34 
35  int nsens(ns);
36  G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
37  G4LogicalVolume *lv = pv->GetLogicalVolume();
38 
39  std::string mother = "World";
40  if (pv->GetMotherLogical())
41  mother = pv->GetMotherLogical()->GetName();
42  std::string lvname = lv->GetName();
43  lvname.assign(lvname, 0, nchar_);
44  if (lvname == name_)
45  printIt = true;
46 
47  if (lv->GetSensitiveDetector() && printIt) {
48  ++nsens;
49  out << nsens << ":" << leafDepth << " ### VOLUME = " << lv->GetName() << " Copy No " << pv->GetCopyNo() << " in "
50  << mother << " global position of centre " << globalpoint << " (r=" << globalpoint.perp()
51  << ", phi=" << globalpoint.phi() / CLHEP::deg << ")\n";
52  }
53 
54  int NoDaughters = lv->GetNoDaughters();
55  while ((NoDaughters--) > 0) {
56  G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters);
57  if (!pvD->IsReplicated())
58  nsens = dumpTouch(pvD, leafDepth + 1, printIt, nsens, out);
59  }
60 
61  if (leafDepth > 0)
62  fHistory.BackLevel();
63  return nsens;
64 }

References fHistory, name_, nchar_, MillePedeFileConverter_cfg::out, riemannFit::printIt(), MetAnalyzer::pv(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by update().

◆ getTopPV()

G4VPhysicalVolume * PrintSensitive::getTopPV ( )
private

Definition at line 66 of file PrintSensitive.cc.

66  {
67  return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
68 }

Referenced by update().

◆ update()

void PrintSensitive::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 23 of file PrintSensitive.cc.

23  {
24  G4VPhysicalVolume *theTopPV = getTopPV();
25  int nsens = dumpTouch(theTopPV, 0, false, 0, std::cout);
26  std::cout << "\nTotal number of sensitive detector volumes for " << name_ << " is " << nsens << std::endl;
27 }

References gather_cfg::cout, dumpTouch(), getTopPV(), and name_.

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

Member Data Documentation

◆ fHistory

G4NavigationHistory PrintSensitive::fHistory
private

Definition at line 29 of file PrintSensitive.h.

Referenced by dumpTouch().

◆ name_

std::string PrintSensitive::name_
private

Definition at line 27 of file PrintSensitive.h.

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

◆ nchar_

int PrintSensitive::nchar_
private

Definition at line 28 of file PrintSensitive.h.

Referenced by dumpTouch(), and PrintSensitive().

PrintSensitive::name_
std::string name_
Definition: PrintSensitive.h:27
PrintSensitive::dumpTouch
int dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, bool printIt, int ns, std::ostream &out=std::cout)
Definition: PrintSensitive.cc:29
PrintSensitive::nchar_
int nchar_
Definition: PrintSensitive.h:28
PrintSensitive::getTopPV
G4VPhysicalVolume * getTopPV()
Definition: PrintSensitive.cc:66
gather_cfg.cout
cout
Definition: gather_cfg.py:144
riemannFit::printIt
__host__ __device__ void printIt(C *m, const char *prefix="")
Definition: FitUtils.h:53
PrintSensitive::fHistory
G4NavigationHistory fHistory
Definition: PrintSensitive.h:29
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31