CMS 3D CMS Logo

MuonG4Numbering.cc
Go to the documentation of this file.
5 
6 #include "G4VPhysicalVolume.hh"
7 #include "G4VTouchable.hh"
8 #include "G4Step.hh"
9 
10 #include <iostream>
11 
12 //#define LOCAL_DEBUG
13 
16 
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  std::cout << "MuonDDDNumbering finds unusual base constant:"
27  <<theBasePart<<std::endl;
28  }
29  if (theSuperPart<100) {
30  std::cout << "MuonDDDNumbering finds unusual super constant:"
31  <<theSuperPart<<std::endl;
32  }
33  if (theLevelPart<10*theSuperPart) {
34  std::cout << "MuonDDDNumbering finds unusual level constant:"
35  <<theLevelPart<<std::endl;
36  }
37  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
38  std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
39  <<theStartCopyNo<<std::endl;
40  }
41 
42 #ifdef LOCAL_DEBUG
43  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
44  std::cout << "MuonG4Numbering configured with"<<std::endl;
45  std::cout << "Level = "<<theLevelPart<<" ";
46  std::cout << "Super = "<<theSuperPart<<" ";
47  std::cout << "Base = "<<theBasePart<<" ";
48  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
49 #endif
50 }
51 
53 {
54 
56  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
57 
58  for( int ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
59  G4VPhysicalVolume* vol = touch->GetVolume(ii);
60  int copyno=vol->GetCopyNo();
61 #ifdef LOCAL_DEBUG
62  std::cout << "MuonG4Numbering: " << vol->GetName() << " " << copyno
63  << std::endl << "Split " << copyNoRelevant(copyno) << ":"
64  << theLevelPart << ":" << theSuperPart << " ";
65 #endif
66  if (copyNoRelevant(copyno)) {
67  num.addBase(getCopyNoLevel(copyno),
68  getCopyNoSuperNo(copyno),
70 #ifdef LOCAL_DEBUG
71  std::cout << " NoLevel " << getCopyNoLevel(copyno) << " Super "
72  << getCopyNoSuperNo(copyno) << " Base "
73  << getCopyNoBaseNo(copyno) << " Start " << theStartCopyNo;
74 #endif
75  }
76 #ifdef LOCAL_DEBUG
77  std::cout << std::endl;
78 #endif
79  }
80 
81  return num;
82 }
83 
84 const int MuonG4Numbering::getCopyNoLevel(const int copyno){
85  return copyno/theLevelPart;
86 }
87 
88 const int MuonG4Numbering::getCopyNoSuperNo(const int copyno){
89  return (copyno%theLevelPart)/theSuperPart;
90 }
91 
92 const int MuonG4Numbering::getCopyNoBaseNo(const int copyno){
93  return copyno%theSuperPart;
94 }
95 
96 const bool MuonG4Numbering::copyNoRelevant(const int copyno){
97  return (copyno/theLevelPart)>0;
98 }
99 
const int getCopyNoLevel(const int)
void addBase(const int level, const int super, const int base)
const int getCopyNoBaseNo(const int)
type of data representation of DDCompactView
Definition: DDCompactView.h:90
int getValue(const std::string &name) const
MuonG4Numbering(const DDCompactView &cpv)
ii
Definition: cuy.py:588
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
const bool copyNoRelevant(const int)
const int getCopyNoSuperNo(const int)