ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/scripts/mergeHists
(Generate patch)

Comparing UserCode/OSUT3Analysis/AnaTools/scripts/mergeHists (file contents):
Revision 1.23 by lantonel, Wed Apr 10 13:34:17 2013 UTC vs.
Revision 1.25 by ahart, Tue Jun 4 23:46:12 2013 UTC

# Line 105 | Line 105 | foreach my $file (@$files)
105                      last;
106                    }
107                  push (@{$rootFiles{$arg}}, $file);
108 <                push (@weights, $opt{"weight"}) if $opt{"weight"};
108 >                if ($opt{"weight"})
109 >                  {
110 >                    push (@weights, $opt{"weight"}) if !($opt{"weight"} =~ m/,/);
111 >                    push (@weights, 1.0) if $opt{"weight"} =~ m/,/;
112 >                  }
113                  push (@weights, $opt{"xsection"} * $integratedLuminosity) if !$opt{"weight"} && $opt{"xsection"};
114                  push (@weights, $crossSections{$dir} * $integratedLuminosity) if !$opt{"weight"} && !$opt{"xsection"} && defined $crossSections{$dir};
115                  push (@weights, 1.0) if !$opt{"weight"} && !$opt{"xsection"} && !(defined $crossSections{$dir});
# Line 137 | Line 141 | foreach my $arg (@ARGV)
141      $weights{$arg} /= $count if !$opt{"weight"} && !$opt{"xsection"} && defined $crossSections{$dirs{$arg}};
142      push (@mergedFiles, $tmpName);
143      push (@mergedWeights, $weights{$arg});
144 +    foreach my $rootFile (@{$rootFiles{$arg}})
145 +      {
146 +        my $weight = $weights{$arg};
147 +        system ("weightTrees $rootFile $weight");
148 +      }
149    }
150   my $mergedFiles = join (" ", @mergedFiles);
151   my $mergedWeights = join (",", @mergedWeights);
152 + $mergedWeights = $opt{"weight"} if $opt{"weight"} && $opt{"weight"} =~ m/,/;
153   system ("mergeTFileServiceHistograms -i $mergedFiles -o $opt{'prefix'}.root -w $mergedWeights");
154   foreach my $mergedFile (@mergedFiles)
155    {
# Line 237 | Line 247 | printHelp
247    printf "%-29s%s\n", "  -c, --cutflow HISTOGRAM", "name of histogram to use for the cutflow (default:";
248    printf "%-29s%s\n", "                  ", "cutFlow)";
249    printf "%-29s%s\n", "  -h, --help", "print this help message";
250 <  printf "%-29s%s\n", "  -l, --luminosity", "integrated luminosity to which the histograms are weighted";
250 >  printf "%-29s%s\n", "  -l, --luminosity", "integrated luminosity to which the histograms are";
251 >  printf "%-29s%s\n", "                  ", "weighted (default: 10000/pb)";
252    printf "%-29s%s\n", "  -p, --prefix PREFIX", "output is  named PREFIX.root";
253    printf "%-29s%s\n", "  -w, --weight WEIGHT", "scale the output by WEIGHT, overriding the";
254    printf "%-29s%s\n", "                     ", "automatic weighting using the cross section from";
255 <  printf "%-29s%s\n", "                     ", "the database";
255 >  printf "%-29s%s\n", "                     ", "the database; WEIGHT may be a single number or a";
256 >  printf "%-29s%s\n", "                     ", "comma-separated list, one for each input file";
257    printf "%-29s%s\n", "  -x, --xsection XSECTION", "use XSECTION to weight the histograms instead of";
258    printf "%-29s%s\n", "                     ", "the value in the database";
259  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines