28 if ( !theConfig.
exists(
"patternsXMLFiles") )
return;
30 for(
auto it: theConfig.
getParameter<std::vector<edm::ParameterSet> >(
"patternsXMLFiles")){
36 for(
auto it: fileNames){
46 for(
auto it:
theGPs)
delete it.second;
64 const std::vector<GoldenPattern *> & aGPs = aReader->
readPatterns();
66 if(!
addGP(it))
return false;
79 l1t::LUT* chargeLUT = omtfParams->chargeLUT();
80 l1t::LUT* etaLUT = omtfParams->etaLUT();
81 l1t::LUT* ptLUT = omtfParams->ptLUT();
82 l1t::LUT* pdfLUT = omtfParams->pdfLUT();
83 l1t::LUT* meanDistPhiLUT = omtfParams->meanDistPhiLUT();
86 unsigned int address = 0;
87 unsigned int iEta, iPt, iCharge;
88 for(
unsigned int iGP=0;iGP<nGPs;++iGP){
90 iEta = etaLUT->
data(address);
91 iCharge = chargeLUT->
data(address);
92 if(iCharge==0) iCharge = -1;
93 iPt = ptLUT->
data(address);
104 meanDistPhi1D[iRefLayer] = meanDistPhiLUT->
data(address) - (1<<(meanDistPhiLUT->
nrBitsData() -1));
106 meanDistPhi2D[iLayer] = meanDistPhi1D;
114 pdf1D[iPdf] = pdfLUT->
data(address);
116 pdf2D[iRefLayer] = pdf1D;
118 pdf3D[iLayer] = pdf2D;
120 Key aKey(iEta,iPt,iCharge);
134 <<
"OMTFProcessor::addGP(...) "
135 <<
" Reading two Golden Patterns with the same key: "
136 <<aGP->
key()<<std::endl;
148 Key aKey(1, 4, charge);
189 meanDistPhi[iLayer][iRefLayer]+=meanDistPhi2[iLayer][iRefLayer];
190 meanDistPhi[iLayer][iRefLayer]+=meanDistPhi3[iLayer][iRefLayer];
191 meanDistPhi[iLayer][iRefLayer]+=meanDistPhi4[iLayer][iRefLayer];
192 meanDistPhi[iLayer][iRefLayer]/=4;
207 shiftGP(aGP1,meanDistPhi, meanDistPhi1);
208 shiftGP(aGP2,meanDistPhi, meanDistPhi2);
209 if(aGP3!=aGP1 && aGP4!=aGP2){
212 shiftGP(aGP3,meanDistPhi, meanDistPhi3);
213 shiftGP(aGP4,meanDistPhi, meanDistPhi4);
233 indexShift = meanDistPhiOld[iLayer][iRefLayer] - meanDistPhiNew[iLayer][iRefLayer];
234 for(
unsigned int iPdfBin=0;iPdfBin<nPdfBins;++iPdfBin) pdfAllRef[iLayer][iRefLayer][iPdfBin] = 0;
235 for(
unsigned int iPdfBin=0;iPdfBin<nPdfBins;++iPdfBin){
236 if((
int)(iPdfBin)+indexShift>=0 && iPdfBin+indexShift<nPdfBins)
237 pdfAllRef[iLayer][iRefLayer][iPdfBin+indexShift] = aGP->
pdfValue(iLayer, iRefLayer, iPdfBin);
251 for(
auto & itRegion:
myResults)
for(
auto & itKey: itRegion) itKey.second.clear();
255 std::bitset<128> refHitsBits = aInput.
getRefHits(iProcessor);
256 if(refHitsBits.none())
return myResults;
260 if(!layerHits.size())
continue;
265 if(!refHitsBits[iRefHit])
continue;
266 if(nTestedRefHits--==0)
break;
270 unsigned int iRegion = aRefHitDef.
iRegion;
276 restrictedLayerHits);
278 int phiRefSt2 = itGP.second->propagateRefPhi(phiRef, etaRef, aRefHitDef.
iRefLayer);
287 for(
auto & itRefHit: myResults)
for(
auto & itKey: itRefHit) itKey.second.finalise();
290 std::ostringstream myStr;
291 myStr<<
"iProcessor: "<<iProcessor<<std::endl;
292 myStr<<
"Input: ------------"<<std::endl;
293 myStr<<aInput<<std::endl;
329 unsigned int iRegion,
338 for(
unsigned int iInput=0;iInput<14;++iInput){
350 int theCharge = (
abs(aSimMuon->
type()) == 13) ? aSimMuon->
type()/-13 : 0;
354 std::bitset<128> refHitsBits = aInput.
getRefHits(iProcessor);
355 if(refHitsBits.none())
return;
357 std::ostringstream myStr;
358 myStr<<
"iProcessor: "<<iProcessor<<std::endl;
359 myStr<<
"Input: ------------"<<std::endl;
360 myStr<<aInput<<std::endl;
365 if(!layerHits.size())
continue;
369 if(!refHitsBits[iRefHit])
continue;
372 unsigned int iRegion = aRefHitDef.
iRegion;
376 if(itGP.first.theCharge!=theCharge)
continue;
377 if(itGP.first.thePtCode!=iPt)
continue;
378 itGP.second->addCount(aRefHitDef.
iRefLayer,iLayer,phiRef,restrictedLayerHits);
T getParameter(std::string const &) const
static unsigned int nLayers
void fillCounts(unsigned int iProcessor, const OMTFinput &aInput, const SimTrack *aSimMuon)
void averagePatterns(int charge)
static vector3D_A connections
std::vector< int > vector1D
bool exists(std::string const ¶meterName) const
checks if a parameter exists
const vector2D & getMeanDistPhi() const
static int globalPhiStart(unsigned int iProcessor)
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.
bool addGP(GoldenPattern *aGP)
static unsigned int nPdfAddrBits
unsigned int nrBitsData() const
std::vector< vector1D > vector2D
std::vector< vector2D > vector3D
void setPdf(const vector3D &aPdf)
static unsigned int nTestRefHits
Abs< T >::type abs(const T &t)
static unsigned int nPhiBins
std::pair< int, bool > layerResult
static std::vector< int > refToLogicNumber
void setPatternsFile(const std::string &fName)
void resetConfiguration()
Reset all configuration parameters.
static unsigned int nRefLayers
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)
static unsigned int nRefHits
static std::set< int > bendingLayers
int type() const
particle type (HEP PDT convension)
OMTFProcessor(const edm::ParameterSet &cfg)
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)
OMTFinput shiftInput(unsigned int iProcessor, const OMTFinput &aInput)
int data(unsigned int address) const
unsigned int iRegion
Region number assigned to this referecne hit.
static unsigned int nGoldenPatterns
std::string fullPath() const
static int iptFromPt(const double pt)
const std::map< Key, GoldenPattern * > & getPatterns() const
Return map of GoldenPatterns.
std::vector< OMTFProcessor::resultsMap > myResults
const vector3D & getPdf() const
static std::vector< std::vector< RefHitDef > > refHitsDefs