CMS 3D CMS Logo

CaloTPGTranscoderULUTs.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CaloTPGTranscoderULUTs
4 // Class: CaloTPGTranscoderULUTs
5 //
13 //
14 // Original Author: Jeremiah Mans
15 // Created: Fri Sep 15 11:49:44 CDT 2006
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
23 
27 
32 
38 
39 //
40 // class decleration
41 //
42 
44 public:
46  ~CaloTPGTranscoderULUTs() override;
47 
48  typedef std::unique_ptr<CaloTPGTranscoder> ReturnType;
49 
50  ReturnType produce(const CaloTPGRecord&);
51 
52 private:
53  // ----------member data ---------------------------
57  const bool read_Ascii_RCT;
58  const std::vector<int> ietal;
59  const std::vector<int> ietah;
60  const std::vector<int> ZS;
61  const std::vector<int> LUTfactor;
62  const bool linearLUTs_;
63  const double nominal_gain;
64  const double RCTLSB;
65  const int NCTScaleShift;
66  const int RCTScaleShift;
67  const double lsbQIE8;
68  const double lsbQIE11;
72 };
73 
74 //
75 // constants, enums and typedefs
76 //
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
86  : hfilename1_(iConfig.getParameter<edm::FileInPath>("hcalLUT1")),
87  hfilename2_(iConfig.getParameter<edm::FileInPath>("hcalLUT2")),
88  read_Ascii_Compression(iConfig.getParameter<bool>("read_Ascii_Compression_LUTs")),
89  read_Ascii_RCT(iConfig.getParameter<bool>("read_Ascii_RCT_LUTs")),
90  ietal(iConfig.getParameter<std::vector<int>>("ietaLowerBound")),
91  ietah(iConfig.getParameter<std::vector<int>>("ietaUpperBound")),
92  ZS(iConfig.getParameter<std::vector<int>>("ZS")),
93  LUTfactor(iConfig.getParameter<std::vector<int>>("LUTfactor")),
94  linearLUTs_(iConfig.getParameter<bool>("linearLUTs")),
95  nominal_gain(iConfig.getParameter<double>("nominal_gain")),
96  RCTLSB(iConfig.getParameter<double>("RCTLSB")),
97  NCTScaleShift(iConfig.getParameter<edm::ParameterSet>("tpScales")
98  .getParameter<edm::ParameterSet>("HF")
99  .getParameter<int>("NCTShift")),
100  RCTScaleShift(iConfig.getParameter<edm::ParameterSet>("tpScales")
101  .getParameter<edm::ParameterSet>("HF")
102  .getParameter<int>("RCTShift")),
103  lsbQIE8(iConfig.getParameter<edm::ParameterSet>("tpScales")
104  .getParameter<edm::ParameterSet>("HBHE")
105  .getParameter<double>("LSBQIE8")),
106  lsbQIE11(iConfig.getParameter<edm::ParameterSet>("tpScales")
107  .getParameter<edm::ParameterSet>("HBHE")
108  .getParameter<double>("LSBQIE11")) {
109  setWhatProduced(this).setConsumes(lutMetadataToken).setConsumes(theTrigTowerGeometryToken).setConsumes(topoToken);
110 }
111 
113  // do anything here that needs to be done at desctruction time
114  // (e.g. close files, deallocate resources etc.)
115 }
116 
117 //
118 // member functions
119 //
120 
121 // ------------ method called to produce the data ------------
123  using namespace edm::es;
124  std::string file1 = "";
125  std::string file2 = "";
127  edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath()
128  << " for CaloTPGTranscoderULUTs HCAL initialization";
129  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
130  //return pTCoder;
131  file1 = hfilename1_.fullPath();
132  file2 = hfilename2_.fullPath();
133  } else if (read_Ascii_RCT && !read_Ascii_Compression) {
134  edm::LogInfo("Level1") << "Using analytical compression and " << hfilename2_.fullPath()
135  << " RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
136  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
137  //return pTCoder;
138  file2 = hfilename2_.fullPath();
139  } else if (read_Ascii_Compression && !read_Ascii_RCT) {
140  edm::LogInfo("Level1") << "Using ASCII compression tables " << hfilename1_.fullPath()
141  << " and automatic RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
142  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
143  //return pTCoder;
144  file1 = hfilename1_.fullPath();
145  } else {
146  edm::LogInfo("Level1")
147  << "Using analytical compression and RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
148  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
149  //return pTCoder;
150  }
151  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));
152 
153  const auto& lutMetadata = iRecord.get(lutMetadataToken);
154  const auto& theTrigTowerGeometry = iRecord.get(theTrigTowerGeometryToken);
155  const auto& topo = iRecord.getRecord<HcalLutMetadataRcd>().get(topoToken);
156 
157  HcalLutMetadata fullLut{lutMetadata};
158  fullLut.setTopo(&topo);
159 
160  auto pTCoder = std::make_unique<CaloTPGTranscoderULUT>(file1, file2);
161  pTCoder->setup(fullLut, theTrigTowerGeometry, NCTScaleShift, RCTScaleShift, lsbQIE8, lsbQIE11, linearLUTs_);
162  return pTCoder;
163 }
164 
165 //define this as a plug-in
std::unique_ptr< CaloTPGTranscoder > ReturnType
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ESGetToken< HcalTrigTowerGeometry, CaloGeometryRecord > theTrigTowerGeometryToken
CaloTPGTranscoderULUTs(const edm::ParameterSet &)
const std::vector< int > LUTfactor
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const std::vector< int > ietal
ReturnType produce(const CaloTPGRecord &)
const edm::FileInPath hfilename1_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
const std::vector< int > ZS
HLT enums.
const std::vector< int > ietah
std::string fullPath() const
Definition: FileInPath.cc:163
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken
edm::ESGetToken< HcalLutMetadata, HcalLutMetadataRcd > lutMetadataToken
void setTopo(const HcalTopology *topo)
const edm::FileInPath hfilename2_