BOSS 7.0.8
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
TFile * f1
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 1584 of file CalibMySQLCnvSvc.cxx.

1586{
1587 MsgStream log(msgSvc(), "CalibMySQLCnvSvc");
1588
1589 // description ="ROOT";
1590 if (description == std::string("XML")) {
1591 type = XML_StorageType;
1592 }
1593 else if (description == std::string("ROOT")) {
1594 type = CALIBROOT_StorageType;
1595 }
1596 else if (description == std::string("TREE")) {
1597 type = CALIBTREE_StorageType;
1598 }
1599 else { // unsupported
1600 log << MSG::ERROR << "unsupported storage type " << description << endreq;
1601 return StatusCode::FAILURE;
1602 }
1603 return StatusCode::SUCCESS;
1604}
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 1608 of file CalibMySQLCnvSvc.cxx.

1608 {
1609 return m_meta;
1610}

◆ 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}
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)
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

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,FirstEvent;
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 FirstEvent = evt -> eventNumber();
1180 }
1181
1182 //TofCalConst
1183 if((cType=="TofCal"))
1184 {
1185 std::string cType="Tof";
1186 if(m_flag[3]=="default")
1187 {
1188 st1=getSftParVer(m_bossver[3],m_calPar[3],runfrm1,runto1,runNo,m_bossRelease,cType);
1189 cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1190 if (st1 .isFailure() )
1191 {
1192 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1193 return st1;
1194 }
1195 }
1196
1197 flag=m_flag[3];
1198
1199 //cout<<"flag @update Tof is:"<<flag<<endl;
1200 //cout<<"SftVer and CalParVer are:"<<sft_ver<<";"<<cal_ver<<endl;
1201 ret = m_meta->getReadTOFInfo(ser,&runfrm,&runto,m_calPar[3],res,runNo,m_bossver[3]);
1202 //cout<<"runfrom, runto @update "<<cType<<" are:"<<runfrm<<"::"<<runto<<endl;
1203 }
1204
1205 //EmcCalConst
1206 if((cType=="EmcCal"))
1207 {
1208 std::string cType="Emc";
1209 if(m_flag[2]=="default")
1210 {
1211 st1=getSftParVer(m_bossver[2],m_calPar[2],runfrm1,runto1,runNo,m_bossRelease,cType);
1212 //cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1213 if (st1 .isFailure() )
1214 {
1215 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1216 return st1;
1217 }
1218 }
1219 flag=m_flag[2];
1220 //cout<<"flag @update Emc is:"<<m_flag[2]<<endl;
1221 ret = m_meta->getReadEMCInfo(ser,&runfrm,&runto, m_calPar[2], res,runNo,m_bossver[2]);
1222 //cout<<"runfrom, runto @update "<<cType<<" are:"<<runfrm<<"::"<<runto<<endl;
1223 }
1224
1225
1226
1227 //DedxCalConst
1228 if((cType=="DedxCal"))
1229 {
1230 std::string cType="Dedx";
1231 if(m_flag[1]=="default")
1232 {
1233 st1=getSftParVer(m_bossver[1],m_calPar[1],runfrm1,runto1,runNo,m_bossRelease,cType);
1234 //cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1235 if (st1 .isFailure() )
1236 {
1237 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1238 return st1;
1239 }
1240 }
1241 flag=m_flag[1];
1242 //cout<<"flag @update Dedx is:"<<m_flag[1]<<endl;
1243 ret = m_meta->getReadDedxInfo(ser,&runfrm,&runto, m_calPar[1], res,runNo,m_bossver[1]);
1244 }
1245
1246 //MdcCalConst
1247 if((cType=="MdcCal"))
1248 {
1249 std::string cType="Mdc";
1250 if(m_flag[0]=="default")
1251 {
1252 //cout<<"cType is"<<cType<<"m_bossver[0] is:"<<m_bossver[0]<<endl;
1253 st1=getSftParVer(m_bossver[0],m_calPar[0],runfrm1,runto1,runNo,m_bossRelease,cType);
1254 //cout<<cType<<" runfrm1,runto1 @update is:"<<runfrm1<<":::"<<runto1<<endl;
1255 if (st1 .isFailure() )
1256 {
1257 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1258 return st1;
1259 }
1260 }
1261 flag=m_flag[0];
1262 //cout<<"flag @update Mdc is:"<<m_flag[0]<<endl;
1263 ret = m_meta->getReadMDCInfo(ser,&runfrm,&runto,m_calPar[0],res,runNo,m_bossver[0]);
1264 //cout<<"runfrom, runto @update "<<cType<<" are:"<<runfrm<<"::"<<runto<<endl;
1265 }
1266
1267 //MucCalConst
1268 if((cType=="MucCal"))
1269 {
1270 std::string cType="Muc";
1271 if(m_flag[4]=="default")
1272 {
1273 st1=getSftParVer(m_bossver[4],m_calPar[4],runfrm1,runto1,runNo,m_bossRelease,cType);
1274 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1275 if (st1 .isFailure() )
1276 {
1277 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1278 return st1;
1279 }
1280 }
1281 flag=m_flag[4];
1282 //cout<<"flag @update Muc is:"<<m_flag[4]<<endl;
1283 ret = m_meta->getReadMUCInfo(ser,&runfrm,&runto, m_calPar[4], res,runNo,m_bossver[4]);
1284 }
1285
1286 //EsTimeCal
1287 if((cType=="EsTimeCal"))
1288 {
1289 std::string cType="EsTime";
1290 if(m_flag[5]=="default")
1291 {
1292 st1=getSftParVer(m_bossver[5],m_calPar[5],runfrm1,runto1,runNo,m_bossRelease,cType);
1293 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1294 if (st1 .isFailure() )
1295 {
1296 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1297 return st1;
1298 }
1299 }
1300 flag=m_flag[5];
1301 //cout<<"flag @update EsTime is:"<<m_flag[5]<<endl;
1302 ret = m_meta->getReadEsTimeInfo(ser,&runfrm,&runto,m_calPar[5], res,runNo,m_bossver[5]);
1303 }
1304
1305 //MdcAlign
1306 if((cType=="MdcAlign"))
1307 {
1308 std::string cType="MdcAlign";
1309 if(m_flag[7]=="default")
1310 {
1311 st1=getSftParVer(m_bossver[7],m_calPar[7],runfrm1,runto1,runNo,m_bossRelease,cType);
1312 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1313 if (st1 .isFailure() ) {
1314 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1315 return st1;
1316 }
1317 }
1318 flag=m_flag[7];
1319 //cout<<"flag @update MdcAlign is:"<<m_flag[7]<<endl;
1320 ret = m_meta->getReadMdcAlignInfo(ser,&runfrm,&runto,m_calPar[7], res,runNo,m_bossver[7]);
1321 }
1322
1323 //TofQElec
1324 if((cType=="TofQElec"))
1325 {
1326 std::string cType="TofQElec";
1327 if(m_flag[8]=="default")
1328 {
1329 //cout<<"TofQElec @update"<<endl;
1330 st1=getSftParVer(m_bossver[8],m_calPar[8],runfrm1,runto1,runNo,m_bossRelease,cType);
1331 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1332 }
1333 flag=m_flag[8];
1334 //cout<<"flag @update TofQElec is:"<<m_flag[8]<<endl;
1335 ret = m_meta->getReadTofQElecInfo(ser,&runfrm,&runto,m_calPar[8],res,runNo,m_bossver[8]);
1336 //cout<<"runfrom, runto @TofQElec are:"<<runfrm<<"::"<<runto<<endl;
1337 }
1338
1339 //TofSim
1340 if((cType=="TofSim"))
1341 {
1342 std::string cType="TofSim";
1343 if(m_flag[9]=="default")
1344 {
1345 st1=getSftParVer(m_bossver[9],m_calPar[9],runfrm1,runto1,runNo,m_bossRelease,cType);
1346 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1347 if (st1 .isFailure() ) {
1348 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1349 return st1;
1350 }
1351 }
1352 flag=m_flag[9];
1353 //cout<<"flag @update TofSim is:"<<m_flag[9]<<endl;
1354 ret = m_meta->getReadTofSimInfo(ser,&runfrm,&runto, m_calPar[9], res,runNo,m_bossver[9]);
1355 //cout<<"runfrom, runto @TofSim are:"<<runfrm<<"::"<<runto<<endl;
1356 }
1357
1358 //DedxSim
1359 if((cType=="DedxSim"))
1360 {
1361 std::string cType="DedxSim";
1362 if(m_flag[10]=="default")
1363 {
1364 st1=getSftParVer(m_bossver[10],m_calPar[10],runfrm1,runto1,runNo,m_bossRelease,cType);
1365 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1366 if (st1 .isFailure() ) {
1367 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1368 return st1;
1369 }
1370 }
1371 flag=m_flag[10];
1372 //cout<<"flag @update DedxSim is:"<<m_flag[10]<<endl;
1373 ret = m_meta->getReadDedxSimInfo(ser,&runfrm,&runto,m_calPar[10], res,runNo,m_bossver[10]);
1374 //cout<<"runfrom, runto @DedxSim are:"<<runfrm<<"::"<<runto<<endl;
1375 }
1376
1377 //MdcDataConst
1378 if((cType=="MdcDataConst"))
1379 {
1380 std::string cType="MdcData";
1381 if(m_flag[11]=="default")
1382 {
1383 st1=getSftParVer(m_bossver[11],m_calPar[11],runfrm1,runto1,runNo,m_bossRelease,cType);
1384 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1385 if (st1 .isFailure() ) {
1386 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1387 return st1;
1388 }
1389 }
1390 flag=m_flag[11];
1391 //cout<<"flag @update MdcData is:"<<m_flag[11]<<endl;
1392 ret = m_meta->getReadMdcDataConstInfo(ser,&runfrm,&runto,m_calPar[11], res,runNo,m_bossver[11]);
1393 //cout<<"runfrom, runto @MdcDataConst are:"<<runfrm<<"::"<<runto<<endl;
1394 }
1395
1396 //InjSigInterval
1397 if(cType=="InjSigInterval")
1398 {
1399 std::string cType="InjSigInterval";
1400 if(m_flag[12]=="default")
1401 {
1402 st1=getSftParVer(m_bossver[12],m_calPar[12],runfrm1,runto1,runNo,m_bossRelease,cType);
1403 if (st1 .isFailure() ) {
1404 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1405 return st1;
1406 }
1407 }
1408 flag=m_flag[12];
1409 ret = m_meta->getReadInjSigIntervalInfo(ser,&runfrm,&runto,m_calPar[12], res,runNo,m_bossver[12]);
1410 }
1411 //InjSigTime
1412 if(cType=="InjSigTime")
1413 {
1414 std::string cType="InjSigTime";
1415 if(m_flag[13]=="default")
1416 {
1417 st1=getSftParVer(m_bossver[13],m_calPar[13],runfrm1,runto1,runNo,m_bossRelease,cType);
1418 if (st1 .isFailure() ) {
1419 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1420 return st1;
1421 }
1422 }
1423 flag=m_flag[13];
1424 ret = m_meta->getReadInjSigTimeInfo(ser,&runfrm,&runto,m_calPar[13], res,runNo,m_bossver[13]);
1425 }
1426 //OffEvtFilter
1427 if(cType=="OffEvtFilter")
1428 {
1429 std::string cType="OffEvtFilter";
1430 if(m_flag[14]=="default")
1431 {
1432 st1=getSftParVer(m_bossver[14],m_calPar[14],runfrm1,runto1,runNo,m_bossRelease,cType);
1433 if (st1 .isFailure() ) {
1434 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1435 return st1;
1436 }
1437 }
1438 flag=m_flag[14];
1439 ret = m_meta->getReadOffEvtFilterInfo(ser,&runfrm,&runto,m_calPar[14], res,runNo,m_bossver[14]);
1440 }
1441 //CorrectedETS
1442 if(cType=="CorrectedETS")
1443 {
1444 std::string cType="CorrectedETS";
1445 ret = m_meta->getReadCorrectedETSInfo(ser,runNo,FirstEvent,m_calPar[15],res);
1446
1447 int _strlenRun = strlen((*res[0])["Run"]) + 1;
1448 char* _pStatus = new char[3];
1449 char* _pRunFrom = new char[_strlenRun];
1450 char* _pRunTo = new char[_strlenRun];
1451 memcpy(_pStatus, "OK", 3);
1452 memcpy(_pRunFrom, (*res[0])["Run"], _strlenRun);
1453 memcpy(_pRunTo, (*res[0])["Run"], _strlenRun);
1454
1455 (*res[0])["Status"] = _pStatus;
1456 (*res[0])["RunFrom"] = _pRunFrom;
1457 (*res[0])["RunTo"] = _pRunTo;
1458 runfrm1 = runNo;
1459 runto1 = runNo;
1460
1461 }
1462
1463 //EstTofCalConst
1464 if((cType=="EstTofCal"))
1465 {
1466 std::string cType="EsTof";
1467 if(m_flag[6]=="default")
1468 {
1469 st1=getSftParVer(m_bossver[6],m_calPar[6],runfrm1,runto1,runNo,m_bossRelease,cType);
1470 //cout<<cType<<" runfrm1,runto1 @CalVtxLumVer are:"<<runfrm1<<":::"<<runto1<<endl;
1471 if (st1 .isFailure() ) {
1472 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
1473 return st1;
1474 }
1475 }
1476 flag=m_flag[6];
1477 //cout<<"flag @update EstTof is:"<<m_flag[6]<<endl;
1478 ret = m_meta->getReadEstTofInfo(ser,&runfrm,&runto,m_calPar[6],res,runNo,m_bossver[6]);
1479 //cout<<"runfrom, runto @EstTofCalConst are:"<<runfrm<<"::"<<runto<<endl;
1480 }
1481
1483 log << MSG::ERROR << "Error searching in the database" << endreq;
1484 exit(1);
1485 }
1486
1487 physFmt="TREE";
1488 unsigned char storageType;
1489 status = decodeDescription(physFmt, storageType);
1490
1491 // Depending on value of eDataFmt, figure out which private
1492 // conversion service to invoke. Pass dataIdent and fmtVersion
1493 // as part of the opaque address.
1494 // Create temporary address for the relevant type and classID
1495 log << MSG::DEBUG << "Creating an address of type "
1496 << (int)storageType << " for class " << classID << endreq;
1497
1498 // int sz=res.size();
1499 DatabaseRecord* records1 = res[0];
1500
1501 if(m_dbStatus=="OK"){
1502 if(std::string((*records1)["Status"])!="OK") {
1503 log<<MSG::FATAL<<"the status of type "<<cType<<" is "<< (*records1)["Status"]<<" your setting is OK"<<endreq;
1504 exit(1);
1505 }
1506 }
1507
1508
1509 IOpaqueAddress* tmpAddress;
1510 //const unsigned long ipar[2] = {runfrm,runto};
1511 const unsigned long ipar[2] = {0,0};//yzhang fix unsigned bug for runfrom runto
1512
1513 tmpAddress = new TreeAddress(storageType, classID,*records1,ipar);
1514 //log << MSG::DEBUG <<__LINE__<<cType<<" runfrm,runto @CalVtxLumVer/update is:"<<runfrm1<<":::"<<runto1<<endreq;
1515 sscanf((*records1)["RunFrom"], "%d", &runfrm);
1516 sscanf((*records1)["RunTo"], "%d", &runto);
1517 log << MSG::DEBUG << __LINE__<<" records @update runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
1518 if(flag=="default")
1519 {
1520 if(runfrm1>runfrm)
1521 {
1522 runfrm=runfrm1;
1523 }
1524 if(runto1<runto)
1525 {
1526 runto=runto1;
1527 }
1528 }
1529 if(flag=="set")
1530 {
1531 flag=="default";
1532 }
1533
1534 log << MSG::DEBUG <<__LINE__<< " runfrm of max is:"<<runfrm<<" runto min is:"<<runto<<endreq;
1535 TreeAddress* treeAddress = dynamic_cast <TreeAddress*> (tmpAddress);
1536 treeAddress->setRunFrom(runfrm);
1537 treeAddress->setRunTo(runto);
1538 //log << MSG::DEBUG << __LINE__<<" records runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
1539 //log << MSG::DEBUG <<__LINE__<< " runfrm is:"<<runfrm<<" runto is:"<<runto<<" ser_no is:"<<ser<<endreq;
1540
1541 log << MSG::DEBUG << "Temporary address successfully created" << endreq;
1542 tmpAddress->addRef();
1543
1544 // Set the transient store registry for the object associated to this address
1545 tmpAddress->setRegistry(entry);
1546
1547 // Now update the object
1548 DataObject* pNewObject;
1549 status = m_detPersSvc->createObj(tmpAddress, pNewObject);
1550 tmpAddress->release();
1551 if ( !status.isSuccess() ) {
1552 log << MSG::ERROR
1553 << "Persistency service could not create object" << endreq;
1554 return status;
1555 }
1556
1557 // Since DataObject::operator= operator is not virtual, dynamic cast first!
1558 // Overloaded virtual method Condition::update() must be properly defined!
1559 // The memory pointed to by the old pointer must contain the new object
1560 // Note this dynamic cast only gets us part-way. The object is
1561 // actually of some type derived from CalibBase.
1562 CalibBase1* pNewBase = dynamic_cast<CalibBase1*>(pNewObject);
1563 if (0 == pNewBase) {
1564 log << MSG::ERROR
1565 << "Cannot update objects other than Calib objects: "
1566 << "update() must be defined!"
1567 << endreq;
1568 return StatusCode::FAILURE;
1569 }
1570
1571 // Deep copy the new calib into the old DataObject. To copy the *whole*
1572 // object, not just the CalibBase part, classes derived from CalibBase
1573 // must override update method.
1574 // NOTE: classes directly derived from CalibBase must call
1575 // CalibBase::update in their own update method.
1576 pBase->update(*pNewBase, &log);
1577 res.clear();
1578 f1->Close();
1579 delete f1;
1580 delete pNewBase;
1581 return StatusCode::SUCCESS;
1582}
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: