4 #define IMPORT_PAYLOAD_CASE( TYPENAME ) \
5 if( inputTypeName == #TYPENAME ){ \
7 const TYPENAME& obj = *static_cast<const TYPENAME*>( inputPtr ); \
8 payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() ); \
11 #define IGNORE_FOR_IMPORT_CASE( TYPENAME ) \
12 if( inputTypeName == #TYPENAME ){ \
16 std::cout <<"WARNING: typename "<<inputTypeName<<" will be skipped in the import."<<std::endl; \
19 #define FETCH_PAYLOAD_CASE( TYPENAME ) \
20 if( payloadTypeName == #TYPENAME ){ \
21 auto payload = deserialize<TYPENAME>( payloadTypeName, data, streamerInfo, isOra ); \
22 payloadPtr = payload; \
43 namespace persistency {
46 boost::shared_ptr<void> payloadPtr;
50 exists = session.
fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
53 return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr, isOra);
54 }
else return std::make_pair(
std::string(
""), boost::shared_ptr<void>() );
59 bool newInsert =
false;
225 if( inputTypeName ==
"L1TriggerKeyList" ){
233 std::cout <<
"WARNING: L1Trigger key stored on "<<sourcePid<<
" has not been migrated (yet?). Attemping to do the export..."<<std::endl;
235 std::pair<std::string,boost::shared_ptr<void> > missingPayload =
fetchIfExists( sourcePid,
source, exists );
236 if( exists ) pid =
import(
source, sourcePid, missingPayload.first, missingPayload.second.get(),
destination );
237 std::cout <<
"WARNING: OID "<<sourcePid<<
" will be mapped to HASH "<<pid<<std::endl;
240 converted.
addKey( kitem.first, pid );
243 for(
const auto& kitem : ritem.second ){
247 std::cout <<
"WARNING: L1Trigger key stored on "<<sourcePid<<
" has not been migrated (yet?). Attemping to do the export..."<<std::endl;
249 std::pair<std::string,boost::shared_ptr<void> > missingPayload =
fetchIfExists( sourcePid,
source, exists );
250 if( exists ) pid =
import(
source, sourcePid, missingPayload.first, missingPayload.second.get(),
destination );
251 std::cout <<
"WARNING: OID "<<sourcePid<<
" will be mapped to HASH "<<pid<<std::endl;
254 converted.
addKey( ritem.first, kitem.first, pid );
257 payloadId =
destination.storePayload( converted, boost::posix_time::microsec_clock::universal_time() );
325 if( inputTypeName ==
"PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
328 payloadId =
destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
330 if( inputTypeName ==
"PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
333 payloadId =
destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
335 if( inputTypeName ==
"std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
337 const std::vector<unsigned long long>&
obj = *
static_cast<const std::vector<unsigned long long>*
>( inputPtr );
338 payloadId =
destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
341 if( ! match )
throwException(
"Payload type \""+inputTypeName+
"\" is unknown.",
"import" );
347 boost::shared_ptr<void> payloadPtr;
352 if( !found )
throwException(
"Payload with id "+boost::lexical_cast<std::string>(payloadId)+
" has not been found in the database.",
"fetchAndCompare" );
355 return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr, isOra);
591 if( payloadTypeName ==
"PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
592 auto payload = deserialize<PhysicsTools::Calibration::Histogram3D<double,double,double,double> >(payloadTypeName,
data, streamerInfo, isOra );
593 payloadPtr = payload;
596 if( payloadTypeName ==
"PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
597 auto payload = deserialize<PhysicsTools::Calibration::Histogram2D<double,double,double> >(payloadTypeName,
data, streamerInfo, isOra );
598 payloadPtr = payload;
601 if( payloadTypeName ==
"std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
602 auto payload = deserialize<std::vector<unsigned long long> >( payloadTypeName,
data, streamerInfo, isOra );
603 payloadPtr = payload;
607 if( ! match )
throwException(
"Payload type \""+payloadTypeName+
"\" is unknown.",
"fetch" );
608 return std::make_pair( payloadTypeName, payloadPtr );
std::pair< std::string, boost::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr, bool is Ora)
#define FETCH_PAYLOAD_CASE(TYPENAME)
QGLikelihoodObject containing valid range and entries with category, histogram and mean...
#define IMPORT_PAYLOAD_CASE(TYPENAME)
bool fetchPayloadData(const cond::Hash &payloadHash, std::string &payloadType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
std::pair< std::string, boost::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
Category structure: ranges associated with QGLikelihood histograms.
const KeyToToken & tscKeyToTokenMap() const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
char data[epos_bytes_allocation]
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::pair< std::string, boost::shared_ptr< void > > fetchIfExists(const cond::Hash &payloadId, Session &session, bool &exists)
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
bool addKey(const std::string &tscKey, const std::string &payloadToken, bool overwriteKey=false)
static std::string const source
void throwException(const std::string &message, const std::string &methodName)