SimG4CMS
Muon
src
MuonG4Numbering.cc
Go to the documentation of this file.
1
#include "
SimG4CMS/Muon/interface/MuonG4Numbering.h
"
2
#include "
Geometry/MuonNumbering/interface/MuonBaseNumber.h
"
3
#include "
Geometry/MuonNumbering/interface/MuonGeometryConstants.h
"
4
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
5
6
#include "G4VPhysicalVolume.hh"
7
#include "G4VTouchable.hh"
8
#include "G4Step.hh"
9
10
#include <iostream>
11
12
//#define EDM_ML_DEBUG
13
14
MuonG4Numbering::MuonG4Numbering
(
const
MuonGeometryConstants
& muonConstants) {
15
theLevelPart
= muonConstants.
getValue
(
"level"
);
16
theSuperPart
= muonConstants.
getValue
(
"super"
);
17
theBasePart
= muonConstants.
getValue
(
"base"
);
18
theStartCopyNo
= muonConstants.
getValue
(
"xml_starts_with_copyno"
);
19
20
// some consistency checks
21
22
if
(
theBasePart
!= 1) {
23
edm::LogVerbatim
(
"MuonSim"
) <<
"MuonGeometryNumbering finds unusual base constant:"
<<
theBasePart
;
24
}
25
if
(
theSuperPart
< 100) {
26
edm::LogVerbatim
(
"MuonSim"
) <<
"MuonGeometryNumbering finds unusual super constant:"
<<
theSuperPart
;
27
}
28
if
(
theLevelPart
< 10 *
theSuperPart
) {
29
edm::LogVerbatim
(
"MuonSim"
) <<
"MuonGeometryNumbering finds unusual level constant:"
<<
theLevelPart
;
30
}
31
if
((
theStartCopyNo
!= 0) && (
theStartCopyNo
!= 1)) {
32
std::cout
<<
"MuonGeometryNumbering finds unusual start value for copy numbers:"
<<
theStartCopyNo
<< std::endl;
33
}
34
35
#ifdef EDM_ML_DEBUG
36
edm::LogVerbatim
(
"MuonSim"
) <<
"StartCopyNo = "
<<
theStartCopyNo
;
37
edm::LogVerbatim
(
"MuonSim"
) <<
"MuonG4Numbering configured with"
38
<<
"Level = "
<<
theLevelPart
<<
" Super = "
<<
theSuperPart
<<
" Base = "
<<
theBasePart
39
<<
" StartCopyNo = "
<<
theStartCopyNo
;
40
#endif
41
}
42
43
MuonBaseNumber
MuonG4Numbering::PhysicalVolumeToBaseNumber
(
const
G4Step* aStep) {
44
MuonBaseNumber
num
;
45
const
G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
46
47
for
(
int
ii
= 0;
ii
< touch->GetHistoryDepth();
ii
++) {
48
G4VPhysicalVolume* vol = touch->GetVolume(
ii
);
49
int
copyno = vol->GetCopyNo();
50
#ifdef EDM_ML_DEBUG
51
edm::LogVerbatim
(
"MuonSim"
) <<
"MuonG4Numbering: "
<< vol->GetName() <<
" "
<< copyno << std::endl
52
<<
"Split "
<<
copyNoRelevant
(copyno) <<
":"
<<
theLevelPart
<<
":"
<<
theSuperPart
53
<<
" "
;
54
#endif
55
if
(
copyNoRelevant
(copyno)) {
56
num
.addBase(
getCopyNoLevel
(copyno),
getCopyNoSuperNo
(copyno),
getCopyNoBaseNo
(copyno) -
theStartCopyNo
);
57
#ifdef EDM_ML_DEBUG
58
edm::LogVerbatim
(
"MuonSim"
) <<
" NoLevel "
<<
getCopyNoLevel
(copyno) <<
" Super "
<<
getCopyNoSuperNo
(copyno)
59
<<
" Base "
<<
getCopyNoBaseNo
(copyno) <<
" Start "
<<
theStartCopyNo
;
60
#endif
61
}
62
}
63
64
return
num
;
65
}
66
67
const
int
MuonG4Numbering::getCopyNoLevel
(
const
int
copyno) {
return
copyno /
theLevelPart
; }
68
69
const
int
MuonG4Numbering::getCopyNoSuperNo
(
const
int
copyno) {
return
(copyno %
theLevelPart
) /
theSuperPart
; }
70
71
const
int
MuonG4Numbering::getCopyNoBaseNo
(
const
int
copyno) {
return
copyno %
theSuperPart
; }
72
73
const
bool
MuonG4Numbering::copyNoRelevant
(
const
int
copyno) {
return
(copyno /
theLevelPart
) > 0; }
MuonGeometryConstants
Definition:
MuonGeometryConstants.h:20
MuonG4Numbering.h
MessageLogger.h
MuonG4Numbering::theSuperPart
int theSuperPart
Definition:
MuonG4Numbering.h:39
MuonG4Numbering::getCopyNoBaseNo
const int getCopyNoBaseNo(const int)
Definition:
MuonG4Numbering.cc:71
MuonGeometryConstants.h
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
MuonG4Numbering::getCopyNoLevel
const int getCopyNoLevel(const int)
Definition:
MuonG4Numbering.cc:67
MuonG4Numbering::theStartCopyNo
int theStartCopyNo
Definition:
MuonG4Numbering.h:41
MuonG4Numbering::theBasePart
int theBasePart
Definition:
MuonG4Numbering.h:40
MuonBaseNumber.h
MuonG4Numbering::MuonG4Numbering
MuonG4Numbering(const MuonGeometryConstants &muonConstants)
Definition:
MuonG4Numbering.cc:14
MuonG4Numbering::theLevelPart
int theLevelPart
Definition:
MuonG4Numbering.h:38
edm::LogVerbatim
Definition:
MessageLogger.h:297
MuonGeometryConstants::getValue
int getValue(const std::string &name) const
Definition:
MuonGeometryConstants.cc:8
MuonG4Numbering::PhysicalVolumeToBaseNumber
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
Definition:
MuonG4Numbering.cc:43
EgammaValidation_cff.num
num
Definition:
EgammaValidation_cff.py:34
MuonBaseNumber
Definition:
MuonBaseNumber.h:21
MuonG4Numbering::copyNoRelevant
const bool copyNoRelevant(const int)
Definition:
MuonG4Numbering.cc:73
MuonG4Numbering::getCopyNoSuperNo
const int getCopyNoSuperNo(const int)
Definition:
MuonG4Numbering.cc:69
cuy.ii
ii
Definition:
cuy.py:590
Generated for CMSSW Reference Manual by
1.8.16