25 int main(
int argc,
char **argv)
30 typedef JToken<';'> JToken_t;
47 JParser<> zap(
"Program to create TH2D and fill according given formula.");
63 catch(
const exception &error) {
64 FATAL(error.what() << endl);
68 if ((formula !=
"" && inputFile !=
"") ||
69 (formula ==
"" && inputFile ==
"")) {
70 FATAL(
"Specify input file or formula." << endl);
76 const string::size_type pos = title.rfind(
'/');
78 if (pos != string::npos) {
80 const string dir = title.substr(0, pos);
82 out.mkdir(dir.c_str());
85 title = title.substr(pos + 1);
88 TH3D h0(title.c_str(), NULL,
89 X.getNumberOfBins(),
X.getLowerLimit(),
X.getUpperLimit(),
90 Y.getNumberOfBins(),
Y.getLowerLimit(),
Y.getUpperLimit(),
91 Z.getNumberOfBins(),
Z.getLowerLimit(),
Z.getUpperLimit());
95 TF3
f3(
"f3", formula.c_str());
101 if (numberOfEvents > 0) {
104 h0.FillRandom(
f3.GetName(), numberOfEvents);
108 for (Int_t ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) {
109 for (Int_t iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) {
110 for (Int_t iz = 1; iz <= h0.GetZaxis()->GetNbins(); ++iz) {
112 h0.SetBinContent(ix, iy, iz,
f3.Eval(h0.GetXaxis()->GetBinCenter(ix),
113 h0.GetYaxis()->GetBinCenter(iy),
114 h0.GetZaxis()->GetBinCenter(iz)));
119 }
else if (inputFile !=
"") {
125 ifstream
in(inputFile.c_str());
127 for (
double x,
y,
z;
in >> x >>
y >>
z; ) {
Utility class to parse command line options.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
int main(int argc, char *argv[])
int getParameter(const std::string &text)
Get parameter number from text string.
*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
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
then fatal The output file must have the wildcard in the e g root fi 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
Utility class to parse command line options.
no fit printf nominal n $STRING awk v X
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
double f3(const double x, const double y, const double z)
3D function.
JAbstractHistogram< double > JHistogram_t
Type definition for scan along axis.