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 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 ()
 
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::map< Time_t, std::shared_ptr< SiPixelCalibConfiguration > > Container
 
typedef std::unique_ptr< SiPixelCalibConfigurationRef
 
typedef PopConSourceHandler< SiPixelCalibConfigurationself
 
typedef cond::Time_t Time_t
 
typedef SiPixelCalibConfiguration value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< SiPixelCalibConfiguration >
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 >
Container m_iovs
 
std::vector< std::pair< SiPixelCalibConfiguration *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 28 of file PixelPopConCalibSourceHandler.h.

Constructor & Destructor Documentation

◆ ~PixelPopConCalibSourceHandler()

PixelPopConCalibSourceHandler::~PixelPopConCalibSourceHandler ( )
override

Definition at line 67 of file PixelPopConCalibSourceHandler.cc.

67 {} // destructor

◆ PixelPopConCalibSourceHandler()

PixelPopConCalibSourceHandler::PixelPopConCalibSourceHandler ( edm::ParameterSet const &  pset)

Definition at line 48 of file PixelPopConCalibSourceHandler.cc.

References muonDTDigis_cfi::pset.

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

Member Function Documentation

◆ getNewObjects_coral()

void PixelPopConCalibSourceHandler::getNewObjects_coral ( )
overridevirtual

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 75 of file PixelPopConCalibSourceHandler.cc.

References gather_cfg::cout.

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

◆ getNewObjects_file()

void PixelPopConCalibSourceHandler::getNewObjects_file ( )
overridevirtual

Reimplemented from PixelPopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 274 of file PixelPopConCalibSourceHandler.cc.

References gather_cfg::cout, and GTTFileWriter_cff::inputFilename.

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

◆ id()

string PixelPopConCalibSourceHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< SiPixelCalibConfiguration >.

Definition at line 69 of file PixelPopConCalibSourceHandler.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

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