9 #include "HGCal/Geometry/interface/HGCalTBCellParameters.h"
10 #include "HGCal/Geometry/interface/HGCalTBCellVertices.h"
11 #include "HGCal/Geometry/interface/HGCalTBTopology.h"
12 #include "HGCal/TBStandaloneSimulator/interface/HGCCellMap.h"
20 double CELL_SIDE = 10 * HGCAL_TB_CELL::FULL_CELL_SIDE;
22 double SENSOR_SIDE = NCELL * CELL_SIDE;
23 double WIDTH = 2 * SENSOR_SIDE;
27 : _uvmap(map<size_t, pair<int, int> >()),
28 _posid(map<pair<int, int>, int>()),
29 _xymap(map<pair<int, int>, pair<double, double> >()),
30 _celltype(map<uint32_t, int>()),
31 _eidmap(map<uint32_t, pair<int, int> >()),
33 _geom(HGCSSGeometryConversion(MODEL, WIDTH, CELL_SIDE)),
36 if ( inputFilename ==
"" )
37 inputFilename = string(
"$CMSSW_BASE/src/HGCal/TBStandaloneSimulator/data/"
41 sprintf(inpfile,
"%s", gSystem->ExpandPathName(inputFilename.c_str()));
42 ifstream fin(inpfile);
44 cout <<
"** HGCCellMap - unable to open file "
49 _geom.initialiseHoneyComb(WIDTH, CELL_SIDE);
50 _map = _geom.hexagonMap();
55 int layer,
posid, cellid,
56 sensor_u, sensor_v, u, v,
61 >> layer >> posid >> cellid
62 >> sensor_u >> sensor_v >> u >> v
63 >> skiroc >> channel >> celltype
65 pair<int, int> uv(u, v);
70 pair<double, double> xy(x, y);
86 uint32_t key = detid1.rawId();
87 if ( _cells.find(key) == _cells.end() )
88 _cells[key] = std::vector<HGCCellMap::Cell>();
89 _cells[key].push_back(cell);
94 assert( _celltype.find(key) == _celltype.end() );
97 _eidmap[key] = pair<int, int>(skiroc, channel);
106 std::vector<HGCCellMap::Cell>
110 int key = detid.rawId();
111 if ( _cells.find(key) != _cells.end() )
114 return std::vector<HGCCellMap::Cell>();
121 if ( _uvmap.find(cellid) != _uvmap.end() )
122 return _uvmap[cellid];
124 return pair<int, int>(-123456, -123456);
130 return uv2xy(uv.first, uv.second);
137 pair<int, int> key(u, v);
138 if ( _xymap.find(key) != _xymap.end() )
141 return pair<double, double>(-123456, -123456);
148 int key = detid.rawId();
149 if ( _eidmap.find(key) != _eidmap.end() )
152 return pair<int, int>(-123456, -123456);
158 size_t cellid = _map->FindBin(x, y);
159 return (*
this)(cellid);
166 int key = detid.rawId();
167 if ( _celltype.find(key) != _celltype.end() )
168 return _celltype[key];
176 pair<int, int> key(u, v);
177 if ( _posid.find(key) != _posid.end() )
HGCCellMap(std::string inputFilename="")
std::pair< int, int > uv2eid(int layer, int sensor_u, int sensor_v, int u, int v)
std::vector< HGCCellMap::Cell > cells(int layer=1, int sensor_u=0, int sensor_v=0)
std::pair< int, int > operator()(size_t cellid)
std::pair< double, double > uv2xy(int u, int v)
std::pair< int, int > xy2uv(double x, double y)
int celltype(int layer, int sensor_u, int sensor_v, int u, int v)