Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
JEvtCategoryMap.hh
Go to the documentation of this file.
1#ifndef __JAANET__JEVTCATEGORYMAP__
2#define __JAANET__JEVTCATEGORYMAP__
3
4#include <map>
5#include <vector>
6
7#include "JSystem/JStat.hh"
8
9#include "JLang/JToken.hh"
10#include "JLang/JClonable.hh"
11#include "JLang/JException.hh"
13
14#include "Jeep/JPrint.hh"
15#include "Jeep/JProperties.hh"
16
18
24
28
29#include "JAAnet/JFlux.hh"
30#include "JAAnet/JFluxHelper.hh"
32
33
34/**
35 * \author bjjung
36 */
37
38namespace JAANET {}
39namespace JPP { using namespace JAANET; }
40
41namespace JAANET {
42
43 using JLANG::JClonable;
44
46
48
49
50 /**
51 * Auxiliary class for reading a map of event categories.
52 *
53 * The template argument corresponds to the mapped value type.
54 */
55 template<class T>
57 public std::map<JEvtCategoryHelper, T>
58 {
59 public:
60
62
64
65 typedef typename map_type::iterator iterator;
66 typedef typename map_type::const_iterator const_iterator;
67
68
69 /**
70 * Default constructor.
71 */
73 map_type()
74 {}
75
76
77 /**
78 * Constructor.
79 *
80 * \param category event category
81 * \param value value
82 */
84 const T& value) :
85 map_type()
86 {
87 insert(category, value);
88 }
89
90
91
92 /**
93 * Constructor.
94 *
95 * \param category event category
96 * \param value value
97 * \param args remaining pairs of event categories and values
98 */
99 template<class ...Args>
101 const T& value,
102 const Args& ...args) :
103 map_type()
104 {
105 insert(category, value, args...);
106 }
107
108
109 /**
110 * Insert pair of event category and value.
111 *
112 * \param category event category
113 * \param value value
114 */
115 void insert(const JEvtCategoryHelper& category,
116 const T& value)
117 {
118 map_type::insert(std::make_pair(category, value));
119 }
120
121
122 /**
123 * Insert pairs of event categories and values.
124 *
125 * \param category event category
126 * \param value value
127 * \param args remaining pairs of event categories and values
128 */
129 template<class ...Args>
130 void insert(const JEvtCategoryHelper& category,
131 const T& value,
132 const Args& ...args)
133 {
134 insert(category, value);
135 insert(args...);
136 }
137 };
138
139
140 /**
141 * Template specialisation for a map between event categories and event-weight factor products.
142 *
143 * The input syntax follows the following scheme:
144 *
145 * <tt>[oscillation probabilities configuration] (<categories> <factors>)+</tt>,
146 *
147 * in which:
148 * - <tt>oscillation probabilities configuration</tt> refers to an optional specification
149 * of the oscillation parameters, which can be given according to one of the following formats:
150 * 1. <tt><oscprob_file>;</tt>,
151 * 2. <tt>oscprob=<oscprob_file>;</tt>,
152 * 3. <tt><oscprob_key>=<oscprob_value>[<end of line> <oscprob_key>=<oscprob_value>]+;</tt> or
153 * 4. <tt>oscprob.<oscprob_key>=<oscprob_value>[<end of line> oscprob.<oscprob_key>=<oscprob_value>]+;</tt>,
154 * where:
155 * - <tt>oscprob_key</tt> refers to an oscillation probability calculator configuration key;
156 * - <tt>oscprob_value</tt> to an oscillation probability calculator configuration value and
157 * - <tt>oscprob_file</tt> to an oscillation probability calculator configuration file with key-value pairs,
158 * - <tt>categories</tt> refers to a set of event categories, which can be specified according to one of the following formats:
159 * 1. <tt><PDG type> [ & <PDG type>]+;</tt>
160 * 2. <tt><key>=<value>[<end of line> <key>=<value>]+ [ & <key>=<value>[<end of line> <key>=<value>]+ ]+;</tt>
161 * where:
162 * - <tt>PDG type</tt> refers to a PDG identifier;
163 * - <tt>key</tt> to one of the data members of a data structure derived from `JAANET::JEvtCategory` and
164 * - <tt>value</tt> to the corresponding value;
165 * - <tt>factors</tt> refers to a set of weighting factors, which needs to be specified according to the following format:
166 * 1. <tt><factor identifier> [<factor arguments> [ & <factor identifier> [<factor arguments] ]+ ];</tt>,
167 * where:
168 * - <tt>factor identifier</tt> refers to an event-weight factor identifier (c.f. `JAANET::JEvtWeighFactorDictionary::factors`); and
169 * - <tt>factor arguments</tt> to the list of arguments for the corresponding event-weight factor,
170 * - each set of arguments for the oscillation probabilities, an event category or weighting factor needs to be separated by a semi-colon (';') and
171 * - multiple event categories and weight factors can be specified as a group, separated by the '&' character.
172 */
173 template<>
175 public std::map<JEvtCategoryHelper, JEvtWeightFactorProduct>,
176 public JClonable<JEvtWeightFactor, JEvtCategoryMap<JEvtWeightFactorProduct> >
177 {
178 public:
179
181
183
184 typedef typename map_type::iterator iterator;
185 typedef typename map_type::const_iterator const_iterator;
186
187
188 /**
189 * Default constructor.
190 */
192 map_type(),
193 oscProb(JOscProbInterpolator<>())
194 {}
195
196
197 /**
198 * Constructor.
199 *
200 * \param oscProb oscillation probability calculator
201 */
203 map_type(),
204 oscProb(oscProb)
205 {}
206
207
208 /**
209 * Constructor.
210 *
211 * \param oscProb oscillation probability calculator
212 * \param category event category
213 * \param factor event-weight factor
214 */
216 const JEvtCategoryHelper& category,
217 const JEvtWeightFactorHelper& factor) :
218 map_type(),
219 oscProb(oscProb)
220 {
221 insert(category, factor);
222 }
223
224
225
226 /**
227 * Constructor.
228 *
229 * \param oscProb oscillation probability calculator
230 * \param category event category
231 * \param factor event-weight factor
232 * \param args remaining pairs of event categories and event-weight factors
233 */
234 template<class ...Args>
236 const JEvtCategoryHelper& category,
237 const JEvtWeightFactorHelper& factor,
238 const Args& ...args) :
239 map_type(),
240 oscProb(oscProb)
241 {
242 insert(category, factor, args...);
243 }
244
245
246 /**
247 * Constructor.
248 *
249 * \param category event category
250 * \param factor event-weight factor
251 */
253 const JEvtWeightFactorHelper& factor) :
254 map_type(),
255 oscProb()
256 {
257 insert(category, factor);
258 }
259
260
261
262 /**
263 * Constructor.
264 *
265 * \param category event category
266 * \param factor event-weight factor
267 * \param args remaining pairs of event categories and event-weight factors
268 */
269 template<class ...Args>
271 const JEvtWeightFactorHelper& factor,
272 const Args& ...args) :
273 map_type(),
274 oscProb()
275 {
276 insert(category, factor, args...);
277 }
278
279
280 /**
281 * Insert pair of an event category and a product of event-weight factors.
282 *
283 * \param category pointer to event category
284 * \param product product of event-weight factors
285 */
286 void insert(const JEvtCategoryHelper& category,
287 const JEvtWeightFactorProduct& product)
288 {
289 iterator i = this->find(category);
290
291 if (i != this->end()) {
292 i->second.join(product);
293 } else {
294 map_type::insert(std::make_pair(category, product));
295 }
296 }
297
298
299 /**
300 * Insert event category.
301 *
302 * \param category event category
303 * \param factor event-weight factor
304 */
305 void insert(const JEvtCategoryHelper& category,
306 const JEvtWeightFactorHelper& factor)
307 {
308 iterator i = this->find(category);
309
310 if (i == this->end()) {
311
312 const JEvtWeightFactorProduct product(oscProb, factor);
313
314 map_type::insert(std::make_pair(category, product));
315
316 } else {
317
318 i->second.push_back(factor);
319 }
320 }
321
322
323 /**
324 * Insert pairs of event categories and event-weight factors.
325 *
326 * \param category event category
327 * \param factor event-weight factor
328 * \param args remaining pairs of event categories and event-weight factors
329 */
330 template<class ...Args>
331 void insert(const JEvtCategoryHelper& category,
332 const JEvtWeightFactorHelper& factor,
333 const Args& ...args)
334 {
335 insert(category, factor);
336 insert(args...);
337 }
338
339
340 /**
341 * Join this map between event categories and weight factors with a given map between event categories and weight factors.
342 *
343 * \param object map between event categories and weight factors
344 * \return joined map between event categories and weight factors
345 */
347 {
348 for (const_iterator i = object.cbegin(); i != object.cend(); ++i) {
349
350 iterator j = this->find(i->first);
351
352 if (j != this->end()) {
353 j->second.join(i->second);
354 } else {
355 this->insert(j->first, j->second);
356 }
357 }
358
359 return (*this);
360 }
361
362
363 /**
364 * Get oscillation probability calculator.
365 *
366 * \return oscillation probability calculator
367 */
369 {
370 return oscProb;
371 }
372
373
374 /**
375 * Set oscillation probability calculator for all compatible event weight factors.
376 *
377 * \param oscProb oscillation probability calculator
378 * \return number of modified event weighters
379 */
380 size_t setOscProb(const JOscProbHelper& oscProb)
381 {
382 using namespace JPP;
383
384 if (oscProb) {
385
386 size_t n = 0;
387
388 this->oscProb = oscProb;
389
390 for (iterator i = this->begin(); i != this->end(); ++i) {
391 n += i->second.setOscProb(oscProb);
392 }
393
394 return n;
395
396 } else {
397
398 THROW(JNullPointerException, "JEvtCategoryMap<JEvtWeightFactorHelper>::setOscProb(): Given oscillation probability function is invalid.");
399 }
400 }
401
402
403 /**
404 * Get weight factor of given event.
405 *
406 * \param evt event
407 * \return weight-factor for given event
408 */
409 double getFactor(const Evt& evt) const override final
410 {
411 using namespace JPP;
412
413 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
414 if (i->first.match(evt)) {
415 return i->second.getFactor(evt);
416 }
417 }
418
419 THROW(JValueOutOfRange, "JEvtCategoryMap<JEvtWeightFactorHelper>::getFactor(): No event-weight factor for given event.");
420 }
421
422
423 /**
424 * Check whether this event-weight factor is valid.
425 *
426 * \return true if valid; else false
427 */
428 bool is_valid() const override final
429 {
430 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
431 if (!i->second.is_valid()) { return false; }
432 }
433
434 return true;
435 }
436
437
438 /**
439 * Get properties of this class.
440 *
441 * \param eqpars equation parameters
442 */
443 JProperties getProperties(const JEquationParameters& eqpars) override final
444 {
445 return JEvtCategoryMapHelper(*this, eqpars);
446 }
447
448
449 /**
450 * Get properties of this class.
451 *
452 * \param eqpars equation parameters
453 */
454 JProperties getProperties(const JEquationParameters& eqpars) const override final
455 {
456 return JEvtCategoryMapHelper(*this, eqpars);
457 }
458
459
460 /**
461 * Read map between event categories and event-weight factors
462 *
463 * \param in input stream
464 * \return input stream
465 */
466 std::istream& read(std::istream& in) override final
467 {
468 using namespace std;
469 using namespace JPP;
470
471 static const char SEPARATOR = ';';
472
473 JStringStream is(in);
474
475 if (getFileStatus(is.str().c_str())) {
476 is.load();
477 }
478
479 const string contents = is.str();
480
481 const streampos pos = is.tellg();
482 const ios_base::iostate state = is.rdstate();
483
484 const int N = std::count(contents.begin(), contents.end(), SEPARATOR);
485
486 if (N & 1) { // Uneven number of terms; First term may correspond to optional oscillation parameters
487
488 JToken<SEPARATOR> token;
489 is >> token;
490
491 istringstream iss(token);
492 iss >> oscProb;
493
494 if (fail(iss)) {
495 is.clear(state);
496 is.seekg(pos);
497 }
498 }
499
500 for (JToken<SEPARATOR> token1, token2; is >> token1 >> token2; ) {
501
502 istringstream iss1(token1); // Read event categories
503
504 JEvtCategorySet categories;
505
506 iss1 >> categories;
507
508 istringstream iss2(token2); // Read event-weight factors
509
510 JEvtWeightFactorProduct factors(oscProb);
511
512 iss2 >> factors;
513
514 if (!fail(iss2)) {
515
516 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
517 this->insert(*i, factors);
518 }
519 }
520 }
521
522 return in;
523 }
524
525
526 /**
527 * Write event-weight factor to output
528 *
529 * \param out output stream
530 * \return output stream
531 */
532 std::ostream& write(std::ostream& out) const override final
533 {
534 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
535 }
536
537
538 private:
539
540 /**
541 * Auxiliary class for I/O of map of event categories and weight factors.
542 */
544 public JProperties
545 {
546 /**
547 * Constructor.
548 *
549 * \param map event category map
550 * \param eqpars equation parameters
551 */
552 template<class JEvtCategoryMap_type>
553 JEvtCategoryMapHelper(JEvtCategoryMap_type& map,
554 const JEquationParameters& eqpars) :
555 JProperties(eqpars, 1)
556 {
557 using namespace std;
558 using namespace JPP;
559
560 for (typename map_type::const_iterator i = map.cbegin(); i != map.cend(); ++i) {
561
562 const int index = 1 + distance(map.cbegin(), i);
563
564 const string key = MAKE_STRING("category" << index);
565
566 JProperties properties1 = i->first .getProperties(eqpars);
567 JProperties properties2 = i->second.getProperties(eqpars);
568
569 (*this)[key] = properties1.join(properties2);
570 }
571 }
572 };
573
574 JOscProbHelper oscProb; //!< oscillation probability calculator
575 };
576
578
579
580 /**
581 * Template specialisation for a map between event categories and flux factors.
582 *
583 * The input syntax follows the following scheme:
584 *
585 * <tt>[oscillation probabilities configuration] (<categories> <flux>)+</tt>,
586 *
587 * in which:
588 * - <tt>oscillation probabilities configuration</tt> refers to an optional specification
589 * of the oscillation parameters, which can be given according to one of the following formats:
590 * 1. <tt><oscprob_file>;</tt>,
591 * 2. <tt>oscprob=<oscprob_file>;</tt>,
592 * 3. <tt><oscprob_key>=<oscprob_value>[<end of line> <oscprob_key>=<oscprob_value>]+;</tt> or
593 * 4. <tt>oscprob.<oscprob_key>=<oscprob_value>[<end of line> oscprob.<oscprob_key>=<oscprob_value>]+;</tt>,
594 * where:
595 * - <tt>oscprob_key</tt> refers to an oscillation probability calculator configuration key;
596 * - <tt>oscprob_value</tt> to an oscillation probability calculator configuration value and
597 * - <tt>oscprob_file</tt> to an oscillation probability calculator configuration file with key-value pairs,
598 * - <tt>categories</tt> refers to a set of event categories, which can be specified according to one of the following formats:
599 * 1. <tt><PDG type> [ & <PDG type>]+;</tt>
600 * 2. <tt><key>=<value>[<end of line> <key>=<value>]+ [ & <key>=<value>[<end of line> <key>=<value>]+ ]+;</tt>
601 * where:
602 * - <tt>PDG type</tt> refers to a PDG identifier;
603 * - <tt>key</tt> to one of the data members of a data structure derived from `JAANET::JEvtCategory` and
604 * - <tt>value</tt> to the corresponding value;
605 * - <tt>flux</tt> refers to a flux, which needs to be specified according to the following format:
606 * 1. <tt><flux identifier> [<flux arguments>];</tt>,
607 * where:
608 * - <tt>flux identifier</tt> refers to an event-weight flux identifier (c.f. `JAANET::JFluxDictionary::factors`); and
609 * - <tt>flux arguments</tt> to the list of arguments for the corresponding flux,
610 * - each set of arguments for the oscillation probabilities, an event category or flux needs to be separated by a semi-colon (';') and
611 * - multiple event categories can be specified as a group, separated by the '&' character.
612 */
613 template<>
615 public std::map<JEvtCategoryHelper, JFluxHelper>,
616 public JClonable<JFlux, JEvtCategoryMap<JFluxHelper> >
617 {
618 public:
619
621
623
624 typedef typename map_type::iterator iterator;
625 typedef typename map_type::const_iterator const_iterator;
626
627
628
629 /**
630 * Default constructor.
631 */
633 map_type(),
634 oscProb(JOscProbInterpolator<>())
635 {}
636
637
638 /**
639 * Constructor.
640 *
641 * \param oscProb oscillation probability calculator
642 */
644 map_type(),
645 oscProb(oscProb)
646 {}
647
648
649 /**
650 * Constructor.
651 *
652 * \param oscProb oscillation probability calculator
653 * \param category event category
654 * \param factor event-weight factor
655 */
657 const JEvtCategoryHelper& category,
658 const JFluxHelper& factor) :
659 map_type(),
660 oscProb(oscProb)
661 {
662 insert(category, factor);
663 }
664
665
666 /**
667 * Constructor.
668 *
669 * \param oscProb oscillation probability calculator
670 * \param category event category
671 * \param factor event-weight factor
672 * \param args remaining pairs of event categories and event-weight factors
673 */
674 template<class ...Args>
676 const JEvtCategoryHelper& category,
677 const JFluxHelper& factor,
678 const Args& ...args) :
679 map_type(),
680 oscProb(oscProb)
681 {
682 insert(category, factor, args...);
683 }
684
685
686 /**
687 * Constructor.
688 *
689 * \param category event category
690 * \param flux flux function
691 */
693 const JFluxHelper& flux) :
694 map_type(),
695 oscProb()
696 {
697 insert(category, flux);
698 }
699
700
701
702 /**
703 * Constructor.
704 *
705 * \param category event category
706 * \param flux flux function
707 * \param args remaining pairs of event categories and flux functions
708 */
709 template<class ...Args>
711 const JFluxHelper& flux,
712 const Args& ...args) :
713 map_type()
714 {
715 insert(category, flux, args...);
716 }
717
718
719 /**
720 * Insert pair of an event category and a flux function.
721 *
722 * \param category event category
723 * \param flux flux function
724 */
725 void insert(const JEvtCategoryHelper& category,
726 const JFluxHelper& flux)
727 {
728 map_type::insert(std::make_pair(category, flux));
729 }
730
731
732 /**
733 * Insert pairs of event categories and flux functions.
734 *
735 * \param category event category
736 * \param flux flux function
737 * \param args remaining pairs of event categories and flux functions
738 */
739 template<class ...Args>
740 void insert(const JEvtCategoryHelper& category,
741 const JFluxHelper& flux,
742 const Args& ...args)
743 {
744 insert(category, flux);
745 insert(args...);
746 }
747
748
749 /**
750 * Get oscillation probability calculator.
751 *
752 * \return oscillation probability calculator
753 */
755 {
756 return oscProb;
757 }
758
759
760 /**
761 * Set oscillation probability calculator for all compatible flux factors.
762 *
763 * \param oscProb oscillation probability calculator
764 * \return number of modified event weighters
765 */
766 size_t setOscProb(const JOscProbHelper& oscProb)
767 {
768 using namespace JPP;
769
770 if (oscProb) {
771
772 size_t n = 0;
773
774 this->oscProb = oscProb;
775
776 for (iterator i = this->begin(); i != this->end(); ++i) {
777
778 JOscFlux* p = dynamic_cast<JOscFlux*>(&(i->second.getFlux()));
779
780 if (p != NULL) {
781 p->setOscProb(oscProb);
782 ++n;
783 }
784 }
785
786 return n;
787
788 } else {
789
790 THROW(JNullPointerException, "JEvtCategoryMap<JFluxHelper>::setOscProb(): Given oscillation probability function is invalid.");
791 }
792 }
793
794
795 /**
796 * Get weight factor of given event.
797 *
798 * \param evt event
799 * \return weight-factor for given event
800 */
801 double getFactor(const Evt& evt) const override final
802 {
803 using namespace JPP;
804
805 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
806 if (i->first.match(evt)) {
807 return i->second.getFactor(evt);
808 }
809 }
810
811 THROW(JValueOutOfRange, "JEvtCategoryMap<JFluxHelper>::getFactor(): No flux factor for given event.");
812 }
813
814
815 /**
816 * Check whether this flux factor is valid.
817 *
818 * \return true if valid; else false
819 */
820 bool is_valid() const override final
821 {
822 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
823 if (!(i->second.is_valid())) { return false; }
824 }
825
826 return true;
827 }
828
829
830 /**
831 * Get properties of this class.
832 *
833 * \param eqpars equation parameters
834 */
836 {
837 return JEvtCategoryMapHelper(*this, eqpars);
838 }
839
840
841 /**
842 * Get properties of this class.
843 *
844 * \param eqpars equation parameters
845 */
847 {
848 return JEvtCategoryMapHelper(*this, eqpars);
849 }
850
851
852 /**
853 * Read map between event categories and flux factors.
854 *
855 * \param in input stream
856 * \return input stream
857 */
858 std::istream& read(std::istream& in) override final
859 {
860 using namespace std;
861 using namespace JPP;
862
863 static const char SEPARATOR = ';';
864
865 static const JFluxDictionary dictionary(oscProb);
866
867 JStringStream is(in);
868
869 if (getFileStatus(is.str().c_str())) {
870 is.load();
871 }
872
873 const string contents = is.str();
874
875 const streampos pos = is.tellg();
876 const ios_base::iostate state = is.rdstate();
877
878 const int N = std::count(contents.begin(), contents.end(), SEPARATOR);
879
880 if (N & 1) { // Uneven number of terms; First term may correspond to optional oscillation parameters
881
882 JToken<SEPARATOR> token;
883 is >> token;
884
885 istringstream iss(token);
886 iss >> oscProb;
887
888 if (fail(iss)) {
889 is.clear(state);
890 is.seekg(pos);
891 }
892 }
893
894 for (JToken<SEPARATOR> token1, token2; is >> token1 >> token2; ) {
895
896 istringstream iss1(token1); // Read event categories
897
898 JEvtCategorySet categories;
899
900 iss1 >> categories;
901
902 istringstream iss2(token2); // Read event-weight factors
903
904 int fluxID = 0;
905
906 if (iss2 >> fluxID) {
907
908 const JFluxHelper helper = dictionary[fluxID];
909
910 JFlux& flux = helper.getFlux();
911
912 iss2 >> flux;
913
914 if (!fail(iss2)) {
915 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
916 this->insert(*i, helper);
917 }
918 }
919 }
920 }
921
922 return in;
923 }
924
925
926 /**
927 * Write event-weight factor to output
928 *
929 * \param out output stream
930 * \return output stream
931 */
932 std::ostream& write(std::ostream& out) const override final
933 {
934 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
935 }
936
937 private:
938
939 /**
940 * Auxiliary class for I/O of map of event categories and weight factors.
941 */
943 public JProperties
944 {
945 /**
946 * Constructor.
947 *
948 * \param map event category map
949 * \param eqpars equation parameters
950 */
951 template<class JEvtCategoryMap_type>
952 JEvtCategoryMapHelper(JEvtCategoryMap_type& map,
953 const JEquationParameters& eqpars) :
954 JProperties(eqpars, 1)
955 {
956 using namespace std;
957 using namespace JPP;
958
959 for (typename map_type::const_iterator i = map.cbegin(); i != map.cend(); ++i) {
960
961 const int index = 1 + distance(map.cbegin(), i);
962
963 const string key = MAKE_STRING("category" << index);
964
965 JProperties sub1 = i->first .getProperties(eqpars);
966 JProperties sub2 = i->second.getProperties(eqpars);
967
968 (*this)[key] = sub1.join(sub2);
969 }
970 }
971 };
972
973 JOscProbHelper oscProb; //!< oscillation probability calculator
974 };
975
976 using JFluxMap = JEvtCategoryMap<JFluxHelper>; //!< Type alias for flux maps
977}
978
979#endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Classes and methods for defining muon bundle categories.
Classes and methods for defining neutrino interaction categories.
I/O formatting auxiliaries.
Utility class to parse parameter values.
File status.
Template specialisation for a map between event categories and event-weight factor products.
JProperties getProperties(const JEquationParameters &eqpars) override final
Get properties of this class.
bool is_valid() const override final
Check whether this event-weight factor is valid.
JProperties getProperties(const JEquationParameters &eqpars) const override final
Get properties of this class.
JEvtCategoryMap(const JOscProbHelper &oscProb, const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor)
Constructor.
JEvtCategoryMap(const JOscProbHelper &oscProb)
Constructor.
JEvtCategoryMap< JEvtWeightFactorProduct > JEvtCategoryMap_t
JEvtCategoryMap_t & join(const JEvtCategoryMap_t &object)
Join this map between event categories and weight factors with a given map between event categories a...
JOscProbHelper oscProb
oscillation probability calculator
std::istream & read(std::istream &in) override final
Read map between event categories and event-weight factors.
double getFactor(const Evt &evt) const override final
Get weight factor of given event.
void insert(const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor)
Insert event category.
std::ostream & write(std::ostream &out) const override final
Write event-weight factor to output.
JEvtCategoryMap(const JOscProbHelper &oscProb, const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor, const Args &...args)
Constructor.
void insert(const JEvtCategoryHelper &category, const JEvtWeightFactorProduct &product)
Insert pair of an event category and a product of event-weight factors.
JEvtCategoryMap(const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor, const Args &...args)
Constructor.
size_t setOscProb(const JOscProbHelper &oscProb)
Set oscillation probability calculator for all compatible event weight factors.
const JOscProbHelper & getOscProb() const
Get oscillation probability calculator.
void insert(const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor, const Args &...args)
Insert pairs of event categories and event-weight factors.
std::map< JEvtCategoryHelper, JEvtWeightFactorProduct > map_type
JEvtCategoryMap(const JEvtCategoryHelper &category, const JEvtWeightFactorHelper &factor)
Constructor.
Template specialisation for a map between event categories and flux factors.
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
Get properties of this class.
std::ostream & write(std::ostream &out) const override final
Write event-weight factor to output.
std::istream & read(std::istream &in) override final
Read map between event categories and flux factors.
JEvtCategoryMap(const JEvtCategoryHelper &category, const JFluxHelper &flux, const Args &...args)
Constructor.
bool is_valid() const override final
Check whether this flux factor is valid.
size_t setOscProb(const JOscProbHelper &oscProb)
Set oscillation probability calculator for all compatible flux factors.
void insert(const JEvtCategoryHelper &category, const JFluxHelper &flux, const Args &...args)
Insert pairs of event categories and flux functions.
JEvtCategoryMap(const JOscProbHelper &oscProb)
Constructor.
JOscProbHelper oscProb
oscillation probability calculator
std::map< JEvtCategoryHelper, JFluxHelper > map_type
JEvtCategoryMap< JFluxHelper > JEvtCategoryMap_t
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.
void insert(const JEvtCategoryHelper &category, const JFluxHelper &flux)
Insert pair of an event category and a flux function.
JEvtCategoryMap(const JOscProbHelper &oscProb, const JEvtCategoryHelper &category, const JFluxHelper &factor)
Constructor.
JEvtCategoryMap(const JEvtCategoryHelper &category, const JFluxHelper &flux)
Constructor.
JEvtCategoryMap(const JOscProbHelper &oscProb, const JEvtCategoryHelper &category, const JFluxHelper &factor, const Args &...args)
Constructor.
const JOscProbHelper & getOscProb() const
Get oscillation probability calculator.
double getFactor(const Evt &evt) const override final
Get weight factor of given event.
Auxiliary class for reading a map of event categories.
void insert(const JEvtCategoryHelper &category, const T &value)
Insert pair of event category and value.
JEvtCategoryMap()
Default constructor.
map_type::const_iterator const_iterator
JEvtCategoryMap< T > JEvtCategoryMap_t
JEvtCategoryMap(const JEvtCategoryHelper &category, const T &value, const Args &...args)
Constructor.
void insert(const JEvtCategoryHelper &category, const T &value, const Args &...args)
Insert pairs of event categories and values.
JEvtCategoryMap(const JEvtCategoryHelper &category, const T &value)
Constructor.
map_type::iterator iterator
std::map< JEvtCategoryHelper, T > map_type
Dictionary to map distinct flux function categories to unique identifiers.
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Exception for null pointer operation.
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
void load()
Load data from file with name corresponding to current contents.
Wrapper class around string.
Definition JToken.hh:26
Exception for accessing a value in a collection that is outside of its range.
Template definition of a multi-dimensional oscillation probability interpolation table.
Extensions to Evt data format.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
Helper class for event categories.
Auxiliary class for I/O of map of event categories and weight factors.
JEvtCategoryMapHelper(JEvtCategoryMap_type &map, const JEquationParameters &eqpars)
Constructor.
Auxiliary class for I/O of map of event categories and weight factors.
JEvtCategoryMapHelper(JEvtCategoryMap_type &map, const JEquationParameters &eqpars)
Constructor.
Container for a set of event categories.
Helper class for event-weight factor.
Class for product of event-weight factors.
static JEquationParameters & getEquationParameters()
Get equation parameters.
Helper class for flux function.
JFlux & getFlux() const
Get reference to flux function.
Low-level interface for retrieving the flux corresponding to a given event.
Definition JFlux.hh:23
Implementation of oscillated neutrino flux.
Definition JOscFlux.hh:44
void setOscProb(const JOscProbHelper oscProb)
Set oscillation probability calculator.
Definition JOscFlux.hh:76
Neutrino flux.
Definition JHead.hh:906
Template class for object cloning.
Definition JClonable.hh:59
Helper class for oscillation probability calculators.