26 if ( !theConfig.
exists(
"patternsXMLFiles") )
return;
28 for(
auto it: theConfig.
getParameter<std::vector<edm::ParameterSet> >(
"patternsXMLFiles")){
33 for(
auto it: fileNames){
43 for(
auto it:
theGPs)
delete it.second;
61 const std::vector<GoldenPattern *> & aGPs = aReader->
readPatterns();
63 if(!
addGP(it))
return false;
83 unsigned int address = 0;
84 unsigned int iEta, iPt, iCharge;
85 for(
unsigned int iGP=0;iGP<nGPs;++iGP){
87 iEta = etaLUT->
data(address);
88 iCharge = chargeLUT->
data(address)==0? -1:1;
89 iPt = ptLUT->
data(address);
99 meanDistPhi1D[iRefLayer] = meanDistPhiLUT->
data(address) - (1<<(meanDistPhiLUT->
nrBitsData() -1));
101 meanDistPhi2D[iLayer] = meanDistPhi1D;
109 pdf1D[iPdf] = pdfLUT->
data(address);
111 pdf2D[iRefLayer] = pdf1D;
113 pdf3D[iLayer] = pdf2D;
115 Key aKey(iEta,iPt,iCharge);
130 <<
"OMTFProcessor::addGP(...) "
131 <<
" Reading two Golden Patterns with the same key: "
132 <<aGP->
key()<<std::endl;
144 Key aKey(0, 9, charge);
186 meanDistPhi[iLayer][iRefLayer]+=meanDistPhi2[iLayer][iRefLayer];
187 meanDistPhi[iLayer][iRefLayer]+=meanDistPhi3[iLayer][iRefLayer];
188 meanDistPhi[iLayer][iRefLayer]+=meanDistPhi4[iLayer][iRefLayer];
189 meanDistPhi[iLayer][iRefLayer]/=4;
197 shiftGP(aGP1,meanDistPhi, meanDistPhi1);
198 shiftGP(aGP2,meanDistPhi, meanDistPhi2);
199 if(aGP3!=aGP1 && aGP4!=aGP2){
202 shiftGP(aGP3,meanDistPhi, meanDistPhi3);
203 shiftGP(aGP4,meanDistPhi, meanDistPhi4);
223 indexShift = meanDistPhiOld[iLayer][iRefLayer] - meanDistPhiNew[iLayer][iRefLayer];
224 for(
unsigned int iPdfBin=0;iPdfBin<nPdfBins;++iPdfBin) pdfAllRef[iLayer][iRefLayer][iPdfBin] = 0;
225 for(
unsigned int iPdfBin=0;iPdfBin<nPdfBins;++iPdfBin){
226 if((
int)(iPdfBin)+indexShift>=0 && iPdfBin+indexShift<nPdfBins)
227 pdfAllRef[iLayer][iRefLayer][iPdfBin+indexShift] = aGP->
pdfValue(iLayer, iRefLayer, iPdfBin);
241 for(
auto & itRegion:
myResults)
for(
auto & itKey: itRegion) itKey.second.clear();
245 std::bitset<128> refHitsBits = aInput.
getRefHits(iProcessor);
246 if(refHitsBits.none())
return myResults;
250 if(!layerHits.size())
continue;
255 if(!refHitsBits[iRefHit])
continue;
256 if(nTestedRefHits--==0)
break;
261 unsigned int iRegion = aRefHitDef.
iRegion;
268 restrictedLayerHits);
273 int phiRefSt2 = itGP.second->propagateRefPhi(phiRef, etaRef, aRefHitDef.
iRefLayer);
283 for(
auto & itRefHit: myResults)
for(
auto & itKey: itRefHit) itKey.second.finalise();
285 std::ostringstream myStr;
286 myStr<<
"iProcessor: "<<iProcessor<<std::endl;
287 myStr<<
"Input: ------------"<<std::endl;
288 myStr<<aInput<<std::endl;
296 unsigned int iRegion,
305 for(
unsigned int iInput=0;iInput<14;++iInput){
317 int theCharge =
abs(aSimMuon->
type()) == 13 ? -1 : 1;
322 if(iPt>31) iPt=200*2+1;
327 std::bitset<128> refHitsBits = aInput.
getRefHits(iProcessor);
328 if(refHitsBits.none())
return;
330 std::ostringstream myStr;
331 myStr<<
"iProcessor: "<<iProcessor<<std::endl;
332 myStr<<
"Input: ------------"<<std::endl;
333 myStr<<aInput<<std::endl;
338 if(!layerHits.size())
continue;
342 if(!refHitsBits[iRefHit])
continue;
345 unsigned int iRegion = aRefHitDef.
iRegion;
349 if(itGP.first.theCharge!=theCharge)
continue;
350 if(itGP.first.thePtCode!=iPt)
continue;
351 itGP.second->addCount(aRefHitDef.
iRefLayer,iLayer,phiRef,restrictedLayerHits);
T getParameter(std::string const &) const
void fillCounts(unsigned int iProcessor, const OMTFinput &aInput, const SimTrack *aSimMuon)
void averagePatterns(int charge)
std::vector< int > vector1D
bool exists(std::string const ¶meterName) const
checks if a parameter exists
const vector2D & getMeanDistPhi() const
unsigned int iInput
Hit input number within a cone.
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
std::map< Key, OMTFResult > resultsMap
bool configure(XMLConfigReader *aReader)
Fill GP map with patterns from XML file.
OMTFConfiguration * m_omtf_config
const l1t::LUT * chargeLUT() const
Golden Patterns definitions.
bool addGP(GoldenPattern *aGP)
unsigned int nPdfAddrBits
unsigned int nrBitsData() const
std::vector< vector1D > vector2D
std::vector< vector2D > vector3D
void setPdf(const vector3D &aPdf)
unsigned int nTestRefHits
tuple omtfParams
OMTF ESProducer.
std::vector< std::vector< RefHitDef > > refHitsDefs
Abs< T >::type abs(const T &t)
std::pair< int, bool > layerResult
static double ptFromIpt(const int ipt)
void setPatternsFile(const std::string &fName)
void resetConfiguration()
Reset all configuration parameters.
const l1t::LUT * etaLUT() const
const l1t::LUT * pdfLUT() const
OMTFProcessor(const edm::ParameterSet &cfg, OMTFConfiguration *omtf_config)
OMTFinput::vector1D restrictInput(unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput::vector1D &layerHits)
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
std::vector< GoldenPattern * > readPatterns()
void shiftGP(GoldenPattern *aGP, const GoldenPattern::vector2D &meanDistPhiNew, const GoldenPattern::vector2D &meanDistPhiOld)
const l1t::LUT * ptLUT() const
int type() const
particle type (HEP PDT convension)
const math::XYZTLorentzVectorD & momentum() const
void setMeanDistPhi(const vector2D &aMeanDistPhi)
unsigned int iRefLayer
Reference layer logic number (0-7)
const std::vector< OMTFProcessor::resultsMap > & processInput(unsigned int iProcessor, const OMTFinput &aInput)
int data(unsigned int address) const
unsigned int iRegion
Region number assigned to this referecne hit.
unsigned int nGoldenPatterns
std::string fullPath() const
static int iptFromPt(const double pt)
const std::map< Key, GoldenPattern * > & getPatterns() const
Return map of GoldenPatterns.
const l1t::LUT * meanDistPhiLUT() const
std::vector< OMTFProcessor::resultsMap > myResults
static const OMTFConfiguration * instance()
const vector3D & getPdf() const