Jpp  test_elongated_shower_pde
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JGedanken.cc File Reference

Auxiliary program to generate particles. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "TROOT.h"
#include "TFile.h"
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JSupport.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to generate particles.

Author
mdejong

Definition in file JGedanken.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 25 of file JGedanken.cc.

26 {
27  using namespace std;
28  using namespace JPP;
29 
30  Trk trk;
31 
33  size_t numberOfEvents;
34  int debug;
35 
36  try {
37 
38  JParser<> zap("Auxiliary program to generate particles.");
39 
40  zap['o'] = make_field(outputFile) = "gedanken.root";
41  zap['n'] = make_field(numberOfEvents) = 1;
42  zap['P'] = make_field(trk.pos, "position");
43  zap['D'] = make_field(trk.dir, "direction") = Vec(0.0, 0.0, 1.0);
44  zap['E'] = make_field(trk.E, "energy [GeV]");
45  zap['T'] = make_field(trk.type, "particle type (PDG)");
46  zap['d'] = make_field(debug) = 2;
47 
48  zap(argc, argv);
49  }
50  catch(const exception& error) {
51  FATAL(error.what() << endl);
52  }
53 
54  trk.dir.normalize();
55 
56  trk.status = TRK_ST_FINALSTATE;
57 
58  Head header;
59 
60  outputFile.open();
61 
62  outputFile.put(header);
63 
64  Evt evt;
65 
66  evt.mc_trks.push_back(trk);
67 
68  for (size_t counter = 0; counter != numberOfEvents; ++counter) {
69 
70  STATUS("event: " << setw(10) << counter << '\r'); DEBUG(endl);
71 
72  outputFile.put(evt);
73  }
74  STATUS(endl);
75 
76  outputFile.close();
77 }
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1500
#define STATUS(A)
Definition: JMessage.hh:63
string outputFile
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:68
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:67
#define FATAL(A)
Definition: JMessage.hh:67
static const int TRK_ST_FINALSTATE
particle to be tracked by detector-level MC (&#39;track_in&#39; tag in evt files from gseagen ...
Definition: trkmembers.hh:15
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:14
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19