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

Definition at line 13 of file BscNumberingScheme.cc.

References LogDebug.

13  {
14  LogDebug("BscSim") << " Creating BscNumberingScheme" ;
15 }
#define LogDebug(id)
BscNumberingScheme::~BscNumberingScheme ( )
default

Member Function Documentation

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

Definition at line 17 of file BscNumberingScheme.cc.

Referenced by getUnitID().

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

Definition at line 24 of file BscNumberingScheme.cc.

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

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

Definition at line 38 of file BscNumberingScheme.cc.

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

Referenced by BscSD::setDetUnitId().

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

Definition at line 92 of file BscNumberingScheme.cc.

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

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

92  {
93  unsigned int idx = 6 << 28; // autre numero que les detecteurs existants
94  idx += (zside<<5)&32; // vaut 0 ou 1 bit 5
95  idx += (det<<3)&24; //bit 3-4 det:0-1-2 2 bits:0-1
96  idx += (station&7); //bits 0-2 station:0-7=8-->2**3 =8 3 bits:0-2
97  LogDebug("BscSim") << "Bsc packing: det " << det
98  << " zside " << zside << " station " << station
99  << "-> 0x" << std::hex << idx << std::dec;
100 
101  // unpackBscIndex(idx);
102  return idx;
103 }
#define LogDebug(id)
int zside(DetId const &)
void BscNumberingScheme::unpackBscIndex ( const unsigned int &  idx)
static

Definition at line 105 of file BscNumberingScheme.cc.

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

Referenced by BscTest::update().

105  {
106  int zside, det, station;
107  zside = (idx&32)>>5;
108  det = (idx&24)>>3;
109  station = idx&7;
110  LogDebug("BscSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec
111  << " -> det " << det << " zside " << zside
112  << " station " << station ;
113 }
#define LogDebug(id)
int zside(DetId const &)