## 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 . ".tcl"; $outputFile = "data/" . $argzero . ".root"; open(SNIPPET, ">snippet/snippet-$N.tcl"); print SNIPPET "\n"; print SNIPPET "\#\# Tell the job where to find data\n"; print SNIPPET "source $inputFile\n"; print SNIPPET "\n"; print SNIPPET "\# set some important parameters\n"; print SNIPPET "\# Note that the output file is different for\n"; print SNIPPET "\# each job, as it should be.\n"; print SNIPPET "\n"; print SNIPPET "set ConfigPatch MC\n"; print SNIPPET "set levelOfDetail cache\n"; print SNIPPET "set BetaMiniTuple root\n"; print SNIPPET "set histFileName $outputFile\n"; print SNIPPET "\n"; print SNIPPET "\# Now send the job to the MyMiniAnalysis module\n"; print SNIPPET "sourceFoundFile BetaMiniUser/MyMiniAnalysis.tcl\n"; print SNIPPET "\n"; }