Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JNuisance.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <memory>
#include <map>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TRandom3.h"
#include "JAstronomy/JNuisance.hh"
#include "JLang/JVectorize.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 Toy simulation to study nuisance.
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Toy simulation to study nuisance.

Definition at line 23 of file JNuisance.cc.

24{
25 using namespace std;
26 using namespace JPP;
27
28 size_t numberOfEvents;
29 string outputFile;
30 JNuisance_t nuisance;
31 UInt_t seed;
32 int debug;
33
34 try {
35
36 JParser<> zap;
37
38 zap['o'] = make_field(outputFile) = "nuisance.root";
39 zap['n'] = make_field(numberOfEvents);
40 zap['u'] = make_field(nuisance, "nuisance: \"<type> (parameters)+\"\n\twhere <type> can be:" << get_keys(nuisance.getDictionary()));
41 zap['S'] = make_field(seed) = 0;
42 zap['d'] = make_field(debug) = 1;
43
44 zap(argc, argv);
45 }
46 catch(const exception &error) {
47 FATAL(error.what() << endl);
48 }
49
50 gRandom->SetSeed(seed);
51
52 TFile out(outputFile.c_str(), "recreate");
53
54 TH1D h0("h0", NULL, 100, -5.0, +5.0);
55
56 for (size_t counter = 0; counter != numberOfEvents; ++counter) {
57
58 STATUS("counter: "<< setw(8) << counter << '\r'); DEBUG(endl);
59
60 h0.Fill(nuisance->get());
61 }
62
63 out.Write();
64 out.Close();
65}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Helper for nuisance I/O.
Definition JNuisance.hh:349
const dictionary_type & getDictionary() const
Get dictionary.
Definition JNuisance.hh:372