Gaudi Framework, version v25r0

Home   Generated: Mon Feb 17 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiAlgorithm.h
Go to the documentation of this file.
1 // $Id: GaudiAlgorithm.h,v 1.19 2008/11/04 22:49:25 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIALG_GaudiAlgorithm_H
4 #define GAUDIALG_GaudiAlgorithm_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 #include <vector>
9 #include <string>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
13 #include "GaudiKernel/Algorithm.h"
14 // ============================================================================
15 // GaudiAlg
16 // ============================================================================
17 #include "GaudiAlg/GaudiAlg.h"
18 #include "GaudiAlg/GaudiCommon.h"
19 // ============================================================================
20 // forward declarations:
21 // ============================================================================
22 class INTupleSvc ; // GaudiKernel
23 // ============================================================================
24 /* @file GaudiAlgorithm.h
25  *
26  * Header file for class GaudiAlgorithm.
27  * The actual code is mainly imported from
28  * - LHCb Calorimeter software and
29  * - LHCb C++ toolkit for smart and friendly physics analysis "LoKi"
30  *
31  * This base class allows "easy"(=="1 line") access to tools
32  * and services. This access is safe in the sense that there
33  * is no need to worry about the reference counts for tools
34  * and services.
35  *
36  * The base class allows "easy" (=="1 line") access to data in
37  * Gaudi Transient Stores. The functionality includes the checking
38  * of the presence of the data at the given location, checking the
39  * validity of the data, retrieval of valid data and "forced" retrieve
40  * of valid data (create if there is no data).
41  *
42  * The base class allows to perform an easy error, warning and exception
43  * treatments, including the accumulated statistics of exceptions, errors
44  * and warnings.
45  *
46  * The base class also includes utilities for general statistical counters.
47  *
48  * It has been reported that usage of this base class results in
49  * significant shrinkage of existing code lines.
50  *
51  * @attention
52  * See also the class GaudiCommon, which implements some of the common
53  * functionality between GaudiTool and GaudiAlgorithm.
54  *
55  * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
56  * @author Chris Jones Christopher.Rob.Jones@cern.ch
57  * @date 30/06/2001
58  */
59 // ============================================================================
93 // ============================================================================
94 class GAUDI_API GaudiAlgorithm: public GaudiCommon<Algorithm>
95 {
96 public:
97  // ==========================================================================
103  virtual StatusCode initialize();
104  // ==========================================================================
110  virtual StatusCode execute ();
111  // ==========================================================================
117  virtual StatusCode finalize ();
118  // ==========================================================================
125  virtual StatusCode sysExecute () ;
126  // ==========================================================================
127 public:
128 
129  // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
130  // and detDvc() ) that are not members of AlgTool.
131  // Also some methods seem which are members of the base class do not seem
132  // to be found unless forwarding methods are put here ??
133 
166  inline void put ( IDataProviderSvc* svc ,
167  DataObject* object ,
168  const std::string& address ,
169  const bool useRootInTES = true ) const
170  {
171  GaudiCommon<Algorithm>::put ( svc , object , address , useRootInTES ) ;
172  }
173 
205  inline void put ( DataObject* object ,
206  const std::string& address ,
207  const bool useRootInTES = true ) const
208  {
209  GaudiCommon<Algorithm>::put ( evtSvc() , object , address , useRootInTES ) ;
210  }
211 
244  template < class TYPE >
245  inline typename Gaudi::Utils::GetData<TYPE>::return_type
247  const std::string& location ,
248  const bool useRootInTES = true ) const
249  {
250  return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , useRootInTES ) ;
251  }
252 
286  template < class TYPE >
287  inline typename Gaudi::Utils::GetData<TYPE>::return_type
289  const std::string& location ,
290  const bool useRootInTES = true ) const
291  {
292  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , useRootInTES ) ;
293  }
294 
321  template < class TYPE >
322  inline typename Gaudi::Utils::GetData<TYPE>::return_type
323  get ( const std::string& location,
324  const bool useRootInTES = true ) const
325  {
326  return GaudiCommon<Algorithm>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
327  }
328 
361  template < class TYPE >
362  inline typename Gaudi::Utils::GetData<TYPE>::return_type
363  getIfExists ( const std::string& location ,
364  const bool useRootInTES = true ) const
365  {
366  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( evtSvc() , location , useRootInTES ) ;
367  }
368 
387  template < class TYPE >
388  inline TYPE* getDet ( IDataProviderSvc* svc ,
389  const std::string& location ) const
390  {
391  return GaudiCommon<Algorithm>::get<TYPE> ( svc , location , false ) ;
392  }
393 
416  template < class TYPE >
417  inline typename Gaudi::Utils::GetData<TYPE>::return_type
418  getDetIfExists ( IDataProviderSvc* svc ,
419  const std::string& location ) const
420  {
421  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( svc , location , false ) ;
422  }
423 
441  template < class TYPE >
442  inline TYPE* getDet ( const std::string& location ) const
443  {
444  return GaudiCommon<Algorithm>::get<TYPE> ( detSvc() , location , false ) ;
445  }
446 
468  template < class TYPE >
469  inline typename Gaudi::Utils::GetData<TYPE>::return_type
470  getDetIfExists ( const std::string& location ) const
471  {
472  return GaudiCommon<Algorithm>::getIfExists<TYPE> ( detSvc() , location , false ) ;
473  }
474 
501  template < class TYPE >
502  inline bool exist ( IDataProviderSvc* svc ,
503  const std::string& location ,
504  const bool useRootInTES = true ) const
505  {
506  return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , useRootInTES ) ;
507  }
508 
534  template < class TYPE >
535  inline bool exist ( const std::string& location ,
536  const bool useRootInTES = true ) const
537  {
538  return GaudiCommon<Algorithm>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
539  }
540 
557  template < class TYPE >
558  inline bool existDet ( IDataProviderSvc* svc ,
559  const std::string& location ) const
560  {
561  return GaudiCommon<Algorithm>::exist<TYPE> ( svc , location , false ) ;
562  }
563 
579  template < class TYPE >
580  inline bool existDet ( const std::string& location ) const
581  {
582  return GaudiCommon<Algorithm>::exist<TYPE> ( detSvc() , location , false ) ;
583  }
584 
612  template < class TYPE , class TYPE2 >
613  inline typename Gaudi::Utils::GetData<TYPE>::return_type
615  const std::string& location ,
616  const bool useRootInTES = true ) const
617  {
618  return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
619  }
620 
647  template < class TYPE , class TYPE2 >
648  inline typename Gaudi::Utils::GetData<TYPE>::return_type
649  getOrCreate ( const std::string& location ,
650  const bool useRootInTES = true ) const
651  {
652  return GaudiCommon<Algorithm>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
653  }
654 public:
655  // ==========================================================================
661  GaudiAlgorithm ( const std::string& name ,
662  ISvcLocator* pSvcLocator );
663  // ==========================================================================
665  virtual ~GaudiAlgorithm();
666  // ==========================================================================
667 public:
668  // ==========================================================================
672  SmartIF<INTupleSvc>& evtColSvc () const;
673  // ==========================================================================
674 private:
675  // ==========================================================================
676  // no public default constructor
677  GaudiAlgorithm();
678  // ==========================================================================
679  // no public copy constructor
680  GaudiAlgorithm ( const GaudiAlgorithm& );
681  // ==========================================================================
682  // no public assignment operator
684  // ==========================================================================
685 private:
686  // ==========================================================================
687  // Pointer to the Event Tag Collection Service
689 
693  // ==========================================================================
694 };
695 // ============================================================================
696 // The END
697 // ============================================================================
698 #endif // GAUDIALG_GaudiAlgorithm_H
699 // ============================================================================
700 
701 

Generated at Mon Feb 17 2014 14:37:37 for Gaudi Framework, version v25r0 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004