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
edm::eventsetup::DependentRecordImplementation::getRecord
const DepRecordT getRecord() const
Definition: DependentRecordImplementation.h:50
electrons_cff.bool
bool
Definition: electrons_cff.py:366
MessageLogger.h
HcalLutMetadataRcd
Definition: HcalLutMetadataRcd.h:25
HcalCondObjectContainerBase::setTopo
void setTopo(const HcalTopology *topo)
Definition: HcalCondObjectContainerBase.cc:17
CaloTPGTranscoderULUTs::theTrigTowerGeometryToken
edm::ESGetToken< HcalTrigTowerGeometry, CaloGeometryRecord > theTrigTowerGeometryToken
Definition: CaloTPGTranscoderULUTs.cc:70
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
ValidityInterval.h
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ESProducer.h
HcalRecNumberingRecord.h
HcalLutMetadata.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edmOneToOneComparison.file2
file2
Definition: edmOneToOneComparison.py:107
CaloTPGTranscoderULUTs::CaloTPGTranscoderULUTs
CaloTPGTranscoderULUTs(const edm::ParameterSet &)
Definition: CaloTPGTranscoderULUTs.cc:85
CaloTPGTranscoderULUTs::lsbQIE11
const double lsbQIE11
Definition: CaloTPGTranscoderULUTs.cc:68
CaloTPGTranscoderULUTs::lsbQIE8
const double lsbQIE8
Definition: CaloTPGTranscoderULUTs.cc:67
edm::FileInPath
Definition: FileInPath.h:61
CaloTPGTranscoderULUTs::produce
ReturnType produce(const CaloTPGRecord &)
Definition: CaloTPGTranscoderULUTs.cc:125
CaloTPGTranscoderULUTs::RCTLSB
const double RCTLSB
Definition: CaloTPGTranscoderULUTs.cc:64
CaloTPGTranscoderULUTs::nominal_gain
const double nominal_gain
Definition: CaloTPGTranscoderULUTs.cc:63
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
CaloTPGTranscoderULUT.h
EventSetupRecordIntervalFinder.h
CaloGeometryRecord.h
CaloTPGTranscoderULUTs::ietal
const std::vector< int > ietal
Definition: CaloTPGTranscoderULUTs.cc:58
CaloTPGTranscoderULUTs::LUTfactor
const std::vector< int > LUTfactor
Definition: CaloTPGTranscoderULUTs.cc:61
edm::ParameterSet
Definition: ParameterSet.h:47
CaloTPGTranscoderULUTs
Definition: CaloTPGTranscoderULUTs.cc:43
CaloTPGTranscoderULUTs::read_Ascii_RCT
const bool read_Ascii_RCT
Definition: CaloTPGTranscoderULUTs.cc:57
CaloTPGTranscoderULUTs::RCTScaleShift
const int RCTScaleShift
Definition: CaloTPGTranscoderULUTs.cc:66
ParameterSet
Definition: Functions.h:16
CaloTPGRecord
Definition: CaloTPGRecord.h:26
createfilelist.int
int
Definition: createfilelist.py:10
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
CaloTPGTranscoderULUTs::linearLUTs_
const bool linearLUTs_
Definition: CaloTPGTranscoderULUTs.cc:62
HcalTrigTowerGeometry.h
CaloTPGRecord.h
get
#define get
cc
CaloTPGTranscoderULUTs::NCTScaleShift
const int NCTScaleShift
Definition: CaloTPGTranscoderULUTs.cc:65
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< HcalLutMetadata, HcalLutMetadataRcd >
CaloTPGTranscoderULUTs::hfilename1_
const edm::FileInPath hfilename1_
Definition: CaloTPGTranscoderULUTs.cc:54
ModuleFactory.h
std
Definition: JetResolutionObject.h:76
HcalLutMetadata
Definition: HcalLutMetadata.h:15
timingPdfMaker.file1
file1
Definition: timingPdfMaker.py:78
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
CaloTPGTranscoderULUTs::topoToken
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken
Definition: CaloTPGTranscoderULUTs.cc:71
CaloTPGTranscoderULUTs::lutMetadataToken
edm::ESGetToken< HcalLutMetadata, HcalLutMetadataRcd > lutMetadataToken
Definition: CaloTPGTranscoderULUTs.cc:69
edm::es
Definition: es_Label.h:33
CaloTPGTranscoderULUTs::read_Ascii_Compression
const bool read_Ascii_Compression
Definition: CaloTPGTranscoderULUTs.cc:56
edm::ESProducer
Definition: ESProducer.h:104
CaloTPGTranscoderULUTs::ZS
const std::vector< int > ZS
Definition: CaloTPGTranscoderULUTs.cc:60
CaloTPGTranscoderULUTs::hfilename2_
const edm::FileInPath hfilename2_
Definition: CaloTPGTranscoderULUTs.cc:55
CaloTPGTranscoderULUTs::ReturnType
std::unique_ptr< CaloTPGTranscoder > ReturnType
Definition: CaloTPGTranscoderULUTs.cc:48
CaloTPGTranscoderULUTs::~CaloTPGTranscoderULUTs
~CaloTPGTranscoderULUTs() override
Definition: CaloTPGTranscoderULUTs.cc:115
CaloTPGTranscoderULUTs::ietah
const std::vector< int > ietah
Definition: CaloTPGTranscoderULUTs.cc:59
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161