CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HGCNumberingScheme Class Reference

#include <HGCNumberingScheme.h>

Public Types

enum  HGCNumberingParameters { HGCCellSize }
 

Public Member Functions

int assignCell (float x, float y, int layer)
 maps a hit position to a sequential cell in a trapezoid surface defined by h,b,t More...
 
std::pair< float, float > getLocalCoords (int cell, int layer)
 inverts the cell number in a trapezoid surface to local coordinates More...
 
uint32_t getUnitID (ForwardSubdetector subdet, int layer, int module, int cell, int iz, const G4ThreeVector &pos)
 assigns the det id to a hit More...
 
 HGCNumberingScheme (const HGCalDDDConstants &hgc, std::string &name)
 
 ~HGCNumberingScheme ()
 

Private Member Functions

 HGCNumberingScheme ()
 

Private Attributes

const HGCalDDDConstantshgcons_
 

Detailed Description

Definition at line 13 of file HGCNumberingScheme.h.

Member Enumeration Documentation

Enumerator
HGCCellSize 

Definition at line 17 of file HGCNumberingScheme.h.

Constructor & Destructor Documentation

HGCNumberingScheme::HGCNumberingScheme ( const HGCalDDDConstants hgc,
std::string &  name 
)

Definition at line 18 of file HGCNumberingScheme.cc.

References dataset::name.

19  :
20  hgcons_(hgc) {
21  edm::LogInfo("HGCSim") << "Creating HGCNumberingScheme for " << name;
22 }
const HGCalDDDConstants & hgcons_
HGCNumberingScheme::~HGCNumberingScheme ( )

Definition at line 24 of file HGCNumberingScheme.cc.

24  {
25  edm::LogInfo("HGCSim") << "Deleting HGCNumberingScheme";
26 }
HGCNumberingScheme::HGCNumberingScheme ( )
private

Member Function Documentation

int HGCNumberingScheme::assignCell ( float  x,
float  y,
int  layer 
)

maps a hit position to a sequential cell in a trapezoid surface defined by h,b,t

Definition at line 89 of file HGCNumberingScheme.cc.

References HGCalDDDConstants::assignCell(), and hgcons_.

89  {
90 
91  std::pair<int,int> phicell = hgcons_.assignCell(x,y,layer,0,false);
92  return phicell.second;
93 }
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
const HGCalDDDConstants & hgcons_
std::pair< float, float > HGCNumberingScheme::getLocalCoords ( int  cell,
int  layer 
)

inverts the cell number in a trapezoid surface to local coordinates

Definition at line 96 of file HGCNumberingScheme.cc.

References hgcons_, and HGCalDDDConstants::locateCell().

96  {
97 
98  return hgcons_.locateCell(cell,layer,0,false);
99 }
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
const HGCalDDDConstants & hgcons_
uint32_t HGCNumberingScheme::getUnitID ( ForwardSubdetector  subdet,
int  layer,
int  module,
int  cell,
int  iz,
const G4ThreeVector &  pos 
)

assigns the det id to a hit

Definition at line 29 of file HGCNumberingScheme.cc.

References HGCalDDDConstants::assignCell(), gather_cfg::cout, TauDecayModes::dec, HGCalDDDConstants::geomMode(), HGCalGeometryMode::HexagonFull, hgcons_, diffTreeTool::index, HGCalDDDConstants::isValid(), HGCalTestNumbering::packHexagonIndex(), HGCalTestNumbering::packSquareIndex(), HGCalGeometryMode::Square, HGCalDDDConstants::waferFromCopy(), and HGCalDDDConstants::waferFromPosition().

Referenced by HGCSD::setDetUnitId().

31  {
32  // module is the sector # for square cell
33  // the copy number of the wafer as placed in the layer
34  int phiSector(0), icell(0), celltyp(0), wafer(0);
35  uint32_t index(0);
37  std::pair<int,int> phicell = hgcons_.assignCell(pos.x(),pos.y(),layer,0,false);
38  phiSector = phicell.first;
39  icell = phicell.second;
40 
41  //build the index
42  index = HGCalTestNumbering::packSquareIndex(iz,layer,module,phiSector,icell);
43  //check if it fits
44  if (!hgcons_.isValid(layer,module,icell,false)) {
45  index = 0;
46  }
48  if (cell >= 0) {
49  wafer = hgcons_.waferFromCopy(module);
50  celltyp = cell/1000;
51  icell = cell%1000;
52  } else {
53  hgcons_.waferFromPosition(pos.x(),pos.y(),wafer,icell,celltyp);
54  }
55  if (celltyp != 1) celltyp = 0;
56  index = HGCalTestNumbering::packHexagonIndex((int)subdet,iz,layer,wafer,
57  celltyp,icell);
58  } else {
59  wafer = hgcons_.waferFromCopy(module);
60  celltyp = cell/1000;
61  icell = cell%1000;
62  if (celltyp != 1) celltyp = 0;
63 
64  index = HGCalTestNumbering::packHexagonIndex((int)subdet,iz,layer,wafer,
65  celltyp,icell);
66  //check if it fits
67  if (!hgcons_.isValid(layer,wafer,icell,false)) {
68  index = 0;
69  edm::LogError("HGCSim") << "[HGCNumberingScheme] ID out of bounds :"
70  << " Subdet= " << subdet << " Zside= " << iz
71  << " Layer= " << layer << " Wafer= " << wafer
72  << ":" << module << " CellType= " << celltyp
73  << " Cell= " << icell;
74  }
75  }
76 #ifdef EDM_ML_DEBUG
77  std::cout << "HGCNumberingScheme::i/p " << subdet << ":" << layer << ":"
78  << module << ":" << iz << ":";
80  std::cout << pos << " o/p " << phiSector << ":" << icell;
81  else
82  std::cout << wafer << ":" << celltyp << ":" << icell;
83  std::cout << ":" << std::hex << index << std::dec << std::endl;
84 #endif
85  return index;
86 }
bool isValid(int lay, int mod, int cell, bool reco) const
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
static uint32_t packHexagonIndex(int subdet, int z, int lay, int wafer, int celltyp, int cell)
HGCalGeometryMode::GeometryMode geomMode() const
int waferFromCopy(int copy) const
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
Definition: vlib.h:208
const HGCalDDDConstants & hgcons_

Member Data Documentation

const HGCalDDDConstants& HGCNumberingScheme::hgcons_
private

Definition at line 42 of file HGCNumberingScheme.h.

Referenced by assignCell(), getLocalCoords(), and getUnitID().