BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
CalibMySQLCnvSvc Class Reference

#include <CalibMySQLCnvSvc.h>

+ Inheritance diagram for CalibMySQLCnvSvc:

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Create a transient representation from another rep of this object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the created transient object.
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
 Update a transient representation from another rep of this object.
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an updated transient object.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert a transient object to a requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of a converted object.
 
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Update a converted representation of a transient object.
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an already converted object.
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 Create an address using explicit arguments to identify a single object.
 
virtual StatusCode createCalib (DataObject *&refpObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)
 
virtual StatusCode updateCalib (DataObject *pObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)
 
virtual StatusCode decodeDescription (const std::string &description, unsigned char &type)
 Decode the string storage type to enumerated storage type.
 
virtual calibUtil::MetadatagetMeta ()
 Handle to the MySQL metadata database.
 
StatusCode getSftParVer (std::string &SftVer, std::string &CalParVer, int &runfrm, int &runto, int RunNo, std::string BossRelease, std::string DataType)
 
virtual StatusCode createCalib (DataObject *&refpObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)=0
 
virtual StatusCode updateCalib (DataObject *pObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)=0
 
virtual calibUtil::MetadatagetMeta ()=0
 

Protected Member Functions

 CalibMySQLCnvSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~CalibMySQLCnvSvc ()
 

Friends

class SvcFactory< CalibMySQLCnvSvc >
 Only factories can access protected constructors.
 

Additional Inherited Members

- Static Public Member Functions inherited from ICalibMetaCnvSvc
static const InterfaceID & interfaceID ()
 Interface ID of this class.
 

Detailed Description


A conversion service for GLAST calibration metadata database persistency. Allows to create and update condition data objects (i.e. DataObjects implementing IValidity).

Adapted from LHCb class DetCond/ConditionsDBCnvSvc by Andrea Valassi

Author
J. Bogart
Date
November 2002

Definition at line 33 of file CalibMySQLCnvSvc.h.

Constructor & Destructor Documentation

◆ CalibMySQLCnvSvc()

CalibMySQLCnvSvc::CalibMySQLCnvSvc ( const std::string &  name,
ISvcLocator *  svc 
)
protected

Definition at line 65 of file CalibMySQLCnvSvc.cxx.

66 : ConversionSvc (name, svc, MYSQL_StorageType)
67 , m_meta(0), m_useEventTime(true),m_enterTimeStart(0), m_enterTimeEnd(0),
68 m_qualityMask(0)
69{
70 // declareProperty("Host", m_host = "202.122.37.69");
71 declareProperty("Host", m_host = "bes3db2.ihep.ac.cn");
72 declareProperty("UseEventTime", m_useEventTime = true);
73 declareProperty("EnterTimeEnd", m_enterTimeEndString = std::string("") );
74 declareProperty("EnterTimeStart", m_enterTimeStartString = std::string("") );
75 // declareProperty("DbName", m_dbName = std::string("calib") );
76 declareProperty("DbName", m_dbName = std::string("offlinedb") );
77 declareProperty("QualityList", m_qualityList);
78 declareProperty("CrashOnError", m_crash = true);
79 declareProperty("Sft_Ver",sft_ver);
80 declareProperty("Cal_Ver",cal_ver);
81 declareProperty("MdcFlag",m_flag[0]="default");
82 declareProperty("DeDxFlag",m_flag[1]="default");
83 declareProperty("EmcFlag",m_flag[2]="default");
84 declareProperty("TofFlag",m_flag[3]="default");
85 declareProperty("MucFlag",m_flag[4]="default");
86 declareProperty("EsTimeFlag",m_flag[5]="default");
87 declareProperty("EstTofFlag",m_flag[6]="default");
88 declareProperty("MdcAlignFlag",m_flag[7]="default");
89 declareProperty("TofQElecFlag",m_flag[8]="default");
90 declareProperty("TofSimPFlag",m_flag[9]="default");
91 declareProperty("DedxSimFlag",m_flag[10]="default");
92 declareProperty("MdcDataFlag",m_flag[11]="default");
93 //Top_up Qiumei Ma
94 declareProperty("InjSigIntervalFlag",m_flag[12]="default");
95 declareProperty("InjSigTimeFlag",m_flag[13]="default");
96 declareProperty("OffEvtFilterFlag",m_flag[14]="default");
97 declareProperty("CorrectedETSFlag",m_flag[15]="default");
98
99 declareProperty("MdcCalPar",m_calPar[0]="default");
100 declareProperty("DeDxCalPar",m_calPar[1]="default");
101 declareProperty("EmcCalPar",m_calPar[2]="default");
102 declareProperty("TofCalPar",m_calPar[3]="default");
103 declareProperty("MucCalPar",m_calPar[4]="default");
104 declareProperty("EsTimeCalPar",m_calPar[5]="default");
105 declareProperty("EstTofCalPar",m_calPar[6]="default");
106 declareProperty("MdcAlignPar",m_calPar[7]="default");
107 declareProperty("TofQElecPar",m_calPar[8]="default");
108 declareProperty("TofSimPar",m_calPar[9]="default");
109 declareProperty("DedxSimPar",m_calPar[10]="default");
110 declareProperty("MdcDataConstVer",m_calPar[11]="default");
111 //Top_up Qiumei Ma
112 declareProperty("InjSigIntervalPar",m_calPar[12]="default");
113 declareProperty("InjSigTimePar",m_calPar[13]="default");
114 declareProperty("OffEvtFilterPar",m_calPar[14]="default");
115 declareProperty("CorrectedETSPar",m_calPar[15]="default");
116
117 declareProperty("MdcBossVer",m_bossver[0]="default");
118 declareProperty("DeDxBossVer",m_bossver[1]="default");
119 declareProperty("EmcBossVer",m_bossver[2]="default");
120 declareProperty("TofBossVer",m_bossver[3]="default");
121 declareProperty("MucBossVer",m_bossver[4]="default");
122 declareProperty("EsTimeBossVer",m_bossver[5]="default");
123 declareProperty("EstTofBossVer",m_bossver[6]="default");
124 declareProperty("MdcAlignBossVer",m_bossver[7]="default");
125 declareProperty("TofQElecBossVer",m_bossver[8]="default");
126 declareProperty("TofSimBossVer",m_bossver[9]="default");
127 declareProperty("DedxSimBossVer",m_bossver[10]="default");
128 declareProperty("MdcDataConstBossVer",m_bossver[11]="default");
129 declareProperty("InjSigIntervalBossVer",m_bossver[12]="default");
130 declareProperty("InjSigTimeBossVer",m_bossver[13]="default");
131 declareProperty("OffEvtFilterBossVer",m_bossver[14]="default");
132 declareProperty("Align_RunNo",m_MdcAlign_No=8093);
133 declareProperty("Db_Status",m_dbStatus="OK");
134 declareProperty("BossRelease",m_bossRelease="default");
135}

◆ ~CalibMySQLCnvSvc()

CalibMySQLCnvSvc::~CalibMySQLCnvSvc ( )
protectedvirtual

Definition at line 137 of file CalibMySQLCnvSvc.cxx.

137{ }

Member Function Documentation

◆ createAddress()

StatusCode CalibMySQLCnvSvc::createAddress ( long  svc_type,
const CLID &  clid,
const std::string *  par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
)
virtual

Create an address using explicit arguments to identify a single object.

Overload ConversionSvc implementation of createAddress.
Create an address using explicit arguments to identify a single object. Par[0] is full path in calibration TDS

Definition at line 380 of file CalibMySQLCnvSvc.cxx.

384 {
385 // First check that requested address is of type MYSQL_StorageType
386 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
387 if ( svc_type!= MYSQL_StorageType ) {
388 log << MSG::ERROR
389 << "Cannot create addresses of type " << (int)svc_type
390 << " which is different from " << (int)MYSQL_StorageType
391 << endreq;
392 return StatusCode::FAILURE;
393 }
394 log << MSG::INFO
395 << " create address in CalibMySQLCnvSvc "
396 << endreq;
397
398 refpAddress = new GenericAddress( MYSQL_StorageType,
399 clid,
400 par[0]);
401
402 return StatusCode::SUCCESS;
403}
IMessageSvc * msgSvc()

◆ createCalib()

StatusCode CalibMySQLCnvSvc::createCalib ( DataObject *&  refpObject,
const std::string &  fullpath,
const CLID &  classID,
IRegistry *  entry = 0 
)
virtual

Create a calib DataObject by calib type name, flavor and time. This method does not register DataObject in the transient data store. The string storage type is discovered at runtime in the Metadata dbs.

Create a calib DataObject by calib type, flavor, time and instrument. This method does not register DataObject in the transient data store, [but may register TDS addresses for its children if needed (e.g. Catalog).

  • what's all this about? ] The string storage type is discovered at runtime in the metadata dbs The entry name identifies a condition amongst the many in the string. Implementation:

create a temporary address containing storage type and classID;

  • dispatch to appropriate conversion service according to storage type;
  • this will dispatch to appropriate converter according to CLID (CalibMySQLCnvSvc has no converters of its own).

Implements ICalibMetaCnvSvc.

Definition at line 466 of file CalibMySQLCnvSvc.cxx.

470{
471 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
472
473 // Look up calib object in the Metadata database
474 std::string cType = CalibData::CalibModelSvc::getCalibType(fullpath);
475
476 // ..and extra special munging for test
477 if (std::string("Test") == cType.substr(0, 4)) {
478 cType = std::string("Test_Gen");
479 }
480
481 std::string testfile = std::string(getenv("CALIBMYSQLCNVROOT"))+"/share/test.root";
482 TFile *f1=new TFile(testfile.c_str(),"read");
483 unsigned int ser = 0;
484 //runfrm,runto are the value from the table ***CalConst;runfrm1,runto1 are the value from the table CalVtxLumVer
485 int runfrm,runfrm1;
486 int runto,runto1;
487 std::string flag="default";
489
490 MSG::Level msgLevel = MSG::DEBUG;
491
492 std::string physFmt = "UNK";
493 std::string fmtVersion;
494 std::string dataIdent;
495
496 // Get the runNo of current event:
497 SmartDataPtr<Event::EventHeader> evt(m_eventSvc,"/Event/EventHeader");
498 int runNo=0,FirstEvent=0;
499 if( !evt ){
500 log << MSG::WARNING << "Unable to read the Event for TDS" << endreq;
501 // return StatusCode::FAILURE;
502 }
503 if( evt ){
504 if(cType!="TofCal"&&cType!="EstTofCal"&&cType!="TofSim"&&cType!="DedxSim") runNo = fabs(evt -> runNumber());
505 if(cType=="TofCal"||cType=="EstTofCal"||cType=="TofSim"||cType=="DedxSim") runNo = evt -> runNumber();
506 FirstEvent = evt -> eventNumber();
507 }
508 DatabaseRecordVector res,res1;
509
510 StatusCode st1;
511
512 //TofCalConst
513 if((cType=="TofCal")&&(m_bossver[3]== "default" ))
514 {
515 std::string cType="Tof";
516 if(m_bossRelease=="default")
517 {
518 log << MSG::FATAL << " Boss Release for TofCal not set!" << endreq;
519 exit(1);
520
521 }
522 else
523 {
524 st1=getSftParVer(m_bossver[3],m_calPar[3],runfrm1,runto1,runNo,m_bossRelease,cType);
525 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
526 if (st1 .isFailure() )
527 {
528 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
529 return st1;
530 }
531 //cout<<"SftVer and CalParVer are:"<<sft_ver<<";"<<cal_ver<<endl;
532 ret = m_meta->getReadTOFInfo(ser,&runfrm,&runto,m_calPar[3],res,runNo,m_bossver[3]);
533 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
534
535 }
536 }
537 else if ((cType=="TofCal")&&(m_bossver[3]!= "default" ))
538 {
539 m_flag[3]="set";
540 flag=m_flag[3];
541 //cout<<"flag @create Tof is:"<<m_flag[3]<<endl;
542 ret = m_meta->getReadTOFInfo(ser,&runfrm,&runto,m_calPar[3],res,runNo,m_bossver[3]);
543 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
544 }
545
546
547 //EmcCalConst
548 if((cType=="EmcCal")&&(m_bossver[2]== "default" ))
549 {
550 std::string cType="Emc";
551 if(m_bossRelease=="default")
552 {
553 log << MSG::FATAL << " Boss Release for EmcCal not set!" << endreq;
554 exit(1);
555 }
556 else{
557
558 st1=getSftParVer(m_bossver[2],m_calPar[2],runfrm1,runto1,runNo,m_bossRelease,cType);
559 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
560 //cout<<"flag @create Emc is:"<<flag<<endl;
561 if (st1 .isFailure() )
562 {
563 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
564 return st1;
565 }
566 ret = m_meta->getReadEMCInfo(ser,&runfrm,&runto, m_calPar[2], res,runNo,m_bossver[2]);
567 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
568 }
569 }
570 else if((cType=="EmcCal")&&(m_bossver[2]!= "default" ))
571 {
572 m_flag[2]="set";
573 flag=m_flag[2];
574 //cout<<"flag @create Emc is:"<<m_flag[2]<<endl;
575 ret = m_meta->getReadEMCInfo(ser,&runfrm,&runto, m_calPar[2], res,runNo,m_bossver[2]);
576 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
577 }
578
579 //DedxCalConst
580 if((cType=="DedxCal")&&(m_bossver[1]== "default" ))
581 {
582 std::string cType="Dedx";
583 if(m_bossRelease=="default")
584 {
585 log << MSG::FATAL << " Boss Release for DedxCal not set!" << endreq;
586 exit(1);
587 }
588 else
589 {
590 st1=getSftParVer(m_bossver[1],m_calPar[1],runfrm1,runto1,runNo,m_bossRelease,cType);
591 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
592 if (st1 .isFailure() )
593 {
594 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
595 return st1;
596 }
597 ret = m_meta->getReadDedxInfo(ser,&runfrm,&runto, m_calPar[1], res,runNo,m_bossver[1]);
598 // cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
599 }
600 }
601 else if((cType=="DedxCal")&&(m_bossver[1]!= "default" ))
602 {
603 m_flag[1]="set";
604 flag=m_flag[1];
605 //cout<<"flag @create Dedx is:"<<m_flag[1]<<endl;
606 ret = m_meta->getReadDedxInfo(ser,&runfrm,&runto, m_calPar[1], res,runNo,m_bossver[1]);
607 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
608 }
609
610 //MdcCalConst
611 if((cType=="MdcCal")&&(m_bossver[0]== "default" ))
612 {
613 std::string cType="Mdc";
614 //cout<<"cType is"<<cType<<"m_bossver[0] is:"<<m_bossver[0]<<endl;
615 if(m_bossRelease=="default")
616 {
617 log << MSG::FATAL << " Boss Release for MdcCal not set!" << endreq;
618 exit(1);
619 }
620 else
621 {
622 st1=getSftParVer(m_bossver[0],m_calPar[0],runfrm1,runto1,runNo,m_bossRelease,cType);
623 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
624 if (st1 .isFailure() )
625 {
626 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
627 return st1;
628 }
629 ret = m_meta->getReadMDCInfo(ser,&runfrm,&runto,m_calPar[0],res,runNo,m_bossver[0]);
630 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
631
632 }
633 }
634 else if((cType=="MdcCal")&&(m_bossver[0]!= "default"))
635 {
636 m_flag[0]="set";
637 flag=m_flag[0];
638 //cout<<"flag @create Mdc is:"<<m_flag[0]<<endl;
639 ret = m_meta->getReadMDCInfo(ser,&runfrm,&runto, m_calPar[0], res,runNo,m_bossver[0]);
640 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
641
642 }
643
644 //MucCalConst
645 if((cType=="MucCal")&&(m_bossver[4]== "default" ))
646 {
647 std::string cType="Muc";
648 if(m_bossRelease=="default")
649 {
650 log << MSG::FATAL << " Boss Release for MucCal not set!" << endreq;
651 exit(1);
652 }
653 else
654 {
655 st1=getSftParVer(m_bossver[4],m_calPar[4],runfrm1,runto1,runNo,m_bossRelease,cType);
656 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
657 if (st1 .isFailure() )
658 {
659 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
660 return st1;
661 }
662 ret = m_meta->getReadMUCInfo(ser,&runfrm,&runto, m_calPar[4], res,runNo,m_bossver[4]);
663 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
664 }
665 }
666 else if((cType=="MucCal")&&(m_bossver[4]!= "default" ))
667 {
668 m_flag[4]="set";
669 flag=m_flag[4];
670 //cout<<"flag @create Muc is:"<<m_flag[4]<<endl;
671 ret = m_meta->getReadMUCInfo(ser,&runfrm,&runto, m_calPar[4], res,runNo,m_bossver[4]);
672 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
673 }
674
675 //EsTimeCal
676 if((cType=="EsTimeCal")&&(m_bossver[5]== "default" ))
677 {
678 std::string cType="EsTime";
679 if(m_bossRelease=="default")
680 {
681 log << MSG::FATAL << " Boss Release for EsTimeCal not set!" << endreq;
682 exit(1);
683 }
684 else
685 {
686 st1=getSftParVer(m_bossver[5],m_calPar[5],runfrm1,runto1,runNo,m_bossRelease,cType);
687 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
688 if (st1 .isFailure() )
689 {
690 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
691 return st1;
692 }
693 ret = m_meta->getReadEsTimeInfo(ser,&runfrm,&runto,m_calPar[5], res,runNo,m_bossver[5]);
694 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
695 }
696 }
697 else if((cType=="EsTimeCal")&&(m_bossver[5]!= "default" ))
698 {
699 m_flag[5]="set";
700 flag=m_flag[5];
701 //cout<<"flag @create EsTime is:"<<m_flag[5]<<endl;
702 ret = m_meta->getReadEsTimeInfo(ser,&runfrm,&runto, m_calPar[5], res,runNo,m_bossver[5]);
703 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
704 }
705
706 //MdcAlign
707 if((cType=="MdcAlign")&&(m_bossver[7]== "default" ))
708 {
709 std::string cType="MdcAlign";
710 if(m_bossRelease=="default") {
711 log << MSG::FATAL << " Boss Release for MdcAlignCal not set!" << endreq;
712 exit(1);
713 }
714 else {
715 st1=getSftParVer(m_bossver[7],m_calPar[7],runfrm1,runto1,runNo,m_bossRelease,cType);
716 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
717 if (st1 .isFailure() ) {
718 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
719 return st1;
720 }
721 ret = m_meta->getReadMdcAlignInfo(ser,&runfrm,&runto,m_calPar[7], res,runNo,m_bossver[7]);
722 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
723 }
724 }
725 else if((cType=="MdcAlign")&&(m_bossver[7]!= "default" ))
726 {
727 m_flag[7]="set";
728 flag=m_flag[7];
729 //cout<<"flag @create MdcAlign is:"<<m_flag[7]<<endl;
730 ret = m_meta->getReadMdcAlignInfo(ser,&runfrm,&runto, m_calPar[7], res,runNo,m_bossver[7]);
731 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
732 }
733
734 //TofQElec
735 if((cType=="TofQElec")&&(m_bossver[8]== "default" ))
736 {
737 std::string cType="TofQElec";
738 if(m_bossRelease=="default") {
739 log << MSG::FATAL << " Boss Release for TofQElecCal not set!" << endreq;
740 exit(1);
741 }
742 else {
743 //cout<<"TofQElec @create"<<endl;
744 st1=getSftParVer(m_bossver[8],m_calPar[8],runfrm1,runto1,runNo,m_bossRelease,cType);
745 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
746 if (st1 .isFailure() ) {
747 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
748 return st1;
749 }
750 ret = m_meta->getReadTofQElecInfo(ser,&runfrm,&runto,m_calPar[8],res,runNo,m_bossver[8]);
751 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
752 }
753 }
754 else if((cType=="TofQElec")&&(m_bossver[8]!= "default" ))
755 {
756 m_flag[8]="set";
757 flag=m_flag[8];
758 //cout<<"flag @create TofQElec is:"<<flag<<endl;
759 ret = m_meta->getReadTofQElecInfo(ser,&runfrm,&runto, m_calPar[8], res,runNo,m_bossver[8]);
760 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
761 }
762
763 //TofSim
764 if((cType=="TofSim")&&(m_bossver[9]== "default" ))
765 {
766 std::string cType="TofSim";
767 if(m_bossRelease=="default") {
768 log << MSG::FATAL << " Boss Release for TofSimCal not set!" << endreq;
769 exit(1);
770 }
771 else {
772 st1=getSftParVer(m_bossver[9],m_calPar[9],runfrm1,runto1,runNo,m_bossRelease,cType);
773 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
774 if (st1 .isFailure() ) {
775 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
776 return st1;
777 }
778 ret = m_meta->getReadTofSimInfo(ser,&runfrm,&runto, m_calPar[9], res,runNo,m_bossver[9]);
779 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
780 }
781 }
782 else if((cType=="TofSim")&&(m_bossver[9]!= "default" ))
783 {
784 m_flag[9]="set";
785 flag=m_flag[9];
786 //cout<<"flag @create TofSim is:"<<m_flag[9]<<endl;
787 ret = m_meta->getReadTofSimInfo(ser,&runfrm,&runto, m_calPar[9], res,runNo,m_bossver[9]);
788 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
789 }
790
791 //DedxSim
792 if((cType=="DedxSim")&&(m_bossver[10]== "default" ))
793 {
794 std::string cType="DedxSim";
795 if(m_bossRelease=="default") {
796 log << MSG::FATAL << " Boss Release for DedxSimCal not set!" << endreq;
797 exit(1);
798 }
799 else {
800 st1=getSftParVer(m_bossver[10],m_calPar[10],runfrm1,runto1,runNo,m_bossRelease,cType);
801 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
802 if (st1 .isFailure() ) {
803 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
804 return st1;
805 }
806 ret = m_meta->getReadDedxSimInfo(ser,&runfrm,&runto,m_calPar[10], res,runNo,m_bossver[10]);
807 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
808 }
809 }
810 else if((cType=="DedxSim")&&(m_bossver[10]!= "default" ))
811 {
812 m_flag[10]="set";
813 flag=m_flag[10];
814 //cout<<"flag @create DedxSim is:"<<m_flag[10]<<endl;
815 ret = m_meta->getReadDedxSimInfo(ser,&runfrm,&runto, m_calPar[10], res,runNo,m_bossver[10]);
816 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
817 }
818
819 //MdcDataConst
820 if((cType=="MdcDataConst")&&(m_bossver[11]== "default" ))
821 {
822 std::string cType="MdcData";
823 if(m_bossRelease=="default") {
824 log << MSG::FATAL << " Boss Release for MdcDataConst not set!" << endreq;
825 exit(1);
826 }
827 else {
828 st1=getSftParVer(m_bossver[11],m_calPar[11],runfrm1,runto1,runNo,m_bossRelease,cType);
829 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
830 if (st1 .isFailure() ) {
831 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
832 return st1;
833 }
834 ret = m_meta->getReadMdcDataConstInfo(ser,&runfrm,&runto,m_calPar[11], res,runNo,m_bossver[11]);
835 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
836 }
837 }
838 else if((cType=="MdcDataConst")&&(m_bossver[11]!= "default" ))
839 {
840 m_flag[11]="set";
841 flag=m_flag[11];
842 //cout<<"flag @create MdcData is:"<<m_flag[11]<<endl;
843 ret = m_meta->getReadMdcDataConstInfo(ser,&runfrm,&runto, m_calPar[11], res,runNo,m_bossver[11]);
844 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
845 }
846
847 //EstTofCalConst
848 if((cType=="EstTofCal")&&(m_bossver[6]== "default" ))
849 {
850 std::string cType="EsTof";
851 if(m_bossRelease=="default") {
852 log << MSG::FATAL << " Boss Release for EstTofCal not set!" << endreq;
853 exit(1);
854 }
855 else {
856 st1=getSftParVer(m_bossver[6],m_calPar[6],runfrm1,runto1,runNo,m_bossRelease,cType);
857 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
858 if (st1 .isFailure() ) {
859 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
860 return st1;
861 }
862 ret = m_meta->getReadEstTofInfo(ser,&runfrm,&runto,m_calPar[6],res,runNo,m_bossver[6]);
863 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
864 }
865 }
866 else if((cType=="EstTofCal")&&(m_bossver[6]!= "default" ))
867 {
868 m_flag[6]="set";
869 flag=m_flag[6];
870 //cout<<"flag @create EstTof is:"<<m_flag[6]<<endl;
871 ret = m_meta->getReadEstTofInfo(ser,&runfrm,&runto, m_calPar[6], res,runNo,m_bossver[6]);
872 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
873 }
874//Top_up Qiumei Ma
875 //InjSigIntercal
876 if((cType=="InjSigInterval")&&(m_bossver[12]== "default" ))
877 {
878 std::string cType="InjSigInterval";
879 if(m_bossRelease=="default")
880 {
881 log << MSG::FATAL << " Boss Release for InjSigInterval not set!" << endreq;
882 exit(1);
883 }
884 else
885 {
886 st1=getSftParVer(m_bossver[12],m_calPar[12],runfrm1,runto1,runNo,m_bossRelease,cType);
887 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
888 if (st1 .isFailure() )
889 {
890 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
891 return st1;
892 }
893 ret = m_meta->getReadInjSigIntervalInfo(ser,&runfrm,&runto,m_calPar[12],res,runNo,m_bossver[12]);
894 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
895 }
896 }
897 else if((cType=="InjSigInterval")&&(m_bossver[12]!= "default"))
898 {
899 m_flag[12]="set";
900 flag=m_flag[12];
901 ret = m_meta->getReadInjSigIntervalInfo(ser,&runfrm,&runto, m_calPar[12], res,runNo,m_bossver[12]);
902 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
903
904 }
905
906 //InjSigTime
907 if((cType=="InjSigTime")&&(m_bossver[13]== "default" ))
908 {
909 std::string cType="InjSigTime";
910 if(m_bossRelease=="default")
911 {
912 log << MSG::FATAL << " Boss Release for InjSigTime not set!" << endreq;
913 exit(1);
914 }
915 else
916 {
917 st1=getSftParVer(m_bossver[13],m_calPar[13],runfrm1,runto1,runNo,m_bossRelease,cType);
918 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
919 if (st1 .isFailure() )
920 {
921 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
922 return st1;
923 }
924 ret = m_meta->getReadInjSigTimeInfo(ser,&runfrm,&runto,m_calPar[13],res,runNo,m_bossver[13]);
925 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
926 }
927 }
928 else if((cType=="InjSigTime")&&(m_bossver[13]!= "default"))
929 {
930 m_flag[13]="set";
931 flag=m_flag[13];
932 ret = m_meta->getReadInjSigTimeInfo(ser,&runfrm,&runto, m_calPar[13], res,runNo,m_bossver[13]);
933 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
934
935 }
936
937//OffEvtFilter
938 if((cType=="OffEvtFilter")&&(m_bossver[14]== "default" ))
939 {
940 std::string cType="OffEvtFilter";
941 if(m_bossRelease=="default")
942 {
943 log << MSG::FATAL << " Boss Release for OffEvtFilter not set!" << endreq;
944 exit(1);
945 }
946 else
947 {
948 st1=getSftParVer(m_bossver[14],m_calPar[14],runfrm1,runto1,runNo,m_bossRelease,cType);
949 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
950 if (st1 .isFailure() )
951 {
952 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
953 return st1;
954 }
955 ret = m_meta->getReadOffEvtFilterInfo(ser,&runfrm,&runto,m_calPar[14],res,runNo,m_bossver[14]);
956 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
957 }
958 }
959 else if((cType=="OffEvtFilter")&&(m_bossver[14]!= "default"))
960 {
961 m_flag[14]="set";
962 flag=m_flag[14];
963 ret = m_meta->getReadOffEvtFilterInfo(ser,&runfrm,&runto, m_calPar[14], res,runNo,m_bossver[14]);
964 //cout<<cType<<"::runfrom, runto @create "<<" are:"<<runfrm<<"::"<<runto<<endl;
965
966 }
967
968 //CorrectedETS
969 if(cType=="CorrectedETS")
970 {
971 std::string cType="CorrectedETS";
972 //cout<<"First Event is:::"<<FirstEvent<<endl;
973 ret = m_meta->getReadCorrectedETSInfo(ser,runNo,FirstEvent,m_calPar[15],res);
974
975 int _strlenRun = strlen((*res[0])["Run"]) + 1;
976 char* _pStatus = new char[3];
977 char* _pRunFrom = new char[_strlenRun];
978 char* _pRunTo = new char[_strlenRun];
979 memcpy(_pStatus, "OK", 3);
980 memcpy(_pRunFrom, (*res[0])["Run"], _strlenRun);
981 memcpy(_pRunTo, (*res[0])["Run"], _strlenRun);
982
983 (*res[0])["Status"] = _pStatus;
984 (*res[0])["RunFrom"] = _pRunFrom;
985 (*res[0])["RunTo"] = _pRunTo;
986 runfrm1 = runNo;
987 runto1 = runNo;
988 }
989
991 log << MSG::ERROR << "no record in the database" << endreq;
992 exit(1);
993 }
994 int sz=res.size();
995 DatabaseRecord* records1 = res[0];
996 if(m_dbStatus=="OK"){
997 if(std::string((*records1)["Status"])!="OK") {
998 log<<MSG::FATAL<<"Status of type "<<cType<<" is "<< (*records1)["Status"]<<" your setting is OK"<<endreq;
999 exit(1);
1000 }
1001 }
1002
1003 log << MSG::DEBUG << "dataIdent is:"<<dataIdent<< endreq;
1004 unsigned char storageType;
1005 physFmt="TREE";
1006 StatusCode sc = decodeDescription(physFmt, storageType);
1007
1008
1009 // Depending on value of eDataFmt, figure out which private
1010 // conversion service to invoke. Pass dataIdent and fmtVersion
1011 // as part of the opaque address.
1012 // Create temporary address for the relevant type and classID
1013 log << MSG::DEBUG << "Creating an address of type "
1014 << (int)storageType << " for class " << classID << endreq;
1015
1016 IOpaqueAddress* tmpAddress;
1017 const std::string par[3] = {dataIdent, fullpath, fmtVersion};
1018 //const unsigned long ipar[2] = {int(runfrm),int(runto)};
1019 //log << MSG::DEBUG << "ipar is:"<<ipar[0]<<":"<<ipar[1]<<"ipar[1]"<<endreq;
1020 const unsigned long ipar[2] = {0,0};//yzhang fix unsigned bug for runfrom runto
1021
1022 // sc = addressCreator()->createAddress(storageType, classID,
1023 // par, ipar, tmpAddress);
1024
1025 tmpAddress = new TreeAddress(storageType, classID,*records1,ipar);
1026 //sscanf((*records2)["RunFrom"], "%d", &runfrm1);
1027 //sscanf((*records2)["RunTo"], "%d", &runto1);
1028 sscanf((*records1)["RunFrom"], "%d", &runfrm);
1029 sscanf((*records1)["RunTo"], "%d", &runto);
1030 log << MSG::DEBUG << __LINE__<<" records @ runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
1031 //log << MSG::DEBUG <<__LINE__<< " runfrm is:"<<runfrm<<" runto is:"<<runto<<" ser_no is:"<<ser<<endreq;
1032 if(flag=="default")
1033 {
1034 if(runfrm1>runfrm)
1035 {
1036 runfrm=runfrm1;
1037 }
1038 if(runto1<runto)
1039 {
1040 runto=runto1;
1041 }
1042 }
1043 if(flag=="set")
1044 {
1045 flag="default";
1046 }
1047 log << MSG::DEBUG <<__LINE__<< " runfrm of max is:"<<runfrm<<" runto min is:"<<runto<<endreq;
1048 TreeAddress* treeAddress = dynamic_cast <TreeAddress*> (tmpAddress);
1049 treeAddress->setRunFrom(runfrm);
1050 treeAddress->setRunTo(runto);
1051// log << MSG::DEBUG << __LINE__<<" records @ runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
1052// log << MSG::DEBUG <<__LINE__<< " runfrm is:"<<runfrm<<" runto is:"<<runto<<" ser_no is:"<<ser<<endreq;
1053 /*
1054 if ( !sc.isSuccess() ) {
1055 log << msgLevel << "Persistency service could not create a new address" << endreq;
1056 if (m_crash) {
1057 log << msgLevel << std::endl << "Exiting... " << std::endl << endreq;
1058 exit(1);
1059 }
1060 return sc;
1061 }
1062 */
1063 tmpAddress->addRef();
1064
1065 // Set the transient store registry for the object associated to this address
1066 tmpAddress->setRegistry(entry);
1067
1068 // Now create the object
1069 sc = m_detPersSvc->createObj(tmpAddress, refpObject);
1070 tmpAddress->release();
1071 if ( !sc.isSuccess() ) {
1072 log << msgLevel
1073 << "Persistency service could not create a new object" << endreq;
1074 if (m_crash) {
1075 log << msgLevel << std::endl << "Exiting... " << std::endl << endreq;
1076 exit(1);
1077 }
1078 return sc;
1079 }
1080 // std::cout<<" CalibMySQLCnvSvc res.size()=="<<res.size()<<std::endl;
1081 res.clear();
1082 log << MSG::DEBUG << "New object successfully created" << endreq;
1083 return StatusCode::SUCCESS;
1084 f1->Close();
1085 delete f1;
1086}
int runNo
Definition: DQA_TO_DB.cxx:12
static std::string getCalibType(const std::string &fullpath)
Return calibration type name, extracted from full path name in TCDS.
virtual StatusCode decodeDescription(const std::string &description, unsigned char &type)
Decode the string storage type to enumerated storage type.
StatusCode getSftParVer(std::string &SftVer, std::string &CalParVer, int &runfrm, int &runto, int RunNo, std::string BossRelease, std::string DataType)
void setRunFrom(int runFrom)
set run from
Definition: TreeAddress.h:140
void setRunTo(int runTo)
set run to
Definition: TreeAddress.h:144
eRet getReadMdcDataConstInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:892
eRet getReadEsTimeInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:702
eRet getReadInjSigTimeInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:412
eRet getReadTOFInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:507
eRet getReadDedxSimInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:817
eRet getReadMUCInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:543
eRet getReadEstTofInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:740
eRet getReadTofSimInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:778
eRet getReadOffEvtFilterInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:447
eRet getReadDedxInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:663
eRet getReadInjSigIntervalInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:377
eRet getReadCorrectedETSInfo(unsigned int serialNo, int runNo, int FirstEvent, std::string &Version, DatabaseRecordVector &res)
Definition: Metadata.cxx:483
eRet getReadMdcAlignInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:855
eRet getReadMDCInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:583
eRet getReadTofQElecInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:928
eRet getReadEMCInfo(unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver)
Definition: Metadata.cxx:624

Referenced by createObj().

◆ createObj()

StatusCode CalibMySQLCnvSvc::createObj ( IOpaqueAddress *  pAddress,
DataObject *&  refpObject 
)
virtual

Create a transient representation from another rep of this object.

Create a transient representation from another representation of an object. Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters. (The typical conversion service delegates this to an appropriate converter)

Definition at line 263 of file CalibMySQLCnvSvc.cxx.

264 {
265
266 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
267
268
269 // Create the object according to calib type, flavor, time, instrument, clid.
270 // Notice that the CalibMySQLCnvSvc has no converters of its own:
271 // object creation is delegated to another CnvSvc via a temporary address
272 // The IOpaqueAddress specifies calibration type and specific flavor.
273 // The secondary storage type is always discovered dynamically
274 StatusCode sc;
275 sc = createCalib(refpObject,
276 pAddress->par()[0],
277 pAddress->clID(),
278 pAddress->registry() );
279
280 if ( !sc.isSuccess() ) {
281 log << MSG::ERROR << "Could not create calib DataObject" << endreq;
282 }
283 log << MSG::DEBUG << "Method createObj exiting" << endreq;
284 return sc;
285}
virtual StatusCode createCalib(DataObject *&refpObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)

◆ createRep()

StatusCode CalibMySQLCnvSvc::createRep ( DataObject *  pObject,
IOpaqueAddress *&  refpAddress 
)
virtual

Convert a transient object to a requested representation.

Convert a transient object to a requested representation. Not implemented. Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters.

Definition at line 337 of file CalibMySQLCnvSvc.cxx.

338 {
339
340 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
341 // log << MSG::WARNING << "Method createRep is not implemented" << endreq;
342 return StatusCode::SUCCESS;
343}

◆ decodeDescription()

StatusCode CalibMySQLCnvSvc::decodeDescription ( const std::string &  description,
unsigned char &  type 
)
virtual

Decode the string storage type to enumerated storage type.

Definition at line 1516 of file CalibMySQLCnvSvc.cxx.

1518{
1519 MsgStream log(msgSvc(), "CalibMySQLCnvSvc");
1520
1521 // description ="ROOT";
1522 if (description == std::string("XML")) {
1523 type = XML_StorageType;
1524 }
1525 else if (description == std::string("ROOT")) {
1526 type = CALIBROOT_StorageType;
1527 }
1528 else if (description == std::string("TREE")) {
1529 type = CALIBTREE_StorageType;
1530 }
1531 else { // unsupported
1532 log << MSG::ERROR << "unsupported storage type " << description << endreq;
1533 return StatusCode::FAILURE;
1534 }
1535 return StatusCode::SUCCESS;
1536}
unsigned const char CALIBROOT_StorageType
Definition: ICalibRootSvc.h:20
unsigned const char CALIBTREE_StorageType
Definition: ICalibTreeSvc.h:20

Referenced by createCalib(), and updateCalib().

◆ fillObjRefs()

StatusCode CalibMySQLCnvSvc::fillObjRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Resolve the references of the created transient object.

Resolve the references of the created transient object. (Actually, don't, because this operation isn't supported, nor is it needed for the conversion service.) Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters.

Definition at line 291 of file CalibMySQLCnvSvc.cxx.

292 {
293 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
294 return StatusCode::SUCCESS;
295}

◆ fillRepRefs()

StatusCode CalibMySQLCnvSvc::fillRepRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Resolve the references of a converted object.

Resolve the references of a converted object. [actually, don't. Calib data doesn't have any inter-object references.] Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters.

Definition at line 349 of file CalibMySQLCnvSvc.cxx.

350 {
351 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
352 // log << MSG::WARNING << "Method fillRepRefs is not implemented" << endreq;
353 return StatusCode::SUCCESS;
354}

◆ finalize()

StatusCode CalibMySQLCnvSvc::finalize ( )
virtual

Definition at line 235 of file CalibMySQLCnvSvc.cxx.

236{
237 MsgStream log(msgSvc(), "CalibMySQLCnvSvc");
238 log << MSG::DEBUG << "Finalizing" << endreq;
239 delete m_meta;
240 m_meta = 0;
241 return ConversionSvc::finalize();
242}

◆ getMeta()

calibUtil::Metadata * CalibMySQLCnvSvc::getMeta ( )
virtual

Handle to the MySQL metadata database.

Implements ICalibMetaCnvSvc.

Definition at line 1540 of file CalibMySQLCnvSvc.cxx.

1540 {
1541 return m_meta;
1542}

◆ getSftParVer()

StatusCode CalibMySQLCnvSvc::getSftParVer ( std::string &  SftVer,
std::string &  CalParVer,
int &  runfrm,
int &  runto,
int  RunNo,
std::string  BossRelease,
std::string  DataType 
)

Definition at line 406 of file CalibMySQLCnvSvc.cxx.

414{
415 using namespace rdbModel;
416 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
417 char stmt[300];
418 int run_No =RunNo;
419 MYSQL_RES *res_set;
420 IDatabaseSvc* m_dbsvc;
421 DatabaseRecordVector res,res1;
422 StatusCode sc=serviceLocator()->service("DatabaseSvc",m_dbsvc,true);
423 if (sc .isFailure() ) {
424 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
425 return sc;
426 }
427 const char* bossRelease = BossRelease.c_str();
428 const char* dataType = DataType.c_str();
429
430 sprintf(stmt,"select RunFrom,RunTo,SftVer,ParVer from CalVtxLumVer where BossRelease = '%s' and RunFrom <= %d and RunTo >= %d and DataType='%s' ",bossRelease,run_No,run_No,dataType);
431
432 int row_no = m_dbsvc->query("offlinedb",stmt,res);
433 if(row_no<1){
434 std::cout<<"ERROR:error searching with:"<<stmt<<std::endl;
435 exit(1);
436 }
437 if(row_no=1){
438 DatabaseRecord* records1 = res[0];
439 runfrm=records1->GetInt("RunFrom");
440 runto=records1->GetInt("RunTo");
441 //cout<<dataType<<" runfrm,runto in getSftParVer is:"<<runfrm<<"::::"<<runto<<endl;
442 SftVer=records1->GetString("SftVer");
443 CalParVer=records1->GetString("ParVer");
444 }
445 if(row_no>1){
446 cout<<"ERROR: "<<dataType<<" set overlapped run number in the table CalVtxLumVer"<<endl;
447 exit(1);
448 }
449 //cout<<"getSftParVer end()::::getSftParVer"<<endl;
450 return StatusCode::SUCCESS;
451}
char * SftVer
Definition: DQA_TO_DB.cxx:18
struct st_mysql_res MYSQL_RES
int GetInt(std::string key)
std::string GetString(std::string key)
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)

Referenced by createCalib(), and updateCalib().

◆ initialize()

StatusCode CalibMySQLCnvSvc::initialize ( )
virtual

Definition at line 139 of file CalibMySQLCnvSvc.cxx.

140{
141 // Initialize base class
142 StatusCode sc = ConversionSvc::initialize();
143 if ( !sc.isSuccess() ) return sc;
144
145 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
146 log << MSG::INFO << "Specific initialization starting" << endreq;
147
148 IDataProviderSvc* pCDS = 0;
149 sc = serviceLocator()->getService ("CalibDataSvc", IDataProviderSvc::interfaceID(), (IInterface*&)pCDS);
150
151 if ( !sc.isSuccess() ) {
152 log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq;
153 return sc;
154 }
155
156 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
157 if (sc .isFailure() ) {
158 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
159 return sc;
160 }
161
162 // Set the CalibDataSvc as data provider service
163 sc = setDataProvider(pCDS);
164 if ( !sc.isSuccess() ) {
165 log << MSG::ERROR << "Could not set data provider" << endreq;
166 return sc;
167 }
168
169 // Query the IAddressCreator interface of the detector persistency service
170
171 sc = serviceLocator()->service
172 ("DetectorPersistencySvc", m_detPersSvc, true);
173 if ( !sc.isSuccess() ) {
174 log << MSG::ERROR
175 << "Cannot locate IConversionSvc interface of DetectorPersistencySvc"
176 << endreq;
177 return sc;
178 } else {
179 log << MSG::DEBUG
180 << "Retrieved IConversionSvc interface of DetectorPersistencySvc"
181 << endreq;
182 }
183
184 IAddressCreator* iAddrCreator;
185 sc = m_detPersSvc->queryInterface(IAddressCreator::interfaceID(),(void**) &iAddrCreator);
186 // sc = m_detPersSvc->queryInterface(IID_IAddressCreator,(void**) &iAddrCreator);
187 if ( !sc.isSuccess() ) {
188 log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq;
189 return sc;
190 }
191
192 sc = setAddressCreator(iAddrCreator);
193 if ( !sc.isSuccess() ) {
194 log << MSG::ERROR << "Cannot set the address creator" << endreq;
195 return sc;
196 }
197
198 // Get properties from the JobOptionsSvc
199 sc = setProperties();
200 if ( !sc.isSuccess() ) {
201 log << MSG::ERROR << "Could not set jobOptions properties" << endreq;
202 return sc;
203 }
204 log << MSG::DEBUG << "Properties were read from jobOptions" << endreq;
205
206 // Translate list of calibration quality names to bit mask form used
207 // by calibUtil::Metadata::findBest Defaults to PROD + DEV for now
208 // (that was old fixed value)
209 m_qualityMask = toQualityMask(m_qualityList);
210 if (!m_qualityMask) {
211 m_qualityMask = calibUtil::Metadata::LEVELProd |
213 }
214
215 // Make a calibUtil::Metadata instance
216 // Conceivably, could start up a different conversion service, depending
217 // on job options parameters, which would look very much like this one
218 // except for having a different way to access metadata.
219 m_meta = new calibUtil::Metadata(m_host, "*", m_dbName);
220
221 if (!m_meta) {
222 log << MSG::ERROR << "Could not open connection to metadata dbs" << endreq;
223 return MSG::ERROR;
224 }
225 // Probably should get this value from job options.
226 // Now we do. See m_qualityMask, m_qualityList
227 // m_calibLevelMask = calibUtil::Metadata::LEVELProd +
228 // calibUtil::Metadata::LEVELDev;
229
230 log << MSG::INFO << "Specific initialization completed" << endreq;
231 return sc;
232}

◆ queryInterface()

StatusCode CalibMySQLCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Definition at line 245 of file CalibMySQLCnvSvc.cxx.

247{
248 if ( IID_ICalibMetaCnvSvc == riid ) {
249 // With the highest priority return the specific interface of this service
250 *ppvInterface = (ICalibMetaCnvSvc*)this;
251 } else {
252 // Interface is not directly available: try out a base class
253 return ConversionSvc::queryInterface(riid, ppvInterface);
254 }
255 addRef();
256 return StatusCode::SUCCESS;
257}

◆ updateCalib()

StatusCode CalibMySQLCnvSvc::updateCalib ( DataObject *  pObject,
const std::string &  fullpath,
const CLID &  classID,
IRegistry *  entry = 0 
)
virtual

Update a condition DataObject by This method does not register DataObject in the transient data store. The string storage type is discovered at runtime in the metadata dbs.

Update a calib DataObject by calib type, flavor,and instrument if necessary. This method does not register DataObject in the transient data store, The string storage type is discovered at runtime in the MySQL dbs. Implementation:

  • create a temporary address containing storage type and classID;
  • dispatch to appropriate conversion service according to storage type;
  • this will dispatch to appropriate converter according to CLID (the CalibMySQLCnvSvc has no converters of its own).

Implements ICalibMetaCnvSvc.

Definition at line 1099 of file CalibMySQLCnvSvc.cxx.

1103{
1105
1106 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
1107 StatusCode status;
1108
1109 std::string testfile = std::string(getenv("CALIBMYSQLCNVROOT"))+"/share/test.root";
1110 TFile *f1=new TFile(testfile.c_str(),"read");
1111
1112
1113 // Look up calib object in the Metadata database
1114 //std::string flavor = CalibData::CalibModelSvc::getFlavor(fullpath);
1115 std::string cType = CalibData::CalibModelSvc::getCalibType(fullpath);
1116
1117 // ..and extra special munging for test
1118 if (std::string("Test") == cType.substr(0, 4)) {
1119 cType = std::string("Test_Gen");
1120 }
1121
1122 if (0 == pObject) {
1123 log << MSG::ERROR << "There is no DataObject to update" << endreq;
1124 return StatusCode::FAILURE;
1125 }
1126 // Is object an instance of the specified class?
1127 if(pObject->clID()!=6411&& classID!=6411){
1128 if ( classID != pObject->clID() ) {
1129 log << MSG::ERROR << "Update requested for clID " << classID
1130 << " while DataObject is of clID "
1131 << pObject->clID() << endreq;
1132 exit(1);
1133 return StatusCode::FAILURE;
1134 }
1135 }
1136
1137 // check if already valid. If so, we're done.
1138 // Need access to IValidity interface
1139 CalibBase1* pBase = dynamic_cast<CalibBase1*>(pObject);
1140 if (pBase == 0) {
1141 log << MSG::WARNING
1142 << "Object to be updated is not a calib object! " << endreq;
1143 return StatusCode::FAILURE;
1144 }
1145
1146 // Following comes from createCalib. Perhaps create and update
1147 // should be calling common utility since much of what they do is identical.
1148 unsigned int ser;
1149 int runfrm,runfrm1;
1150 int runto,runto1;
1152
1153 // calibUtil::Metadata::eDataFmt physFmt = calibUtil::Metadata::FMTUnknown;
1154 std::string physFmt;
1155 std::string fmtVersion;
1156 std::string dataIdent;
1157 std::string flag="default";
1158 // Get the information needed to find and interpret the bulk data:
1159 // * physical storage type
1160 // * version of the physical format
1161 // * pathname or similar identifying information so the data can be found
1162 // maqm comment remove fmtversion :
1163 // ret = m_meta->getReadInfo(ser, physFmt, fmtVersion, dataIdent);
1164
1165 SmartDataPtr<Event::EventHeader> evt(m_eventSvc,"/Event/EventHeader");
1166 int runNo=0;
1167 if( !evt ){
1168 log << MSG::WARNING << "Unable to read the Event for TDS" << endreq;
1169 // return StatusCode::FAILURE;
1170 }
1171
1172 // eRet ret;
1173
1175 StatusCode st1;
1176 if( evt ){
1177 if(cType!="TofCal"&&cType!="EstTofCal"&&cType!="TofSim"&&cType!="DedxSim") runNo = fabs(evt -> runNumber());
1178 if(cType=="TofCal"||cType=="EstTofCal"||cType=="TofSim"||cType=="DedxSim") runNo = evt -> runNumber();
1179 }
1180
1181 //TofCalConst
1182 if((cType=="TofCal"))
1183 {
1184 std::string cType="Tof";
1185 if(m_flag[3]=="default")
1186 {
1187 st1=getSftParVer(m_bossver[3],m_calPar[3],runfrm1,runto1,runNo,m_bossRelease,cType);
1188 cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1189 if (st1 .isFailure() )
1190 {
1191 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1192 return st1;
1193 }
1194 }
1195
1196 flag=m_flag[3];
1197
1198 //cout<<"flag @update Tof is:"<<flag<<endl;
1199 //cout<<"SftVer and CalParVer are:"<<sft_ver<<";"<<cal_ver<<endl;
1200 ret = m_meta->getReadTOFInfo(ser,&runfrm,&runto,m_calPar[3],res,runNo,m_bossver[3]);
1201 //cout<<"runfrom, runto @update "<<cType<<" are:"<<runfrm<<"::"<<runto<<endl;
1202 }
1203
1204 //EmcCalConst
1205 if((cType=="EmcCal"))
1206 {
1207 std::string cType="Emc";
1208 if(m_flag[2]=="default")
1209 {
1210 st1=getSftParVer(m_bossver[2],m_calPar[2],runfrm1,runto1,runNo,m_bossRelease,cType);
1211 //cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1212 if (st1 .isFailure() )
1213 {
1214 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1215 return st1;
1216 }
1217 }
1218 flag=m_flag[2];
1219 //cout<<"flag @update Emc is:"<<m_flag[2]<<endl;
1220 ret = m_meta->getReadEMCInfo(ser,&runfrm,&runto, m_calPar[2], res,runNo,m_bossver[2]);
1221 //cout<<"runfrom, runto @update "<<cType<<" are:"<<runfrm<<"::"<<runto<<endl;
1222 }
1223
1224
1225
1226 //DedxCalConst
1227 if((cType=="DedxCal"))
1228 {
1229 std::string cType="Dedx";
1230 if(m_flag[1]=="default")
1231 {
1232 st1=getSftParVer(m_bossver[1],m_calPar[1],runfrm1,runto1,runNo,m_bossRelease,cType);
1233 //cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1234 if (st1 .isFailure() )
1235 {
1236 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1237 return st1;
1238 }
1239 }
1240 flag=m_flag[1];
1241 //cout<<"flag @update Dedx is:"<<m_flag[1]<<endl;
1242 ret = m_meta->getReadDedxInfo(ser,&runfrm,&runto, m_calPar[1], res,runNo,m_bossver[1]);
1243 }
1244
1245 //MdcCalConst
1246 if((cType=="MdcCal"))
1247 {
1248 std::string cType="Mdc";
1249 if(m_flag[0]=="default")
1250 {
1251 //cout<<"cType is"<<cType<<"m_bossver[0] is:"<<m_bossver[0]<<endl;
1252 st1=getSftParVer(m_bossver[0],m_calPar[0],runfrm1,runto1,runNo,m_bossRelease,cType);
1253 //cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1254 if (st1 .isFailure() )
1255 {
1256 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1257 return st1;
1258 }
1259 }
1260 flag=m_flag[0];
1261 //cout<<"flag @update Mdc is:"<<m_flag[0]<<endl;
1262 ret = m_meta->getReadMDCInfo(ser,&runfrm,&runto,m_calPar[0],res,runNo,m_bossver[0]);
1263 //cout<<"runfrom, runto @update "<<cType<<" are:"<<runfrm<<"::"<<runto<<endl;
1264 }
1265
1266 //MucCalConst
1267 if((cType=="MucCal"))
1268 {
1269 std::string cType="Muc";
1270 if(m_flag[4]=="default")
1271 {
1272 st1=getSftParVer(m_bossver[4],m_calPar[4],runfrm1,runto1,runNo,m_bossRelease,cType);
1273 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1274 if (st1 .isFailure() )
1275 {
1276 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1277 return st1;
1278 }
1279 }
1280 flag=m_flag[4];
1281 //cout<<"flag @update Muc is:"<<m_flag[4]<<endl;
1282 ret = m_meta->getReadMUCInfo(ser,&runfrm,&runto, m_calPar[4], res,runNo,m_bossver[4]);
1283 }
1284
1285 //EsTimeCal
1286 if((cType=="EsTimeCal"))
1287 {
1288 std::string cType="EsTime";
1289 if(m_flag[5]=="default")
1290 {
1291 st1=getSftParVer(m_bossver[5],m_calPar[5],runfrm1,runto1,runNo,m_bossRelease,cType);
1292 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1293 if (st1 .isFailure() )
1294 {
1295 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1296 return st1;
1297 }
1298 }
1299 flag=m_flag[5];
1300 //cout<<"flag @update EsTime is:"<<m_flag[5]<<endl;
1301 ret = m_meta->getReadEsTimeInfo(ser,&runfrm,&runto,m_calPar[5], res,runNo,m_bossver[5]);
1302 }
1303
1304 //MdcAlign
1305 if((cType=="MdcAlign"))
1306 {
1307 std::string cType="MdcAlign";
1308 if(m_flag[7]=="default")
1309 {
1310 st1=getSftParVer(m_bossver[7],m_calPar[7],runfrm1,runto1,runNo,m_bossRelease,cType);
1311 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1312 if (st1 .isFailure() ) {
1313 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1314 return st1;
1315 }
1316 }
1317 flag=m_flag[7];
1318 //cout<<"flag @update MdcAlign is:"<<m_flag[7]<<endl;
1319 ret = m_meta->getReadMdcAlignInfo(ser,&runfrm,&runto,m_calPar[7], res,runNo,m_bossver[7]);
1320 }
1321
1322 //TofQElec
1323 if((cType=="TofQElec"))
1324 {
1325 std::string cType="TofQElec";
1326 if(m_flag[8]=="default")
1327 {
1328 //cout<<"TofQElec @update"<<endl;
1329 st1=getSftParVer(m_bossver[8],m_calPar[8],runfrm1,runto1,runNo,m_bossRelease,cType);
1330 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1331 }
1332 flag=m_flag[8];
1333 //cout<<"flag @update TofQElec is:"<<m_flag[8]<<endl;
1334 ret = m_meta->getReadTofQElecInfo(ser,&runfrm,&runto,m_calPar[8],res,runNo,m_bossver[8]);
1335 //cout<<"runfrom, runto @TofQElec are:"<<runfrm<<"::"<<runto<<endl;
1336 }
1337
1338 //TofSim
1339 if((cType=="TofSim"))
1340 {
1341 std::string cType="TofSim";
1342 if(m_flag[9]=="default")
1343 {
1344 st1=getSftParVer(m_bossver[9],m_calPar[9],runfrm1,runto1,runNo,m_bossRelease,cType);
1345 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1346 if (st1 .isFailure() ) {
1347 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1348 return st1;
1349 }
1350 }
1351 flag=m_flag[9];
1352 //cout<<"flag @update TofSim is:"<<m_flag[9]<<endl;
1353 ret = m_meta->getReadTofSimInfo(ser,&runfrm,&runto, m_calPar[9], res,runNo,m_bossver[9]);
1354 //cout<<"runfrom, runto @TofSim are:"<<runfrm<<"::"<<runto<<endl;
1355 }
1356
1357 //DedxSim
1358 if((cType=="DedxSim"))
1359 {
1360 std::string cType="DedxSim";
1361 if(m_flag[10]=="default")
1362 {
1363 st1=getSftParVer(m_bossver[10],m_calPar[10],runfrm1,runto1,runNo,m_bossRelease,cType);
1364 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1365 if (st1 .isFailure() ) {
1366 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1367 return st1;
1368 }
1369 }
1370 flag=m_flag[10];
1371 //cout<<"flag @update DedxSim is:"<<m_flag[10]<<endl;
1372 ret = m_meta->getReadDedxSimInfo(ser,&runfrm,&runto,m_calPar[10], res,runNo,m_bossver[10]);
1373 //cout<<"runfrom, runto @DedxSim are:"<<runfrm<<"::"<<runto<<endl;
1374 }
1375
1376 //MdcDataConst
1377 if((cType=="MdcDataConst"))
1378 {
1379 std::string cType="MdcData";
1380 if(m_flag[11]=="default")
1381 {
1382 st1=getSftParVer(m_bossver[11],m_calPar[11],runfrm1,runto1,runNo,m_bossRelease,cType);
1383 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1384 if (st1 .isFailure() ) {
1385 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1386 return st1;
1387 }
1388 }
1389 flag=m_flag[11];
1390 //cout<<"flag @update MdcData is:"<<m_flag[11]<<endl;
1391 ret = m_meta->getReadMdcDataConstInfo(ser,&runfrm,&runto,m_calPar[11], res,runNo,m_bossver[11]);
1392 //cout<<"runfrom, runto @MdcDataConst are:"<<runfrm<<"::"<<runto<<endl;
1393 }
1394
1395 //EstTofCalConst
1396 if((cType=="EstTofCal"))
1397 {
1398 std::string cType="EsTof";
1399 if(m_flag[6]=="default")
1400 {
1401 st1=getSftParVer(m_bossver[6],m_calPar[6],runfrm1,runto1,runNo,m_bossRelease,cType);
1402 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1403 if (st1 .isFailure() ) {
1404 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1405 return st1;
1406 }
1407 }
1408 flag=m_flag[6];
1409 //cout<<"flag @update EstTof is:"<<m_flag[6]<<endl;
1410 ret = m_meta->getReadEstTofInfo(ser,&runfrm,&runto,m_calPar[6],res,runNo,m_bossver[6]);
1411 //cout<<"runfrom, runto @EstTofCalConst are:"<<runfrm<<"::"<<runto<<endl;
1412 }
1413
1415 log << MSG::ERROR << "Error searching in the database" << endreq;
1416 exit(1);
1417 }
1418
1419 physFmt="TREE";
1420 unsigned char storageType;
1421 status = decodeDescription(physFmt, storageType);
1422
1423 // Depending on value of eDataFmt, figure out which private
1424 // conversion service to invoke. Pass dataIdent and fmtVersion
1425 // as part of the opaque address.
1426 // Create temporary address for the relevant type and classID
1427 log << MSG::DEBUG << "Creating an address of type "
1428 << (int)storageType << " for class " << classID << endreq;
1429
1430 // int sz=res.size();
1431 DatabaseRecord* records1 = res[0];
1432
1433 if(m_dbStatus=="OK"){
1434 if(std::string((*records1)["Status"])!="OK") {
1435 log<<MSG::FATAL<<"the status of type "<<cType<<" is "<< (*records1)["Status"]<<" your setting is OK"<<endreq;
1436 exit(1);
1437 }
1438 }
1439
1440
1441 IOpaqueAddress* tmpAddress;
1442 //const unsigned long ipar[2] = {runfrm,runto};
1443 const unsigned long ipar[2] = {0,0};//yzhang fix unsigned bug for runfrom runto
1444
1445 tmpAddress = new TreeAddress(storageType, classID,*records1,ipar);
1446 //log << MSG::DEBUG <<__LINE__<<cType<<" runfrm,runto @CalVtxLumVer/update is:"<<runfrm1<<":::"<<runto1<<endreq;
1447 sscanf((*records1)["RunFrom"], "%d", &runfrm);
1448 sscanf((*records1)["RunTo"], "%d", &runto);
1449 log << MSG::DEBUG << __LINE__<<" records @update runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
1450 if(flag=="default")
1451 {
1452 if(runfrm1>runfrm)
1453 {
1454 runfrm=runfrm1;
1455 }
1456 if(runto1<runto)
1457 {
1458 runto=runto1;
1459 }
1460 }
1461 if(flag=="set")
1462 {
1463 flag=="default";
1464 }
1465
1466 log << MSG::DEBUG <<__LINE__<< " runfrm of max is:"<<runfrm<<" runto min is:"<<runto<<endreq;
1467 TreeAddress* treeAddress = dynamic_cast <TreeAddress*> (tmpAddress);
1468 treeAddress->setRunFrom(runfrm);
1469 treeAddress->setRunTo(runto);
1470 //log << MSG::DEBUG << __LINE__<<" records runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
1471 //log << MSG::DEBUG <<__LINE__<< " runfrm is:"<<runfrm<<" runto is:"<<runto<<" ser_no is:"<<ser<<endreq;
1472
1473 log << MSG::DEBUG << "Temporary address successfully created" << endreq;
1474 tmpAddress->addRef();
1475
1476 // Set the transient store registry for the object associated to this address
1477 tmpAddress->setRegistry(entry);
1478
1479 // Now update the object
1480 DataObject* pNewObject;
1481 status = m_detPersSvc->createObj(tmpAddress, pNewObject);
1482 tmpAddress->release();
1483 if ( !status.isSuccess() ) {
1484 log << MSG::ERROR
1485 << "Persistency service could not create object" << endreq;
1486 return status;
1487 }
1488
1489 // Since DataObject::operator= operator is not virtual, dynamic cast first!
1490 // Overloaded virtual method Condition::update() must be properly defined!
1491 // The memory pointed to by the old pointer must contain the new object
1492 // Note this dynamic cast only gets us part-way. The object is
1493 // actually of some type derived from CalibBase.
1494 CalibBase1* pNewBase = dynamic_cast<CalibBase1*>(pNewObject);
1495 if (0 == pNewBase) {
1496 log << MSG::ERROR
1497 << "Cannot update objects other than Calib objects: "
1498 << "update() must be defined!"
1499 << endreq;
1500 return StatusCode::FAILURE;
1501 }
1502
1503 // Deep copy the new calib into the old DataObject. To copy the *whole*
1504 // object, not just the CalibBase part, classes derived from CalibBase
1505 // must override update method.
1506 // NOTE: classes directly derived from CalibBase must call
1507 // CalibBase::update in their own update method.
1508 pBase->update(*pNewBase, &log);
1509 res.clear();
1510 f1->Close();
1511 delete f1;
1512 delete pNewBase;
1513 return StatusCode::SUCCESS;
1514}
virtual StatusCode update(CalibBase1 &obj, MsgStream *)
Definition: CalibBase1.cxx:33

Referenced by updateObj().

◆ updateObj()

StatusCode CalibMySQLCnvSvc::updateObj ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Update a transient representation from another rep of this object.

Update a transient representation from another representation of an object. Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters.

Definition at line 300 of file CalibMySQLCnvSvc.cxx.

301 {
302
303 // using facilities::Timestamp;
304
305 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
306
307 // Don't update when we're using enter time
308 log << MSG::DEBUG << "CalibMySQLCnvSvc::updateObj starting ...."<<endreq;
309
310 if( 0 == pObject ) {
311 log << MSG::ERROR << "There is no object to update" << endreq;
312 return StatusCode::FAILURE;
313 }
314
315 StatusCode sc = updateCalib(pObject, pAddress->par()[0],
316 pAddress->clID(), pAddress->registry() );
317 if ( !sc.isSuccess() ) {
318 log << MSG::ERROR << "Could not update calib DataObject" << endreq;
319 return sc;
320 }
321
322 return StatusCode::SUCCESS;
323}
virtual StatusCode updateCalib(DataObject *pObject, const std::string &fullpath, const CLID &classID, IRegistry *entry=0)

◆ updateObjRefs()

StatusCode CalibMySQLCnvSvc::updateObjRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Update the references of an updated transient object.

Update the references of an updated transient object. [actually, don't. Calib data doesn't have any inter-object references.] Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters.

Definition at line 328 of file CalibMySQLCnvSvc.cxx.

329 {
330 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
331 return StatusCode::SUCCESS;
332}

◆ updateRep()

StatusCode CalibMySQLCnvSvc::updateRep ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Update a converted representation of a transient object.

Update a converted representation of a transient object. Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters.

Definition at line 359 of file CalibMySQLCnvSvc.cxx.

360 {
361 MsgStream log(msgSvc(), "CalibMySQLCnvSvc" );
362 // log << MSG::WARNING << "Method updateRep is not implemented" << endreq;
363 return StatusCode::SUCCESS;
364}

◆ updateRepRefs()

StatusCode CalibMySQLCnvSvc::updateRepRefs ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Update the references of an already converted object.

Update the references of an already converted object. Overloaded from ConversionSvc because CalibMySQLCnvSvc has no converters. Don't do anything because calib objects have no inter-object references.

Definition at line 370 of file CalibMySQLCnvSvc.cxx.

371 {
372 MsgStream log(msgSvc(), "CalibMySQLCnvSvc");
373 //log << MSG::WARNING << "Method updateRepRefs is not implemented" << endreq;
374 return StatusCode::SUCCESS;
375}

Friends And Related Function Documentation

◆ SvcFactory< CalibMySQLCnvSvc >

friend class SvcFactory< CalibMySQLCnvSvc >
friend

Only factories can access protected constructors.

Definition at line 1 of file CalibMySQLCnvSvc.h.


The documentation for this class was generated from the following files: