29 int main(
int argc,
char **argv)
40 JParser<> zap(
"Auxiliary program to determine standard deviation of a set of 1D histograms.");
42 zap[
'f'] =
make_field(inputFile,
"<input file>:<object name>");
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
59 DEBUG(
"Input: " << *input << endl);
64 ERROR(
"File: " << input->getFullFilename() <<
" not opened." << endl);
68 const TRegexp regexp(input->getObjectName());
70 TIter iter(dir->GetListOfKeys());
72 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
74 const TString tag(key->GetName());
76 DEBUG(
"Key: " << tag <<
" match = " << tag.Contains(regexp) << endl);
80 if (tag.Contains(regexp) &&
isTObject(key)) {
84 if (!p->InheritsFrom(
"TH1")) {
85 FATAL(
"Object " << p->GetName() <<
" not compatible with histogram operations." << endl);
90 h3 = (TH1*) p->Clone(
"stdev");
96 if (h3->GetXaxis()->GetNbins() != h1->GetXaxis()->GetNbins() ||
97 h3->GetXaxis()->GetXmin () != h1->GetXaxis()->GetXmin () ||
98 h3->GetXaxis()->GetXmax () != h1->GetXaxis()->GetXmax ()) {
99 FATAL(
"Objects " << h3->GetName() <<
" and " << p->GetName() <<
" have different binning." << endl);
103 listOfHistograms.push_back((TH1*) p);
108 if (listOfHistograms.size() <= 1) {
109 FATAL(
"Not enough histograms " << listOfHistograms.size() << endl);
112 for (Int_t
i = 1;
i <= h3->GetNbinsX(); ++
i) {
118 Y += (*p)->GetBinContent(
i);
119 Z += (*p)->GetBinError(
i) * (*p)->GetBinError(
i);
123 Y /= listOfHistograms.size();
124 Z /= listOfHistograms.size();
129 y += ((*p)->GetBinContent(
i) -
Y)*((*p)->GetBinContent(
i) -
Y) / ((*p)->GetBinError(
i)*(*p)->GetBinError(
i) + Z*
Z);
132 y = sqrt(y / listOfHistograms.size());
134 h3->SetBinContent(
i, y);
135 h3->SetBinError (
i, 0.0);
Utility class to parse command line options.
int main(int argc, char *argv[])
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.
Utility class to parse command line options.
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
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
#define DEBUG(A)
Message macros.