CFEL - ASG Software Suite  2.5.0
CASS
delayline_detector.cpp
Go to the documentation of this file.
1 //Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file delayline_detector.cpp file contains the implementatio of classes that
5  * describe a delayline detector.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #include <stdexcept>
11 
12 #include <QtCore/QStringList>
13 #include <QtCore/QString>
14 
15 #include "delayline_detector.h"
16 
17 #include "cass_settings.h"
19 
20 using namespace cass::ACQIRIS;
21 using namespace std;
22 
24 {
25  wireends_t::iterator it (_wireends.begin());
26  for (; it != _wireends.end(); ++it)
27  (*it).second.associate(evt);
28 }
29 
31 {
32  s.beginGroup("One");
33  _wireends['1'].loadSettings(s);
34  s.endGroup();
35  s.beginGroup("Two");
36  _wireends['2'].loadSettings(s);
37  s.endGroup();
38 }
39 
41 {
42  _newEventAssociated = true;
43  _hits.clear();
44  _mcp.associate(evt);
45  anodelayers_t::iterator it (_anodelayers.begin());
46  for (; it != _anodelayers.end(); ++it)
47  {
48  (*it).second.associate(evt);
49  }
50  particles_t::iterator pit (_particles.begin());
51  for (; pit != _particles.end();++pit)
52  (*pit).second.associate(this);
53 }
54 
56 {
58  DelaylineType delaylinetype
59  (static_cast<DelaylineType>(s.value("DelaylineType",Hex).toInt()));
60  s.beginGroup("MCP");
61  _mcp.loadSettings(s);
62  s.endGroup();
63  switch (delaylinetype)
64  {
65  case Hex:
66  s.beginGroup("ULayer");
67  _anodelayers['U'].loadSettings(s);
68  s.endGroup();
69  s.beginGroup("VLayer");
70  _anodelayers['V'].loadSettings(s);
71  s.endGroup();
72  s.beginGroup("WLayer");
73  _anodelayers['W'].loadSettings(s);
74  s.endGroup();
75  break;
76  case Quad:
77  s.beginGroup("XLayer");
78  _anodelayers['X'].loadSettings(s);
79  s.endGroup();
80  s.beginGroup("YLayer");
81  _anodelayers['Y'].loadSettings(s);
82  s.endGroup();
83  break;
84  default:
85  throw invalid_argument("DelaylineDetector::loadSettings(): delayline type '" +
86  toString(delaylinetype) + "' does not exist");
87  break;
88  }
89  _analyzer =
90  DetectorAnalyzerBackend::instance(static_cast<DetectorAnalyzerType>(s.value("AnalysisMethod",DelaylineSimple).toInt()));
91  _analyzer->loadSettings(s, *this);
92  s.beginGroup("Particles");
93  _particles.clear();
94  QStringList particlesNameList(s.childGroups());
95  QStringList::const_iterator pNamesIt (particlesNameList.begin());
96  for (; pNamesIt != particlesNameList.end();++pNamesIt)
97  {
98  s.beginGroup(*pNamesIt);
99  string particleName (pNamesIt->toStdString());
100  _particles[particleName].loadSettings(s);
101  s.endGroup();
102  }
103  s.endGroup();
104  s.endGroup();
105 }
106 
108 {
109  bool newEventAssociated (_newEventAssociated);
110  _newEventAssociated = false;
111  return (newEventAssociated)? (*_analyzer)(_hits):_hits;
112 }
static shared_pointer instance(const DetectorAnalyzerType &type)
create an instance of the right analyzer type
Event to store all LCLS Data.
Definition: cass_event.h:32
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
STL namespace.
detectorHits_t & hits()
return the detector hits
file contains the classes that describe a delayline detector.
fromStdString(const std::string &str)
DelaylineType
the types of delayline detectors that are available
file contains base class for all detector analyzers.
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::string toString(const Type &t)
convert any type to a string
Definition: cass.h:63
value(const QString &key, const QVariant &defaultValue=QVariant()
virtual void loadSettings(CASSSettings &s)
load the values from the .ini file
file contains specialized class that do the settings for cass
beginGroup(const QString &prefix)