#!/usr/bin/perl -w #1=test run, 0=for real $test=0; $test=1; #get set up LoadModules(); #define the global variables to be used defineTimeLine(); ####################################### #run the jobs... #runJob1(); #runJobOneMonthPostRevBfld2007(); #runJobOneMonthPreAprilShws(); #runJobOneMonthNovDec2006(); #runJobRunII(); #runJobRunIII(); runJobRunIIIFD(1); #runJobRunIIIRev(1); #runJobRunIIIRev(2); #runJobRunIIIRev(3); #runJobRunIIend(); #runJobRunIIend2(); #runJobPostL010z200iRunI2005Cedar_phy_bhcurv(); #runJobPTSimFDCosmicLEDaikon_02(); #runJobPTSimFDL010185NDaikon_00(); #runMCTest(); #runDataTest(); #runJobCedar_phyNearSpillDaikon00(); #runJobCedar_phy_bhcurvFarSpillDaikon04Tau(); #runJobCC00325_RunI_L010z185_ND_Data(); #indlues L010170 and L010200 #runJobCC00325_RunI_L010z170_ND_Data(); #runJobCC00325_RunI_L010z200_ND_Data(); #runJobCC00325_RunII_L010z185_ND_Data(); #runJobCC00325_RunII_L250z200_ND_Data(); #runJobCedar_phy_bhcurvFarSpillDaikon04(); #runJobCedar_phy_bhcurvNearSpillDaikon04(); #runJobCedar_phy_bhcurv(); #runJobCedar_phy_oldbhcurv(); #runJobHeMC(); #runRevBW1(); #runRevBW2(); #runRevBW3(); #runForBW1(); #runForBW2(); #runForBW3(); #runRevBMC(); ##....................................................................72 sub runJobCC00325_RunII_L010z185_ND_Data { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z185iRunII\n"; print "end =$TL::endTimeL010z185iRunII\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z185iRunII, $TL::endTimeL010z185iRunII); BadRuns::defineBadRuns(); print "About to loop over bad runs\n"; foreach $badRun (@BadRuns::bad_run_list){ $dim=removeRunFromDim($dim, $badRun); } #remove the reversed B-field $dim = removeRunsBetween($dim, $TL::startTimeRevBfld2007W1, $TL::endTimeRevBfld2007W1); $dim = removeRunsBetween($dim, $TL::startTimeRevBfld2007W2, $TL::endTimeRevBfld2007W2); $dim = removeRunsBetween($dim, $TL::startTimeRevBfld2007W3, $TL::endTimeRevBfld2007W3); samListFiles($dim); # return 1; # die; $defName="$user-CC0325-RunII-L010z185-ND-Data"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; $N=50; $maxNumFiles="10"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##....................................................................72 sub runJobCC00325_RunII_L250z200_ND_Data { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL250z200iRunII\n"; print "end =$TL::endTimeL250z200iRunII\n"; $dim=addDatesToDim($dim, $TL::startTimeL250z200iRunII, $TL::endTimeL250z200iRunII); BadRuns::defineBadRuns(); foreach $badRun (@BadRuns::bad_run_list){ $dim=removeRunFromDim($dim, $badRun); } samListFiles($dim); # return 1; # die; $defName="$user-CC0325-RunII-L250z200-ND-Data"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; $N=50; $maxNumFiles="10"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##....................................................................72 sub runJobCC00325_RunI_L010z185_ND_Data #this icludes L010z170 and L010z200 { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z185iRunI\n"; print "end =$TL::endTimeL010z185iRunI\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z185iRunI, $TL::endTimeL010z185iRunI); BadRuns::defineBadRuns(); foreach $badRun (@BadRuns::bad_run_list){ $dim=removeRunFromDim($dim, $badRun); } #Now remove the horn off data print "Removing horn off data between $TL::startTimeL010z000iRunI and $TL::endTimeL010z000iRunI\n"; $dim = removeRunsBetween($dim, $TL::startTimeL010z000iRunI, $TL::endTimeL010z000iRunI); samListFiles($dim); # return 1; # die; $defName="$user-CC0325-RunI-L010z185-ND-Data"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; $N=50; $maxNumFiles="10"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##....................................................................72 sub runJobCC00325_RunI_L010z170_ND_Data { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z170iRunI\n"; print "end =$TL::endTimeL010z170iRunI\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z170iRunI, $TL::endTimeL010z170iRunI); BadRuns::defineBadRuns(); print "About to loop over bad runs\n"; $badRunCount = 0; foreach $badRun (@BadRuns::bad_run_list){ $dim=removeRunFromDim($dim, $badRun); ++$badRunCount; } print "Removed $badRunCount runs\n"; samListFiles($dim); # return 1; # die; $defName="$user-CC0325-RunI-L010z170-ND-Data"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; $N=50; $maxNumFiles="10"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##....................................................................72 sub runJobCC00325_RunI_L010z200_ND_Data { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z200iRunI\n"; print "end =$TL::endTimeL010z200iRunI\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z200iRunI, $TL::endTimeL010z200iRunI); BadRuns::defineBadRuns(); print "About to loop over bad runs\n"; $badRunCount = 0; foreach $badRun (@BadRuns::bad_run_list){ $dim=removeRunFromDim($dim, $badRun); ++$badRunCount; } print "Removed $badRunCount runs\n"; samListFiles($dim); # return 1; # die; $defName="$user-CC0325-RunI-L010z200-ND-Data"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; $N=50; $maxNumFiles="10"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... sub runRevBMC { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); defineMCVarsL010185NrevDaikon_04(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); $defName="$user-BRevDaikon04Cedar_phy_bhcurv_brev"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/brev_bhcurv/MC"; chomp $workLocation; $N=17; $maxNumFiles="11"; #submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runRevBW1 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeRevBfld2007W1\n"; print "end =$TL::endTimeRevBfld2007W1\n"; $dim=addDatesToDim($dim, $TL::startTimeRevBfld2007W1, $TL::endTimeRevBfld2007W1); samListFiles($dim); $defName="$user-BRevW1Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/brev_bhcurv/week1"; chomp $workLocation; $N=4; $maxNumFiles="3"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runRevBW2 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeRevBfld2007W2\n"; print "end =$TL::endTimeRevBfld2007W2\n"; $dim=addDatesToDim($dim, $TL::startTimeRevBfld2007W2, $TL::endTimeRevBfld2007W2); samListFiles($dim); $defName="$user-BRevW2Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/brev_bhcurv/week2"; chomp $workLocation; $N=4; $maxNumFiles="3"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runRevBW3 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeRevBfld2007W3\n"; print "end =$TL::endTimeRevBfld2007W3\n"; $dim=addDatesToDim($dim, $TL::startTimeRevBfld2007W3, $TL::endTimeRevBfld2007W3); samListFiles($dim); $defName="$user-BRevW3Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/brev_bhcurv/week3"; chomp $workLocation; $N=4; $maxNumFiles="3"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runForBW1 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::endTimeRevBfld2007W1\n"; print "end =$TL::startTimeRevBfld2007W2\n"; $dim=addDatesToDim($dim, $TL::endTimeRevBfld2007W1, $TL::startTimeRevBfld2007W2); samListFiles($dim); $defName="$user-BForW1Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/20080219/bfor/week1"; chomp $workLocation; $N=4; $maxNumFiles="3"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runForBW2 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::endTimeRevBfld2007W2\n"; print "end =$TL::startTimeRevBfld2007W3\n"; $dim=addDatesToDim($dim, $TL::endTimeRevBfld2007W2, $TL::startTimeRevBfld2007W3); samListFiles($dim); $defName="$user-BForW2Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/20080219/bfor/week2"; chomp $workLocation; $N=6; $maxNumFiles="3"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runForBW3 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::endTimeRevBfld2007W3\n"; print "end =$TL::startTimeRevBfld2007W4\n"; $dim=addDatesToDim($dim, $TL::endTimeRevBfld2007W3, $TL::startTimeRevBfld2007W4); samListFiles($dim); $defName="$user-BForW3Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/scratch/ahimmel/20080219/bfor/week3"; chomp $workLocation; $N=4; $maxNumFiles="3"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runMCTest { defineBaseVarsCedar_phySntpNearSpill(); defineMCVarsL010185NDaikon_00(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); } ##...................................................................... sub runDataTest { #defineBaseVarsCedarSntpNearSpill(); defineBaseVarsCedarSntpFarSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z185iRunIII\n"; print "end =$TL::endTimeL010z185iRunIII\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z185iRunIII, $TL::endTimeL010z185iRunIII); samListFiles($dim); } ##...................................................................... sub runJobCedar_phyNearSpillDaikon00 { defineBaseVarsCedar_phySntpNearSpill(); defineMCVarsL010185NDaikon_00(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); $defName="$user-Cedar_phyDaikon00"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; #$N=134 $N=10; $maxNumFiles="5"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobCedar_phy_oldbhcurv { defineBaseVarsCedar_phy_oldbhcurvSntpNearSpill(); defineMCVarsL010185NDaikon_03(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); $defName="$user-Cedar_phy_oldbhcurv_all"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/data/analysis/NuMuBar/DSTs/MC/D03_cedar_phy/oldbhcurv"; chomp $workLocation; #$N=134 $N=65; $maxNumFiles="4"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobHeMC { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); defineMCVarsL010185NDaikon_04(); defineHelium(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); $defName="$user-heliumMC"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/data/analysis/NuMuBar/DSTs/MC/D04_helium"; chomp $workLocation; $N=35; $maxNumFiles="2"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobCedar_phy_bhcurv { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); defineMCVarsL010185NDaikon_03(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); $defName="$user-Cedar_phy_bhcurv_all"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/data/analysis/NuMuBar/DSTs/MC/D03_cedar_phy/bhcurv"; chomp $workLocation; #$N=134 $N=45; $maxNumFiles="4"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobCedar_phy_bhcurvNearSpillDaikon04 { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); defineMCVarsL010185NDaikon_04(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); # Was needed for the B-field MC problem seen a while back @bad_run_list = (7233, 7244, 7245); print "About to loop over bad runs\n"; print $dim; foreach $badRun (@bad_run_list){ $dim=removeRunFromDim($dim, $badRun); print $dim; } $dim=removeRunsRange($dim,7250,7470); $dim=removeRunsRange($dim,7553,7735); print $dim; samListFiles($dim); $defName="$user-Cedar_phy_bhcurvNearSpillDaikon04"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/data/analysis/NuMuBar/DSTs/MC/D04_cedar_phy_bhcurv/near-all"; chomp $workLocation; #$N=134 $N=50; $maxNumFiles="30"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobCedar_phy_bhcurvFarSpillDaikon04 { defineBaseVarsCedar_phy_bhcurvSntpFarSpill(); defineMCVarsL010185NFarDaikon_04(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); $defName="$user-Cedar_phy_bhcurvFarSpillDaikon04"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = "/minos/data/analysis/NuMuBar/DSTs/MC/D04_cedar_phy_bhcurv/far"; chomp $workLocation; $N=40; $maxNumFiles="10"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobPostL010z200iRunI2005Cedar_phy_bhcurv { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimePostL010z200iRunI\n"; print "end =$TL::endTimeL010z185iRunI\n"; $dim=addDatesToDim($dim, $TL::startTimePostL010z200iRunI, $TL::endTimeL010z185iRunI); samListFiles($dim); $defName="$user-PostL010z200iRunI2005Cedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; #$N=134 $N=36; $maxNumFiles="4"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobPostL250z200iRunIICedar_phy_bhcurv { defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL250z200iRunII\n"; print "end =$TL::endTimeL250z200iRunII\n"; $dim=addDatesToDim($dim, $TL::startTimeL250z200iRunII, $TL::endTimeL250z200iRunII); samListFiles($dim); $defName="$user-PostL250z200iRunIICedar_phy_bhcurv"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation = `pwd`; chomp $workLocation; #$N=134 $N=5; $maxNumFiles="4"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobPTSimFDL010185NDaikon_00 { defineBaseVarsReroot(); defineMCVarsL010185NDaikon_00(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); $lowNum=0; $highNum=1011;#11 files; $dim=addRunNumberRangeToDim($dim,$lowNum,$highNum); samListFiles($dim); $defName="$user-PTSimFDL010185N-D00-R$lowNum-R$highNum"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion="-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation=`pwd`; chomp $workLocation; #$N=700; $N=10; $maxNumFiles="1"; submitJobsPTSimFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub runJobPTSimFDCosmicLEDaikon_02 { defineBaseVarsReroot(); defineMCVarsCosmicLEDaikon_02(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); $lowNum=0; $highNum=1011; $dim=addRunNumberRangeToDim($dim,$lowNum,$highNum); samListFiles($dim); $defName="$user-PTSimFDCosmicLE-D02-R$lowNum-$highNum"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion="-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation=`pwd`; chomp $workLocation; #$N=700; $N=4; $maxNumFiles="1"; submitJobsPTSimFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... ## AIH Job to look at RunII forward field data ## sub runJobRunII { #&defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); &defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimePostL250z200iRunII\n"; print "end =$TL::endTimePreAprilShws\n"; $dim=addDatesToDim($dim, $TL::startTimePostL250z200iRunII, $TL::endTimePreAprilShws); samListFiles($dim); $defName="ahimmel-PreRevBfld2007"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/minos/scratch/ahimmel/cedar/RunII"; $N=125; $maxNumFiles="20"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ## RM Job to look at RunII forward field data ## sub runRMJobRunII { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); #&defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z185iRunII\n"; print "end =$TL::endTimeL010z185iRunII\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z185iRunII, $TL::endTimeL010z185iRunII); samListFiles($dim); $defName="rmehdi-RunII"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/minos/scratch/rmehdi/cedar_phy_bhcurv/RunII"; $N=95; $maxNumFiles="5"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... ## AIH Job to look at the end RunII forward field data uncalibrated ## Goes from end of horn off to before RunIII begins sub runJobRunIIend { #&defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); &defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::endTimePostRevBfld2007\n"; print "end =$TL::startTimeL010z000iRunII\n"; $dim=addDatesToDim($dim, $TL::endTimePostRevBfld2007, $TL::startTimeL010z000iRunII); samListFiles($dim); $defName="ahimmel-RunIIend"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/minos/scratch/ahimmel/cedar/RunIIend"; $N=8; $maxNumFiles="2"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... ## AIH Job to look at the end RunII forward field data uncalibrated ## Goes from end of horn off to before RunIII begins sub runJobRunIIend2 { #&defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); &defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::endTimeL010z000iRunII\n"; print "end =$TL::startTimeL010z185iRunIII\n"; $dim=addDatesToDim($dim, $TL::endTimeL010z000iRunII, $TL::startTimeL010z185iRunIII); samListFiles($dim); $defName="ahimmel-RunIIend2"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/minos/scratch/ahimmel/cedar/RunIIend2"; $N=6; $maxNumFiles="2"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... ## AIH Job to look at RunIII ND data ## sub runJobRunIII { &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); #&defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z185iRunIII\n"; print "end =$TL::endTimeCurrent\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z185iRunIII, $TL::endTimeCurrent); #remove the reversed B-field $dim = removeRunsRange($dim, $TL::startRevBfld2008Runs1, $TL::endRevBfld2008Runs1); $dim = removeRunsRange($dim, $TL::startRevBfld2008Runs2, $TL::endRevBfld2008Runs2); $dim = removeRunsRange($dim, $TL::startRevBfld2008Runs3, $TL::endRevBfld2008Runs3); samListFiles($dim); $defName="ahimmel-RunIII-september-v2"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/minos/data/analysis/NuMuBar/DSTs/Data/near/cedar_phy_bhcurv/RunIII"; $N=118; $maxNumFiles="2"; submitJobsCondor($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... ## AIH Job to look at RunIII FD open data ## sub runJobRunIIIFD { my($blind)=@_; if ($blind) { &defineBaseVarsCedarSntpFarBlindSpill(); $defName="ahimmel-RunIII-cedar-far-blind"; $workLocation="/minos/data/analysis/NuMuBar/DSTs/Data/far-blind/RunIIIcedar"; } else { &defineBaseVarsCedarSntpFarSpill(); $defName="ahimmel-RunIII-cedar-far-open"; $workLocation="/minos/data/analysis/NuMuBar/DSTs/Data/far-open/RunIIIcedar"; } local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeL010z185iRunIII\n"; print "end =$TL::endTimeCurrent\n"; $dim=addDatesToDim($dim, $TL::startTimeL010z185iRunIII, $TL::endTimeCurrent); samListFiles($dim); if ($blind) { print "WARNING: These files are blinded. Take care.\n"; } $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $N=15; $maxNumFiles="40"; submitJobsCondor($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... ## AIH Job to look at RunIII Rev ND data ## sub runJobRunIIIRev { my($subPeriod)=@_; &defineBaseVarsCedar_phy_bhcurvSntpNearSpill(); #&defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim($dim,$physicalDatastreamNameLike); $defName="ahimmel-RunIII-rev"; $workLocation="/minos/data/analysis/NuMuBar/DSTs/Data/near/cedar_phy_bhcurv_rev/RunIII"; if ($subPeriod == 1) { $dim = addRunNumberRangeToDim($dim, $TL::startRevBfld2008Runs1, $TL::endRevBfld2008Runs1); $defName .= "Apr"; $workLocation .= "Apr"; } if ($subPeriod == 2) { $dim = addRunNumberRangeToDim($dim, $TL::startRevBfld2008Runs2, $TL::endRevBfld2008Runs2); $defName .= "May"; $workLocation .= "May"; } if ($subPeriod == 3) { $dim = addRunNumberRangeToDim($dim, $TL::startRevBfld2008Runs3, $TL::endRevBfld2008Runs3); $defName .= "June"; $workLocation .= "June"; } if ($subPeriod < 1 || $subPeriod > 3) { print "subPeriod $subPeriod not recognized."; } samListFiles($dim); $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion = "-" . todayDate(); #$projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $N=16; $maxNumFiles="2"; submitJobsCondor($project,$N,$workLocation,$maxNumFiles); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... sub runJobOneMonthNovDec2006 { defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimeNovDec2006\n"; print "end =$TL::endTimeNovDec2006\n"; &$dim=addDatesToDim($dim, &$TL::startTimeNovDec2006, &$TL::endTimeNovDec2006); samListFiles($dim); $defName="$user-OneMonthNovDec2006"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; # $projectVersion="V3"; $projectVersion = "-" . todayDate(); $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); # $workLocation="/afs/.fnal.gov/files/data/minos/d227/workDir/20071015/novDec2006";#curr dir $workLocation = `pwd`; chomp $workLocation; #$N=700; $N=35; $maxNumFiles="20"; submitJobsFNAL($project,$N,$workLocation,$maxNumFiles); } ##...................................................................... sub todayDate { ($MINUTE,$HOUR,$DAY, $MONTH, $YEAR) = (localtime)[1,2,3,4,5]; $YEAR += 1900; $MONTH += 1; if ($MONTH<10){$MONTH="0$MONTH"}; if ($DAY<10){$DAY="0$DAY"}; if ($HOUR<10){$HOUR="0$HOUR"}; if ($MINUTE<10){$MINUTE="0$MINUTE"}; return "$YEAR$MONTH$DAY-$HOUR$MINUTE"; } ##...................................................................... sub runJobOneMonthPreAprilShws { defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimePreAprilShws\n"; print "end =$TL::endTimePreAprilShws\n"; $dim=addDatesToDim($dim, $TL::startTimePreAprilShws, $TL::endTimePreAprilShws); samListFiles($dim); $defName="jjh-OneMonthPreAprilShws"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion="V3"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/afs/.fnal.gov/files/data/minos/d227/workDir/20071015/preAprilShws"; $N=48; submitJobsFNAL($project,$N,$workLocation,"1"); } ##...................................................................... sub runJobOneMonthPostRevBfld2007 { defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimePostRevBfld2007\n"; print "end =$TL::endTimePostRevBfld2007\n"; $dim=addDatesToDim($dim, $TL::startTimePostRevBfld2007, $TL::endTimePostRevBfld2007); samListFiles($dim); $defName="jjh-OneMonthPostRevBfld2007"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion="V2"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/afs/.fnal.gov/files/data/minos/d227/workDir/20071009/postRevB"; $N=48; submitJobsFNAL($project,$N,$workLocation,"1"); } ##...................................................................... sub runJob2 { defineBaseVarsCedar_phySntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); #defineMCVarsL010185NDaikon_00(); defineMCVarsCosmicMuDaikon_03(); #$mcVolume="1"; #$mcBeam="L150200N"; #$dim=addMCInfoToDimCarrot($dim,$mcBeam,$mcFlavor,$mcRelease,$mcSplit,$mcVolume); $dim=addMCInfoToDimDaikon($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion); samListFiles($dim); die; $defName="jjh-OneMonthPostRevBfld2007"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion="V1"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/afs/.fnal.gov/files/data/minos/d227/workDir/20071009/postRevB"; $N=48; submitJobsFNAL($project,$N,$workLocation,"1"); } ##...................................................................... sub runJob1 { defineBaseVarsCedarSntpNearSpill(); local $dim=getBaseDim($runType,$dataTier,$versionLike); $dim=addPhysicalDatastreamNameLikeToDim ($dim,$physicalDatastreamNameLike); print "start=$TL::startTimePostRevBfld2007\n"; print "end =$TL::endTimePostRevBfld2007\n"; $dim=addDatesToDim($dim, $TL::startTimePostRevBfld2007, $TL::endTimePostRevBfld2007); samListFiles($dim); $defName="jjh-OneMonthPostRevBfld2007"; $defDesc="$defName"; samCreateDefinition($dim,$defName,$defDesc); samCreateDataset($defName); $snapshotVersion="new"; $projectVersion="V1"; $project="$defName$projectVersion"; samStartProject($defName,$snapshotVersion,$project); $workLocation="/afs/.fnal.gov/files/data/minos/d227/workDir/20071009/postRevB"; $N=48; submitJobsFNAL($project,$N,$workLocation,"1"); #samListFilesOld($startTimePreAprilShws,$endTimePreAprilShws); #samListFilesOld($startTimeRevBfld2007W3,$endTimeRevBfld2007W3); } ##...................................................................... sub killJobs { $jobNumber1="450750"; $Njobs=45; bkill($jobNumber1,$Njobs); } ##...................................................................... sub bkill { my($jobNumber1,$N)=@_; local $i=0; while ($i<$N) { local $jobNumber=$jobNumber1+$i; local $bkillCmd="bkill $jobNumber"; if ($test) {print "$bkillCmd\n";} if (!$test) {system("$bkillCmd");} $i++; } die; } ##...................................................................... sub sanityCheckOnCurrentDirectory { print "\n\n"; print "Current directory is:\n"; system("pwd"); print "\n\n\n"; print " *** Is this where you want to be working? ***\n\n\n"; print "sleeping for 10 seconds...\n"; if (!$test) {system("sleep 10");} else {system("sleep 2");} } ##...................................................................... sub submitJobsFNAL { my($project,$N,$workLocation,$maxNumFiles)=@_; $wasHere = `pwd`; print "wasHere = $wasHere\n"; chdir $workLocation; sanityCheckOnCurrentDirectory(); print "Running submitJobsFNAL...\n"; $home=$ENV{"HOME"}; print "home=$home\n"; $testRel="$home/mytest"; #$queueName="-q 4hr"; #$queueName="-q minos -R \"linux24\""; #$queueName="-q 30min -R \"linux24\""; #$queueName="-q 4hr -R \"linux24\""; #$queueName="-q 4hr"; $queueName="-q minos"; $queueNameR="-R \"hname!=flxi06 & hname!=flxb10 & hname!=flxb11 & hname!=flxb35\""; $batchCmd="bsub $queueName $queueNameR"; $qstatCmd="bjobs"; $macroAna="$testRel/NuMuBar/macros/makeDstSam.C"; $loonCmd="loon -bq \'$macroAna(\"$project\",\"$maxNumFiles\")\'"; print "Using test release=$testRel\n"; print "Using macro=$macroAna\n"; print "Using work location=$workLocation\n"; print "Using queue statistics command=$qstatCmd\n"; print "Using batch command=$batchCmd\n"; $i=0; while ($i<$N) { $i2=$i; if ($i<10) {$i2="000$i";} elsif ($i<100) {$i2="00$i";} elsif ($i<1000) {$i2="0$i";} local $outFileName="Output$i2.txt"; $outFileName="$workLocation/$outFileName"; print "file name=$outFileName\n"; #just give the loonCmd on the command line $fullBatchCmd="$batchCmd -o $outFileName $loonCmd"; if ($test) {print "$fullBatchCmd\n";} if (!$test) {system("$fullBatchCmd") && die "Failed in submitting job: $!";} if (!$test) {system("sleep 1");} #leave a line print "\n\n"; $i++; } #printout the queue status if ($test) {print "$qstatCmd\n";} if (!$test) {system("$qstatCmd");} chdir $wasHere; } ##....................................................................72 sub submitJobsCondor { my($project,$N,$workLocation,$maxNumFiles)=@_; $wasHere = `pwd`; print "wasHere = $wasHere\n"; chdir $workLocation; sanityCheckOnCurrentDirectory(); print "Running submitJobsCondor...\n"; $home=$ENV{"HOME"}; $user=$ENV{"USER"}; $testRel=$ENV{"SRT_PRIVATE_CONTEXT"}; print "home=$home\n"; #$batchCmd="minos_jobsub -g -O -t $testRel -N $N -dSAM $workLocation"; $batchCmd="cd /tmp ; /opt/condor/bin/condor_submit"; $qstatCmd="condor_q -sub $user"; $init="$testRel/NuMuBar/macros/mm/SystematicsStudies/Transitions/Init.sh"; $macroAna="$testRel/NuMuBar/macros/makeDstSam.C"; $looncmd="loon -b -q \'$macroAna(\"$project\",\"$maxNumFiles\")\'"; print "Using test release=$testRel\n"; print "Using macro=$macroAna\n"; print "Using work location=$workLocation\n"; open SCRIPT, ">$workLocation/$project.sh"; print SCRIPT "#!/bin/sh\n"; print SCRIPT "cd ~\n"; print SCRIPT "source \.profile\n"; print SCRIPT "export HOME=$home\n"; print SCRIPT "source $init\n"; print SCRIPT "export workdir=$workLocation\n"; print SCRIPT "cd $workLocation\n"; print SCRIPT "$looncmd\n"; close SCRIPT; open RUN, ">$workLocation/$project.run"; print RUN "UNIVERSE = vanilla\n"; print RUN "WHEN_TO_TRANSFER_OUTPUT = ON_EXIT\n"; print RUN "\n"; print RUN "EXECUTABLE = $workLocation/$project\.sh\n"; print RUN "ARGUMENTS = \"\"\n"; print RUN "\n"; print RUN "TRANSFER_OUTPUT = true\n"; print RUN "TRANSFER_ERROR = true\n"; print RUN "TRANSFER_EXECUTABLE = false\n"; print RUN "\n"; print RUN "REQUIREMENTS = ((Arch==\"X86_64\") || (Arch==\"INTEL\"))\n"; print RUN "NOTIFICATION = ALWAYS\n"; print RUN "\n"; print RUN "REMOTE_INITIALDIR = $workLocation\n"; print RUN "LOG = $workLocation/logs/$project\_\$(Process)\.log\n"; print RUN "OUTPUT = $workLocation/logs/$project\_\$(Process)\.out\n"; print RUN "ERROR = $workLocation/logs/$project\_\$(Process)\.err\n"; print RUN "\n"; print RUN "QUEUE $N \n"; close RUN; #$fullBatchCmd="$batchCmd $project.sh"; $fullBatchCmd="ssh -ax minos25.fnal.gov \"$batchCmd $workLocation/$project.run\""; if ($test) { print "\n"; print "$project.run:\n"; system "cat $project.run"; system "rm $project.run" ; print "\n"; print "$project.sh:\n"; system "cat $project.sh"; system "rm $project.sh"; print "\n"; print "$fullBatchCmd\n"; print "$qstatCmd\n"; } if (!$test) { system "chmod a+x $project.sh"; print "$fullBatchCmd\n"; system "$fullBatchCmd"; system "$qstatCmd"; } chdir $wasHere; } ##...................................................................... sub submitJobsPTSimFNAL { my($project,$N,$workLocation,$maxNumFiles)=@_; sanityCheckOnCurrentDirectory(); print "Running submitJobsPTSimFNAL...\n"; $home=$ENV{"HOME"}; print "home=$home\n"; $testRel="$home/mytest"; #$queueName="-q 4hr"; #$queueName="-q minos -R \"linux24\""; #$queueName="-q 30min -R \"linux24\""; #$queueName="-q 4hr -R \"linux24\""; #$queueName="-q 1day -R \"linux24\""; $queueName="-q 1day"; $queueNameR="-R \"hname!=flxi06 & hname!=flxb10 & hname!=flxb11 & hname!=flxb35\""; $batchCmd="bsub $queueName $queueNameR"; $qstatCmd="bjobs"; $macroAna="$testRel/NuMuBar/macros/ptsim/ptsim_G3_eggplant.C"; $loonCmd="loon -bq \'$macroAna(\"$project\",\"$maxNumFiles\")\'"; print "Using test release=$testRel\n"; print "Using macro=$macroAna\n"; print "Using work location=$workLocation\n"; print "Using queue statistics command=$qstatCmd\n"; print "Using batch command=$batchCmd\n"; $i=0; while ($i<$N) { $i2=$i; if ($i<10) {$i2="000$i";} elsif ($i<100) {$i2="00$i";} elsif ($i<1000) {$i2="0$i";} local $outFileName="Output$i2.txt"; $outFileName="$workLocation/$outFileName"; print "file name=$outFileName\n"; $ptsimName="ptsim$i2.root"; $loonCmd="loon -bq \'$macroAna(\"$ptsimName\",\"$project\",\"$maxNumFiles\")\'"; #just give the loonCmd on the command line $fullBatchCmd="$batchCmd -o $outFileName $loonCmd"; if ($test) {print "$fullBatchCmd\n";} if (!$test) {system("$fullBatchCmd") && die "Failed in submitting job: $!";} if (!$test) {system("sleep 1");} #leave a line print "\n\n"; $i++; } #printout the queue status if ($test) {print "$qstatCmd\n";} if (!$test) {system("$qstatCmd");} } ##...................................................................... sub getBaseDim { my($runType,$dataTier,$versionLike)=@_; local $dim="run_type $runType"; $dim="$dim and data_tier $dataTier"; if ($versionLike ne "") {$dim="$dim and version like \'$versionLike\'";} #local $dim="run_type $runType and data_tier $dataTier and version like \'$versionLike\' and physical_datastream_name like \'$physicalDatastreamNameLike\' "; #local $dim="run_type $runType and data_tier $dataTier and version like \'$versionLike\'"; #print "dim=$dim\n"; return $dim; } ##...................................................................... sub addPhysicalDatastreamNameLikeToDim { my($dim,$physicalDatastreamNameLike)=@_; $dim="$dim and physical_datastream_name like \'$physicalDatastreamNameLike\' "; print "dim=$dim\n"; return $dim; } ##...................................................................... sub addRunNumberRangeToDim { my($dim,$lowNum,$highNum,)=@_; $dim="$dim and run_number>=$lowNum and run_number<=$highNum "; print "dim=$dim\n"; return $dim; } ##...................................................................... sub addMCInfoToDimDaikon { my($dim,$mcBeam,$mcBfield,$mcFlavor,$mcRelease,$mcVtxregion)=@_; #add the requirements if they exist if ($mcBeam ne "") {$dim="$dim and mc.beam=\'$mcBeam\'";} if ($mcBfield ne "") {$dim="$dim and mc.bfield=\'$mcBfield\'";} if ($mcFlavor ne "") {$dim="$dim and mc.flavor=\'$mcFlavor\'";} if ($mcRelease ne "") {$dim="$dim and mc.release=\'$mcRelease\'";} if ($mcVtxregion ne "") {$dim="$dim and mc.vtxregion=\'$mcVtxregion\'";} print "dim=$dim\n"; return $dim; } ##...................................................................... sub addMCInfoToDimCarrot { my($dim,$mcBeam,$mcFlavor,$mcRelease,$mcSplit,$mcVolume)=@_; #mc.beam='L010185', add an N for daikon $dim="$dim and mc.beam=\'$mcBeam\'"; $dim="$dim and mc.flavor=\'$mcFlavor\'"; $dim="$dim and mc.release=\'$mcRelease\'"; $dim="$dim and mc.split=\'$mcSplit\'"; $dim="$dim and mc.volume=\'$mcVolume\'"; print "dim=$dim\n"; return $dim; } ##...................................................................... sub removeRunsRange { my($dim,$startRun,$endRun)=@_; #Note the start and end times are flipped so we remove any run that #overlaps at all with the disfavoured period $dim = "$dim minus (run_number >= $startRun and run_number <= $endRun) "; return $dim; } ##...................................................................... sub removeRunsBetween { my($dim,$startTime,$endTime)=@_; #Note the start and end times are flipped so we remove any run that #overlaps at all with the disfavoured period $dim = "$dim minus (end_time >= to_date(\'$startTime\',\'yyyy-mm-dd hh24:mi::ss\') and start_time <= to_date(\'$endTime\',\'yyyy-mm-dd hh24:mi::ss\')) "; return $dim; } ##...................................................................... sub removeRunFromDim { my($dim,$runNumber)=@_; $dim = "$dim minus (run_number $runNumber)"; # print "dim=$dim\n"; return $dim; } ##...................................................................... sub addDatesToDim { my($dim,$startTime,$endTime)=@_; #print "before dates: dim=$dim\n"; $dim="$dim and start_time >= to_date(\'$startTime\',\'yyyy-mm-dd hh24:mi::ss\') and end_time <= to_date(\'$endTime\',\'yyyy-mm-dd hh24:mi::ss\') "; #print "dim=$dim\n"; return $dim; } ##...................................................................... sub samListFilesUseDim { local $samCmd="sam list files --dim=\"$dim\" "; if ($test) {print "\n$samCmd\n";} if (!$test) {system("$samCmd");} } ##...................................................................... sub samListFiles { my($dim)=@_; local $samCmd="sam list files --dim=\"$dim\" "; print "\n$samCmd\n"; system("$samCmd"); } ##...................................................................... sub samCreateDefinition { my($dim,$defName,$defDesc)=@_; local $samCmd="sam create definition"; $samCmd="$samCmd --defName=$defName"; $samCmd="$samCmd --defdesc=\"$defDesc\""; $samCmd="$samCmd --group=minos"; $samCmd="$samCmd --dim=\"$dim\" "; if ($test) {print "\n$samCmd\n";} if (!$test) {system("$samCmd");} } ##...................................................................... sub samCreateDataset { my($defName)=@_; local $samCmd="sam create dataset"; $samCmd="$samCmd --group=minos"; $samCmd="$samCmd --defName=$defName"; if ($test) {print "\n$samCmd\n";} if (!$test) {system("$samCmd");} } ##...................................................................... sub samStartProject { my($defName,$snapshotVersion,$project)=@_; #sam start project --station=minos --definitionName=jjh-bhcurvDA-all --snapshotVersion=new --project=jjh-bhcurvDA-all-1 --group=minos local $samCmd="sam start project"; $samCmd="$samCmd --station=minos"; $samCmd="$samCmd --group=minos"; $samCmd="$samCmd --defName=$defName"; $samCmd="$samCmd --snapshotVersion=$snapshotVersion"; $samCmd="$samCmd --project=$project"; if ($test) {print "\n$samCmd\n";} if (!$test) {system("$samCmd");} if (!$test) {print "Sleeping for 10 seconds to allow project time to start\n";} if (!$test) {system("sleep 10");} } ##...................................................................... sub samListFilesOld { my($startTime,$endTime)=@_; local $samCmd="sam list files --dim=\"run_type physics% and data_tier sntp-near and version like \'cedar\' and physical_datastream_name like \'spill\' and start_time >= to_date(\'$startTime\',\'yyyy-mm-dd hh24:mi::ss\') and end_time <= to_date(\'$endTime\',\'yyyy-mm-dd hh24:mi::ss\')\" "; #local $samCmd="sam list files --dim=\"run_type $runType and data_tier $dataTier and version like \'$versionLike\' and physical_datastream_name like \'$physicalDatastreamNameLike\' and start_time >= to_date(\'$startTime\',\'yyyy-mm-dd hh24:mi::ss\') and end_time <= to_date(\'$endTime\',\'yyyy-mm-dd hh24:mi::ss\')\" "; if ($test) {print "\n$samCmd\n";} system("$samCmd"); } ##...................................................................... sub defineMCVarsL010185NDaikon_00Default { $mcBeam="L010185N"; $mcBfield="1"; $mcFlavor="0"; $mcRelease="daikon_00"; $mcVtxregion="3"; #these two are carrot era $mcSplit="1"; $mcVolume="3"; } ##...................................................................... sub defineMCVarsL010185NrevDaikon_04 { print "Running defineMCVarsL010185NrevDaikon_04...\n"; defineMCVarsL010185NDaikon_00Default(); $mcBfield="4"; $mcRelease="daikon_04"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsL010185NDaikon_00 { print "Running defineMCVarsL010185NDaikon_00...\n"; defineMCVarsL010185NDaikon_00Default(); printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsL010185NDaikon_03 { print "Running defineMCVarsL010185NDaikon_03...\n"; #use D00 and then override defineMCVarsL010185NDaikon_00Default(); $mcRelease="daikon_03"; #the new bhcurv field maps use 3 and 4 (rather than 1 and 2) $mcBfield="3"; printMCVarsDaikon(); } ##...................................................................... sub defineHelium { print "Running defineHelium...\n"; $mcBeam="L010185N_helium"; } ##...................................................................... sub defineMCVarsL010185NDaikon_04 { print "Running defineMCVarsL010185NDaikon_04...\n"; #use D00 and then override defineMCVarsL010185NDaikon_00Default(); $mcRelease="daikon_04"; #the new bhcurv field maps use 3 and 4 (rather than 1 and 2) $mcBfield="3"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsL010185NFarDaikon_04 { print "Running defineMCVarsL010185NFarDaikon_04...\n"; #use D00 and then override defineMCVarsL010185NDaikon_00Default(); $mcRelease="daikon_04"; #the new bhcurv field maps use 3 and 4 (rather than 1 and 2) $mcBfield="3"; #FD only has detector vertices $mcVtxregion="1"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsCosmicMuDaikon_02 { print "Running defineMCVarsCosmicMuDaikon_02...\n"; defineMCVarsL010185NDaikon_00Default(); $mcBeam="CosmicMu"; $mcRelease="daikon_02"; $mcVtxregion="0"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsCosmicLEDaikon_02 { print "Running defineMCVarsCosmicLEDaikon_02...\n"; #use D02 and then override defineMCVarsCosmicMuDaikon_02(); $mcBeam="CosmicLE"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsCosmicMuDaikon_03 { print "Running defineMCVarsCosmicMuDaikon_03...\n"; #use D02 and then override defineMCVarsCosmicMuDaikon_02(); $mcRelease="daikon_03"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsCosmicMuDaikon_04 { print "Running defineMCVarsCosmicMuDaikon_04...\n"; #use D02 and then override defineMCVarsCosmicMuDaikon_02(); $mcRelease="daikon_04"; printMCVarsDaikon(); } ##...................................................................... sub defineMCVarsL010185Carrot_00Std { print "Running defineMCVarsL010185Carrot_00Std...\n"; $mcBeam="L010185"; #$mcBeam="L250200"; $mcFlavor="0"; $mcRelease="daikon_00"; $mcSplit="1"; $mcVolume="3"; printMCVarsCarrot(); } ##...................................................................... sub defineBaseVarsReroot { print "Running defineBaseVarsReroot...\n"; #define the variables $versionLike=""; $runType="physics%"; $dataTier="mc-far"; $physicalDatastreamNameLike=""; printBaseVars(); } ##...................................................................... sub defineBaseVarsCedarSntpFarSpillDefault { #define the variables $versionLike="cedar"; $runType="physics%"; $dataTier="sntp-far"; $physicalDatastreamNameLike="spill"; } ##...................................................................... sub defineBaseVarsCedarSntpFarSpill { print "Running defineBaseVarsCedarSntpFarSpill...\n"; defineBaseVarsCedarSntpFarSpillDefault(); printBaseVars(); } ##...................................................................... sub defineBaseVarsCedarSntpFarBlindSpill { print "Running defineBaseVarsCedarSntpFarSpill...\n"; defineBaseVarsCedarSntpFarSpillDefault(); $dataTier="bntp-far"; printBaseVars(); } ##...................................................................... sub defineBaseVarsCedar_phy_bhcurvSntpFarSpill { print "Running defineBaseVarsCedar_phy_bhcurvSntpFarSpill...\n"; defineBaseVarsCedarSntpFarSpillDefault(); $versionLike="cedar_phy_bhcurv"; printBaseVars(); } ##...................................................................... sub defineBaseVarsCedarSntpNearSpillDefault { #define the variables $versionLike="cedar"; $runType="physics%"; $dataTier="sntp-near"; $physicalDatastreamNameLike="spill"; } ##...................................................................... sub defineBaseVarsCedarSntpNearSpill { print "Running defineBaseVarsCedarSntpNearSpill...\n"; defineBaseVarsCedarSntpNearSpillDefault(); printBaseVars(); } ##...................................................................... sub defineBaseVarsCedar_phySntpNearSpill { print "Running defineBaseVarsCedarSntpNearSpill...\n"; #define then override cedar variables defineBaseVarsCedarSntpNearSpillDefault(); $versionLike="cedar_phy"; printBaseVars(); } ##...................................................................... sub defineBaseVarsCedar_phy_oldbhcurvSntpNearSpill { print "Running defineBaseVarsCedarSntpNearSpill...\n"; #define then override cedar variables defineBaseVarsCedarSntpNearSpillDefault(); $versionLike="cedar_phy_oldbhcurv"; printBaseVars(); } ##...................................................................... sub defineBaseVarsCedar_phy_bhcurvSntpNearSpill { print "Running defineBaseVarsCedarSntpNearSpill...\n"; #define then override cedar variables defineBaseVarsCedarSntpNearSpillDefault(); $versionLike="cedar_phy_bhcurv"; printBaseVars(); } ##...................................................................... sub printBaseVars { print "versionLike=$versionLike\n"; print "runType=$runType\n"; print "dataTier=$dataTier\n"; print "physicalDatastreamNameLike=$physicalDatastreamNameLike\n"; } ##...................................................................... sub printMCVarsCarrot { print "mcBeam=$mcBeam\n"; print "mcFlavor=$mcFlavor\n"; print "mcRelease=$mcRelease\n"; print "mcSplit=$mcSplit\n"; print "mcVolume=$mcVolume\n"; } ##...................................................................... sub printMCVarsDaikon { print "mcBeam=$mcBeam\n"; print "mcBfield=$mcBfield\n"; print "mcFlavor=$mcFlavor\n"; print "mcRelease=$mcRelease\n"; print "mcVtxregion\n"; } #DAIKON #ikey (key) # * (n1) Near MC # * (f2) Far MC # * (F2) Far Mock Data (MC) #itgt Interaction Region # * (0) upper atmosphere (cosmic muons only) # * (1) in detector only # * (2) in rock only # * (3) detector + rock overlayed # * (4) in detctor fiducial only (Near fiducial=planes 6 to 85, <150cm from beam center) #iflv Flavor # * (0) unoscillated (i.e. beam nu's) # * (1) nu_e # * (3) nu_tau # * (4) inverted beam (nue → numu; numu → nue) # * (9) far oscillated mock data, F2191RRRR_0000_L010185N... #B Detector Bfield # * (0) Field off # * (1) Normal Bfield # * (2) Reversed Bfield # * (3) New Normal Bfield (ND:170,171,172; FD:218,219,220) # * (4) New Reversed Bfield (ND:170,171,172; FD:218,219,220) #H Horn Position (Not target position!) # * (L) Low-energy Horn Config (Note: This includes pME, pMHE, and pHE) # * (M) Medium-energy Horn Config (Not used yet) # * (H) High-energy horn Config (Not used yet) #WWW Upstream Target z-shift (in cm) # * (010) LE -10 cm # * (100) LE -100 cm (a.k.a. pME) # * (150) LE -150 cm (a.k.a. pMHE) # * (250) LE -250 cm (a.k.a. pHE) #CCC Horn Current (-kAmps) # * (000) LE-10 horn off # * (170) Non-standard LE-10 horn current # * (185) Standard LE, LE-10 horn current # * (200) pME and pHE horn current, also non-standard LE-10 horn current #NR Sign of the horn current # * (N) Normal # * (R) Reversed #SSSSSSSS Non-NuMI Source # * (CosmicMu) Cosmic muons # * (CosmicLE) Cosmic muons (uniform 0 - 20 GeV) # * (CosmicVLE) Cosmic muons (uniform 0 - 2 GeV) # * (AtmosNu) Atmospheric neutrinos #$samCmd="sam list files --dim=\"run_type physics% and data_tier sntp-near and version like \'cedar\' and physical_datastream_name like \'spill\' and start_time >= to_date(\'$startTimeRevBfld2007W3\',\'yyyy-mm-dd hh24:mi::ss\') and end_time <= to_date(\'$endTimeRevBfld2007W3\',\'yyyy-mm-dd hh24:mi::ss\')\" "; #$samCmd="sam list files --dim=\"run_type physics% and data_tier raw-near and start_time >= to_date(\'$startTimeRevBfld2007W3\',\'yyyy-mm-dd hh24:mi::ss\') and end_time <= to_date(\'$endTimeRevBfld2007W3\',\'yyyy-mm-dd hh24:mi::ss\')\" "; #this works #$samCmd="sam list files --dim=\"run_type physics% and data_tier sntp-near and version like \'cedar_phy\' and physical_datastream_name like \'spill\' \" "; #$samCmd="echo \"run_type physics% and data_tier sntp-near and version like \'cedar_phy\' and physical_datastream_name like \'spill\' and start_time >= to_date\(\'$startTimeRevBfld2007W3\',\'yyyy-mm-dd hh24:mi::ss\'\) \""; #and start_time >= to_date(\'$startTimeRevBfld2007W3,\'yyyy-mm-dd hh24:mi::ss\') and end_time <= to_date(\'$endTimeRevBfld2007W3\',\'yyyy-mm-dd hh24:mi::ss\')\""; #print "here\n"; #if ($test) {print "$samCmd\n";} #if (!$test) {system("$samCmd");} #system("sam get metadata --file=\"n13023572_0000_L010185.sntp.R1_18_2.root\""); #system("$samCmd"); ##...................................................................... sub LoadModules { ## Load all required modules. $user=$ENV{"USER"}; print "user=$user\n"; $priv=$ENV{"SRT_PRIVATE_CONTEXT"}; print "priv=$priv\n"; $home=$ENV{"HOME"}; print "home=$home\n"; $ENV::src_dir = "$priv/NuMuBar/tools/"; $INC[@INC]=$ENV::src_dir; for $module ( qw/ timeLine.pm BadRuns.pm / ) { $cmd = "require \"$module\""; print "module=$module\n"; if ( ! eval $cmd ) { die "?Sorry I cannot run because:-\n $@\n"; } } } ##......................................................................