test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RCTObjectKeysOnlineProd.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TriggerConfig
4 // Class: RCTObjectKeysOnlineProd
5 //
13 //
14 // Original Author: Werner Man-Li Sun
15 // Created: Fri Aug 22 19:51:36 CEST 2008
16 //
17 //
18 
19 
20 // system include files
21 #include <iostream>
22 
23 // user include files
25 
27 
28 //
29 // class declaration
30 //
31 
33  public:
36 
37  virtual void fillObjectKeys( ReturnType pL1TriggerKey ) override ;
38  private:
39  // ----------member data ---------------------------
40 };
41 
42 //
43 // constants, enums and typedefs
44 //
45 
46 //
47 // static data member definitions
48 //
49 
50 //
51 // constructors and destructor
52 //
54  : L1ObjectKeysOnlineProdBase( iConfig )
55 {}
56 
57 
59 {
60 
61  // do anything here that needs to be done at desctruction time
62  // (e.g. close files, deallocate resources etc.)
63 
64 }
65 
66 
67 //
68 // member functions
69 //
70 
71 // ------------ method called to produce the data ------------
72 void
74 {
75  std::string rctKey = pL1TriggerKey->subsystemKey( L1TriggerKey::kRCT ) ;
76 
77  if( !rctKey.empty() )
78  {
79  std::string paremKey, scaleKey, ecalScaleKey , hcalScaleKey;
80  // SELECT RCT_PARAMETER FROM RCT_CONF WHERE RCT_CONF.RCT_KEY = rctKey
81  l1t::OMDSReader::QueryResults paremKeyResults =
82  m_omdsReader.basicQuery( "RCT_PARAMETER",
83  "CMS_RCT",
84  "RCT_CONF",
85  "RCT_CONF.RCT_KEY",
86  m_omdsReader.singleAttribute( rctKey ) );
87 
88 
89  if( paremKeyResults.queryFailed() ||
90  paremKeyResults.numberRows() != 1 ) // check query successful
91  {
92  edm::LogError( "L1-O2O" ) << "Problem with RCT Parameter key." ;
93  return ;
94  }
95 
96 
97  l1t::OMDSReader::QueryResults scaleKeyResults =
98  m_omdsReader.basicQuery( "L1T_SCALE_CALO_ET_THRESHOLD_ID",
99  "CMS_RCT",
100  "PAREM_CONF",
101  "PAREM_CONF.PAREM_KEY",
102  paremKeyResults ); // not null no need to check
103 
104  l1t::OMDSReader::QueryResults ecalKeyResults =
105  m_omdsReader.basicQuery("ECAL_CONF",
106  "CMS_RCT",
107  "RCT_CONF",
108  "RCT_CONF.RCT_KEY",
109  m_omdsReader.singleAttribute(rctKey));
110 
111  if( ecalKeyResults.queryFailed() ||
112  ecalKeyResults.numberRows() > 1 ) // check query successful)
113  {
114  edm::LogError( "L1-O2O" ) << "Problem with rct_conf.ecal_conf." ;
115  return ;
116  }
117  std::string ecalKey;
118  if(!ecalKeyResults.fillVariable(ecalKey))
119  ecalScaleKey = "NULL";
120  else { // fill variable not null
121 
122  if( ecalKey == "NULL")
123  ecalScaleKey = "NULL";
124  else if(ecalKey == "IDENTITY")
125  ecalScaleKey = "IDENTITY";
126  else { // not identity or null
127 
128 
129  l1t::OMDSReader::QueryResults ecalScaleKeyResults =
130  m_omdsReader.basicQuery( "ECAL_LUT_CONFIG_ID",
131  "CMS_RCT",
132  "ECAL_SCALE_KEY",
133  "ECAL_SCALE_KEY.ECAL_TAG",
134  ecalKeyResults);
135 
136  if( ecalScaleKeyResults.queryFailed() ||
137  ecalScaleKeyResults.numberRows() > 1 ) // check query successful)
138  {
139  std::cout << " nrows " << ecalScaleKeyResults.numberRows() <<std::endl;
140  edm::LogError( "L1-O2O" ) << "bad results from lut_config_id." ;
141  return ;
142  }
143  int ecalScaleTemp = -1;
144 
145  ecalScaleKeyResults.fillVariable( ecalScaleTemp );
146 
147 
148 
149 
150  std::stringstream ss;
151  ss << ecalScaleTemp;
152  ecalScaleKey = ss.str();
153  }
154  }
155 
156  l1t::OMDSReader::QueryResults hcalKeyResults =
157  m_omdsReader.basicQuery("HCAL_CONF",
158  "CMS_RCT",
159  "RCT_CONF",
160  "RCT_CONF.RCT_KEY",
161  m_omdsReader.singleAttribute(rctKey));
162 
163  if( hcalKeyResults.queryFailed() ||
164  hcalKeyResults.numberRows() > 1 ) // check query successful)
165  {
166  edm::LogError( "L1-O2O" ) << "Problem with rct_conf.hcal_conf." ;
167  return ;
168  }
169  std::string hcalKey;
170  if(!hcalKeyResults.fillVariable(hcalScaleKey))
171  hcalScaleKey = "NULL";
172 
173 
174 
175  paremKeyResults.fillVariable( paremKey ) ;
176  scaleKeyResults.fillVariable( scaleKey ) ;
177 
178 
179  pL1TriggerKey->add( "L1RCTParametersRcd",
180  "L1RCTParameters",
181  paremKey ) ;
182  pL1TriggerKey->add( "L1EmEtScaleRcd",
183  "L1CaloEtScale",
184  scaleKey ) ;
185  pL1TriggerKey->add( "L1CaloEcalScaleRcd",
186  "L1CaloEcalScale",
187  ecalScaleKey ) ;
188  pL1TriggerKey->add( "L1CaloHcalScaleRcd",
189  "L1CaloHcalScale",
190  hcalScaleKey ) ;
191  }
192 }
193 
194 
195 //define this as a plug-in
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
virtual void fillObjectKeys(ReturnType pL1TriggerKey) override
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="")
Definition: OMDSReader.cc:86
RCTObjectKeysOnlineProd(const edm::ParameterSet &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
return(e1-e2)*(e1-e2)+dp *dp
std::shared_ptr< L1TriggerKey > ReturnType
tuple cout
Definition: gather_cfg.py:145