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).
457{
458 MsgStream log(
msgSvc(),
"CalibMySQLCnvSvc" );
459
460
462
463
464 if (std::string("Test") == cType.substr(0, 4)) {
465 cType = std::string("Test_Gen");
466 }
467
468 std::string testfile = std::string(getenv("CALIBMYSQLCNVROOT"))+"/share/test.root";
469 TFile *
f1=
new TFile(testfile.c_str(),
"read");
470 unsigned int ser = 0;
471
472 int runfrm,runfrm1;
473 int runto,runto1;
474 std::string flag="default";
476
477 MSG::Level msgLevel = MSG::DEBUG;
478
479 std::string physFmt = "UNK";
480 std::string fmtVersion;
481 std::string dataIdent;
482
483
484 SmartDataPtr<Event::EventHeader> evt(m_eventSvc,"/Event/EventHeader");
486 if( !evt ){
487 log << MSG::WARNING << "Unable to read the Event for TDS" << endreq;
488
489 }
490 if( evt ){
491 if(cType!=
"TofCal"&&cType!=
"EstTofCal"&&cType!=
"TofSim"&&cType!=
"DedxSim")
runNo = fabs(evt -> runNumber());
492 if(cType==
"TofCal"||cType==
"EstTofCal"||cType==
"TofSim"||cType==
"DedxSim")
runNo = evt -> runNumber();
493 }
495
496 StatusCode st1;
497
498
499 if((cType=="TofCal")&&(m_bossver[3]== "default" ))
500 {
501 std::string cType="Tof";
502 if(m_bossRelease=="default")
503 {
504 log << MSG::FATAL << " Boss Release for TofCal not set!" << endreq;
505 exit(1);
506
507 }
508 else
509 {
510 st1=
getSftParVer(m_bossver[3],m_calPar[3],runfrm1,runto1,
runNo,m_bossRelease,cType);
511
512 if (st1 .isFailure() )
513 {
514 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
515 return st1;
516 }
517
519
520 }
521 }
522 else if ((cType=="TofCal")&&(m_bossver[3]!= "default" ))
523 {
524 m_flag[3]="set";
525 flag=m_flag[3];
526
528 }
529
530
531
532 if((cType=="EmcCal")&&(m_bossver[2]== "default" ))
533 {
534 std::string cType="Emc";
535 if(m_bossRelease=="default")
536 {
537 log << MSG::FATAL << " Boss Release for EmcCal not set!" << endreq;
538 exit(1);
539 }
540 else{
541
542 st1=
getSftParVer(m_bossver[2],m_calPar[2],runfrm1,runto1,
runNo,m_bossRelease,cType);
543
544
545 if (st1 .isFailure() )
546 {
547 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
548 return st1;
549 }
551 }
552 }
553 else if((cType=="EmcCal")&&(m_bossver[2]!= "default" ))
554 {
555 m_flag[2]="set";
556 flag=m_flag[2];
557
559 }
560
561
562 if((cType=="DedxCal")&&(m_bossver[1]== "default" ))
563 {
564 std::string cType="Dedx";
565 if(m_bossRelease=="default")
566 {
567 log << MSG::FATAL << " Boss Release for DedxCal not set!" << endreq;
568 exit(1);
569 }
570 else
571 {
572 st1=
getSftParVer(m_bossver[1],m_calPar[1],runfrm1,runto1,
runNo,m_bossRelease,cType);
573
574 if (st1 .isFailure() )
575 {
576 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
577 return st1;
578 }
580 }
581 }
582 else if((cType=="DedxCal")&&(m_bossver[1]!= "default" ))
583 {
584 m_flag[1]="set";
585 flag=m_flag[1];
586
588 }
589
590
591 if((cType=="MdcCal")&&(m_bossver[0]== "default" ))
592 {
593 std::string cType="Mdc";
594
595 if(m_bossRelease=="default")
596 {
597 log << MSG::FATAL << " Boss Release for MdcCal not set!" << endreq;
598 exit(1);
599 }
600 else
601 {
602 st1=
getSftParVer(m_bossver[0],m_calPar[0],runfrm1,runto1,
runNo,m_bossRelease,cType);
603
604 if (st1 .isFailure() )
605 {
606 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
607 return st1;
608 }
610 }
611 }
612 else if((cType=="MdcCal")&&(m_bossver[0]!= "default"))
613 {
614 m_flag[0]="set";
615 flag=m_flag[0];
616
618
619 }
620
621
622 if((cType=="MucCal")&&(m_bossver[4]== "default" ))
623 {
624 std::string cType="Muc";
625 if(m_bossRelease=="default")
626 {
627 log << MSG::FATAL << " Boss Release for MucCal not set!" << endreq;
628 exit(1);
629 }
630 else
631 {
632 st1=
getSftParVer(m_bossver[4],m_calPar[4],runfrm1,runto1,
runNo,m_bossRelease,cType);
633 if (st1 .isFailure() )
634 {
635 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
636 return st1;
637 }
639 }
640 }
641 else if((cType=="MucCal")&&(m_bossver[4]!= "default" ))
642 {
643 m_flag[4]="set";
644 flag=m_flag[4];
645
647 }
648
649
650 if((cType=="EsTimeCal")&&(m_bossver[5]== "default" ))
651 {
652 std::string cType="EsTime";
653 if(m_bossRelease=="default")
654 {
655 log << MSG::FATAL << " Boss Release for EsTimeCal not set!" << endreq;
656 exit(1);
657 }
658 else
659 {
660 st1=
getSftParVer(m_bossver[5],m_calPar[5],runfrm1,runto1,
runNo,m_bossRelease,cType);
661 if (st1 .isFailure() )
662 {
663 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
664 return st1;
665 }
667 }
668 }
669 else if((cType=="EsTimeCal")&&(m_bossver[5]!= "default" ))
670 {
671 m_flag[5]="set";
672 flag=m_flag[5];
673
675 }
676
677
678 if((cType=="MdcAlign")&&(m_bossver[7]== "default" ))
679 {
680 std::string cType="MdcAlign";
681 if(m_bossRelease=="default") {
682 log << MSG::FATAL << " Boss Release for MdcAlignCal not set!" << endreq;
683 exit(1);
684 }
685 else {
686 st1=
getSftParVer(m_bossver[7],m_calPar[7],runfrm1,runto1,
runNo,m_bossRelease,cType);
687 if (st1 .isFailure() ) {
688 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
689 return st1;
690 }
692 }
693 }
694 else if((cType=="MdcAlign")&&(m_bossver[7]!= "default" ))
695 {
696 m_flag[7]="set";
697 flag=m_flag[7];
698
700 }
701
702
703 if((cType=="TofQElec")&&(m_bossver[8]== "default" ))
704 {
705 std::string cType="TofQElec";
706 if(m_bossRelease=="default") {
707 log << MSG::FATAL << " Boss Release for TofQElecCal not set!" << endreq;
708 exit(1);
709 }
710 else {
711
712 st1=
getSftParVer(m_bossver[8],m_calPar[8],runfrm1,runto1,
runNo,m_bossRelease,cType);
713 if (st1 .isFailure() ) {
714 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
715 return st1;
716 }
718 }
719 }
720 else if((cType=="TofQElec")&&(m_bossver[8]!= "default" ))
721 {
722 m_flag[8]="set";
723 flag=m_flag[8];
724
726 }
727
728
729 if((cType=="TofSim")&&(m_bossver[9]== "default" ))
730 {
731 std::string cType="TofSim";
732 if(m_bossRelease=="default") {
733 log << MSG::FATAL << " Boss Release for TofSimCal not set!" << endreq;
734 exit(1);
735 }
736 else {
737 st1=
getSftParVer(m_bossver[9],m_calPar[9],runfrm1,runto1,
runNo,m_bossRelease,cType);
738 if (st1 .isFailure() ) {
739 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
740 return st1;
741 }
743 }
744 }
745 else if((cType=="TofSim")&&(m_bossver[9]!= "default" ))
746 {
747 m_flag[9]="set";
748 flag=m_flag[9];
749
751 }
752
753
754 if((cType=="DedxSim")&&(m_bossver[10]== "default" ))
755 {
756 std::string cType="DedxSim";
757 if(m_bossRelease=="default") {
758 log << MSG::FATAL << " Boss Release for DedxSimCal not set!" << endreq;
759 exit(1);
760 }
761 else {
762 st1=
getSftParVer(m_bossver[10],m_calPar[10],runfrm1,runto1,
runNo,m_bossRelease,cType);
763 if (st1 .isFailure() ) {
764 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
765 return st1;
766 }
768 }
769 }
770 else if((cType=="DedxSim")&&(m_bossver[10]!= "default" ))
771 {
772 m_flag[10]="set";
773 flag=m_flag[10];
774
776 }
777
778
779 if((cType=="MdcDataConst")&&(m_bossver[11]== "default" ))
780 {
781 std::string cType="MdcData";
782 if(m_bossRelease=="default") {
783 log << MSG::FATAL << " Boss Release for MdcDataConst not set!" << endreq;
784 exit(1);
785 }
786 else {
787 st1=
getSftParVer(m_bossver[11],m_calPar[11],runfrm1,runto1,
runNo,m_bossRelease,cType);
788 if (st1 .isFailure() ) {
789 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
790 return st1;
791 }
793 }
794 }
795 else if((cType=="MdcDataConst")&&(m_bossver[11]!= "default" ))
796 {
797 m_flag[11]="set";
798 flag=m_flag[11];
799
801 }
802
803
804 if((cType=="EstTofCal")&&(m_bossver[6]== "default" ))
805 {
806 std::string cType="EsTof";
807 if(m_bossRelease=="default") {
808 log << MSG::FATAL << " Boss Release for EstTofCal not set!" << endreq;
809 exit(1);
810 }
811 else {
812 st1=
getSftParVer(m_bossver[6],m_calPar[6],runfrm1,runto1,
runNo,m_bossRelease,cType);
813 if (st1 .isFailure() ) {
814 log << MSG::ERROR << " Unable to find DatabaseSvc " << endreq;
815 return st1;
816 }
818 }
819 }
820 else if((cType=="EstTofCal")&&(m_bossver[6]!= "default" ))
821 {
822 m_flag[6]="set";
823 flag=m_flag[6];
824
826 }
827
829 log << MSG::ERROR << "no record in the database" << endreq;
830 exit(1);
831 }
832 int sz=res.size();
834
835
836
837
838 if(m_dbStatus=="OK"){
839 if(std::string((*records1)["Status"])!="OK") {
840 log<<MSG::FATAL<<"Status of type "<<cType<<" is "<< (*records1)["Status"]<<" your setting is OK"<<endreq;
841 exit(1);
842 }
843 }
844
845 log << MSG::DEBUG << "dataIdent is:"<<dataIdent<< endreq;
846 unsigned char storageType;
847 physFmt="TREE";
849
850
851
852
853
854
855 log << MSG::DEBUG << "Creating an address of type "
856 << (int)storageType << " for class " << classID << endreq;
857
858 IOpaqueAddress* tmpAddress;
859 const std::string par[3] = {dataIdent, fullpath, fmtVersion};
860
861
862 const unsigned long ipar[2] = {0,0};
863
864
865
866
867 tmpAddress =
new TreeAddress(storageType, classID,*records1,ipar);
868
869
870
871 cout<<cType<<" runfrm,runto @CalVtxLumVer is:"<<runfrm1<<":::"<<runto1<<endl;
872 sscanf((*records1)["RunFrom"], "%d", &runfrm);
873 sscanf((*records1)["RunTo"], "%d", &runto);
874 log << MSG::DEBUG << __LINE__<<" records @ runfrm is:"<<(*records1)["RunFrom"]<<" runto is:"<<(*records1)["RunTo"]<<" ser_no is:"<<ser<<endreq;
875
876 if(flag=="default")
877 {
878 if(runfrm1>runfrm)
879 {
880 runfrm=runfrm1;
881 }
882 if(runto1<runto)
883 {
884 runto=runto1;
885 }
886 }
887 if(flag=="set")
888 {
889 flag="default";
890 }
891 log << MSG::DEBUG <<__LINE__<< " runfrm of max is:"<<runfrm<<" runto min is:"<<runto<<endreq;
895
896
897
898
899
900
901
902
903
904
905
906
907 tmpAddress->addRef();
908
909
910 tmpAddress->setRegistry(entry);
911
912
913 sc = m_detPersSvc->createObj(tmpAddress, refpObject);
914 tmpAddress->release();
915 if ( !sc.isSuccess() ) {
916 log << msgLevel
917 << "Persistency service could not create a new object" << endreq;
918 if (m_crash) {
919 log << msgLevel << std::endl << "Exiting... " << std::endl << endreq;
920 exit(1);
921 }
922 return sc;
923 }
924
926 log << MSG::DEBUG << "New object successfully created" << endreq;
927 return StatusCode::SUCCESS;
930}
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
void setRunTo(int runTo)
set run to