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 
38 
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;
65 };
66 
67 //
68 // constants, enums and typedefs
69 //
70 
71 //
72 // static data member definitions
73 //
74 
75 //
76 // constructors and destructor
77 //
79  hfilename1_(iConfig.getParameter<edm::FileInPath>("hcalLUT1")),
80  hfilename2_(iConfig.getParameter<edm::FileInPath>("hcalLUT2"))
81 {
82  //the following line is needed to tell the framework what
83  // data is being produced
84  setWhatProduced(this);
85 
86  //now do what ever other initialization is needed
87  read_Ascii_Compression = false;
88  read_Ascii_RCT = false;
89  read_Ascii_Compression=iConfig.getParameter<bool>("read_Ascii_Compression_LUTs");
90  read_Ascii_RCT=iConfig.getParameter<bool>("read_Ascii_RCT_LUTs");
91 
92  ietal = iConfig.getParameter< std::vector<int> >("ietaLowerBound");
93  ietah = iConfig.getParameter< std::vector<int> >("ietaUpperBound");
94  ZS = iConfig.getParameter< std::vector<int> >("ZS");
95  LUTfactor = iConfig.getParameter< std::vector<int> >("LUTfactor");
96  nominal_gain = iConfig.getParameter<double>("nominal_gain");
97  RCTLSB = iConfig.getParameter<double>("RCTLSB");
98 
99 }
100 
101 
103 {
104 
105  // do anything here that needs to be done at desctruction time
106  // (e.g. close files, deallocate resources etc.)
107 
108 }
109 
110 
111 //
112 // member functions
113 //
114 
115 // ------------ method called to produce the data ------------
118 {
119  using namespace edm::es;
120  std::string file1="";
121  std::string file2="";
123  edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath()
124  << " for CaloTPGTranscoderULUTs HCAL initialization";
125  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
126  //return pTCoder;
128  file2 = hfilename2_.fullPath();
129  } else if (read_Ascii_RCT && !read_Ascii_Compression) {
130  edm::LogInfo("Level1") << "Using analytical compression and " << hfilename2_.fullPath()
131  << " RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
132  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
133  //return pTCoder;
134  file2 = hfilename2_.fullPath();
135  } else if (read_Ascii_Compression && !read_Ascii_RCT) {
136  edm::LogInfo("Level1") << "Using ASCII compression tables " << hfilename1_.fullPath()
137  << " and automatic RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
138  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
139  //return pTCoder;
141  } else {
142  edm::LogInfo("Level1") << "Using analytical compression and RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
143  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
144  //return pTCoder;
145  }
146  //std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));
147 
148  edm::ESHandle<HcalLutMetadata> lutMetadata;
149  iRecord.getRecord<HcalLutMetadataRcd>().get(lutMetadata);
150  edm::ESHandle<HcalTrigTowerGeometry> theTrigTowerGeometry;
151  iRecord.getRecord<CaloGeometryRecord>().get(theTrigTowerGeometry);
152 
154  iRecord.getRecord<HcalLutMetadataRcd>().getRecord<IdealGeometryRecord>().get(htopo);
155 
156  HcalLutMetadata fullLut{ *lutMetadata };
157  fullLut.setTopo(htopo.product());
158 
159  std::auto_ptr<CaloTPGTranscoderULUT> pTCoder(new CaloTPGTranscoderULUT(file1, file2));
160  pTCoder->setup(fullLut, *theTrigTowerGeometry);
161  return std::auto_ptr<CaloTPGTranscoder>( pTCoder );
162 }
163 
164 //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:165
void setTopo(const HcalTopology *topo)