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