45 virtual boost::shared_ptr< L1CaloHcalScale >
newObject(
46 const std::string& objectKey ) ;
101 boost::shared_ptr< L1CaloHcalScale >
104 using namespace edm::es;
106 std:: cout <<
"object Key " << objectKey <<std::endl <<std::flush;
108 if(objectKey ==
"NULL" || objectKey ==
"")
109 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
110 if(objectKey ==
"IDENTITY"){
116 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale);
119 std::vector<unsigned int> analyticalLUT(1024, 0);
120 std::vector<unsigned int> identityLUT(1024, 0);
123 for (
unsigned int i=0;
i < 1024;
i++) {
124 analyticalLUT[
i] = (
unsigned int)(
sqrt(14.94*
log(1.+
i/14.94)*
i) + 0.5);
129 for (
int i = 0;
i < 4176;
i++){
136 std::vector < std::string > mainStrings;
137 mainStrings.push_back(
"HCAL_LUT_METADATA");
138 mainStrings.push_back(
"HCAL_LUT_CHAN_DATA");
143 std::vector< std::string > metaStrings ;
144 metaStrings.push_back(
"RCTLSB");
145 metaStrings.push_back(
"NOMINAL_GAIN");
151 "V_HCAL_LUT_METADATA_V1",
152 "V_HCAL_LUT_METADATA_V1.TAG_NAME",
157 "HCAL_SCALE_KEY.HCAL_TAG",
163 if( paramResults.queryFailed()
164 || (paramResults.numberRows()!=1) )
166 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ;
167 return boost::shared_ptr< L1CaloHcalScale >() ;
170 double hcalLSB, nominal_gain;
171 paramResults.fillVariable(
"RCTLSB",hcalLSB);
172 paramResults.fillVariable(
"NOMINAL_GAIN",nominal_gain);
174 float rctlsb = hcalLSB;
179 "HCAL_LUT_CHAN_DATA",
182 "HCAL_SCALE_KEY.HCAL_TAG",
189 std::string schemaName(
"CMS_HCL_HCAL_COND");
194 std::vector< std::string > channelStrings;
195 channelStrings.push_back(
"IPHI");
196 channelStrings.push_back(
"IETA");
197 channelStrings.push_back(
"LUT_GRANULARITY");
198 channelStrings.push_back(
"OUTPUT_LUT_THRESHOLD");
199 channelStrings.push_back(
"OBJECTNAME");
203 std::vector< std::string >::const_iterator it = channelStrings.begin() ;
204 std::vector< std::string >::const_iterator
end = channelStrings.end() ;
205 for( ; it !=
end ; ++it )
207 query->addToOutputList( *it ) ;
210 std::string ob =
"OBJECTNAME";
211 coral::AttributeList myresult;
212 myresult.extend(
"IPHI",
typeid(
int));
213 myresult.extend(
"IETA",
typeid(
int));
214 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
215 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
216 myresult.extend( ob,
typeid(std::string));
218 query->defineOutput( myresult );
220 query->addToTableList(
"V_HCAL_LUT_CHAN_DATA_V1");
223 "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.columnNames().front(),
224 chanKey.attributeLists().front());
226 coral::ICursor& cursor =
query->execute();
229 std::vector<coral::AttributeList> atts;
230 while (cursor.next()) {
231 atts.push_back(cursor.currentRow());
240 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.
numberRows() ;
241 return boost::shared_ptr< L1CaloHcalScale >() ;
251 if(objectName ==
"HcalTrigTowerDetId") {
252 int ieta, iphi, lutGranularity,
threshold;
261 unsigned int outputLut[1024];
265 double eta_low = 0., eta_high = 0.;
267 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
275 factor = nominal_gain / cosh_ieta * lutGranularity;
279 for (
unsigned int k = threshold;
k < 1024; ++
k)
284 unsigned int tpg = outputLut[0];
288 for (
unsigned int k = 0;
k < 1024; ++
k){
289 if (outputLut[
k] != tpg){
290 unsigned int mid = (low +
k)/2;
291 hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid);
308 int zside = (int)
pow(-1,
pos);
313 for(
int iphi = 1; iphi<=72; iphi++){
321 if (nphi > 0) etvalue /= nphi;
332 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
virtual boost::shared_ptr< L1CaloHcalScale > newObject(const std::string &objectKey)
const QueryResults singleAttribute(const T &data) const
HcalTrigTowerGeometry theTrigTowerGeometry
L1CaloHcalScaleConfigOnlineProd(const edm::ParameterSet &iConfig)
~L1CaloHcalScaleConfigOnlineProd()
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
coral::ISchema & schema(const std::string &schemaName)
cond::DbSession * dbSession()
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
static const unsigned short nBinRank
const std::vector< coral::AttributeList > & attributeLists() const
HcalTrigTowerDetId * ttDetId
l1t::OMDSReader m_omdsReader
void print(std::ostream &s) const
virtual bool HTvalid(const int ieta, const int iphi) const
std::vector< RCTdecompression > hcaluncomp
std::vector< double > RCTdecompression
void towerEtaBounds(int ieta, double &eta1, double &eta2) const
where this tower begins and ends in eta
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
CaloTPGTranscoderULUT * caloTPG
static const unsigned short nBinEta
virtual int getOutputLUTId(const int ieta, const int iphi) const
L1CaloHcalScale * hcalScale
Power< A, B >::type pow(const A &a, const B &b)
const QueryResults basicQueryView(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &viewName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const