CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
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 25 of file MuonG4Numbering.h.

Constructor & Destructor Documentation

MuonG4Numbering::MuonG4Numbering ( const DDCompactView cpv)

Definition at line 12 of file MuonG4Numbering.cc.

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

12  {
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 }
#define LogDebug(id)
tuple cout
Definition: gather_cfg.py:121
MuonG4Numbering::~MuonG4Numbering ( )
inline

Definition at line 29 of file MuonG4Numbering.h.

29 {};

Member Function Documentation

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

Definition at line 78 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

78  {
79  return (copyno/theLevelPart)>0;
80 }
const int MuonG4Numbering::getCopyNoBaseNo ( const int  copyno)
private

Definition at line 74 of file MuonG4Numbering.cc.

References theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

74  {
75  return copyno%theSuperPart;
76 }
const int MuonG4Numbering::getCopyNoLevel ( const int  copyno)
private

Definition at line 66 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

66  {
67  return copyno/theLevelPart;
68 }
const int MuonG4Numbering::getCopyNoSuperNo ( const int  copyno)
private

Definition at line 70 of file MuonG4Numbering.cc.

References theLevelPart, and theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

70  {
71  return (copyno%theLevelPart)/theSuperPart;
72 }
MuonBaseNumber MuonG4Numbering::PhysicalVolumeToBaseNumber ( const G4Step *  aStep)

Definition at line 46 of file MuonG4Numbering.cc.

References MuonBaseNumber::addBase(), copyNoRelevant(), getCopyNoBaseNo(), getCopyNoLevel(), getCopyNoSuperNo(), LogDebug, and theStartCopyNo.

Referenced by MuonSensitiveDetector::setDetUnitId(), and MuonRpcFrameRotation::transformPoint().

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 }
#define LogDebug(id)
const int getCopyNoLevel(const int)
void addBase(const int level, const int super, const int base)
const int getCopyNoBaseNo(const int)
long long int num
Definition: procUtils.cc:71
const bool copyNoRelevant(const int)
const int getCopyNoSuperNo(const int)

Member Data Documentation

int MuonG4Numbering::theBasePart
private

Definition at line 42 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering().

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

Definition at line 43 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

int MuonG4Numbering::theSuperPart
private

Definition at line 41 of file MuonG4Numbering.h.

Referenced by getCopyNoBaseNo(), getCopyNoSuperNo(), and MuonG4Numbering().