Jpp  17.3.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
219  ClassDefNV(String,1);
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 
280 
281  ClassDefNV(detector,1);
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  {
301  ClassDefNV(target,1);
302  };
303 
304 
305  /**
306  * Neutrino cross section file.
307  */
308  struct XSecFile :
309  public String
310  {
311  ClassDefNV(XSecFile,1);
312  };
313 
314 
315  /**
316  * Drawing.
317  */
318  struct drawing :
319  public String
320  {
321  ClassDefNV(drawing,1);
322  };
323 
324 
325  /**
326  * General purpose class of phase space generation.
327  */
328  struct cut {
329  /**
330  * Default constructor.
331  */
332  cut() :
333  E (0.0, 0.0),
334  cosT(0.0, 0.0)
335  {}
336 
337  /**
338  * Constructor.
339  *
340  * \param _E energy range
341  * \param _cosT cosine zenith angle range
342  */
343  cut(const JRange_t& _E,
344  const JRange_t& _cosT) :
345  E (_E),
346  cosT(_cosT)
347  {}
348 
349  /**
350  * Constructor.
351  *
352  * \param Emin energy range lower bound
353  * \param Emax energy range upper bound
354  * \param cosTmin cosine zenith angle lower bound
355  * \param cosTmax cosine zenith angle upper bound
356  */
357  cut(const double Emin,
358  const double Emax,
359  const double cosTmin,
360  const double cosTmax) :
361  E (Emin, Emax),
362  cosT(cosTmin, cosTmax)
363  {}
364 
365  /**
366  * Comparison.
367  *
368  * \param object cut
369  * \return true if this cut less than given cut; else false
370  */
371  inline bool less(const cut& object) const
372  {
373  if (E.getLowerLimit() == object.E.getLowerLimit()) {
374 
375  if (E.getUpperLimit() == object.E.getUpperLimit()) {
376 
377  if (cosT.getLowerLimit() == object.cosT.getLowerLimit()) {
378  return cosT.getUpperLimit() < object.cosT.getUpperLimit();
379  } else {
380  return cosT.getLowerLimit() < object.cosT.getLowerLimit();
381  }
382 
383  } else {
384 
385  return E.getUpperLimit() < object.E.getUpperLimit();
386  }
387 
388  } else {
389 
390  return E.getLowerLimit() < object.E.getLowerLimit();
391  }
392  }
393 
394  /**
395  * Test match.
396  *
397  * \param object cut
398  * \return true if matches; else false
399  */
400  inline bool match(const cut& object) const
401  {
402  return (E .equals(object.E) &&
403  cosT.equals(object.cosT));
404  }
405 
406  JRange_t E; ///< Energy range [GeV]
407  JRange_t cosT; ///< Cosine zenith angle range
408 
409  ClassDefNV(cut,1);
410  };
411 
412 
413  /**
414  * Phase space of primary particle.
415  */
416  struct cut_primary :
417  public cut
418  {
420  };
421 
422 
423  /**
424  * Phase space of atmospheric muon generation.
425  */
426  struct cut_seamuon :
427  public cut
428  {
430  };
431 
432 
433  /**
434  * Phase space of incoming particle
435  */
436  struct cut_in :
437  public cut
438  {
439  ClassDefNV(cut_in,1);
440  };
441 
442 
443  /**
444  * Phase space of incident neutrino.
445  */
446  struct cut_nu :
447  public cut
448  {
449  ClassDefNV(cut_nu,1);
450  };
451 
452 
453  /**
454  * Description of Monte Carlo event generation applications.
455  */
456  struct generator {
457  /**
458  * Default constructor.
459  */
461  program(),
462  version(),
463  date(),
464  time()
465  {}
466 
467  /**
468  * Comparison.
469  *
470  * \param object generator
471  * \return true if this primary particle is less than given primary particle; else false
472  */
473  inline bool less(const generator& object) const
474  {
475  return program < object.program;
476  }
477 
478  /**
479  * Test match.
480  *
481  * Note that only the name of program is matched.
482  *
483  * \param object generator
484  * \return true if matches; else false
485  */
486  inline bool match(const generator& object) const
487  {
488  return program == object.program;
489  }
490 
491  std::string program; ///< program name
492  std::string version; ///< program version
493  std::string date; ///< processing date
494  std::string time; ///< processing time
495 
497  };
498 
499 
500  /**
501  * Physics information.
502  */
503  struct physics :
504  public String
505  {
506  ClassDefNV(physics,1);
507  };
508 
509 
510  /**
511  * Generator for simulation.
512  */
513  struct simul :
514  public generator
515  {
516  ClassDefNV(simul,1);
517  };
518 
519 
520  /**
521  * Neutrino energy spectrum.
522  */
523  struct spectrum {
524  /**
525  * Default constructor.
526  */
527  spectrum() :
528  alpha(0)
529  {}
530 
531  /**
532  * Comparison.
533  *
534  * \param object spectrum
535  * \return true if this spectrum less than given spectrum; else false
536  */
537  inline bool less(const spectrum& object) const
538  {
539  return alpha < object.alpha;
540  }
541 
542  /**
543  * Test match.
544  *
545  * \param object spectrum
546  * \return true if matches; else false
547  */
548  inline bool match(const spectrum& object) const
549  {
550  return (alpha == object.alpha);
551  }
552 
553  double alpha; ///< Energy spectrum: \f$ \Phi \propto E^{-\alpha} \f$
554 
555  ClassDefNV(spectrum,1);
556  };
557 
558 
559  /**
560  * The cylinder used for photon tracking.
561  */
562  struct can {
563  /**
564  * Default constructor.
565  */
566  can() :
567  zmin(0),
568  zmax(0),
569  r(0)
570  {}
571 
572  /**
573  * Test match.
574  *
575  * \param object can
576  * \return true if matches; else false
577  */
578  inline bool match(const can& object) const
579  {
580  return (zmin == object.zmin &&
581  zmax == object.zmax &&
582  r == object.r);
583  }
584 
585  double zmin; ///< Bottom [m]
586  double zmax; ///< Top [m]
587  double r; ///< Radius [m]
588 
589  ClassDefNV(can,1);
590  };
591 
592 
593  /**
594  * The fixed cylinder used for photon tracking.
595  */
596  struct fixedcan {
597  /**
598  * Default constructor.
599  */
601  xcenter(0),
602  ycenter(0),
603  zmin(0),
604  zmax(0),
605  radius(0)
606  {}
607 
608  /**
609  * Test match.
610  *
611  * \param object can
612  * \return true if matches; else false
613  */
614  inline bool match(const fixedcan& object) const
615  {
616  return (xcenter == object.xcenter &&
617  ycenter == object.ycenter &&
618  zmin == object.zmin &&
619  zmax == object.zmax &&
620  radius == object.radius);
621  }
622 
623  double xcenter; ///< x-center [m]
624  double ycenter; ///< y-center [m]
625  double zmin; ///< Bottom [m]
626  double zmax; ///< Top [m]
627  double radius; ///< Radius [m]
628 
629  ClassDefNV(fixedcan,1);
630  };
631 
632 
633  /**
634  * Neutrino vertex volume.
635  */
636  struct genvol {
637  /**
638  * Default constructor.
639  */
640  genvol() :
641  zmin(0),
642  zmax(0),
643  r(0),
644  volume(0),
645  numberOfEvents(0)
646  {}
647 
648  /**
649  * Comparison.
650  *
651  * \param object genvol
652  * \return true if this genvol less than given genvol; else false
653  */
654  inline bool less(const genvol& object) const
655  {
656  return volume < object.volume;
657  }
658 
659  /**
660  * Test match.
661  *
662  * \param object generation volume
663  * \return true if matches; else false
664  */
665  inline bool match(const genvol& object) const
666  {
667  return (zmin == object.zmin &&
668  zmax == object.zmax &&
669  r == object.r &&
670  volume == object.volume);
671  }
672 
673  /**
674  * Addition.
675  *
676  * \param object generation volume
677  * \return this generation volume
678  */
679  inline genvol& add(const genvol& object)
680  {
681  numberOfEvents += object.numberOfEvents;
682 
683  return *this;
684  }
685 
686  /**
687  * Scale.
688  *
689  * \param factor 1D scale factor
690  * \param z z position
691  * \return this genvol
692  */
693  inline genvol& mul(const double factor,
694  const double z = 0.0)
695  {
696  zmin = (zmin - z) * factor + z;
697  zmax = (zmax - z) * factor + z;
698  r *= factor;
699  volume *= factor * factor * factor;
700 
701  return *this;
702  }
703 
704  double zmin; ///< Bottom [m]
705  double zmax; ///< Top [m]
706  double r; ///< Radius [m]
707  double volume; ///< Volume [m^3]
708  double numberOfEvents; ///< Number of events
709 
710  ClassDefNV(genvol,1);
711  };
712 
713 
714  /**
715  * Coordinate origin.
716  */
717  struct coord_origin :
718  public Vec
719  {
720  /**
721  * Default constructor.
722  */
724  Vec()
725  {}
726 
727  /**
728  * Constructor.
729  *
730  * \param x x position
731  * \param y y position
732  * \param z z position
733  */
734  coord_origin(const double x,
735  const double y,
736  const double z) :
737  Vec(x,y,z)
738  {}
739 
740  /**
741  * Test match.
742  *
743  * \param object coordinate origin
744  * \return true if matches; else false
745  */
746  inline bool match(const coord_origin& object) const
747  {
748  return (x == object.x &&
749  y == object.y &&
750  z == object.z);
751  }
752 
754  };
755 
756 
757  /**
758  * Phase space for incident neutrino.
759  */
760  struct genhencut {
761  /**
762  * Default constructor.
763  */
765  gDir(0),
766  Emin(0)
767  {}
768 
769  double gDir; ///< Angle
770  double Emin; ///< Minimal energy [GeV]
771 
773  };
774 
775 
776  /**
777  * Normlisation of CORSIKA events.
778  */
779  struct norma {
780  /**
781  * Default constructor.
782  */
783  norma() :
784  primaryFlux(0),
785  numberOfPrimaries(0)
786  {}
787 
788  /**
789  * Test match.
790  *
791  * \param object normalisation
792  * \return true if matches; else false
793  */
794  inline bool match(const norma& object) const
795  {
796  return (primaryFlux == object.primaryFlux);
797  }
798 
799  /**
800  * Addition.
801  *
802  * \param object normalisation
803  * \return this normalisation
804  */
805  inline norma& add(const norma& object)
806  {
807  numberOfPrimaries += object.numberOfPrimaries;
808 
809  return *this;
810  }
811 
812  double primaryFlux; ///< Primary flux
813  double numberOfPrimaries; ///< Number of primaries
814 
815  ClassDefNV(norma,1);
816  };
817 
818 
819  /**
820  * Normalisation of MUPAGE events.
821  */
822  struct livetime {
823  /**
824  * Default constructor.
825  */
827  numberOfSeconds(0),
828  errorOfSeconds(0)
829  {}
830 
831  /**
832  * Comparison.
833  *
834  * \param object livetime
835  * \return true if this livetime is less than given livetime; else false
836  */
837  inline bool less(const livetime& object) const
838  {
839  return numberOfSeconds < object.numberOfSeconds;
840  }
841 
842  /**
843  * Test match.
844  *
845  * \param object live time
846  * \return true if matches; else false
847  */
848  inline bool match(const livetime& object) const
849  {
850  return ((numberOfSeconds == 0.0 && object.numberOfSeconds == 0.0) ||
851  (numberOfSeconds > 0.0 && object.numberOfSeconds > 0.0));
852  }
853 
854  /**
855  * Addition.
856  *
857  * \param object live time
858  * \return this live time
859  */
860  inline livetime& add(const livetime& object)
861  {
862  numberOfSeconds += object.numberOfSeconds;
863  errorOfSeconds = sqrt(errorOfSeconds * errorOfSeconds +
864  object.errorOfSeconds * object.errorOfSeconds);
865 
866  return *this;
867  }
868 
869  /**
870  * Scale.
871  *
872  * \param factor 1D scale factor
873  * \return this livetime
874  */
875  inline livetime& mul(const double factor)
876  {
877  numberOfSeconds /= (factor * factor);
878  errorOfSeconds /= (factor * factor);
879 
880  return *this;
881  }
882 
883  double numberOfSeconds; ///< Live time [s]
884  double errorOfSeconds; ///< Uncertainty on live time [s]
885 
886  ClassDefNV(livetime,1);
887  };
888 
889 
890  /**
891  * Neutrino flux.
892  */
893  struct flux {
894  public:
895  /**
896  * Default constructor.
897  */
898  flux() :
899  type(0),
900  key(),
901  file_1(),
902  file_2()
903  {}
904 
905  /**
906  * Comparison.
907  *
908  * \param object flux
909  * \return true if this flux is less than given flux; else false
910  */
911  inline bool less(const flux& object) const
912  {
913  return type < object.type;
914  }
915 
916  /**
917  * Test match.
918  *
919  * \param object flux
920  * \return true if matches; else false
921  */
922  inline bool match(const flux& object) const
923  {
924  return type == object.type;
925  }
926 
927  int type; ///< Type
928  std::string key; ///< Key
929  std::string file_1; ///< File name
930  std::string file_2; ///< File name
931 
932  ClassDefNV(flux,1);
933  };
934 
935 
936  /**
937  * The bottom of the sea.
938  */
939  struct seabottom {
940  /**
941  * Default constructor.
942  */
944  z(0)
945  {}
946 
947  /**
948  * Test match.
949  *
950  * \param object sea bottom
951  * \return true if matches; else false
952  */
953  inline bool match(const seabottom& object) const
954  {
955  return (z == object.z);
956  }
957 
958  double z; ///< Sea bottom [m]
959 
961  };
962 
963 
964  /**
965  * Depth.
966  */
967  struct depth {
968  /**
969  * Default constructor.
970  */
971  depth() :
972  z(0)
973  {}
974 
975  /**
976  * Test match.
977  *
978  * \param object sea bottom
979  * \return true if matches; else false
980  */
981  inline bool match(const depth& object) const
982  {
983  return (z == object.z);
984  }
985 
986  double z; ///< Sea bottom [m]
987 
988  ClassDefNV(depth,1);
989  };
990 
991 
992  /**
993  * Livetime of DAQ data.
994  */
995  struct DAQ {
996  public:
997  /**
998  * Default constructor.
999  */
1000  DAQ() :
1001  livetime_s(0.0)
1002  {}
1003 
1004  /**
1005  * Comparison.
1006  *
1007  * \param object DAQ
1008  * \return true if this DAQ is less than given DAQ; else false
1009  */
1010  inline bool less(const DAQ& object) const
1011  {
1012  return livetime_s < object.livetime_s;
1013  }
1014 
1015  /**
1016  * Test match.
1017  *
1018  * \param object DAQ
1019  * \return true if matches; else false
1020  */
1021  inline bool match(const DAQ& object) const
1022  {
1023  return ((livetime_s == 0.0 && object.livetime_s == 0.0) ||
1024  (livetime_s > 0.0 && object.livetime_s > 0.0));
1025  }
1026 
1027  /**
1028  * Addition.
1029  *
1030  * \param object DAQ
1031  * \return this DAQ
1032  */
1033  inline DAQ& add(const DAQ& object)
1034  {
1035  livetime_s += object.livetime_s;
1036 
1037  return *this;
1038  }
1039 
1040  double livetime_s; ///< Live time [s]
1041 
1042  ClassDefNV(DAQ,1);
1043  };
1044 
1045 
1046  /**
1047  * Time duration of event generation.
1048  */
1049  struct tgen {
1050  /**
1051  * Default constructor.
1052  */
1053  tgen() :
1054  numberOfSeconds(0)
1055  {}
1056 
1057  /**
1058  * Test match.
1059  *
1060  * \param object time duration
1061  * \return true if matches; else false
1062  */
1063  inline bool match(const tgen& object) const
1064  {
1065  return this->numberOfSeconds == object.numberOfSeconds;
1066  }
1067 
1068  double numberOfSeconds; ///< Time in seconds
1069 
1070  ClassDefNV(tgen,1);
1071  };
1072 
1073 
1074  /**
1075  * UTC time interval for event generation.
1076  */
1077  struct time_interval {
1078  /**
1079  * Default constructor.
1080  */
1082  t1(0),
1083  t2(0)
1084  {}
1085 
1086  /**
1087  * Test match.
1088  *
1089  * \param object time interval
1090  * \return true if matches; else false
1091  */
1092  inline bool match(const time_interval& object) const
1093  {
1094  return (this->t1 == object.t1 && this->t2 == object.t2);
1095  }
1096 
1097  double t1; ///< Start time in seconds
1098  double t2; ///< Stop time in seconds
1099 
1101  };
1102 
1103 
1104  /**
1105  * Primary particle.
1106  */
1107  struct primary {
1108  /**
1109  * Default constructor.
1110  */
1111  primary() :
1112  type(0)
1113  {}
1114 
1115  /**
1116  * Comparison.
1117  *
1118  * \param object primary particle
1119  * \return true if this primary particle is less than given primary particle; else false
1120  */
1121  inline bool less(const primary& object) const
1122  {
1123  return type < object.type;
1124  }
1125 
1126  /**
1127  * Test match.
1128  *
1129  * \param object primary particle
1130  * \return true if matches; else false
1131  */
1132  inline bool match(const primary& object) const
1133  {
1134  return (type == object.type);
1135  }
1136 
1137  int type; ///< Particle type
1138 
1139  ClassDefNV(primary,1);
1140  };
1141 
1142 
1143  /**
1144  * End of event record.
1145  */
1146  struct end_event {
1147  /**
1148  * Default constructor.
1149  */
1151  {}
1152 
1153  ClassDefNV(end_event,1);
1154  };
1155 
1156 
1157  /**
1158  * Monte Carlo run header.
1159  *
1160  * This class extends the Head class so that the data from specific tags
1161  * can be promoted to concrete data types.
1162  *
1163  * Note that for the copy of new JHead data (e.g.\ data not obtained via a previous JAANET::copy) to become effective,
1164  * the key words in the corresponding map of the Head class should be set. \n
1165  * To this end, member method JHead::push can be used.
1166  */
1167  struct JHead :
1168  public Head
1169  {
1170  /**
1171  * Default constructor.
1172  */
1174  {
1175  createUUID();
1176  }
1177 
1178 
1179  /**
1180  * Copy constructor.
1181  *
1182  * \param header header
1183  */
1184  JHead(const Head& header)
1185  {
1186  copy(header, *this);
1187  }
1188 
1189 
1190  /**
1191  * Virtual destructor.
1192  */
1193  virtual ~JHead()
1194  {}
1195 
1196 
1197  /**
1198  * Get header.
1199  *
1200  * \return header
1201  */
1202  const JHead& getHeader() const
1203  {
1204  return static_cast<const JHead&>(*this);
1205  }
1206 
1207 
1208  /**
1209  * Get header.
1210  *
1211  * \return header
1212  */
1214  {
1215  return static_cast<JHead&>(*this);
1216  }
1217 
1218 
1219  /**
1220  * Set header.
1221  *
1222  * \param header header
1223  */
1224  void setHeader(const JHead& header)
1225  {
1226  static_cast<JHead&>(*this) = header;
1227  }
1228 
1229 
1230  /**
1231  * Create UUID if not already set.
1232  */
1233  void createUUID()
1234  {
1235  if (!is_valid(&JHead::UUID)) {
1236  this->UUID = JUUID::rndm();
1237  this->push(&JHead::UUID);
1238  }
1239  }
1240 
1241 
1242  /**
1243  * Check validity of given data member in JHead.
1244  *
1245  * The validity is defined by the presence of the name of the data member in the underlying map.
1246  *
1247  * \param pd pointer to data member
1248  * \return true if valid; else false
1249  */
1250  template<class T>
1251  inline bool is_valid(T JHead::*pd) const
1252  {
1253  return (this->pull(pd) != this->end());
1254  }
1255 
1256 
1257  /**
1258  * Check validity of given data member in JHead.
1259  *
1260  * The validity is defined by difference between actual and default value.
1261  *
1262  * \param object object
1263  * \return true if valid; else false
1264  */
1265  template<class T>
1266  static bool is_valid(const T& object)
1267  {
1268  static const T value;
1269 
1270  return (object.less(value) || value.less(object));
1271  }
1272 
1273 
1274  /**
1275  * Pull given data member from Head.
1276  *
1277  * \param pd pointer to data member
1278  * \return iterator of Head
1279  */
1280  template<class T>
1281  inline const_iterator pull(T JHead::*pd) const
1282  {
1283  return this->find(JROOT::getDataMember(pd)->GetName());
1284  }
1285 
1286 
1287  /**
1288  * Pull given data member from Head.
1289  *
1290  * \param pd pointer to data member
1291  * \return iterator of Head
1292  */
1293  template<class T>
1294  inline iterator pull(T JHead::*pd)
1295  {
1296  return this->find(JROOT::getDataMember(pd)->GetName());
1297  }
1298 
1299 
1300  /**
1301  * Push given data member to Head.
1302  *
1303  * \param pd pointer to data member
1304  */
1305  template<class T>
1306  inline void push(T JHead::*pd)
1307  {
1308  (*this)[JROOT::getDataMember(pd)->GetName()] = "";
1309  }
1310 
1311 
1312  /**
1313  * Push all data members to Head.
1314  */
1315  void push();
1316 
1317 
1318  /**
1319  * Reset and remove given data member from Head.
1320  *
1321  * \param pd pointer to data member
1322  */
1323  template<class T>
1324  inline void erase(T JHead::*pd)
1325  {
1326  this->*pd = T();
1327 
1328  iterator p = this->pull(pd);
1329 
1330  if (p != this->end()) {
1331  static_cast<Head*>(this)->erase(p);
1332  }
1333  }
1334 
1335 
1336  /**
1337  * Get matching fields.
1338  *
1339  * \param header header
1340  * \return header with matching fields
1341  */
1342  inline JHead getMatch(const JHead& header) const
1343  {
1344 #define IF_MATCH(A, B, C, D) \
1345  if (match(B,C,D)) { A.push(D); } \
1346  else { A.erase(D); }
1347 
1348  JHead buffer(*this);
1349 
1350  buffer.clear();
1351 
1352  buffer.createUUID();
1353 
1354  IF_MATCH(buffer, *this, header, &JHead::cut_primary);
1355  IF_MATCH(buffer, *this, header, &JHead::cut_seamuon);
1356  IF_MATCH(buffer, *this, header, &JHead::cut_in);
1357  IF_MATCH(buffer, *this, header, &JHead::cut_nu);
1358  IF_MATCH(buffer, *this, header, &JHead::simul);
1359  IF_MATCH(buffer, *this, header, &JHead::spectrum);
1360  IF_MATCH(buffer, *this, header, &JHead::can);
1361  IF_MATCH(buffer, *this, header, &JHead::fixedcan);
1362  IF_MATCH(buffer, *this, header, &JHead::genvol);
1363  IF_MATCH(buffer, *this, header, &JHead::coord_origin);
1364 
1365  IF_MATCH(buffer, *this, header, &JHead::norma);
1366  IF_MATCH(buffer, *this, header, &JHead::livetime);
1367 
1368  IF_MATCH(buffer, *this, header, &JHead::seabottom);
1369  IF_MATCH(buffer, *this, header, &JHead::depth);
1370  IF_MATCH(buffer, *this, header, &JHead::tgen);
1371  IF_MATCH(buffer, *this, header, &JHead::time_interval);
1372 
1373  IF_MATCH(buffer, *this, header, &JHead::primary);
1374  IF_MATCH(buffer, *this, header, &JHead::flux);
1375  IF_MATCH(buffer, *this, header, &JHead::DAQ);
1376 
1377  return buffer;
1378 
1379 #undef IF_MATCH
1380  }
1381 
1382 
1383  /**
1384  * Get number of matching fields.
1385  *
1386  * \param header header
1387  * \return number of matching header fields
1388  */
1389  inline size_t getNumberOfMatches(const JHead& header) const
1390  {
1391  const JHead head = getMatch(header);
1392 
1393  return head.size();
1394  }
1395 
1396 
1397  /**
1398  * Test match of headers.
1399  *
1400  * \param header second header
1401  * \return true if all header fields match; else false
1402  */
1403  inline bool match(const JHead& header) const
1404  {
1405  return getNumberOfMatches(header) == getNumberOfMatches(*this);
1406  }
1407 
1408 
1409  /**
1410  * Comparison of headers.
1411  *
1412  * \param header header
1413  * \return true if this header less than given header; else false
1414  */
1415  inline bool less(const JHead& header) const
1416  {
1417 #define RETURN_IF_DIFFERENT(A, B) \
1418  if (less(A,B)) { return true; } \
1419  if (less(B,A)) { return false; }
1420 
1421  // compare physics
1422 
1423  RETURN_IF_DIFFERENT(this->physics, header.physics);
1424 
1425  // compare simulation
1426 
1427  RETURN_IF_DIFFERENT(this->simul, header.simul);
1428 
1429  // compare generation data
1430 
1431  RETURN_IF_DIFFERENT(this->primary, header.primary);
1432  RETURN_IF_DIFFERENT(this->flux, header.flux);
1433  RETURN_IF_DIFFERENT(this->spectrum, header.spectrum);
1436  RETURN_IF_DIFFERENT(this->cut_in, header.cut_in);
1437  RETURN_IF_DIFFERENT(this->cut_nu, header.cut_nu);
1438  RETURN_IF_DIFFERENT(this->genvol, header.genvol);
1439 
1440  // compare compatibility
1441 
1442  if (is_valid(this->livetime) == is_valid(header.livetime) &&
1443  is_valid(this->DAQ) == is_valid(header.DAQ)) {
1444  return false;
1445  }
1446 
1447  THROW(JException, "JHead::less() headers do not compare.");
1448 
1449 #undef RETURN_IF_DIFFERENT
1450  }
1451 
1452 
1453  /**
1454  * Addition of headers.
1455  *
1456  * \param header header
1457  * \return this header
1458  */
1459  inline JHead& add(const JHead& header)
1460  {
1461  if (match(header)) {
1462 
1463  this->createUUID();
1464  this->UUID = JUUID::rndm();
1465 
1466  genvol .add(header.genvol);
1467  norma .add(header.norma);
1468  livetime.add(header.livetime);
1469  DAQ .add(header.DAQ);
1470 
1471  } else {
1472 
1473  THROW(JException, "JHead::add() headers do not match.");
1474  }
1475 
1476  return *this;
1477  }
1478 
1479 
1480  /**
1481  * Equal operator.
1482  *
1483  * Note that this operator uses the JHead::match method.
1484  *
1485  * \param first first header
1486  * \param second second header
1487  * \return true if two headers are equal; else false
1488  */
1489  friend inline bool operator==(const JHead& first,
1490  const JHead& second)
1491  {
1492  return first.match(second);
1493  }
1494 
1495 
1496  /**
1497  * Less than operator.
1498  *
1499  * \param first first header
1500  * \param second second header
1501  * \return true if first header is less than second header; else false
1502  */
1503  friend inline bool operator<(const JHead& first,
1504  const JHead& second)
1505  {
1506  return first.less(second);
1507  }
1508 
1509  JAANET::start_run start_run; // first data member
1510  JUUID UUID; // header unique identifier
1537  JAANET::end_event end_event; // last data member
1538 
1539 
1540  /**
1541  * Get maximum number of matching header fields.
1542  *
1543  * \return maximum number of matching header fields
1544  */
1545  static inline const size_t getMaximumNumberOfMatches()
1546  {
1547  static JHead header;
1548 
1549  header.push();
1550 
1551  static const size_t value = header.getNumberOfMatches(header);
1552 
1553  return value;
1554  }
1555 
1556 
1557  /**
1558  * Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
1559  * <pre>
1560  * <key>: <value> [<value>]*
1561  * <key>: <value> [<value>]*
1562  * </pre>
1563  *
1564  * \return equation parameters
1565  */
1567  {
1568  static JLANG::JEquationParameters parameters(":", "\n", "", "");
1569 
1570  return parameters;
1571  }
1572 
1573 
1574  /**
1575  * Set equation parameters.
1576  *
1577  * \param equation equation parameters
1578  */
1579  static inline void setEquationParameters(const JLANG::JEquationParameters& equation)
1580  {
1581  getEquationParameters() = equation;
1582  }
1583 
1584 
1585  /**
1586  * Read header from input.
1587  *
1588  * \param in input stream
1589  * \return input stream
1590  */
1591  std::istream& read(std::istream& in);
1592 
1593 
1594  /**
1595  * Write header to output.
1596  *
1597  * \param out output stream
1598  * \return output stream
1599  */
1600  std::ostream& write(std::ostream& out) const;
1601 
1602 
1603  /**
1604  * Print header to output.
1605  *
1606  * \param out output stream
1607  * \return output stream
1608  */
1609  std::ostream& print(std::ostream& out) const;
1610 
1611 
1612  ClassDef(JHead,4);
1613 
1614  private:
1615  /**
1616  * Comparison.
1617  *
1618  * \param first first object
1619  * \param second second object
1620  * \return true if first less than second; else false
1621  */
1622  template<class T>
1623  static inline bool less(const T& first,
1624  const T& second)
1625  {
1626  return first.less(second);
1627  }
1628 
1629 
1630  /**
1631  * Test match.
1632  *
1633  * \param first first object
1634  * \param second second object
1635  * \return true if matches; else false
1636  */
1637  template<class T>
1638  static inline bool match(const T& first,
1639  const T& second)
1640  {
1641  return first.match(second);
1642  }
1643 
1644 
1645  /**
1646  * Comparison of containers.
1647  * It is assumed that the containers are ordered in the same way.
1648  *
1649  * \param first first object
1650  * \param second second object
1651  * \return true if first is less than second; else false
1652  */
1653  template<class T>
1654  static inline bool less(const std::vector<T>& first,
1655  const std::vector<T>& second)
1656  {
1657  if (first.size() == second.size()) {
1658 
1659  for (size_t i = 0; i != first.size(); ++i) {
1660  if (less(first[i], second[i])) {
1661  return true;
1662  }
1663  }
1664 
1665  return false;
1666 
1667  } else {
1668 
1669  return first.size() < second.size();
1670  }
1671  }
1672 
1673 
1674  /**
1675  * Test is containers match.
1676  * It is assumed that the containers are ordered in the same way.
1677  *
1678  * \param first first object
1679  * \param second second object
1680  * \return true if matches; else false
1681  */
1682  template<class T>
1683  static inline bool match(const std::vector<T>& first,
1684  const std::vector<T>& second)
1685  {
1686  for (size_t i = 0; i != first.size() && i != second.size(); ++i) {
1687  if (!match(first[i], second[i])) {
1688  return false;
1689  }
1690  }
1691 
1692  return first.size() == second.size();
1693  }
1694 
1695 
1696  /**
1697  * Test match of given data member of headers.
1698  *
1699  * \param first first header
1700  * \param second second header
1701  * \param pd pointer to data member
1702  * \return true if matches; else false
1703  */
1704  template<class T>
1705  static inline bool match(const JHead& first,
1706  const JHead& second,
1707  T JHead::*pd)
1708  {
1709  return (first .is_valid(pd) &&
1710  second.is_valid(pd) &&
1711  match(first.*pd, second.*pd));
1712  }
1713  };
1714 
1715 
1716  /**
1717  * Equal operator.
1718  *
1719  * Note that this operator uses the JHead::match method.
1720  *
1721  * \param first first header
1722  * \param second second header
1723  * \return true if two headers are equal; else false
1724  */
1725  inline bool operator==(const Head& first,
1726  const Head& second)
1727  {
1728  return JHead(first).match(JHead(second));
1729  }
1730 
1731 
1732  /**
1733  * Less than operator.
1734  *
1735  * Note that this operator uses the JHead::less method.
1736  *
1737  * \param first first header
1738  * \param second second header
1739  * \return true if first header is less than second header; else false
1740  */
1741  inline bool operator<(const Head& first,
1742  const Head& second)
1743  {
1744  return JHead(first).less(JHead(second));
1745  }
1746 }
1747 
1748 
1749 /**
1750  * Read header from input.
1751  *
1752  * \param in input stream
1753  * \param header header
1754  * \return input stream
1755  */
1756 inline std::istream& operator>>(std::istream& in, JAANET::JHead& header)
1757 {
1758  return header.read(in);
1759 }
1760 
1761 
1762 /**
1763  * Write header to output.
1764  *
1765  * \param out output stream
1766  * \param header header
1767  * \return output stream
1768  */
1769 inline std::ostream& operator<<(std::ostream& out, const JAANET::JHead& header)
1770 {
1771  return header.write(out);
1772 }
1773 #endif
norma & add(const norma &object)
Addition.
Definition: JHead.hh:805
bool match(const cut &object) const
Test match.
Definition: JHead.hh:400
bool match(const detector &object) const
Test match.
Definition: JHead.hh:240
double zmin
Bottom [m].
Definition: JHead.hh:585
JAANET::depth depth
Definition: JHead.hh:1531
JAANET::genhencut genhencut
Definition: JHead.hh:1527
static const size_t getMaximumNumberOfMatches()
Get maximum number of matching header fields.
Definition: JHead.hh:1545
General exception.
Definition: JException.hh:23
Phase space of incident neutrino.
Definition: JHead.hh:446
Drawing.
Definition: JHead.hh:318
static bool is_valid(const T &object)
Check validity of given data member in JHead.
Definition: JHead.hh:1266
JHead getMatch(const JHead &header) const
Get matching fields.
Definition: JHead.hh:1342
livetime & mul(const double factor)
Scale.
Definition: JHead.hh:875
JAANET::genvol genvol
Definition: JHead.hh:1525
Neutrino vertex volume.
Definition: JHead.hh:636
Exceptions.
bool less(const String &object) const
Comparison.
Definition: JHead.hh:177
double r
Radius [m].
Definition: JHead.hh:706
JAANET::norma norma
Definition: JHead.hh:1528
std::vector< JAANET::flux > flux
Definition: JHead.hh:1536
JRange()
Default constructor.
Definition: JRange.hh:54
Target.
Definition: JHead.hh:298
genvol & mul(const double factor, const double z=0.0)
Scale.
Definition: JHead.hh:693
double volume
Volume [m^3].
Definition: JHead.hh:707
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then usage E
Definition: JMuonPostfit.sh:35
Livetime of DAQ data.
Definition: JHead.hh:995
double t1
Start time in seconds.
Definition: JHead.hh:1097
bool match(const tgen &object) const
Test match.
Definition: JHead.hh:1063
seabottom()
Default constructor.
Definition: JHead.hh:943
livetime & add(const livetime &object)
Addition.
Definition: JHead.hh:860
friend bool operator<(const JHead &first, const JHead &second)
Less than operator.
Definition: JHead.hh:1503
Depth.
Definition: JHead.hh:967
version
Definition: JEditTuneHV.sh:5
bool less(const DAQ &object) const
Comparison.
Definition: JHead.hh:1010
void setHeader(const JHead &header)
Set header.
Definition: JHead.hh:1224
friend std::istream & operator>>(std::istream &in, String &object)
Read string from input stream.
Definition: JHead.hh:200
#define RETURN_IF_DIFFERENT(A, B)
const JHead & getHeader() const
Get header.
Definition: JHead.hh:1202
Phase space of incoming particle.
Definition: JHead.hh:436
Generator for simulation.
Definition: JHead.hh:513
bool operator<(const Head &first, const Head &second)
Less than operator.
Definition: JHead.hh:1741
double alpha
Energy spectrum: .
Definition: JHead.hh:553
const TDataMember * getDataMember(const JRootClass &parent, const JRootClass &member)
Get ROOT data member for given parent and member class.
Definition: JRootClass.hh:641
bool is_valid(const json &js)
Check validity of JSon data.
Phase space for incident neutrino.
Definition: JHead.hh:760
JAANET::drawing drawing
Definition: JHead.hh:1512
double numberOfEvents
Number of events.
Definition: JHead.hh:708
bool less(const generator &object) const
Comparison.
Definition: JHead.hh:473
static bool less(const T &first, const T &second)
Comparison.
Definition: JHead.hh:1623
friend std::istream & operator>>(std::istream &in, detector &object)
Read detector from input stream.
Definition: JHead.hh:252
std::string program
program name
Definition: JHead.hh:491
depth()
Default constructor.
Definition: JHead.hh:971
Neutrino cross section file.
Definition: JHead.hh:308
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
double t2
Stop time in seconds.
Definition: JHead.hh:1098
livetime()
Default constructor.
Definition: JHead.hh:826
double zmax
Top [m].
Definition: JHead.hh:626
Normlisation of CORSIKA events.
Definition: JHead.hh:779
JAANET::cut_primary cut_primary
Definition: JHead.hh:1518
double errorOfSeconds
Uncertainty on live time [s].
Definition: JHead.hh:884
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
std::vector< JAANET::physics > physics
Definition: JHead.hh:1516
Simple data structure to support I/O of equations (see class JLANG::JEquation).
bool match(const generator &object) const
Test match.
Definition: JHead.hh:486
JRange_t E
Energy range [GeV].
Definition: JHead.hh:406
static void setEquationParameters(const JLANG::JEquationParameters &equation)
Set equation parameters.
Definition: JHead.hh:1579
bool match(const time_interval &object) const
Test match.
Definition: JHead.hh:1092
bool match(const JHead &header) const
Test match of headers.
Definition: JHead.hh:1403
data_type r[M+1]
Definition: JPolint.hh:779
std::vector< JAANET::simul > simul
Definition: JHead.hh:1517
double livetime_s
Live time [s].
Definition: JHead.hh:1040
JHead & add(const JHead &header)
Addition of headers.
Definition: JHead.hh:1459
genhencut()
Default constructor.
Definition: JHead.hh:764
JRange_t()
Default constructor.
Definition: JHead.hh:47
General purpose class of phase space generation.
Definition: JHead.hh:328
bool match(const spectrum &object) const
Test match.
Definition: JHead.hh:548
void createUUID()
Create UUID if not already set.
Definition: JHead.hh:1233
DAQ & add(const DAQ &object)
Addition.
Definition: JHead.hh:1033
bool match(const can &object) const
Test match.
Definition: JHead.hh:578
Coordinate origin.
Definition: JHead.hh:717
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Physics information.
Definition: JHead.hh:503
Description of Monte Carlo event generation applications.
Definition: JHead.hh:456
double ycenter
y-center [m]
Definition: JHead.hh:624
Q JDAQEvent livetime_s
Definition: JDataQuality.sh:57
genvol & add(const genvol &object)
Addition.
Definition: JHead.hh:679
ClassDefNV(start_run, 1)
Start of run record.
Definition: JHead.hh:135
spectrum()
Default constructor.
Definition: JHead.hh:527
JAANET::end_event end_event
Definition: JHead.hh:1537
bool less(const JHead &header) const
Comparison of headers.
Definition: JHead.hh:1415
double zmax
Top [m].
Definition: JHead.hh:705
JAANET::fixedcan fixedcan
Definition: JHead.hh:1524
static const JUUID & rndm()
Generate random UUID.
Definition: JUUID.hh:67
JAANET::can can
Definition: JHead.hh:1523
std::string buffer
General purpose name.
Definition: JHead.hh:217
double xcenter
x-center [m]
Definition: JHead.hh:623
JRange_t(double x, double y)
Constructor.
Definition: JHead.hh:58
bool operator==(Packet const &p, ID const &id)
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
void push(T JHead::*pd)
Push given data member to Head.
Definition: JHead.hh:1306
Type definition of range.
Definition: JHead.hh:41
int type
Particle type.
Definition: JHead.hh:1137
bool match(const fixedcan &object) const
Test match.
Definition: JHead.hh:614
Detector file.
Definition: JHead.hh:226
JNET::JTag getTag(JLANG::JType< KM3NETDAQ::JDAQTimeslice >)
Definition: JDAQTags.hh:82
JUUID UUID
Definition: JHead.hh:1510
JAANET::cut_seamuon cut_seamuon
Definition: JHead.hh:1519
generator()
Default constructor.
Definition: JHead.hh:460
double numberOfPrimaries
Number of primaries.
Definition: JHead.hh:813
JAANET::livetime livetime
Definition: JHead.hh:1529
static JLANG::JEquationParameters & getEquationParameters()
Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
Definition: JHead.hh:1566
JHead()
Default constructor.
Definition: JHead.hh:1173
flux()
Default constructor.
Definition: JHead.hh:898
cut(const double Emin, const double Emax, const double cosTmin, const double cosTmax)
Constructor.
Definition: JHead.hh:357
std::istream & read(std::istream &in)
Read header from input.
Definition: JHead.cc:53
bool less(const primary &object) const
Comparison.
Definition: JHead.hh:1121
cut(const JRange_t &_E, const JRange_t &_cosT)
Constructor.
Definition: JHead.hh:343
void erase(T JHead::*pd)
Reset and remove given data member from Head.
Definition: JHead.hh:1324
JAANET::seabottom seabottom
Definition: JHead.hh:1530
bool less(const flux &object) const
Comparison.
Definition: JHead.hh:911
cut()
Default constructor.
Definition: JHead.hh:332
Neutrino flux.
Definition: JHead.hh:893
do set_variable OUTPUT_DIRECTORY $WORKDIR T
friend std::ostream & operator<<(std::ostream &out, const String &object)
Write string to output stream.
Definition: JHead.hh:212
JAANET::start_run start_run
Definition: JHead.hh:1509
bool match(const depth &object) const
Test match.
Definition: JHead.hh:981
ClassDefNV(String, 1)
friend bool operator==(const JHead &first, const JHead &second)
Equal operator.
Definition: JHead.hh:1489
then awk string
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
std::string version
program version
Definition: JHead.hh:492
Time duration of event generation.
Definition: JHead.hh:1049
JAANET::spectrum spectrum
Definition: JHead.hh:1522
std::string file_2
File name.
Definition: JHead.hh:930
bool match(const norma &object) const
Test match.
Definition: JHead.hh:794
time_interval()
Default constructor.
Definition: JHead.hh:1081
std::string key
Key.
Definition: JHead.hh:928
bool match(const flux &object) const
Test match.
Definition: JHead.hh:922
int type
Type.
Definition: JHead.hh:927
DAQ()
Default constructor.
Definition: JHead.hh:1000
bool is_integer(const std::string &buffer)
Check if string is an integer.
Definition: JLangToolkit.hh:58
JAANET::primary primary
Definition: JHead.hh:1535
double z
Sea bottom [m].
Definition: JHead.hh:986
JRange_t cosT
Cosine zenith angle range.
Definition: JHead.hh:407
double zmin
Bottom [m].
Definition: JHead.hh:625
print
Definition: JConvertDusj.sh:44
Range of values.
Definition: JRange.hh:38
bool match(const livetime &object) const
Test match.
Definition: JHead.hh:848
double zmin
Bottom [m].
Definition: JHead.hh:704
Monte Carlo run header.
Definition: JHead.hh:1167
genvol()
Default constructor.
Definition: JHead.hh:640
bool less(const spectrum &object) const
Comparison.
Definition: JHead.hh:537
int run_id
MC run number.
Definition: JHead.hh:143
double Emin
Minimal energy [GeV].
Definition: JHead.hh:770
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
can()
Default constructor.
Definition: JHead.hh:566
std::string filename
Definition: JHead.hh:279
JAANET::time_interval time_interval
Definition: JHead.hh:1534
size_t getNumberOfMatches(const JHead &header) const
Get number of matching fields.
Definition: JHead.hh:1389
static bool match(const std::vector< T > &first, const std::vector< T > &second)
Test is containers match.
Definition: JHead.hh:1683
JAANET::muon_desc_file muon_desc_file
Definition: JHead.hh:1514
#define ClassDef(name, version)
Definition: JRoot.hh:32
norma()
Default constructor.
Definition: JHead.hh:783
virtual ~JHead()
Virtual destructor.
Definition: JHead.hh:1193
std::string program
Definition: JHead.hh:278
bool match(const coord_origin &object) const
Test match.
Definition: JHead.hh:746
double r
Radius [m].
Definition: JHead.hh:587
coord_origin(const double x, const double y, const double z)
Constructor.
Definition: JHead.hh:734
bool match(const genvol &object) const
Test match.
Definition: JHead.hh:665
std::vector< JAANET::detector > detector
Definition: JHead.hh:1513
Normalisation of MUPAGE events.
Definition: JHead.hh:822
static bool match(const JHead &first, const JHead &second, T JHead::*pd)
Test match of given data member of headers.
Definition: JHead.hh:1705
bool less(const genvol &object) const
Comparison.
Definition: JHead.hh:654
bool match(const seabottom &object) const
Test match.
Definition: JHead.hh:953
detector()
Default constructor.
Definition: JHead.hh:231
Auxiliary class to define a range between two values.
iterator pull(T JHead::*pd)
Pull given data member from Head.
Definition: JHead.hh:1294
std::string date
processing date
Definition: JHead.hh:493
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
Definition: io_ascii.hh:155
primary()
Default constructor.
Definition: JHead.hh:1111
JAANET::tgen tgen
Definition: JHead.hh:1533
JAANET::cut_in cut_in
Definition: JHead.hh:1520
Simple wrapper for UUID.
Definition: JUUID.hh:22
JHead & getHeader()
Get header.
Definition: JHead.hh:1213
static bool less(const std::vector< T > &first, const std::vector< T > &second)
Comparison of containers.
Definition: JHead.hh:1654
bool less(const cut &object) const
Comparison.
Definition: JHead.hh:371
General purpose string class.
Definition: JHead.hh:152
start_run()
Default constructor.
Definition: JHead.hh:139
double gDir
Angle.
Definition: JHead.hh:769
double primaryFlux
Primary flux.
Definition: JHead.hh:812
double radius
Radius [m].
Definition: JHead.hh:627
bool match(const DAQ &object) const
Test match.
Definition: JHead.hh:1021
JAANET::target target
Definition: JHead.hh:1515
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
Primary particle.
Definition: JHead.hh:1107
Muon descriptor file.
Definition: JHead.hh:288
fixedcan()
Default constructor.
Definition: JHead.hh:600
The fixed cylinder used for photon tracking.
Definition: JHead.hh:596
static bool match(const T &first, const T &second)
Test match.
Definition: JHead.hh:1638
double z
Sea bottom [m].
Definition: JHead.hh:958
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
Definition: JMathToolkit.hh:86
#define IF_MATCH(A, B, C, D)
JAANET::cut_nu cut_nu
Definition: JHead.hh:1521
bool less(const livetime &object) const
Comparison.
Definition: JHead.hh:837
UTC time interval for event generation.
Definition: JHead.hh:1077
end_event()
Default constructor.
Definition: JHead.hh:1150
Phase space of atmospheric muon generation.
Definition: JHead.hh:426
double numberOfSeconds
Time in seconds.
Definition: JHead.hh:1068
std::string time
processing time
Definition: JHead.hh:494
tgen()
Default constructor.
Definition: JHead.hh:1053
End of event record.
Definition: JHead.hh:1146
Phase space of primary particle.
Definition: JHead.hh:416
JAANET::coord_origin coord_origin
Definition: JHead.hh:1526
static const char AANET_TAG_SEPARATOR
Separator for tag extension of multiple tags in Head (&quot;_&lt;counter&gt;&quot;).
Definition: JHead.hh:65
bool is_valid(T JHead::*pd) const
Check validity of given data member in JHead.
Definition: JHead.hh:1251
JAANET::XSecFile XSecFile
Definition: JHead.hh:1511
JAANET::DAQ DAQ
Definition: JHead.hh:1532
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
double numberOfSeconds
Live time [s].
Definition: JHead.hh:883
bool match(const primary &object) const
Test match.
Definition: JHead.hh:1132
Vec coord_origin() const
Get coordinate origin.
Definition: Head.hh:395
JHead(const Head &header)
Copy constructor.
Definition: JHead.hh:1184
friend std::ostream & operator<<(std::ostream &out, const detector &object)
Write detector to output stream.
Definition: JHead.hh:273
bool match(const String &object) const
Test match.
Definition: JHead.hh:166
Neutrino energy spectrum.
Definition: JHead.hh:523
The bottom of the sea.
Definition: JHead.hh:939
std::ostream & write(std::ostream &out) const
Write header to output.
Definition: JHead.cc:91
String()
Default constructor.
Definition: JHead.hh:156
double zmax
Top [m].
Definition: JHead.hh:586
const_iterator pull(T JHead::*pd) const
Pull given data member from Head.
Definition: JHead.hh:1281
The cylinder used for photon tracking.
Definition: JHead.hh:562
std::string file_1
File name.
Definition: JHead.hh:929
coord_origin()
Default constructor.
Definition: JHead.hh:723