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 ()
 
virtual int detectorLevel (const G4Step *) const
 
virtual void detectorLevel (const G4Step *, int &, int *, G4String *) const
 
virtual unsigned int getUnitID (const G4Step *aStep) const
 
virtual ~BHMNumberingScheme ()
 

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

Definition at line 10 of file BHMNumberingScheme.cc.

References LogDebug.

10  {
11  LogDebug("BHMSim") << " Deleting BHMNumberingScheme" ;
12 }
#define LogDebug(id)

Member Function Documentation

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

Definition at line 14 of file BHMNumberingScheme.cc.

References hcalDigis_cfi::level.

Referenced by getUnitID().

14  {
15 
16  //Find number of levels
17  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
18  int level = 0;
19  if (touch) level = ((touch->GetHistoryDepth())+1);
20  return level;
21 }
void BHMNumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const
virtual

Definition at line 23 of file BHMNumberingScheme.cc.

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

24  {
25 
26  //Get name and copy numbers
27  if (level > 0) {
28  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
29  for (int ii = 0; ii < level; ii++) {
30  int i = level - ii - 1;
31  name[ii] = touch->GetVolume(i)->GetName();
32  copyno[ii] = touch->GetReplicaNumber(i);
33  }
34  }
35 }
ii
Definition: cuy.py:588
unsigned int BHMNumberingScheme::getUnitID ( const G4Step *  aStep) const
virtual

Definition at line 37 of file BHMNumberingScheme.cc.

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

Referenced by BHMSD::setDetUnitId().

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

Definition at line 66 of file BHMNumberingScheme.cc.

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

Referenced by getUnitID().

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

Definition at line 76 of file BHMNumberingScheme.cc.

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

77  {
78 
79  subdet = (idx>>25)>>0x7;
80  zside = (idx>>5)&0x3;
81  station = idx&0x1F;
82  LogDebug("BHMSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec
83  << " -> subdet " << subdet << " zside " << zside
84  << " station " << station ;
85 }
#define LogDebug(id)