8 |
|
sub printHelp; |
9 |
|
sub getRunList; |
10 |
|
sub countEvents; |
11 |
+ |
sub isEDM; |
12 |
|
|
13 |
|
my %opt; |
14 |
|
Getopt::Long::Configure ("bundling"); |
84 |
|
$dir =~ s/^(.*)\/[^\/]*$/$1/; |
85 |
|
my $badJob = 0; |
86 |
|
my $jobNumber; |
87 |
< |
if ($file =~ m/^.*_[^_]*\.root$/) |
87 |
> |
my $fileIsEDM = 0; |
88 |
> |
$fileIsEDM = isEDM ($file) if $file =~ m/^.*\.root$/; |
89 |
> |
if ($file =~ m/^.*_[^_]*\.root$/ && !$fileIsEDM) |
90 |
|
{ |
91 |
|
$jobNumber = $file; |
92 |
|
$jobNumber =~ s/^.*_([^_]*)\.root$/$1/; |
93 |
|
$badJob = (defined $signals{$dir} && defined $signals{$dir}{$jobNumber}) || (defined $partial{$dir} && defined $partial{$dir}{$jobNumber}); |
94 |
|
} |
95 |
|
next if $badJob; |
96 |
< |
if ($file =~ m/^.*\.root$/) |
96 |
> |
if ($file =~ m/^.*\.root$/ && !$fileIsEDM) |
97 |
|
{ |
98 |
|
foreach my $arg (@ARGV) |
99 |
|
{ |
144 |
|
$weights{$arg} /= $count if !$opt{"weight"} && !$opt{"xsection"} && defined $crossSections{$dirs{$arg}}; |
145 |
|
push (@mergedFiles, $tmpName); |
146 |
|
push (@mergedWeights, $weights{$arg}); |
147 |
+ |
foreach my $rootFile (@{$rootFiles{$arg}}) |
148 |
+ |
{ |
149 |
+ |
my $weight = $weights{$arg}; |
150 |
+ |
system ("weightTrees $rootFile $weight"); |
151 |
+ |
} |
152 |
+ |
if (defined $crossSections{$dirs{$arg}}) |
153 |
+ |
{ |
154 |
+ |
open (EVENT_COUNT, ">$dirs{$arg}/numberOfEvents.txt"); |
155 |
+ |
print EVENT_COUNT sprintf ("%.0f", $count) . "\n"; |
156 |
+ |
close (EVENT_COUNT); |
157 |
+ |
} |
158 |
|
} |
159 |
|
my $mergedFiles = join (" ", @mergedFiles); |
160 |
|
my $mergedWeights = join (",", @mergedWeights); |
199 |
|
print $output if $printOutput; |
200 |
|
|
201 |
|
my $goodEvents = countEvents ("$opt{'prefix'}.root", $cutFlow); |
202 |
< |
print "$nGoodJobs jobs ran successfully over $nTotalEvents ($goodEvents weighted) events.\n" if $counting; |
202 |
> |
printf "$nGoodJobs jobs ran successfully over $nTotalEvents (%.1f weighted) events.\n", $goodEvents if $counting; |
203 |
|
print "$nBadJobs jobs failed to run.\n" if $counting; |
204 |
|
print "$nIncompleteJobs jobs have not finished.\n" if $counting; |
205 |
|
print "=============================================\n"; |
305 |
|
|
306 |
|
return $output; |
307 |
|
} |
308 |
+ |
|
309 |
+ |
sub |
310 |
+ |
isEDM |
311 |
+ |
{ |
312 |
+ |
my $file = shift; |
313 |
+ |
|
314 |
+ |
my $output = `edmFileUtil $file 2>&1`; |
315 |
+ |
return 0 if $output =~ m/appears to be missing/ || $output =~ m/not a ROOT file/; |
316 |
+ |
return 1; |
317 |
+ |
} |