Skip to content

Usage of external codes

dongjun edited this page Dec 18, 2018 · 10 revisions

This page contains descriptions of external codes in nano/external

lumiTools

The codes are src/lumiTool.c and interface/lumiTool.h.

The following code is for initialization. The file Cert_271036-284044_13TeV_PromptReco_Collisions16_JSON.txt can be changed if you want to use your own lumi JSON file.

// lumiTool m_lumi; is already given above
string env = getenv("CMSSW_BASE");
string lumi = env+"/src/nano/analysis/data/Cert_271036-284044_13TeV_PromptReco_Collisions16_JSON.txt";
m_lumi = new lumiTool(lumi);

This code is from nano/analysis/src/nanoBase.cc. We already have this in the constructor of nanoBase class (into m_lumi). Once you run the above and keep m_lumi, in your event loop you can reject events not in the JSON file as following:

for ( [EVENT LOOP] ) {
  // run and luminosityBlock are given in nanoBase class
  if ( !( m_lumi->LumiCheck(run, luminosityBlock) ) ) continue;
  ...
}

pileupTool

Calculator of pile-up weight. The codes are src/pileUpTool.cc and interface/pileUpTool.h. This calculator is adjusted to Moriond17 MC/RD.

Initialization is done by just one line;

pileUpTool *m_pileUp;
m_pileUp = new pileUpTool();

It is already called in the constructor of nanoBase. It is also easy to get the pile-up weight. The following is enough:

// If you want to evaluate uncertainty, change the second parameter to +1 or -1
b_puweight = m_pileUp->getWeight(Pileup_nTrueInt, 0); // Pileup_nTrueInt is provided in the nanoBase class

How to set the numbers in this module

Although the usage is quite easy, the numbers in src/pileUpTool.cc, contained in four arraries pileUpTool::Moriond17MC, pileUpTool::Moriond17RD, pileUpTool::Moriond17RD_up, pileUpTool::Moriond17RD_dn, come from somewhat complicated paths. The origin of the MC array is somewhat simple; see mix.input.nbPileupEvents.probValue in https://github.com/cms-sw/cmssw/blob/master/SimGeneral/MixingModule/python/mix_2016_25ns_Moriond17MC_PoissonOOTPU_cfi.py, as following https://twiki.cern.ch/twiki/bin/view/CMS/PdmVPileUpDescription#Startup2015 (although this page is for 2015 MC/data, the prescription still works).

The RD tables are somewhat complicated. The way for this is described in here. According to this page, first, we need the JSON file containing informations for pileup. The file is /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/PileUp/pileup_latest.txt (you can find it in lxplus). Then, the following command will give a root file:

pileupCalc.py -i [Cert_..._Collision16_JSON.txt] --inputLumiJSON pileup_latest.txt  --calcMode true --minBiasXsec 69200 --maxPileupBin 75 --numPileupBins 75  [A_NANE_YOU_WANT].root

The lumi JSON file [Cert_..._Collision16_JSON.txt] can be found in nano/analysis/data if you ran getFiles. Since the 'pileup' number is an integer, maxPileupBin and numPileupBins have to be same. (In the given table the number of bins is 75, so I gave same). This command will create [A_NANE_YOU_WANT].root, which contains a histogram. Each of bin contents is the number in the RD table.

On the other hand, minBiasXsec is the measured cross section of MinBias events in 2016, which is 69.200 mb +- 5%. (In the CATTools, 69.000 mb is used; see sec. Dataset selections in here.) The uncertainty from pileup is estimated by giving the cross section which got up (69.200 mb + 5% = 72.660 mb) and down (69.200 mb - 5% = 65.740 mb). The RD_up and RD_dn tables are filled by the bin contents of them.

TopTriggerSF

In the interface
There is computeTrigSF(lepton1, lepton2, direction = central:0 or up:1 or down:-1)
we enter lepton1 and lepton 2 to the computeTrigSF,
sumId will be checked like this abs(lepton1.PdgCode()) + abs(lepton2.PdgCode())
11+11 = ee channel, 13+13 = mumu channel, else = emu channel.
aeta1 = abs(lepton1.Eta()), aeta2 = abs(lepton2.Eta())

and then, return lepton trigger weight for each Eta.

if ( channel == CH_ELEL ) {
    if ( aeta1 < 0.3 ) {
      if      ( aeta2 < 0.3 ) return 0.965 + direction*0.010;
      else if ( aeta2 < 0.6 ) return 0.989 + 0.5*direction*0.007;
      else if ( aeta2 < 1.2 ) return 1.003 + 0.5*direction*0.004;
      else if ( aeta2 < 1.7 ) return 0.990 + 0.5*direction*0.010;
      else if ( aeta2 < 2.4 ) return 0.997 + 0.5*direction*0.011;
    }
    else if ( aeta1 < 0.6 ) {
      if      ( aeta2 < 0.3 ) return 0.981 + direction*0.007;
      else if ( aeta2 < 0.6 ) return 0.972 + 0.5*direction*0.009;
      else if ( aeta2 < 1.2 ) return 0.990 + 0.5*direction*0.005;
      else if ( aeta2 < 1.7 ) return 1.000 + 0.5*direction*0.007;
      else if ( aeta2 < 2.4 ) return 0.997 + 0.5*direction*0.011;
    }

...

    else if ( aeta1 < 2.4 ) {
      if      ( aeta2 < 0.3 ) return 1.005 + direction*0.013;
      else if ( aeta2 < 0.6 ) return 0.995 + 0.5*direction*0.016;
      else if ( aeta2 < 1.2 ) return 0.989 + 0.5*direction*0.011;
      else if ( aeta2 < 1.7 ) return 0.985 + 0.5*direction*0.018;
      else if ( aeta2 < 2.4 ) return 0.996 + 0.5*direction*0.014;
    }
  }

CH_MUMU and CH_MUEL are calculated, also.

BTagCalibration

Clone this wiki locally