Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-30 08:50:48

0001 #include "L1Trigger/L1TMuonBarrel/interface/L1TMuonBarrelKalmanLUTs.h"
0002 #include "FWCore/ParameterSet/interface/FileInPath.h"
0003 
0004 L1TMuonBarrelKalmanLUTs::L1TMuonBarrelKalmanLUTs(const std::string& filename) {
0005   edm::FileInPath path(filename);
0006   lutFile_ = new TFile(path.fullPath().c_str());
0007 
0008   lut_[3 * 64 + 8] = (TH1*)lutFile_->Get("gain_8_3");
0009   lut_[2 * 64 + 8] = (TH1*)lutFile_->Get("gain_8_2");
0010   lut_[2 * 64 + 12] = (TH1*)lutFile_->Get("gain_12_2");
0011   lut_[2 * 64 + 4] = (TH1*)lutFile_->Get("gain_4_2");
0012   lut_[1 * 64 + 12] = (TH1*)lutFile_->Get("gain_12_1");
0013   lut_[1 * 64 + 10] = (TH1*)lutFile_->Get("gain_10_1");
0014   lut_[1 * 64 + 6] = (TH1*)lutFile_->Get("gain_6_1");
0015   lut_[1 * 64 + 14] = (TH1*)lutFile_->Get("gain_14_1");
0016   lut_[3] = (TH1*)lutFile_->Get("gain_3_0");
0017   lut_[5] = (TH1*)lutFile_->Get("gain_5_0");
0018   lut_[6] = (TH1*)lutFile_->Get("gain_6_0");
0019   lut_[7] = (TH1*)lutFile_->Get("gain_7_0");
0020   lut_[9] = (TH1*)lutFile_->Get("gain_9_0");
0021   lut_[10] = (TH1*)lutFile_->Get("gain_10_0");
0022   lut_[11] = (TH1*)lutFile_->Get("gain_11_0");
0023   lut_[12] = (TH1*)lutFile_->Get("gain_12_0");
0024   lut_[13] = (TH1*)lutFile_->Get("gain_13_0");
0025   lut_[14] = (TH1*)lutFile_->Get("gain_14_0");
0026   lut_[15] = (TH1*)lutFile_->Get("gain_15_0");
0027 
0028   lut2HH_[3 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_3_HH");
0029   lut2HH_[2 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_2_HH");
0030   lut2HH_[2 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_2_HH");
0031   lut2HH_[1 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_1_HH");
0032   lut2HH_[1 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_1_HH");
0033   lut2HH_[1 * 64 + 2] = (TH1*)lutFile_->Get("gain2_2_1_HH");
0034 
0035   lut2LH_[3 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_3_LH");
0036   lut2LH_[2 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_2_LH");
0037   lut2LH_[2 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_2_LH");
0038   lut2LH_[1 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_1_LH");
0039   lut2LH_[1 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_1_LH");
0040   lut2LH_[1 * 64 + 2] = (TH1*)lutFile_->Get("gain2_2_1_LH");
0041 
0042   lut2HL_[3 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_3_HL");
0043   lut2HL_[2 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_2_HL");
0044   lut2HL_[2 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_2_HL");
0045   lut2HL_[1 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_1_HL");
0046   lut2HL_[1 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_1_HL");
0047   lut2HL_[1 * 64 + 2] = (TH1*)lutFile_->Get("gain2_2_1_HL");
0048 
0049   lut2LL_[3 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_3_LL");
0050   lut2LL_[2 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_2_LL");
0051   lut2LL_[2 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_2_LL");
0052   lut2LL_[1 * 64 + 8] = (TH1*)lutFile_->Get("gain2_8_1_LL");
0053   lut2LL_[1 * 64 + 4] = (TH1*)lutFile_->Get("gain2_4_1_LL");
0054   lut2LL_[1 * 64 + 2] = (TH1*)lutFile_->Get("gain2_2_1_LL");
0055 
0056   coarseEta_[3] = (TH1*)lutFile_->Get("coarseEta_3");
0057   coarseEta_[5] = (TH1*)lutFile_->Get("coarseEta_5");
0058   coarseEta_[6] = (TH1*)lutFile_->Get("coarseEta_6");
0059   coarseEta_[7] = (TH1*)lutFile_->Get("coarseEta_7");
0060   coarseEta_[9] = (TH1*)lutFile_->Get("coarseEta_9");
0061 
0062   coarseEta_[10] = (TH1*)lutFile_->Get("coarseEta_10");
0063   coarseEta_[11] = (TH1*)lutFile_->Get("coarseEta_11");
0064   coarseEta_[12] = (TH1*)lutFile_->Get("coarseEta_12");
0065   coarseEta_[13] = (TH1*)lutFile_->Get("coarseEta_13");
0066   coarseEta_[14] = (TH1*)lutFile_->Get("coarseEta_14");
0067   coarseEta_[15] = (TH1*)lutFile_->Get("coarseEta_15");
0068 }
0069 
0070 L1TMuonBarrelKalmanLUTs::~L1TMuonBarrelKalmanLUTs() {
0071   lutFile_->Close();
0072   if (lutFile_ != nullptr)
0073     delete lutFile_;
0074 }
0075 
0076 std::vector<float> L1TMuonBarrelKalmanLUTs::trackGain(uint step, uint bitmask, uint K) {
0077   std::vector<float> gain(4, 0.0);
0078   const TH1* h = lut_[64 * step + bitmask];
0079   gain[0] = h->GetBinContent(K + 1);
0080   gain[2] = h->GetBinContent(1024 + K + 1);
0081   return gain;
0082 }
0083 
0084 std::vector<float> L1TMuonBarrelKalmanLUTs::trackGain2(uint step, uint bitmask, uint K, uint qual1, uint qual2) {
0085   std::vector<float> gain(4, 0.0);
0086 
0087   //  printf("Track gain %d %d %d\n",step,bitmask,K);
0088   const TH1* h;
0089   if (qual1 < 4) {
0090     if (qual2 < 4)
0091       h = lut2LL_[64 * step + bitmask];
0092     else
0093       h = lut2LH_[64 * step + bitmask];
0094   } else {
0095     if (qual2 < 4)
0096       h = lut2HL_[64 * step + bitmask];
0097     else
0098       h = lut2HH_[64 * step + bitmask];
0099   }
0100   gain[0] = h->GetBinContent(K + 1);
0101   gain[1] = h->GetBinContent(512 + K + 1);
0102   gain[2] = h->GetBinContent(2 * 512 + K + 1);
0103   gain[3] = h->GetBinContent(3 * 512 + K + 1);
0104   return gain;
0105 }
0106 
0107 std::pair<float, float> L1TMuonBarrelKalmanLUTs::vertexGain(uint bitmask, uint K) {
0108   const TH1* h = lut_[bitmask];
0109   std::pair<float, float> gain(-h->GetBinContent(K + 1), -h->GetBinContent(1024 + K + 1));
0110   return gain;
0111 }
0112 
0113 uint L1TMuonBarrelKalmanLUTs::coarseEta(uint pattern, uint mask) {
0114   const TH1* h = coarseEta_[pattern];
0115   return uint(h->GetBinContent(h->GetXaxis()->FindBin(mask)));
0116 }