Skip to content
pequegnot edited this page Jan 28, 2014 · 9 revisions

How-to use and run Pat

Once Pat has been setup, following the instructions here, you can start using the tool as indicated below.

Specify the datasets you want to run on

src> cd PatTopProduction/configs

First create a JSON file containing the list of the datasets you want to run on and the corresponding working directory for crab:

For MC:

{
    "/myDataset1": "myWorkingDirName1", 
    "/myDataset2": "myWorkingDirName2"
}

For data: You also have to specify the globalTag and the run range:

{
  "/myDataset1": {
    "name": "myWorkingDirName1",
    "global_tag": "myGlobalTag1",
    "run_range": [low1, up1]
  },
  "/myDataset2": {
    "name": "myWorkingDirName2",
    "global_tag": "myGlobalTag2",
    "run_range": [low2, up2]
  },
}

Run your code with crab

configs> cd ..

Create your crab configuration files .cfg and submit your jobs by running the following command:

for MC:

PatTopProduction> ./createAndRunMCCrab.py /configs/myMCJSONFile.json --run

for data:

PatTopProduction> ./createAndRunDataCrab.py /configs/myDataJSONFile.json --run

Once your crab jobs are done

First, retrieve your jobs:

PatTopProduction> crab -get -c myWorkingDir

Then, publish your datasets:

PatTopProduction> crab -publish -c myWorkingDir

Especially for MC

You can compute the real number of processed events (which can be different from the number of generated AOD events or the number of events at the end of Pat obtained by the crab -publish command) using the following command:

PatTopProduction> curl -o crabNumberOfProcessedEvents.py https://raw.github.com/blinkseb/cms-utilities/master/crabNumberOfProcessedEvents.py
PatTopProduction> crabNumberOfProcessedEvents.py myWorkingDir

Especially for data

Luminosity

You can compute the equivalent luminosity following these instructions. First, you have to generate your /res/lumiSummary.json file:

PatTopProduction> crab -report -c myWorkingDir

Then compute the luminosity:

PatTopProduction> pixelLumiCalc.py -i /<path>/myWorkingDir/res/lumiSummary.json overview

Remark:

Finally, you can merge all the json files thus obtained using the mergeJSON.py script:

Usage: mergeJSON.py alpha1.json [alpha2.json:142300-145900]

Options:

-h, --help show this help message and exit

--output=OUTPUT Save output to file OUTPUT

For example:

PatTopProduction> mergedJSON.py myWorkingDir1/res/lumiSummary.json myWorkingDir2/res/lumiSummary.json

You can then use the merged json file to compute the prescale factor of a given HLT trigger. For example, if you are interested in HLT_PFJet200 trigger, execute this command:

PatTopProduction> pixelLumiCalc.py recorded -i mergedLumiSummaryData.json --hltpath "HLT_PFJet200_*"

Pileup profile

You can get the pileup profile from the data PAttuples as follows:

PatTopProduction> curl -O https://cms-service-dqm.web.cern.ch/cms-service-dqm/CAF/certification/Collisions12/8TeV/PileUp/pileup_latest.txt  
PatTopProduction> pileupCalc.py -i myWorkingDir1/res/lumiSummary.json --inputLumiJSON pileup_latest.txt --calcMode true --minBiasXsec 69400 --maxPileupBin 80 --numPileupBins 80 MyDataPileupHistogram_1.root

If you have several datasets, repeat the command for the over working directories and merge all the final histogramms:

PatTopProduction> hadd MyFinalDataPileupHistogram MyDataPileupHistogram_1.root MyDataPileupHistogram_2.root