CMS 3D CMS Logo

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< HcalNumberingSchemenumberingScheme_
 

Detailed Description

Definition at line 20 of file HcalDumpGeometry.h.

Constructor & Destructor Documentation

◆ HcalDumpGeometry()

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

Definition at line 8 of file HcalDumpGeometry.cc.

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

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

Member Function Documentation

◆ dumpTouch()

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

Definition at line 54 of file HcalDumpGeometry.cc.

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

Referenced by update().

54  {
55  if (leafDepth == 0)
56  fHistory_.SetFirstEntry(pv);
57  else
58  fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo());
59 
60  G4ThreeVector globalpoint = fHistory_.GetTopTransform().Inverse().TransformPoint(G4ThreeVector(0, 0, 0));
61  G4LogicalVolume* lv = pv->GetLogicalVolume();
62 
63  const std::string& lvname = lv->GetName();
64  std::string namex = (getNameNoNS(lvname)).substr(0, 3);
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  int depth = (fHistory_.GetVolume(theSize)->GetCopyNo()) % 10 + 1;
71  int lay = (fHistory_.GetVolume(theSize)->GetCopyNo() / 10) % 100 + 1;
72  int det = (fHistory_.GetVolume(theSize - 1)->GetCopyNo()) / 1000;
74  det, math::XYZVectorD(globalpoint.x(), globalpoint.y(), globalpoint.z()), depth, lay);
75  uint32_t id = numberingScheme_->getUnitID(tmp);
76  G4cout << "Det " << det << " Layer " << lay << ":" << depth << " Volume "
77  << fHistory_.GetVolume(theSize)->GetName() << ":" << fHistory_.GetVolume(theSize - 1)->GetName()
78  << " ID " << std::hex << id << std::dec << G4endl;
79 
80  G4VSolid* solid = lv->GetSolid();
81  infoVec_.emplace_back(CaloDetInfo(id, 0, 0, getNameNoNS(lvname), globalpoint, solid, flag_));
82  }
83  break;
84  }
85  }
86 
87  int NoDaughters = lv->GetNoDaughters();
88  while ((NoDaughters--) > 0) {
89  G4VPhysicalVolume* pvD = lv->GetDaughter(NoDaughters);
90  if (!pvD->IsReplicated())
91  dumpTouch(pvD, leafDepth + 1);
92  }
93 
94  if (leafDepth > 0)
95  fHistory_.BackLevel();
96 }
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_
G4NavigationHistory fHistory_
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
const HcalNumberingFromDDD * numberingFromDDD_
std::unique_ptr< HcalNumberingScheme > numberingScheme_
tmp
align.sh
Definition: createJobs.py:716
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth)

◆ getNameNoNS()

std::string HcalDumpGeometry::getNameNoNS ( const std::string &  name)
private

Definition at line 98 of file HcalDumpGeometry.cc.

References mergeVDriftHistosByStation::name.

Referenced by dumpTouch(), and HcalDumpGeometry().

98  {
99  if (name.find(':') == std::string::npos) {
100  return name;
101  } else {
102  auto n1 = name.find(':') + 1;
103  return name.substr(n1, (name.size() - n1));
104  }
105 }

◆ update()

void HcalDumpGeometry::update ( )

Definition at line 34 of file HcalDumpGeometry.cc.

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

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

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

Member Data Documentation

◆ fHistory_

G4NavigationHistory HcalDumpGeometry::fHistory_
private

Definition at line 38 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

◆ flag_

const bool HcalDumpGeometry::flag_
private

Definition at line 37 of file HcalDumpGeometry.h.

Referenced by dumpTouch().

◆ infoVec_

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

Definition at line 39 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and update().

◆ names_

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

Definition at line 36 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and HcalDumpGeometry().

◆ numberingFromDDD_

const HcalNumberingFromDDD* HcalDumpGeometry::numberingFromDDD_
private

Definition at line 34 of file HcalDumpGeometry.h.

Referenced by dumpTouch().

◆ numberingScheme_

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

Definition at line 35 of file HcalDumpGeometry.h.

Referenced by dumpTouch(), and HcalDumpGeometry().