Jpp  master_rocky-43-ge265d140c
the software that should make you happy
JHead.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JHEAD__
2 #define __JAANET__JHEAD__
3 
4 #include <string>
5 #include <vector>
6 #include <cmath>
7 #include <ctype.h>
8 #include <sstream>
9 
10 #include "TObject.h"
11 
14 
15 #include "JLang/JUUID.hh"
16 #include "JLang/JException.hh"
18 #include "JLang/JLangToolkit.hh"
19 
20 #include "JTools/JRange.hh"
21 
22 #include "JROOT/JRootClass.hh"
23 
24 
25 /**
26  * \author mdejong
27  */
28 
29 namespace JAANET {}
30 namespace JPP { using namespace JAANET; }
31 
32 namespace JAANET {
33 
34  using JLANG::JUUID;
35  using JLANG::JException;
37 
38  /**
39  * Type definition of range.
40  */
41  struct JRange_t :
42  public JTOOLS::JRange<double>
43  {
44  /**
45  * Default constructor.
46  */
48  JTOOLS::JRange<double>()
49  {}
50 
51 
52  /**
53  * Constructor.
54  *
55  * \param x lower limit
56  * \param y upper limit
57  */
58  JRange_t(double x,
59  double y) :
60  JTOOLS::JRange<double>(x, y)
61  {}
62  };
63 
64 
65  static const char AANET_TAG_SEPARATOR = '_'; //!< Separator for tag extension of multiple tags in Head ("_<counter>").
66 
67  class JHead; // forward declaration for copy methods
68 
69 
70  /**
71  * Copy header from <tt>from</tt> to <tt>to</tt>.
72  *
73  * \param from header
74  * \param to header
75  */
76  extern void copy(const JHead& from, Head& to);
77 
78 
79  /**
80  * Copy header from <tt>from</tt> to <tt>to</tt>.
81  *
82  * \param from header
83  * \param to header
84  */
85  extern void copy(const Head& from, JHead& to);
86 
87 
88  /**
89  * Get tag without aanet extension "_<counter>" for identical tags.
90  *
91  * \param tag tag
92  * \return tag
93  */
94  inline std::string getTag(const std::string& tag)
95  {
96  using namespace std;
97 
98  const string::size_type pos = tag.find(AANET_TAG_SEPARATOR);
99 
100  if (pos != string::npos) {
101 
102  for (string::size_type i = pos + 1; i != tag.size(); ++i) {
103  if (!isdigit(tag[i])) {
104  return tag;
105  }
106  }
107 
108  return tag.substr(0, pos);
109  }
110 
111  return tag;
112  }
113 
114 
115  /**
116  * Get tag with aanet extension "_<counter>" for identical tags.
117  *
118  * \param tag tag
119  * \param counter counter
120  * \return tag
121  */
122  inline std::string getTag(const std::string& tag, const int counter)
123  {
124  std::ostringstream os;
125 
126  os << tag << AANET_TAG_SEPARATOR << counter;
127 
128  return os.str();
129  }
130 
131 
132  /**
133  * Start of run record.
134  */
135  struct start_run {
136  /**
137  * Default constructor.
138  */
140  run_id(0)
141  {}
142 
143  int run_id; ///< MC run number
144 
146  };
147 
148 
149  /**
150  * General purpose string class.
151  */
152  struct String {
153  /**
154  * Default constructor.
155  */
156  String() :
157  buffer()
158  {}
159 
160  /**
161  * Test match.
162  *
163  * \param object string
164  * \return true if matches; else false
165  */
166  inline bool match(const String& object) const
167  {
168  return !(*this).less(object) && !(object).less(*this);
169  }
170 
171  /**
172  * Comparison.
173  *
174  * \param object string
175  * \return true if this string less than given string; else false
176  */
177  inline bool less(const String& object) const
178  {
179  using namespace std;
180 
181  istringstream i0(this ->buffer);
182  istringstream i1(object.buffer);
183 
184  vector<string> v0;
185  vector<string> v1;
186 
187  copy(istream_iterator<string>(i0), istream_iterator<string>(), back_inserter(v0));
188  copy(istream_iterator<string>(i1), istream_iterator<string>(), back_inserter(v1));
189 
190  return v0 < v1;
191  }
192 
193  /**
194  * Read string from input stream.
195  *
196  * \param in input stream
197  * \param object string
198  * \return input stream
199  */
200  friend inline std::istream& operator>>(std::istream& in, String& object)
201  {
202  return std::getline(in, object.buffer);
203  }
204 
205  /**
206  * Write string to output stream.
207  *
208  * \param out output stream
209  * \param object string
210  * \return output stream
211  */
212  friend inline std::ostream& operator<<(std::ostream& out, const String& object)
213  {
214  return out << object.buffer;
215  }
216 
217  std::string buffer; ///< General purpose name
218 
220  };
221 
222 
223  /**
224  * Detector file.
225  */
226  struct detector
227  {
228  /**
229  * Default constructor.
230  */
232  {}
233 
234  /**
235  * Test match.
236  *
237  * \param object detector
238  * \return true if matches; else false
239  */
240  inline bool match(const detector& object) const
241  {
242  return this->program == object.program && this->filename == object.filename;
243  }
244 
245  /**
246  * Read detector from input stream.
247  *
248  * \param in input stream
249  * \param object detector
250  * \return input stream
251  */
252  friend inline std::istream& operator>>(std::istream& in, detector& object)
253  {
254  using namespace JPP;
255 
256  in >> object.program >> object.filename;
257 
258  if (!in || is_integer(object.filename)) { // legacy
259  object.filename = object.program;
260  object.program = "?";
261  }
262 
263  return in;
264  }
265 
266  /**
267  * Write detector to output stream.
268  *
269  * \param out output stream
270  * \param object detector
271  * \return output stream
272  */
273  friend inline std::ostream& operator<<(std::ostream& out, const detector& object)
274  {
275  return out << object.program << ' ' << object.filename;
276  }
277 
278  std::string program;
279  std::string filename;
280 
282  };
283 
284 
285  /**
286  * Muon descriptor file.
287  */
288  struct muon_desc_file :
289  public String
290  {
292  };
293 
294 
295  /**
296  * Target.
297  */
298  struct target :
299  public String
300  {
302  };
303 
304 
305  /**
306  * Neutrino cross section file.
307  */
308  struct XSecFile :
309  public String
310  {
312  };
313 
314 
315  /**
316  * Drawing.
317  */
318  struct drawing :
319  public String
320  {
322  };
323 
324 
325  /**
326  * Calibration.
327  */
328  struct calibration :
329  public String
330  {
331  static const std::string statical() { return "statical"; }
332  static const std::string dynamical() { return "dynamical"; }
333 
335  };
336 
337 
338  /**
339  * General purpose class of phase space generation.
340  */
341  struct cut {
342  /**
343  * Default constructor.
344  */
345  cut() :
346  E (0.0, 0.0),
347  cosT(0.0, 0.0)
348  {}
349 
350  /**
351  * Constructor.
352  *
353  * \param _E energy range
354  * \param _cosT cosine zenith angle range
355  */
356  cut(const JRange_t& _E,
357  const JRange_t& _cosT) :
358  E (_E),
359  cosT(_cosT)
360  {}
361 
362  /**
363  * Constructor.
364  *
365  * \param Emin energy range lower bound
366  * \param Emax energy range upper bound
367  * \param cosTmin cosine zenith angle lower bound
368  * \param cosTmax cosine zenith angle upper bound
369  */
370  cut(const double Emin,
371  const double Emax,
372  const double cosTmin,
373  const double cosTmax) :
374  E (Emin, Emax),
375  cosT(cosTmin, cosTmax)
376  {}
377 
378  /**
379  * Comparison.
380  *
381  * \param object cut
382  * \return true if this cut less than given cut; else false
383  */
384  inline bool less(const cut& object) const
385  {
386  if (E.getLowerLimit() == object.E.getLowerLimit()) {
387 
388  if (E.getUpperLimit() == object.E.getUpperLimit()) {
389 
390  if (cosT.getLowerLimit() == object.cosT.getLowerLimit()) {
391  return cosT.getUpperLimit() < object.cosT.getUpperLimit();
392  } else {
393  return cosT.getLowerLimit() < object.cosT.getLowerLimit();
394  }
395 
396  } else {
397 
398  return E.getUpperLimit() < object.E.getUpperLimit();
399  }
400 
401  } else {
402 
403  return E.getLowerLimit() < object.E.getLowerLimit();
404  }
405  }
406 
407  /**
408  * Test match.
409  *
410  * \param object cut
411  * \return true if matches; else false
412  */
413  inline bool match(const cut& object) const
414  {
415  return (E .equals(object.E) &&
416  cosT.equals(object.cosT));
417  }
418 
419  JRange_t E; ///< Energy range [GeV]
420  JRange_t cosT; ///< Cosine zenith angle range
421 
423  };
424 
425 
426  /**
427  * Phase space of primary particle.
428  */
429  struct cut_primary :
430  public cut
431  {
433  };
434 
435 
436  /**
437  * Phase space of atmospheric muon generation.
438  */
439  struct cut_seamuon :
440  public cut
441  {
443  };
444 
445 
446  /**
447  * Phase space of incoming particle
448  */
449  struct cut_in :
450  public cut
451  {
453  };
454 
455 
456  /**
457  * Phase space of incident neutrino.
458  */
459  struct cut_nu :
460  public cut
461  {
463  };
464 
465 
466  /**
467  * Description of Monte Carlo event generation applications.
468  */
469  struct generator {
470  /**
471  * Default constructor.
472  */
474  program(),
475  version(),
476  date(),
477  time()
478  {}
479 
480  /**
481  * Comparison.
482  *
483  * \param object generator
484  * \return true if this primary particle is less than given primary particle; else false
485  */
486  inline bool less(const generator& object) const
487  {
488  return program < object.program;
489  }
490 
491  /**
492  * Test match.
493  *
494  * Note that only the name of program is matched.
495  *
496  * \param object generator
497  * \return true if matches; else false
498  */
499  inline bool match(const generator& object) const
500  {
501  return program == object.program;
502  }
503 
504  std::string program; ///< program name
505  std::string version; ///< program version
506  std::string date; ///< processing date
507  std::string time; ///< processing time
508 
510  };
511 
512 
513  /**
514  * Physics information.
515  */
516  struct physics :
517  public String
518  {
520  };
521 
522 
523  /**
524  * Generator for simulation.
525  */
526  struct simul :
527  public generator
528  {
530  };
531 
532 
533  /**
534  * Neutrino energy spectrum.
535  */
536  struct spectrum {
537  /**
538  * Default constructor.
539  */
540  spectrum() :
541  alpha(0)
542  {}
543 
544  /**
545  * Comparison.
546  *
547  * \param object spectrum
548  * \return true if this spectrum less than given spectrum; else false
549  */
550  inline bool less(const spectrum& object) const
551  {
552  return alpha < object.alpha;
553  }
554 
555  /**
556  * Test match.
557  *
558  * \param object spectrum
559  * \return true if matches; else false
560  */
561  inline bool match(const spectrum& object) const
562  {
563  return (alpha == object.alpha);
564  }
565 
566  double alpha; ///< Energy spectrum: \f$ \Phi \propto E^{-\alpha} \f$
567 
569  };
570 
571 
572  /**
573  * The cylinder used for photon tracking.
574  */
575  struct can {
576  /**
577  * Default constructor.
578  */
579  can() :
580  zmin(0),
581  zmax(0),
582  r(0)
583  {}
584 
585  /**
586  * Test match.
587  *
588  * \param object can
589  * \return true if matches; else false
590  */
591  inline bool match(const can& object) const
592  {
593  return (zmin == object.zmin &&
594  zmax == object.zmax &&
595  r == object.r);
596  }
597 
598  double zmin; ///< Bottom [m]
599  double zmax; ///< Top [m]
600  double r; ///< Radius [m]
601 
603  };
604 
605 
606  /**
607  * The fixed cylinder used for photon tracking.
608  */
609  struct fixedcan {
610  /**
611  * Default constructor.
612  */
614  xcenter(0),
615  ycenter(0),
616  zmin(0),
617  zmax(0),
618  radius(0)
619  {}
620 
621  /**
622  * Test match.
623  *
624  * \param object can
625  * \return true if matches; else false
626  */
627  inline bool match(const fixedcan& object) const
628  {
629  return (xcenter == object.xcenter &&
630  ycenter == object.ycenter &&
631  zmin == object.zmin &&
632  zmax == object.zmax &&
633  radius == object.radius);
634  }
635 
636  double xcenter; ///< x-center [m]
637  double ycenter; ///< y-center [m]
638  double zmin; ///< Bottom [m]
639  double zmax; ///< Top [m]
640  double radius; ///< Radius [m]
641 
643  };
644 
645 
646  /**
647  * Neutrino vertex volume.
648  */
649  struct genvol {
650  /**
651  * Default constructor.
652  */
653  genvol() :
654  zmin(0),
655  zmax(0),
656  r(0),
657  volume(0),
658  numberOfEvents(0)
659  {}
660 
661  /**
662  * Comparison.
663  *
664  * \param object genvol
665  * \return true if this genvol less than given genvol; else false
666  */
667  inline bool less(const genvol& object) const
668  {
669  return volume < object.volume;
670  }
671 
672  /**
673  * Test match.
674  *
675  * \param object generation volume
676  * \return true if matches; else false
677  */
678  inline bool match(const genvol& object) const
679  {
680  return (zmin == object.zmin &&
681  zmax == object.zmax &&
682  r == object.r &&
683  volume == object.volume);
684  }
685 
686  /**
687  * Addition.
688  *
689  * \param object generation volume
690  * \return this generation volume
691  */
692  inline genvol& add(const genvol& object)
693  {
694  numberOfEvents += object.numberOfEvents;
695 
696  return *this;
697  }
698 
699  /**
700  * Scale.
701  *
702  * \param factor 1D scale factor
703  * \param z z position
704  * \return this genvol
705  */
706  inline genvol& mul(const double factor,
707  const double z = 0.0)
708  {
709  zmin = (zmin - z) * factor + z;
710  zmax = (zmax - z) * factor + z;
711  r *= factor;
712  volume *= factor * factor * factor;
713 
714  return *this;
715  }
716 
717  double zmin; ///< Bottom [m]
718  double zmax; ///< Top [m]
719  double r; ///< Radius [m]
720  double volume; ///< Volume [m^3]
721  double numberOfEvents; ///< Number of events
722 
724  };
725 
726 
727  /**
728  * Coordinate origin.
729  */
730  struct coord_origin :
731  public Vec
732  {
733  /**
734  * Default constructor.
735  */
737  Vec()
738  {}
739 
740  /**
741  * Constructor.
742  *
743  * \param x x position
744  * \param y y position
745  * \param z z position
746  */
747  coord_origin(const double x,
748  const double y,
749  const double z) :
750  Vec(x,y,z)
751  {}
752 
753  /**
754  * Test match.
755  *
756  * \param object coordinate origin
757  * \return true if matches; else false
758  */
759  inline bool match(const coord_origin& object) const
760  {
761  return (x == object.x &&
762  y == object.y &&
763  z == object.z);
764  }
765 
767  };
768 
769 
770  /**
771  * Phase space for incident neutrino.
772  */
773  struct genhencut {
774  /**
775  * Default constructor.
776  */
778  gDir(0),
779  Emin(0)
780  {}
781 
782  double gDir; ///< Angle
783  double Emin; ///< Minimal energy [GeV]
784 
786  };
787 
788 
789  /**
790  * Normlisation of CORSIKA events.
791  */
792  struct norma {
793  /**
794  * Default constructor.
795  */
796  norma() :
797  primaryFlux(0),
798  numberOfPrimaries(0)
799  {}
800 
801  /**
802  * Test match.
803  *
804  * \param object normalisation
805  * \return true if matches; else false
806  */
807  inline bool match(const norma& object) const
808  {
809  return (primaryFlux == object.primaryFlux);
810  }
811 
812  /**
813  * Addition.
814  *
815  * \param object normalisation
816  * \return this normalisation
817  */
818  inline norma& add(const norma& object)
819  {
820  numberOfPrimaries += object.numberOfPrimaries;
821 
822  return *this;
823  }
824 
825  double primaryFlux; ///< Primary flux
826  double numberOfPrimaries; ///< Number of primaries
827 
829  };
830 
831 
832  /**
833  * Normalisation of MUPAGE events.
834  */
835  struct livetime {
836  /**
837  * Default constructor.
838  */
840  numberOfSeconds(0),
841  errorOfSeconds(0)
842  {}
843 
844  /**
845  * Comparison.
846  *
847  * \param object livetime
848  * \return true if this livetime is less than given livetime; else false
849  */
850  inline bool less(const livetime& object) const
851  {
852  return numberOfSeconds < object.numberOfSeconds;
853  }
854 
855  /**
856  * Test match.
857  *
858  * \param object live time
859  * \return true if matches; else false
860  */
861  inline bool match(const livetime& object) const
862  {
863  return ((numberOfSeconds == 0.0 && object.numberOfSeconds == 0.0) ||
864  (numberOfSeconds > 0.0 && object.numberOfSeconds > 0.0));
865  }
866 
867  /**
868  * Addition.
869  *
870  * \param object live time
871  * \return this live time
872  */
873  inline livetime& add(const livetime& object)
874  {
875  numberOfSeconds += object.numberOfSeconds;
876  errorOfSeconds = sqrt(errorOfSeconds * errorOfSeconds +
877  object.errorOfSeconds * object.errorOfSeconds);
878 
879  return *this;
880  }
881 
882  /**
883  * Scale.
884  *
885  * \param factor 1D scale factor
886  * \return this livetime
887  */
888  inline livetime& mul(const double factor)
889  {
890  numberOfSeconds /= (factor * factor);
891  errorOfSeconds /= (factor * factor);
892 
893  return *this;
894  }
895 
896  double numberOfSeconds; ///< Live time [s]
897  double errorOfSeconds; ///< Uncertainty on live time [s]
898 
900  };
901 
902 
903  /**
904  * Neutrino flux.
905  */
906  struct flux {
907  public:
908  /**
909  * Default constructor.
910  */
911  flux() :
912  type(0),
913  key(),
914  file_1(),
915  file_2()
916  {}
917 
918  /**
919  * Comparison.
920  *
921  * \param object flux
922  * \return true if this flux is less than given flux; else false
923  */
924  inline bool less(const flux& object) const
925  {
926  return type < object.type;
927  }
928 
929  /**
930  * Test match.
931  *
932  * \param object flux
933  * \return true if matches; else false
934  */
935  inline bool match(const flux& object) const
936  {
937  return type == object.type;
938  }
939 
940  int type; ///< Type
941  std::string key; ///< Key
942  std::string file_1; ///< File name
943  std::string file_2; ///< File name
944 
946  };
947 
948 
949  /**
950  * The bottom of the sea.
951  */
952  struct seabottom {
953  /**
954  * Default constructor.
955  */
957  z(0)
958  {}
959 
960  /**
961  * Test match.
962  *
963  * \param object sea bottom
964  * \return true if matches; else false
965  */
966  inline bool match(const seabottom& object) const
967  {
968  return (z == object.z);
969  }
970 
971  double z; ///< Sea bottom [m]
972 
974  };
975 
976 
977  /**
978  * Depth.
979  */
980  struct depth {
981  /**
982  * Default constructor.
983  */
984  depth() :
985  z(0)
986  {}
987 
988  /**
989  * Test match.
990  *
991  * \param object sea bottom
992  * \return true if matches; else false
993  */
994  inline bool match(const depth& object) const
995  {
996  return (z == object.z);
997  }
998 
999  double z; ///< Sea bottom [m]
1000 
1002  };
1003 
1004 
1005  /**
1006  * Livetime of DAQ data.
1007  */
1008  struct DAQ {
1009  public:
1010  /**
1011  * Default constructor.
1012  */
1013  DAQ() :
1014  livetime_s(0.0)
1015  {}
1016 
1017  /**
1018  * Comparison.
1019  *
1020  * \param object DAQ
1021  * \return true if this DAQ is less than given DAQ; else false
1022  */
1023  inline bool less(const DAQ& object) const
1024  {
1025  return livetime_s < object.livetime_s;
1026  }
1027 
1028  /**
1029  * Test match.
1030  *
1031  * \param object DAQ
1032  * \return true if matches; else false
1033  */
1034  inline bool match(const DAQ& object) const
1035  {
1036  return ((livetime_s == 0.0 && object.livetime_s == 0.0) ||
1037  (livetime_s > 0.0 && object.livetime_s > 0.0));
1038  }
1039 
1040  /**
1041  * Addition.
1042  *
1043  * \param object DAQ
1044  * \return this DAQ
1045  */
1046  inline DAQ& add(const DAQ& object)
1047  {
1048  livetime_s += object.livetime_s;
1049 
1050  return *this;
1051  }
1052 
1053  double livetime_s; ///< Live time [s]
1054 
1056  };
1057 
1058 
1059  /**
1060  * Livetime of noise data.
1061  */
1062  struct K40 {
1063  public:
1064  /**
1065  * Default constructor.
1066  */
1067  K40() :
1068  livetime_s(0.0)
1069  {}
1070 
1071  /**
1072  * Comparison.
1073  *
1074  * \param object K40
1075  * \return true if this K40 is less than given K40; else false
1076  */
1077  inline bool less(const K40& object) const
1078  {
1079  return livetime_s < object.livetime_s;
1080  }
1081 
1082  /**
1083  * Test match.
1084  *
1085  * \param object K40
1086  * \return true if matches; else false
1087  */
1088  inline bool match(const K40& object) const
1089  {
1090  return ((livetime_s == 0.0 && object.livetime_s == 0.0) ||
1091  (livetime_s > 0.0 && object.livetime_s > 0.0));
1092  }
1093 
1094  /**
1095  * Addition.
1096  *
1097  * \param object K40
1098  * \return this K40
1099  */
1100  inline K40& add(const K40& object)
1101  {
1102  livetime_s += object.livetime_s;
1103 
1104  return *this;
1105  }
1106 
1107  double livetime_s; ///< Live time [s]
1108 
1110  };
1111 
1112 
1113  /**
1114  * Time duration of event generation.
1115  */
1116  struct tgen {
1117  /**
1118  * Default constructor.
1119  */
1120  tgen() :
1121  numberOfSeconds(0)
1122  {}
1123 
1124  /**
1125  * Test match.
1126  *
1127  * \param object time duration
1128  * \return true if matches; else false
1129  */
1130  inline bool match(const tgen& object) const
1131  {
1132  return this->numberOfSeconds == object.numberOfSeconds;
1133  }
1134 
1135  double numberOfSeconds; ///< Time in seconds
1136 
1138  };
1139 
1140 
1141  /**
1142  * UTC time interval for event generation.
1143  */
1144  struct time_interval {
1145  /**
1146  * Default constructor.
1147  */
1149  t1(0),
1150  t2(0)
1151  {}
1152 
1153  /**
1154  * Test match.
1155  *
1156  * \param object time interval
1157  * \return true if matches; else false
1158  */
1159  inline bool match(const time_interval& object) const
1160  {
1161  return (this->t1 == object.t1 && this->t2 == object.t2);
1162  }
1163 
1164  double t1; ///< Start time in seconds
1165  double t2; ///< Stop time in seconds
1166 
1168  };
1169 
1170 
1171  /**
1172  * Primary particle.
1173  */
1174  struct primary {
1175  /**
1176  * Default constructor.
1177  */
1178  primary() :
1179  type(0)
1180  {}
1181 
1182  /**
1183  * Comparison.
1184  *
1185  * \param object primary particle
1186  * \return true if this primary particle is less than given primary particle; else false
1187  */
1188  inline bool less(const primary& object) const
1189  {
1190  return type < object.type;
1191  }
1192 
1193  /**
1194  * Test match.
1195  *
1196  * \param object primary particle
1197  * \return true if matches; else false
1198  */
1199  inline bool match(const primary& object) const
1200  {
1201  return (type == object.type);
1202  }
1203 
1204  int type; ///< Particle type
1205 
1207  };
1208 
1209 
1210  /**
1211  * End of event record.
1212  */
1213  struct end_event {
1214  /**
1215  * Default constructor.
1216  */
1218  {}
1219 
1221  };
1222 
1223 
1224  /**
1225  * Monte Carlo run header.
1226  *
1227  * This class extends the Head class so that the data from specific tags
1228  * can be promoted to concrete data types.
1229  *
1230  * Note that for the copy of new JHead data (e.g.\ data not obtained via a previous JAANET::copy) to become effective,
1231  * the key words in the corresponding map of the Head class should be set. \n
1232  * To this end, member method JHead::push can be used.
1233  */
1234  class JHead :
1235  public Head
1236  {
1237  public:
1238  /**
1239  * Default constructor.
1240  */
1242  {
1243  createUUID();
1244  }
1245 
1246 
1247  /**
1248  * Copy constructor.
1249  *
1250  * \param header header
1251  */
1252  JHead(const Head& header)
1253  {
1254  copy(header, *this);
1255  }
1256 
1257 
1258  /**
1259  * Virtual destructor.
1260  */
1261  virtual ~JHead()
1262  {}
1263 
1264 
1265  /**
1266  * Get header.
1267  *
1268  * \return header
1269  */
1270  const JHead& getHeader() const
1271  {
1272  return static_cast<const JHead&>(*this);
1273  }
1274 
1275 
1276  /**
1277  * Get header.
1278  *
1279  * \return header
1280  */
1282  {
1283  return static_cast<JHead&>(*this);
1284  }
1285 
1286 
1287  /**
1288  * Set header.
1289  *
1290  * \param header header
1291  */
1292  void setHeader(const JHead& header)
1293  {
1294  static_cast<JHead&>(*this) = header;
1295  }
1296 
1297 
1298  /**
1299  * Create UUID if not already set.
1300  */
1301  void createUUID()
1302  {
1303  if (!is_valid(&JHead::UUID)) {
1304  this->UUID = JUUID::rndm();
1305  this->push(&JHead::UUID);
1306  }
1307  }
1308 
1309 
1310  /**
1311  * Check validity of given data member in JHead.
1312  *
1313  * The validity is defined by the presence of the name of the data member in the underlying map.
1314  *
1315  * \param pd pointer to data member
1316  * \return true if valid; else false
1317  */
1318  template<class T>
1319  inline bool is_valid(T JHead::*pd) const
1320  {
1321  return (this->pull(pd) != this->end());
1322  }
1323 
1324 
1325  /**
1326  * Check validity of given data member in JHead.
1327  *
1328  * The validity is defined by difference between actual and default value.
1329  *
1330  * \param object object
1331  * \return true if valid; else false
1332  */
1333  template<class T>
1334  static bool is_valid(const T& object)
1335  {
1336  static const T value;
1337 
1338  return (object.less(value) || value.less(object));
1339  }
1340 
1341 
1342  /**
1343  * Pull given data member from Head.
1344  *
1345  * \param pd pointer to data member
1346  * \return iterator of Head
1347  */
1348  template<class T>
1349  inline const_iterator pull(T JHead::*pd) const
1350  {
1351  return this->find(JROOT::getDataMember(pd)->GetName());
1352  }
1353 
1354 
1355  /**
1356  * Pull given data member from Head.
1357  *
1358  * \param pd pointer to data member
1359  * \return iterator of Head
1360  */
1361  template<class T>
1362  inline iterator pull(T JHead::*pd)
1363  {
1364  return this->find(JROOT::getDataMember(pd)->GetName());
1365  }
1366 
1367 
1368  /**
1369  * Push given data member to Head.
1370  *
1371  * \param pd pointer to data member
1372  */
1373  template<class T>
1374  inline void push(T JHead::*pd)
1375  {
1376  (*this)[JROOT::getDataMember(pd)->GetName()] = "";
1377  }
1378 
1379 
1380  /**
1381  * Push all data members to Head.
1382  */
1383  void push();
1384 
1385 
1386  /**
1387  * Reset and remove given data member from Head.
1388  *
1389  * \param pd pointer to data member
1390  */
1391  template<class T>
1392  inline void erase(T JHead::*pd)
1393  {
1394  this->*pd = T();
1395 
1396  iterator p = this->pull(pd);
1397 
1398  if (p != this->end()) {
1399  static_cast<Head*>(this)->erase(p);
1400  }
1401  }
1402 
1403 
1404  /**
1405  * Get matching fields.
1406  *
1407  * \param header header
1408  * \return header with matching fields
1409  */
1410  inline JHead getMatch(const JHead& header) const
1411  {
1412 #define IF_MATCH(A, B, C, D) \
1413  if (match(B,C,D)) { A.push(D); } \
1414  else { A.erase(D); }
1415 
1416  JHead buffer(*this);
1417 
1418  buffer.clear();
1419 
1420  buffer.createUUID();
1421 
1422  IF_MATCH(buffer, *this, header, &JHead::cut_primary);
1423  IF_MATCH(buffer, *this, header, &JHead::cut_seamuon);
1424  IF_MATCH(buffer, *this, header, &JHead::cut_in);
1425  IF_MATCH(buffer, *this, header, &JHead::cut_nu);
1426  IF_MATCH(buffer, *this, header, &JHead::simul);
1427  IF_MATCH(buffer, *this, header, &JHead::physics);
1428  IF_MATCH(buffer, *this, header, &JHead::spectrum);
1429  IF_MATCH(buffer, *this, header, &JHead::can);
1430  IF_MATCH(buffer, *this, header, &JHead::fixedcan);
1431  IF_MATCH(buffer, *this, header, &JHead::genvol);
1432  IF_MATCH(buffer, *this, header, &JHead::coord_origin);
1433 
1434  IF_MATCH(buffer, *this, header, &JHead::norma);
1435  IF_MATCH(buffer, *this, header, &JHead::livetime);
1436 
1437  IF_MATCH(buffer, *this, header, &JHead::seabottom);
1438  IF_MATCH(buffer, *this, header, &JHead::depth);
1439  IF_MATCH(buffer, *this, header, &JHead::tgen);
1440  //IF_MATCH(buffer, *this, header, &JHead::time_interval);
1441 
1442  IF_MATCH(buffer, *this, header, &JHead::primary);
1443  IF_MATCH(buffer, *this, header, &JHead::flux);
1444  IF_MATCH(buffer, *this, header, &JHead::DAQ);
1445  IF_MATCH(buffer, *this, header, &JHead::K40);
1446  IF_MATCH(buffer, *this, header, &JHead::target);
1447 
1448  return buffer;
1449 
1450 #undef IF_MATCH
1451  }
1452 
1453 
1454  /**
1455  * Get number of matching fields.
1456  *
1457  * \param header header
1458  * \return number of matching header fields
1459  */
1460  inline size_t getNumberOfMatches(const JHead& header) const
1461  {
1462  const JHead head = getMatch(header);
1463 
1464  return head.size();
1465  }
1466 
1467 
1468  /**
1469  * Test match of headers.
1470  *
1471  * \param header second header
1472  * \return true if all header fields match; else false
1473  */
1474  inline bool match(const JHead& header) const
1475  {
1476  return getNumberOfMatches(header) == getNumberOfMatches(*this);
1477  }
1478 
1479 
1480  /**
1481  * Comparison of headers.
1482  *
1483  * \param header header
1484  * \return true if this header less than given header; else false
1485  */
1486  inline bool less(const JHead& header) const
1487  {
1488 #define RETURN_IF_DIFFERENT(A, B) \
1489  if (less(A,B)) { return true; } \
1490  if (less(B,A)) { return false; }
1491 
1492  // compare physics
1493 
1494  RETURN_IF_DIFFERENT(this->physics, header.physics);
1495 
1496  // compare simulation
1497 
1498  RETURN_IF_DIFFERENT(this->simul, header.simul);
1499 
1500  // compare generation data
1501 
1502  RETURN_IF_DIFFERENT(this->primary, header.primary);
1503  RETURN_IF_DIFFERENT(this->flux, header.flux);
1504  RETURN_IF_DIFFERENT(this->spectrum, header.spectrum);
1507  RETURN_IF_DIFFERENT(this->cut_in, header.cut_in);
1508  RETURN_IF_DIFFERENT(this->cut_nu, header.cut_nu);
1509  RETURN_IF_DIFFERENT(this->genvol, header.genvol);
1510  RETURN_IF_DIFFERENT(this->target, header.target);
1511 
1512  // compare compatibility
1513 
1514  if (is_valid(this->livetime) == is_valid(header.livetime) &&
1515  is_valid(this->DAQ) == is_valid(header.DAQ) &&
1516  is_valid(this->K40) == is_valid(header.K40)) {
1517  return false;
1518  }
1519 
1520  THROW(JException, "JHead::less() headers do not compare.");
1521 
1522 #undef RETURN_IF_DIFFERENT
1523  }
1524 
1525 
1526  /**
1527  * Addition of headers.
1528  *
1529  * \param header header
1530  * \return this header
1531  */
1532  inline JHead& add(const JHead& header)
1533  {
1534  if (match(header)) {
1535 
1536  this->createUUID();
1537  this->UUID = JUUID::rndm();
1538 
1539  genvol .add(header.genvol);
1540  norma .add(header.norma);
1541  livetime.add(header.livetime);
1542  DAQ .add(header.DAQ);
1543  K40 .add(header.K40);
1544 
1545  } else {
1546 
1547  THROW(JException, "JHead::add() headers do not match.");
1548  }
1549 
1550  return *this;
1551  }
1552 
1553 
1554  /**
1555  * Equal operator.
1556  *
1557  * Note that this operator uses the JHead::match method.
1558  *
1559  * \param first first header
1560  * \param second second header
1561  * \return true if two headers are equal; else false
1562  */
1563  friend inline bool operator==(const JHead& first,
1564  const JHead& second)
1565  {
1566  return first.match(second);
1567  }
1568 
1569 
1570  /**
1571  * Less than operator.
1572  *
1573  * \param first first header
1574  * \param second second header
1575  * \return true if first header is less than second header; else false
1576  */
1577  friend inline bool operator<(const JHead& first,
1578  const JHead& second)
1579  {
1580  return first.less(second);
1581  }
1582 
1583  JAANET::start_run start_run; // first data member
1584  JUUID UUID; // header unique identifier
1613  JAANET::end_event end_event; // last data member
1614 
1615 
1616  /**
1617  * Get maximum number of matching header fields.
1618  *
1619  * \return maximum number of matching header fields
1620  */
1621  static inline const size_t getMaximumNumberOfMatches()
1622  {
1623  static JHead header;
1624 
1625  header.push();
1626 
1627  static const size_t value = header.getNumberOfMatches(header);
1628 
1629  return value;
1630  }
1631 
1632 
1633  /**
1634  * Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
1635  * <pre>
1636  * <key>: <value> [<value>]*
1637  * <key>: <value> [<value>]*
1638  * </pre>
1639  *
1640  * \return equation parameters
1641  */
1643  {
1644  static JLANG::JEquationParameters parameters(":", "\n", "", "");
1645 
1646  return parameters;
1647  }
1648 
1649 
1650  /**
1651  * Set equation parameters.
1652  *
1653  * \param equation equation parameters
1654  */
1655  static inline void setEquationParameters(const JLANG::JEquationParameters& equation)
1656  {
1657  getEquationParameters() = equation;
1658  }
1659 
1660 
1661  /**
1662  * Read header from input.
1663  *
1664  * \param in input stream
1665  * \return input stream
1666  */
1667  std::istream& read(std::istream& in);
1668 
1669 
1670  /**
1671  * Write header to output.
1672  *
1673  * \param out output stream
1674  * \return output stream
1675  */
1676  std::ostream& write(std::ostream& out) const;
1677 
1678 
1679  /**
1680  * Print header to output.
1681  *
1682  * \param out output stream
1683  * \return output stream
1684  */
1685  std::ostream& print(std::ostream& out) const;
1686 
1687 
1689 
1690  private:
1691  /**
1692  * Comparison.
1693  *
1694  * \param first first object
1695  * \param second second object
1696  * \return true if first less than second; else false
1697  */
1698  template<class T>
1699  static inline bool less(const T& first,
1700  const T& second)
1701  {
1702  return first.less(second);
1703  }
1704 
1705 
1706  /**
1707  * Test match.
1708  *
1709  * \param first first object
1710  * \param second second object
1711  * \return true if matches; else false
1712  */
1713  template<class T>
1714  static inline bool match(const T& first,
1715  const T& second)
1716  {
1717  return first.match(second);
1718  }
1719 
1720 
1721  /**
1722  * Comparison of containers.
1723  * It is assumed that the containers are ordered in the same way.
1724  *
1725  * \param first first object
1726  * \param second second object
1727  * \return true if first is less than second; else false
1728  */
1729  template<class T>
1730  static inline bool less(const std::vector<T>& first,
1731  const std::vector<T>& second)
1732  {
1733  if (first.size() == second.size()) {
1734 
1735  for (size_t i = 0; i != first.size(); ++i) {
1736  if (less(first[i], second[i])) {
1737  return true;
1738  }
1739  }
1740 
1741  return false;
1742 
1743  } else {
1744 
1745  return first.size() < second.size();
1746  }
1747  }
1748 
1749 
1750  /**
1751  * Test is containers match.
1752  * It is assumed that the containers are ordered in the same way.
1753  *
1754  * \param first first object
1755  * \param second second object
1756  * \return true if matches; else false
1757  */
1758  template<class T>
1759  static inline bool match(const std::vector<T>& first,
1760  const std::vector<T>& second)
1761  {
1762  for (size_t i = 0; i != first.size() && i != second.size(); ++i) {
1763  if (!match(first[i], second[i])) {
1764  return false;
1765  }
1766  }
1767 
1768  return first.size() == second.size();
1769  }
1770 
1771 
1772  /**
1773  * Test match of given data member of headers.
1774  *
1775  * \param first first header
1776  * \param second second header
1777  * \param pd pointer to data member
1778  * \return true if matches; else false
1779  */
1780  template<class T>
1781  static inline bool match(const JHead& first,
1782  const JHead& second,
1783  T JHead::*pd)
1784  {
1785  return (first .is_valid(pd) &&
1786  second.is_valid(pd) &&
1787  match(first.*pd, second.*pd));
1788  }
1789  };
1790 
1791 
1792  /**
1793  * Equal operator.
1794  *
1795  * Note that this operator uses the JHead::match method.
1796  *
1797  * \param first first header
1798  * \param second second header
1799  * \return true if two headers are equal; else false
1800  */
1801  inline bool operator==(const Head& first,
1802  const Head& second)
1803  {
1804  return JHead(first).match(JHead(second));
1805  }
1806 
1807 
1808  /**
1809  * Less than operator.
1810  *
1811  * Note that this operator uses the JHead::less method.
1812  *
1813  * \param first first header
1814  * \param second second header
1815  * \return true if first header is less than second header; else false
1816  */
1817  inline bool operator<(const Head& first,
1818  const Head& second)
1819  {
1820  return JHead(first).less(JHead(second));
1821  }
1822 }
1823 
1824 
1825 /**
1826  * Read header from input.
1827  *
1828  * \param in input stream
1829  * \param header header
1830  * \return input stream
1831  */
1832 inline std::istream& operator>>(std::istream& in, JAANET::JHead& header)
1833 {
1834  return header.read(in);
1835 }
1836 
1837 
1838 /**
1839  * Write header to output.
1840  *
1841  * \param out output stream
1842  * \param header header
1843  * \return output stream
1844  */
1845 inline std::ostream& operator<<(std::ostream& out, const JAANET::JHead& header)
1846 {
1847  return header.write(out);
1848 }
1849 #endif
Exceptions.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
#define RETURN_IF_DIFFERENT(A, B)
#define IF_MATCH(A, B, C, D)
Auxiliary class to define a range between two values.
Monte Carlo run header.
Definition: JHead.hh:1236
JHead & add(const JHead &header)
Addition of headers.
Definition: JHead.hh:1532
JAANET::spectrum spectrum
Definition: JHead.hh:1597
std::vector< JAANET::simul > simul
Definition: JHead.hh:1591
JAANET::seabottom seabottom
Definition: JHead.hh:1605
std::istream & read(std::istream &in)
Read header from input.
Definition: JHead.cc:53
JHead(const Head &header)
Copy constructor.
Definition: JHead.hh:1252
virtual ~JHead()
Virtual destructor.
Definition: JHead.hh:1261
JAANET::start_run start_run
Definition: JHead.hh:1583
JAANET::coord_origin coord_origin
Definition: JHead.hh:1601
friend bool operator<(const JHead &first, const JHead &second)
Less than operator.
Definition: JHead.hh:1577
static bool is_valid(const T &object)
Check validity of given data member in JHead.
Definition: JHead.hh:1334
JAANET::norma norma
Definition: JHead.hh:1603
JAANET::cut_in cut_in
Definition: JHead.hh:1595
const JHead & getHeader() const
Get header.
Definition: JHead.hh:1270
JAANET::livetime livetime
Definition: JHead.hh:1604
JAANET::cut_nu cut_nu
Definition: JHead.hh:1596
std::ostream & write(std::ostream &out) const
Write header to output.
Definition: JHead.cc:91
JHead()
Default constructor.
Definition: JHead.hh:1241
static bool match(const JHead &first, const JHead &second, T JHead::*pd)
Test match of given data member of headers.
Definition: JHead.hh:1781
JAANET::primary primary
Definition: JHead.hh:1611
JAANET::DAQ DAQ
Definition: JHead.hh:1607
void push(T JHead::*pd)
Push given data member to Head.
Definition: JHead.hh:1374
void createUUID()
Create UUID if not already set.
Definition: JHead.hh:1301
JAANET::tgen tgen
Definition: JHead.hh:1609
static bool less(const T &first, const T &second)
Comparison.
Definition: JHead.hh:1699
bool less(const JHead &header) const
Comparison of headers.
Definition: JHead.hh:1486
JAANET::drawing drawing
Definition: JHead.hh:1586
const_iterator pull(T JHead::*pd) const
Pull given data member from Head.
Definition: JHead.hh:1349
static bool less(const std::vector< T > &first, const std::vector< T > &second)
Comparison of containers.
Definition: JHead.hh:1730
static bool match(const T &first, const T &second)
Test match.
Definition: JHead.hh:1714
static void setEquationParameters(const JLANG::JEquationParameters &equation)
Set equation parameters.
Definition: JHead.hh:1655
JAANET::genhencut genhencut
Definition: JHead.hh:1602
JAANET::genvol genvol
Definition: JHead.hh:1600
JAANET::depth depth
Definition: JHead.hh:1606
static JLANG::JEquationParameters & getEquationParameters()
Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
Definition: JHead.hh:1642
std::vector< JAANET::flux > flux
Definition: JHead.hh:1612
std::vector< JAANET::detector > detector
Definition: JHead.hh:1587
JHead & getHeader()
Get header.
Definition: JHead.hh:1281
JAANET::target target
Definition: JHead.hh:1589
JAANET::cut_seamuon cut_seamuon
Definition: JHead.hh:1594
JAANET::can can
Definition: JHead.hh:1598
JAANET::fixedcan fixedcan
Definition: JHead.hh:1599
JAANET::XSecFile XSecFile
Definition: JHead.hh:1585
JHead getMatch(const JHead &header) const
Get matching fields.
Definition: JHead.hh:1410
JUUID UUID
Definition: JHead.hh:1584
void setHeader(const JHead &header)
Set header.
Definition: JHead.hh:1292
friend bool operator==(const JHead &first, const JHead &second)
Equal operator.
Definition: JHead.hh:1563
JAANET::K40 K40
Definition: JHead.hh:1608
iterator pull(T JHead::*pd)
Pull given data member from Head.
Definition: JHead.hh:1362
JAANET::calibration calibration
Definition: JHead.hh:1592
static const size_t getMaximumNumberOfMatches()
Get maximum number of matching header fields.
Definition: JHead.hh:1621
JAANET::end_event end_event
Definition: JHead.hh:1613
JAANET::time_interval time_interval
Definition: JHead.hh:1610
ClassDef(JHead, 5)
bool is_valid(T JHead::*pd) const
Check validity of given data member in JHead.
Definition: JHead.hh:1319
size_t getNumberOfMatches(const JHead &header) const
Get number of matching fields.
Definition: JHead.hh:1460
static bool match(const std::vector< T > &first, const std::vector< T > &second)
Test is containers match.
Definition: JHead.hh:1759
std::vector< JAANET::physics > physics
Definition: JHead.hh:1590
void erase(T JHead::*pd)
Reset and remove given data member from Head.
Definition: JHead.hh:1392
JAANET::cut_primary cut_primary
Definition: JHead.hh:1593
bool match(const JHead &header) const
Test match of headers.
Definition: JHead.hh:1474
JAANET::muon_desc_file muon_desc_file
Definition: JHead.hh:1588
Simple data structure to support I/O of equations (see class JLANG::JEquation).
General exception.
Definition: JException.hh:24
Range of values.
Definition: JRange.hh:42
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
Definition: io_ascii.hh:155
Extensions to Evt data format.
bool operator==(const Head &first, const Head &second)
Equal operator.
Definition: JHead.hh:1801
static const char AANET_TAG_SEPARATOR
Separator for tag extension of multiple tags in Head ("_<counter>").
Definition: JHead.hh:65
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
std::string getTag(const std::string &tag, const int counter)
Get tag with aanet extension "_<counter>" for identical tags.
Definition: JHead.hh:122
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition: JHead.hh:1817
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.
bool is_integer(const std::string &buffer)
Check if string is an integer.
Definition: JLangToolkit.hh:58
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
Definition: JMathToolkit.hh:87
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Definition: JRootClass.hh:650
bool is_valid(const json &js)
Check validity of JSon data.
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
data_type r[M+1]
Definition: JPolint.hh:868
Definition: JSTDTypes.hh:14
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
Livetime of DAQ data.
Definition: JHead.hh:1008
double livetime_s
Live time [s].
Definition: JHead.hh:1053
DAQ & add(const DAQ &object)
Addition.
Definition: JHead.hh:1046
DAQ()
Default constructor.
Definition: JHead.hh:1013
bool less(const DAQ &object) const
Comparison.
Definition: JHead.hh:1023
ClassDefNV(DAQ, 1)
bool match(const DAQ &object) const
Test match.
Definition: JHead.hh:1034
Type definition of range.
Definition: JHead.hh:43
JRange_t(double x, double y)
Constructor.
Definition: JHead.hh:58
JRange_t()
Default constructor.
Definition: JHead.hh:47
Livetime of noise data.
Definition: JHead.hh:1062
K40 & add(const K40 &object)
Addition.
Definition: JHead.hh:1100
ClassDefNV(K40, 1)
bool less(const K40 &object) const
Comparison.
Definition: JHead.hh:1077
double livetime_s
Live time [s].
Definition: JHead.hh:1107
K40()
Default constructor.
Definition: JHead.hh:1067
bool match(const K40 &object) const
Test match.
Definition: JHead.hh:1088
General purpose string class.
Definition: JHead.hh:152
bool match(const String &object) const
Test match.
Definition: JHead.hh:166
std::string buffer
General purpose name.
Definition: JHead.hh:217
friend std::istream & operator>>(std::istream &in, String &object)
Read string from input stream.
Definition: JHead.hh:200
bool less(const String &object) const
Comparison.
Definition: JHead.hh:177
ClassDefNV(String, 1)
String()
Default constructor.
Definition: JHead.hh:156
friend std::ostream & operator<<(std::ostream &out, const String &object)
Write string to output stream.
Definition: JHead.hh:212
Neutrino cross section file.
Definition: JHead.hh:310
ClassDefNV(XSecFile, 1)
Calibration.
Definition: JHead.hh:330
ClassDefNV(calibration, 1)
static const std::string dynamical()
Definition: JHead.hh:332
static const std::string statical()
Definition: JHead.hh:331
The cylinder used for photon tracking.
Definition: JHead.hh:575
bool match(const can &object) const
Test match.
Definition: JHead.hh:591
ClassDefNV(can, 1)
double zmin
Bottom [m].
Definition: JHead.hh:598
double zmax
Top [m].
Definition: JHead.hh:599
can()
Default constructor.
Definition: JHead.hh:579
double r
Radius [m].
Definition: JHead.hh:600
Coordinate origin.
Definition: JHead.hh:732
coord_origin()
Default constructor.
Definition: JHead.hh:736
coord_origin(const double x, const double y, const double z)
Constructor.
Definition: JHead.hh:747
bool match(const coord_origin &object) const
Test match.
Definition: JHead.hh:759
ClassDefNV(coord_origin, 1)
Phase space of incoming particle.
Definition: JHead.hh:451
ClassDefNV(cut_in, 1)
Phase space of incident neutrino.
Definition: JHead.hh:461
ClassDefNV(cut_nu, 1)
Phase space of primary particle.
Definition: JHead.hh:431
ClassDefNV(cut_primary, 1)
Phase space of atmospheric muon generation.
Definition: JHead.hh:441
ClassDefNV(cut_seamuon, 1)
General purpose class of phase space generation.
Definition: JHead.hh:341
cut(const double Emin, const double Emax, const double cosTmin, const double cosTmax)
Constructor.
Definition: JHead.hh:370
JRange_t cosT
Cosine zenith angle range
Definition: JHead.hh:420
ClassDefNV(cut, 1)
bool less(const cut &object) const
Comparison.
Definition: JHead.hh:384
cut()
Default constructor.
Definition: JHead.hh:345
cut(const JRange_t &_E, const JRange_t &_cosT)
Constructor.
Definition: JHead.hh:356
bool match(const cut &object) const
Test match.
Definition: JHead.hh:413
JRange_t E
Energy range [GeV].
Definition: JHead.hh:419
Depth.
Definition: JHead.hh:980
depth()
Default constructor.
Definition: JHead.hh:984
bool match(const depth &object) const
Test match.
Definition: JHead.hh:994
ClassDefNV(depth, 1)
double z
Sea bottom [m].
Definition: JHead.hh:999
Detector file.
Definition: JHead.hh:227
detector()
Default constructor.
Definition: JHead.hh:231
friend std::istream & operator>>(std::istream &in, detector &object)
Read detector from input stream.
Definition: JHead.hh:252
std::string program
Definition: JHead.hh:278
std::string filename
Definition: JHead.hh:279
friend std::ostream & operator<<(std::ostream &out, const detector &object)
Write detector to output stream.
Definition: JHead.hh:273
ClassDefNV(detector, 1)
bool match(const detector &object) const
Test match.
Definition: JHead.hh:240
Drawing.
Definition: JHead.hh:320
ClassDefNV(drawing, 1)
End of event record.
Definition: JHead.hh:1213
ClassDefNV(end_event, 1)
end_event()
Default constructor.
Definition: JHead.hh:1217
The fixed cylinder used for photon tracking.
Definition: JHead.hh:609
double zmax
Top [m].
Definition: JHead.hh:639
double radius
Radius [m].
Definition: JHead.hh:640
ClassDefNV(fixedcan, 1)
bool match(const fixedcan &object) const
Test match.
Definition: JHead.hh:627
double zmin
Bottom [m].
Definition: JHead.hh:638
double ycenter
y-center [m]
Definition: JHead.hh:637
double xcenter
x-center [m]
Definition: JHead.hh:636
fixedcan()
Default constructor.
Definition: JHead.hh:613
Neutrino flux.
Definition: JHead.hh:906
int type
Type.
Definition: JHead.hh:940
bool less(const flux &object) const
Comparison.
Definition: JHead.hh:924
ClassDefNV(flux, 1)
flux()
Default constructor.
Definition: JHead.hh:911
std::string key
Key.
Definition: JHead.hh:941
std::string file_2
File name.
Definition: JHead.hh:943
std::string file_1
File name.
Definition: JHead.hh:942
bool match(const flux &object) const
Test match.
Definition: JHead.hh:935
Description of Monte Carlo event generation applications.
Definition: JHead.hh:469
bool less(const generator &object) const
Comparison.
Definition: JHead.hh:486
std::string time
processing time
Definition: JHead.hh:507
std::string date
processing date
Definition: JHead.hh:506
bool match(const generator &object) const
Test match.
Definition: JHead.hh:499
std::string program
program name
Definition: JHead.hh:504
generator()
Default constructor.
Definition: JHead.hh:473
ClassDefNV(generator, 1)
std::string version
program version
Definition: JHead.hh:505
Phase space for incident neutrino.
Definition: JHead.hh:773
genhencut()
Default constructor.
Definition: JHead.hh:777
double gDir
Angle.
Definition: JHead.hh:782
double Emin
Minimal energy [GeV].
Definition: JHead.hh:783
ClassDefNV(genhencut, 1)
Neutrino vertex volume.
Definition: JHead.hh:649
double numberOfEvents
Number of events.
Definition: JHead.hh:721
ClassDefNV(genvol, 1)
double zmax
Top [m].
Definition: JHead.hh:718
genvol()
Default constructor.
Definition: JHead.hh:653
genvol & mul(const double factor, const double z=0.0)
Scale.
Definition: JHead.hh:706
bool less(const genvol &object) const
Comparison.
Definition: JHead.hh:667
genvol & add(const genvol &object)
Addition.
Definition: JHead.hh:692
double volume
Volume [m^3].
Definition: JHead.hh:720
double zmin
Bottom [m].
Definition: JHead.hh:717
bool match(const genvol &object) const
Test match.
Definition: JHead.hh:678
double r
Radius [m].
Definition: JHead.hh:719
Normalisation of MUPAGE events.
Definition: JHead.hh:835
bool less(const livetime &object) const
Comparison.
Definition: JHead.hh:850
livetime()
Default constructor.
Definition: JHead.hh:839
double numberOfSeconds
Live time [s].
Definition: JHead.hh:896
double errorOfSeconds
Uncertainty on live time [s].
Definition: JHead.hh:897
livetime & add(const livetime &object)
Addition.
Definition: JHead.hh:873
livetime & mul(const double factor)
Scale.
Definition: JHead.hh:888
ClassDefNV(livetime, 1)
bool match(const livetime &object) const
Test match.
Definition: JHead.hh:861
Muon descriptor file.
Definition: JHead.hh:290
ClassDefNV(muon_desc_file, 1)
Normlisation of CORSIKA events.
Definition: JHead.hh:792
double numberOfPrimaries
Number of primaries.
Definition: JHead.hh:826
double primaryFlux
Primary flux.
Definition: JHead.hh:825
norma()
Default constructor.
Definition: JHead.hh:796
norma & add(const norma &object)
Addition.
Definition: JHead.hh:818
ClassDefNV(norma, 1)
bool match(const norma &object) const
Test match.
Definition: JHead.hh:807
Physics information.
Definition: JHead.hh:518
ClassDefNV(physics, 1)
Primary particle.
Definition: JHead.hh:1174
ClassDefNV(primary, 1)
bool match(const primary &object) const
Test match.
Definition: JHead.hh:1199
bool less(const primary &object) const
Comparison.
Definition: JHead.hh:1188
int type
Particle type.
Definition: JHead.hh:1204
primary()
Default constructor.
Definition: JHead.hh:1178
The bottom of the sea.
Definition: JHead.hh:952
bool match(const seabottom &object) const
Test match.
Definition: JHead.hh:966
double z
Sea bottom [m].
Definition: JHead.hh:971
ClassDefNV(seabottom, 1)
seabottom()
Default constructor.
Definition: JHead.hh:956
Generator for simulation.
Definition: JHead.hh:528
ClassDefNV(simul, 1)
Neutrino energy spectrum.
Definition: JHead.hh:536
spectrum()
Default constructor.
Definition: JHead.hh:540
bool less(const spectrum &object) const
Comparison.
Definition: JHead.hh:550
bool match(const spectrum &object) const
Test match.
Definition: JHead.hh:561
ClassDefNV(spectrum, 1)
double alpha
Energy spectrum: .
Definition: JHead.hh:566
Start of run record.
Definition: JHead.hh:135
ClassDefNV(start_run, 1)
int run_id
MC run number.
Definition: JHead.hh:143
start_run()
Default constructor.
Definition: JHead.hh:139
Target.
Definition: JHead.hh:300
ClassDefNV(target, 1)
Time duration of event generation.
Definition: JHead.hh:1116
tgen()
Default constructor.
Definition: JHead.hh:1120
bool match(const tgen &object) const
Test match.
Definition: JHead.hh:1130
ClassDefNV(tgen, 1)
double numberOfSeconds
Time in seconds.
Definition: JHead.hh:1135
UTC time interval for event generation.
Definition: JHead.hh:1144
time_interval()
Default constructor.
Definition: JHead.hh:1148
bool match(const time_interval &object) const
Test match.
Definition: JHead.hh:1159
ClassDefNV(time_interval, 1)
double t1
Start time in seconds.
Definition: JHead.hh:1164
double t2
Stop time in seconds.
Definition: JHead.hh:1165
Simple wrapper for UUID.
Definition: JUUID.hh:24
static const JUUID & rndm()
Generate random UUID.
Definition: JUUID.hh:78
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:13