CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( )

Definition at line 7 of file BHMNumberingScheme.cc.

References LogDebug.

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

Member Function Documentation

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 }
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, and testEve_cfg::level.

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 }
int ii
Definition: cuy.py:589
std::string getName(const G4String &)
Definition: ForwardName.cc:3
tuple level
Definition: testEve_cfg.py:47
unsigned int BHMNumberingScheme::getUnitID ( const G4Step *  aStep) const

Definition at line 27 of file BHMNumberingScheme.cc.

References TauDecayModes::dec, detectorLevel(), testEve_cfg::level, LogDebug, mergeVDriftHistosByStation::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
tuple level
Definition: testEve_cfg.py:47
#define LogDebug(id)
unsigned int BHMNumberingScheme::packIndex ( int  subdet,
int  zside,
int  station 
)
static

Definition at line 52 of file BHMNumberingScheme.cc.

References TauDecayModes::dec, and LogDebug.

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)
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, LogDebug, and relativeConstraints::station.

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)