CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
15  MuonDDDConstants muonConstants(cpv);
16  theLevelPart=muonConstants.getValue("level");
17  theSuperPart=muonConstants.getValue("super");
18  theBasePart=muonConstants.getValue("base");
19  theStartCopyNo=muonConstants.getValue("xml_starts_with_copyno");
20 
21  // some consistency checks
22 
23  if (theBasePart!=1) {
24  std::cout << "MuonDDDNumbering finds unusual base constant:"
25  <<theBasePart<<std::endl;
26  }
27  if (theSuperPart<100) {
28  std::cout << "MuonDDDNumbering finds unusual super constant:"
29  <<theSuperPart<<std::endl;
30  }
31  if (theLevelPart<10*theSuperPart) {
32  std::cout << "MuonDDDNumbering finds unusual level constant:"
33  <<theLevelPart<<std::endl;
34  }
35  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
36  std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
37  <<theStartCopyNo<<std::endl;
38  }
39 
40 #ifdef LOCAL_DEBUG
41  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
42  std::cout << "MuonG4Numbering configured with"<<std::endl;
43  std::cout << "Level = "<<theLevelPart<<" ";
44  std::cout << "Super = "<<theSuperPart<<" ";
45  std::cout << "Base = "<<theBasePart<<" ";
46  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
47 #endif
48 }
49 
51 {
52 
54  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
55 
56  for( int ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
57  G4VPhysicalVolume* vol = touch->GetVolume(ii);
58  int copyno=vol->GetCopyNo();
59 #ifdef LOCAL_DEBUG
60  std::cout << "MuonG4Numbering: " << vol->GetName()<<" "<<copyno<<std::endl;
61  std::cout << "Split " << copyNoRelevant(copyno);
62 #endif
63  if (copyNoRelevant(copyno)) {
64  num.addBase(getCopyNoLevel(copyno),
65  getCopyNoSuperNo(copyno),
67 #ifdef LOCAL_DEBUG
68  std::cout << " NoLevel " << getCopyNoLevel(copyno) << " Super "
69  << getCopyNoSuperNo(copyno) << " Base "
70  << getCopyNoBaseNo(copyno) << " Start " << theStartCopyNo;
71 #endif
72  }
73 #ifdef LOCAL_DEBUG
74  std::cout << std::endl;
75 #endif
76  }
77 
78  return num;
79 }
80 
81 const int MuonG4Numbering::getCopyNoLevel(const int copyno){
82  return copyno/theLevelPart;
83 }
84 
85 const int MuonG4Numbering::getCopyNoSuperNo(const int copyno){
86  return (copyno%theLevelPart)/theSuperPart;
87 }
88 
89 const int MuonG4Numbering::getCopyNoBaseNo(const int copyno){
90  return copyno%theSuperPart;
91 }
92 
93 const bool MuonG4Numbering::copyNoRelevant(const int copyno){
94  return (copyno/theLevelPart)>0;
95 }
96 
const int getCopyNoLevel(const int)
void addBase(const int level, const int super, const int base)
const int getCopyNoBaseNo(const int)
int ii
Definition: cuy.py:588
type of data representation of DDCompactView
Definition: DDCompactView.h:77
int getValue(const std::string &name) const
MuonG4Numbering(const DDCompactView &cpv)
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
const bool copyNoRelevant(const int)
tuple cout
Definition: gather_cfg.py:121
const int getCopyNoSuperNo(const int)