CFEL - ASG Software Suite  2.5.0
CASS
detector_backend.h
Go to the documentation of this file.
1 // Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file detector_backend.h contains the base class declaration for all detectors
5  * that are attached to an acqiris device.
6  *
7  * @todo create another acqiris detector, that will just measure the voltage
8  * on a given channel
9  * @todo use shared pointers
10  *
11  * @author Lutz Foucar
12  */
13 
14 #ifndef _DETECTOR_BACKEND_H_
15 #define _DETECTOR_BACKEND_H_
16 
17 #include <iostream>
18 #include <tr1/memory>
19 
21 
22 namespace cass
23 {
24 class CASSEvent;
25 class CASSSettings;
26 
27 namespace ACQIRIS
28 {
29 class DetectorAnalyzerBackend;
30 
31 /** Base class for all Detectors attached to an Acqiris Instrument.
32  *
33  * @todo this class can have the conatiner for all signal producers. It can
34  * also have the container for all particles and detectorhits. In case
35  * it is a tof detector it just won't have the px and py components and
36  * related values. This sig prod will just be call either "u1" .. so the
37  * map is of string,sigprod instead of char,sigprod. When changing this
38  * also change the directory structure by flatening it out so that one
39  * can call make -j. (Or create a .pro file for each subfolder)
40  *
41  * @author Lutz Foucar
42  */
44 {
45 public:
46  /** a shared pointer of this type */
47  typedef std::tr1::shared_ptr<DetectorBackend> shared_pointer;
48 
49 protected:
50  /** constructor.
51  *
52  * @param[in] name the name of the detector
53  */
54  DetectorBackend(const std::string name)
55  :_name(name)
56  {}
57 
58 public:
59  /** virtual destructor*/
60  virtual ~DetectorBackend() {}
61 
62  /** load the settings of the detector
63  *
64  * load the settings from the .ini file. Needs to be implemented by the
65  * detector that inherits from this.
66  *
67  * @param s reference to the CASSSettings object
68  */
69  virtual void loadSettings(CASSSettings &s)=0;
70 
71  /** associate the event with this detector
72  *
73  * retrieve all necessary information for this detector from the event.
74  * Needs to be implemented by the detector inheriting from this.
75  *
76  * @param evt The event to take the data from
77  */
78  virtual void associate(const CASSEvent& evt)=0;
79 
80  /** return the detector name*/
81  const std::string name()const {return _name;}
82 
83  /** create an instance of the requested dectortype
84  *
85  * if the requested detector type is not known an exception will be thrown
86  *
87  * @return an instance of the the requested detector type.
88  * @param dettype type that the detector should have
89  * @param detname the name of the detector in the .ini file
90  */
91  static shared_pointer instance(const DetectorType &dettype, const std::string &detname);
92 
93  /** retrieve what kind of detector this is */
94  virtual DetectorType type()=0;
95 
96 protected:
97  /** the name of the detector. used for casssettings group*/
98  std::string _name;
99 
100 private:
101  /** default constructor should not be called therefore its privat*/
102  DetectorBackend():_name("unamed") {}
103 };
104 }//end namespace acqiris
105 }//end namespace cass
106 
107 #endif
Event to store all LCLS Data.
Definition: cass_event.h:32
std::tr1::shared_ptr< DetectorBackend > shared_pointer
a shared pointer of this type
Settings for CASS.
Definition: cass_settings.h:30
static shared_pointer instance(const DetectorType &dettype, const std::string &detname)
create an instance of the requested dectortype
virtual void loadSettings(CASSSettings &s)=0
load the settings of the detector
DetectorType
the types of detectors that are available
DetectorBackend()
default constructor should not be called therefore its privat
contains the global definitions for acqiris analysis
virtual ~DetectorBackend()
virtual destructor
virtual void associate(const CASSEvent &evt)=0
associate the event with this detector
const std::string name() const
return the detector name
std::string _name
the name of the detector.
Base class for all Detectors attached to an Acqiris Instrument.
virtual DetectorType type()=0
retrieve what kind of detector this is
DetectorBackend(const std::string name)
constructor.