CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions
BscNumberingScheme Class Reference

#include <BscNumberingScheme.h>

Public Member Functions

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

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

Definition at line 17 of file BscNumberingScheme.cc.

References LogDebug.

17  {
18  LogDebug("BscSim") << " Deleting BscNumberingScheme" ;
19 }
#define LogDebug(id)

Member Function Documentation

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

Definition at line 21 of file BscNumberingScheme.cc.

References testEve_cfg::level.

Referenced by getUnitID().

21  {
22 
23  //Find number of levels
24  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
25  int level = 0;
26  if (touch) level = ((touch->GetHistoryDepth())+1);
27  return level;
28 }
tuple level
Definition: testEve_cfg.py:34
void BscNumberingScheme::detectorLevel ( const G4Step *  aStep,
int &  level,
int *  copyno,
G4String *  name 
) const
virtual

Definition at line 30 of file BscNumberingScheme.cc.

References i, cuy::ii, and testEve_cfg::level.

31  {
32 
33  //Get name and copy numbers
34  if (level > 0) {
35  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
36  for (int ii = 0; ii < level; ii++) {
37  int i = level - ii - 1;
38  name[ii] = touch->GetVolume(i)->GetName();
39  copyno[ii] = touch->GetReplicaNumber(i);
40  }
41  }
42 }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
tuple level
Definition: testEve_cfg.py:34
unsigned int BscNumberingScheme::getUnitID ( const G4Step *  aStep) const
virtual

Definition at line 44 of file BscNumberingScheme.cc.

References detectorLevel(), testEve_cfg::level, LogDebug, mergeVDriftHistosByStation::name, packBscIndex(), relativeConstraints::station, and ecaldqm::zside().

Referenced by BscSD::setDetUnitId().

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

Definition at line 99 of file BscNumberingScheme.cc.

References customizeTrackingMonitorSeedNumber::idx, and LogDebug.

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

99  {
100  unsigned int idx = 6 << 28; // autre numero que les detecteurs existants
101  idx += (zside<<5)&32; // vaut 0 ou 1 bit 5
102  idx += (det<<3)&24; //bit 3-4 det:0-1-2 2 bits:0-1
103  idx += (station&7); //bits 0-2 station:0-7=8-->2**3 =8 3 bits:0-2
104  LogDebug("BscSim") << "Bsc packing: det " << det
105  << " zside " << zside << " station " << station
106  << "-> 0x" << std::hex << idx << std::dec;
107 
108  // unpackBscIndex(idx);
109  return idx;
110 }
#define LogDebug(id)
int zside(DetId const &)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void BscNumberingScheme::unpackBscIndex ( const unsigned int &  idx)
static

Definition at line 112 of file BscNumberingScheme.cc.

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

Referenced by BscTest::update().

112  {
113  int zside, det, station;
114  zside = (idx&32)>>5;
115  det = (idx&24)>>3;
116  station = idx&7;
117  LogDebug("BscSim") << " Bsc unpacking: 0x " << std::hex << idx << std::dec
118  << " -> det " << det << " zside " << zside
119  << " station " << station ;
120 }
#define LogDebug(id)
int zside(DetId const &)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...