CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
BHMNumberingScheme Class Reference

#include <BHMNumberingScheme.h>

Public Member Functions

 BHMNumberingScheme ()
 
int detectorLevel (const G4Step *) const
 
void detectorLevel (const G4Step *, int &, int *, G4String *) const
 
unsigned int getUnitID (const G4Step *aStep) const
 
 ~BHMNumberingScheme ()=default
 

Static Public Member Functions

static unsigned int packIndex (int subdet, int zside, int station)
 
static void unpackIndex (const unsigned int &idx, int &subdet, int &zside, int &station)
 

Detailed Description

Definition at line 7 of file BHMNumberingScheme.h.

Constructor & Destructor Documentation

◆ BHMNumberingScheme()

BHMNumberingScheme::BHMNumberingScheme ( )

Definition at line 6 of file BHMNumberingScheme.cc.

6 { LogDebug("BHMSim") << " Creating BHMNumberingScheme"; }

References LogDebug.

◆ ~BHMNumberingScheme()

BHMNumberingScheme::~BHMNumberingScheme ( )
default

Member Function Documentation

◆ detectorLevel() [1/2]

int BHMNumberingScheme::detectorLevel ( const G4Step *  aStep) const

Definition at line 8 of file BHMNumberingScheme.cc.

8  {
9  //Find number of levels
10  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
11  return (touch) ? ((touch->GetHistoryDepth()) + 1) : 0;
12 }

Referenced by getUnitID().

◆ detectorLevel() [2/2]

void BHMNumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const

Definition at line 14 of file BHMNumberingScheme.cc.

14  {
15  //Get name and copy numbers
16  if (level > 0) {
17  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
18  for (int ii = 0; ii < level; ++ii) {
19  int i = level - ii - 1;
20  name[ii] = touch->GetVolume(i)->GetName();
21  copyno[ii] = touch->GetReplicaNumber(i);
22  }
23  }
24 }

References mps_fire::i, cuy::ii, personalPlayback::level, and Skims_PA_cff::name.

◆ getUnitID()

unsigned int BHMNumberingScheme::getUnitID ( const G4Step *  aStep) const

Definition at line 26 of file BHMNumberingScheme.cc.

26  {
27  unsigned intindex = 0;
28  int level = detectorLevel(aStep);
29 
30  LogDebug("BHMSim") << "BHMNumberingScheme number of levels= " << level;
31  if (level > 0) {
32  int* copyno = new int[level];
33  G4String* name = new G4String[level];
34  detectorLevel(aStep, level, copyno, name);
35 
36  if (level > 3) {
37  int subdet = copyno[0];
38  int zside = copyno[3];
39  int station = copyno[1];
40  intindex = packIndex(subdet, zside, station);
41  LogDebug("BHMSim") << "BHMNumberingScheme : subdet " << subdet << " zside " << zside << " station " << station;
42  }
43  delete[] copyno;
44  delete[] name;
45  }
46  LogDebug("BHMSim") << "BHMNumberingScheme : UnitID 0x" << std::hex << intindex << std::dec;
47 
48  return intindex;
49 }

References TauDecayModes::dec, detectorLevel(), personalPlayback::level, LogDebug, Skims_PA_cff::name, packIndex(), relativeConstraints::station, and ecaldqm::zside().

Referenced by BHMSD::setDetUnitId().

◆ packIndex()

unsigned int BHMNumberingScheme::packIndex ( int  subdet,
int  zside,
int  station 
)
static

Definition at line 51 of file BHMNumberingScheme.cc.

51  {
52  unsigned int idx = ((6 << 28) | (subdet & 0x7) << 25); // Use 6 as the detector name
53  idx |= ((zside & 0x3) << 5) | (station & 0x1F); // bits 0-4:station 5-6:side
54  LogDebug("BHMSim") << "BHM packing: subdet " << subdet << " zside " << zside << " station " << station << "-> 0x"
55  << std::hex << idx << std::dec;
56  return idx;
57 }

References TauDecayModes::dec, heavyIonCSV_trainingSettings::idx, LogDebug, relativeConstraints::station, and ecaldqm::zside().

Referenced by getUnitID().

◆ unpackIndex()

void BHMNumberingScheme::unpackIndex ( const unsigned int &  idx,
int &  subdet,
int &  zside,
int &  station 
)
static

Definition at line 59 of file BHMNumberingScheme.cc.

59  {
60  subdet = (idx >> 25) >> 0x7;
61  zside = (idx >> 5) & 0x3;
62  station = idx & 0x1F;
63  LogDebug("BHMSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec << " -> subdet " << subdet << " zside "
64  << zside << " station " << station;
65 }

References TauDecayModes::dec, heavyIonCSV_trainingSettings::idx, LogDebug, relativeConstraints::station, and ecaldqm::zside().

personalPlayback.level
level
Definition: personalPlayback.py:22
mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
relativeConstraints.station
station
Definition: relativeConstraints.py:67
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
BHMNumberingScheme::packIndex
static unsigned int packIndex(int subdet, int zside, int station)
Definition: BHMNumberingScheme.cc:51
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BHMNumberingScheme::detectorLevel
int detectorLevel(const G4Step *) const
Definition: BHMNumberingScheme.cc:8
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
cuy.ii
ii
Definition: cuy.py:589