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
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 ( const MuonGeometryConstants muonConstants,
const MuonOffsetMap offMap,
bool  dd4hep 
)

Definition at line 16 of file MuonG4Numbering.cc.

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

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 }
Log< level::Info, true > LogVerbatim
int getValue(const std::string &name) const
const MuonOffsetMap * offMap_
tuple dd4hep
Definition: dd4hep_cff.py:3
const bool dd4hep_
tuple cout
Definition: gather_cfg.py:144
MuonG4Numbering::~MuonG4Numbering ( )
inline

Definition at line 29 of file MuonG4Numbering.h.

29 {};

Member Function Documentation

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

Definition at line 90 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

90 { return (copyno / theLevelPart) > 0; }
const int MuonG4Numbering::getCopyNoBaseNo ( const int  copyno)
private

Definition at line 88 of file MuonG4Numbering.cc.

References theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

88 { return copyno % theSuperPart; }
const int MuonG4Numbering::getCopyNoLevel ( const int  copyno)
private

Definition at line 84 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

84 { return copyno / theLevelPart; }
const int MuonG4Numbering::getCopyNoSuperNo ( const int  copyno)
private

Definition at line 86 of file MuonG4Numbering.cc.

References theLevelPart, and theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

86 { return (copyno % theLevelPart) / theSuperPart; }
MuonBaseNumber MuonG4Numbering::PhysicalVolumeToBaseNumber ( const G4Step *  aStep)

Definition at line 47 of file MuonG4Numbering.cc.

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

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

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 }
Log< level::Info, true > LogVerbatim
const int getCopyNoLevel(const int)
void addBase(const int level, const int super, const int base)
const MuonOffsetMap * offMap_
const int getCopyNoBaseNo(const int)
int ii
Definition: cuy.py:589
U second(std::pair< T, U > const &p)
const bool dd4hep_
const bool copyNoRelevant(const int)
tuple last
Definition: dqmdumpme.py:56
const int getCopyNoSuperNo(const int)
std::unordered_map< std::string, std::pair< int, int > > muonMap_
Definition: MuonOffsetMap.h:14

Member Data Documentation

const bool MuonG4Numbering::dd4hep_
private

Definition at line 40 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

const MuonOffsetMap* MuonG4Numbering::offMap_
private

Definition at line 39 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

int MuonG4Numbering::theBasePart
private

Definition at line 43 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering().

int MuonG4Numbering::theLevelPart
private
int MuonG4Numbering::theStartCopyNo
private

Definition at line 44 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

int MuonG4Numbering::theSuperPart
private