CFEL - ASG Software Suite  2.5.0
CASS
acqiris_detectors.cpp
Go to the documentation of this file.
1 //Copyright (C) 2010 Lutz Foucar
2 
3 /**
4  * @file acqiris_detectors.cpp file contains definition of processors that
5  * extract information of acqiris detectors.
6  *
7  * @author Lutz Foucar
8  */
9 
10 #include <stdexcept>
11 #include <cmath>
12 #include <algorithm>
13 #include <tr1/memory>
14 
15 #include <QtCore/QString>
16 
17 #include "acqiris_detectors.h"
19 #include "result.hpp"
20 #include "cass_event.h"
21 #include "acqiris_device.hpp"
22 #include "cass.h"
23 #include "convenience_functions.h"
24 #include "cass_settings.h"
25 #include "log.h"
26 
27 using namespace cass;
28 using namespace ACQIRIS;
29 using namespace std;
30 using std::tr1::dynamic_pointer_cast;
31 using std::tr1::shared_ptr;
32 
33 namespace cass
34 {
35 namespace ACQIRIS
36 {
37 /** load layer from file
38  *
39  * load the requested layer from .ini file and checks whether it is valid.
40  * If it is not valid an invalid_argument exception is thrown
41  *
42  * @return key containing the layer name
43  * @param s CASSSettings object to read the info from
44  * @param detector the name of the detector that contains the layer
45  * @param layerKey key how the layer value is called in the .ini file
46  * @param ppNbr the processor number of the processor calling this function
47  * @param key the key of the processor calling this function
48  *
49  * @author Lutz Foucar
50  */
51 DelaylineDetector::anodelayers_t::key_type loadLayer(CASSSettings &s,
52  const HelperAcqirisDetectors::helperinstancesmap_t::key_type &detector,
53  const std::string &layerKey,
54  int ppNbr,
55  const string& key)
56 {
58  DelaylineDetector::anodelayers_t::key_type layer
59  (s.value(layerKey.c_str(),"U").toString()[0].toLatin1());
60  if (layer != 'U' && layer != 'V' && layer != 'W' &&
61  layer != 'X' && layer != 'Y')
62  {
63  throw invalid_argument("pp" + toString(ppNbr) + "::loadSettings()'" + key +
64  "': The loaded value of '" + layerKey +"' '"+ layer +
65  "' does not exist. Can only be 'U', 'V', 'W', 'X' or 'Y'");
66  }
67  else if (dynamic_cast<const DelaylineDetector&>(dethelp->detector()).isHex())
68  {
69  if (layer == 'X' || layer == 'Y')
70  throw invalid_argument("pp"+ toString(ppNbr) + "::loadSettings()'"+ key +
71  "': Detector '" + detector +
72  "' is Hex-detector and cannot have Layer '" +layer +"'");
73  }
74  else
75  {
76  if (layer == 'U' || layer == 'V' || layer == 'W')
77  throw invalid_argument("pp" + toString(ppNbr) + "::loadSettings()'" + key +
78  "': Detector '" + detector +
79  "' is Quad-detector and cannot have Layer '" + layer + "'");
80  }
81  return layer;
82 }
83 
84 /** load wireend from file
85  *
86  * load the requested wireend from .ini file. Check whether it is a valid
87  * wireend otherwise throw invalid_argument exception.
88  *
89  * @return key containing the wireend name
90  * @param s CASSSettings object to read the info from
91  * @param wireendKey key how the wireend value is called in the .ini file
92  * @param ppNbr the processor number of the processor calling this function
93  * @param key the key of the processor calling this function
94  *
95  * @author Lutz Foucar
96  */
97 AnodeLayer::wireends_t::key_type loadWireend(CASSSettings &s,
98  const std::string & wireendKey,
99  int ppNbr,
100  const string& key)
101 {
102  AnodeLayer::wireends_t::key_type wireend
103  (s.value(wireendKey.c_str(),"1").toString()[0].toLatin1());
104  if (wireend != '1' && wireend != '2')
105  throw invalid_argument("pp" + toString(ppNbr) + "::loadSettings()'" + key +
106  "': The loaded value of '" + wireendKey +
107  "' '" + wireend + "' does not exist. Can only be '1' or '2'");
108  return wireend;
109 }
110 }//end namespace acqiris
111 }//end namespace cass
112 
113 
114 
115 //----------------Nbr of Peaks MCP---------------------------------------------
116 pp150::pp150(const name_t &name)
117  : Processor(name)
118 {
119  loadSettings(0);
120 }
121 
123 {
124  CASSSettings s;
125  s.beginGroup("Processor");
127  setupGeneral();
128  if (!setupCondition())
129  return;
130  _detector = s.value("Detector","blubb").toString().toStdString();
131  HelperAcqirisDetectors::instance(_detector)->loadSettings();
133  Log::add(Log::INFO,"Processor '" + name() +
134  "' retrieves the nbr of mcp signals of detector '" + _detector +
135  "'. Condition is '" + _condition->name() + "'");
136 }
137 
138 void pp150::process(const CASSEvent &evt, result_t &result)
139 {
140  DetectorBackend &rawdet(
141  HelperAcqirisDetectors::instance(_detector)->detector(evt));
142  TofDetector &det(dynamic_cast<TofDetector&>(rawdet));
143 
144  result.setValue(det.mcp().output().size());
145 }
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 //----------------MCP Hits (Tof)-----------------------------------------------
157 pp151::pp151(const name_t &name)
158  : Processor(name)
159 {
160  loadSettings(0);
161 }
162 
164 {
165  CASSSettings s;
166  s.beginGroup("Processor");
168  setupGeneral();
169  if (!setupCondition())
170  return;
171  _detector = s.value("Detector","blubb").toString().toStdString();
172  HelperAcqirisDetectors::instance(_detector)->loadSettings();
174  Log::add(Log::INFO,"Processor '" + name() +
175  "' histograms times of the found mcp signals of detector '" + _detector +
176  "'. Condition is '"+ _condition->name() + "'");
177 }
178 
179 void pp151::process(const CASSEvent &evt, result_t &result)
180 {
181  DetectorBackend &rawdet(
182  HelperAcqirisDetectors::instance(_detector)->detector(evt));
183  TofDetector &det(dynamic_cast<TofDetector&>(rawdet));
184  SignalProducer::signals_t::const_iterator it (det.mcp().output().begin());
185  SignalProducer::signals_t::const_iterator end (det.mcp().output().end());
186 
187  while ( it != end )
188  result.histogram((*it++)[ACQIRIS::time]);
189 }
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 //----------------MCP Fwhm vs. height------------------------------------------
201 pp152::pp152(const name_t &name)
202  : Processor(name)
203 {
204  loadSettings(0);
205 }
206 
208 {
209  CASSSettings s;
210  s.beginGroup("Processor");
212  setupGeneral();
213  if (!setupCondition())
214  return;
215  _detector = s.value("Detector","blubb").toString().toStdString();
216  HelperAcqirisDetectors::instance(_detector)->loadSettings();
218  Log::add(Log::INFO,"Processor '" + name() +
219  "' histograms the FWHM vs the height of the found mcp signals" +
220  " of detector '" + _detector + "'. Condition is '" +
221  _condition->name() + "'");
222 }
223 
224 void pp152::process(const CASSEvent &evt, result_t &result)
225 {
226  DetectorBackend &rawdet(
227  HelperAcqirisDetectors::instance(_detector)->detector(evt));
228  TofDetector &det(dynamic_cast<TofDetector&>(rawdet));
229  SignalProducer::signals_t::const_iterator it(det.mcp().output().begin());
230  SignalProducer::signals_t::const_iterator end(det.mcp().output().end());
231 
232  for (; it != end; ++it)
233  result.histogram(make_pair((*it)[fwhm],(*it)[height]));
234 }
235 
236 
237 
238 
239 
240 
241 
242 
243 //----------------Deadtime between consecutive MCP signals----------------------
244 pp153::pp153(const name_t &name)
245  : Processor(name)
246 {
247  loadSettings(0);
248 }
249 
251 {
252  CASSSettings s;
253  s.beginGroup("Processor");
255  setupGeneral();
256  if (!setupCondition())
257  return;
258  _detector = s.value("Detector","blubb").toString().toStdString();
259  HelperAcqirisDetectors::instance(_detector)->loadSettings();
261  Log::add(Log::INFO,"Processor '" + name() +
262  "' creates a histogram of the deatime between two consecutive " +
263  "MCP Signals of detctor '" + _detector +
264  "'. Condition is '" + _condition->name() + "'");
265 }
266 
267 void pp153::process(const CASSEvent& evt, result_t &result)
268 {
269  DetectorBackend &rawdet(
270  HelperAcqirisDetectors::instance(_detector)->detector(evt));
271  TofDetector &det(dynamic_cast<TofDetector&>(rawdet));
272  const SignalProducer::signals_t& mcp(det.mcp().output());
273 
274  for (size_t i(1); i < mcp.size(); ++i)
275  result.histogram(mcp[i-1][ACQIRIS::time] - mcp[i][ACQIRIS::time]);
276 }
277 
278 
279 
280 
281 
282 
283 
284 
285 
286 
287 
288 
289 //----------------Nbr of Peaks Anode-------------------------------------------
290 pp160::pp160(const name_t &name)
291  : Processor(name)
292 {
293  loadSettings(0);
294 }
295 
297 {
298  CASSSettings s;
299  s.beginGroup("Processor");
301  setupGeneral();
302  if (!setupCondition())
303  return;
304  _detector = loadDelayDet(s,160,name());
305  _layer = loadLayer(s,_detector,"Layer",160,name());
306  _signal = loadWireend(s,"Wireend",160,name());
308  Log::add(Log::INFO,"Processor '" + name() +
309  "' outputs the nbr of signals of layer '" + _layer + "' wireend '" +
310  _signal + "' of detector '" + _detector +"'. Condition is '" +
311  _condition->name() + "'");
312 }
313 
314 void pp160::process(const CASSEvent& evt, result_t &result)
315 {
316  DetectorBackend &rawdet(
317  HelperAcqirisDetectors::instance(_detector)->detector(evt));
318  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
319 
320  result.setValue(det.layers()[_layer].wireends()[_signal].output().size());
321 }
322 
323 
324 
325 
326 
327 
328 
329 
330 
331 
332 
333 //----------------FWHM vs. Height of Wireend Signals---------------------------
334 pp161::pp161(const name_t &name)
335  : Processor(name)
336 {
337  loadSettings(0);
338 }
339 
341 {
342  CASSSettings s;
343  s.beginGroup("Processor");
345  setupGeneral();
346  if (!setupCondition())
347  return;
348  _detector = loadDelayDet(s,161,name());
349  _layer = loadLayer(s,_detector,"Layer",161,name());
350  _signal = loadWireend(s,"Wireend",161,name());
352  Log::add(Log::INFO,"Processor '" + name() +
353  "' histograms the FWHM vs the height from the signals of layer '" +
354  _layer + "' wireend '" + _signal + "' of detector '" + _detector +
355  "'. Condition is '" + _condition->name() + "'");
356 }
357 
358 void pp161::process(const CASSEvent& evt, result_t &result)
359 {
360  DetectorBackend &rawdet(
361  HelperAcqirisDetectors::instance(_detector)->detector(evt));
362  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
363  SignalProducer::signals_t::const_iterator it (det.layers()[_layer].wireends()[_signal].output().begin());
364  SignalProducer::signals_t::const_iterator end (det.layers()[_layer].wireends()[_signal].output().end());
365 
366  for (; it != end; ++it)
367  result.histogram(make_pair((*it)[fwhm],(*it)[height]));
368 }
369 
370 
371 
372 
373 
374 
375 
376 
377 
378 
379 //----------------Timesum for the layers---------------------------------------
380 pp162::pp162(const name_t &name)
381  : Processor(name)
382 {
383  loadSettings(0);
384 }
385 
387 {
388  CASSSettings s;
389  s.beginGroup("Processor");
391  setupGeneral();
392  if (!setupCondition())
393  return;
394  _detector = loadDelayDet(s,162,name());
395  _layer = loadLayer(s,_detector,"Layer",162,name());
396  _range = make_pair(s.value("TimeRangeLow",0).toDouble(),
397  s.value("TimeRangeHigh",20000).toDouble());
399  Log::add(Log::INFO,"Processor '" + name() +
400  "' calculates the timesum of layer '" + _layer + "' of detector '" +
401  _detector + "'. It will use the first signals that appeared in the" +
402  "ToF range from '" + toString(_range.first) + "' ns to '" +
403  toString(_range.second) + "' ns. Condition is '" + _condition->name() + "'");
404 }
405 
406 void pp162::process(const CASSEvent& evt, result_t &result)
407 {
408  DetectorBackend &rawdet(
409  HelperAcqirisDetectors::instance(_detector)->detector(evt));
410  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
411  const double one (det.layers()[_layer].wireends()['1'].firstGood(_range));
412  const double two (det.layers()[_layer].wireends()['2'].firstGood(_range));
413  const double mcp (det.mcp().firstGood(_range));
414 
415  result.setValue(one + two - 2.*mcp);
416 }
417 
418 
419 
420 
421 
422 
423 
424 
425 
426 
427 //----------------Timesum vs Position for the layers--------------------------
428 pp163::pp163(const name_t &name)
429  : Processor(name)
430 {
431  loadSettings(0);
432 }
433 
435 {
436  CASSSettings s;
437  s.beginGroup("ostProcessor");
439  setupGeneral();
440  if (!setupCondition())
441  return;
442  _detector = loadDelayDet(s,163,name());
443  _layer = loadLayer(s,_detector,"Layer",163,name());
444  _range = make_pair(s.value("TimeRangeLow",0).toDouble(),
445  s.value("TimeRangeHigh",20000).toDouble());
447  Log::add(Log::INFO,"Processor '" + name() +
448  "' histograms the timesum vs Positon on layer '" + _layer + "' of detector '" +
449  _detector + "'. Condition is '" + _condition->name() + "'");
450 }
451 
452 void pp163::process(const CASSEvent& evt, result_t &result)
453 {
454  DetectorBackend &rawdet(
455  HelperAcqirisDetectors::instance(_detector)->detector(evt));
456  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
457  const double one (det.layers()[_layer].wireends()['1'].firstGood(_range));
458  const double two (det.layers()[_layer].wireends()['2'].firstGood(_range));
459  const double mcp (det.mcp().firstGood(_range));
460  const double timesum (one + two - 2.*mcp);
461  const double position (one - two);
462 
463  result.histogram(make_pair(position,timesum));
464 }
465 
466 
467 
468 
469 
470 
471 
472 
473 
474 
475 
476 //----------------Detector First Hit-------------------------------------------
477 pp164::pp164(const name_t &name)
478  : Processor(name)
479 {
480  loadSettings(0);
481 }
482 
484 {
485  CASSSettings s;
486  s.beginGroup("Processor");
488  setupGeneral();
489  if (!setupCondition())
490  return;
491  _detector = loadDelayDet(s,164,name());
492  _first = loadLayer(s,_detector,"FirstLayer",164,name());
493  _second = loadLayer(s,_detector,"SecondLayer",164,name());
494  _range = make_pair(s.value("TimeRangeLow",0).toDouble(),
495  s.value("TimeRangeHigh",20000).toDouble());
496  _tsrange = make_pair(make_pair(s.value("TimesumFirstLayerLow",20).toDouble(),
497  s.value("TimesumFirstLayerHigh",200).toDouble()),
498  make_pair(s.value("TimesumSecondLayerLow",20).toDouble(),
499  s.value("TimesumSecondLayerHigh",200).toDouble()));
501  Log::add(Log::INFO,"Processor '" + name() +
502  "' creates a detector picture of the first Hit on the detector created" +
503  " from Layers '" + _first + "' and '" + _second + "' of detector '" +
504  _detector + "'. The signals from wich the frist hit is calculated have to be in the" +
505  " range from '" + toString(_range.first) + "' ns to '" + toString(_range.second) +
506  "' ns. The Timesum range of the first layer goes from '"+ toString(_tsrange.first.first) +
507  "' to '" + toString(_tsrange.first.second) + "'. The Timesum range of the second layer goes from '" +
508  toString(_tsrange.second.first) + "' to '" + toString(_tsrange.second.second) +
509  "'. Condition is '" + _condition->name() + "'");
510 }
511 
512 void pp164::process(const CASSEvent& evt, result_t &result)
513 {
514  DetectorBackend &rawdet(
515  HelperAcqirisDetectors::instance(_detector)->detector(evt));
516  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
517  const double f1 (det.layers()[_first].wireends()['1'].firstGood(_range));
518  const double f2 (det.layers()[_first].wireends()['2'].firstGood(_range));
519  const double s1 (det.layers()[_second].wireends()['1'].firstGood(_range));
520  const double s2 (det.layers()[_second].wireends()['2'].firstGood(_range));
521  const double mcp (det.mcp().firstGood(_range));
522  const double tsf (f1 + f2 - 2.*mcp);
523  const double tss (s1 + s2 - 2.*mcp);
524  const double f (f1-f2);
525  const double s (s1-s2);
526  const bool csf = (_tsrange.first.first < tsf && tsf < _tsrange.first.second);
527  const bool css = (_tsrange.second.first < tss && tss < _tsrange.second.second);
528 
529  if (csf && css)
530  result.histogram(make_pair(f,s));
531 }
532 
533 
534 
535 
536 
537 
538 
539 
540 
541 
542 
543 
544 
545 
546 
547 
548 
549 
550 //----------------Nbr of rec. Hits --------------------------------------------
551 pp165::pp165(const name_t &name)
552  : Processor(name)
553 {
554  loadSettings(0);
555 }
556 
558 {
559  CASSSettings s;
560  s.beginGroup("Processor");
562  setupGeneral();
563  if (!setupCondition())
564  return;
565  _detector = loadDelayDet(s,165,name());
567  Log::add(Log::INFO,"Processor '" + name() +
568  "' outputs the number of reconstructed hits of detector '" + _detector +
569  "'. Condition is '" + _condition->name() + "'");
570 }
571 
572 void pp165::process(const CASSEvent& evt, result_t &result)
573 {
574  DetectorBackend &rawdet(
575  HelperAcqirisDetectors::instance(_detector)->detector(evt));
576  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
577 
578  result.setValue(det.hits().size());
579 }
580 
581 
582 
583 
584 
585 
586 
587 
588 
589 
590 
591 
592 
593 
594 
595 
596 //----------------Detector Values----------------------------------------------
597 pp166::pp166(const name_t &name)
598  : Processor(name)
599 {
600  loadSettings(0);
601 }
602 
604 {
605  CASSSettings s;
606  s.beginGroup("Processor");
608  setupGeneral();
609  if (!setupCondition())
610  return;
611  _detector = loadDelayDet(s,166,name());
612  _first = static_cast<ACQIRIS::detectorHits>(s.value("XInput",0).toInt());
613  _second = static_cast<ACQIRIS::detectorHits>(s.value("YInput",1).toInt());
614  _third = static_cast<ACQIRIS::detectorHits>(s.value("ConditionInput",2).toInt());
615  _cond = make_pair(min(s.value("ConditionLow",-50000.).toFloat(),
616  s.value("ConditionHigh",50000.).toFloat()),
617  max(s.value("ConditionLow",-50000.).toFloat(),
618  s.value("ConditionHigh",50000.).toFloat()));
620  Log::add(Log::INFO,"Processor '" + name() + "' histograms the Property '" +
621  toString(_second) + "' vs. '" + toString(_first) +
622  "' of the reconstructed detectorhits of detector '" + _detector +
623  "'. It puts a condition from '" + toString(_cond.first) +
624  "' to '" + toString(_cond.second) + "' on Property '" + toString(_third) +
625  "'. Condition is '" + _condition->name() + "'");
626 }
627 
628 void pp166::process(const CASSEvent& evt, result_t &result)
629 {
630  DetectorBackend &rawdet(
631  HelperAcqirisDetectors::instance(_detector)->detector(evt));
632  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
633  detectorHits_t::iterator it (det.hits().begin());
634  detectorHits_t::iterator end (det.hits().end());
635  for (; it != end; ++it)
636  {
637  if (_cond.first < (*it)[_third] && (*it)[_third] < _cond.second)
638  result.histogram(make_pair((*it)[_first],(*it)[_second]));
639  }
640 }
641 
642 
643 
644 
645 
646 
647 
648 //----------------Deadtime between consecutive Anode signals----------------------
649 pp167::pp167(const name_t &name)
650  : Processor(name)
651 {
652  loadSettings(0);
653 }
654 
656 {
657  CASSSettings s;
658  s.beginGroup("Processor");
660  setupGeneral();
661  if (!setupCondition())
662  return;
663  _detector = loadDelayDet(s,167,name());
664  _layer = loadLayer(s,_detector,"Layer",167,name());
665  _signal = loadWireend(s,"Wireend",167,name());
667  HelperAcqirisDetectors::instance(_detector)->loadSettings();
668  Log::add(Log::INFO,"Processor '" + name() +
669  "' creates a histogram of the deatime between two consecutive " +
670  "Anode Signals of detctor '" + _detector +
671  "'. Condition is '" + _condition->name() + "'");
672 }
673 
674 void pp167::process(const CASSEvent& evt, result_t &result)
675 {
676  DetectorBackend &rawdet(
677  HelperAcqirisDetectors::instance(_detector)->detector(evt));
678  DelaylineDetector &det(dynamic_cast<DelaylineDetector&>(rawdet));
679  const SignalProducer::signals_t& anode(det.layers()[_layer].wireends()[_signal].output());
680 
681  for (size_t i(1); i < anode.size(); ++i)
682  result.histogram(anode[i-1][ACQIRIS::time] - anode[i][ACQIRIS::time]);
683 }
684 
685 
686 
687 
688 
689 
690 //----------------PIPICO-------------------------------------------------------
691 pp220::pp220(const name_t &name)
692  : Processor(name)
693 {
694  loadSettings(0);
695 }
696 
698 {
699  CASSSettings s;
700  s.beginGroup("Processor");
702  _detector01 = s.value("FirstDetector","blubb").toString().toStdString();
703  _detector02 = s.value("SecondDetector","blubb").toString().toStdString();
704  setupGeneral();
705  if (!setupCondition())
706  return;
708  HelperAcqirisDetectors::instance(_detector01)->loadSettings();
709  HelperAcqirisDetectors::instance(_detector02)->loadSettings();
710  Log::add(Log::INFO,"Processor '"+ name() +
711  "' create a PIPICO Histogram of detectors '" + _detector01 +
712  "' and '" + _detector02 + "'. Condition is '"+ _condition->name() + "'");
713 }
714 
715 void pp220::process(const CASSEvent& evt, result_t &result)
716 {
717  DetectorBackend &rawdet01(
718  HelperAcqirisDetectors::instance(_detector01)->detector(evt));
719  TofDetector &det01(dynamic_cast<TofDetector&>(rawdet01));
720  DetectorBackend &rawdet02(
721  HelperAcqirisDetectors::instance(_detector02)->detector(evt));
722  TofDetector &det02(dynamic_cast<TofDetector&>(rawdet02));
723  SignalProducer::signals_t::const_iterator it01(det01.mcp().output().begin());
724  SignalProducer::signals_t::const_iterator end01(det01.mcp().output().end());
725  SignalProducer::signals_t::const_iterator end02(det02.mcp().output().end());
726 
727  for (; it01 != end01;++it01)
728  {
729  //if both detectors are the same, then the second iterator should start
730  //i+1, otherwise we will just draw all hits vs. all hits
731  SignalProducer::signals_t::const_iterator it02((_detector01==_detector02) ?
732  it01+1 :
733  det02.mcp().output().begin());
734  for (; it02 != end02; ++it02)
735  result.histogram(make_pair((*it01)[ACQIRIS::time],(*it02)[ACQIRIS::time]));
736  }
737 }
738 
739 
740 
741 
742 
743 //----------------Particle Value----------------------------------------------
744 pp250::pp250(const name_t &name)
745  : Processor(name)
746 {
747  loadSettings(0);
748 }
749 
751 {
752  CASSSettings s;
753  s.beginGroup("Processor");
755  setupGeneral();
756  if (!setupCondition())
757  return;
758  _detector = loadDelayDet(s,250,name());
760  _property = static_cast<ACQIRIS::particleHits>(s.value("Property",0).toInt());
762  Log::add(Log::INFO,"Processor '" + name() + "' histograms the Property '" +
763  toString(_property) + "' of the particle '" + _particle + "' of detector '" +
764  _detector + "'. Condition is '" + _condition->name() + "'");
765 }
766 
767 void pp250::process(const CASSEvent& evt, result_t &result)
768 {
769  DetectorBackend &rawdet(
770  HelperAcqirisDetectors::instance(_detector)->detector(evt));
771  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
772  Particle &particle(det.particles()[_particle]);
773  particleHits_t::iterator it (particle.hits().begin());
774  particleHits_t::iterator end (particle.hits().end());
775 
776  while( it != end )
777  result.histogram((*it++)[_property]);
778 }
779 
780 
781 
782 
783 
784 
785 //----------------Particle Values----------------------------------------------
786 pp251::pp251(const name_t &name)
787  : Processor(name)
788 {
789  loadSettings(0);
790 }
791 
793 {
794  CASSSettings s;
795  s.beginGroup("Processor");
797  setupGeneral();
798  if (!setupCondition())
799  return;
800  _detector = loadDelayDet(s,251,name());
802  _property01 = static_cast<ACQIRIS::particleHits>(s.value("Property",0).toInt());
803  _property02 = static_cast<ACQIRIS::particleHits>(s.value("Property",1).toInt());
805  Log::add(Log::INFO,"Processor '" + name() + "' histograms the Property '" +
806  toString(_property02) + "' vs. '" + toString(_property01) + "' of the particle '" +
807  _particle + "' of detector '" + _detector + "'. Condition is '"+
808  _condition->name() + "'");
809 }
810 
811 void pp251::process(const CASSEvent& evt, result_t &result)
812 {
813  DetectorBackend &rawdet(
814  HelperAcqirisDetectors::instance(_detector)->detector(evt));
815  DelaylineDetector &det(dynamic_cast<DelaylineDetector&>(rawdet));
816  Particle &particle(det.particles()[_particle]);
817  particleHits_t::iterator it(particle.hits().begin());
818  particleHits_t::iterator end(particle.hits().end());
819 
820  for (; it != end; ++it)
821  result.histogram(make_pair((*it)[_property01],(*it)[_property02]));
822 }
823 
824 
825 
826 
827 //----------------Number of Particles---------------------------------------------
828 pp252::pp252(const name_t &name)
829  : Processor(name)
830 {
831  loadSettings(0);
832 }
833 
835 {
836  CASSSettings s;
837  s.beginGroup("Processor");
839  setupGeneral();
840  if (!setupCondition())
841  return;
842  _detector = loadDelayDet(s,252,name());
845  Log::add(Log::INFO,"Processor '" + name() +
846  + "' outputs how many particles were found for '" + _particle +
847  + "' of detector '" + _detector + "'. Condition is '" + _condition->name() + "'");
848 }
849 
850 void pp252::process(const CASSEvent& evt, result_t &result)
851 {
852  DetectorBackend &rawdet(
853  HelperAcqirisDetectors::instance(_detector)->detector(evt));
854  DelaylineDetector &det (dynamic_cast<DelaylineDetector&>(rawdet));
855  Particle& particle (det.particles()[_particle]);
856 
857  result.setValue(particle.hits().size());
858 }
pp162(const name_t &)
Constructor.
CachedList::item_type result_t
define the results
Definition: processor.h:52
ACQIRIS::DelaylineDetector::particles_t::key_type _particle
the particle we are working on
pp166(const name_t &)
Constructor.
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 detector we are there for.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
std::vector< signal_t > signals_t
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
pp167(const name_t &)
Constructor for Ratio of the reconstructed Hits vs MCP Hits.
virtual void loadSettings(size_t)
load the histogram settings from file
const name_t name() const
retrieve the name of this processor
Definition: processor.h:167
virtual void process(const CASSEvent &, result_t &res)
Retrieve the number of Signals and histogram it.
virtual void loadSettings(size_t)
load the histogram settings from file
pp160(const name_t &)
Constructor for Number of Signals.
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
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
Definition: result.hpp:323
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector01
The first detector of the cooincdence.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
ACQIRIS::particleHits _property02
the second property of the particle that we want to retrieve
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
Processor::result_t::shared_pointer set2DHist(const Processor::name_t &name)
function to set the 2d histogram properties from the ini file.
pp252(const name_t &)
Constructor for Number of Signals.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
std::tr1::shared_ptr< HelperAcqirisDetectors > shared_pointer
typedef a shared pointer of this
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
AnodeLayer::wireends_t::key_type loadWireend(CASSSettings &s, const std::string &wireendKey, int ppNbr, const string &key)
load wireend from file
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _first
The first layer of the detector for the position.
STL namespace.
virtual void loadSettings(size_t)
load the histogram settings from file
file contains declaration of processors that extract information of acqiris detectors.
virtual void process(const CASSEvent &, result_t &res)
Retrieve the number of Signals and histogram it.
detectorHits_t & hits()
return the detector hits
pp153(const name_t &)
Constructor for Ratio of the reconstructed Hits vs MCP Hits.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
result classes
pp251(const name_t &)
Constructor for Number of Signals.
ACQIRIS::detectorHits _first
The first value of the detector hit.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
pp165(const name_t &)
Constructor for Ratio of the reconstructed Hits vs MCP Hits.
pp151(const name_t &)
Constructor.
ACQIRIS::DelaylineDetector::particles_t::key_type _particle
the particle we are working on
A Time of Flight Detector.
Definition: tof_detector.h:33
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
std::string loadParticle(CASSSettings &s, const std::string &detector, int ppNbr, const std::string &key)
load particle for a specific detector
DelaylineDetector::anodelayers_t::key_type loadLayer(CASSSettings &s, const HelperAcqirisDetectors::helperinstancesmap_t::key_type &detector, const std::string &layerKey, int ppNbr, const string &key)
load layer from file
SignalProducer & mcp()
retrieve the mcp
Definition: tof_detector.h:67
virtual void process(const CASSEvent &, result_t &res)
Retrieve the number of Signals and histogram it.
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _layer
The layer of the detector detector we are there for.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
static void add(Level level, const std::string &line)
add a string to the log
Definition: log.cpp:31
void setValue(const_reference value)
assign the result container to a value
Definition: result.hpp:543
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
fromStdString(const std::string &str)
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
virtual void loadSettings(size_t)
load the histogram settings from file
virtual void loadSettings(size_t)
load the histogram settings from file
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _second
The second layer of the detector for the position.
virtual void loadSettings(size_t)
load the histogram settings from file
anodelayers_t & layers()
return the layers
base class for processors.
Definition: processor.h:39
ACQIRIS::particleHits _property
the property of the particle that we want to retrieve
virtual void loadSettings(size_t)
load the histogram settings from file
virtual void loadSettings(size_t)
load the histogram settings from file
virtual void loadSettings(size_t)
load the histogram settings from file
pp163(const name_t &)
Constructor.
particleHits
types of pariticle hits
std::pair< double, double > _range
the range in which the single events are in
virtual void loadSettings(size_t)
load the histogram settings from file
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector02
The second detector of the cooincdence.
ACQIRIS::detectorHits _second
The second value of the detector.
std::pair< std::pair< double, double >, std::pair< double, double > > _tsrange
timesum ranges of the layers
file contains declaration of classes and functions that help other processors to do their job...
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _layer
The layer of the detector detector we are there for.
virtual void loadSettings(size_t)
load the histogram settings from file
pp161(const name_t &)
Constructor.
pp220(const name_t &)
Constructor for Number of Signals.
file contains the declaration of the acqiris part of the CASSEvent
file contains global definitions for project cass
std::pair< double, double > _range
the range in which the single events are in
pp164(const name_t &)
Constructor.
std::string toString(const Type &t)
convert any type to a string
Definition: cass.h:63
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
pp152(const name_t &)
Constructor for Number of Signals.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
ACQIRIS::AnodeLayer::wireends_t::key_type _signal
The Signal of the layer detector we are there for.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
std::string loadDelayDet(CASSSettings &s, int ppNbr, const std::string &key)
load detector from file
value(const QString &key, const QVariant &defaultValue=QVariant()
ACQIRIS::AnodeLayer::wireends_t::key_type _signal
The Signal of the layer detector we are there for.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
ACQIRIS::detectorHits _third
The third value of the detector, that we will check the condition for.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
double firstGood(const std::pair< double, double > &range)
returns the time of the first peak in the time range
void setupGeneral()
general setup of the processor
Definition: processor.cpp:85
virtual void loadSettings(size_t)
load the histogram settings from file
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
virtual void loadSettings(size_t)
load the histogram settings from file
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
file contains specialized class that do the settings for cass
std::pair< double, double > _range
the range in which the single events are in
signals_t & output()
return the signals
virtual void loadSettings(size_t)
load the histogram settings from file
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
std::pair< float, float > _cond
The condition that we impose on the third component.
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _layer
The layer of the detector detector we are there for.
virtual void process(const CASSEvent &, result_t &)
Retrieve the number of Signals and histogram it.
Base class for all Detectors attached to an Acqiris Instrument.
ACQIRIS::HelperAcqirisDetectors::helperinstancesmap_t::key_type _detector
The detector we are there for.
static shared_pointer instance(const helperinstancesmap_t::key_type &detector)
static function creating instance of this.
shared_pointer _condition
pointer to the processor that will contain the condition
Definition: processor.h:277
Processor::result_t::shared_pointer set1DHist(const Processor::name_t &name)
function to set the 1d histogram properties from the ini file.
pp150(const name_t &)
Constructor.
Electron detector
Definition: hdf5-input.ini:62
pp250(const name_t &)
Constructor for Number of Signals.
A Particle.
Definition: particle.h:70
bool setupCondition(bool defaultConditionType=true)
setup the condition.
Definition: processor.cpp:94
detectorHits
types of detector hits
std::string name_t
define the name type
Definition: processor.h:46
contains a logger for cass
virtual void loadSettings(size_t)
load the histogram settings from file
ACQIRIS::particleHits _property01
the first property of the particle that we want to retrieve
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _layer
The layer of the detector detector we are there for.
ACQIRIS::DelaylineDetector::particles_t::key_type _particle
the particle we are working on
beginGroup(const QString &prefix)
ACQIRIS::AnodeLayer::wireends_t::key_type _signal
The Signal of the layer detector we are there for.
virtual void loadSettings(size_t)
load the histogram settings from file
ACQIRIS::DelaylineDetector::anodelayers_t::key_type _layer
The layer of the detector detector we are there for.