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 12 of file EcalDumpGeometry.cc.

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

16  : name1_(name1), name2_(name2), type_(type) {
17  std::stringstream ss;
18  for (const auto& lvname : names)
19  ss << " " << lvname;
20  G4cout << " Type: " << type << " Depth Names " << name1_ << ":" << name2_ << " with " << names.size()
21  << " LVs: " << ss.str() << G4endl;
22  for (const auto& name : names) {
23  std::string namex = (static_cast<std::string>(dd4hep::dd::noNamespace(name))).substr(0, 4);
24  if (std::find(names_.begin(), names_.end(), namex) == names_.end())
25  names_.emplace_back(namex);
26  }
27  G4cout << "EcalDumpGeometry:: dump geometry information for detector of type " << type_ << " with " << names_.size()
28  << " elements:" << G4endl;
29  for (unsigned int k = 0; k < names_.size(); ++k)
30  G4cout << "[" << k << "] : " << names_[k] << G4endl;
31 }
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_

◆ ~EcalDumpGeometry()

EcalDumpGeometry::~EcalDumpGeometry ( )
default

Member Function Documentation

◆ dumpTouch()

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

Definition at line 53 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_, noRefl(), alignCSCRings::r, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

Referenced by update().

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

◆ noRefl()

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

Definition at line 111 of file EcalDumpGeometry.cc.

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

Referenced by dumpTouch().

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

◆ update()

void EcalDumpGeometry::update ( )

Definition at line 33 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().

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