48 std::shared_ptr< L1CaloHcalScale >
newObject(
97 std::shared_ptr< L1CaloHcalScale >
104 edm::LogInfo(
"L1CaloHcalScaleConfigOnlineProd") <<
"object Key " << objectKey;
106 if(objectKey ==
"NULL" || objectKey ==
"")
107 return std::shared_ptr< L1CaloHcalScale >(
hcalScale );
108 if(objectKey ==
"IDENTITY"){
114 return std::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",
164 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ;
165 return std::shared_ptr< L1CaloHcalScale >() ;
172 float rctlsb = hcalLSB;
177 "HCAL_LUT_CHAN_DATA",
180 "HCAL_SCALE_KEY.HCAL_TAG",
189 coral::IQuery*
query = schema.newQuery(); ;
192 std::vector< std::string > channelStrings;
193 channelStrings.push_back(
"IPHI");
194 channelStrings.push_back(
"IETA");
195 channelStrings.push_back(
"DEPTH");
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 ) ;
210 coral::AttributeList myresult;
211 myresult.extend(
"IPHI",
typeid(
int));
212 myresult.extend(
"IETA",
typeid(
int));
213 myresult.extend(
"DEPTH",
typeid(
int));
214 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
215 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
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(),
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 std::shared_ptr< L1CaloHcalScale >() ;
251 if(objectName ==
"HcalTrigTowerDetId") {
262 unsigned int outputLut[1024];
264 const int tp_version = depth / 10;
267 double eta_low = 0., eta_high = 0.;
269 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
277 factor = nominal_gain / cosh_ieta * lutGranularity;
281 for (
unsigned int k = threshold;
k < 1024; ++
k)
286 unsigned int tpg = outputLut[0];
290 for (
unsigned int k = 0;
k < 1024; ++
k){
291 if (outputLut[
k] != tpg){
292 unsigned int mid = (low +
k)/2;
293 hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid);
305 const int tp_version = 0;
317 for(
int iphi = 1; iphi<=72; iphi++){
325 if (nphi > 0) etvalue /= nphi;
334 s << std::setprecision(10);
336 edm::LogInfo(
"L1CaloHcalScaleConfigOnlineProd") << s.str();
338 return std::shared_ptr< L1CaloHcalScale >(
hcalScale );
342 std::shared_ptr< L1CaloHcalScale >
bool fillVariable(const std::string &columnName, T &outputVariable) const
const QueryResults singleAttribute(const T &data) const
virtual bool HTvalid(const int ieta, const int iphi, const int version) const
~L1CaloHcalScaleConfigOnlineProd() override
L1CaloHcalScaleConfigOnlineProd(const edm::ParameterSet &iConfig)
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
def query(query_str, verbose=False)
const HcalTrigTowerGeometry * theTrigTowerGeometry
const DepRecordT getRecord() const
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
const std::vector< std::string > & columnNames() const
std::shared_ptr< L1CaloHcalScale > produce(const L1CaloHcalScaleRcd &iRecord) override
l1t::OMDSReader m_omdsReader
void print(std::ostream &s) const
std::vector< RCTdecompression > hcaluncomp
std::vector< double > RCTdecompression
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()
std::shared_ptr< L1CaloHcalScale > newObject(const std::string &objectKey) override
static const unsigned short nBinEta
L1CaloHcalScale * hcalScale
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)
int firstHFTower(int version) const