## Perl script to make snippet files for the Workbook ## To make snippet files with this script, go to workdir and do: ## workdir> mkdir snippet ## workdir> perl MultiSnippet.pl TclName NumberOfTcls ## where TclName is the name of all the tcl files WITHOUT ## THE ".tcl" AT THE END, and NumberOfTcls is the number of tcl files ## For example, if you have 100 tcl files, ## SP-B0B0bar-Run4-1.tcl, SP-B0B0bar-Run4-2.tcl ... SP-B0B0bar-Run4-100.tcl ## then the command is: ## workdir> perl MultiSnippet.pl SP-B0B0bar-Run4 100 $MAX = $ARGV[1]; for ($N=1; $N<=$MAX; $N++) { ## input file name, and add ".root" to make the output file name $argzero = $ARGV[0]; $inputFile = "tcl/" . $argzero . "-$N.tcl"; $outputFile = "output/" . $argzero . "-$N.root"; open(SNIPPET, ">snippet/snippet-$N.tcl"); print SNIPPET "\n"; print SNIPPET "\# snippet-$N.tcl"; print SNIPPET "\n"; print SNIPPET "\# Set some important parameters:\n"; print SNIPPET "\n"; print SNIPPET "set inputTclfile $inputFile\n"; print SNIPPET "set histFileName $outputFile\n"; print SNIPPET "set levelOfDetail cache\n"; print SNIPPET "set ConfigPatch MC\n"; print SNIPPET "set BetaMiniTuple root\n"; print SNIPPET "\n"; print SNIPPET "\# Now send the job to MyMiniAnalysis.tcl\n"; print SNIPPET "sourceFoundFile BetaMiniUser/MyMiniAnalysis.tcl\n"; print SNIPPET "\n"; }