Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:07

0001 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPattern.h"
0002 
0003 #include <cmath>
0004 #include <iomanip>
0005 
0006 int GoldenPattern::meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB) const {
0007   return (((meanDistPhi[iLayer][iRefLayer][1] * refLayerPhiB) >> myOmtfConfig->nPdfAddrBits()) +
0008           meanDistPhi[iLayer][iRefLayer][0]);
0009   //assumes that the meanDistPhi[1] is float alpha from the fit to the phiB-phi distribution multiplied by 2^myOmtfConfig->nPdfAddrBits()
0010 }
0011 
0012 ////////////////////////////////////////////////////
0013 ////////////////////////////////////////////////////
0014 int GoldenPattern::propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer) {
0015   unsigned int iLayer = 2;  //MB2
0016   return phiRef + meanDistPhi[iLayer][iRefLayer][0];
0017   //FIXME if the meanDistPhiAlpha is non-zero, then meanDistPhi is alone not good for propagation of the phi
0018   //other value should be used, or the ref_layer phiB should be included
0019 }
0020 ////////////////////////////////////////////////////
0021 ////////////////////////////////////////////////////
0022 
0023 std::ostream &operator<<(std::ostream &out, const GoldenPattern &aPattern) {
0024   out << "GoldenPattern " << aPattern.theKey << std::endl;
0025   out << "Number of reference layers: " << aPattern.meanDistPhi[0].size()
0026       << ", number of measurement layers: " << aPattern.pdfAllRef.size() << std::endl;
0027 
0028   if (aPattern.meanDistPhi.empty())
0029     return out;
0030   if (aPattern.pdfAllRef.empty())
0031     return out;
0032 
0033   out << "Mean dist phi per layer:" << std::endl;
0034   for (unsigned int iRefLayer = 0; iRefLayer < aPattern.meanDistPhi[0].size(); ++iRefLayer) {
0035     out << "Ref layer: " << iRefLayer << " (";
0036     for (unsigned int iLayer = 0; iLayer < aPattern.meanDistPhi.size(); ++iLayer) {
0037       for (unsigned int iPar = 0; iPar < aPattern.meanDistPhi[iLayer][iRefLayer].size(); iPar++)
0038         out << std::setw(3) << aPattern.meanDistPhi[iLayer][iRefLayer][iPar] << "\t";
0039     }
0040     out << ")" << std::endl;
0041   }
0042 
0043   unsigned int nPdfAddrBits = 7;
0044   out << "PDF per layer:" << std::endl;
0045   for (unsigned int iRefLayer = 0; iRefLayer < aPattern.pdfAllRef[0].size(); ++iRefLayer) {
0046     out << "Ref layer: " << iRefLayer;
0047     for (unsigned int iLayer = 0; iLayer < aPattern.pdfAllRef.size(); ++iLayer) {
0048       out << ", measurement layer: " << iLayer << std::endl;
0049       for (unsigned int iPdf = 0; iPdf < exp2(nPdfAddrBits); ++iPdf) {
0050         out << std::setw(2) << aPattern.pdfAllRef[iLayer][iRefLayer][iPdf] << " ";
0051       }
0052       out << std::endl;
0053     }
0054   }
0055 
0056   return out;
0057 }
0058 ////////////////////////////////////////////////////
0059 ////////////////////////////////////////////////////
0060 void GoldenPattern::reset() {
0061   for (unsigned int iLayer = 0; iLayer < meanDistPhi.size(); ++iLayer) {
0062     for (unsigned int iRefLayer = 0; iRefLayer < meanDistPhi[iLayer].size(); ++iRefLayer) {
0063       for (unsigned int iBin = 0; iBin < meanDistPhi[iLayer][iRefLayer].size(); ++iBin) {
0064         meanDistPhi[iLayer][iRefLayer][iBin] = 0;
0065       }
0066     }
0067   }
0068 
0069   for (unsigned int iLayer = 0; iLayer < distPhiBitShift.size(); ++iLayer) {
0070     for (unsigned int iRefLayer = 0; iRefLayer < distPhiBitShift[iLayer].size(); ++iRefLayer) {
0071       distPhiBitShift[iLayer][iRefLayer] = 0;
0072     }
0073   }
0074 
0075   for (unsigned int iLayer = 0; iLayer < pdfAllRef.size(); ++iLayer) {
0076     for (unsigned int iRefLayer = 0; iRefLayer < pdfAllRef[iLayer].size(); ++iRefLayer) {
0077       for (unsigned int iPdf = 0; iPdf < pdfAllRef[iLayer][iRefLayer].size(); ++iPdf) {
0078         pdfAllRef[iLayer][iRefLayer][iPdf] = 0;
0079       }
0080     }
0081   }
0082 }