StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiDetectorGroup.h
1 #ifndef StiDetectorGroup_H_INCLUDED
2 #define StiDetectorGroup_H_INCLUDED
3 
4 #include <stdexcept>
5 
6 #include "Sti/StiGenericDetectorGroup.h"
7 #include "Sti/Base/Factory.h"
8 #include "Sti/StiToolkit.h"
9 template<class Event,class Detector> class StiHitLoader;
10 
11 template<class Event>
13 {
14  public:
15 
18  StiHitLoader<Event,StiDetectorBuilder> *hitLoader() {return _hitLoader;}
19 
20  protected:
21 
22  StiDetectorGroup(const string & name);
23  StiDetectorGroup(const string & name,
25  StiDetectorBuilder * detectorBuilder);
28 };
29 
30 
31 template<class Event>
34  StiDetectorBuilder * detectorBuilder)
35  : StiGenericDetectorGroup(name,detectorBuilder),
36  _hitLoader(hitLoader)
37 {
38  // If a loader was specified, make sure it uses the selected detector builder.
39  if (_hitLoader)
40  {
41  _hitLoader->setDetector(detectorBuilder);
42  }
43  initialize();
44 }
45 
46 template<class Event>
49  _hitLoader(0)
50 {
51  initialize();
52 }
53 
54 template<class Event>
56 {
57  delete _hitLoader;
58 }
59 
61 template<class Event>
63 {
64  if (_detectorBuilder==0)
65  {
66  string message = "StiDetectorGroup::getHitLoader() - ERROR - Hit loader requested for non active detector:";
67  message += getName();
68 // throw logic_error(message.c_str());
69  }
70  /* if (_hitLoader==0)
71  {
72  string message = "StiDetectorGroup::getHitLoader() - ERROR - Hit loader == 0 for detector:";
73  message += getName();
74  throw logic_error(message.c_str());
75  }*/
76  return _hitLoader;
77 }
78 #endif
79 
Abstract interface for a STI toolkit.
virtual StiHitLoader< Event, StiDetectorBuilder > * getHitLoader()
Get a hit loader appropriate for this detector group.