CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
48 
49  typedef std::auto_ptr<CaloTPGTranscoder> ReturnType;
50 
52 
53 private:
54  // ----------member data ---------------------------
59  std::vector<int> ietal;
60  std::vector<int> ietah;
61  std::vector<int> ZS;
62  std::vector<int> LUTfactor;
63  double nominal_gain;
64  double RCTLSB;
67 };
68 
69 //
70 // constants, enums and typedefs
71 //
72 
73 //
74 // static data member definitions
75 //
76 
77 //
78 // constructors and destructor
79 //
81  hfilename1_(iConfig.getParameter<edm::FileInPath>("hcalLUT1")),
82  hfilename2_(iConfig.getParameter<edm::FileInPath>("hcalLUT2"))
83 {
84  //the following line is needed to tell the framework what
85  // data is being produced
86  setWhatProduced(this);
87 
88  //now do what ever other initialization is needed
89  read_Ascii_Compression = false;
90  read_Ascii_RCT = false;
91  read_Ascii_Compression=iConfig.getParameter<bool>("read_Ascii_Compression_LUTs");
92  read_Ascii_RCT=iConfig.getParameter<bool>("read_Ascii_RCT_LUTs");
93 
94  ietal = iConfig.getParameter< std::vector<int> >("ietaLowerBound");
95  ietah = iConfig.getParameter< std::vector<int> >("ietaUpperBound");
96  ZS = iConfig.getParameter< std::vector<int> >("ZS");
97  LUTfactor = iConfig.getParameter< std::vector<int> >("LUTfactor");
98  nominal_gain = iConfig.getParameter<double>("nominal_gain");
99  RCTLSB = iConfig.getParameter<double>("RCTLSB");
100 
101  edm::ParameterSet hfSS=iConfig.getParameter<edm::ParameterSet>("HFTPScaleShift");
102  NCTScaleShift = hfSS.getParameter<int>("NCT");
103  RCTScaleShift = hfSS.getParameter<int>("RCT");
104 }
105 
106 
108 {
109 
110  // do anything here that needs to be done at desctruction time
111  // (e.g. close files, deallocate resources etc.)
112 
113 }
114 
115 
116 //
117 // member functions
118 //
119 
120 // ------------ method called to produce the data ------------
123 {
124  using namespace edm::es;
125  std::string file1="";
126  std::string file2="";
128  edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath()
129  << " for CaloTPGTranscoderULUTs HCAL initialization";
130  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
131  //return pTCoder;
133  file2 = hfilename2_.fullPath();
134  } else if (read_Ascii_RCT && !read_Ascii_Compression) {
135  edm::LogInfo("Level1") << "Using analytical compression and " << hfilename2_.fullPath()
136  << " RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
137  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
138  //return pTCoder;
139  file2 = hfilename2_.fullPath();
140  } else if (read_Ascii_Compression && !read_Ascii_RCT) {
141  edm::LogInfo("Level1") << "Using ASCII compression tables " << hfilename1_.fullPath()
142  << " and automatic RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
143  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
144  //return pTCoder;
146  } else {
147  edm::LogInfo("Level1") << "Using analytical compression and RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
148  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
149  //return pTCoder;
150  }
151  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));
152 
153  edm::ESHandle<HcalLutMetadata> lutMetadata;
154  iRecord.getRecord<HcalLutMetadataRcd>().get(lutMetadata);
155  edm::ESHandle<HcalTrigTowerGeometry> theTrigTowerGeometry;
156  iRecord.getRecord<CaloGeometryRecord>().get(theTrigTowerGeometry);
157 
159  iRecord.getRecord<HcalLutMetadataRcd>().getRecord<HcalRecNumberingRecord>().get(htopo);
160 
161  HcalLutMetadata fullLut{ *lutMetadata };
162  fullLut.setTopo(htopo.product());
163 
164  std::auto_ptr<CaloTPGTranscoderULUT> pTCoder(new CaloTPGTranscoderULUT(file1, file2));
165  pTCoder->setup(fullLut, *theTrigTowerGeometry, NCTScaleShift, RCTScaleShift);
166  return std::auto_ptr<CaloTPGTranscoder>( pTCoder );
167 }
168 
169 //define this as a plug-in
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CaloTPGTranscoderULUTs(const edm::ParameterSet &)
void get(HolderT &iHolder) const
ReturnType produce(const CaloTPGRecord &)
std::auto_ptr< CaloTPGTranscoder > ReturnType
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::string fullPath() const
Definition: FileInPath.cc:184
void setTopo(const HcalTopology *topo)