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, Session& session, bool& exists ){
26  std::shared_ptr<void> payloadPtr;
28  cond::Binary streamerInfo;
29  std::string payloadTypeName;
30  exists = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
31  if( exists ) {
32  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr );
33  } else return std::make_pair( std::string(""), std::shared_ptr<void>() );
34  }
35 
36  cond::Hash import( Session& source, const cond::Hash& sourcePayloadId, const std::string& inputTypeName, const void* inputPtr, Session& destination ){
37  cond::Hash payloadId("");
38  bool newInsert = false;
39  bool match = false;
40  if( inputPtr ){
42  IMPORT_PAYLOAD_CASE( std::vector<unsigned long long> )
241  if( inputTypeName == "L1TriggerKeyList" ){
242  match = true;
243  throwException( "Import of \"L1TriggerKeyList\" type payloads is not supported.","import" );
244  }
245  //IMPORT_PAYLOAD_CASE( L1TriggerKeyList )
260  //IMPORT_PAYLOAD_CASE( PerformancePayload )
322  if( inputTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
323  match = true;
325  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
326  }
327  if( inputTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
328  match = true;
330  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
331  }
332  if( inputTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
333  match = true;
334  const std::vector<unsigned long long>& obj = *static_cast<const std::vector<unsigned long long>*>( inputPtr );
335  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
336  }
337 
338  if( ! match ) throwException( "Payload type \""+inputTypeName+"\" is unknown.","import" );
339  }
340  return payloadId;
341  }
342 
343  }
344 }
345 
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:24
Definition: ESGain.h:7
std::pair< std::string, std::shared_ptr< void > > fetchIfExists(const cond::Hash &payloadId, Session &session, bool &exists)
Definition: CondDBImport.cc:25
Definition: DTT0.h:53
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:45
bool fetchPayloadData(const cond::Hash &payloadHash, std::string &payloadType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
Definition: Session.cc:202
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
Definition: plugin.cc:24
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
static std::string const source
Definition: EdmProvDump.cc:43
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
The mapping between FramePosition and ROCInfo.