Jpp test-rotations-new
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"
12
13#include "Jeep/JPrint.hh"
14#include "Jeep/JProperties.hh"
15
17
23
27
28#include "JAAnet/JFlux.hh"
29#include "JAAnet/JFluxHelper.hh"
30#include "JAAnet/JFluxDictionary.hh"
31
32
33/**
34 * \author bjjung
35 */
36
37namespace JAANET {}
38namespace JPP { using namespace JAANET; }
39
40namespace JAANET {
41
42 using JLANG::JClonable;
43
45
47
48
49 /**
50 * Auxiliary class for reading a map of event categories.
51 *
52 * The template argument corresponds to the mapped value type.
53 */
54 template<class T>
56 public std::map<JEvtCategoryHelper, T>
57 {
58 public:
59
61
63
64 typedef typename map_type::iterator iterator;
65 typedef typename map_type::const_iterator const_iterator;
66
67
68 /**
69 * Default constructor.
70 */
72 map_type()
73 {}
74
75
76 /**
77 * Constructor.
78 *
79 * \param category event category
80 * \param value value
81 */
83 const T& value) :
84 map_type()
85 {
86 insert(category, value);
87 }
88
89
90
91 /**
92 * Constructor.
93 *
94 * \param category event category
95 * \param value value
96 * \param args remaining pairs of event categories and values
97 */
98 template<class ...Args>
100 const T& value,
101 const Args& ...args) :
102 map_type()
103 {
104 insert(category, value, args...);
105 }
106
107
108 /**
109 * Insert pair of event category and value.
110 *
111 * \param category event category
112 * \param value value
113 */
114 void insert(const JEvtCategoryHelper& category,
115 const T& value)
116 {
117 map_type::insert(std::make_pair(category, value));
118 }
119
120
121 /**
122 * Insert pairs of event categories and values.
123 *
124 * \param category event category
125 * \param value value
126 * \param args remaining pairs of event categories and values
127 */
128 template<class ...Args>
129 void insert(const JEvtCategoryHelper& category,
130 const T& value,
131 const Args& ...args)
132 {
133 insert(category, value);
134 insert(args...);
135 }
136 };
137
138
139 /**
140 * Template specialisation for a map between event categories and event-weight factor products.
141 *
142 * Input syntax as follows:
143 * <pre>
144 * <oscprob_key>=<oscprob_value>[,<oscprob_key>=<oscprob_value>]...
145 *
146 * oscprob.<oscprob_key>=<oscprob_value>[,oscprob.<oscprob_key>=<oscprob_value>]...
147 *
148 * oscprob=<oscprob_file>
149 *
150 * <oscprob_file>
151 *
152 * <PDG type> [ & <PDG type>]...; <factor identifier> [<factor arguments> [& <factor identifier> [<factor arguments]]...];
153 *
154 * <key>=<value>[,<key>=<value>]... [ & <key>=<value>[,<key>=<value>]...]...; <factor identifier> [<factor arguments> [& <factor identifier> [<factor arguments]]...];
155 * </pre>
156 * where
157 * - <oscprob_key> refers to an oscillation probability calculator configuration key;
158 * - <oscprob_value> to an oscillation probability calculator configuration value;
159 * - <oscprob_file> to an oscillation probability calculator configuration file;
160 * - <PDG type> to a PDG identifier;
161 * - <key> to one of the data members of a data structure derived from `JAANET::JEvtCategory`;
162 * - <value> to the corresponding value;
163 * - <factor identifier> to an event-weight factor identifier (c.f. `JAANET::JEvtWeighFactorDictionary::factors`); and
164 * - <factor arguments> to the list of arguments for the corresponding event-weight factor.
165 * Multiple event categories and flux factors can be specified, separated by the '&' character.
166 */
167 template<>
169 public std::map<JEvtCategoryHelper, JEvtWeightFactorProduct>,
170 public JClonable<JEvtWeightFactor, JEvtCategoryMap<JEvtWeightFactorProduct> >
171 {
172 public:
173
175
177
178 typedef typename map_type::iterator iterator;
179 typedef typename map_type::const_iterator const_iterator;
180
181
182 /**
183 * Default constructor.
184 */
186 map_type(),
187 oscProb(JOscProbInterpolator<>())
188 {}
189
190
191 /**
192 * Constructor.
193 *
194 * \param oscProb oscillation probability calculator
195 */
197 map_type(),
198 oscProb(oscProb)
199 {}
200
201
202 /**
203 * Constructor.
204 *
205 * \param oscProb oscillation probability calculator
206 * \param category event category
207 * \param factor event-weight factor
208 */
210 const JEvtCategoryHelper& category,
211 const JEvtWeightFactorHelper& factor) :
212 map_type(),
213 oscProb(oscProb)
214 {
215 insert(category, factor);
216 }
217
218
219
220 /**
221 * Constructor.
222 *
223 * \param oscProb oscillation probability calculator
224 * \param category event category
225 * \param factor event-weight factor
226 * \param args remaining pairs of event categories and event-weight factors
227 */
228 template<class ...Args>
230 const JEvtCategoryHelper& category,
231 const JEvtWeightFactorHelper& factor,
232 const Args& ...args) :
233 map_type(),
234 oscProb(oscProb)
235 {
236 insert(category, factor, args...);
237 }
238
239
240 /**
241 * Constructor.
242 *
243 * \param category event category
244 * \param factor event-weight factor
245 */
247 const JEvtWeightFactorHelper& factor) :
248 map_type(),
249 oscProb()
250 {
251 insert(category, factor);
252 }
253
254
255
256 /**
257 * Constructor.
258 *
259 * \param category event category
260 * \param factor event-weight factor
261 * \param args remaining pairs of event categories and event-weight factors
262 */
263 template<class ...Args>
265 const JEvtWeightFactorHelper& factor,
266 const Args& ...args) :
267 map_type(),
268 oscProb()
269 {
270 insert(category, factor, args...);
271 }
272
273
274 /**
275 * Insert pair of an event category and a product of event-weight factors.
276 *
277 * \param category pointer to event category
278 * \param product product of event-weight factors
279 */
280 void insert(const JEvtCategoryHelper& category,
281 const JEvtWeightFactorProduct& product)
282 {
283 iterator i = this->find(category);
284
285 if (i != this->end()) {
286 i->second.join(product);
287 } else {
288 map_type::insert(std::make_pair(category, product));
289 }
290 }
291
292
293 /**
294 * Insert event category.
295 *
296 * \param category event category
297 * \param factor event-weight factor
298 */
299 void insert(const JEvtCategoryHelper& category,
300 const JEvtWeightFactorHelper& factor)
301 {
302 iterator i = this->find(category);
303
304 if (i == this->end()) {
305
306 const JEvtWeightFactorProduct product(oscProb, factor);
307
308 map_type::insert(std::make_pair(category, product));
309
310 } else {
311
312 i->second.push_back(factor);
313 }
314 }
315
316
317 /**
318 * Insert pairs of event categories and event-weight factors.
319 *
320 * \param category event category
321 * \param factor event-weight factor
322 * \param args remaining pairs of event categories and event-weight factors
323 */
324 template<class ...Args>
325 void insert(const JEvtCategoryHelper& category,
326 const JEvtWeightFactorHelper& factor,
327 const Args& ...args)
328 {
329 insert(category, factor);
330 insert(args...);
331 }
332
333
334 /**
335 * Join this map between event categories and weight factors with a given map between event categories and weight factors.
336 *
337 * \param object map between event categories and fluxes
338 * \return joined map between event categories and fluxes
339 */
341 {
342 for (const_iterator i = object.cbegin(); i != object.cend(); ++i) {
343
344 iterator j = this->find(i->first);
345
346 if (j != this->end()) {
347 j->second.join(i->second);
348 } else {
349 this->insert(j->first, j->second);
350 }
351 }
352
353 return (*this);
354 }
355
356
357 /**
358 * Get oscillation probability calculator.
359 *
360 * \return oscillation probability calculator
361 */
363 {
364 return oscProb;
365 }
366
367
368 /**
369 * Set oscillation probability calculator for all compatible event weight factors.
370 *
371 * \param oscProb oscillation probability calculator
372 * \return number of modified event weighters
373 */
374 size_t setOscProb(const JOscProbHelper& oscProb)
375 {
376 using namespace JPP;
377
378 if (oscProb) {
379
380 size_t n = 0;
381
382 this->oscProb = oscProb;
383
384 for (iterator i = this->begin(); i != this->end(); ++i) {
385 n += i->second.setOscProb(oscProb);
386 }
387
388 return n;
389
390 } else {
391
392 THROW(JNullPointerException, "JEvtCategoryMap<JFluxHelper>::setOscProb(): Given oscillation probability function is invalid.");
393 }
394 }
395
396
397 /**
398 * Get weight factor of given event.
399 *
400 * \param evt event
401 * \return weight-factor for given event
402 */
403 double getFactor(const Evt& evt) const override final
404 {
405 using namespace JPP;
406
407 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
408 if (i->first.match(evt)) {
409 return i->second.getFactor(evt);
410 }
411 }
412
413 THROW(JValueOutOfRange, "JEvtCategoryMap<JEvtWeightFactorHelper>::getFactor(): No event-weight factor for given event.");
414 }
415
416
417 /**
418 * Check whether this event-weight factor is valid.
419 *
420 * \return true if valid; else false
421 */
422 bool is_valid() const override final
423 {
424 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
425 if (!i->second.is_valid()) { return false; }
426 }
427
428 return true;
429 }
430
431
432 /**
433 * Get properties of this class.
434 *
435 * \param eqpars equation parameters
436 */
437 JProperties getProperties(const JEquationParameters& eqpars) override final
438 {
439 return JEvtCategoryMapHelper(*this, eqpars);
440 }
441
442
443 /**
444 * Get properties of this class.
445 *
446 * \param eqpars equation parameters
447 */
448 JProperties getProperties(const JEquationParameters& eqpars) const override final
449 {
450 return JEvtCategoryMapHelper(*this, eqpars);
451 }
452
453
454 /**
455 * Read map between event categories and event-weight factors
456 *
457 * \param in input stream
458 * \return input stream
459 */
460 std::istream& read(std::istream& in) override final
461 {
462 using namespace std;
463 using namespace JPP;
464
465 streampos pos = in.tellg();
466
467 // Optional loading of data from file
468
469 std::string buffer;
470 in >> buffer;
471
472 if (getFileStatus(buffer.c_str())) {
473
474 ifstream ifs(buffer.c_str());
475
476 read(ifs);
477
478 ifs.close();
479
480 return in;
481
482 } else {
483
484 in.clear();
485 in.seekg(pos);
486 }
487
488 // Read optional oscillation probability calculator configuration
489
490 in >> oscProb;
491
492 if (fail(in)) {
493
494 in.clear();
495 in.seekg(pos);
496 }
497
498 for (JToken<';'> token1, token2; in >> token1 >> token2; ) {
499
500 istringstream iss1(token1); // Read event categories
501
502 JEvtCategorySet categories;
503
504 iss1 >> categories;
505
506 istringstream iss2(token2); // Read event-weight factors
507
508 JEvtWeightFactorProduct factors(oscProb);
509
510 iss2 >> factors;
511
512 if (!fail(iss2)) {
513
514 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
515 this->insert(*i, factors);
516 }
517 }
518 }
519
520 return in;
521 }
522
523
524 /**
525 * Write event-weight factor to output
526 *
527 * \param out output stream
528 * \return output stream
529 */
530 std::ostream& write(std::ostream& out) const override final
531 {
532 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
533 }
534
535
536 private:
537
538 /**
539 * Auxiliary class for I/O of map of event categories and weight factors.
540 */
542 public JProperties
543 {
544 /**
545 * Constructor.
546 *
547 * \param map event category map
548 * \param eqpars equation parameters
549 */
550 template<class JEvtCategoryMap_type>
551 JEvtCategoryMapHelper(JEvtCategoryMap_type& map,
552 const JEquationParameters& eqpars) :
553 JProperties(eqpars, 1)
554 {
555 using namespace std;
556 using namespace JPP;
557
558 for (typename map_type::const_iterator i = map.cbegin(); i != map.cend(); ++i) {
559
560 const int index = 1 + distance(map.cbegin(), i);
561
562 const string key = MAKE_STRING("category" << index);
563
564 JProperties properties1 = i->first .getProperties(eqpars);
565 JProperties properties2 = i->second.getProperties(eqpars);
566
567 (*this)[key] = properties1.join(properties2);
568 }
569 }
570 };
571
572 JOscProbHelper oscProb; //!< oscillation probability calculator
573 };
574
576
577
578 /**
579 * Template specialisation for a map between event categories and flux factors.
580 *
581 * Input syntax as follows:
582 * <pre>
583 * <oscprob_key>=<oscprob_value>[,<oscprob_key>=<oscprob_value>]...
584 *
585 * oscprob.<oscprob_key>=<oscprob_value>[,oscprob.<oscprob_key>=<oscprob_value>]...
586 *
587 * oscprob=<oscprob_file>
588 *
589 * <oscprob_file>
590 *
591 * <PDG type> [<PDG type>]...; <flux identifier> [<flux arguments>];
592 *
593 * <key>=<value>[,<key>=<value>]...; <flux identifier> [<flux arguments>];
594 *
595 * </pre>
596 * where
597 * - <oscprob_key> refers to an oscillation probability calculator configuration key;
598 * - <oscprob_value> to an oscillation probability calculator configuration value;
599 * - <oscprob_file> to an oscillation probability calculator configuration file;
600 * - <PDG type> to a PDG identifier;
601 * - <key> to one of the data members of a data structure derived from `JAANET::JEvtCategory`;
602 * - <value> to the corresponding value;
603 * - <flux identifier> to a flux identifier (c.f. `JAANET::JFluxDictionary`) and
604 * - <flux arguments> to the list of arguments of the corresponding flux factor.
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 streampos pos = in.tellg();
859
860 // Optional loading of data from file
861
862 std::string buffer;
863 in >> buffer;
864
865 if (getFileStatus(buffer.c_str())) {
866
867 ifstream ifs(buffer.c_str());
868
869 read(ifs);
870
871 ifs.close();
872
873 return in;
874
875 } else {
876
877 in.clear();
878 in.seekg(pos);
879 }
880
881 // Read optional oscillation probability calculator configuration
882
883 in >> oscProb;
884
885 if (fail(in)) {
886
887 in.clear();
888 in.seekg(pos);
889 }
890
891 for (JToken<';'> token1, token2; in >> token1 >> token2; ) {
892
893 istringstream iss1(token1); // Read event categories
894
895 JEvtCategorySet categories;
896
897 iss1 >> categories;
898
899 istringstream iss2(token2); // Read event-weight factors
900
901 int fluxID = 0;
902
903 if (iss2 >> fluxID) {
904
905 JFluxHelper helper(dictionary.at(fluxID).getFlux());
906
907 JFlux& flux = helper.getFlux();
908
909 iss2 >> flux;
910
911 if (!fail(iss2)) {
912 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
913 this->insert(*i, helper);
914 }
915 }
916 }
917 }
918
919 return in;
920 }
921
922
923 /**
924 * Write event-weight factor to output
925 *
926 * \param out output stream
927 * \return output stream
928 */
929 std::ostream& write(std::ostream& out) const override final
930 {
931 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
932 }
933
934 private:
935
936 /**
937 * Auxiliary class for I/O of map of event categories and weight factors.
938 */
940 public JProperties
941 {
942 /**
943 * Constructor.
944 *
945 * \param map event category map
946 * \param eqpars equation parameters
947 */
948 template<class JEvtCategoryMap_type>
949 JEvtCategoryMapHelper(JEvtCategoryMap_type& map,
950 const JEquationParameters& eqpars) :
951 JProperties(eqpars, 1)
952 {
953 using namespace std;
954 using namespace JPP;
955
956 for (typename map_type::const_iterator i = map.cbegin(); i != map.cend(); ++i) {
957
958 const int index = 1 + distance(map.cbegin(), i);
959
960 const string key = MAKE_STRING("category" << index);
961
962 JProperties sub1 = i->first .getProperties(eqpars);
963 JProperties sub2 = i->second.getProperties(eqpars);
964
965 (*this)[key] = sub1.join(sub2);
966 }
967 }
968 };
969
970 JOscProbHelper oscProb; //!< oscillation probability calculator
971 };
972
973 using JFluxMap = JEvtCategoryMap<JFluxHelper>; //!< Type alias for flux maps
974}
975
976#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 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.
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
Definition io_ascii.hh:142
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.