48 std::unique_ptr< L1CaloHcalScale >
newObject(
95 std::unique_ptr< L1CaloHcalScale >
100 edm::LogInfo(
"L1CaloHcalScaleConfigOnlineProd") <<
"object Key " << objectKey;
102 if(objectKey ==
"NULL" || objectKey.empty()) {
103 return std::make_unique<L1CaloHcalScale>(0);
105 if(objectKey ==
"IDENTITY") {
106 return std::make_unique<L1CaloHcalScale>(1);
109 std::vector<unsigned int> analyticalLUT(1024, 0);
110 std::vector<unsigned int> identityLUT(1024, 0);
113 for (
unsigned int i=0;
i < 1024;
i++) {
114 analyticalLUT[
i] = (
unsigned int)(
sqrt(14.94*
log(1.+
i/14.94)*
i) + 0.5);
119 for (
int i = 0;
i < 4176;
i++){
126 std::vector < std::string > mainStrings;
127 mainStrings.push_back(
"HCAL_LUT_METADATA");
128 mainStrings.push_back(
"HCAL_LUT_CHAN_DATA");
133 std::vector< std::string > metaStrings ;
134 metaStrings.push_back(
"RCTLSB");
135 metaStrings.push_back(
"NOMINAL_GAIN");
141 "V_HCAL_LUT_METADATA_V1",
142 "V_HCAL_LUT_METADATA_V1.TAG_NAME",
147 "HCAL_SCALE_KEY.HCAL_TAG",
156 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ;
157 return std::unique_ptr< L1CaloHcalScale >() ;
164 float rctlsb = hcalLSB;
169 "HCAL_LUT_CHAN_DATA",
172 "HCAL_SCALE_KEY.HCAL_TAG",
181 coral::IQuery*
query = schema.newQuery(); ;
184 std::vector< std::string > channelStrings;
185 channelStrings.push_back(
"IPHI");
186 channelStrings.push_back(
"IETA");
187 channelStrings.push_back(
"DEPTH");
188 channelStrings.push_back(
"LUT_GRANULARITY");
189 channelStrings.push_back(
"OUTPUT_LUT_THRESHOLD");
190 channelStrings.push_back(
"OBJECTNAME");
194 std::vector< std::string >::const_iterator it = channelStrings.begin() ;
195 std::vector< std::string >::const_iterator
end = channelStrings.end() ;
196 for( ; it !=
end ; ++it )
198 query->addToOutputList( *it ) ;
202 coral::AttributeList myresult;
203 myresult.extend(
"IPHI",
typeid(
int));
204 myresult.extend(
"IETA",
typeid(
int));
205 myresult.extend(
"DEPTH",
typeid(
int));
206 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
207 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
210 query->defineOutput( myresult );
212 query->addToTableList(
"V_HCAL_LUT_CHAN_DATA_V1");
215 "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.
columnNames().front(),
218 coral::ICursor& cursor = query->execute();
221 std::vector<coral::AttributeList> atts;
222 while (cursor.next()) {
223 atts.push_back(cursor.currentRow());
232 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.
numberRows() ;
233 return std::unique_ptr< L1CaloHcalScale >() ;
243 if(objectName ==
"HcalTrigTowerDetId") {
254 unsigned int outputLut[1024];
256 const int tp_version = depth / 10;
259 double eta_low = 0., eta_high = 0.;
261 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
269 factor = nominal_gain / cosh_ieta * lutGranularity;
273 for (
unsigned int k = threshold;
k < 1024; ++
k)
278 unsigned int tpg = outputLut[0];
282 for (
unsigned int k = 0;
k < 1024; ++
k){
283 if (outputLut[
k] != tpg){
284 unsigned int mid = (low +
k)/2;
285 hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid);
294 auto hcalScale = std::make_unique<L1CaloHcalScale>(0);
297 const int tp_version = 0;
309 for(
int iphi = 1; iphi<=72; iphi++){
317 if (nphi > 0) etvalue /= nphi;
319 hcalScale->setBin(irank, ieta, zside, etvalue);
326 s << std::setprecision(10);
328 edm::LogInfo(
"L1CaloHcalScaleConfigOnlineProd") << s.str();
333 std::unique_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 towerEtaBounds(int ieta, int version, double &eta1, double &eta2) const
where this tower begins and ends in eta
std::unique_ptr< L1CaloHcalScale > newObject(const std::string &objectKey) override
def query(query_str, verbose=False)
std::unique_ptr< L1CaloHcalScale > produce(const L1CaloHcalScaleRcd &iRecord) override
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
l1t::OMDSReader m_omdsReader
std::vector< RCTdecompression > hcaluncomp
std::vector< double > RCTdecompression
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
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="")
coral::ISessionProxy & coralSession()
CaloTPGTranscoderULUT * caloTPG
cond::persistency::Session dbSession()
static const unsigned short nBinEta
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)
int firstHFTower(int version) const