Jpp test-rotations-old-533-g2bdbdb559
the software that should make you happy
Loading...
Searching...
No Matches
JNuisance.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4#include <memory>
5#include <map>
6
7#include "TROOT.h"
8#include "TFile.h"
9#include "TH1D.h"
10#include "TRandom3.h"
11
13
14#include "JLang/JVectorize.hh"
15
16#include "Jeep/JParser.hh"
17#include "Jeep/JMessage.hh"
18
19
20/**
21 * Toy simulation to study nuisance.
22 */
23int main(int argc, char**argv)
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
General purpose messaging.
#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
int main(int argc, char **argv)
Toy simulation to study nuisance.
Definition JNuisance.cc:23
Nuisance parameter.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
Utility class to parse command line options.
Definition JParser.hh:1698
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