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 10 of file HcalDumpGeometry.cc.

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 }

References spr::find(), getNameNoNS(), dqmdumpme::k, Skims_PA_cff::name, names, names_, numberingScheme_, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~HcalDumpGeometry()

HcalDumpGeometry::~HcalDumpGeometry ( )
default

Member Function Documentation

◆ dumpTouch()

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

Definition at line 57 of file HcalDumpGeometry.cc.

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 }

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

Referenced by update().

◆ getNameNoNS()

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

Definition at line 104 of file HcalDumpGeometry.cc.

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 }

References Skims_PA_cff::name.

Referenced by dumpTouch(), and HcalDumpGeometry().

◆ update()

void HcalDumpGeometry::update ( )

Definition at line 37 of file HcalDumpGeometry.cc.

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 }

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().

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().

HcalDumpGeometry::getNameNoNS
std::string getNameNoNS(const std::string &name)
Definition: HcalDumpGeometry.cc:104
HcalNumberingFromDDD::HcalID
Definition: HcalNumberingFromDDD.h:21
HcalDumpGeometry::fHistory_
G4NavigationHistory fHistory_
Definition: HcalDumpGeometry.h:38
HcalDumpGeometry::infoVec_
std::vector< CaloDetInfo > infoVec_
Definition: HcalDumpGeometry.h:39
CaloDetInfoLess
Definition: CaloDetInfo.h:42
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
HcalDumpGeometry::numberingScheme_
std::unique_ptr< HcalNumberingScheme > numberingScheme_
Definition: HcalDumpGeometry.h:35
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
HcalDumpGeometry::numberingFromDDD_
const HcalNumberingFromDDD * numberingFromDDD_
Definition: HcalDumpGeometry.h:34
test
Definition: SmallWORMDict.h:13
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
HcalDumpGeometry::dumpTouch
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth)
Definition: HcalDumpGeometry.cc:57
dqmdumpme.k
k
Definition: dqmdumpme.py:60
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
math::XYZVectorD
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
HcalTestNumberingScheme
Definition: HcalTestNumberingScheme.h:11
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
CaloDetInfo
Definition: CaloDetInfo.h:9
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HcalNumberingFromDDD::unitID
HcalID unitID(int det, const math::XYZVectorD &pos, int depth, int lay=-1) const
Definition: HcalNumberingFromDDD.cc:30
HcalDumpGeometry::names_
std::vector< std::string > names_
Definition: HcalDumpGeometry.h:36
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ecalTB2006H4_GenSimDigiReco_cfg.G4cout
G4cout
Definition: ecalTB2006H4_GenSimDigiReco_cfg.py:285
edm::Log
Definition: MessageLogger.h:70
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HcalDumpGeometry::flag_
const bool flag_
Definition: HcalDumpGeometry.h:37
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116