ECALELF  d6718b6cc30d69f18fde9018c5ae12f9d80bd7a5
Generating PU weight files

Table of Contents

PU weights can be generated following the official recipe or by the "quick and dirty" reweight using the reconstructed number of primary vertices (nPV)

In both cases what is needed is:

The files with the PU distributions should be added to the config file used by ZFitter (for more info about the config files see Config files syntax and generation)

Official recipe for PU weights

MC true PU

The MC distribution is the true PU distribution defined in the PU scenario during the MC generation. There is a python config file in CMSSW that contains the values. The files can be found in

SimGeneral/MixingModule/python 

Make sure you pick up the right file matching the PU scenario used in your MC.

The MC pileup histograms should be put on EOS in the calibration project directory:

/eos/project/c/cms-ecal-calibration/data/puHistos/  

To generate this MC Pileup root file:

cd $CMSSW_BASE/Calibration/ZFitter/;
python script/generateMCPUHist.py PileupCFI=mix_2016_25ns_SpringMC_PUScenarioV1_PoissonOOTPU_cfi output=PUSpring16-nPUtrue.root

pileup scenarios

scenario python file pileupHist root file
PUSpring16 mix_2016_25ns_SpringMC_PUScenarioV1_PoissonOOTPU_cfi.py PUSpring16-nPUtrue.root
PUMoriond17 mix_2016_25ns_Moriond17MC_PoissonOOTPU_cfi.py PUMoriond17-nPUtrue.root

True PU distribution in data

Instructions can be found in PileupJSONFileforData

In summary you need:

To generate the root file with the pileup histogram:

JSONFILE=/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/ReReco/Final/Cert_271036-284044_13TeV_23Sep2016ReReco_Collisions16_JSON.txt
PileUpJSON=/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/PileUp/pileup_latest.txt
OUTPUTFILE=271036-284044_23Sept_v1-nPUtrue.root
pileupCalc.py -i $JSONFILE --inputLumiJSON $PileUpJSON --calcMode true --minBiasXsec 69200 --maxPileupBin 50 --numPileupBins 50 $OUTPUTFILE

Using Number of Primary Vertices

The pileup histograms can simply be histograms of the nPV branch for data and MC. CAVEAT: the nPV is biased by the selection used in your sample, to reduce the data/MC difference, please apply the full selection of your analysis.

The name of the tree in the config file has to contain the string "nPV":

s   pileupHist_nPV   file.root

The files containing the histograms for the PU reweight are indicated with pileupHist as treeName and they are treated in a different way. There must be only one pileupHist for d and one for s, then the program calculates the weights for the MC, produces a temporary file with just one tree containing the weights (pileupTree) and it is added as friend to the chain of MC. You can also provide directly the "temporary" root file indicating s pileupTree file.root