CMS 3D CMS Logo

PrintSensitive Class Reference

#include <SimG4Core/PrintGeomInfo/interface/PrintSensitive.h>

Inheritance diagram for PrintSensitive:

SimWatcher Observer< const BeginOfRun * >

List of all members.

Public Member Functions

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

Private Member Functions

void dumpTouch (G4VPhysicalVolume *pv, uint leafDepth, bool printIt, std::ostream &out=std::cout)
G4VPhysicalVolume * getTopPV ()
void update (const BeginOfRun *run)
 This routine will be called when the appropriate signal arrives.

Private Attributes

G4NavigationHistory fHistory
std::string name
int nchar


Detailed Description

Definition at line 16 of file PrintSensitive.h.


Constructor & Destructor Documentation

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

Definition at line 14 of file PrintSensitive.cc.

References GenMuonPlsPt100GeV_cfg::cout, edm::ParameterSet::getUntrackedParameter(), name, and nchar.

00014                                                        {
00015   name  = p.getUntrackedParameter<std::string>("Name","*");
00016   nchar = name.find("*");
00017   name.assign(name,0,nchar);
00018   std::cout << "PrintSensitive:: Print position of all Sensitive Touchables: "
00019             << " for names (0-" << nchar << ") = " << name << "\n";
00020 }

PrintSensitive::~PrintSensitive (  ) 

Definition at line 22 of file PrintSensitive.cc.

00022 {}


Member Function Documentation

void PrintSensitive::dumpTouch ( G4VPhysicalVolume *  pv,
uint  leafDepth,
bool  printIt,
std::ostream &  out = std::cout 
) [private]

Definition at line 30 of file PrintSensitive.cc.

References fHistory, lv, name, nchar, and PV3DBase< T, PVType, FrameType >::perp().

Referenced by update().

00031                                                                {
00032 
00033   if (leafDepth == 0) fHistory.SetFirstEntry(pv);
00034   else fHistory.NewLevel(pv, kNormal, pv->GetCopyNo());
00035 
00036   G4ThreeVector globalpoint = fHistory.GetTopTransform().Inverse().
00037     TransformPoint(G4ThreeVector(0,0,0));
00038   G4LogicalVolume * lv = pv->GetLogicalVolume();
00039 
00040   std::string mother = "World";
00041   if (pv->GetMotherLogical()) mother = pv->GetMotherLogical()->GetName();
00042   std::string lvname = lv->GetName();
00043   lvname.assign(lvname,0,nchar);
00044   if (lvname == name) printIt = true;
00045 
00046   if (lv->GetSensitiveDetector() && printIt) {
00047     out << leafDepth << " ### VOLUME = " << lv->GetName() 
00048         << " Copy No " << pv->GetCopyNo() << " in " << mother
00049         << " global position of centre " << globalpoint << " (r=" 
00050         <<  globalpoint.perp() << ", phi=" <<  globalpoint.phi()/deg
00051         << ")\n";
00052   }
00053 
00054   int NoDaughters = lv->GetNoDaughters();
00055   while ((NoDaughters--)>0)  {
00056     G4VPhysicalVolume * pvD = lv->GetDaughter(NoDaughters);
00057     if (!pvD->IsReplicated()) dumpTouch(pvD, leafDepth+1, printIt, out);
00058   }
00059 
00060   if (leafDepth > 0) fHistory.BackLevel();
00061 }

G4VPhysicalVolume * PrintSensitive::getTopPV (  )  [private]

Definition at line 63 of file PrintSensitive.cc.

Referenced by update().

00063                                              {
00064   return G4TransportationManager::GetTransportationManager()
00065     ->GetNavigatorForTracking()->GetWorldVolume();
00066 }

void PrintSensitive::update ( const BeginOfRun  )  [private, virtual]

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 24 of file PrintSensitive.cc.

References GenMuonPlsPt100GeV_cfg::cout, dumpTouch(), and getTopPV().

00024                                                   {
00025 
00026   G4VPhysicalVolume * theTopPV = getTopPV();
00027   dumpTouch(theTopPV, 0, false, std::cout);
00028 }


Member Data Documentation

G4NavigationHistory PrintSensitive::fHistory [private]

Definition at line 34 of file PrintSensitive.h.

Referenced by dumpTouch().

std::string PrintSensitive::name [private]

Definition at line 32 of file PrintSensitive.h.

Referenced by dumpTouch(), and PrintSensitive().

int PrintSensitive::nchar [private]

Definition at line 33 of file PrintSensitive.h.

Referenced by dumpTouch(), and PrintSensitive().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:19 2009 for CMSSW by  doxygen 1.5.4