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 >() ;
171 paramResults.fillVariable(
"RCTLSB",hcalLSB);
174 float rctlsb = hcalLSB == 0.25 ? 1./4 : 1./8;
178 "HCAL_LUT_CHAN_DATA",
181 "HCAL_SCALE_KEY.HCAL_TAG",
188 std::string schemaName(
"CMS_HCL_HCAL_COND");
193 std::vector< std::string > channelStrings;
194 channelStrings.push_back(
"IPHI");
195 channelStrings.push_back(
"IETA");
196 channelStrings.push_back(
"LUT_GRANULARITY");
197 channelStrings.push_back(
"OUTPUT_LUT_THRESHOLD");
198 channelStrings.push_back(
"OBJECTNAME");
202 std::vector< std::string >::const_iterator it = channelStrings.begin() ;
203 std::vector< std::string >::const_iterator
end = channelStrings.end() ;
204 for( ; it !=
end ; ++it )
206 query->addToOutputList( *it ) ;
209 std::string ob =
"OBJECTNAME";
210 coral::AttributeList myresult;
211 myresult.extend(
"IPHI",
typeid(
int));
212 myresult.extend(
"IETA",
typeid(
int));
213 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
214 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
215 myresult.extend( ob,
typeid(std::string));
217 query->defineOutput( myresult );
219 query->addToTableList(
"V_HCAL_LUT_CHAN_DATA_V1");
222 "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.columnNames().front(),
223 chanKey.attributeLists().front());
225 coral::ICursor& cursor =
query->execute();
228 std::vector<coral::AttributeList> atts;
229 while (cursor.next()) {
230 atts.push_back(cursor.currentRow());
239 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.
numberRows() ;
240 return boost::shared_ptr< L1CaloHcalScale >() ;
250 if(objectName ==
"HcalTrigTowerDetId") {
251 int ieta, iphi, lutGranularity,
threshold;
260 unsigned int outputLut[1024];
264 double eta_low = 0., eta_high = 0.;
266 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
278 for (
unsigned int k = threshold;
k < 1024; ++
k)
283 unsigned int tpg = outputLut[0];
287 for (
unsigned int k = 0;
k < 1024; ++
k){
288 if (outputLut[
k] != tpg){
289 unsigned int mid = (low +
k)/2;
290 hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid);
307 int zside = (int)
pow(-1,
pos);
312 for(
int iphi = 1; iphi<=72; iphi++){
320 if (nphi > 0) etvalue /= nphi;
331 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
Log< T >::type log(const T &t)
#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