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

Definition at line 6 of file BHMNumberingScheme.cc.

References LogDebug.

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

Member Function Documentation

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

Definition at line 10 of file BHMNumberingScheme.cc.

Referenced by getUnitID().

10  {
11 
12  //Find number of levels
13  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
14  return (touch) ? ((touch->GetHistoryDepth())+1) : 0;
15 }
void BHMNumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const

Definition at line 17 of file BHMNumberingScheme.cc.

References mps_fire::i, cuy::ii, and hcalDigis_cfi::level.

18  {
19 
20  //Get name and copy numbers
21  if (level > 0) {
22  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
23  for (int ii = 0; ii < level; ++ii) {
24  int i = level - ii - 1;
25  name[ii] = touch->GetVolume(i)->GetName();
26  copyno[ii] = touch->GetReplicaNumber(i);
27  }
28  }
29 }
ii
Definition: cuy.py:590
unsigned int BHMNumberingScheme::getUnitID ( const G4Step *  aStep) const

Definition at line 31 of file BHMNumberingScheme.cc.

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

Referenced by BHMSD::setDetUnitId().

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

Definition at line 60 of file BHMNumberingScheme.cc.

References TauDecayModes::dec, training_settings::idx, and LogDebug.

Referenced by getUnitID().

60  {
61 
62  unsigned int idx = ((6<<28)|(subdet&0x7)<<25); // Use 6 as the detector name
63  idx |= ((zside&0x3)<<5) | (station&0x1F); // bits 0-4:station 5-6:side
64  LogDebug("BHMSim") << "BHM packing: subdet " << subdet
65  << " zside " << zside << " station " << station
66  << "-> 0x" << std::hex << idx << std::dec;
67  return idx;
68 }
#define LogDebug(id)
int zside(DetId const &)
void BHMNumberingScheme::unpackIndex ( const unsigned int &  idx,
int &  subdet,
int &  zside,
int &  station 
)
static

Definition at line 70 of file BHMNumberingScheme.cc.

References TauDecayModes::dec, LogDebug, and relativeConstraints::station.

71  {
72 
73  subdet = (idx>>25)>>0x7;
74  zside = (idx>>5)&0x3;
75  station = idx&0x1F;
76  LogDebug("BHMSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec
77  << " -> subdet " << subdet << " zside " << zside
78  << " station " << station ;
79 }
#define LogDebug(id)
int zside(DetId const &)