CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( const std::vector< std::string_view > &  names,
const std::string &  name1,
const std::string &  name2,
int  type 
)
explicit

Definition at line 14 of file EcalDumpGeometry.cc.

References spr::find(), isotrackApplyRegressor::k, mergeVDriftHistosByStation::name, name1_, name2_, names_, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

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

Member Function Documentation

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

Definition at line 55 of file EcalDumpGeometry.cc.

References EcalBaseNumber::addLevel(), TauDecayModes::dec, HLT_FULL_cff::depth, ebNumbering_, eeNumbering_, esNumbering_, fHistory_, EcalBaseNumber::getCapacity(), EcalEndcapNumberingScheme::getUnitID(), EcalPreshowerNumberingScheme::getUnitID(), EcalBarrelNumberingScheme::getUnitID(), cuy::ii, infoVec_, isotrackApplyRegressor::k, mergeVDriftHistosByStation::name, name1_, name2_, names_, noRefl(), alignCSCRings::r, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

Referenced by update().

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

Definition at line 120 of file EcalDumpGeometry.cc.

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

Referenced by dumpTouch().

120  {
121  if (name.find("_refl") == std::string::npos) {
122  return name;
123  } else {
124  size_t n = name.size();
125  return name.substr(0, n - 5);
126  }
127 }
void EcalDumpGeometry::update ( )

Definition at line 35 of file EcalDumpGeometry.cc.

References dumpTouch(), fHistory_, info(), infoVec_, and isotrackApplyRegressor::k.

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

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

Member Data Documentation

EcalBarrelNumberingScheme EcalDumpGeometry::ebNumbering_
private

Definition at line 34 of file EcalDumpGeometry.h.

Referenced by dumpTouch().

EcalEndcapNumberingScheme EcalDumpGeometry::eeNumbering_
private

Definition at line 35 of file EcalDumpGeometry.h.

Referenced by dumpTouch().

EcalPreshowerNumberingScheme EcalDumpGeometry::esNumbering_
private

Definition at line 36 of file EcalDumpGeometry.h.

Referenced by dumpTouch().

G4NavigationHistory EcalDumpGeometry::fHistory_
private

Definition at line 39 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

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

Definition at line 40 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

const std::string EcalDumpGeometry::name1_
private

Definition at line 33 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and EcalDumpGeometry().

const std::string EcalDumpGeometry::name2_
private

Definition at line 33 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and EcalDumpGeometry().

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

Definition at line 37 of file EcalDumpGeometry.h.

Referenced by dumpTouch(), and EcalDumpGeometry().

int EcalDumpGeometry::type_
private