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 
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  auto cc = setWhatProduced(this);
110  lutMetadataToken = cc.consumes();
111  theTrigTowerGeometryToken = cc.consumes();
112  topoToken = cc.consumes();
113 }
114 
116  // do anything here that needs to be done at desctruction time
117  // (e.g. close files, deallocate resources etc.)
118 }
119 
120 //
121 // member functions
122 //
123 
124 // ------------ method called to produce the data ------------
126  using namespace edm::es;
127  std::string file1 = "";
128  std::string file2 = "";
130  edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath()
131  << " for CaloTPGTranscoderULUTs HCAL initialization";
132  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
133  //return pTCoder;
136  } else if (read_Ascii_RCT && !read_Ascii_Compression) {
137  edm::LogInfo("Level1") << "Using analytical compression and " << hfilename2_.fullPath()
138  << " RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
139  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
140  //return pTCoder;
142  } else if (read_Ascii_Compression && !read_Ascii_RCT) {
143  edm::LogInfo("Level1") << "Using ASCII compression tables " << hfilename1_.fullPath()
144  << " and automatic RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
145  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
146  //return pTCoder;
148  } else {
149  edm::LogInfo("Level1")
150  << "Using analytical compression and RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
151  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
152  //return pTCoder;
153  }
154  //std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));
155 
156  const auto& lutMetadata = iRecord.get(lutMetadataToken);
157  const auto& theTrigTowerGeometry = iRecord.get(theTrigTowerGeometryToken);
158  const auto& topo = iRecord.getRecord<HcalLutMetadataRcd>().get(topoToken);
159 
160  HcalLutMetadata fullLut{lutMetadata};
161  fullLut.setTopo(&topo);
162 
163  auto pTCoder = std::make_unique<CaloTPGTranscoderULUT>(file1, file2);
164  pTCoder->setup(fullLut, theTrigTowerGeometry, NCTScaleShift, RCTScaleShift, lsbQIE8, lsbQIE11, linearLUTs_);
165  return pTCoder;
166 }
167 
168 //define this as a plug-in
std::unique_ptr< CaloTPGTranscoder > ReturnType
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
std::string fullPath() const
Definition: FileInPath.cc:161
edm::ESGetToken< HcalTrigTowerGeometry, CaloGeometryRecord > theTrigTowerGeometryToken
CaloTPGTranscoderULUTs(const edm::ParameterSet &)
const std::vector< int > LUTfactor
const std::vector< int > ietal
ReturnType produce(const CaloTPGRecord &)
const edm::FileInPath hfilename1_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
Log< level::Info, false > LogInfo
const std::vector< int > ZS
HLT enums.
const std::vector< int > ietah
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken
edm::ESGetToken< HcalLutMetadata, HcalLutMetadataRcd > lutMetadataToken
void setTopo(const HcalTopology *topo)
const edm::FileInPath hfilename2_