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
HcalDumpGeometry Class Reference

#include <HcalDumpGeometry.h>

Public Member Functions

 HcalDumpGeometry (const std::vector< std::string_view > &, const HcalNumberingFromDDD *, bool, bool flag=false)
 
void update ()
 
 ~HcalDumpGeometry ()=default
 

Private Member Functions

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

Private Attributes

G4NavigationHistory fHistory_
 
const bool flag_
 
std::vector< CaloDetInfoinfoVec_
 
std::vector< std::string > names_
 
const HcalNumberingFromDDDnumberingFromDDD_
 
std::unique_ptr
< HcalNumberingScheme
numberingScheme_
 

Detailed Description

Definition at line 20 of file HcalDumpGeometry.h.

Constructor & Destructor Documentation

HcalDumpGeometry::HcalDumpGeometry ( const std::vector< std::string_view > &  names,
const HcalNumberingFromDDD hcn,
bool  test,
bool  flag = false 
)
explicit

Definition at line 10 of file HcalDumpGeometry.cc.

References spr::find(), getNameNoNS(), isotrackApplyRegressor::k, mergeVDriftHistosByStation::name, names_, numberingScheme_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

14  : numberingFromDDD_(hcn), flag_(flag) {
15  if (test)
16  numberingScheme_.reset(dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(false)));
17  else
18  numberingScheme_ = std::make_unique<HcalNumberingScheme>();
19  std::stringstream ss;
20  for (const auto& lvname : names)
21  ss << " " << lvname;
22  edm::LogVerbatim("HCalGeom") << " Testmode: " << test << " with " << names.size() << " LVs: " << ss.str();
23  const std::vector<std::string> namg = {"HBS", "HES", "HTS", "HVQ"};
24  for (const auto& name : names) {
25  std::string namex = (getNameNoNS(static_cast<std::string>(name))).substr(0, 3);
26  if (std::find(namg.begin(), namg.end(), namex) != namg.end()) {
27  if (std::find(names_.begin(), names_.end(), namex) == names_.end())
28  names_.emplace_back(namex);
29  }
30  }
31  edm::LogVerbatim("HCalGeom") << "HcalDumpGeometry:: dump geometry information for Hcal with " << names_.size()
32  << " elements:";
33  for (unsigned int k = 0; k < names_.size(); ++k)
34  edm::LogVerbatim("HCalGeom") << "[" << k << "] : " << names_[k];
35 }
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_
std::string getNameNoNS(const std::string &name)
const HcalNumberingFromDDD * numberingFromDDD_
std::unique_ptr< HcalNumberingScheme > numberingScheme_
HcalDumpGeometry::~HcalDumpGeometry ( )
default

Member Function Documentation

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

Definition at line 57 of file HcalDumpGeometry.cc.

References TauDecayModes::dec, HLT_FULL_cff::depth, fHistory_, flag_, getNameNoNS(), infoVec_, isotrackApplyRegressor::k, names_, numberingFromDDD_, numberingScheme_, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, and HcalNumberingFromDDD::unitID().

Referenced by update().

57  {
58  if (leafDepth == 0)
59  fHistory_.SetFirstEntry(pv);
60  else
61  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
62 
63  G4ThreeVector globalpoint = fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
64  G4LogicalVolume* lv = pv->GetLogicalVolume();
65 
66  const std::string& lvname = lv->GetName();
67  std::string namex = (getNameNoNS(lvname)).substr(0, 3);
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  int depth = (fHistory_.GetVolume(theSize)->GetCopyNo()) % 10 + 1;
74  int lay = (fHistory_.GetVolume(theSize)->GetCopyNo() / 10) % 100 + 1;
75  int det = (fHistory_.GetVolume(theSize - 1)->GetCopyNo()) / 1000;
77  det, math::XYZVectorD(globalpoint.x(), globalpoint.y(), globalpoint.z()), depth, lay);
78  uint32_t id = numberingScheme_->getUnitID(tmp);
79 #ifdef EDM_ML_DEBUG
80  edm::LogVerbatim("HCalGeom") << "Det " << det << " Layer " << lay << ":" << depth << " Volume "
81  << fHistory_.GetVolume(theSize)->GetName() << ":"
82  << fHistory_.GetVolume(theSize - 1)->GetName() << " ID " << std::hex << id
83  << std::dec;
84 #endif
85 
86  G4VSolid* solid = lv->GetSolid();
87  infoVec_.emplace_back(CaloDetInfo(id, 0, 0, getNameNoNS(lvname), globalpoint, solid, flag_));
88  }
89  break;
90  }
91  }
92 
93  int NoDaughters = lv->GetNoDaughters();
94  while ((NoDaughters--) > 0) {
95  G4VPhysicalVolume* pvD = lv->GetDaughter(NoDaughters);
96  if (!pvD->IsReplicated())
97  dumpTouch(pvD, leafDepth + 1);
98  }
99 
100  if (leafDepth > 0)
101  fHistory_.BackLevel();
102 }
Log< level::Info, true > LogVerbatim
std::vector< std::string > names_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
std::string getNameNoNS(const std::string &name)
std::vector< CaloDetInfo > infoVec_
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
G4NavigationHistory fHistory_
const HcalNumberingFromDDD * numberingFromDDD_
std::unique_ptr< HcalNumberingScheme > numberingScheme_
tmp
align.sh
Definition: createJobs.py:716
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth)
std::string HcalDumpGeometry::getNameNoNS ( const std::string &  name)
private

Definition at line 104 of file HcalDumpGeometry.cc.

References mergeVDriftHistosByStation::name.

Referenced by dumpTouch(), and HcalDumpGeometry().

104  {
105  if (name.find(':') == std::string::npos) {
106  return name;
107  } else {
108  auto n1 = name.find(':') + 1;
109  return name.substr(n1, (name.size() - n1));
110  }
111 }
void HcalDumpGeometry::update ( )

Definition at line 37 of file HcalDumpGeometry.cc.

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

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

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

Member Data Documentation

G4NavigationHistory HcalDumpGeometry::fHistory_
private

Definition at line 38 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

const bool HcalDumpGeometry::flag_
private

Definition at line 37 of file HcalDumpGeometry.h.

Referenced by dumpTouch().

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

Definition at line 39 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

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

Definition at line 36 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and HcalDumpGeometry().

const HcalNumberingFromDDD* HcalDumpGeometry::numberingFromDDD_
private

Definition at line 34 of file HcalDumpGeometry.h.

Referenced by dumpTouch().

std::unique_ptr<HcalNumberingScheme> HcalDumpGeometry::numberingScheme_
private

Definition at line 35 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and HcalDumpGeometry().