CMS 3D CMS Logo

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 () override
 
void getNewObjects_file () override
 
std::string id () const override
 
 PixelPopConCalibSourceHandler (edm::ParameterSet const &)
 
 ~PixelPopConCalibSourceHandler () override
 
- Public Member Functions inherited from PixelPopConSourceHandler< SiPixelCalibConfiguration >
void getNewObjects () override
 
std::string id () const override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
typedef std::vector< Triplet > Container
 
typedef std::vector< std::pair< SiPixelCalibConfiguration *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< SiPixelCalibConfigurationself
 
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)
 
cond::persistency::SessiondbSession () const
 
- 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 28 of file PixelPopConCalibSourceHandler.h.

Constructor & Destructor Documentation

PixelPopConCalibSourceHandler::~PixelPopConCalibSourceHandler ( )
override

Definition at line 68 of file PixelPopConCalibSourceHandler.cc.

68 {} // destructor
PixelPopConCalibSourceHandler::PixelPopConCalibSourceHandler ( edm::ParameterSet const &  pset)

Definition at line 49 of file PixelPopConCalibSourceHandler.cc.

References edm::ParameterSet::getParameter().

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

Member Function Documentation

void PixelPopConCalibSourceHandler::getNewObjects_coral ( )
overridevirtual

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 76 of file PixelPopConCalibSourceHandler.cc.

References gather_cfg::cout.

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

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 275 of file PixelPopConCalibSourceHandler.cc.

References gather_cfg::cout.

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

Implements popcon::PopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 70 of file PixelPopConCalibSourceHandler.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

70  {
71  return string("PixelPopConCalibSourceHandler");
72 
73 } // string PixelPopConCalibSourceHandler::id()