CFEL - ASG Software Suite  2.5.0
CASS
coltrims_analysis.cpp
Go to the documentation of this file.
1 //Copyright (C) 2011 Lutz Foucar
2 
3 /**
4  * @file coltrims_analysis.cpp file contains the processor specific for
5  * coltrims analysis
6  *
7  * @author Lutz Foucar
8  */
9 
10 #include <stdexcept>
11 #include <cmath>
12 #include <algorithm>
13 
14 #include <QtCore/QString>
15 
16 #include "coltrims_analysis.h"
17 
19 #include "cass_event.h"
20 #include "acqiris_device.hpp"
21 #include "cass.h"
22 #include "convenience_functions.h"
23 #include "cass_settings.h"
24 #include "log.h"
25 
26 using namespace cass;
27 using namespace ACQIRIS;
28 using namespace std;
29 
30 
31 //----------------Electron Energy----------------------------------------------
32 pp5000::pp5000(const name_t &name)
33  : Processor(name)
34 
35 {
36  loadSettings(0);
37 }
38 
40 {
41  CASSSettings settings;
42  settings.beginGroup("Processor");
44  _detector = loadDelayDet(settings,5000,name());
45  _particle = loadParticle(settings,_detector,5000,name());
46  setupGeneral();
47  if (!setupCondition())
48  return;
50  Log::add(Log::INFO,"Processor '" + name() +
51  "' extracts the total momentum of the particle '" + _particle +
52  "' of detector '" + _detector +
53  "' and then converts it to Energy assuming that it is an electron. " +
54  "Condition is '" + _condition->name() + "'");
55 }
56 
57 void pp5000::process(const CASSEvent& evt, result_t &result)
58 {
59  DetectorBackend &rawdet(
60  HelperAcqirisDetectors::instance(_detector)->detector(evt));
61  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
62  Particle &particle(det.particles()[_particle]);
63  particleHits_t::iterator it(particle.hits().begin());
64  for (; it != particle.hits().end(); ++it)
65  {
66  double p = (*it)[roh];
67  double e_energy = p*p*13.6;
68  result.histogram(e_energy);
69  }
70 }
71 
72 
73 
74 //----------------PIPIPICO-------------------------------------------------------
75 pp5001::pp5001(const name_t &name)
76  :cass:: Processor(name)
77 {
78  loadSettings(0);
79 }
80 
82 {
83  CASSSettings settings;
84  settings.beginGroup("Processor");
86  _detector = settings.value("Detector","blubb").toString().toStdString();
87  setupGeneral();
88  if (!setupCondition())
89  return;
91  HelperAcqirisDetectors::instance(_detector)->loadSettings();
92  Log::add(Log::INFO,"Processor '" + name() +
93  "' create a tripple coincidence Histogram of particles of '" + _detector +
94  "'. Condition is '" + _condition->name() + "'");
95 }
96 
97 void pp5001::process(const CASSEvent& evt, result_t &result)
98 {
99  DetectorBackend &rawdet(
100  HelperAcqirisDetectors::instance(_detector)->detector(evt));
101  DelaylineDetector &det01 (dynamic_cast<DelaylineDetector&>(rawdet));
102  SignalProducer::signals_t::const_iterator it01(det01.mcp().output().begin());
103  SignalProducer::signals_t::const_iterator end(det01.mcp().output().end());
104  for (; it01 != end;++it01)
105  {
106  SignalProducer::signals_t::const_iterator it02(it01+1);
107  for (; it02 != end; ++it02)
108  {
109 
110  SignalProducer::signals_t::const_iterator it03(it02+1);
111  for (; it03 != end; ++it03)
112  {
113  result.histogram(make_pair((*it01)[ACQIRIS::time]+(*it02)[ACQIRIS::time],
114  (*it03)[ACQIRIS::time]));
115  }
116  }
117  }
118 }
119 
120 
particles_t & particles()
retrieve the particle container
Event to store all LCLS Data.
Definition: cass_event.h:32
virtual void createHistList(result_t::shared_pointer result)
create result list.
Definition: processor.cpp:79
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The first detector of the cooincdence.
const name_t name() const
retrieve the name of this processor
Definition: processor.h:167
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
file contains declaration of the CASSEvent
file contains declaration of classes that extract information of acqiris detectors.
Settings for CASS.
Definition: cass_settings.h:30
virtual void loadSettings(size_t)
load the histogram settings from file
Processor::result_t::shared_pointer set2DHist(const Processor::name_t &name)
function to set the 2d histogram properties from the ini file.
STL namespace.
ACQIRIS::DelaylineDetector::particles_t::key_type _particle
the particle we are working on
std::string loadParticle(CASSSettings &s, const std::string &detector, int ppNbr, const std::string &key)
load particle for a specific detector
SignalProducer & mcp()
retrieve the mcp
Definition: tof_detector.h:67
static void add(Level level, const std::string &line)
add a string to the log
Definition: log.cpp:31
fromStdString(const std::string &str)
pp5001(const name_t &)
Constructor for Number of Signals.
base class for processors.
Definition: processor.h:39
virtual void loadSettings(size_t)
load the histogram settings from file
file contains declaration of classes and functions that help other processors to do their job...
file contains the declaration of the acqiris part of the CASSEvent
file contains global definitions for project cass
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
std::string loadDelayDet(CASSSettings &s, int ppNbr, const std::string &key)
load detector from file
value(const QString &key, const QVariant &defaultValue=QVariant()
pp5000(const name_t &)
Constructor for Number of Signals.
void setupGeneral()
general setup of the processor
Definition: processor.cpp:85
file contains specialized class that do the settings for cass
signals_t & output()
return the signals
iterator histogram(const value_t &pos, const value_t &weight=1)
add the weight at the right bin for the value in the 1d array
Definition: result.hpp:651
Base class for all Detectors attached to an Acqiris Instrument.
shared_pointer _condition
pointer to the processor that will contain the condition
Definition: processor.h:277
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
Processor::result_t::shared_pointer set1DHist(const Processor::name_t &name)
function to set the 1d histogram properties from the ini file.
Electron detector
Definition: hdf5-input.ini:62
A Particle.
Definition: particle.h:70
bool setupCondition(bool defaultConditionType=true)
setup the condition.
Definition: processor.cpp:94
std::string name_t
define the name type
Definition: processor.h:46
contains a logger for cass
beginGroup(const QString &prefix)
file contains the processor specific for coltrims analysis