CFEL - ASG Software Suite  2.5.0
CASS
delayline_detector.h
Go to the documentation of this file.
1 //Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file delayline_detector.h file contains the classes that describe a
5  * delayline detector.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef _DELAYLINE_DETECTOR_H_
11 #define _DELAYLINE_DETECTOR_H_
12 
13 #include <vector>
14 #include <algorithm>
15 #include <stdexcept>
16 #include <memory>
17 
18 #include "tof_detector.h"
19 #include "signal_producer.h"
20 #include "particle.h"
21 
22 namespace cass
23 {
24 class CASSSettings;
25 
26 namespace ACQIRIS
27 {
28 //forward declarations
29 class DetectorAnalyzerBackend;
30 
31 /** A anode layer of the delayline detector.
32  *
33  * class containing the wireends of an anode layer of the detector.
34  *
35  * This class has no user settable parameters. It will only open groups for
36  * its different wireends. The groupname for the first wireend name is "One"
37  * and for the second its "Two".
38  *
39  * @cassttng AcqirisDetectors/\%detectorname\%/\%layername%/One\n
40  * groupname of the first wireend.
41  * See cass::ACQIRIS::SignalProducer
42  * @cassttng AcqirisDetectors/\%detectorname\%/\%layername%/Two\n
43  * groupname of the second wireend
44  * See cass::ACQIRIS::SignalProducer
45  *
46  * @author Lutz Foucar
47  */
49 {
50 public:
51  /** map of signals that form the wireends of the layer*/
52  typedef std::map<char,SignalProducer> wireends_t;
53 
54  /** load the values from the .ini file
55  *
56  * Will retrieve the settings for the wireends, which are singal producers.
57  * Opens a group called "One" and retrieves the settings for the first
58  * wireend signal producer and then does the same for the second wireend
59  * by opening a group called "Two". Please refer to
60  * SignalProducer::loadSettings() for further information.
61  *
62  * @param s the CASSSettings object we retrieve the values from
63  */
64  void loadSettings(CASSSettings &s);
65 
66  /** associate the event with this anodelayers signal producers
67  *
68  * associtates the event with this anodelayers wireends, which are singal
69  * producers. It just goes through the _wireends map and calls
70  * loadSettings for each value of the elements. Please refer to
71  * SignalProducer::associate() for further information.
72  *
73  * @param evt The event to associate with this anode layer
74  */
75  void associate(const CASSEvent &evt);
76 
77  /** return the wireends */
78  wireends_t &wireends() {return _wireends;}
79 
80 private:
81  /** container for the SignalProducers we call wireends */
82  wireends_t _wireends;
83 };
84 
85 
86 
87 
88 
89 
90 
91 
92 /** A delayline detector.
93  *
94  * A delayline detector is a tof detector with the ability to also have
95  * position information. It can be either a Hex or Quad delayline detector.
96  * It also contains detector hits. These are extracted by sorting the
97  * signals of the singal producers. To do this each detector has its own
98  * Analysis object. There are various ways to do this analysis, the user has
99  * the option to choose which one he wants to use. Please refer to the
100  * documentation of the different analyzers to find out their user settings.
101  *
102  * In addition to these parameters it will also opens the groups for the
103  * different layers. The groupnames depend on the Delaylinetype. For a
104  * Quad Anode it will be "XLayer" and "YLayer". For a Hex Anode it will be
105  * "ULayer", "VLayer" and "WLayer". Please refer to AnodeLayer for the
106  * user settable parameters of the anode layers.
107  *
108  * @todo instead of having a layer (which does nothing) and a wireend a det
109  * should have a map of string, signalproducers. THis way one could
110  * possibly get rid of the two classes. One has to create a dethit
111  * identifier for creating a detecthit list for tof dets (the output of
112  * the sig prod. then one could also use the particle class to identif
113  * particles. later on one could calc the enegey using the eland
114  * methos (stuff that koji and marco added). In this case one could
115  * also flatten the directory structure maybe make a sublib for this
116  * acqiris lib
117  *
118  * @cassttng AcqirisDetectors/\%detectorname\%/{AnalysisMethod}\n
119  * Method that is used to reconstruct the detector hits. Default
120  * is 0. Choises are:
121  * - 0: Simple Analysis:
122  * (see cass::ACQIRIS::DelaylineDetectorAnalyzerSimple)
123  * - 1: Achims Routine for Hex anodes: See cass::ACQIRIS::HexSorter)
124  * - 3: Simple non sorting: See cass::ACQIRIS::DelaylineNonSorting)
125  * @cassttng AcqirisDetectors/\%detectorname\%/{DelaylineType}\n
126  * What kind of Delaylinedetector are we. Default is 0
127  * - 0: Quad Anode
128  * - 1: Hex Anode
129  * @cassttng AcqirisDetectors/\%detectorname\%/MCP\n
130  * Name of the MCP Signal. See cass::ACQIRIS::SignalProducer
131  * @cassttng AcqirisDetectors/\%detectorname\%/XLayer\n
132  * groupname of the X Layer, when DelaylineType is Quad
133  * see cass::ACQIRIS::AnodeLayer
134  * @cassttng AcqirisDetectors/\%detectorname\%/YLayer\n
135  * groupname of the Y Layer, when DelaylineType is Quad
136  * see cass::ACQIRIS::AnodeLayer
137  * @cassttng AcqirisDetectors/\%detectorname\%/ULayer\n
138  * groupname of the U Layer, when DelaylineType is Hex
139  * see cass::ACQIRIS::AnodeLayer
140  * @cassttng AcqirisDetectors/\%detectorname\%/VLayer\n
141  * groupname of the V Layer, when DelaylineType is Hex
142  * see cass::ACQIRIS::AnodeLayer
143  * @cassttng AcqirisDetectors/\%detectorname\%/WLayer\n
144  * groupname of the W Layer, when DelaylineType is Hex
145  * see cass::ACQIRIS::AnodeLayer
146  * @cassttng AcqirisDetectors/\%detectorname\%/Particles\n
147  * groupname of the user definable Particles.
148  * see cass::ACQIRIS::Particle
149  *
150  * @author Lutz Foucar
151  */
153 {
154 public:
155  /** define the anodelayers */
156  typedef std::map<char,AnodeLayer> anodelayers_t;
157 
158  /** define the particles */
159  typedef std::map<std::string,Particle> particles_t;
160 
161 public:
162  /** constructor.
163  *
164  * @param[in] name the name of this detector
165  */
166  DelaylineDetector(const std::string name)
167  :TofDetector(name),
168  _newEventAssociated(false)
169  {}
170 
171 public:
172  /** load the values from the .ini file
173  *
174  * this function will load the settings of this detector, which are
175  * described in the class description. Next to those it will load the
176  * settings of its SignalProducers (mcp and anodelayers). The anode layers
177  * to load are chosen on the Delaylinetype. Please refer to
178  * SignalProducer::loadSettings() for further information.\n
179  * Then it will create the requested analyzer by calling
180  * DetectorAnalyzerBackend::instance() and load the settings for the
181  * analyzer. Please refer to the analyzers loadSettings() member for
182  * further information.\n
183  * Create the particles map from the subgroups of the "Particle" group in
184  * the .ini file. Therefore retrieve a string list of all subgroup names
185  * under particle. Iterate through this list and create a particle for
186  * entry in the list and call Particle::loadSettings() for it after opening
187  * a group with the name of the particle. After loading the particles
188  * parameters put the particle into the container.
189  *
190  * @param s the CASSSettings object we retrieve the values from
191  */
192  virtual void loadSettings(CASSSettings &s);
193 
194  /** associate the event with this detector
195  *
196  * when this is called, it means that a data from a new event will be
197  * available. Therefore the _newEventAssociatad is set to true and the
198  * _hits container is cleared. Then the Signalproduers of this detector
199  * (the mcp and all anodlayers) will be associated with this event. Please
200  * refer to SignalProducer::associate() for further information.\n
201  * Then associate all particles with the detectorhits of this detector by
202  * calling Particle::associate() for each particle in the container.
203  *
204  * @param evt The event to associate with this detector
205  */
206  void associate (const CASSEvent& evt);
207 
208  /** return the layers */
209  anodelayers_t &layers() {return _anodelayers;}
210 
211  /** return the detector hits
212  *
213  * When a new event was associated with this detector, calling this
214  * function will first create the detector hits from the signals of the
215  * signal producers with the help of the _analyzer. When the _analyzer has
216  * already created this list, then it will be just returned.
217  *
218  * @return the list of detector hits
219  */
220  detectorHits_t &hits();
221 
222  /** retrieve the particle container */
223  particles_t& particles() {return _particles;}
224 
225  /** retrieve the particle container without changing it */
226  const particles_t& particles()const {return _particles;}
227 
228  /** retrieve the detector type */
229  DetectorType type()const {return Delayline;}
230 
231  /** retrieve the anode type property
232  *
233  * detector is hex when it has a U-Layer
234  */
235  bool isHex()const {return (_anodelayers.find('U') != _anodelayers.end());}
236 
237 private:
238  /** delayline detector has anode wire layers */
239  anodelayers_t _anodelayers;
240 
241  /** container for all reconstructed detector hits*/
243 
244  /** the analyzer that will sort the signal to hits */
245  std::tr1::shared_ptr<DetectorAnalyzerBackend> _analyzer;
246 
247  /** container for all particles of this detector */
248  particles_t _particles;
249 
250  /** flag to show whether there is a new event associated whith this */
252 
253 };
254 
255 }//end namespace acqiris
256 }//end namespace cass
257 
258 
259 #endif
260 
261 
262 
263 
264 
particles_t & particles()
retrieve the particle container
Event to store all LCLS Data.
Definition: cass_event.h:32
file contains the classes that describe how to analyze the waveform and stores the result...
particles_t _particles
container for all particles of this detector
anodelayers_t _anodelayers
delayline detector has anode wire layers
std::map< std::string, Particle > particles_t
define the particles
wireends_t _wireends
container for the SignalProducers we call wireends
bool _newEventAssociated
flag to show whether there is a new event associated whith this
Settings for CASS.
Definition: cass_settings.h:30
void associate(const CASSEvent &evt)
associate the event with this detector
std::vector< detectorHit_t > detectorHits_t
define container for all detector hits
detectorHits_t & hits()
return the detector hits
wireends_t & wireends()
return the wireends
A Time of Flight Detector.
Definition: tof_detector.h:33
const particles_t & particles() const
retrieve the particle container without changing it
DetectorType
the types of detectors that are available
anodelayers_t & layers()
return the layers
std::tr1::shared_ptr< DetectorAnalyzerBackend > _analyzer
the analyzer that will sort the signal to hits
void associate(const CASSEvent &evt)
associate the event with this anodelayers signal producers
void loadSettings(CASSSettings &s)
load the values from the .ini file
std::map< char, SignalProducer > wireends_t
map of signals that form the wireends of the layer
const std::string name() const
return the detector name
bool isHex() const
retrieve the anode type property
virtual void loadSettings(CASSSettings &s)
load the values from the .ini file
file contains the classes that describe a particle that hit a delayline detector. ...
detectorHits_t _hits
container for all reconstructed detector hits
A anode layer of the delayline detector.
DetectorType type() const
retrieve the detector type
DelaylineDetector(const std::string name)
constructor.
std::map< char, AnodeLayer > anodelayers_t
define the anodelayers
file contains the declaration of the class that describes a Time Of Flight Detector.