44 virtual boost::shared_ptr< L1CaloHcalScale >
newObject(
85 if( iConfig.
exists(
"hcalTopologyConstants" ))
90 maxDepthHB = hcalTopoConsts.
getParameter<
int>(
"maxDepthHB");
91 maxDepthHE = hcalTopoConsts.
getParameter<
int>(
"maxDepthHE");
107 boost::shared_ptr< L1CaloHcalScale >
110 using namespace edm::es;
112 std:: cout <<
"object Key " << objectKey <<std::endl <<std::flush;
114 if(objectKey ==
"NULL" || objectKey ==
"")
115 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
116 if(objectKey ==
"IDENTITY"){
122 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale);
125 std::vector<unsigned int> analyticalLUT(1024, 0);
126 std::vector<unsigned int> identityLUT(1024, 0);
129 for (
unsigned int i=0;
i < 1024;
i++) {
130 analyticalLUT[
i] = (
unsigned int)(
sqrt(14.94*
log(1.+
i/14.94)*
i) + 0.5);
135 for (
int i = 0;
i < 4176;
i++){
142 std::vector < std::string > mainStrings;
143 mainStrings.push_back(
"HCAL_LUT_METADATA");
144 mainStrings.push_back(
"HCAL_LUT_CHAN_DATA");
149 std::vector< std::string > metaStrings ;
150 metaStrings.push_back(
"RCTLSB");
151 metaStrings.push_back(
"NOMINAL_GAIN");
157 "V_HCAL_LUT_METADATA_V1",
158 "V_HCAL_LUT_METADATA_V1.TAG_NAME",
163 "HCAL_SCALE_KEY.HCAL_TAG",
169 if( paramResults.queryFailed()
170 || (paramResults.numberRows()!=1) )
172 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ;
173 return boost::shared_ptr< L1CaloHcalScale >() ;
176 double hcalLSB, nominal_gain;
177 paramResults.fillVariable(
"RCTLSB",hcalLSB);
178 paramResults.fillVariable(
"NOMINAL_GAIN",nominal_gain);
180 float rctlsb = hcalLSB;
185 "HCAL_LUT_CHAN_DATA",
188 "HCAL_SCALE_KEY.HCAL_TAG",
200 std::vector< std::string > channelStrings;
201 channelStrings.push_back(
"IPHI");
202 channelStrings.push_back(
"IETA");
203 channelStrings.push_back(
"LUT_GRANULARITY");
204 channelStrings.push_back(
"OUTPUT_LUT_THRESHOLD");
205 channelStrings.push_back(
"OBJECTNAME");
209 std::vector< std::string >::const_iterator it = channelStrings.begin() ;
210 std::vector< std::string >::const_iterator
end = channelStrings.end() ;
211 for( ; it !=
end ; ++it )
213 query->addToOutputList( *it ) ;
217 coral::AttributeList myresult;
218 myresult.extend(
"IPHI",
typeid(
int));
219 myresult.extend(
"IETA",
typeid(
int));
220 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
221 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
224 query->defineOutput( myresult );
226 query->addToTableList(
"V_HCAL_LUT_CHAN_DATA_V1");
229 "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.columnNames().front(),
230 chanKey.attributeLists().front());
232 coral::ICursor& cursor =
query->execute();
235 std::vector<coral::AttributeList> atts;
236 while (cursor.next()) {
237 atts.push_back(cursor.currentRow());
246 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.
numberRows() ;
247 return boost::shared_ptr< L1CaloHcalScale >() ;
257 if(objectName ==
"HcalTrigTowerDetId") {
258 int ieta, iphi, lutGranularity,
threshold;
267 unsigned int outputLut[1024];
271 double eta_low = 0., eta_high = 0.;
273 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
281 factor = nominal_gain / cosh_ieta * lutGranularity;
285 for (
unsigned int k = threshold;
k < 1024; ++
k)
290 unsigned int tpg = outputLut[0];
294 for (
unsigned int k = 0;
k < 1024; ++
k){
295 if (outputLut[
k] != tpg){
296 unsigned int mid = (low +
k)/2;
297 hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid);
309 for(
int pos = 0; pos <=1; pos++){
319 for(
int iphi = 1; iphi<=72; iphi++){
327 if (nphi > 0) etvalue /= nphi;
338 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
T getParameter(std::string const &) const
virtual boost::shared_ptr< L1CaloHcalScale > newObject(const std::string &objectKey) override
static std::vector< std::string > checklist log
const QueryResults singleAttribute(const T &data) const
L1CaloHcalScaleConfigOnlineProd(const edm::ParameterSet &iConfig)
~L1CaloHcalScaleConfigOnlineProd()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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
HcalTrigTowerGeometry * theTrigTowerGeometry
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
Abs< T >::type abs(const T &t)
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