Presentation is loading. Please wait.

Presentation is loading. Please wait.

Use of Gaudi in Reconstruction Weidong Li 23/06/2004.

Similar presentations


Presentation on theme: "Use of Gaudi in Reconstruction Weidong Li 23/06/2004."— Presentation transcript:

1 Use of Gaudi in Reconstruction Weidong Li 23/06/2004

2 Video Lectures  Video Lectures in my machine: IP address: 202.122.35.59  Gaudi Tutorials GaudiAthena AthenaRec  C++ Tutorial C++ training  Software Engineering Software training

3 Reconstruction Dataflow MDC Tracking Calorimeter Clustering Electron/photon Identification Transient Event Data Store MDC digits Tracks Calorimeter Digits Tracks, Showers Calorimeter showers Electron/photon Electrons/photons Real dataflow Apparent dataflow Tracks Showers MDC digits

4 Algorithm  Users write concrete Algorithms derived from base class Algorithm  Implements - at least - three methods in addition to the constructor and destructor initialize(), execute(), finalize()  execute is called once per physics event Concrete Algorithm EventDataSvc IDataProviderSvc IHistogramSvc IMessageSvc IAlgorithm IProperty Obj_B DetectorDataSvc HistogramSvc MessageSvc ApplicationMgr ISvcLocator Obj_A ParticlePropertySv c IParticlePropertySvc

5 Algorithm’s Properties  Algorithm’s properties can be declared in the constructor: MdcHough::MdcHough(const std::string& name, ISvcLocator* pSvcLocator) : Algorithm(name, pSvcLocator) { // Declare the properties declareProperty("FittingMethod", m_fittingMethod = 2); declareProperty("ConfigFile", m_configFile = "MDCConfig.xml"); }  Algorithm’s properties are configured through jobOption file: MdcHough. FittingMethod = 3; MdcHough. ConfigFile = "MDCConfig.xml";

6 Accessing Services  Within the Algorithm services are readily accessible.  The most common are: msgSvc( ) [or messageService( )] eventSvc( )[or eventDataService( )] histoSvc( )[or histogramDataService( )] ntupleSvc( )[or ntupleService( )] detSvc( )[or detDataService( )] service (…)generalized access to Services serviceLocator( )  Other registered services are accessible once their header file is included in the Algorithm

7 Retrieving Event Data (1) StatusCode MdcHough::execute() { // Part 1: Get the event header, print out event and run number SmartDataPtr eventHeader(eventSvc(),"/Event"); if (!eventHeader) { log << MSG::FATAL << "Could not find Event Header" << endreq; return( StatusCode::FAILURE); } //Part 2: Print out MDC digi SmartDataPtr mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol"); OR DataObject * mdcDigiCol; StatusCode sc = eventSvc()->retrieveObject("/Event/Digi/MdcDigiCol“, mdcDigiCol);

8 Retrieving Event Data (2) if (!mdcDigiCol) { log << MSG::FATAL << "Could not find event" << endreq; return( StatusCode::FAILURE); } MdcDigiCol::iterator iter = mdcDigiCol->begin(); for (;iter != mdcDigiCol->end(); iter++, digiId++) { } return StatusCode::SUCCESS; }

9 Algorithm (1) Retrieve object Unsuccessful if requested object is not present (3) Request load Persistency Service Converter (4) Request creation Conversion Service Request dispatcher Objy, ROOT,.. Data Store Data Service (2) Search in Store (5) Register Loading from Data Store

10 Storing Data Object MdcDigiCol * mdcDigiCol = new MdcDigiCol(); StatusCode sc = eventSvc()-> registerObject("/Event/Digi/MdcDigiCol“, mdcDigiCol);

11 Service class IMdcGeomSvc : virtual public IInterface { public: virtual const MdcGeoWire * const Wire(unsigned id) = 0; virtual const MdcGeoLayer * const Layer(unsigned id) = 0; virtual const MdcGeoSuper * const SuperLayer(unsigned id) = 0; virtual void Dump() = 0; }; class IMdcGeomSvc : virtual public IInterface { public: virtual const MdcGeoWire * const Wire(unsigned id) = 0; virtual const MdcGeoLayer * const Layer(unsigned id) = 0; virtual const MdcGeoSuper * const SuperLayer(unsigned id) = 0; virtual void Dump() = 0; }; #include “MDCGeomSvc/IMdcGeomSvc.h” ClientAlgotihm::myMethod() { IMdcGeomSvc* mdcGeomSvc; service(“MdcGeomSvc”, mdcGeomSvc ); mdcGeomSvc -> Dump(); } #include “MDCGeomSvc/IMdcGeomSvc.h” ClientAlgotihm::myMethod() { IMdcGeomSvc* mdcGeomSvc; service(“MdcGeomSvc”, mdcGeomSvc ); mdcGeomSvc -> Dump(); } IMdcGeomSvc.h ClientAlgoritm.cpp

12 Patterns for libraries Patterns for libraries  Helper packages These packages create a shared library that is designed to be linked against. library XxxCode apply_pattern installed_library Or apply_pattern installed_library =*.cxx  Algorithm and Service packages a) component_library - for simple component libraries b) dual_use_library - for Algorithms or Services that are capable of being inherited from.  A package that uses the dual_use_library pattern creates two separate shared libraries libXxxAlgs.so which contains the component factories and needs to be setup at run-time in the job options file, and libXxxAlgsLib.so which is a linkable shared library containing the component code which allows inheritance.

13 Component Library #include “GaudiKernel/DeclareFactoryEntries.h” DECLARE_FACTORY_ENTRIES ( ) { DECLARE_ALGORITH( MyAlgorithm ) DECLARE_SERVICE( MyService ) } #include “GaudiKernel/DeclareFactoryEntries.h” DECLARE_FACTORY_ENTRIES ( ) { DECLARE_ALGORITH( MyAlgorithm ) DECLARE_SERVICE( MyService ) } #include “GaudiKernel/LoadFactoryEntries.h” LOAD_FACTORY_ENTRIES ( ) #include “GaudiKernel/LoadFactoryEntries.h” LOAD_FACTORY_ENTRIES ( ) _load.cxx Your components need to be added here Substitute with your package name _entries.cxx

14 Setup Environment  Set CVSROOT setenv CVSROOT :pserver:liwd@koala.ihep.ac.cn: /bes/bes  Setup CMT source /bes/tool/CMT/v1r14p20031120 /mgr/setup.csh  Set CVSIGNORE setenv CVSIGNORE 'setup.* cleanup.* *.make Makefile Linux* *~' # set the SITEROOT set SITEROOT "/bes/sw/boss" # set the offset in cvs repository set CMTCVSOFFSET "BossCvs" # Setup the CMT search path for work area, distribution area and Gaudi area macro WorkArea "${HOME}/work" macro home_dir "${HOME}" path_remove CMTPATH "${home_dir}" path_prepend CMTPATH "$(WorkArea)" /home/liwd/setupCVS.csh/home/liwd/setupCMT.csh/home/liwd/BossEnv/requirements

15 Job Options // Event Persistency Service and Conversion Service ApplicationMgr.DLLs += {"AsciiFileCnv"}; ApplicationMgr.ExtSvc += { "EvtPersistencySvc/EventPersistencySvc" }; ApplicationMgr.ExtSvc += { "AsciiFileCnvSvc","AsciiFileEventSelector/EventSelector"}; EventPersistencySvc.CnvServices = { "AsciiFileCnvSvc" }; // Reconstruction Algorithm and Geometry Service ApplicationMgr.DLLs += {"MdcDummyAlg", "MdcGeomSvc"}; ApplicationMgr.TopAlg = { "MdcDummy" }; ApplicationMgr.ExtSvc += { "MdcGeomSvc" }; MessageSvc.OutputLevel = 2; ApplicationMgr.EvtMax = 2; /home/liwd/work/TestRelease/TestRelease-00-00-01/run/jobOptions_MDCHough.txt/home/liwd/work/TestRelease/TestRelease-00-00-01/run/Ascii.txt

16 Running Job (1)  Get TestRelease cmt co TestRelease  Modify TestRelease requirements file to list the packages being checked out emacs TestRelease/ /cmt/requirements & And add this line to the requirements file use MdcDummyAlg MdcDummyAlg-* Reconstruction /home/liwd/work/TestRelease/TestRelease-00-00-01/requirements

17 Running Job (2)  Building MdcDummyAlg cd TestRelease/ /cmt source setup.sh cmt broadcast cmt config cmt broadcast gmake  From /run directory boss.exe jobOptions_MdcDummy.txt

18 谢谢大家!


Download ppt "Use of Gaudi in Reconstruction Weidong Li 23/06/2004."

Similar presentations


Ads by Google