16 RefHitDef::RefHitDef(
unsigned int aInput,
int aPhiMin,
int aPhiMax,
unsigned int aRegion,
unsigned int aRefLayer)
17 : iInput(aInput), iRegion(aRegion), iRefLayer(aRefLayer),
range(
std::pair<
int,
int>(aPhiMin, aPhiMax)) {}
24 out <<
"iRefLayer: " << aRefHitDef.
iRefLayer <<
" iInput: " << aRefHitDef.
iInput <<
" iRegion: " << aRefHitDef.
iRegion 25 <<
" range: (" << aRefHitDef.
range.first <<
", " << aRefHitDef.
range.second << std::endl;
33 std::vector<int> aLayer1D(nInputs(), 0);
37 aLayer2D.assign(
nLayers(), aLayer1D);
41 aLayer3D.assign(nLogicRegions(), aLayer2D);
44 measurements4D.assign(nProcessors(), aLayer3D);
45 measurements4Dref.assign(nProcessors(), aLayer3D);
53 barrelMin.resize(nProcessors());
54 endcap10DegMin.resize(nProcessors());
55 endcap20DegMin.resize(nProcessors());
57 barrelMax.resize(nProcessors());
58 endcap10DegMax.resize(nProcessors());
59 endcap20DegMax.resize(nProcessors());
64 std::copy(connectedSectorsStartVec->begin(), connectedSectorsStartVec->begin() + 6, barrelMin.begin());
65 std::copy(connectedSectorsStartVec->begin() + 6, connectedSectorsStartVec->begin() + 12, endcap10DegMin.begin());
66 std::copy(connectedSectorsStartVec->begin() + 12, connectedSectorsStartVec->end(), endcap20DegMin.begin());
68 std::copy(connectedSectorsEndVec->begin(), connectedSectorsEndVec->begin() + 6, barrelMax.begin());
69 std::copy(connectedSectorsEndVec->begin() + 6, connectedSectorsEndVec->begin() + 12, endcap10DegMax.begin());
70 std::copy(connectedSectorsEndVec->begin() + 12, connectedSectorsEndVec->end(), endcap20DegMax.begin());
73 const std::vector<L1TMuonOverlapParams::LayerMapNode> *layerMap = omtfParams->
layerMap();
75 for (
unsigned int iLayer = 0; iLayer <
nLayers(); ++iLayer) {
84 refToLogicNumber.resize(nRefLayers());
86 const std::vector<L1TMuonOverlapParams::RefLayerMapNode> *refLayerMap = omtfParams->
refLayerMap();
93 processorPhiVsRefLayer.assign(nProcessors(), vector1D);
100 aLayer2D.assign(nLogicRegions(), aLayer1D);
102 connections.assign(nProcessors(), aLayer2D);
106 std::vector<std::pair<int, int> > aRefHit1D(nLogicRegions(), std::pair<int, int>(9999, 9999));
108 std::vector<std::vector<std::pair<int, int> > > aRefHit2D;
109 aRefHit2D.assign(nRefLayers(), aRefHit1D);
111 regionPhisVsRefLayerVsInput.assign(nInputs(), aRefHit2D);
114 std::vector<RefHitDef> aRefHitsDefs(nRefHits());
116 refHitsDefs.assign(nProcessors(), aRefHitsDefs);
119 const std::vector<L1TMuonOverlapParams::RefHitNode> *refHitMap = omtfParams->
refHitMap();
120 const std::vector<L1TMuonOverlapParams::LayerInputNode> *layerInputMap = omtfParams->
layerInputMap();
121 unsigned int tmpIndex = 0;
122 for (
unsigned int iProcessor = 0; iProcessor < nProcessors(); ++iProcessor) {
124 int iPhiStart = phiStartMap->at(
iRefLayer + iProcessor * nRefLayers());
125 processorPhiVsRefLayer[iProcessor][
iRefLayer] = iPhiStart;
127 for (
unsigned int iRefHit = 0; iRefHit < nRefHits(); ++iRefHit) {
128 int iPhiMin = refHitMap->at(iRefHit + iProcessor * nRefHits()).iPhiMin;
129 int iPhiMax = refHitMap->at(iRefHit + iProcessor * nRefHits()).iPhiMax;
130 unsigned int iInput = refHitMap->at(iRefHit + iProcessor * nRefHits()).iInput;
131 unsigned int iRegion = refHitMap->at(iRefHit + iProcessor * nRefHits()).iRegion;
132 unsigned int iRefLayer = refHitMap->at(iRefHit + iProcessor * nRefHits()).iRefLayer;
134 refHitsDefs[iProcessor][iRefHit] =
RefHitDef(iInput, iPhiMin, iPhiMax, iRegion, iRefLayer);
136 for (
unsigned int iLogicRegion = 0; iLogicRegion < nLogicRegions(); ++iLogicRegion) {
137 for (
unsigned int iLayer = 0; iLayer <
nLayers(); ++iLayer) {
138 tmpIndex = iLayer + iLogicRegion *
nLayers() + iProcessor * nLogicRegions() *
nLayers();
139 unsigned int iFirstInput = layerInputMap->at(tmpIndex).iFirstInput;
140 unsigned int nInputsInRegion = layerInputMap->at(tmpIndex).nInputs;
141 connections[iProcessor][iLogicRegion][iLayer] =
142 std::pair<unsigned int, unsigned int>(iFirstInput, nInputsInRegion);
145 connections[iProcessor][iLogicRegion][iLayer] = connections[0][iLogicRegion][iLayer];
150 initCounterMatrices();
157 <<
" nPdfValBits: " << aConfig.
nPdfValBits() << std::endl;
159 for (
unsigned int iProcessor = 0; iProcessor < aConfig.
nProcessors(); ++iProcessor) {
160 out <<
"Processor: " << iProcessor;
177 if (iPhiStart + (
int)coneSize < (
int)
nPhiBins()) {
178 return iPhiStart <= iPhi && iPhiStart + (int)coneSize > iPhi;
179 }
else if (iPhi > (
int)
nPhiBins() / 2) {
180 return iPhiStart <= iPhi;
181 }
else if (iPhi < (
int)
nPhiBins() / 2) {
182 return iPhi < iPhiStart + (
int)coneSize - (
int)
nPhiBins();
190 if (iPhi >= regionPhisVsRefLayerVsInput[iInput][iRefLayer][
iRegion].
first &&
191 iPhi <= regionPhisVsRefLayerVsInput[iInput][iRefLayer][
iRegion].
second)
200 return *std::min_element(processorPhiVsRefLayer[iProcessor].
begin(), processorPhiVsRefLayer[iProcessor].
end());
209 std::cout <<
"PROBLEM: hit in unknown Det, detID: " << detId.
det() << std::endl;
240 int hwNumber = aLayer + 100 * detId.
subdetId();
bool fitsRange(int iPhi) const
const std::vector< LayerMapNode > * layerMap() const
unsigned int nRefLayers() const
std::vector< std::pair< unsigned int, unsigned int > > vector1D_pair
unsigned int hwNumber
short layer number used within OMTF emulator
const std::vector< int > * connectedSectorsEnd() const
void initCounterMatrices()
bool isInRegionRange(int iPhiStart, unsigned int coneSize, int iPhi) const
unsigned int nLayers() const
unsigned int logicNumber
logic numer of the layer
unsigned int nProcessors() const
std::vector< std::vector< int > > processorPhiVsRefLayer
unsigned int iInput
Hit input number within a cone.
U second(std::pair< T, U > const &p)
const std::vector< LayerInputNode > * layerInputMap() const
std::vector< vector1D > vector2D
unsigned int getRegionNumberFromMap(unsigned int iInput, unsigned int iRefLayer, int iPhi) const
omtfParams
OMTF ESProducer.
unsigned int nPdfAddrBits() const
unsigned int nHitsPerLayer() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< int > vector1D
RefHitDef(unsigned int aInput=15, int aPhiMin=5760, int aPhiMax=5760, unsigned int aRegion=99, unsigned int aRefLayer=99)
bool bendingLayer
Is this a bending layers?
void configure(const L1TMuonOverlapParams *omtfParams)
uint32_t getLayerNumber(uint32_t rawId) const
unsigned int refLayer
Reference layer number.
const std::vector< int > * globalPhiStartMap() const
std::pair< int, int > range
int globalPhiStart(unsigned int iProcessor) const
std::vector< vector2D > vector3D
unsigned int iRefLayer
Reference layer logic number (0-7)
unsigned int logicNumber
Corresponding logical layer number.
unsigned int connectedToLayer
unsigned int iRegion
Region number assigned to this referecne hit.
const std::vector< RefLayerMapNode > * refLayerMap() const
int station() const
Return the station number.
unsigned int nPdfValBits() const
friend std::ostream & operator<<(std::ostream &out, const RefHitDef &aRefHitDef)
const std::vector< int > * connectedSectorsStart() const
std::vector< vector1D_pair > vector2D_pair
const std::vector< RefHitNode > * refHitMap() const
constexpr Detector det() const
get the detector field from this detid
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.