45 virtual boost::shared_ptr< L1CaloHcalScale >
newObject(
86 if( iConfig.
exists(
"hcalTopologyConstants" ))
91 maxDepthHB = hcalTopoConsts.
getParameter<
int>(
"maxDepthHB");
92 maxDepthHE = hcalTopoConsts.
getParameter<
int>(
"maxDepthHE");
108 boost::shared_ptr< L1CaloHcalScale >
111 using namespace edm::es;
113 std:: cout <<
"object Key " << objectKey <<std::endl <<std::flush;
115 if(objectKey ==
"NULL" || objectKey ==
"")
116 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
117 if(objectKey ==
"IDENTITY"){
123 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale);
126 std::vector<unsigned int> analyticalLUT(1024, 0);
127 std::vector<unsigned int> identityLUT(1024, 0);
130 for (
unsigned int i=0;
i < 1024;
i++) {
131 analyticalLUT[
i] = (
unsigned int)(
sqrt(14.94*
log(1.+
i/14.94)*
i) + 0.5);
136 for (
int i = 0;
i < 4176;
i++){
143 std::vector < std::string > mainStrings;
144 mainStrings.push_back(
"HCAL_LUT_METADATA");
145 mainStrings.push_back(
"HCAL_LUT_CHAN_DATA");
150 std::vector< std::string > metaStrings ;
151 metaStrings.push_back(
"RCTLSB");
152 metaStrings.push_back(
"NOMINAL_GAIN");
158 "V_HCAL_LUT_METADATA_V1",
159 "V_HCAL_LUT_METADATA_V1.TAG_NAME",
164 "HCAL_SCALE_KEY.HCAL_TAG",
170 if( paramResults.queryFailed()
171 || (paramResults.numberRows()!=1) )
173 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ;
174 return boost::shared_ptr< L1CaloHcalScale >() ;
177 double hcalLSB, nominal_gain;
178 paramResults.fillVariable(
"RCTLSB",hcalLSB);
179 paramResults.fillVariable(
"NOMINAL_GAIN",nominal_gain);
181 float rctlsb = hcalLSB;
186 "HCAL_LUT_CHAN_DATA",
189 "HCAL_SCALE_KEY.HCAL_TAG",
201 std::vector< std::string > channelStrings;
202 channelStrings.push_back(
"IPHI");
203 channelStrings.push_back(
"IETA");
204 channelStrings.push_back(
"LUT_GRANULARITY");
205 channelStrings.push_back(
"OUTPUT_LUT_THRESHOLD");
206 channelStrings.push_back(
"OBJECTNAME");
210 std::vector< std::string >::const_iterator it = channelStrings.begin() ;
211 std::vector< std::string >::const_iterator
end = channelStrings.end() ;
212 for( ; it !=
end ; ++it )
214 query->addToOutputList( *it ) ;
218 coral::AttributeList myresult;
219 myresult.extend(
"IPHI",
typeid(
int));
220 myresult.extend(
"IETA",
typeid(
int));
221 myresult.extend(
"LUT_GRANULARITY",
typeid(
int));
222 myresult.extend(
"OUTPUT_LUT_THRESHOLD",
typeid(
int));
225 query->defineOutput( myresult );
227 query->addToTableList(
"V_HCAL_LUT_CHAN_DATA_V1");
230 "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.columnNames().front(),
231 chanKey.attributeLists().front());
233 coral::ICursor& cursor =
query->execute();
236 std::vector<coral::AttributeList> atts;
237 while (cursor.next()) {
238 atts.push_back(cursor.currentRow());
247 edm::LogError(
"L1-O2O" ) <<
"Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.
numberRows() ;
248 return boost::shared_ptr< L1CaloHcalScale >() ;
258 if(objectName ==
"HcalTrigTowerDetId") {
259 int ieta, iphi, lutGranularity,
threshold;
268 unsigned int outputLut[1024];
272 double eta_low = 0., eta_high = 0.;
274 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
282 factor = nominal_gain / cosh_ieta * lutGranularity;
286 for (
unsigned int k = threshold;
k < 1024; ++
k)
291 unsigned int tpg = outputLut[0];
295 for (
unsigned int k = 0;
k < 1024; ++
k){
296 if (outputLut[
k] != tpg){
297 unsigned int mid = (low +
k)/2;
298 hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid);
315 int zside = (int)
pow(-1,
pos);
320 for(
int iphi = 1; iphi<=72; iphi++){
328 if (nphi > 0) etvalue /= nphi;
339 return boost::shared_ptr< L1CaloHcalScale >(
hcalScale );
T getParameter(std::string const &) const
virtual boost::shared_ptr< L1CaloHcalScale > newObject(const std::string &objectKey)
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
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