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 
20 // system include files
21 #include <memory>
22 
23 // user include files
24 
28 
33 
39 
40 //
41 // class decleration
42 //
43 
45  public:
47  ~CaloTPGTranscoderULUTs() override;
48 
49  typedef std::unique_ptr<CaloTPGTranscoder> ReturnType;
50 
51  ReturnType produce(const CaloTPGRecord&);
52 
53  private:
54  // ----------member data ---------------------------
58  const bool read_Ascii_RCT;
59  const std::vector<int> ietal;
60  const std::vector<int> ietah;
61  const std::vector<int> ZS;
62  const std::vector<int> LUTfactor;
63  const bool linearLUTs_;
64  const double nominal_gain;
65  const double RCTLSB;
66  const int NCTScaleShift;
67  const int RCTScaleShift;
68  const double lsbQIE8;
69  const double lsbQIE11;
70 };
71 
72 //
73 // constants, enums and typedefs
74 //
75 
76 //
77 // static data member definitions
78 //
79 
80 //
81 // constructors and destructor
82 //
84  hfilename1_(iConfig.getParameter<edm::FileInPath>("hcalLUT1")),
85  hfilename2_(iConfig.getParameter<edm::FileInPath>("hcalLUT2")),
86  read_Ascii_Compression(iConfig.getParameter<bool>("read_Ascii_Compression_LUTs")),
87  read_Ascii_RCT(iConfig.getParameter<bool>("read_Ascii_RCT_LUTs")),
88  ietal(iConfig.getParameter<std::vector<int>>("ietaLowerBound")),
89  ietah(iConfig.getParameter<std::vector<int>>("ietaUpperBound")),
90  ZS(iConfig.getParameter<std::vector<int>>("ZS")),
91  LUTfactor(iConfig.getParameter<std::vector<int>>("LUTfactor")),
92  linearLUTs_(iConfig.getParameter<bool>("linearLUTs")),
93  nominal_gain(iConfig.getParameter<double>("nominal_gain")),
94  RCTLSB(iConfig.getParameter<double>("RCTLSB")),
95  NCTScaleShift(iConfig.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HF").getParameter<int>("NCTShift")),
96  RCTScaleShift(iConfig.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HF").getParameter<int>("RCTShift")),
97  lsbQIE8(iConfig.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HBHE").getParameter<double>("LSBQIE8")),
98  lsbQIE11(iConfig.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HBHE").getParameter<double>("LSBQIE11"))
99 {
100  setWhatProduced(this);
101 }
102 
103 
105 {
106 
107  // do anything here that needs to be done at desctruction time
108  // (e.g. close files, deallocate resources etc.)
109 
110 }
111 
112 
113 //
114 // member functions
115 //
116 
117 // ------------ method called to produce the data ------------
120 {
121  using namespace edm::es;
122  std::string file1="";
123  std::string file2="";
125  edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath()
126  << " for CaloTPGTranscoderULUTs HCAL initialization";
127  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
128  //return pTCoder;
129  file1 = hfilename1_.fullPath();
130  file2 = hfilename2_.fullPath();
131  } else if (read_Ascii_RCT && !read_Ascii_Compression) {
132  edm::LogInfo("Level1") << "Using analytical compression and " << hfilename2_.fullPath()
133  << " RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
134  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
135  //return pTCoder;
136  file2 = hfilename2_.fullPath();
137  } else if (read_Ascii_Compression && !read_Ascii_RCT) {
138  edm::LogInfo("Level1") << "Using ASCII compression tables " << hfilename1_.fullPath()
139  << " and automatic RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
140  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
141  //return pTCoder;
142  file1 = hfilename1_.fullPath();
143  } else {
144  edm::LogInfo("Level1") << "Using analytical compression and RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
145  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
146  //return pTCoder;
147  }
148  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));
149 
150  edm::ESHandle<HcalLutMetadata> lutMetadata;
151  iRecord.getRecord<HcalLutMetadataRcd>().get(lutMetadata);
152  edm::ESHandle<HcalTrigTowerGeometry> theTrigTowerGeometry;
153  iRecord.getRecord<CaloGeometryRecord>().get(theTrigTowerGeometry);
154 
156  iRecord.getRecord<HcalLutMetadataRcd>().getRecord<HcalRecNumberingRecord>().get(htopo);
157 
158  HcalLutMetadata fullLut{ *lutMetadata };
159  fullLut.setTopo(htopo.product());
160 
161  std::auto_ptr<CaloTPGTranscoderULUT> pTCoder(new CaloTPGTranscoderULUT(file1, file2));
162  pTCoder->setup(fullLut, *theTrigTowerGeometry, NCTScaleShift, RCTScaleShift, lsbQIE8, lsbQIE11, linearLUTs_);
163  return std::auto_ptr<CaloTPGTranscoder>( pTCoder );
164 }
165 
166 //define this as a plug-in
std::unique_ptr< CaloTPGTranscoder > ReturnType
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CaloTPGTranscoderULUTs(const edm::ParameterSet &)
const std::vector< int > LUTfactor
const std::vector< int > ietal
void get(HolderT &iHolder) const
ReturnType produce(const CaloTPGRecord &)
const edm::FileInPath hfilename1_
const std::vector< int > ZS
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
HLT enums.
const std::vector< int > ietah
std::string fullPath() const
Definition: FileInPath.cc:197
T const * product() const
Definition: ESHandle.h:86
const edm::FileInPath hfilename2_