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 12 of file MuonG4Numbering.cc.

References gather_cfg::cout, MuonDDDConstants::getValue(), LogDebug, 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;
  }

  LogDebug("MuonSimDebug") << "MuonG4Numbering configured with"<<std::endl;
  LogDebug("MuonSimDebug") << "Level = "<<theLevelPart<<" ";
  LogDebug("MuonSimDebug") << "Super = "<<theSuperPart<<" ";
  LogDebug("MuonSimDebug") << "Base = "<<theBasePart<<" ";
  LogDebug("MuonSimDebug") << "StartCopyNo = "<<theStartCopyNo<<std::endl;

}
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 78 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

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

Definition at line 74 of file MuonG4Numbering.cc.

References theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

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

Definition at line 66 of file MuonG4Numbering.cc.

References theLevelPart.

Referenced by PhysicalVolumeToBaseNumber().

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

Definition at line 70 of file MuonG4Numbering.cc.

References theLevelPart, and theSuperPart.

Referenced by PhysicalVolumeToBaseNumber().

                                                           {
  return (copyno%theLevelPart)/theSuperPart;
}
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().

{

  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();
    LogDebug("MuonSimDebug") << "MuonG4Numbering: " << vol->GetName()<<" "<<copyno<<std::endl;
    if (copyNoRelevant(copyno)) {
      num.addBase(getCopyNoLevel(copyno),
                  getCopyNoSuperNo(copyno),
                  getCopyNoBaseNo(copyno)-theStartCopyNo);
    }
  }

  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().