CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonG4Numbering Class Reference

#include <MuonG4Numbering.h>

Public Member Functions

 MuonG4Numbering (const DDCompactView &cpv)
 
 MuonG4Numbering (const MuonDDDConstants &muonConstants)
 
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

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 DDCompactView cpv)

Definition at line 14 of file MuonG4Numbering.cc.

14  :
MuonG4Numbering(const DDCompactView &cpv)
MuonG4Numbering::MuonG4Numbering ( const MuonDDDConstants muonConstants)

Definition at line 17 of file MuonG4Numbering.cc.

References gather_cfg::cout, MuonDDDConstants::getValue(), theBasePart, theLevelPart, theStartCopyNo, and theSuperPart.

17  {
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 }
int getValue(const std::string &name) const
MuonG4Numbering::~MuonG4Numbering ( )
inline

Member Function Documentation

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

Definition at line 96 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber(), and ~MuonG4Numbering().

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

Definition at line 92 of file MuonG4Numbering.cc.

References theSuperPart.

Referenced by PhysicalVolumeToBaseNumber(), and ~MuonG4Numbering().

92  {
93  return copyno%theSuperPart;
94 }
const int MuonG4Numbering::getCopyNoLevel ( const int  copyno)
private

Definition at line 84 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber(), and ~MuonG4Numbering().

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

Definition at line 88 of file MuonG4Numbering.cc.

References theLevelPart, and theSuperPart.

Referenced by PhysicalVolumeToBaseNumber(), and ~MuonG4Numbering().

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

Definition at line 52 of file MuonG4Numbering.cc.

References MuonBaseNumber::addBase(), copyNoRelevant(), gather_cfg::cout, getCopyNoBaseNo(), getCopyNoLevel(), getCopyNoSuperNo(), cuy::ii, pileupDistInMC::num, theLevelPart, theStartCopyNo, and theSuperPart.

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

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 }
const int getCopyNoLevel(const int)
void addBase(const int level, const int super, const int base)
const int getCopyNoBaseNo(const int)
ii
Definition: cuy.py:590
const bool copyNoRelevant(const int)
const int getCopyNoSuperNo(const int)

Member Data Documentation

int MuonG4Numbering::theBasePart
private

Definition at line 44 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering().

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

Definition at line 45 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

int MuonG4Numbering::theSuperPart
private