CMS 3D CMS Logo

CondDBImport.cc
Go to the documentation of this file.
1 //
2 
3 //TO DO: add the comparison between stored object and input object - bool cond::serialization::equal( obj,read_back_copy )
4 #define IMPORT_PAYLOAD_CASE(TYPENAME) \
5  if (inputTypeName == #TYPENAME) { \
6  match = true; \
7  const TYPENAME& obj = *static_cast<const TYPENAME*>(inputPtr); \
8  payloadId = destination.storePayload(obj, boost::posix_time::microsec_clock::universal_time()); \
9  }
10 
12 
15 #include "CondFormats.h"
16 
17 //
18 #include <memory>
19 #include <sstream>
20 
21 namespace cond {
22 
23  namespace persistency {
24 
25  std::pair<std::string, std::shared_ptr<void> > fetchIfExists(const cond::Hash& payloadId,
26  Session& session,
27  bool& exists) {
28  std::shared_ptr<void> payloadPtr;
30  cond::Binary streamerInfo;
31  std::string payloadTypeName;
32  exists = session.fetchPayloadData(payloadId, payloadTypeName, data, streamerInfo);
33  if (exists) {
34  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr);
35  } else
36  return std::make_pair(std::string(""), std::shared_ptr<void>());
37  }
38 
40  const cond::Hash& sourcePayloadId,
41  const std::string& inputTypeName,
42  const void* inputPtr,
44  cond::Hash payloadId("");
45  bool newInsert = false;
46  bool match = false;
47  if (inputPtr) {
49  IMPORT_PAYLOAD_CASE(std::vector<unsigned long long>)
256  if (inputTypeName == "L1TriggerKeyList") {
257  match = true;
258  throwException("Import of \"L1TriggerKeyList\" type payloads is not supported.", "import");
259  }
260  //IMPORT_PAYLOAD_CASE( L1TriggerKeyList )
275  //IMPORT_PAYLOAD_CASE( PerformancePayload )
347  if (inputTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>") {
348  match = true;
351  payloadId = destination.storePayload(obj, boost::posix_time::microsec_clock::universal_time());
352  }
353  if (inputTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>") {
354  match = true;
357  payloadId = destination.storePayload(obj, boost::posix_time::microsec_clock::universal_time());
358  }
359  if (inputTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>") {
360  match = true;
361  const std::vector<unsigned long long>& obj = *static_cast<const std::vector<unsigned long long>*>(inputPtr);
362  payloadId = destination.storePayload(obj, boost::posix_time::microsec_clock::universal_time());
363  }
364 
365  if (!match)
366  throwException("Payload type \"" + inputTypeName + "\" is unknown.", "import");
367  }
368  return payloadId;
369  }
370 
371  } // namespace persistency
372 } // namespace cond
std::pair< std::string, std::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, std::shared_ptr< void > payloadPtr)
Definition: CondDBFetch.cc:23
std::pair< std::string, std::shared_ptr< void > > fetchIfExists(const cond::Hash &payloadId, Session &session, bool &exists)
Definition: CondDBImport.cc:25
Definition: ESGain.h:7
Definition: DTT0.h:48
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
#define IMPORT_PAYLOAD_CASE(TYPENAME)
Definition: CondDBImport.cc:4
Channel-mask mapping.
std::string Hash
Definition: Types.h:43
bool fetchPayloadData(const cond::Hash &payloadHash, std::string &payloadType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
Definition: Session.cc:185
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition: plugin.cc:23
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
Collection of optical functions for two crossing angle values and various scoring planes...
static std::string const source
Definition: EdmProvDump.cc:49
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
The mapping between FramePosition and ROCInfo.