CMS 3D CMS Logo

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

#include <EcalDumpGeometry.h>

Public Member Functions

 EcalDumpGeometry (const std::vector< std::string_view > &, const std::string &, const std::string &, int)
 
void update ()
 
 ~EcalDumpGeometry ()=default
 

Private Member Functions

void dumpTouch (G4VPhysicalVolume *pv, unsigned int leafDepth)
 
std::string noRefl (const std::string &name)
 

Private Attributes

EcalBarrelNumberingScheme ebNumbering_
 
EcalEndcapNumberingScheme eeNumbering_
 
EcalPreshowerNumberingScheme esNumbering_
 
G4NavigationHistory fHistory_
 
std::vector< CaloDetInfoinfoVec_
 
const std::string name1_
 
const std::string name2_
 
std::vector< std::string > names_
 
int type_
 

Detailed Description

Definition at line 22 of file EcalDumpGeometry.h.

Constructor & Destructor Documentation

◆ EcalDumpGeometry()

EcalDumpGeometry::EcalDumpGeometry ( const std::vector< std::string_view > &  names,
const std::string &  name1,
const std::string &  name2,
int  type 
)
explicit

Definition at line 11 of file EcalDumpGeometry.cc.

References spr::find(), ecalTB2006H4_GenSimDigiReco_cfg::G4cout, dqmdumpme::k, Skims_PA_cff::name, name1_, name2_, names, names_, DD4hep2DDDName::noNameSpace(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

15  : name1_(name1), name2_(name2), type_(type) {
16  std::stringstream ss;
17  for (const auto& lvname : names)
18  ss << " " << lvname;
19  G4cout << " Type: " << type << " Depth Names " << name1_ << ":" << name2_ << " with " << names.size()
20  << " LVs: " << ss.str() << G4endl;
21  for (const auto& name : names) {
22  std::string namex = DD4hep2DDDName::noNameSpace(static_cast<std::string>(name)).substr(0, 4);
23  if (std::find(names_.begin(), names_.end(), namex) == names_.end())
24  names_.emplace_back(namex);
25  }
26  G4cout << "EcalDumpGeometry:: dump geometry information for detector of type " << type_ << " with " << names_.size()
27  << " elements:" << G4endl;
28  for (unsigned int k = 0; k < names_.size(); ++k)
29  G4cout << "[" << k << "] : " << names_[k] << G4endl;
30 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::string names[nVars_]
std::vector< std::string > names_
const std::string name1_
const std::string name2_
std::string noNameSpace(const std::string &name)

◆ ~EcalDumpGeometry()

EcalDumpGeometry::~EcalDumpGeometry ( )
default

Member Function Documentation

◆ dumpTouch()

void EcalDumpGeometry::dumpTouch ( G4VPhysicalVolume *  pv,
unsigned int  leafDepth 
)
private

Definition at line 52 of file EcalDumpGeometry.cc.

References EcalBaseNumber::addLevel(), TauDecayModes::dec, hcalRecHitTable_cff::depth, ebNumbering_, eeNumbering_, esNumbering_, fHistory_, RemoveAddSevLevel::flag, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, EcalBaseNumber::getCapacity(), EcalEndcapNumberingScheme::getUnitID(), EcalPreshowerNumberingScheme::getUnitID(), EcalBarrelNumberingScheme::getUnitID(), cuy::ii, infoVec_, dqmdumpme::k, Skims_PA_cff::name, name1_, name2_, names_, DD4hep2DDDName::noNameSpace(), noRefl(), alignCSCRings::r, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

Referenced by update().

52  {
53  if (leafDepth == 0)
54  fHistory_.SetFirstEntry(pv);
55  else
56  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
57 
58  G4ThreeVector globalpoint = fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
59  G4LogicalVolume* lv = pv->GetLogicalVolume();
60 
61  bool flag = ((type_ / 10) % 10 > 0);
62  std::string lvname = DD4hep2DDDName::noNameSpace(static_cast<std::string>(lv->GetName()));
63  std::string namex = lvname.substr(0, 4);
64  EcalBaseNumber theBaseNumber;
65  for (unsigned int k = 0; k < names_.size(); ++k) {
66  if (namex == names_[k]) {
67  int theSize = fHistory_.GetDepth();
68  //Get name and copy numbers
69  if (theSize > 5) {
70  theBaseNumber.reset();
71  if (theBaseNumber.getCapacity() < theSize + 1)
72  theBaseNumber.setSize(theSize + 1);
73  std::stringstream ss;
74  for (int ii = theSize; ii >= 0; --ii) {
75  std::string name = DD4hep2DDDName::noNameSpace(static_cast<std::string>(fHistory_.GetVolume(ii)->GetName()));
76  theBaseNumber.addLevel(name, fHistory_.GetVolume(ii)->GetCopyNo());
77  ss << " " << ii << " " << name << ":" << fHistory_.GetVolume(ii)->GetCopyNo();
78  }
79  uint32_t id = (((type_ % 10) == 0) ? ebNumbering_.getUnitID(theBaseNumber)
80  : (((type_ % 10) == 1) ? eeNumbering_.getUnitID(theBaseNumber)
81  : esNumbering_.getUnitID(theBaseNumber)));
82  uint32_t depth(0);
83  if ((!name1_.empty()) && (namex == name1_))
84  depth = 1;
85  if ((!name2_.empty()) && (namex == name2_))
86  depth = 2;
87  double r = globalpoint.rho();
88  G4cout << " Field: " << ss.str() << " ID " << std::hex << id << std::dec << ":" << depth << ":" << r << G4endl;
89  G4VSolid* solid = (lv->GetSolid());
90  if (((type_ / 100) % 10) != 0)
91  infoVec_.emplace_back(CaloDetInfo(id, depth, r, noRefl(lvname), globalpoint, solid, flag));
92  else
93  infoVec_.emplace_back(CaloDetInfo(id, depth, r, lvname, globalpoint, solid, flag));
94  }
95  break;
96  }
97  }
98 
99  int NoDaughters = lv->GetNoDaughters();
100  while ((NoDaughters--) > 0) {
101  G4VPhysicalVolume* pvD = lv->GetDaughter(NoDaughters);
102  if (!pvD->IsReplicated())
103  dumpTouch(pvD, leafDepth + 1);
104  }
105 
106  if (leafDepth > 0)
107  fHistory_.BackLevel();
108 }
std::string noRefl(const std::string &name)
EcalPreshowerNumberingScheme esNumbering_
void addLevel(const std::string &name, const int &copyNumber)
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth)
std::vector< CaloDetInfo > infoVec_
std::vector< std::string > names_
ii
Definition: cuy.py:589
EcalEndcapNumberingScheme eeNumbering_
G4NavigationHistory fHistory_
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
const std::string name1_
EcalBarrelNumberingScheme ebNumbering_
const std::string name2_
std::string noNameSpace(const std::string &name)
void setSize(const int &size)

◆ noRefl()

std::string EcalDumpGeometry::noRefl ( const std::string &  name)
private

Definition at line 110 of file EcalDumpGeometry.cc.

References dqmiodumpmetadata::n, and Skims_PA_cff::name.

Referenced by dumpTouch().

110  {
111  if (name.find("_refl") == std::string::npos) {
112  return name;
113  } else {
114  size_t n = name.size();
115  return name.substr(0, n - 5);
116  }
117 }

◆ update()

void EcalDumpGeometry::update ( )

Definition at line 32 of file EcalDumpGeometry.cc.

References dumpTouch(), fHistory_, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, info(), infoVec_, dqmdumpme::k, and jetUpdater_cfi::sort.

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

32  {
33  G4VPhysicalVolume* theTopPV =
34  G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume();
35  G4cout << "EcalDumpGeometry entered with entry of top PV at " << theTopPV << G4endl;
36 
37  dumpTouch(theTopPV, 0);
38  fHistory_.SetFirstEntry(theTopPV);
39  G4cout << "EcalDumpGeometry finds " << infoVec_.size() << " touchables" << G4endl;
40  sort(infoVec_.begin(), infoVec_.end(), CaloDetInfoLess());
41  unsigned int k(0);
42  for (const auto& info : infoVec_) {
43  G4cout << "[" << k << "] " << info << G4endl;
44  if (info.flag() && (info.solid() != nullptr)) {
45  info.solid()->DumpInfo();
46  G4cout << G4endl;
47  }
48  ++k;
49  }
50 }
static const TGPicture * info(bool iBackgroundIsBlack)
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth)
std::vector< CaloDetInfo > infoVec_
G4NavigationHistory fHistory_

Member Data Documentation

◆ ebNumbering_

EcalBarrelNumberingScheme EcalDumpGeometry::ebNumbering_
private

Definition at line 34 of file EcalDumpGeometry.h.

Referenced by dumpTouch().

◆ eeNumbering_

EcalEndcapNumberingScheme EcalDumpGeometry::eeNumbering_
private

Definition at line 35 of file EcalDumpGeometry.h.

Referenced by dumpTouch().

◆ esNumbering_

EcalPreshowerNumberingScheme EcalDumpGeometry::esNumbering_
private

Definition at line 36 of file EcalDumpGeometry.h.

Referenced by dumpTouch().

◆ fHistory_

G4NavigationHistory EcalDumpGeometry::fHistory_
private

Definition at line 39 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

◆ infoVec_

std::vector<CaloDetInfo> EcalDumpGeometry::infoVec_
private

Definition at line 40 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

◆ name1_

const std::string EcalDumpGeometry::name1_
private

Definition at line 33 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and EcalDumpGeometry().

◆ name2_

const std::string EcalDumpGeometry::name2_
private

Definition at line 33 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and EcalDumpGeometry().

◆ names_

std::vector<std::string> EcalDumpGeometry::names_
private

Definition at line 37 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and EcalDumpGeometry().

◆ type_

int EcalDumpGeometry::type_
private