CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
LMFCorrCoefDat Class Reference

#include <LMFCorrCoefDat.h>

Public Member Functions

void debug ()
 
void dump ()
 
void fetch (const LMFLmrSubIOV &iov)
 
void fetch (int subiov_id)
 
void fetch (std::list< int > subiov_ids)
 
void fetchAfter (const Tm &t)
 
void fetchAfter (const Tm &t, int howMany)
 
void fetchBetween (const Tm &tmin, const Tm &tmax)
 
void fetchBetween (const Tm &tmin, const Tm &tmax, int maxNumberOfIOVs)
 
RunIOV fetchLastInsertedRun ()
 
std::map< int, std::map< int, LMFSextuple > > getCorrections (const Tm &t)
 
std::map< int, std::map< int, LMFSextuple > > getCorrections (const Tm &t, const Tm &t2, int max)
 
std::map< int, std::map< int, LMFSextuple > > getCorrections (const Tm &t, int max)
 
int getFlag (const LMFLmrSubIOV &iov, const EcalLogicID &id)
 
std::vector< float > getParameterErrors (const LMFLmrSubIOV &iov, const EcalLogicID &id)
 
std::list< std::vector< float > > getParameters (const EcalLogicID &id)
 
std::vector< float > getParameters (const LMFLmrSubIOV &iov, const EcalLogicID &id)
 
std::list< std::vector< float > > getParameters (int id)
 
int getSeqID (const LMFLmrSubIOV &iov, const EcalLogicID &id)
 
LMFSeqDat getSequence (const LMFLmrSubIOV &iov, const EcalLogicID &id)
 
std::list< int > getSubIOVIDs ()
 
std::vector< TmgetTimes (const LMFLmrSubIOV &iov)
 
void init ()
 
 LMFCorrCoefDat ()
 
 LMFCorrCoefDat (EcalDBConnection *c)
 
 LMFCorrCoefDat (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
void nodebug ()
 
LMFCorrCoefDatsetConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
LMFCorrCoefDatsetFlag (const LMFLmrSubIOV &iov, const EcalLogicID &id, int flag)
 
LMFCorrCoefDatsetP123 (const LMFLmrSubIOV &iov, const EcalLogicID &id, float p1, float p2, float p3)
 
LMFCorrCoefDatsetP123 (const LMFLmrSubIOV &iov, const EcalLogicID &id, float p1, float p2, float p3, float p1e, float p2e, float p3e)
 
LMFCorrCoefDatsetP123Errors (const LMFLmrSubIOV &iov, const EcalLogicID &id, float p1e, float p2e, float p3e)
 
LMFCorrCoefDatsetSequence (const LMFLmrSubIOV &iov, const EcalLogicID &id, const LMFSeqDat &seq)
 
LMFCorrCoefDatsetSequence (const LMFLmrSubIOV &iov, const EcalLogicID &id, int seq_id)
 
int size () const
 
void writeDB ()
 
 ~LMFCorrCoefDat ()
 

Private Member Functions

void checkTriplets (int logic_id, const LMFSextuple &s, const std::map< int, LMFSextuple > &lastMap)
 
LMFCorrCoefDatComponentfind (const LMFLmrSubIOV &iov)
 

Private Attributes

oracle::occi::Connection * m_conn
 
std::map< int, LMFCorrCoefDatComponent * > m_data
 
bool m_debug
 
oracle::occi::Environment * m_env
 
std::map< int, LMFLmrSubIOV * > m_subiov
 

Static Private Attributes

static const int MAX_NUMBER_OF_SEQUENCES_TO_FETCH = 32
 

Detailed Description

Definition at line 16 of file LMFCorrCoefDat.h.

Constructor & Destructor Documentation

◆ LMFCorrCoefDat() [1/3]

LMFCorrCoefDat::LMFCorrCoefDat ( )

Definition at line 4 of file LMFCorrCoefDat.cc.

4 { init(); }

References init().

◆ LMFCorrCoefDat() [2/3]

LMFCorrCoefDat::LMFCorrCoefDat ( EcalDBConnection c)

Definition at line 6 of file LMFCorrCoefDat.cc.

6  {
7  init();
8  m_env = c->getEnv();
9  m_conn = c->getConn();
10 }

References HltBtagPostValidation_cff::c, init(), m_conn, and m_env.

◆ LMFCorrCoefDat() [3/3]

LMFCorrCoefDat::LMFCorrCoefDat ( oracle::occi::Environment *  env,
oracle::occi::Connection *  conn 
)

Definition at line 12 of file LMFCorrCoefDat.cc.

12  {
13  init();
14  m_env = env;
15  m_conn = conn;
16 }

References SiStripCommissioningClient_cfg::conn, web.browse_db::env, init(), m_conn, and m_env.

◆ ~LMFCorrCoefDat()

LMFCorrCoefDat::~LMFCorrCoefDat ( )

Definition at line 18 of file LMFCorrCoefDat.cc.

18  {
19  std::map<int, LMFCorrCoefDatComponent *>::iterator i = m_data.begin();
20  std::map<int, LMFCorrCoefDatComponent *>::iterator e = m_data.end();
21  while (i != e) {
22  delete i->second;
23  i++;
24  }
25  m_data.clear();
26  std::map<int, LMFLmrSubIOV *>::iterator si = m_subiov.begin();
27  std::map<int, LMFLmrSubIOV *>::iterator se = m_subiov.end();
28  while (si != se) {
29  delete si->second;
30  si++;
31  }
32  m_subiov.clear();
33 }

References MillePedeFileConverter_cfg::e, mps_fire::i, m_data, and m_subiov.

Member Function Documentation

◆ checkTriplets()

void LMFCorrCoefDat::checkTriplets ( int  logic_id,
const LMFSextuple s,
const std::map< int, LMFSextuple > &  lastMap 
)
private

Definition at line 298 of file LMFCorrCoefDat.cc.

298  {
299  // this method verify that T3 in the last inserted record for a given
300  // crystal coincides with T1 of the newly inserted record
301  if (lastMap.find(logic_id) != lastMap.end()) {
302  const LMFSextuple sold = lastMap.find(logic_id)->second;
303  /* This check is wrong as it is. But we still need to define
304  a reasonable one.
305  if (sold.t[2] != s.t[0]) {
306  std::cout << ":-( T3 in last sequence for crystal " << logic_id
307  << " differs from T1 in this sequence: "
308  << sold.t[2].str() << " != " << s.t[0].str() << std::endl;
309  exit(0);
310  }
311  */
312  } else {
313  /* This check too must be updated
314  std::cout << ":-( Can't find crystal " << logic_id << " in last map"
315  << std::endl;
316  */
317  }
318 }

Referenced by getCorrections().

◆ debug()

void LMFCorrCoefDat::debug ( )

Definition at line 135 of file LMFCorrCoefDat.cc.

135  {
136  std::cout << "Set debug" << std::endl << std::flush;
137  m_debug = true;
138 }

References gather_cfg::cout, and m_debug.

◆ dump()

void LMFCorrCoefDat::dump ( void  )

Definition at line 105 of file LMFCorrCoefDat.cc.

105  {
106  std::cout << std::endl;
107  std::cout << "##################### LMF_CORR_COEF_DAT ########################" << std::endl;
108  std::cout << "This structure contains " << m_data.size() << " LMR_SUB_IOV_ID" << std::endl;
109  std::map<int, LMFCorrCoefDatComponent *>::const_iterator i = m_data.begin();
110  std::map<int, LMFCorrCoefDatComponent *>::const_iterator e = m_data.end();
111  int count = 0;
112  while (i != e) {
113  std::cout << "### SUB IOV ID: " << i->second->getLMFLmrSubIOVID() << std::endl;
114  std::list<int> logic_ids = i->second->getLogicIds();
115  std::cout << " Contains data for " << logic_ids.size() << " xtals" << std::endl;
116  count += logic_ids.size();
117  i++;
118  }
119  std::cout << "Total no. of xtals for which data are stored: " << count << std::endl;
120  std::cout << "##################### LMF_CORR_COEF_DAT ########################" << std::endl;
121 }

References KineDebug3::count(), gather_cfg::cout, MillePedeFileConverter_cfg::e, mps_fire::i, and m_data.

◆ fetch() [1/3]

void LMFCorrCoefDat::fetch ( const LMFLmrSubIOV iov)

Definition at line 260 of file LMFCorrCoefDat.cc.

260  {
261  // fetch data with given LMR_SUB_IOV_ID from the database
262  if (m_data.find(iov.getID()) == m_data.end()) {
263  if (m_debug) {
264  std::cout << " Data collected in LMR_SUB_IOV " << iov.getID() << " not found in private data. "
265  << "Getting it from DB " << std::endl
266  << std::flush;
267  }
269  if (m_debug) {
270  comp->debug();
271  }
272  // assign this IOV to comp to be able to retrieve it from the DB
273  comp->setLMFLmrSubIOV(iov);
274  comp->fetch();
275  if (m_debug) {
276  std::cout << "====== DEBUGGING: Data collected during this LMR_SUB_IOV" << std::endl;
277  comp->dump();
278  std::cout << "====== DEBUGGING: ======================================" << std::endl << std::endl;
279  }
280  m_data[iov.getID()] = comp;
281  } else if (m_debug) {
282  // this is not going to happen, but...
283  std::cout << " Data collected in LMR_SUB_IOV " << iov.getID() << " found in private data. "
284  << std::endl
285  << std::flush;
286  }
287  if (m_debug) {
288  std::cout << "[LMFCorrCoefDat] Fetch done" << std::endl << std::endl << std::flush;
289  }
290 }

References AlCaHLTBitMon_QueryRunRegistry::comp, gather_cfg::cout, LMFUnique::getID(), m_conn, m_data, m_debug, and m_env.

◆ fetch() [2/3]

void LMFCorrCoefDat::fetch ( int  subiov_id)

Definition at line 240 of file LMFCorrCoefDat.cc.

240  {
241  LMFLmrSubIOV iov(m_env, m_conn);
242  iov.setByID(subiov_id);
243  if (m_debug) {
244  std::cout << "[LMFCorrCoefDat] Looking for LMR_SUB_IOV with ID " << iov.getID() << std::endl << std::flush;
245  }
246  // create an instance of LMFLmrSubIOV to associate to this IOV_ID
247  LMFLmrSubIOV *subiov = new LMFLmrSubIOV(m_env, m_conn);
248  *subiov = iov;
249  m_subiov[subiov_id] = subiov;
250  if (m_debug) {
251  std::cout << "[LMFCorrCoefDat] Latest LMR_SUB_IOV data follows" << std::endl;
252  subiov->dump();
253  std::cout << "[LMFCorrCoefDat] Fetching data taken "
254  << "during LMR_SUB_IOV ID " << subiov_id << std::endl
255  << std::flush;
256  }
257  fetch(iov);
258 }

References gather_cfg::cout, LMFUnique::dump(), fetch(), LMFUnique::getID(), m_conn, m_debug, m_env, m_subiov, and LMFUnique::setByID().

◆ fetch() [3/3]

void LMFCorrCoefDat::fetch ( std::list< int >  subiov_ids)

Definition at line 223 of file LMFCorrCoefDat.cc.

223  {
224  std::list<int>::const_iterator i = subiov_ids.begin();
225  std::list<int>::const_iterator e = subiov_ids.end();
226  int c = 0;
227  while (i != e) {
228  if (m_debug) {
229  std::cout << "[LMFCorrCoefDat] Fetching data taken "
230  << "during LMR_SUB_IOV no. " << ++c << std::endl;
231  }
232  fetch(*i);
233  i++;
234  }
235  if (m_debug) {
236  std::cout << "[LMFCorrCoefDat] fetch done for all sub iovs" << std::endl << std::flush;
237  }
238 }

References HltBtagPostValidation_cff::c, gather_cfg::cout, MillePedeFileConverter_cfg::e, mps_fire::i, and m_debug.

Referenced by fetch(), fetchBetween(), getFlag(), getParameterErrors(), getParameters(), getSeqID(), and getSequence().

◆ fetchAfter() [1/2]

void LMFCorrCoefDat::fetchAfter ( const Tm t)

Definition at line 185 of file LMFCorrCoefDat.cc.

185  {
186  Tm tmax;
187  tmax.setToString("9999-12-31 23:59:59");
188  fetchBetween(t, tmax, 0);
189 }

References fetchBetween(), OrderedSet::t, and tmax.

◆ fetchAfter() [2/2]

void LMFCorrCoefDat::fetchAfter ( const Tm t,
int  howMany 
)

Definition at line 191 of file LMFCorrCoefDat.cc.

191  {
192  Tm tmax;
193  tmax.setToString("9999-12-31 23:59:59");
194  fetchBetween(t, tmax, howmany);
195 }

References fetchBetween(), OrderedSet::t, and tmax.

◆ fetchBetween() [1/2]

void LMFCorrCoefDat::fetchBetween ( const Tm tmin,
const Tm tmax 
)

Definition at line 197 of file LMFCorrCoefDat.cc.

197 { fetchBetween(tmin, tmax, 0); }

References tmax, and muonTiming_cfi::tmin.

Referenced by fetchAfter().

◆ fetchBetween() [2/2]

void LMFCorrCoefDat::fetchBetween ( const Tm tmin,
const Tm tmax,
int  maxNumberOfIOVs 
)

Definition at line 199 of file LMFCorrCoefDat.cc.

199  {
200  LMFLmrSubIOV iov(m_env, m_conn);
201  Tm tinf;
202  tinf.setToString("9999-12-31 23:59:59");
203  if (m_debug) {
204  std::cout << "Searching for data collected after " << tmin.str();
205  if (tmax != tinf) {
206  std::cout << " and before " << tmax.str();
207  }
208  std::cout << ". Retrieving the first " << maxNumberOfIOVs << " records" << std::endl;
209  iov.debug();
210  }
211  std::list<int> l = iov.getIOVIDsLaterThan(tmin, tmax, maxNumberOfIOVs);
212  if (m_debug) {
213  std::cout << "Now we are going to fetch details about "
214  << "data collected within the above mentioned "
215  << "LMR_SUB_IOV's" << std::endl;
216  }
217  fetch(l);
218  if (m_debug) {
219  std::cout << "Fetched a list of " << m_data.size() << " IOVs" << std::endl << std::flush;
220  }
221 }

References gather_cfg::cout, LMFUnique::debug(), fetch(), LMFLmrSubIOV::getIOVIDsLaterThan(), cmsLHEtoEOSManager::l, m_conn, m_data, m_debug, m_env, Tm::setToString(), tmax, and muonTiming_cfi::tmin.

◆ fetchLastInsertedRun()

RunIOV LMFCorrCoefDat::fetchLastInsertedRun ( )

Definition at line 142 of file LMFCorrCoefDat.cc.

142  {
143  RunIOV iov;
144  if (m_conn == nullptr) {
145  throw std::runtime_error(
146  "[LMFCorrCoefDat::fetchLastInsertedRun] ERROR: "
147  "Connection not set");
148  }
149  iov.setConnection(m_env, m_conn);
150  std::string sql =
151  "SELECT IOV_ID FROM CMS_ECAL_COND.RUN_IOV WHERE "
152  "IOV_ID = (SELECT RUN_IOV_ID FROM LMF_SEQ_DAT WHERE SEQ_ID = "
153  "(SELECT MAX(SEQ_ID) FROM LMF_CORR_COEF_DAT))";
154  oracle::occi::Statement *stmt;
155  try {
156  stmt = m_conn->createStatement();
157  stmt->setSQL(sql);
158  } catch (oracle::occi::SQLException &e) {
159  throw(std::runtime_error("[LMFCorrCoefDat::fetchLastInsertedRun]: " + e.getMessage()));
160  }
161  if (m_debug) {
162  std::cout << "[LMFCorrCoefDat::fetchLastInsertedRun] executing query" << std::endl
163  << sql << std::endl
164  << std::flush;
165  }
166  oracle::occi::ResultSet *rset = stmt->executeQuery();
167  if (m_debug) {
168  std::cout << " done" << std::endl << std::flush;
169  }
170  int iov_id = -1;
171  try {
172  while (rset->next()) {
173  // there should be just one result
174  iov_id = rset->getInt(1);
175  }
176  } catch (oracle::occi::SQLException &e) {
177  throw(std::runtime_error("[LMFCorrCoefDat::fetchLastInsertedRun]: " + e.getMessage()));
178  }
179  if (iov_id > 0) {
180  iov.setByID(iov_id);
181  }
182  return iov;
183 }

References gather_cfg::cout, MillePedeFileConverter_cfg::e, m_conn, m_debug, m_env, RunIOV::setByID(), IDBObject::setConnection(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ find()

LMFCorrCoefDatComponent * LMFCorrCoefDat::find ( const LMFLmrSubIOV iov)
private

Definition at line 87 of file LMFCorrCoefDat.cc.

87  {
88  if (m_data.find(iov.getID()) != m_data.end()) {
89  return m_data[iov.getID()];
90  } else {
92  LMFLmrSubIOV *subiov = new LMFLmrSubIOV();
93  if (m_conn != nullptr) {
94  c->setConnection(m_env, m_conn);
95  subiov->setConnection(m_env, m_conn);
96  }
97  *subiov = iov;
98  c->setLMFLmrSubIOV(*subiov);
99  m_data[subiov->getID()] = c;
100  m_subiov[subiov->getID()] = subiov;
101  return c;
102  }
103 }

References HltBtagPostValidation_cff::c, LMFUnique::getID(), m_conn, m_data, m_env, m_subiov, and IDBObject::setConnection().

Referenced by setFlag(), setP123(), setP123Errors(), and setSequence().

◆ getCorrections() [1/3]

std::map< int, std::map< int, LMFSextuple > > LMFCorrCoefDat::getCorrections ( const Tm t)

Definition at line 294 of file LMFCorrCoefDat.cc.

294  {
296 }

References MAX_NUMBER_OF_SEQUENCES_TO_FETCH, and OrderedSet::t.

Referenced by getCorrections().

◆ getCorrections() [2/3]

std::map< int, std::map< int, LMFSextuple > > LMFCorrCoefDat::getCorrections ( const Tm t,
const Tm t2,
int  max 
)

Definition at line 324 of file LMFCorrCoefDat.cc.

324  {
325  // returns a map whose key is the sequence_id and whose value is another
326  // map. The latter has the logic_id of a crystal as key and the corresponding
327  // sextuple p1, p2, p3, t1, t2, t3 as value.
328  // Crystal corrections, then, are organized by sequences
329  // First of all, checks that the connection is active (TODO)
330  //
331  // For fixed-time IOV's sequence ID's are always 0. In that case
332  // use the LMR_SUB_IOV_ID as a key
333  if (m_conn == nullptr) {
334  throw std::runtime_error(
335  "[LMFCorrCoefDat::getCorrections] ERROR: "
336  "Connection not set");
337  }
338  // limit the maximum number of rows to fetch
340  if (m_debug) {
341  std::cout << " Required to fetch " << max << " sequences from OMDS. " << MAX_NUMBER_OF_SEQUENCES_TO_FETCH
342  << " allowed" << std::endl;
343  }
345  }
346  // we must define some criteria to select the right rows
347  std::map<int, std::map<int, LMFSextuple> > ret;
348  std::string sql =
349  "SELECT * FROM (SELECT LOGIC_ID, T1, T2, T3, P1, P2, P3, "
350  "SEQ_ID, D.LMR_SUB_IOV_ID FROM LMF_LMR_SUB_IOV JOIN LMF_CORR_COEF_DAT D ON "
351  "D.LMR_SUB_IOV_ID = LMF_LMR_SUB_IOV.LMR_SUB_IOV_ID "
352  "WHERE T1 > TO_DATE(:1, 'YYYY-MM-DD HH24:MI:SS') AND "
353  "T1 <= TO_DATE(:2, 'YYYY-MM-DD HH24:MI:SS') ORDER BY T1) WHERE ROWNUM <= :3";
354  try {
356  const int PREFETCH = 10000;
357  oracle::occi::Statement *stmt = m_conn->createStatement();
358  stmt->setSQL(sql);
359  int toFetch = (max * (61200 + 14648));
360  stmt->setString(1, t.str());
361  stmt->setString(2, t2.str());
362  stmt->setInt(3, toFetch);
363  stmt->setPrefetchRowCount(PREFETCH);
364  if (m_debug) {
365  std::cout << "[LMFCorrCoefDat::getCorrections] executing query" << std::endl
366  << sql << std::endl
367  << "Parameters 1 = " << t.str() << " 2 = " << t2.str() << " 3 = " << toFetch << std::endl
368  << "Prefetching " << PREFETCH << " rows " << std::endl
369  << std::flush;
370  }
371  oracle::occi::ResultSet *rset = stmt->executeQuery();
372  if (m_debug) {
373  std::cout << " done" << std::endl << std::flush;
374  }
375  int c = 0;
376  std::map<int, LMFSextuple> theMap;
377  int lastSeqId = 0;
378  int previousSeqId = 0;
379  int startingSeqId = -1; // this variable contains the very first SEQ_ID
380  LMFSextuple s;
381  bool proceed = true;
382  while (rset->next()) {
383  int logic_id = rset->getInt(1);
384  int seq_id = rset->getInt(8);
385  if (startingSeqId < 0) {
386  startingSeqId = seq_id;
387  }
388  if ((seq_id == 0) && (startingSeqId == 0)) {
389  // check if we are in fixed-time IOV mode or not.
390  // In any case do not mix the modes.
391  if (c == 0) {
392  std::cout << "[LMFCorrCoefDat::getCorrections] Using fixed-time IOV" << std::endl;
393  }
394  seq_id = rset->getInt(9); // for fixed-time intervals use LMR_SUB_IOV_ID
395  } else if ((startingSeqId == 0) && (proceed = true)) {
396  std::cout << "[LMFCorrCoefDat::getCorrections] Switch to normal (sequence based) mode. "
397  << "Exiting..." << std::endl;
398  proceed = false;
399  } else if ((seq_id == 0) && (proceed = true)) {
400  std::cout << "[LMFCorrCoefDat::getCorrections] Switch to fixed-time IOV mode. "
401  << "Exiting..." << std::endl;
402  proceed = false;
403  }
404  if (proceed) {
405  if (seq_id != lastSeqId) {
406  if (m_debug) {
407  if (lastSeqId != 0) {
408  std::cout << " Triplets in sequences: " << c << std::endl;
409  std::cout << " T1: " << s.t[0].str() << " T2: " << s.t[1].str() << " T3: " << s.t[2].str()
410  << std::endl;
411  }
412  c = 0;
413  std::cout << " Found new sequence: " << seq_id << std::endl;
414  }
415  // the triplet of dates is equal for all rows in a sequence:
416  // get them once
417  for (int i = 0; i < 3; i++) {
418  oracle::occi::Date d = rset->getDate(i + 2);
419  s.t[i] = dh.dateToTm(d);
420  }
421  if (lastSeqId > 0) {
422  ret[lastSeqId] = theMap;
423  }
424  theMap.clear();
425  previousSeqId = lastSeqId;
426  lastSeqId = seq_id;
427  }
428  for (int i = 0; i < 3; i++) {
429  s.p[i] = rset->getDouble(i + 5);
430  }
431  theMap[logic_id] = s;
432  // verify that the sequence of time is correct
433  if (!ret.empty()) {
434  checkTriplets(logic_id, s, ret[previousSeqId]);
435  }
436  c++;
437  }
438  }
439  // insert the last map in the outer map
440  ret[lastSeqId] = theMap;
441  if (m_debug) {
442  std::cout << " Triplets in sequences: " << c << std::endl;
443  std::cout << " T1: " << s.t[0].str() << " T2: " << s.t[1].str() << " T3: " << s.t[2].str() << std::endl;
444  std::cout << std::endl;
445  }
446  } catch (oracle::occi::SQLException &e) {
447  throw(std::runtime_error("LMFCorrCoefDat::getCorrections: " + e.getMessage()));
448  }
449  if (m_debug) {
450  std::cout << "[LMFCorrCoefDat::getCorrections] Map built" << std::endl
451  << " Contains " << ret.size()
452  << " sequences. These are the size of all sequences" << std::endl;
453  std::map<int, std::map<int, LMFSextuple> >::const_iterator i = ret.begin();
454  std::map<int, std::map<int, LMFSextuple> >::const_iterator e = ret.end();
455  while (i != e) {
456  std::cout << " SEQ " << i->first << " Size " << i->second.size() << std::endl;
457  i++;
458  }
459  }
460  return ret;
461 }

References HltBtagPostValidation_cff::c, checkTriplets(), gather_cfg::cout, ztail::d, cuy::dh, MillePedeFileConverter_cfg::e, mps_fire::i, m_conn, m_debug, m_env, SiStripPI::max, MAX_NUMBER_OF_SEQUENCES_TO_FETCH, runTheMatrix::ret, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, OrderedSet::t, and RandomServiceHelper::t2.

◆ getCorrections() [3/3]

std::map< int, std::map< int, LMFSextuple > > LMFCorrCoefDat::getCorrections ( const Tm t,
int  max 
)

Definition at line 320 of file LMFCorrCoefDat.cc.

320  {
321  return getCorrections(t, Tm().plusInfinity(), max);
322 }

References getCorrections(), SiStripPI::max, and OrderedSet::t.

◆ getFlag()

int LMFCorrCoefDat::getFlag ( const LMFLmrSubIOV iov,
const EcalLogicID id 
)

Definition at line 514 of file LMFCorrCoefDat.cc.

514  {
515  int x = -1;
516  fetch(iov);
517  if (m_data.find(iov.getID()) != m_data.end()) {
518  x = (m_data.find(iov.getID())->second)->getFlag(id);
519  }
520  return x;
521 }

References fetch(), LMFUnique::getID(), m_data, edm::second(), and x.

◆ getParameterErrors()

std::vector< float > LMFCorrCoefDat::getParameterErrors ( const LMFLmrSubIOV iov,
const EcalLogicID id 
)

Definition at line 504 of file LMFCorrCoefDat.cc.

504  {
505  std::vector<float> x;
506  int key = iov.getID();
507  fetch(iov);
508  if (m_data.find(key) != m_data.end()) {
509  x = (m_data.find(key)->second)->getParameterErrors(id);
510  }
511  return x;
512 }

References fetch(), LMFUnique::getID(), crabWrapper::key, m_data, and x.

◆ getParameters() [1/3]

std::list< std::vector< float > > LMFCorrCoefDat::getParameters ( const EcalLogicID id)

Definition at line 463 of file LMFCorrCoefDat.cc.

463  {
464  return getParameters(id.getLogicID());
465 }

References getParameters().

◆ getParameters() [2/3]

std::vector< float > LMFCorrCoefDat::getParameters ( const LMFLmrSubIOV iov,
const EcalLogicID id 
)

Definition at line 494 of file LMFCorrCoefDat.cc.

494  {
495  std::vector<float> x(3);
496  int key = iov.getID();
497  fetch(iov);
498  if (m_data.find(key) != m_data.end()) {
499  x = (m_data.find(key)->second)->getParameters(id);
500  }
501  return x;
502 }

References fetch(), LMFUnique::getID(), getParameters(), crabWrapper::key, m_data, and x.

◆ getParameters() [3/3]

std::list< std::vector< float > > LMFCorrCoefDat::getParameters ( int  id)

Definition at line 467 of file LMFCorrCoefDat.cc.

467  {
468  std::map<int, LMFCorrCoefDatComponent *>::const_iterator i = m_data.begin();
469  std::map<int, LMFCorrCoefDatComponent *>::const_iterator e = m_data.end();
470  std::list<std::vector<float> > ret;
471  while (i != e) {
472  std::list<int> logic_ids = i->second->getLogicIds();
473  std::list<int>::iterator p = std::find(logic_ids.begin(), logic_ids.end(), id);
474  if (p != logic_ids.end()) {
475  // the given logic id is contained in at least an element of this map
476  std::vector<float> ppar;
477  std::vector<Tm> tpar;
478  // get P1, P2, P3 and T1, T2, T3
479  i->second->getData(id, ppar);
480  tpar = m_subiov[i->first]->getTimes();
481  // construct the resulting pair of triplets
482  std::vector<float> par(6);
483  for (int k = 0; k < 3; k++) {
484  par[k + 3] = ppar[k];
485  par[k] = tpar[k].microsTime();
486  }
487  ret.push_back(par);
488  }
489  i++;
490  }
491  return ret;
492 }

References MillePedeFileConverter_cfg::e, spr::find(), mps_fire::i, triggerObjects_cff::id, dqmdumpme::k, m_data, m_subiov, AlCaHLTBitMon_ParallelJobs::p, and runTheMatrix::ret.

Referenced by getParameters().

◆ getSeqID()

int LMFCorrCoefDat::getSeqID ( const LMFLmrSubIOV iov,
const EcalLogicID id 
)

Definition at line 523 of file LMFCorrCoefDat.cc.

523  {
524  int x = -1;
525  fetch(iov);
526  if (m_data.find(iov.getID()) != m_data.end()) {
527  x = (m_data.find(iov.getID())->second)->getSeqID(id);
528  }
529  return x;
530 }

References fetch(), LMFUnique::getID(), m_data, edm::second(), and x.

◆ getSequence()

LMFSeqDat LMFCorrCoefDat::getSequence ( const LMFLmrSubIOV iov,
const EcalLogicID id 
)

Definition at line 532 of file LMFCorrCoefDat.cc.

532  {
534  fetch(iov);
535  if (m_data.find(iov.getID()) != m_data.end()) {
536  seq = (m_data.find(iov.getID())->second)->getSequence(id);
537  }
538  return seq;
539 }

References fetch(), LMFUnique::getID(), m_conn, m_data, m_env, edm::second(), and cmsswSequenceInfo::seq.

◆ getSubIOVIDs()

std::list< int > LMFCorrCoefDat::getSubIOVIDs ( )

Definition at line 552 of file LMFCorrCoefDat.cc.

552  {
553  std::list<int> ret;
554  std::map<int, LMFCorrCoefDatComponent *>::const_iterator i = m_data.begin();
555  std::map<int, LMFCorrCoefDatComponent *>::const_iterator e = m_data.end();
556  while (i != e) {
557  ret.push_back(i->first);
558  i++;
559  }
560  return ret;
561 }

References MillePedeFileConverter_cfg::e, mps_fire::i, m_data, and runTheMatrix::ret.

◆ getTimes()

std::vector< Tm > LMFCorrCoefDat::getTimes ( const LMFLmrSubIOV iov)

Definition at line 292 of file LMFCorrCoefDat.cc.

292 { return iov.getTimes(); }

References LMFLmrSubIOV::getTimes().

◆ init()

void LMFCorrCoefDat::init ( void  )

Definition at line 35 of file LMFCorrCoefDat.cc.

35  {
36  m_data.clear();
37  m_subiov.clear();
38  m_env = nullptr;
39  m_conn = nullptr;
40  nodebug();
41 }

References m_conn, m_data, m_env, m_subiov, and nodebug().

Referenced by LMFCorrCoefDat().

◆ nodebug()

void LMFCorrCoefDat::nodebug ( )

Definition at line 140 of file LMFCorrCoefDat.cc.

140 { m_debug = false; }

References m_debug.

Referenced by init().

◆ setConnection()

LMFCorrCoefDat & LMFCorrCoefDat::setConnection ( oracle::occi::Environment *  env,
oracle::occi::Connection *  conn 
)

Definition at line 43 of file LMFCorrCoefDat.cc.

43  {
44  m_env = env;
45  m_conn = conn;
46  std::map<int, LMFCorrCoefDatComponent *>::iterator i = m_data.begin();
47  std::map<int, LMFCorrCoefDatComponent *>::iterator e = m_data.end();
48  while (i != e) {
49  i->second->setConnection(m_env, m_conn);
50  i++;
51  }
52  return *this;
53 }

References SiStripCommissioningClient_cfg::conn, MillePedeFileConverter_cfg::e, web.browse_db::env, mps_fire::i, m_conn, m_data, and m_env.

◆ setFlag()

LMFCorrCoefDat & LMFCorrCoefDat::setFlag ( const LMFLmrSubIOV iov,
const EcalLogicID id,
int  flag 
)

Definition at line 72 of file LMFCorrCoefDat.cc.

72  {
73  find(iov)->setFlag(id, flag);
74  return *this;
75 }

References find(), RemoveAddSevLevel::flag, and LMFCorrCoefDatComponent::setFlag().

◆ setP123() [1/2]

LMFCorrCoefDat & LMFCorrCoefDat::setP123 ( const LMFLmrSubIOV iov,
const EcalLogicID id,
float  p1,
float  p2,
float  p3 
)

Definition at line 55 of file LMFCorrCoefDat.cc.

55  {
56  find(iov)->setP123(id, p1, p2, p3);
57  return *this;
58 }

References find(), p1, p2, p3, and LMFCorrCoefDatComponent::setP123().

◆ setP123() [2/2]

LMFCorrCoefDat & LMFCorrCoefDat::setP123 ( const LMFLmrSubIOV iov,
const EcalLogicID id,
float  p1,
float  p2,
float  p3,
float  p1e,
float  p2e,
float  p3e 
)

Definition at line 60 of file LMFCorrCoefDat.cc.

61  {
62  find(iov)->setP123(id, p1, p2, p3, p1e, p2e, p3e);
63  return *this;
64 }

References find(), p1, p2, p3, and LMFCorrCoefDatComponent::setP123().

◆ setP123Errors()

LMFCorrCoefDat & LMFCorrCoefDat::setP123Errors ( const LMFLmrSubIOV iov,
const EcalLogicID id,
float  p1e,
float  p2e,
float  p3e 
)

Definition at line 66 of file LMFCorrCoefDat.cc.

67  {
68  find(iov)->setP123Errors(id, p1e, p2e, p3e);
69  return *this;
70 }

References find(), and LMFCorrCoefDatComponent::setP123Errors().

◆ setSequence() [1/2]

LMFCorrCoefDat & LMFCorrCoefDat::setSequence ( const LMFLmrSubIOV iov,
const EcalLogicID id,
const LMFSeqDat seq 
)

Definition at line 82 of file LMFCorrCoefDat.cc.

82  {
83  find(iov)->setSequence(id, seq);
84  return *this;
85 }

References find(), cmsswSequenceInfo::seq, and LMFCorrCoefDatComponent::setSequence().

◆ setSequence() [2/2]

LMFCorrCoefDat & LMFCorrCoefDat::setSequence ( const LMFLmrSubIOV iov,
const EcalLogicID id,
int  seq_id 
)

Definition at line 77 of file LMFCorrCoefDat.cc.

77  {
78  find(iov)->setSequence(id, seq_id);
79  return *this;
80 }

References find(), and LMFCorrCoefDatComponent::setSequence().

◆ size()

int LMFCorrCoefDat::size ( void  ) const

Definition at line 541 of file LMFCorrCoefDat.cc.

541  {
542  int c = 0;
543  std::map<int, LMFCorrCoefDatComponent *>::const_iterator i = m_data.begin();
544  std::map<int, LMFCorrCoefDatComponent *>::const_iterator e = m_data.end();
545  while (i != e) {
546  c += i->second->size();
547  i++;
548  }
549  return c;
550 }

References HltBtagPostValidation_cff::c, MillePedeFileConverter_cfg::e, mps_fire::i, and m_data.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ writeDB()

void LMFCorrCoefDat::writeDB ( )

Definition at line 123 of file LMFCorrCoefDat.cc.

123  {
124  std::map<int, LMFCorrCoefDatComponent *>::iterator i = m_data.begin();
125  std::map<int, LMFCorrCoefDatComponent *>::iterator e = m_data.end();
126  while (i != e) {
127  if (m_debug) {
128  std::cout << "Writing data for LMR_SUB_IOV_ID " << i->first << std::endl;
129  }
130  i->second->writeDB();
131  i++;
132  }
133 }

References gather_cfg::cout, MillePedeFileConverter_cfg::e, mps_fire::i, m_data, and m_debug.

Member Data Documentation

◆ m_conn

oracle::occi::Connection* LMFCorrCoefDat::m_conn
private

◆ m_data

std::map<int, LMFCorrCoefDatComponent *> LMFCorrCoefDat::m_data
private

◆ m_debug

bool LMFCorrCoefDat::m_debug
private

◆ m_env

oracle::occi::Environment* LMFCorrCoefDat::m_env
private

◆ m_subiov

std::map<int, LMFLmrSubIOV *> LMFCorrCoefDat::m_subiov
private

Definition at line 64 of file LMFCorrCoefDat.h.

Referenced by fetch(), find(), getParameters(), init(), and ~LMFCorrCoefDat().

◆ MAX_NUMBER_OF_SEQUENCES_TO_FETCH

const int LMFCorrCoefDat::MAX_NUMBER_OF_SEQUENCES_TO_FETCH = 32
staticprivate

Definition at line 61 of file LMFCorrCoefDat.h.

Referenced by getCorrections().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
RunIOV
Definition: RunIOV.h:13
LMFCorrCoefDat::fetchBetween
void fetchBetween(const Tm &tmin, const Tm &tmax)
Definition: LMFCorrCoefDat.cc:197
mps_fire.i
i
Definition: mps_fire.py:355
LMFCorrCoefDat::checkTriplets
void checkTriplets(int logic_id, const LMFSextuple &s, const std::map< int, LMFSextuple > &lastMap)
Definition: LMFCorrCoefDat.cc:298
cmsswSequenceInfo.seq
seq
Definition: cmsswSequenceInfo.py:540
LMFCorrCoefDat::m_data
std::map< int, LMFCorrCoefDatComponent * > m_data
Definition: LMFCorrCoefDat.h:63
muonTiming_cfi.tmin
tmin
Definition: muonTiming_cfi.py:24
LMFCorrCoefDatComponent::setP123Errors
LMFCorrCoefDatComponent & setP123Errors(const EcalLogicID &id, float p1e, float p2e, float p3e)
Definition: LMFCorrCoefDatComponent.cc:54
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
LMFCorrCoefDat::m_subiov
std::map< int, LMFLmrSubIOV * > m_subiov
Definition: LMFCorrCoefDat.h:64
RunIOV::setByID
void setByID(int id) noexcept(false) override
Definition: RunIOV.cc:106
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
LMFSextuple
Definition: LMFSextuple.h:13
DDAxes::x
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
tmax
static const double tmax[3]
Definition: CastorTimeSlew.cc:7
alignCSCRings.s
s
Definition: alignCSCRings.py:92
LMFUnique::dump
virtual void dump() const
Definition: LMFUnique.cc:104
LMFCorrCoefDat::getCorrections
std::map< int, std::map< int, LMFSextuple > > getCorrections(const Tm &t)
Definition: LMFCorrCoefDat.cc:294
LMFLmrSubIOV
Definition: LMFLmrSubIOV.h:13
p2
double p2[4]
Definition: TauolaWrapper.h:90
LMFCorrCoefDat::MAX_NUMBER_OF_SEQUENCES_TO_FETCH
static const int MAX_NUMBER_OF_SEQUENCES_TO_FETCH
Definition: LMFCorrCoefDat.h:61
dqmdumpme.k
k
Definition: dqmdumpme.py:60
OrderedSet.t
t
Definition: OrderedSet.py:90
Tm
Definition: Tm.h:13
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
web.browse_db.env
env
Definition: browse_db.py:18
LMFCorrCoefDatComponent::setP123
LMFCorrCoefDatComponent & setP123(const EcalLogicID &id, float p1, float p2, float p3)
Definition: LMFCorrCoefDatComponent.cc:40
LMFCorrCoefDat::init
void init()
Definition: LMFCorrCoefDat.cc:35
LMFCorrCoefDatComponent::setSequence
LMFCorrCoefDatComponent & setSequence(const EcalLogicID &id, int seq_id)
Definition: LMFCorrCoefDatComponent.cc:66
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
LMFCorrCoefDatComponent
Definition: LMFCorrCoefDatComponent.h:21
p1
double p1[4]
Definition: TauolaWrapper.h:89
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
LMFSeqDat
Definition: LMFSeqDat.h:14
LMFCorrCoefDat::fetch
void fetch(std::list< int > subiov_ids)
Definition: LMFCorrCoefDat.cc:223
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
LMFCorrCoefDatComponent::setFlag
LMFCorrCoefDatComponent & setFlag(const EcalLogicID &id, int flag)
Definition: LMFCorrCoefDatComponent.cc:61
LMFUnique::getID
int getID() const
Definition: LMFUnique.h:54
IDBObject::setConnection
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
LMFCorrCoefDat::find
LMFCorrCoefDatComponent * find(const LMFLmrSubIOV &iov)
Definition: LMFCorrCoefDat.cc:87
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Tm::setToString
void setToString(const std::string s) noexcept(false)
Definition: Tm.cc:150
p3
double p3[4]
Definition: TauolaWrapper.h:91
LMFCorrCoefDat::getParameters
std::list< std::vector< float > > getParameters(int id)
Definition: LMFCorrCoefDat.cc:467
LMFCorrCoefDat::m_env
oracle::occi::Environment * m_env
Definition: LMFCorrCoefDat.h:65
LMFCorrCoefDat::m_debug
bool m_debug
Definition: LMFCorrCoefDat.h:67
ztail.d
d
Definition: ztail.py:151
LMFCorrCoefDat::m_conn
oracle::occi::Connection * m_conn
Definition: LMFCorrCoefDat.h:66
LMFCorrCoefDat::getParameterErrors
std::vector< float > getParameterErrors(const LMFLmrSubIOV &iov, const EcalLogicID &id)
Definition: LMFCorrCoefDat.cc:504
LMFLmrSubIOV::getTimes
void getTimes(Tm *t1, Tm *t2, Tm *t3) const
Definition: LMFLmrSubIOV.h:34
crabWrapper.key
key
Definition: crabWrapper.py:19
DateHandler
Definition: DateHandler.h:7
LMFCorrCoefDat::nodebug
void nodebug()
Definition: LMFCorrCoefDat.cc:140
cuy.dh
dh
Definition: cuy.py:355
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37