CMS 3D CMS Logo

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

#include <BscNumberingScheme.h>

Public Member Functions

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

Static Public Member Functions

static unsigned int packBscIndex (int det, int zside, int station)
 
static void unpackBscIndex (const unsigned int &idx)
 

Detailed Description

Definition at line 13 of file BscNumberingScheme.h.

Constructor & Destructor Documentation

◆ BscNumberingScheme()

BscNumberingScheme::BscNumberingScheme ( )

Definition at line 13 of file BscNumberingScheme.cc.

13 { LogDebug("BscSim") << " Creating BscNumberingScheme"; }

References LogDebug.

◆ ~BscNumberingScheme()

BscNumberingScheme::~BscNumberingScheme ( )
default

Member Function Documentation

◆ detectorLevel() [1/2]

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

Definition at line 15 of file BscNumberingScheme.cc.

15  {
16  //Find number of levels
17  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
18  return (touch) ? ((touch->GetHistoryDepth()) + 1) : 0;
19 }

Referenced by getUnitID().

◆ detectorLevel() [2/2]

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

Definition at line 21 of file BscNumberingScheme.cc.

21  {
22  //Get name and copy numbers
23  if (level > 0) {
24  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
25  for (int ii = 0; ii < level; ++ii) {
26  int i = level - ii - 1;
27  name[ii] = touch->GetVolume(i)->GetName();
28  copyno[ii] = touch->GetReplicaNumber(i);
29  }
30  }
31 }

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

◆ getUnitID()

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

Definition at line 33 of file BscNumberingScheme.cc.

33  {
34  unsigned int intindex = 0;
35  int level = detectorLevel(aStep);
36 
37  LogDebug("BscSim") << "BscNumberingScheme number of levels= " << level;
38 
39  if (level > 0) {
40  int* copyno = new int[level];
41  G4String* name = new G4String[level];
42  detectorLevel(aStep, level, copyno, name);
43 
44  int det = 0;
45  int zside = 0;
46  int station = 0;
47  for (int ich = 0; ich < level; ich++) {
48  // new and old set up configurations are possible:
49  if (name[ich] == "BSC1" || name[ich] == "BSC2") {
50  zside = copyno[ich] - 1;
51  } else if (name[ich] == "BSCTrap") {
52  det = 0;
53  station = 2 * (copyno[ich] - 1);
54  } else if (name[ich] == "BSCTubs") {
55  det = 1;
56  station = copyno[ich] - 1;
57  } else if (name[ich] == "BSCTTop") {
58  ++station;
59  } else if (name[ich] == "BSC2Pad") {
60  det = 2;
61  station = copyno[ich] - 1;
62  }
63 
64  LogDebug("BscSim") << "BscNumberingScheme "
65  << "ich=" << ich << "copyno" << copyno[ich] << "name=" << name[ich];
66  }
67  intindex = packBscIndex(zside, det, station);
68  LogDebug("BscSim") << "BscNumberingScheme : det " << det << " zside " << zside << " station " << station
69  << " UnitID 0x" << std::hex << intindex << std::dec;
70 
71  for (int ich = 0; ich < level; ich++)
72  LogDebug("BscSim") << " name = " << name[ich] << " copy = " << copyno[ich];
73 
74  LogDebug("BscSim") << " packed index = 0x" << std::hex << intindex << std::dec;
75 
76  delete[] copyno;
77  delete[] name;
78  }
79 
80  return intindex;
81 }

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

Referenced by BscSD::setDetUnitId().

◆ packBscIndex()

unsigned int BscNumberingScheme::packBscIndex ( int  det,
int  zside,
int  station 
)
static

Definition at line 83 of file BscNumberingScheme.cc.

83  {
84  unsigned int idx = 6 << 28; // autre numero que les detecteurs existants
85  idx += (zside << 5) & 32; // vaut 0 ou 1 bit 5
86  idx += (det << 3) & 24; //bit 3-4 det:0-1-2 2 bits:0-1
87  idx += (station & 7); //bits 0-2 station:0-7=8-->2**3 =8 3 bits:0-2
88  LogDebug("BscSim") << "Bsc packing: det " << det << " zside " << zside << " station " << station << "-> 0x"
89  << std::hex << idx << std::dec;
90 
91  // unpackBscIndex(idx);
92  return idx;
93 }

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

Referenced by getUnitID(), and BscTest::update().

◆ unpackBscIndex()

void BscNumberingScheme::unpackBscIndex ( const unsigned int &  idx)
static

Definition at line 95 of file BscNumberingScheme.cc.

95  {
96  int zside, det, station;
97  zside = (idx & 32) >> 5;
98  det = (idx & 24) >> 3;
99  station = idx & 7;
100  LogDebug("BscSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec << " -> det " << det << " zside " << zside
101  << " station " << station;
102 }

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

Referenced by BscTest::update().

personalPlayback.level
level
Definition: personalPlayback.py:22
mps_fire.i
i
Definition: mps_fire.py:355
BscNumberingScheme::detectorLevel
int detectorLevel(const G4Step *) const
Definition: BscNumberingScheme.cc:15
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
relativeConstraints.station
station
Definition: relativeConstraints.py:67
training_settings.idx
idx
Definition: training_settings.py:16
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BscNumberingScheme::packBscIndex
static unsigned int packBscIndex(int det, int zside, int station)
Definition: BscNumberingScheme.cc:83
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
cuy.ii
ii
Definition: cuy.py:590