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

References LogDebug.

7 { LogDebug("BHMSim") << " Creating BHMNumberingScheme"; }
#define LogDebug(id)

◆ ~BHMNumberingScheme()

BHMNumberingScheme::~BHMNumberingScheme ( )
default

Member Function Documentation

◆ detectorLevel() [1/2]

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

Definition at line 9 of file BHMNumberingScheme.cc.

Referenced by getUnitID().

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

◆ detectorLevel() [2/2]

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

Definition at line 15 of file BHMNumberingScheme.cc.

References ForwardName::getName(), mps_fire::i, cuy::ii, personalPlayback::level, and Skims_PA_cff::name.

15  {
16  //Get name and copy numbers
17  if (level > 0) {
18  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
19  for (int ii = 0; ii < level; ++ii) {
20  int i = level - ii - 1;
21  name[ii] = ForwardName::getName(touch->GetVolume(i)->GetName());
22  copyno[ii] = touch->GetReplicaNumber(i);
23  }
24  }
25 }
ii
Definition: cuy.py:589
std::string getName(const G4String &)
Definition: ForwardName.cc:3

◆ getUnitID()

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

Definition at line 27 of file BHMNumberingScheme.cc.

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

Referenced by BHMSD::setDetUnitId().

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

◆ packIndex()

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

Definition at line 52 of file BHMNumberingScheme.cc.

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

Referenced by getUnitID().

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

◆ unpackIndex()

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

Definition at line 60 of file BHMNumberingScheme.cc.

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

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