Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:12:52

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