Jpp  18.0.0
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  * Livetime of noise data.
1048  */
1049  struct K40 {
1050  public:
1051  /**
1052  * Default constructor.
1053  */
1054  K40() :
1055  livetime_s(0.0)
1056  {}
1057 
1058  /**
1059  * Comparison.
1060  *
1061  * \param object K40
1062  * \return true if this K40 is less than given K40; else false
1063  */
1064  inline bool less(const K40& object) const
1065  {
1066  return livetime_s < object.livetime_s;
1067  }
1068 
1069  /**
1070  * Test match.
1071  *
1072  * \param object K40
1073  * \return true if matches; else false
1074  */
1075  inline bool match(const K40& object) const
1076  {
1077  return ((livetime_s == 0.0 && object.livetime_s == 0.0) ||
1078  (livetime_s > 0.0 && object.livetime_s > 0.0));
1079  }
1080 
1081  /**
1082  * Addition.
1083  *
1084  * \param object K40
1085  * \return this K40
1086  */
1087  inline K40& add(const K40& object)
1088  {
1089  livetime_s += object.livetime_s;
1090 
1091  return *this;
1092  }
1093 
1094  double livetime_s; ///< Live time [s]
1095 
1096  ClassDefNV(K40,1);
1097  };
1098 
1099 
1100  /**
1101  * Time duration of event generation.
1102  */
1103  struct tgen {
1104  /**
1105  * Default constructor.
1106  */
1107  tgen() :
1108  numberOfSeconds(0)
1109  {}
1110 
1111  /**
1112  * Test match.
1113  *
1114  * \param object time duration
1115  * \return true if matches; else false
1116  */
1117  inline bool match(const tgen& object) const
1118  {
1119  return this->numberOfSeconds == object.numberOfSeconds;
1120  }
1121 
1122  double numberOfSeconds; ///< Time in seconds
1123 
1124  ClassDefNV(tgen,1);
1125  };
1126 
1127 
1128  /**
1129  * UTC time interval for event generation.
1130  */
1131  struct time_interval {
1132  /**
1133  * Default constructor.
1134  */
1136  t1(0),
1137  t2(0)
1138  {}
1139 
1140  /**
1141  * Test match.
1142  *
1143  * \param object time interval
1144  * \return true if matches; else false
1145  */
1146  inline bool match(const time_interval& object) const
1147  {
1148  return (this->t1 == object.t1 && this->t2 == object.t2);
1149  }
1150 
1151  double t1; ///< Start time in seconds
1152  double t2; ///< Stop time in seconds
1153 
1155  };
1156 
1157 
1158  /**
1159  * Primary particle.
1160  */
1161  struct primary {
1162  /**
1163  * Default constructor.
1164  */
1165  primary() :
1166  type(0)
1167  {}
1168 
1169  /**
1170  * Comparison.
1171  *
1172  * \param object primary particle
1173  * \return true if this primary particle is less than given primary particle; else false
1174  */
1175  inline bool less(const primary& object) const
1176  {
1177  return type < object.type;
1178  }
1179 
1180  /**
1181  * Test match.
1182  *
1183  * \param object primary particle
1184  * \return true if matches; else false
1185  */
1186  inline bool match(const primary& object) const
1187  {
1188  return (type == object.type);
1189  }
1190 
1191  int type; ///< Particle type
1192 
1193  ClassDefNV(primary,1);
1194  };
1195 
1196 
1197  /**
1198  * End of event record.
1199  */
1200  struct end_event {
1201  /**
1202  * Default constructor.
1203  */
1205  {}
1206 
1207  ClassDefNV(end_event,1);
1208  };
1209 
1210 
1211  /**
1212  * Monte Carlo run header.
1213  *
1214  * This class extends the Head class so that the data from specific tags
1215  * can be promoted to concrete data types.
1216  *
1217  * Note that for the copy of new JHead data (e.g.\ data not obtained via a previous JAANET::copy) to become effective,
1218  * the key words in the corresponding map of the Head class should be set. \n
1219  * To this end, member method JHead::push can be used.
1220  */
1221  struct JHead :
1222  public Head
1223  {
1224  /**
1225  * Default constructor.
1226  */
1228  {
1229  createUUID();
1230  }
1231 
1232 
1233  /**
1234  * Copy constructor.
1235  *
1236  * \param header header
1237  */
1238  JHead(const Head& header)
1239  {
1240  copy(header, *this);
1241  }
1242 
1243 
1244  /**
1245  * Virtual destructor.
1246  */
1247  virtual ~JHead()
1248  {}
1249 
1250 
1251  /**
1252  * Get header.
1253  *
1254  * \return header
1255  */
1256  const JHead& getHeader() const
1257  {
1258  return static_cast<const JHead&>(*this);
1259  }
1260 
1261 
1262  /**
1263  * Get header.
1264  *
1265  * \return header
1266  */
1268  {
1269  return static_cast<JHead&>(*this);
1270  }
1271 
1272 
1273  /**
1274  * Set header.
1275  *
1276  * \param header header
1277  */
1278  void setHeader(const JHead& header)
1279  {
1280  static_cast<JHead&>(*this) = header;
1281  }
1282 
1283 
1284  /**
1285  * Create UUID if not already set.
1286  */
1287  void createUUID()
1288  {
1289  if (!is_valid(&JHead::UUID)) {
1290  this->UUID = JUUID::rndm();
1291  this->push(&JHead::UUID);
1292  }
1293  }
1294 
1295 
1296  /**
1297  * Check validity of given data member in JHead.
1298  *
1299  * The validity is defined by the presence of the name of the data member in the underlying map.
1300  *
1301  * \param pd pointer to data member
1302  * \return true if valid; else false
1303  */
1304  template<class T>
1305  inline bool is_valid(T JHead::*pd) const
1306  {
1307  return (this->pull(pd) != this->end());
1308  }
1309 
1310 
1311  /**
1312  * Check validity of given data member in JHead.
1313  *
1314  * The validity is defined by difference between actual and default value.
1315  *
1316  * \param object object
1317  * \return true if valid; else false
1318  */
1319  template<class T>
1320  static bool is_valid(const T& object)
1321  {
1322  static const T value;
1323 
1324  return (object.less(value) || value.less(object));
1325  }
1326 
1327 
1328  /**
1329  * Pull given data member from Head.
1330  *
1331  * \param pd pointer to data member
1332  * \return iterator of Head
1333  */
1334  template<class T>
1335  inline const_iterator pull(T JHead::*pd) const
1336  {
1337  return this->find(JROOT::getDataMember(pd)->GetName());
1338  }
1339 
1340 
1341  /**
1342  * Pull given data member from Head.
1343  *
1344  * \param pd pointer to data member
1345  * \return iterator of Head
1346  */
1347  template<class T>
1348  inline iterator pull(T JHead::*pd)
1349  {
1350  return this->find(JROOT::getDataMember(pd)->GetName());
1351  }
1352 
1353 
1354  /**
1355  * Push given data member to Head.
1356  *
1357  * \param pd pointer to data member
1358  */
1359  template<class T>
1360  inline void push(T JHead::*pd)
1361  {
1362  (*this)[JROOT::getDataMember(pd)->GetName()] = "";
1363  }
1364 
1365 
1366  /**
1367  * Push all data members to Head.
1368  */
1369  void push();
1370 
1371 
1372  /**
1373  * Reset and remove given data member from Head.
1374  *
1375  * \param pd pointer to data member
1376  */
1377  template<class T>
1378  inline void erase(T JHead::*pd)
1379  {
1380  this->*pd = T();
1381 
1382  iterator p = this->pull(pd);
1383 
1384  if (p != this->end()) {
1385  static_cast<Head*>(this)->erase(p);
1386  }
1387  }
1388 
1389 
1390  /**
1391  * Get matching fields.
1392  *
1393  * \param header header
1394  * \return header with matching fields
1395  */
1396  inline JHead getMatch(const JHead& header) const
1397  {
1398 #define IF_MATCH(A, B, C, D) \
1399  if (match(B,C,D)) { A.push(D); } \
1400  else { A.erase(D); }
1401 
1402  JHead buffer(*this);
1403 
1404  buffer.clear();
1405 
1406  buffer.createUUID();
1407 
1408  IF_MATCH(buffer, *this, header, &JHead::cut_primary);
1409  IF_MATCH(buffer, *this, header, &JHead::cut_seamuon);
1410  IF_MATCH(buffer, *this, header, &JHead::cut_in);
1411  IF_MATCH(buffer, *this, header, &JHead::cut_nu);
1412  IF_MATCH(buffer, *this, header, &JHead::simul);
1413  IF_MATCH(buffer, *this, header, &JHead::spectrum);
1414  IF_MATCH(buffer, *this, header, &JHead::can);
1415  IF_MATCH(buffer, *this, header, &JHead::fixedcan);
1416  IF_MATCH(buffer, *this, header, &JHead::genvol);
1417  IF_MATCH(buffer, *this, header, &JHead::coord_origin);
1418 
1419  IF_MATCH(buffer, *this, header, &JHead::norma);
1420  IF_MATCH(buffer, *this, header, &JHead::livetime);
1421 
1422  IF_MATCH(buffer, *this, header, &JHead::seabottom);
1423  IF_MATCH(buffer, *this, header, &JHead::depth);
1424  IF_MATCH(buffer, *this, header, &JHead::tgen);
1425  IF_MATCH(buffer, *this, header, &JHead::time_interval);
1426 
1427  IF_MATCH(buffer, *this, header, &JHead::primary);
1428  IF_MATCH(buffer, *this, header, &JHead::flux);
1429  IF_MATCH(buffer, *this, header, &JHead::DAQ);
1430  IF_MATCH(buffer, *this, header, &JHead::K40);
1431 
1432  return buffer;
1433 
1434 #undef IF_MATCH
1435  }
1436 
1437 
1438  /**
1439  * Get number of matching fields.
1440  *
1441  * \param header header
1442  * \return number of matching header fields
1443  */
1444  inline size_t getNumberOfMatches(const JHead& header) const
1445  {
1446  const JHead head = getMatch(header);
1447 
1448  return head.size();
1449  }
1450 
1451 
1452  /**
1453  * Test match of headers.
1454  *
1455  * \param header second header
1456  * \return true if all header fields match; else false
1457  */
1458  inline bool match(const JHead& header) const
1459  {
1460  return getNumberOfMatches(header) == getNumberOfMatches(*this);
1461  }
1462 
1463 
1464  /**
1465  * Comparison of headers.
1466  *
1467  * \param header header
1468  * \return true if this header less than given header; else false
1469  */
1470  inline bool less(const JHead& header) const
1471  {
1472 #define RETURN_IF_DIFFERENT(A, B) \
1473  if (less(A,B)) { return true; } \
1474  if (less(B,A)) { return false; }
1475 
1476  // compare physics
1477 
1478  RETURN_IF_DIFFERENT(this->physics, header.physics);
1479 
1480  // compare simulation
1481 
1482  RETURN_IF_DIFFERENT(this->simul, header.simul);
1483 
1484  // compare generation data
1485 
1486  RETURN_IF_DIFFERENT(this->primary, header.primary);
1487  RETURN_IF_DIFFERENT(this->flux, header.flux);
1488  RETURN_IF_DIFFERENT(this->spectrum, header.spectrum);
1491  RETURN_IF_DIFFERENT(this->cut_in, header.cut_in);
1492  RETURN_IF_DIFFERENT(this->cut_nu, header.cut_nu);
1493  RETURN_IF_DIFFERENT(this->genvol, header.genvol);
1494 
1495  // compare compatibility
1496 
1497  if (is_valid(this->livetime) == is_valid(header.livetime) &&
1498  is_valid(this->DAQ) == is_valid(header.DAQ) &&
1499  is_valid(this->K40) == is_valid(header.K40)) {
1500  return false;
1501  }
1502 
1503  THROW(JException, "JHead::less() headers do not compare.");
1504 
1505 #undef RETURN_IF_DIFFERENT
1506  }
1507 
1508 
1509  /**
1510  * Addition of headers.
1511  *
1512  * \param header header
1513  * \return this header
1514  */
1515  inline JHead& add(const JHead& header)
1516  {
1517  if (match(header)) {
1518 
1519  this->createUUID();
1520  this->UUID = JUUID::rndm();
1521 
1522  genvol .add(header.genvol);
1523  norma .add(header.norma);
1524  livetime.add(header.livetime);
1525  DAQ .add(header.DAQ);
1526  K40 .add(header.K40);
1527 
1528  } else {
1529 
1530  THROW(JException, "JHead::add() headers do not match.");
1531  }
1532 
1533  return *this;
1534  }
1535 
1536 
1537  /**
1538  * Equal operator.
1539  *
1540  * Note that this operator uses the JHead::match method.
1541  *
1542  * \param first first header
1543  * \param second second header
1544  * \return true if two headers are equal; else false
1545  */
1546  friend inline bool operator==(const JHead& first,
1547  const JHead& second)
1548  {
1549  return first.match(second);
1550  }
1551 
1552 
1553  /**
1554  * Less than operator.
1555  *
1556  * \param first first header
1557  * \param second second header
1558  * \return true if first header is less than second header; else false
1559  */
1560  friend inline bool operator<(const JHead& first,
1561  const JHead& second)
1562  {
1563  return first.less(second);
1564  }
1565 
1566  JAANET::start_run start_run; // first data member
1567  JUUID UUID; // header unique identifier
1595  JAANET::end_event end_event; // last data member
1596 
1597 
1598  /**
1599  * Get maximum number of matching header fields.
1600  *
1601  * \return maximum number of matching header fields
1602  */
1603  static inline const size_t getMaximumNumberOfMatches()
1604  {
1605  static JHead header;
1606 
1607  header.push();
1608 
1609  static const size_t value = header.getNumberOfMatches(header);
1610 
1611  return value;
1612  }
1613 
1614 
1615  /**
1616  * Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
1617  * <pre>
1618  * <key>: <value> [<value>]*
1619  * <key>: <value> [<value>]*
1620  * </pre>
1621  *
1622  * \return equation parameters
1623  */
1625  {
1626  static JLANG::JEquationParameters parameters(":", "\n", "", "");
1627 
1628  return parameters;
1629  }
1630 
1631 
1632  /**
1633  * Set equation parameters.
1634  *
1635  * \param equation equation parameters
1636  */
1637  static inline void setEquationParameters(const JLANG::JEquationParameters& equation)
1638  {
1639  getEquationParameters() = equation;
1640  }
1641 
1642 
1643  /**
1644  * Read header from input.
1645  *
1646  * \param in input stream
1647  * \return input stream
1648  */
1649  std::istream& read(std::istream& in);
1650 
1651 
1652  /**
1653  * Write header to output.
1654  *
1655  * \param out output stream
1656  * \return output stream
1657  */
1658  std::ostream& write(std::ostream& out) const;
1659 
1660 
1661  /**
1662  * Print header to output.
1663  *
1664  * \param out output stream
1665  * \return output stream
1666  */
1667  std::ostream& print(std::ostream& out) const;
1668 
1669 
1670  ClassDef(JHead,5);
1671 
1672  private:
1673  /**
1674  * Comparison.
1675  *
1676  * \param first first object
1677  * \param second second object
1678  * \return true if first less than second; else false
1679  */
1680  template<class T>
1681  static inline bool less(const T& first,
1682  const T& second)
1683  {
1684  return first.less(second);
1685  }
1686 
1687 
1688  /**
1689  * Test match.
1690  *
1691  * \param first first object
1692  * \param second second object
1693  * \return true if matches; else false
1694  */
1695  template<class T>
1696  static inline bool match(const T& first,
1697  const T& second)
1698  {
1699  return first.match(second);
1700  }
1701 
1702 
1703  /**
1704  * Comparison of containers.
1705  * It is assumed that the containers are ordered in the same way.
1706  *
1707  * \param first first object
1708  * \param second second object
1709  * \return true if first is less than second; else false
1710  */
1711  template<class T>
1712  static inline bool less(const std::vector<T>& first,
1713  const std::vector<T>& second)
1714  {
1715  if (first.size() == second.size()) {
1716 
1717  for (size_t i = 0; i != first.size(); ++i) {
1718  if (less(first[i], second[i])) {
1719  return true;
1720  }
1721  }
1722 
1723  return false;
1724 
1725  } else {
1726 
1727  return first.size() < second.size();
1728  }
1729  }
1730 
1731 
1732  /**
1733  * Test is containers match.
1734  * It is assumed that the containers are ordered in the same way.
1735  *
1736  * \param first first object
1737  * \param second second object
1738  * \return true if matches; else false
1739  */
1740  template<class T>
1741  static inline bool match(const std::vector<T>& first,
1742  const std::vector<T>& second)
1743  {
1744  for (size_t i = 0; i != first.size() && i != second.size(); ++i) {
1745  if (!match(first[i], second[i])) {
1746  return false;
1747  }
1748  }
1749 
1750  return first.size() == second.size();
1751  }
1752 
1753 
1754  /**
1755  * Test match of given data member of headers.
1756  *
1757  * \param first first header
1758  * \param second second header
1759  * \param pd pointer to data member
1760  * \return true if matches; else false
1761  */
1762  template<class T>
1763  static inline bool match(const JHead& first,
1764  const JHead& second,
1765  T JHead::*pd)
1766  {
1767  return (first .is_valid(pd) &&
1768  second.is_valid(pd) &&
1769  match(first.*pd, second.*pd));
1770  }
1771  };
1772 
1773 
1774  /**
1775  * Equal operator.
1776  *
1777  * Note that this operator uses the JHead::match method.
1778  *
1779  * \param first first header
1780  * \param second second header
1781  * \return true if two headers are equal; else false
1782  */
1783  inline bool operator==(const Head& first,
1784  const Head& second)
1785  {
1786  return JHead(first).match(JHead(second));
1787  }
1788 
1789 
1790  /**
1791  * Less than operator.
1792  *
1793  * Note that this operator uses the JHead::less method.
1794  *
1795  * \param first first header
1796  * \param second second header
1797  * \return true if first header is less than second header; else false
1798  */
1799  inline bool operator<(const Head& first,
1800  const Head& second)
1801  {
1802  return JHead(first).less(JHead(second));
1803  }
1804 }
1805 
1806 
1807 /**
1808  * Read header from input.
1809  *
1810  * \param in input stream
1811  * \param header header
1812  * \return input stream
1813  */
1814 inline std::istream& operator>>(std::istream& in, JAANET::JHead& header)
1815 {
1816  return header.read(in);
1817 }
1818 
1819 
1820 /**
1821  * Write header to output.
1822  *
1823  * \param out output stream
1824  * \param header header
1825  * \return output stream
1826  */
1827 inline std::ostream& operator<<(std::ostream& out, const JAANET::JHead& header)
1828 {
1829  return header.write(out);
1830 }
1831 #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:1588
JAANET::genhencut genhencut
Definition: JHead.hh:1584
static const size_t getMaximumNumberOfMatches()
Get maximum number of matching header fields.
Definition: JHead.hh:1603
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:1320
JHead getMatch(const JHead &header) const
Get matching fields.
Definition: JHead.hh:1396
livetime & mul(const double factor)
Scale.
Definition: JHead.hh:875
JAANET::genvol genvol
Definition: JHead.hh:1582
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:1585
std::vector< JAANET::flux > flux
Definition: JHead.hh:1594
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
bool less(const K40 &object) const
Comparison.
Definition: JHead.hh:1064
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
Definition: JMuonPostfit.sh:40
Livetime of DAQ data.
Definition: JHead.hh:995
double t1
Start time in seconds.
Definition: JHead.hh:1151
bool match(const tgen &object) const
Test match.
Definition: JHead.hh:1117
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:1560
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:1278
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:1256
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:1799
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:1569
double numberOfEvents
Number of events.
Definition: JHead.hh:708
bool less(const generator &object) const
Comparison.
Definition: JHead.hh:473
K40()
Default constructor.
Definition: JHead.hh:1054
static bool less(const T &first, const T &second)
Comparison.
Definition: JHead.hh:1681
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:1152
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:1575
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:1573
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:1637
bool match(const K40 &object) const
Test match.
Definition: JHead.hh:1075
bool match(const time_interval &object) const
Test match.
Definition: JHead.hh:1146
bool match(const JHead &header) const
Test match of headers.
Definition: JHead.hh:1458
data_type r[M+1]
Definition: JPolint.hh:779
std::vector< JAANET::simul > simul
Definition: JHead.hh:1574
double livetime_s
Live time [s].
Definition: JHead.hh:1040
JHead & add(const JHead &header)
Addition of headers.
Definition: JHead.hh:1515
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:1287
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:1595
bool less(const JHead &header) const
Comparison of headers.
Definition: JHead.hh:1470
double zmax
Top [m].
Definition: JHead.hh:705
JAANET::fixedcan fixedcan
Definition: JHead.hh:1581
static const JUUID & rndm()
Generate random UUID.
Definition: JUUID.hh:67
JAANET::can can
Definition: JHead.hh:1580
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:1360
Type definition of range.
Definition: JHead.hh:41
int type
Particle type.
Definition: JHead.hh:1191
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:96
JUUID UUID
Definition: JHead.hh:1567
JAANET::cut_seamuon cut_seamuon
Definition: JHead.hh:1576
generator()
Default constructor.
Definition: JHead.hh:460
double numberOfPrimaries
Number of primaries.
Definition: JHead.hh:813
JAANET::livetime livetime
Definition: JHead.hh:1586
static JLANG::JEquationParameters & getEquationParameters()
Get equation parameters corresponding to Monte Carlo ASCII format, i.e:
Definition: JHead.hh:1624
JHead()
Default constructor.
Definition: JHead.hh:1227
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:1175
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:1378
JAANET::seabottom seabottom
Definition: JHead.hh:1587
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:1566
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:1546
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:1103
JAANET::spectrum spectrum
Definition: JHead.hh:1579
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:1135
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::K40 K40
Definition: JHead.hh:1590
JAANET::primary primary
Definition: JHead.hh:1593
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:1221
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:1592
size_t getNumberOfMatches(const JHead &header) const
Get number of matching fields.
Definition: JHead.hh:1444
static bool match(const std::vector< T > &first, const std::vector< T > &second)
Test is containers match.
Definition: JHead.hh:1741
JAANET::muon_desc_file muon_desc_file
Definition: JHead.hh:1571
#define ClassDef(name, version)
Definition: JRoot.hh:32
norma()
Default constructor.
Definition: JHead.hh:783
virtual ~JHead()
Virtual destructor.
Definition: JHead.hh:1247
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:1570
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:1763
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:1348
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:1165
JAANET::tgen tgen
Definition: JHead.hh:1591
JAANET::cut_in cut_in
Definition: JHead.hh:1577
Simple wrapper for UUID.
Definition: JUUID.hh:22
JHead & getHeader()
Get header.
Definition: JHead.hh:1267
static bool less(const std::vector< T > &first, const std::vector< T > &second)
Comparison of containers.
Definition: JHead.hh:1712
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:1572
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
Primary particle.
Definition: JHead.hh:1161
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:1696
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:1578
bool less(const livetime &object) const
Comparison.
Definition: JHead.hh:837
UTC time interval for event generation.
Definition: JHead.hh:1131
end_event()
Default constructor.
Definition: JHead.hh:1204
Phase space of atmospheric muon generation.
Definition: JHead.hh:426
double numberOfSeconds
Time in seconds.
Definition: JHead.hh:1122
std::string time
processing time
Definition: JHead.hh:494
tgen()
Default constructor.
Definition: JHead.hh:1107
End of event record.
Definition: JHead.hh:1200
Phase space of primary particle.
Definition: JHead.hh:416
JAANET::coord_origin coord_origin
Definition: JHead.hh:1583
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:1305
JAANET::XSecFile XSecFile
Definition: JHead.hh:1568
JAANET::DAQ DAQ
Definition: JHead.hh:1589
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:1186
Livetime of noise data.
Definition: JHead.hh:1049
Vec coord_origin() const
Get coordinate origin.
Definition: Head.hh:395
JHead(const Head &header)
Copy constructor.
Definition: JHead.hh:1238
friend std::ostream & operator<<(std::ostream &out, const detector &object)
Write detector to output stream.
Definition: JHead.hh:273
double livetime_s
Live time [s].
Definition: JHead.hh:1094
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
K40 & add(const K40 &object)
Addition.
Definition: JHead.hh:1087
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:1335
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