CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
PixelPopConCalibSourceHandler Class Reference

#include <PixelPopConCalibSourceHandler.h>

Inheritance diagram for PixelPopConCalibSourceHandler:
PixelPopConSourceHandler< SiPixelCalibConfiguration > popcon::PopConSourceHandler< SiPixelCalibConfiguration >

Public Member Functions

void getNewObjects_coral ()
 
void getNewObjects_file ()
 
virtual std::string id () const
 
 PixelPopConCalibSourceHandler (edm::ParameterSet const &)
 
 ~PixelPopConCalibSourceHandler ()
 
- Public Member Functions inherited from PixelPopConSourceHandler< SiPixelCalibConfiguration >
virtual void getNewObjects ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (cond::DbSession dbSession, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (cond::DbSession session, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< SiPixelCalibConfiguration
*, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler
< SiPixelCalibConfiguration
self
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef SiPixelCalibConfiguration value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
int add (value_type *payload, Summary *summary, Time_t time)
 
- Protected Attributes inherited from PixelPopConSourceHandler< SiPixelCalibConfiguration >
std::string _configKeyName
 
std::string _connectString
 
int _runNumber
 
std::string _schemaName
 
unsigned int _sinceIOV
 
std::string _viewName
 
- Protected Attributes inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 29 of file PixelPopConCalibSourceHandler.h.

Constructor & Destructor Documentation

PixelPopConCalibSourceHandler::~PixelPopConCalibSourceHandler ( )

Definition at line 70 of file PixelPopConCalibSourceHandler.cc.

70  {
71 
72 } // destructor
PixelPopConCalibSourceHandler::PixelPopConCalibSourceHandler ( edm::ParameterSet const &  pset)

Definition at line 50 of file PixelPopConCalibSourceHandler.cc.

References edm::ParameterSet::getParameter().

50  {
51 
52  // try to get a parameter
53  _connectString = pset.getParameter<string>("connectString");
54  //cout << " connectString: " << _connectString << endl;
55 
56  // get the schema and view name to use from the config file
57  _viewName = pset.getParameter<string>("viewName");
58  _schemaName = pset.getParameter<string>("schemaName");
59 
60  // get the key name and/or run number to use
61  _runNumber = pset.getParameter<int>("runNumber");
62  _configKeyName = pset.getParameter<string>("configKeyName");
63 
64  // get the "since" IOV parameter
65  _sinceIOV = pset.getParameter<unsigned int>("sinceIOV");
66 
67 } // constructor

Member Function Documentation

void PixelPopConCalibSourceHandler::getNewObjects_coral ( )
virtual

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 82 of file PixelPopConCalibSourceHandler.cc.

References gather_cfg::cout.

82  {
83  cout << "I'm sorry, the PixelPopConCalibSourceHandler::getNewObjects_coral() is not currently working." << endl;
84  cout << "I am not able to build calibration configuration objects from the database" << endl;
85  return;
86 
87 // // create the empty SiPixelCalibConfiguration object
88 // SiPixelCalibConfiguration* calibConfig = new SiPixelCalibConfiguration();
89 
90 // // set up the DB session
91 // cond::DBSession* dbsession = new cond::DBSession();
92 // dbsession->configuration().setAuthenticationMethod(cond::XML);
93 // dbsession->configuration().setMessageLevel(cond::Error);
94 // try{
95 // dbsession->open();
96 // }catch(cond::Exception& er){
97 // std::cerr<< "CoralIface::initialize cond " << er.what()<<std::endl;
98 // throw;
99 // }catch(std::exception& er){
100 // std::cerr<< "CoralIface::initialize std " << er.what()<<std::endl;
101 // throw;
102 // }
103 
104 // cond::Connection dbconn(_connectString);
105 // dbconn.connect(dbsession);
106 // cond::CoralTransaction& coraldb=dbconn.coralTransaction();
107 // coraldb.start(true);
108 
109 // // build and execute the query
110 // coral::IQuery* query = coraldb.coralSessionProxy().schema(_schemaName).newQuery();
111 // query->addToTableList(_viewName);
112 // query->addToOutputList("CONFG_KEY");
113 // query->addToOutputList("VERSION");
114 // query->addToOutputList("RUN_TYPE");
115 // query->addToOutputList("RUN_NUMBER");
116 // query->addToOutputList("CALIB_OBJ_DATA_FILE");
117 // query->addToOutputList("CALIB_OBJ_DATA_CLOB");
118 
119 // // if _runNumber is -1, query by config key name
120 // if (_runNumber == -1)
121 // query->setCondition("CONFG_KEY = '" + _configKeyName + "'", coral::AttributeList());
122 // else // query by run number
123 // query->setCondition("RUN_NUMBER = " + _runNumber, coral::AttributeList());
124 // coral::ICursor& cursor = query->execute();
125 
126 // // parse the response, build the Calib object
127 // bool found_fNtriggers = false;
128 // bool found_fRowPattern = false;
129 // bool found_fColumnPattern = false;
130 // bool found_fVCalValues = false;
131 // bool found_fMode = false;
132 // while ( cursor.next() ) {
133 // cout << "Inside cursor.next() loop" << endl;
134 // //cursor.currentRow().toOutputStream( std::cout ) << std::endl;
135 // coral::AttributeList row = cursor.currentRow();
136 
137 // string mystring = row["CALIB_OBJ_DATA_CLOB"].data<string>();
138 // cout << "mystring: " << mystring << endl;
139 
140 // // get fMode
141 // if (!found_fMode) {
142 // calibConfig->setCalibrationMode(row["CALIB_MODE"].data<string>());
143 // found_fMode = true;
144 // } // if (!found_fMode)
145 
146 // // fill fNTriggers
147 // if (row["PARAMETER"].data<string>() == "Number of Triggers") {
148 // if (found_fNtriggers) {
149 // cout << "Warning: found mulitple entries for fNtriggers!" << endl;
150 // }
151 // int fNtriggers = atoi(row["VALUE"].data<string>().c_str());
152 // //cout << "Number of triggers: " << fNtriggers << endl;
153 // calibConfig->setNTriggers(static_cast<short>(fNtriggers));
154 // found_fNtriggers = true;
155 // } // fill fNTriggers
156 
157 // /*
158 // // fill fROCIds
159 // if (row["PARAMETER"].data<string>() == "ROC") {
160 // if (found_fROCIds) {
161 // cout << "Warning: found mulitple entries for fROCIds!" << endl;
162 // }
163 // string rocidlist = row["VALUE"].data<string>();
164 // // split the string
165 // string buff;
166 // vector<string> ROCIds;
167 // stringstream ss(rocidlist);
168 // while (ss >> buff) {
169 // ROCIds.push_back(buff);
170 // }
171 // calibConfig->setROCIds(ROCIds);
172 // found_fROCIds = true;
173 // } // fill fROCIds
174 // */
175 
176 // // fill fRowPattern
177 // if (row["PARAMETER"].data<string>() == "RowNums") {
178 // if (found_fRowPattern) {
179 // cout << "Warning: found mulitple entries for fRowPattern!" << endl;
180 // }
181 // string rowlist = row["VALUE"].data<string>();
182 // // split the string
183 // string buff;
184 // vector<short> rows;
185 // stringstream ss(rowlist);
186 // while (ss >> buff) {
187 // rows.push_back(static_cast<short>(atoi(buff.c_str())));
188 // }
189 // calibConfig->setRowPattern(rows);
190 // found_fRowPattern = true;
191 // } // fill fRowPattern
192 
193 // // fill fColumnPattern
194 // if (row["PARAMETER"].data<string>() == "ColNums") {
195 // if (found_fColumnPattern) {
196 // cout << "Warning: found mulitple entries for fColumnPattern!" << endl;
197 // }
198 // string collist = row["VALUE"].data<string>();
199 // // split the string
200 // string buff;
201 // vector<short> cols;
202 // stringstream ss(collist);
203 // while (ss >> buff) {
204 // cols.push_back(static_cast<short>(atoi(buff.c_str())));
205 // }
206 // calibConfig->setColumnPattern(cols);
207 // found_fColumnPattern = true;
208 // } // fill fColumnPattern
209 
210 // // fill fVCalValues
211 // if (row["CALIB_OBJECT"].data<string>() == "Vcal DAC") {
212 // if (found_fVCalValues) {
213 // cout << "Warning: found mulitple entries for fVCalValues!" << endl;
214 // }
215 // string vcallist = row["VALUE"].data<string>();
216 // // split the string
217 // string buff;
218 // vector<short> vcals;
219 // stringstream ss(vcallist);
220 // while (ss >> buff) {
221 // vcals.push_back(static_cast<short>(atoi(buff.c_str())));
222 // }
223 // calibConfig->setVCalValues(vcals);
224 // found_fVCalValues = true;
225 // } // fill fRowPattern
226 
227 // /*
228 // for (coral::AttributeList::iterator it = row.begin();
229 // it != row.end(); ++it) {
230 // if it->specification().name() == "PARAMETER"
231 
232 // if (it->specification().name() == "RUN_NUMBER")
233 // cout << it->specification().name() << ", " << it->data<long long>() << endl;
234 // else
235 // cout << it->specification().name() << ", " << it->data<string>() << endl;
236 
237 // } // loop over attribute list
238 // */
239 // } // while (cursor.next())
240 
241 // // spit out calibConfig object
242 // cout << endl << "** calibConfig: " << endl;
243 // cout << " fNtriggers: " << calibConfig->getNTriggers() << endl;
244 // /*
245 // cout << " fROCIds: ";
246 // vector<string> rocids = calibConfig->getROCIds();
247 // for (vector<string>::const_iterator it = rocids.begin();
248 // it != rocids.end(); ++it)
249 // cout << *it << ", ";
250 // cout << endl;
251 // */
252 // cout << " fRowPattern: ";
253 // vector<short> rowpattern = calibConfig->getRowPattern();
254 // for (vector<short>::const_iterator it = rowpattern.begin();
255 // it != rowpattern.end(); ++it)
256 // cout << *it << ", ";
257 // cout << endl;
258 // cout << " fColumnPattern: ";
259 // vector<short> columnpattern = calibConfig->getColumnPattern();
260 // for (vector<short>::const_iterator it = columnpattern.begin();
261 // it != columnpattern.end(); ++it)
262 // cout << *it << ", ";
263 // cout << endl;
264 // cout << " fVcalValues: ";
265 // vector<short> vcalvalues = calibConfig->getVCalValues();
266 // for (vector<short>::const_iterator it = vcalvalues.begin();
267 // it != vcalvalues.end(); ++it)
268 // cout << *it << ", ";
269 // cout << endl;
270 // cout << " fNmode: " << calibConfig->getCalibrationMode() << endl;
271 
272 // // see what's in the db
273 // //cout << "tagInfo: " << tagInfo().name << ", " << tagInfo().lastInterval.first << endl;
274 
275 // m_to_transfer.push_back(std::make_pair(calibConfig,_sinceIOV));
276 
277 
278 // delete dbsession;
279 } // void PixelPopConCalibSourceHandler::getNewObjects_coral()
tuple cout
Definition: gather_cfg.py:121
void PixelPopConCalibSourceHandler::getNewObjects_file ( )
virtual

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 282 of file PixelPopConCalibSourceHandler.cc.

References gather_cfg::cout.

282  {
283  // check to make sure the _connectString begins with "file//"
284  if (_connectString.find("file://") != 0) {
285  cout << "Invalid connectString: " << _connectString << endl;
286  cout << "It should begin with \"file://\"" << endl;
287  return;
288  }
289  // strip the "file://" from the connect string
290  string inputFilename = _connectString.erase(0, 7);
291 
292  cout << "PopCon-ing the calibration configuration file located at " << inputFilename << endl;
293 
294  // use online code to parse the file
295  pos::PixelCalibConfiguration fancyCalib(inputFilename);
296  SiPixelCalibConfiguration *calibConfig = new SiPixelCalibConfiguration(fancyCalib);
297 
298  m_to_transfer.push_back(std::make_pair(calibConfig, _sinceIOV));
299 
300 } // void PixelPopConCalibSourceHandler::getNewObjects_file()
This class implements the steps that are used in a scan over Threshold and CalDelay.
tuple cout
Definition: gather_cfg.py:121
string PixelPopConCalibSourceHandler::id ( void  ) const
virtual

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 74 of file PixelPopConCalibSourceHandler.cc.

74  {
75 
76  return string("PixelPopConCalibSourceHandler");
77 
78 } // string PixelPopConCalibSourceHandler::id()