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 
13  MuonDDDConstants muonConstants(cpv);
14  theLevelPart=muonConstants.getValue("level");
15  theSuperPart=muonConstants.getValue("super");
16  theBasePart=muonConstants.getValue("base");
17  theStartCopyNo=muonConstants.getValue("xml_starts_with_copyno");
18 
19  // some consistency checks
20 
21  if (theBasePart!=1) {
22  std::cout << "MuonDDDNumbering finds unusual base constant:"
23  <<theBasePart<<std::endl;
24  }
25  if (theSuperPart<100) {
26  std::cout << "MuonDDDNumbering finds unusual super constant:"
27  <<theSuperPart<<std::endl;
28  }
29  if (theLevelPart<10*theSuperPart) {
30  std::cout << "MuonDDDNumbering finds unusual level constant:"
31  <<theLevelPart<<std::endl;
32  }
33  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
34  std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
35  <<theStartCopyNo<<std::endl;
36  }
37 
38  LogDebug("MuonSimDebug") << "MuonG4Numbering configured with"<<std::endl;
39  LogDebug("MuonSimDebug") << "Level = "<<theLevelPart<<" ";
40  LogDebug("MuonSimDebug") << "Super = "<<theSuperPart<<" ";
41  LogDebug("MuonSimDebug") << "Base = "<<theBasePart<<" ";
42  LogDebug("MuonSimDebug") << "StartCopyNo = "<<theStartCopyNo<<std::endl;
43 
44 }
45 
47 {
48 
50  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
51 
52  for( int ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
53  G4VPhysicalVolume* vol = touch->GetVolume(ii);
54  int copyno=vol->GetCopyNo();
55  LogDebug("MuonSimDebug") << "MuonG4Numbering: " << vol->GetName()<<" "<<copyno<<std::endl;
56  if (copyNoRelevant(copyno)) {
57  num.addBase(getCopyNoLevel(copyno),
58  getCopyNoSuperNo(copyno),
60  }
61  }
62 
63  return num;
64 }
65 
66 const int MuonG4Numbering::getCopyNoLevel(const int copyno){
67  return copyno/theLevelPart;
68 }
69 
70 const int MuonG4Numbering::getCopyNoSuperNo(const int copyno){
71  return (copyno%theLevelPart)/theSuperPart;
72 }
73 
74 const int MuonG4Numbering::getCopyNoBaseNo(const int copyno){
75  return copyno%theSuperPart;
76 }
77 
78 const bool MuonG4Numbering::copyNoRelevant(const int copyno){
79  return (copyno/theLevelPart)>0;
80 }
81 
#define LogDebug(id)
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:77
int getValue(const std::string &name) const
MuonG4Numbering(const DDCompactView &cpv)
MuonBaseNumber PhysicalVolumeToBaseNumber(const G4Step *aStep)
long long int num
Definition: procUtils.cc:71
const bool copyNoRelevant(const int)
tuple cout
Definition: gather_cfg.py:121
const int getCopyNoSuperNo(const int)