CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonG4Numbering Class Reference

#include <MuonG4Numbering.h>

Public Member Functions

 MuonG4Numbering (const MuonGeometryConstants &muonConstants, const MuonOffsetMap *offMap, bool dd4hep)
 
MuonBaseNumber PhysicalVolumeToBaseNumber (const G4Step *aStep)
 
 ~MuonG4Numbering ()
 

Private Member Functions

const bool copyNoRelevant (const int)
 
const int getCopyNoBaseNo (const int)
 
const int getCopyNoLevel (const int)
 
const int getCopyNoSuperNo (const int)
 

Private Attributes

const bool dd4hep_
 
const MuonOffsetMapoffMap_
 
int theBasePart
 
int theLevelPart
 
int theStartCopyNo
 
int theSuperPart
 

Detailed Description

class to handle the conversion to MuonBaseNumber from tree of G4 copy numbers extracted from G4VPhysicalVolume; needs DDD compatible format of G4 copy numbers; the format itself may in a later version also be defined by DDD constants

in the xml muon constant section one has to define level, super and base constants (eg. 1000,100,1) and the start value of the copy numbers (0 or 1)

Author
Arno Straessner, CERN arno..nosp@m.stra.nosp@m.essne.nosp@m.r@ce.nosp@m.rn.ch

Modification:

Definition at line 26 of file MuonG4Numbering.h.

Constructor & Destructor Documentation

◆ MuonG4Numbering()

MuonG4Numbering::MuonG4Numbering ( const MuonGeometryConstants muonConstants,
const MuonOffsetMap offMap,
bool  dd4hep 
)

Definition at line 16 of file MuonG4Numbering.cc.

17  : offMap_(offMap), dd4hep_(dd4hep) {
18  theLevelPart = muonConstants.getValue("level");
19  theSuperPart = muonConstants.getValue("super");
20  theBasePart = muonConstants.getValue("base");
21  theStartCopyNo = muonConstants.getValue("xml_starts_with_copyno");
22 
23  // some consistency checks
24 
25  if (theBasePart != 1) {
26  edm::LogVerbatim("MuonSim") << "MuonGeometryNumbering finds unusual base constant:" << theBasePart;
27  }
28  if (theSuperPart < 100) {
29  edm::LogVerbatim("MuonSim") << "MuonGeometryNumbering finds unusual super constant:" << theSuperPart;
30  }
31  if (theLevelPart < 10 * theSuperPart) {
32  edm::LogVerbatim("MuonSim") << "MuonGeometryNumbering finds unusual level constant:" << theLevelPart;
33  }
34  if ((theStartCopyNo != 0) && (theStartCopyNo != 1)) {
35  std::cout << "MuonGeometryNumbering finds unusual start value for copy numbers:" << theStartCopyNo << std::endl;
36  }
37 
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("MuonSim") << "StartCopyNo = " << theStartCopyNo;
40  edm::LogVerbatim("MuonSim") << "MuonG4Numbering configured with"
41  << "Level = " << theLevelPart << " Super = " << theSuperPart << " Base = " << theBasePart
42  << " StartCopyNo = " << theStartCopyNo;
43  edm::LogVerbatim("MuonSim") << "dd4hep flag set to " << dd4hep_ << " and offsetmap at " << offMap_;
44 #endif
45 }

References gather_cfg::cout, dd4hep_, MuonGeometryConstants::getValue(), offMap_, theBasePart, theLevelPart, theStartCopyNo, and theSuperPart.

◆ ~MuonG4Numbering()

MuonG4Numbering::~MuonG4Numbering ( )
inline

Definition at line 29 of file MuonG4Numbering.h.

29 {};

Member Function Documentation

◆ copyNoRelevant()

const bool MuonG4Numbering::copyNoRelevant ( const int  copyno)
private

Definition at line 90 of file MuonG4Numbering.cc.

90 { return (copyno / theLevelPart) > 0; }

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

◆ getCopyNoBaseNo()

const int MuonG4Numbering::getCopyNoBaseNo ( const int  copyno)
private

Definition at line 88 of file MuonG4Numbering.cc.

88 { return copyno % theSuperPart; }

References theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

◆ getCopyNoLevel()

const int MuonG4Numbering::getCopyNoLevel ( const int  copyno)
private

Definition at line 84 of file MuonG4Numbering.cc.

84 { return copyno / theLevelPart; }

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

◆ getCopyNoSuperNo()

const int MuonG4Numbering::getCopyNoSuperNo ( const int  copyno)
private

Definition at line 86 of file MuonG4Numbering.cc.

86 { return (copyno % theLevelPart) / theSuperPart; }

References theLevelPart, and theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

◆ PhysicalVolumeToBaseNumber()

MuonBaseNumber MuonG4Numbering::PhysicalVolumeToBaseNumber ( const G4Step *  aStep)

Definition at line 47 of file MuonG4Numbering.cc.

47  {
49  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
50 
51  for (int ii = 0; ii < touch->GetHistoryDepth(); ii++) {
52  G4VPhysicalVolume* vol = touch->GetVolume(ii);
53  int copyno = vol->GetCopyNo();
54  int extra(0);
55  if (dd4hep_ && (offMap_ != nullptr)) {
56  std::string namx = static_cast<std::string>(dd4hep::dd::noNamespace(vol->GetName()));
57  std::size_t last = namx.rfind('_');
58  std::string name = ((last == std::string::npos) ? namx : (namx.substr(0, last)));
59  auto itr = offMap_->muonMap_.find(name);
60  if (itr != offMap_->muonMap_.end())
61  extra = (itr->second).first + (itr->second).second;
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("MuonSim") << "MuonG4Numbering: " << namx << ":" << name << " iterator "
64  << (itr != offMap_->muonMap_.end()) << " Extra " << extra;
65 #endif
66  }
67  copyno += extra;
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("MuonSim") << "MuonG4Numbering: " << vol->GetName() << " " << copyno << " Split "
70  << copyNoRelevant(copyno) << ":" << theLevelPart << ":" << theSuperPart << " ";
71 #endif
72  if (copyNoRelevant(copyno)) {
73  num.addBase(getCopyNoLevel(copyno), getCopyNoSuperNo(copyno), getCopyNoBaseNo(copyno) - theStartCopyNo);
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("MuonSim") << " NoLevel " << getCopyNoLevel(copyno) << " Super " << getCopyNoSuperNo(copyno)
76  << " Base " << getCopyNoBaseNo(copyno) << " Start " << theStartCopyNo;
77 #endif
78  }
79  }
80 
81  return num;
82 }

References copyNoRelevant(), dd4hep_, getCopyNoBaseNo(), getCopyNoLevel(), getCopyNoSuperNo(), cuy::ii, dqmdumpme::last, MuonOffsetMap::muonMap_, Skims_PA_cff::name, EgammaValidation_cff::num, offMap_, edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, theLevelPart, theStartCopyNo, and theSuperPart.

Referenced by MuonSensitiveDetector::setDetUnitId(), and MuonRPCFrameRotation::transformPoint().

Member Data Documentation

◆ dd4hep_

const bool MuonG4Numbering::dd4hep_
private

Definition at line 40 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

◆ offMap_

const MuonOffsetMap* MuonG4Numbering::offMap_
private

Definition at line 39 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

◆ theBasePart

int MuonG4Numbering::theBasePart
private

Definition at line 43 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering().

◆ theLevelPart

int MuonG4Numbering::theLevelPart
private

◆ theStartCopyNo

int MuonG4Numbering::theStartCopyNo
private

Definition at line 44 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

◆ theSuperPart

int MuonG4Numbering::theSuperPart
private
MuonG4Numbering::theSuperPart
int theSuperPart
Definition: MuonG4Numbering.h:42
MuonG4Numbering::dd4hep_
const bool dd4hep_
Definition: MuonG4Numbering.h:40
MuonG4Numbering::getCopyNoBaseNo
const int getCopyNoBaseNo(const int)
Definition: MuonG4Numbering.cc:88
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MuonG4Numbering::getCopyNoLevel
const int getCopyNoLevel(const int)
Definition: MuonG4Numbering.cc:84
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
MuonG4Numbering::theStartCopyNo
int theStartCopyNo
Definition: MuonG4Numbering.h:44
dqmdumpme.last
last
Definition: dqmdumpme.py:56
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonG4Numbering::theBasePart
int theBasePart
Definition: MuonG4Numbering.h:43
MuonG4Numbering::theLevelPart
int theLevelPart
Definition: MuonG4Numbering.h:41
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition: MuonGeometryConstants.cc:8
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
MuonBaseNumber
Definition: MuonBaseNumber.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dd4hep
Definition: DDPlugins.h:8
MuonG4Numbering::copyNoRelevant
const bool copyNoRelevant(const int)
Definition: MuonG4Numbering.cc:90
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MuonG4Numbering::offMap_
const MuonOffsetMap * offMap_
Definition: MuonG4Numbering.h:39
MuonG4Numbering::getCopyNoSuperNo
const int getCopyNoSuperNo(const int)
Definition: MuonG4Numbering.cc:86
MuonOffsetMap::muonMap_
std::unordered_map< std::string, std::pair< int, int > > muonMap_
Definition: MuonOffsetMap.h:14
cuy.ii
ii
Definition: cuy.py:590