CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MuonG4Numbering Class Reference

#include <MuonG4Numbering.h>

List of all members.

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.straessner@cern.ch>

Modification:

Definition at line 25 of file MuonG4Numbering.h.


Constructor & Destructor Documentation

MuonG4Numbering::MuonG4Numbering ( const DDCompactView cpv)

Definition at line 14 of file MuonG4Numbering.cc.

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

                                                        {
  MuonDDDConstants muonConstants(cpv);
  theLevelPart=muonConstants.getValue("level");
  theSuperPart=muonConstants.getValue("super");
  theBasePart=muonConstants.getValue("base");
  theStartCopyNo=muonConstants.getValue("xml_starts_with_copyno");

  // some consistency checks

  if (theBasePart!=1) {
    std::cout << "MuonDDDNumbering finds unusual base constant:"
         <<theBasePart<<std::endl;
  }
  if (theSuperPart<100) {
    std::cout << "MuonDDDNumbering finds unusual super constant:"
         <<theSuperPart<<std::endl;
  }
  if (theLevelPart<10*theSuperPart) {
    std::cout << "MuonDDDNumbering finds unusual level constant:"
         <<theLevelPart<<std::endl;
  }
  if ((theStartCopyNo!=0)&&(theStartCopyNo!=1)) {
    std::cout << "MuonDDDNumbering finds unusual start value for copy numbers:"
         <<theStartCopyNo<<std::endl;
  }

#ifdef LOCAL_DEBUG
  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
  std::cout << "MuonG4Numbering configured with"<<std::endl;
  std::cout << "Level = "<<theLevelPart<<" ";
  std::cout << "Super = "<<theSuperPart<<" ";
  std::cout << "Base = "<<theBasePart<<" ";
  std::cout << "StartCopyNo = "<<theStartCopyNo<<std::endl;
#endif
}
MuonG4Numbering::~MuonG4Numbering ( ) [inline]

Definition at line 29 of file MuonG4Numbering.h.

{};

Member Function Documentation

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

Definition at line 93 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

                                                          {
  return (copyno/theLevelPart)>0;
}
const int MuonG4Numbering::getCopyNoBaseNo ( const int  copyno) [private]

Definition at line 89 of file MuonG4Numbering.cc.

References theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

                                                          {
  return copyno%theSuperPart;
}
const int MuonG4Numbering::getCopyNoLevel ( const int  copyno) [private]

Definition at line 81 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

                                                         {
  return copyno/theLevelPart;
}
const int MuonG4Numbering::getCopyNoSuperNo ( const int  copyno) [private]

Definition at line 85 of file MuonG4Numbering.cc.

References theLevelPart, and theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

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

Definition at line 50 of file MuonG4Numbering.cc.

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

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

{

  MuonBaseNumber num;
  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();

  for( int ii = 0; ii < touch->GetHistoryDepth(); ii++ ){
    G4VPhysicalVolume* vol = touch->GetVolume(ii);
    int copyno=vol->GetCopyNo();
#ifdef LOCAL_DEBUG
    std::cout << "MuonG4Numbering: " << vol->GetName()<<" "<<copyno<<std::endl;
    std::cout << "Split " << copyNoRelevant(copyno);
#endif
    if (copyNoRelevant(copyno)) {
      num.addBase(getCopyNoLevel(copyno),
                  getCopyNoSuperNo(copyno),
                  getCopyNoBaseNo(copyno)-theStartCopyNo);
#ifdef LOCAL_DEBUG
      std::cout << " NoLevel " << getCopyNoLevel(copyno) << " Super " 
                << getCopyNoSuperNo(copyno) << " Base " 
                << getCopyNoBaseNo(copyno) << " Start " << theStartCopyNo;
#endif
    }
#ifdef LOCAL_DEBUG
    std::cout << std::endl;
#endif
  }

  return num;
}

Member Data Documentation

Definition at line 42 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering().

Definition at line 43 of file MuonG4Numbering.h.

Referenced by MuonG4Numbering(), and PhysicalVolumeToBaseNumber().

Definition at line 41 of file MuonG4Numbering.h.

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