48 virtual boost::shared_ptr< L1CaloHcalScale >
newObject(
97 boost::shared_ptr< L1CaloHcalScale >
102 using namespace edm::es;
104 edm::LogInfo(
"L1CaloHcalScaleConfigOnlineProd") <<
"object Key " << objectKey;
106 if(objectKey ==
"NULL" || objectKey ==
"")
107 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
108 if(objectKey ==
"IDENTITY"){
114 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale);
117 std::vector<unsigned int> analyticalLUT(1024, 0);
118 std::vector<unsigned int> identityLUT(1024, 0);
121 for (
unsigned int i=0;
i < 1024;
i++) {
122 analyticalLUT[
i] = (
unsigned int)(
sqrt(14.94*
log(1.+
i/14.94)*
i) + 0.5);
127 for (
int i = 0;
i < 4176;
i++){
134 std::vector < std::string > mainStrings;
135 mainStrings.push_back(
"HCAL_LUT_METADATA");
136 mainStrings.push_back(
"HCAL_LUT_CHAN_DATA");
141 std::vector< std::string > metaStrings ;
142 metaStrings.push_back(
"RCTLSB");
143 metaStrings.push_back(
"NOMINAL_GAIN");
149 "V_HCAL_LUT_METADATA_V1",
150 "V_HCAL_LUT_METADATA_V1.TAG_NAME",
155 "HCAL_SCALE_KEY.HCAL_TAG",
161 if( paramResults.queryFailed()
162 || (paramResults.numberRows()!=1) )
164 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ;
165 return boost::shared_ptr< L1CaloHcalScale >() ;
168 double hcalLSB, nominal_gain;
169 paramResults.fillVariable(
"RCTLSB",hcalLSB);
170 paramResults.fillVariable(
"NOMINAL_GAIN",nominal_gain);
172 float rctlsb = hcalLSB;
177 "HCAL_LUT_CHAN_DATA",
180 "HCAL_SCALE_KEY.HCAL_TAG",
192 std::vector< std::string > channelStrings;
193 channelStrings.push_back(
"IPHI");
194 channelStrings.push_back(
"IETA");
195 channelStrings.push_back(
"LUT_GRANULARITY");
196 channelStrings.push_back(
"OUTPUT_LUT_THRESHOLD");
197 channelStrings.push_back(
"OBJECTNAME");
201 std::vector< std::string >::const_iterator it = channelStrings.begin() ;
202 std::vector< std::string >::const_iterator
end = channelStrings.end() ;
203 for( ; it !=
end ; ++it )
205 query->addToOutputList( *it ) ;
209 coral::AttributeList myresult;
210 myresult.extend(
"IPHI",
typeid(
int));
211 myresult.extend(
"IETA",
typeid(
int));
212 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
213 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
216 query->defineOutput( myresult );
218 query->addToTableList(
"V_HCAL_LUT_CHAN_DATA_V1");
221 "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.columnNames().front(),
222 chanKey.attributeLists().front());
224 coral::ICursor& cursor =
query->execute();
227 std::vector<coral::AttributeList> atts;
228 while (cursor.next()) {
229 atts.push_back(cursor.currentRow());
238 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.
numberRows() ;
239 return boost::shared_ptr< L1CaloHcalScale >() ;
249 if(objectName ==
"HcalTrigTowerDetId") {
250 int ieta, iphi, lutGranularity,
threshold;
259 unsigned int outputLut[1024];
263 double eta_low = 0., eta_high = 0.;
264 const int version_of_hcal_TPs = 0;
266 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
274 factor = nominal_gain / cosh_ieta * lutGranularity;
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);
302 for(
int pos = 0; pos <=1; pos++){
312 for(
int iphi = 1; iphi<=72; iphi++){
320 if (nphi > 0) etvalue /= nphi;
329 s << std::setprecision(10);
333 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
337 boost::shared_ptr< L1CaloHcalScale >
virtual boost::shared_ptr< L1CaloHcalScale > newObject(const std::string &objectKey) override
const QueryResults singleAttribute(const T &data) const
L1CaloHcalScaleConfigOnlineProd(const edm::ParameterSet &iConfig)
boost::shared_ptr< L1CaloHcalScale > produce(const L1CaloHcalScaleRcd &iRecord) override
~L1CaloHcalScaleConfigOnlineProd()
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
void towerEtaBounds(int ieta, int version, double &eta1, double &eta2) const
where this tower begins and ends in eta
const DepRecordT & getRecord() const
const HcalTrigTowerGeometry * theTrigTowerGeometry
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
static const unsigned short nBinRank
const std::vector< coral::AttributeList > & attributeLists() 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="")
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
T const * product() const
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="")
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
coral::ISessionProxy & coralSession()
CaloTPGTranscoderULUT * caloTPG
cond::persistency::Session dbSession()
static const unsigned short nBinEta
L1CaloHcalScale * hcalScale
Power< A, B >::type pow(const A &a, const B &b)
int firstHFTower(int version) const