Jpp in_tag_pdf_generation
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"
31#include "JAAnet/JFluxDictionary.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 JStringStream is(in);
472
473 if (getFileStatus(is.str().c_str())) {
474 is.load();
475 }
476
477 const streampos pos = is.tellg();
478 const ios_base::iostate state = is.rdstate();
479
480 // Read optional oscillation probability calculator configuration
481
482 JToken<';'> 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 for (JToken<';'> token1, token2; is >> token1 >> token2; ) {
494
495 istringstream iss1(token1); // Read event categories
496
497 JEvtCategorySet categories;
498
499 iss1 >> categories;
500
501 istringstream iss2(token2); // Read event-weight factors
502
503 JEvtWeightFactorProduct factors(oscProb);
504
505 iss2 >> factors;
506
507 if (!fail(iss2)) {
508
509 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
510 this->insert(*i, factors);
511 }
512 }
513 }
514
515 return in;
516 }
517
518
519 /**
520 * Write event-weight factor to output
521 *
522 * \param out output stream
523 * \return output stream
524 */
525 std::ostream& write(std::ostream& out) const override final
526 {
527 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
528 }
529
530
531 private:
532
533 /**
534 * Auxiliary class for I/O of map of event categories and weight factors.
535 */
537 public JProperties
538 {
539 /**
540 * Constructor.
541 *
542 * \param map event category map
543 * \param eqpars equation parameters
544 */
545 template<class JEvtCategoryMap_type>
546 JEvtCategoryMapHelper(JEvtCategoryMap_type& map,
547 const JEquationParameters& eqpars) :
548 JProperties(eqpars, 1)
549 {
550 using namespace std;
551 using namespace JPP;
552
553 for (typename map_type::const_iterator i = map.cbegin(); i != map.cend(); ++i) {
554
555 const int index = 1 + distance(map.cbegin(), i);
556
557 const string key = MAKE_STRING("category" << index);
558
559 JProperties properties1 = i->first .getProperties(eqpars);
560 JProperties properties2 = i->second.getProperties(eqpars);
561
562 (*this)[key] = properties1.join(properties2);
563 }
564 }
565 };
566
567 JOscProbHelper oscProb; //!< oscillation probability calculator
568 };
569
571
572
573 /**
574 * Template specialisation for a map between event categories and flux factors.
575 *
576 * The input syntax follows the following scheme:
577 *
578 * <tt>[oscillation probabilities configuration] (<categories> <flux>)+</tt>,
579 *
580 * in which:
581 * - <tt>oscillation probabilities configuration</tt> refers to an optional specification
582 * of the oscillation parameters, which can be given according to one of the following formats:
583 * 1. <tt><oscprob_file>;</tt>,
584 * 2. <tt>oscprob=<oscprob_file>;</tt>,
585 * 3. <tt><oscprob_key>=<oscprob_value>[<end of line> <oscprob_key>=<oscprob_value>]+;</tt> or
586 * 4. <tt>oscprob.<oscprob_key>=<oscprob_value>[<end of line> oscprob.<oscprob_key>=<oscprob_value>]+;</tt>,
587 * where:
588 * - <tt>oscprob_key</tt> refers to an oscillation probability calculator configuration key;
589 * - <tt>oscprob_value</tt> to an oscillation probability calculator configuration value and
590 * - <tt>oscprob_file</tt> to an oscillation probability calculator configuration file with key-value pairs,
591 * - <tt>categories</tt> refers to a set of event categories, which can be specified according to one of the following formats:
592 * 1. <tt><PDG type> [ & <PDG type>]+;</tt>
593 * 2. <tt><key>=<value>[<end of line> <key>=<value>]+ [ & <key>=<value>[<end of line> <key>=<value>]+ ]+;</tt>
594 * where:
595 * - <tt>PDG type</tt> refers to a PDG identifier;
596 * - <tt>key</tt> to one of the data members of a data structure derived from `JAANET::JEvtCategory` and
597 * - <tt>value</tt> to the corresponding value;
598 * - <tt>flux</tt> refers to a flux, which needs to be specified according to the following format:
599 * 1. <tt><flux identifier> [<flux arguments>];</tt>,
600 * where:
601 * - <tt>flux identifier</tt> refers to an event-weight flux identifier (c.f. `JAANET::JFluxDictionary::factors`); and
602 * - <tt>flux arguments</tt> to the list of arguments for the corresponding flux,
603 * - each set of arguments for the oscillation probabilities, an event category or flux needs to be separated by a semi-colon (';') and
604 * - multiple event categories can be specified as a group, separated by the '&' character.
605 */
606 template<>
608 public std::map<JEvtCategoryHelper, JFluxHelper>,
609 public JClonable<JFlux, JEvtCategoryMap<JFluxHelper> >
610 {
611 public:
612
614
616
617 typedef typename map_type::iterator iterator;
618 typedef typename map_type::const_iterator const_iterator;
619
620
621
622 /**
623 * Default constructor.
624 */
626 map_type(),
627 oscProb(JOscProbInterpolator<>())
628 {}
629
630
631 /**
632 * Constructor.
633 *
634 * \param oscProb oscillation probability calculator
635 */
637 map_type(),
638 oscProb(oscProb)
639 {}
640
641
642 /**
643 * Constructor.
644 *
645 * \param oscProb oscillation probability calculator
646 * \param category event category
647 * \param factor event-weight factor
648 */
650 const JEvtCategoryHelper& category,
651 const JFluxHelper& factor) :
652 map_type(),
653 oscProb(oscProb)
654 {
655 insert(category, factor);
656 }
657
658
659 /**
660 * Constructor.
661 *
662 * \param oscProb oscillation probability calculator
663 * \param category event category
664 * \param factor event-weight factor
665 * \param args remaining pairs of event categories and event-weight factors
666 */
667 template<class ...Args>
669 const JEvtCategoryHelper& category,
670 const JFluxHelper& factor,
671 const Args& ...args) :
672 map_type(),
673 oscProb(oscProb)
674 {
675 insert(category, factor, args...);
676 }
677
678
679 /**
680 * Constructor.
681 *
682 * \param category event category
683 * \param flux flux function
684 */
686 const JFluxHelper& flux) :
687 map_type(),
688 oscProb()
689 {
690 insert(category, flux);
691 }
692
693
694
695 /**
696 * Constructor.
697 *
698 * \param category event category
699 * \param flux flux function
700 * \param args remaining pairs of event categories and flux functions
701 */
702 template<class ...Args>
704 const JFluxHelper& flux,
705 const Args& ...args) :
706 map_type()
707 {
708 insert(category, flux, args...);
709 }
710
711
712 /**
713 * Insert pair of an event category and a flux function.
714 *
715 * \param category event category
716 * \param flux flux function
717 */
718 void insert(const JEvtCategoryHelper& category,
719 const JFluxHelper& flux)
720 {
721 map_type::insert(std::make_pair(category, flux));
722 }
723
724
725 /**
726 * Insert pairs of event categories and flux functions.
727 *
728 * \param category event category
729 * \param flux flux function
730 * \param args remaining pairs of event categories and flux functions
731 */
732 template<class ...Args>
733 void insert(const JEvtCategoryHelper& category,
734 const JFluxHelper& flux,
735 const Args& ...args)
736 {
737 insert(category, flux);
738 insert(args...);
739 }
740
741
742 /**
743 * Get oscillation probability calculator.
744 *
745 * \return oscillation probability calculator
746 */
748 {
749 return oscProb;
750 }
751
752
753 /**
754 * Set oscillation probability calculator for all compatible flux factors.
755 *
756 * \param oscProb oscillation probability calculator
757 * \return number of modified event weighters
758 */
759 size_t setOscProb(const JOscProbHelper& oscProb)
760 {
761 using namespace JPP;
762
763 if (oscProb) {
764
765 size_t n = 0;
766
767 this->oscProb = oscProb;
768
769 for (iterator i = this->begin(); i != this->end(); ++i) {
770
771 JOscFlux* p = dynamic_cast<JOscFlux*>(&(i->second.getFlux()));
772
773 if (p != NULL) {
774 p->setOscProb(oscProb);
775 ++n;
776 }
777 }
778
779 return n;
780
781 } else {
782
783 THROW(JNullPointerException, "JEvtCategoryMap<JFluxHelper>::setOscProb(): Given oscillation probability function is invalid.");
784 }
785 }
786
787
788 /**
789 * Get weight factor of given event.
790 *
791 * \param evt event
792 * \return weight-factor for given event
793 */
794 double getFactor(const Evt& evt) const override final
795 {
796 using namespace JPP;
797
798 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
799 if (i->first.match(evt)) {
800 return i->second.getFactor(evt);
801 }
802 }
803
804 THROW(JValueOutOfRange, "JEvtCategoryMap<JFluxHelper>::getFactor(): No flux factor for given event.");
805 }
806
807
808 /**
809 * Check whether this flux factor is valid.
810 *
811 * \return true if valid; else false
812 */
813 bool is_valid() const override final
814 {
815 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
816 if (!(i->second.is_valid())) { return false; }
817 }
818
819 return true;
820 }
821
822
823 /**
824 * Get properties of this class.
825 *
826 * \param eqpars equation parameters
827 */
829 {
830 return JEvtCategoryMapHelper(*this, eqpars);
831 }
832
833
834 /**
835 * Get properties of this class.
836 *
837 * \param eqpars equation parameters
838 */
840 {
841 return JEvtCategoryMapHelper(*this, eqpars);
842 }
843
844
845 /**
846 * Read map between event categories and flux factors.
847 *
848 * \param in input stream
849 * \return input stream
850 */
851 std::istream& read(std::istream& in) override final
852 {
853 using namespace std;
854 using namespace JPP;
855
856 static const JFluxDictionary dictionary(oscProb);
857
858 JStringStream is(in);
859
860 if (getFileStatus(is.str().c_str())) {
861 is.load();
862 }
863
864 const streampos pos = is.tellg();
865 const ios_base::iostate state = is.rdstate();
866
867 // Read optional oscillation probability calculator configuration
868
869 JToken<';'> token;
870 is >> token;
871
872 istringstream iss(token);
873 iss >> oscProb;
874
875 if (fail(iss)) {
876 is.clear(state);
877 is.seekg(pos);
878 }
879
880 for (JToken<';'> token1, token2; is >> token1 >> token2; ) {
881
882 istringstream iss1(token1); // Read event categories
883
884 JEvtCategorySet categories;
885
886 iss1 >> categories;
887
888 istringstream iss2(token2); // Read event-weight factors
889
890 int fluxID = 0;
891
892 if (iss2 >> fluxID) {
893
894 const JFluxHelper helper = dictionary[fluxID];
895
896 JFlux& flux = helper.getFlux();
897
898 iss2 >> flux;
899
900 if (!fail(iss2)) {
901 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
902 this->insert(*i, helper);
903 }
904 }
905 }
906 }
907
908 return in;
909 }
910
911
912 /**
913 * Write event-weight factor to output
914 *
915 * \param out output stream
916 * \return output stream
917 */
918 std::ostream& write(std::ostream& out) const override final
919 {
920 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
921 }
922
923 private:
924
925 /**
926 * Auxiliary class for I/O of map of event categories and weight factors.
927 */
929 public JProperties
930 {
931 /**
932 * Constructor.
933 *
934 * \param map event category map
935 * \param eqpars equation parameters
936 */
937 template<class JEvtCategoryMap_type>
938 JEvtCategoryMapHelper(JEvtCategoryMap_type& map,
939 const JEquationParameters& eqpars) :
940 JProperties(eqpars, 1)
941 {
942 using namespace std;
943 using namespace JPP;
944
945 for (typename map_type::const_iterator i = map.cbegin(); i != map.cend(); ++i) {
946
947 const int index = 1 + distance(map.cbegin(), i);
948
949 const string key = MAKE_STRING("category" << index);
950
951 JProperties sub1 = i->first .getProperties(eqpars);
952 JProperties sub2 = i->second.getProperties(eqpars);
953
954 (*this)[key] = sub1.join(sub2);
955 }
956 }
957 };
958
959 JOscProbHelper oscProb; //!< oscillation probability calculator
960 };
961
962 using JFluxMap = JEvtCategoryMap<JFluxHelper>; //!< Type alias for flux maps
963}
964
965#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
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.