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

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 }

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

◆ ~EcalDumpGeometry()

EcalDumpGeometry::~EcalDumpGeometry ( )
default

Member Function Documentation

◆ dumpTouch()

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

Definition at line 55 of file EcalDumpGeometry.cc.

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 }

References EcalBaseNumber::addLevel(), TauDecayModes::dec, LEDCalibrationChannels::depth, ebNumbering_, eeNumbering_, esNumbering_, fHistory_, RemoveAddSevLevel::flag, EcalBaseNumber::getCapacity(), EcalEndcapNumberingScheme::getUnitID(), EcalPreshowerNumberingScheme::getUnitID(), EcalBarrelNumberingScheme::getUnitID(), cuy::ii, infoVec_, dqmdumpme::k, Skims_PA_cff::name, name1_, name2_, names_, noRefl(), MetAnalyzer::pv(), alignCSCRings::r, EcalBaseNumber::reset(), EcalBaseNumber::setSize(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and type_.

Referenced by update().

◆ noRefl()

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

Definition at line 120 of file EcalDumpGeometry.cc.

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 }

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

Referenced by dumpTouch().

◆ update()

void EcalDumpGeometry::update ( )

Definition at line 35 of file EcalDumpGeometry.cc.

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 }

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

◆ 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
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
EcalDumpGeometry::fHistory_
G4NavigationHistory fHistory_
Definition: EcalDumpGeometry.h:39
EcalDumpGeometry::infoVec_
std::vector< CaloDetInfo > infoVec_
Definition: EcalDumpGeometry.h:40
EcalDumpGeometry::eeNumbering_
EcalEndcapNumberingScheme eeNumbering_
Definition: EcalDumpGeometry.h:35
EcalEndcapNumberingScheme::getUnitID
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
Definition: EcalEndcapNumberingScheme.cc:17
EcalDumpGeometry::names_
std::vector< std::string > names_
Definition: EcalDumpGeometry.h:37
EcalBaseNumber::getCapacity
int getCapacity()
Definition: EcalBaseNumber.cc:37
CaloDetInfoLess
Definition: CaloDetInfo.h:42
EcalBaseNumber::addLevel
void addLevel(const std::string &name, const int &copyNumber)
Definition: EcalBaseNumber.cc:16
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
EcalBaseNumber
Definition: EcalBaseNumber.h:12
EcalPreshowerNumberingScheme::getUnitID
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
Definition: EcalPreshowerNumberingScheme.cc:99
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalDumpGeometry::name1_
const std::string name1_
Definition: EcalDumpGeometry.h:33
EcalDumpGeometry::ebNumbering_
EcalBarrelNumberingScheme ebNumbering_
Definition: EcalDumpGeometry.h:34
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
EcalDumpGeometry::name2_
const std::string name2_
Definition: EcalDumpGeometry.h:33
EcalBarrelNumberingScheme::getUnitID
uint32_t getUnitID(const EcalBaseNumber &baseNumber) const override
Definition: EcalBarrelNumberingScheme.cc:19
dqmdumpme.k
k
Definition: dqmdumpme.py:60
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
EcalDumpGeometry::type_
int type_
Definition: EcalDumpGeometry.h:38
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
EcalBaseNumber::reset
void reset()
Definition: EcalBaseNumber.cc:39
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
CaloDetInfo
Definition: CaloDetInfo.h:9
EcalDumpGeometry::esNumbering_
EcalPreshowerNumberingScheme esNumbering_
Definition: EcalDumpGeometry.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignCSCRings.r
r
Definition: alignCSCRings.py:93
EcalDumpGeometry::noRefl
std::string noRefl(const std::string &name)
Definition: EcalDumpGeometry.cc:120
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EcalDumpGeometry::dumpTouch
void dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth)
Definition: EcalDumpGeometry.cc:55
ecalTB2006H4_GenSimDigiReco_cfg.G4cout
G4cout
Definition: ecalTB2006H4_GenSimDigiReco_cfg.py:285
hfnoseParametersInitialization_cfi.name2
name2
Definition: hfnoseParametersInitialization_cfi.py:8
EcalBaseNumber::setSize
void setSize(const int &size)
Definition: EcalBaseNumber.cc:11
edm::Log
Definition: MessageLogger.h:70
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
cuy.ii
ii
Definition: cuy.py:589
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117