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

References LogDebug.

14 { LogDebug("BscSim") << " Creating BscNumberingScheme"; }
#define LogDebug(id)

◆ ~BscNumberingScheme()

BscNumberingScheme::~BscNumberingScheme ( )
default

Member Function Documentation

◆ detectorLevel() [1/2]

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

Definition at line 16 of file BscNumberingScheme.cc.

Referenced by getUnitID().

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

◆ detectorLevel() [2/2]

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

Definition at line 22 of file BscNumberingScheme.cc.

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

22  {
23  //Get name and copy numbers
24  if (level > 0) {
25  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
26  for (int ii = 0; ii < level; ++ii) {
27  int i = level - ii - 1;
28  name[ii] = ForwardName::getName(touch->GetVolume(i)->GetName());
29  copyno[ii] = touch->GetReplicaNumber(i);
30  }
31  }
32 }
ii
Definition: cuy.py:589
std::string getName(const G4String &)
Definition: ForwardName.cc:3

◆ getUnitID()

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

Definition at line 34 of file BscNumberingScheme.cc.

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

Referenced by BscSD::setDetUnitId().

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

◆ packBscIndex()

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

Definition at line 84 of file BscNumberingScheme.cc.

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

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

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

◆ unpackBscIndex()

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

Definition at line 96 of file BscNumberingScheme.cc.

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

Referenced by BscTest::update().

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