BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcGeomSvc Class Reference

#include <MdcGeomSvc.h>

Inheritance diagram for MdcGeomSvc:

Public Member Functions

 MdcGeomSvc (const std::string &name, ISvcLocator *svcloc)
 ~MdcGeomSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void handle (const Incident &inc)
 this handle function is prepared for special use
const MdcGeoWire *const Wire (unsigned id)
const MdcGeoWire *const Wire (unsigned lyrid, unsigned wirid)
const MdcGeoLayer *const Layer (unsigned id)
const MdcGeoSuper *const SuperLayer (unsigned id)
const MdcGeoGeneral *const GeneralLayer (unsigned id)
const MdcGeoMisc *const Misc (void)
const MdcGeoEnd *const End (unsigned id)
const int getWireSize ()
const int getLayerSize ()
const int getSuperLayerSize ()
const int getGeneralLayerSize ()
const int getSegmentNo ()
void Dump ()
virtual bool getSagFlag (void)

Static Public Attributes

static bool m_doSag = true
static bool m_readAlignParDataBase = true
static bool m_nomcalignment = true

Detailed Description

Definition at line 25 of file MdcGeomSvc.h.

Constructor & Destructor Documentation

◆ MdcGeomSvc()

MdcGeomSvc::MdcGeomSvc ( const std::string & name,
ISvcLocator * svcloc )

Definition at line 31 of file MdcGeomSvc.cxx.

32 : base_class( name, svcloc ) {
33 if ( getenv( "MDCGEOMSVCROOT" ) )
34 {
35 m_alignFilePath =
36 std::string( getenv( "MDCGEOMSVCROOT" ) ) + std::string( "/share/MdcAlignPar.dat" );
37 // std::cout<<" the MDC alignment file: "<<m_alignFilePath<<std::endl;
38
39 m_wirePosFilePath =
40 std::string( getenv( "MDCGEOMSVCROOT" ) ) + std::string( "/share/WirePosCalib.dat" );
41 // std::cout<<" the MDC wire position file: "<<m_wirePosFilePath<<std::endl;
42
43 m_wireTensionFilePath =
44 std::string( getenv( "MDCGEOMSVCROOT" ) ) + std::string( "/share/mdcWireTension.dat" );
45 // std::cout<<" the MDC wire tension file: "<<m_wireTensionFilePath<<std::endl;
46 }
47 else { std::cout << "A fatal error, contact wangjk..." << std::endl; }
48
49 declareProperty( "doSag", m_doSag = true );
50 declareProperty( "readAlignParDataBase", m_readAlignParDataBase = true );
51 declareProperty( "mcnoalignment", m_nomcalignment = true );
52 declareProperty( "wholeShiftX", m_wholeShiftX = 0. );
53 declareProperty( "wholeShiftY", m_wholeShiftY = 0. );
54 declareProperty( "wholeShiftZ", m_wholeShiftZ = 0. );
55 declareProperty( "wholeRotatX", m_wholeRotatX = 0. );
56 declareProperty( "wholeRotatY", m_wholeRotatY = 0. );
57 declareProperty( "wholeRotatZ", m_wholeRotatZ = 0. );
58 declareProperty( "alignFilePath", m_alignFilePath );
59 declareProperty( "wirePosFilePath", m_wirePosFilePath );
60 declareProperty( "wireTensionFilePath", m_wireTensionFilePath );
61}
static bool m_readAlignParDataBase
Definition MdcGeomSvc.h:55
static bool m_doSag
Definition MdcGeomSvc.h:54
static bool m_nomcalignment
Definition MdcGeomSvc.h:56

◆ ~MdcGeomSvc()

MdcGeomSvc::~MdcGeomSvc ( )

Definition at line 109 of file MdcGeomSvc.cxx.

109 {
110 for ( vector<MdcGeoLayer*>::iterator it1 = fLayers.begin(); it1 != fLayers.end(); it1++ )
111 delete *it1;
112 for ( vector<MdcGeoSuper*>::iterator it2 = fSupers.begin(); it2 != fSupers.end(); it2++ )
113 delete *it2;
114 for ( vector<MdcGeoWire*>::iterator it3 = fWires.begin(); it3 != fWires.end(); it3++ )
115 delete *it3;
116 for ( vector<MdcGeoEnd*>::iterator it4 = fEnd.begin(); it4 != fEnd.end(); it4++ )
117 delete *it4;
118 fGenerals.clear();
119 fWires.clear();
120 fLayers.clear();
121 fSupers.clear();
122 fEnd.clear();
123}

Member Function Documentation

◆ Dump()

void MdcGeomSvc::Dump ( )

Definition at line 694 of file MdcGeomSvc.cxx.

694{}

Referenced by main().

◆ End()

const MdcGeoEnd *const MdcGeomSvc::End ( unsigned id)

Definition at line 798 of file MdcGeomSvc.cxx.

798 {
799 if ( id < fEnd.size() ) return fEnd[id];
800
801 return 0;
802}

◆ finalize()

StatusCode MdcGeomSvc::finalize ( )
virtual

Definition at line 103 of file MdcGeomSvc.cxx.

103 {
104 MsgStream log( msgSvc(), name() );
105 log << MSG::INFO << name() << ": End of Run" << endmsg;
106 return StatusCode::SUCCESS;
107}
IMessageSvc * msgSvc()

Referenced by main().

◆ GeneralLayer()

const MdcGeoGeneral *const MdcGeomSvc::GeneralLayer ( unsigned id)

Definition at line 790 of file MdcGeomSvc.cxx.

790 {
791 if ( id < fGenerals.size() ) return &fGenerals[id];
792
793 return 0;
794}

◆ getGeneralLayerSize()

const int MdcGeomSvc::getGeneralLayerSize ( )

Definition at line 690 of file MdcGeomSvc.cxx.

690{ return fGenerals.size(); }

◆ getLayerSize()

const int MdcGeomSvc::getLayerSize ( )

Definition at line 686 of file MdcGeomSvc.cxx.

686{ return fLayers.size(); }

◆ getSagFlag()

bool MdcGeomSvc::getSagFlag ( void )
virtual

Definition at line 804 of file MdcGeomSvc.cxx.

804{ return m_doSag; }

◆ getSegmentNo()

const int MdcGeomSvc::getSegmentNo ( )

Definition at line 692 of file MdcGeomSvc.cxx.

692{ return fEnd.size(); }

◆ getSuperLayerSize()

const int MdcGeomSvc::getSuperLayerSize ( )

Definition at line 688 of file MdcGeomSvc.cxx.

688{ return fSupers.size(); }

◆ getWireSize()

const int MdcGeomSvc::getWireSize ( )

Definition at line 684 of file MdcGeomSvc.cxx.

684{ return fWires.size(); }

◆ handle()

void MdcGeomSvc::handle ( const Incident & inc)

this handle function is prepared for special use

Definition at line 739 of file MdcGeomSvc.cxx.

739 {
740 MsgStream log( msgSvc(), name() );
741 log << MSG::DEBUG << "handle: " << inc.type() << endmsg;
742 IDataProviderSvc* m_eventSvc;
743 Gaudi::svcLocator()->service( "EventDataSvc", m_eventSvc, true );
744 SmartDataPtr<Event::EventHeader> eventHeader( m_eventSvc, "/Event/EventHeader" );
745 if ( !eventHeader ) { log << MSG::FATAL << "Could not find Event Header" << endmsg; }
746 if ( m_updataalign ) return;
747 if ( inc.type() == "NewRun" )
748 {
749 log << MSG::DEBUG << "Begin Event" << endmsg;
750 clean();
751 m_updataalign = true;
752 if ( m_nomcalignment && m_mindex == 0 )
753 {
754 int RunNo = eventHeader->runNumber();
755 if ( RunNo < 0 ) m_readAlignParDataBase = false;
756 else m_readAlignParDataBase = true;
757 m_mindex += 1;
758 cout << "m__RunNo=" << RunNo << "m_mindex=" << m_mindex << endl;
759 }
760 // std::cout<<"############"<<m_readAlignParDataBase<<std::endl;
761 ReadFilePar();
762 }
763}

◆ initialize()

StatusCode MdcGeomSvc::initialize ( )
virtual

Definition at line 73 of file MdcGeomSvc.cxx.

73 {
74 MsgStream log( msgSvc(), name() );
75 log << MSG::INFO << name() << ": Start of run initialisation" << endmsg;
76
77 StatusCode sc = Service::initialize();
78 if ( sc.isFailure() ) return sc;
79 m_mindex = 0;
80 m_updataalign = false;
81 IIncidentSvc* incsvc;
82 sc = service( "IncidentSvc", incsvc );
83 int priority = 100;
84 if ( sc.isSuccess() ) { incsvc->addListener( this, "NewRun", priority ); }
85
86 // ReadFilePar(); // get geometry data from file SimUtil/dat/Mdc.txt
87 // Fill(); // get geometry data from Database
88
89 sc = service( "CalibDataSvc", m_pCalibDataSvc, true );
90
91 if ( !sc.isSuccess() )
92 {
93 log << MSG::ERROR << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
94 << endmsg;
95 return sc;
96 }
97 else
98 { log << MSG::DEBUG << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" << endmsg; }
99 ReadFilePar();
100 return StatusCode::SUCCESS;
101}

Referenced by main().

◆ Layer()

const MdcGeoLayer *const MdcGeomSvc::Layer ( unsigned id)

Definition at line 778 of file MdcGeomSvc.cxx.

778 {
779 if ( id < fLayers.size() ) return fLayers[id];
780
781 return 0;
782}

Referenced by Wire().

◆ Misc()

const MdcGeoMisc *const MdcGeomSvc::Misc ( void )

Definition at line 796 of file MdcGeomSvc.cxx.

796{ return &fMisc; }

◆ SuperLayer()

const MdcGeoSuper *const MdcGeomSvc::SuperLayer ( unsigned id)

Definition at line 784 of file MdcGeomSvc.cxx.

784 {
785 if ( id < fSupers.size() ) return fSupers[id];
786
787 return 0;
788}

◆ Wire() [1/2]

const MdcGeoWire *const MdcGeomSvc::Wire ( unsigned id)

Definition at line 765 of file MdcGeomSvc.cxx.

765 {
766 if ( id < fWires.size() ) return fWires[id];
767
768 return 0;
769}

Referenced by main().

◆ Wire() [2/2]

const MdcGeoWire *const MdcGeomSvc::Wire ( unsigned lyrid,
unsigned wirid )

Definition at line 771 of file MdcGeomSvc.cxx.

771 {
772 if ( ( lyrid < fLayers.size() ) && ( (int)wirid < Layer( lyrid )->NCell() ) )
773 return fWires[Layer( lyrid )->Wirst() + wirid];
774
775 return 0;
776}
const MdcGeoLayer *const Layer(unsigned id)

Member Data Documentation

◆ m_doSag

bool MdcGeomSvc::m_doSag = true
static

Definition at line 54 of file MdcGeomSvc.h.

Referenced by getSagFlag(), and MdcGeomSvc().

◆ m_nomcalignment

bool MdcGeomSvc::m_nomcalignment = true
static

Definition at line 56 of file MdcGeomSvc.h.

Referenced by handle(), and MdcGeomSvc().

◆ m_readAlignParDataBase

bool MdcGeomSvc::m_readAlignParDataBase = true
static

Definition at line 55 of file MdcGeomSvc.h.

Referenced by handle(), and MdcGeomSvc().


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