23 for (
auto itHit : layerHits) {
26 if (
abs(itHit - phiMean - phiRefHit) <
abs(phiDist))
27 phiDist = itHit - phiMean - phiRefHit;
37 int pdfVal =
pdfAllRef[iLayer][iRefLayer][phiDist];
44 unsigned int iLayer = 2;
56 for (
auto itHit : layerHits) {
59 if (
abs(itHit - phiRefHit) < phiDist)
60 phiDist = itHit - phiRefHit;
64 if (nHitsInLayer > 1 || nHitsInLayer == 0)
85 ++
pdfAllRef[iLayer][iRefLayer][phiDistShift];
90 out <<
"GoldenPattern " << aPattern.
theKey << std::endl;
91 out <<
"Number of reference layers: " << aPattern.
meanDistPhi[0].size()
92 <<
", number of measurement layers: " << aPattern.
pdfAllRef.size() << std::endl;
99 out <<
"Mean dist phi per layer:" << std::endl;
100 for (
unsigned int iRefLayer = 0; iRefLayer < aPattern.
meanDistPhi[0].size(); ++iRefLayer) {
101 out <<
"Ref layer: " << iRefLayer <<
" (";
102 for (
unsigned int iLayer = 0; iLayer < aPattern.
meanDistPhi.size(); ++iLayer) {
103 out << std::setw(3) << aPattern.
meanDistPhi[iLayer][iRefLayer] <<
"\t";
105 out <<
")" << std::endl;
109 out <<
"Counts number per layer:" << std::endl;
110 for (
unsigned int iRefLayer = 0; iRefLayer < aPattern.
meanDistPhi[0].size(); ++iRefLayer) {
111 out <<
"Ref layer: " << iRefLayer <<
" (";
112 for (
unsigned int iLayer = 0; iLayer < aPattern.
meanDistPhi.size(); ++iLayer) {
115 out <<
")" << std::endl;
119 unsigned int nPdfAddrBits = 7;
120 out <<
"PDF per layer:" << std::endl;
121 for (
unsigned int iRefLayer = 0; iRefLayer < aPattern.
pdfAllRef[0].size(); ++iRefLayer) {
122 out <<
"Ref layer: " << iRefLayer;
123 for (
unsigned int iLayer = 0; iLayer < aPattern.
pdfAllRef.size(); ++iLayer) {
124 out <<
", measurement layer: " << iLayer << std::endl;
125 for (
unsigned int iPdf = 0; iPdf < exp2(nPdfAddrBits); ++iPdf) {
126 out << std::setw(2) << aPattern.
pdfAllRef[iLayer][iRefLayer][iPdf] <<
" ";
153 for (
unsigned int iRefLayer = 0; iRefLayer <
pdfAllRef[0].size(); ++iRefLayer) {
154 for (
unsigned int iLayer = 0; iLayer <
pdfAllRef.size(); ++iLayer) {
155 for (
unsigned int iPdf = 0; iPdf <
pdfAllRef[iLayer][iRefLayer].size(); ++iPdf) {
156 float pVal =
log((
float)
pdfAllRef[iLayer][iRefLayer][iPdf] /
169 for (
unsigned int iRefLayer = 0; iRefLayer <
meanDistPhi[0].size(); ++iRefLayer) {
170 for (
unsigned int iLayer = 0; iLayer <
meanDistPhi.size(); ++iLayer) {
184 int digitisedVal, truncatedValue;
185 for (
unsigned int iRefLayer = 0; iRefLayer <
pdfAllRef[0].size(); ++iRefLayer) {
186 for (
unsigned int iLayer = 0; iLayer <
pdfAllRef.size(); ++iLayer) {
187 for (
unsigned int iPdf = 0; iPdf <
pdfAllRef[iLayer][iRefLayer].size(); ++iPdf) {
201 digitisedVal = rint((
std::pow(2, nPdfValBits) - 1) - (pVal / minPlog) * (
std::pow(2, nPdfValBits) - 1));
203 truncatedValue = 0 | (digitisedVal & ((
int)
pow(2, nPdfValBits) - 1));
204 pdfAllRef[iLayer][iRefLayer][iPdf] = truncatedValue;
210 for (
unsigned int iRefLayer = 0; iRefLayer <
pdfAllRef[0].size(); ++iRefLayer) {
211 for (
unsigned int iLayer = 0; iLayer <
pdfAllRef.size(); ++iLayer) {
212 for (
unsigned int iPdf = 0; iPdf <
pdfAllRef[iLayer][iRefLayer].size(); ++iPdf) {
217 if (index < 0 || index > exp2(nPdfAddrBits) - 1)
219 pdfAllRef[iLayer][iRefLayer][
index] = pdfAllRefTmp[iLayer][iRefLayer][iPdf];
227 for (
unsigned int iRefLayer = 0; iRefLayer <
meanDistPhi[0].size(); ++iRefLayer) {
228 for (
unsigned int iLayer = 0; iLayer <
meanDistPhi.size(); ++iLayer) {
vector2D meanDistPhiCounts
std::vector< int > vector1D
std::pair< int, bool > layerResult
unsigned int nPdfValBits() 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::ostream & operator<<(std::ostream &out, const GoldenPattern &aPattern)
unsigned int nPhiBins() const
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)
unsigned int nLayers() const
const std::vector< int > & getRefToLogicNumber() const
unsigned int nRefLayers() const
void reset()
Reset contents of all data vectors, keeping the vectors size.
int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer)
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.