24 for(
auto itHit: layerHits){
26 if(
abs(itHit-phiMean-phiRefHit)<
abs(phiDist)) phiDist = itHit-phiMean-phiRefHit;
35 int pdfVal =
pdfAllRef[iLayer][iRefLayer][phiDist];
43 unsigned int iLayer = 2;
57 for(
auto itHit: layerHits){
59 if(
abs(itHit-phiRefHit)<phiDist) phiDist = itHit-phiRefHit;
63 if(nHitsInLayer>1 || nHitsInLayer==0)
return;
81 ++
pdfAllRef[iLayer][iRefLayer][phiDistShift];
87 out <<
"GoldenPattern "<< aPattern.
theKey <<std::endl;
88 out <<
"Number of reference layers: "<<aPattern.
meanDistPhi[0].size()
89 <<
", number of measurement layers: "<<aPattern.
pdfAllRef.size()
93 if(aPattern.
pdfAllRef.empty())
return out;
95 out<<
"Mean dist phi per layer:"<<std::endl;
96 for (
unsigned int iRefLayer=0;iRefLayer<aPattern.
meanDistPhi[0].size();++iRefLayer){
97 out<<
"Ref layer: "<<iRefLayer<<
" (";
98 for (
unsigned int iLayer=0;iLayer<aPattern.
meanDistPhi.size();++iLayer){
99 out<<std::setw(3)<<aPattern.
meanDistPhi[iLayer][iRefLayer]<<
"\t";
105 out<<
"Counts number per layer:"<<std::endl;
106 for (
unsigned int iRefLayer=0;iRefLayer<aPattern.
meanDistPhi[0].size();++iRefLayer){
107 out<<
"Ref layer: "<<iRefLayer<<
" (";
108 for (
unsigned int iLayer=0;iLayer<aPattern.
meanDistPhi.size();++iLayer){
115 unsigned int nPdfAddrBits = 7;
116 out<<
"PDF per layer:"<<std::endl;
117 for (
unsigned int iRefLayer=0;iRefLayer<aPattern.
pdfAllRef[0].size();++iRefLayer){
118 out<<
"Ref layer: "<<iRefLayer;
119 for (
unsigned int iLayer=0;iLayer<aPattern.
pdfAllRef.size();++iLayer){
120 out<<
", measurement layer: "<<iLayer<<std::endl;
121 for (
unsigned int iPdf=0;iPdf<exp2(nPdfAddrBits);++iPdf){
122 out<<std::setw(2)<<aPattern.
pdfAllRef[iLayer][iRefLayer][iPdf]<<
" ";
151 for (
unsigned int iRefLayer=0;iRefLayer<
pdfAllRef[0].size();++iRefLayer){
152 for (
unsigned int iLayer=0;iLayer<
pdfAllRef.size();++iLayer){
153 for (
unsigned int iPdf=0;iPdf<
pdfAllRef[iLayer][iRefLayer].size();++iPdf){
163 for (
unsigned int iRefLayer=0;iRefLayer<
meanDistPhi[0].size();++iRefLayer){
164 for (
unsigned int iLayer=0;iLayer<
meanDistPhi.size();++iLayer){
175 int digitisedVal, truncatedValue;
176 for (
unsigned int iRefLayer=0;iRefLayer<
pdfAllRef[0].size();++iRefLayer){
177 for (
unsigned int iLayer=0;iLayer<
pdfAllRef.size();++iLayer){
178 for (
unsigned int iPdf=0;iPdf<
pdfAllRef[iLayer][iRefLayer].size();++iPdf){
180 !
pdfAllRef[iLayer][iRefLayer][iPdf])
continue;
190 digitisedVal = rint((
std::pow(2,nPdfValBits)-1) - (pVal/minPlog)*(
std::pow(2,nPdfValBits)-1));
192 truncatedValue = 0 | (digitisedVal & ((
int)
pow(2,nPdfValBits)-1));
193 pdfAllRef[iLayer][iRefLayer][iPdf] = truncatedValue;
199 for (
unsigned int iRefLayer=0;iRefLayer<
pdfAllRef[0].size();++iRefLayer){
200 for (
unsigned int iLayer=0;iLayer<
pdfAllRef.size();++iLayer){
201 for (
unsigned int iPdf=0;iPdf<
pdfAllRef[iLayer][iRefLayer].size();++iPdf){
205 if(index<0 || index>exp2(nPdfAddrBits)-1)
continue;
206 pdfAllRef[iLayer][iRefLayer][
index] = pdfAllRefTmp[iLayer][iRefLayer][iPdf];
215 for (
unsigned int iRefLayer=0;iRefLayer<
meanDistPhi[0].size();++iRefLayer){
216 for (
unsigned int iLayer=0;iLayer<
meanDistPhi.size();++iLayer){
unsigned int nRefLayers() const
friend std::ostream & operator<<(std::ostream &out, const GoldenPattern &aPattern)
vector2D meanDistPhiCounts
std::vector< int > vector1D
unsigned int nLayers() const
unsigned int nPhiBins() const
const OMTFConfiguration * myOmtfConfig
bool hasCounts()
Check if the GP has any counts in any of referecne layers;.
GoldenPattern::layerResult process1Layer1RefLayer(unsigned int iRefLayer, unsigned int iLayer, const int refPhi, const OMTFinput::vector1D &layerHits)
void normalise(unsigned int nPdfAddrBits)
std::vector< vector1D > vector2D
std::vector< vector2D > vector3D
Key theKey
Pattern kinematical identification (iEta,iPt,iCharge)
unsigned int nPdfAddrBits() const
Abs< T >::type abs(const T &t)
std::pair< int, bool > layerResult
void reset()
Reset contents of all data vectors, keeping the vectors size.
int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer)
const std::vector< int > & getRefToLogicNumber() const
void addCount(unsigned int iRefLayer, unsigned int iLayer, const int refPhi, const OMTFinput::vector1D &layerHits)
Add a single count to the relevant pdf bin in three dimensions.
unsigned int nPdfValBits() const
Power< A, B >::type pow(const A &a, const B &b)