Child pages
• Drell-Yan Analysis Procedure 2011

Page History

Key

• This line was removed.
• Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

...

...

...

Procedure

This twiki documents the most important steps of the Drell-Yan

...

cross

...

section

...

measurement.

...

It

...

is

...

intended

...

to

...

familiarize

...

you

...

with

...

the

...

technical

...

aspects

...

of

...

the

...

analysis

...

procedure.

...

At

...

the

...

end

...

of

...

each

...

section

...

there

...

is

...

a

...

set

...

of

...

questions

...

and

...

exercises.

...

Note,

...

the

...

software

...

and

...

samples

...

evolve

...

very

...

frequently

...

so

...

some

...

parts

...

of

...

the

...

page

...

will

...

get

...

obsolete

...

soon

...

!

...

...

...

...

Step 3: Event Selection

Once the ntuples are ready, one can proceed to the actual physics analysis. The first step of every analysis is the event selection. Currently, we use the so-called cut-based approach to discriminate between signal and background. For more on event selection please read chapter 3 in the analysis note CMS-AN-11-013

...

.

...

Before

...

starting

...

to

...

run

...

a

...

macro,

...

set

...

up

...

the

...

working

...

area.

...

Find

...

all

...

the

...

necessary

...

scripts

...

in:

...

}
Code Block
```UserCode/Purdue/DYAnalysis/NtupleMaker/interface
UserCode/Purdue/DYAnalysis/NtupleMaker/ntuples
{code}
```

and

...

precisely

...

follow

...

the

...

recipe

...

below

...

preserving

...

folder

...

structure

...

recommended

...

in

...

the

...

recipe:

...

Code Block
```1. copy the Ntuples in rootfiles directory, splitting by trigger path used at the level of skimming (as we might use a combination!): e.g. rootfiles/HLT_Mu15/

2. modify the createChain.pl file

cd rootfiles
vim createChain.pl

change this to the full path to your rootfiles directory:
\$dir = "/work/asvyatko/Work/DYanalysis/dataAnalysis10/analysis/rootfiles";
choose the trigger scenario you wish to use:
\$trig = "HLT_Mu15"; // trigger name (directory name)

Run the shell script:
./Chains.csh

then all chain_* files will be created in the roorfiles directory.
{code}
* After you are done with creating chains (I assume you are in ./rootfiles directory) do:

{code}```
• After you are done with creating chains (I assume you are in ./rootfiles directory) do:
Code Block
```cd ..
cvs co -d ControlPlots UserCode/Purdue/DYAnalysis/AnalysisMacros/ControlPlots
cd ControlPlots
#note: for the sake of convenience add the alias for this directory in your ~/.profile, like:
#CONTROL_PLOTS_DIR=/whatever.is/the/absolte_path
#export CONTROL_PLOTS_DIR
{code}
```

Before

...

running

...

the

...

macros,

...

we

...

need

...

to

...

fix

...

few

...

things

...

which

...

are

...

changing

...

frequently

...

for

...

our

...

analysis:

...

• Mass

...

• range

...

• and

...

• binning:

...

• for

...

• the

...

• early

...

• stage

...

• of

...

• 2011

...

• analysis

...

• we

...

• keep

...

• the

...

• 2010

...

• binning

...

• [15,20,30,40,50,60,76,86,96,106,120,150,200,600

...

• ]

...

• Trigger

...

• selection:

...

• See

...

• the

...

• presentation

...

• on

...

• event

...

• selection

...

• for

...

• 2011
• Thus, for 2011 we consider a combination of Double muon trigger and a combination of single isolated muon triggers can be used as a cross-check. Use three following combinations:
• HLT_Mu15, HLT_Mu24, HLT_Mu30
• HLT_IsoMu15, HLT_IsoMu17, HLT_IsoMu24
• DoubleMu6, DoubleMu7, Mu13_Mu8
• Offline selection: Baseline event selection has not changed compared to 2010 analysis, see
• we will consider moving to PF muons and PF isolation: this study is in progress right now

To produce the invariant mass plot do use the analyse2.C macro, which calls the TSelector for the DY analysis (called EventSelector):

Code Block
```root -l analyse2.C
{code}

The macro allows to run on multiple cores.

By performing minor changes inside the EventSelector one can calculate the efficiency weighted invariant mass distribution (which is used to estimate the corection factor as a function of invariant mass). Inside the EventSelector.C set

{panel}
\#define ```

The macro allows to run on multiple cores.

By performing minor changes inside the EventSelector one can calculate the efficiency weighted invariant mass distribution (which is used to estimate the corection factor as a function of invariant mass). Inside the EventSelector.C set

Panel

#define CORRECT_FOR_EFF

true

<

\

-

change

to

true

if

you

want

to

use

it

for

efficiency

correction

estimation

\

#define

CORRECTION_TYPE

"trig"

<

\

-

choose

the

efficiency

type

recoid,

iso

or

trig

{panel}

To

...

produce

...

dimuon

...

kinematic

...

distributions

...

run

...

Code Block
```root -l TransMomentum.C++
root -l Rapidity.C++
{code}
```

To

...

produce

...

other

...

control

...

plot

...

(for

...

all

...

the

...

event

...

selection

...

variables

...

used

...

in

...

the

...

analysis,

...

as

...

documented

...

in

...

the

...

note),

...

use:

...

Code Block
``` root -l ControlPlots.C++
{code}
```

There

...

are

...

few

...

macros

...

that

...

help

...

us

...

to

...

optimize

...

the

...

cuts.

...

These

...

macros

...

calculate

...

the

...

statistical

...

significance

...

and

...

the

...

uncertainty

...

on

...

the

...

cross-section.

...

Statistical

...

significance

...

is

...

defined

...

as

...

:

...

S

...

=

...

N_sig/sqrt(N_sig+N_bkg)

...

and

...

normally

...

determined

...

from

...

MC.

...

As

...

you

...

can

...

infer,

...

it

...

scales

...

with

...

luminosity

...

as

...

~sqrt(Lumi).

...

There

...

are

...

other

...

definitions

...

of

...

significance

...

used

...

in

...

the

...

analyses

...

sometimes

...

(see

...

for

...

instance

...

CMS-TDR).

...

To

...

run,

...

check

...

out

...

just

...

two

...

...

macros

...

(I

...

assume

...

you

...

didn't

...

leave

...

./ControlPlots

...

directory)

...

Code Block
```cvs co UserCode/Purdue/DYAnalysis/NtupleMacro/AsymmetricCutStudy/OfflineSelection.C
cvs co UserCode/Purdue/DYAnalysis/NtupleMacro/AsymmetricCutStudy/graphStats.C
root -l OfflineSelection.C++
root -l graphStats.C++
{code}
```

The

...

first

...

macro

...

will

...

create

...

a

...

txt

...

file

...

with

...

an

...

per

...

mass

...

bin

...

values

...

of

...

signal

...

and

...

background.

...

The

...

second

...

macro

...

will

...

histogram

...

the

...

output.

...

These

...

macros

...

are

...

...

to

...

optimize

...

the

...

acceptance

...

cuts,

...

but

...

with

...

minimal

...

changes

...

it

...

can

...

optimize

...

any

...

other

...

cut

...

we

...

use,

...

and

...

it

...

is

...

possible

...

to

...

change

...

style

...

to

...

conform

...

with

...

the

...

rest

...

of

...

plots

...

in

...

the

...

note.

...

Note:

...

root

...

doesn

...

not

...

create

...

output

...

directories

...

by

...

itself

...

so

...

you

...

should

...

create

...

a

...

corresponding

...

directory

...

for

...

output

...

txt

...

files

...

like:

...

}
Code Block
``` mkdir my_output_dir_for_macro1
{code}

```

Q1:

...

Check

...

data/MC

...

agreement

...

for

...

each

...

plot,

...

look

...

for

...

discrepancies.

...

Checkpoint1 With the macros described above you should be able to *reproduce* following plots from the CMS-AN-11-013:

...

1,3-14,

...

17-29,51.

...

Note:

...

for

...

the

...

23,25-29

...

macros

...

have

...

different

...

style

...

and

...

were

...

produce

...

with

...

PU

...

sample.

...

Note:

...

plots

...

20-22

...

are

...

reproducible

...

by

...

optimization

...

macros

...

but

...

have

...

different

...

style.

...

...

...

Another ... constituent ... of ... the ... cross-section ... measurement ... is ... the ... acceptance....Acceptance ... is ... determined ... using ... GEN ... level ... information, ... so ... that ... the ... generation ... of ... MC ... is ... not ... crucial...Use ... the ... acceptance ... numbers ... documented ... in ... the ... note ... to ... save ... time: ...CMS-AN-11-013...Below ... are ... some ... additional ... details ... on ... the ... acceptance ... calculation ... which ... might ... be ... necessary ... if ... the ... procedure ... will ... change....We ... use ... POWHEG ... NLO ... acceptance, ... see ... all ... the ... relevant ... formulas ... in ... this ...talk... (the ... updated ... version), ... see ... slide18 ... for ... acceptance ... definitions ... and ... refer ... to ... earlier ... talks. ... Di\ue ... to ... the ... intrinsic ... discrepancies ... in ... the ... modeling ... between ... the ... POWHEG ... and ... FEWZ ... we ... correct ... the ... Z ... kinematics. ... For ... that, ... we ... extract ... the ... weight ... maps ... from ... POWHEG ... at ... NLO ... and ... from ... FEWZ ... at ... NNLO ... (to ... be ... more ... specific ... it ... is ... at ... NNLO ... below ... 40 ... GeV ... and ... NLO ... otherwise, ... as ... the ... effect ... of ... higher ... order ... corrections ... is ... negligible ... at ... the ... higher ... masses). ... The ... weight ... map ... is ... essentially ... the ... ratio ... of ... double ... inclusive ... cross-sections ... extracted ... from ... POWHEG ... and ... FEWZ ... per ... PT-Y ... bin ... (PT, ... Y ... refer ... to ... Z ... kinematics, ... which ... is ... identical ... here ... to ... dimuon ... kinematics, ... our ... final ... aim). ... Details ... on ... the ... re-weighting ... technique ... are ... also ... in ... the ... linked ... presentation....How to run:To setup area do: Code Block```cd \$CMSSW_RELEASE_BASE/src cvs co -r V00-09-11 SUSYBSMAnalysis/Zprime2muAnalysis (38x analysis) # for 41x or higher, use V00-10-09 cmsenv SUSYBSMAnalysis/Zprime2muAnalysis/setup.csh # This last command checks # out other packages and # executes scramv1 b to # compile everything. cvs co UserCode/Purdue/DYAnalysis/AcceptanceAdam #rearrange stuff a little bit cp UserCode/Purdue/DYAnalysis/AcceptanceAdam/* . {code} h6. First ```

...

...

...

...

//description

...

to

...

be

...

...

-

...

I

...

will

...

...

...

But

...

actually

...

we

...

switched

...

to

...

Purdue

...

ntuples

...

so

...

this

...

section

...

is

...

obsolete....

...

...

...

...

...

...

maps.

...

Inspect

...

the

...

countxsec.py

...

script

...

in

...

the

...

directory.

...

What

...

it

...

does

...

is

...

following:

...

It

...

takes

...

hard

...

interaction

...

ntuple

...

produced

...

on

...

the

...

previous

...

step,

...

which

...

contains

...

the

...

gen

...

level

...

information

...

...

the

...

hard

...

collision

...

and

...

produces

...

the

...

2D

...

histogram

...

in

...

the

...

bins

...

of

...

dimuon

...

Pt-Y

...

for

...

each

...

mass

...

bin,

...

as

...

well

...

as

...

3

...

auxiliary

...

histograms

...

with

...

mass

...

spectrum

...

pre-FSR

...

(after

...

acceptance

...

cuts,

...

marked

...

with

...

'num').

...

The

...

only

...

part

...

which

...

is

...

expected

...

to

...

be

...

configured

...

frequently

...

is

...

the

...

mass,

...

Pt,

...

Y

...

binning

...

everything

...

else

...

is

...

fixed.

...

(Note

...

that

...

right

...

now

...

the

...

input

...

can

...

also

...

be

...

set

...

to

...

Purdue

...

ntuple

...

!

...

!)

...

To test the script locally on few hundred of events do:

Code Block
```python countxsec.py --s 1667 --n 20000000 --w 1.0 --sg DYM1020/a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_9_1_WaI/zp2mu_histos.root
{code}
```

To

...

submit

...

the

...

batch

...

script

...

on

...

full

...

statistics,

...

use

...

the

...

farmaout

...

scripts

...

and

...

the

...

local

...

batch

...

system:

...

Code Block
```cd /home/ba01/u112/aeverett/scratch_rcac/20112011/DYM1020 //(don't really have to CD there but change all dirs accordingly)

farmoutAnalysisJobsPyList.sh bob \$CMSSW_BASE /home/ba01/u112/aeverett/scratch_rcac/20112011/countxsec.py --skip-srmcp
--submit-dir=\$PWD/xsec04w1_new --input-files-per-job=1  --assume-input-files-exist --input-file-list=\$PWD/inFileList.txt
--input-dir=\$PWD/ --python-arguments="--s 3320.0 --n 9630633.0 --w 1.0 " # --w 6.06" #9780633 in DBS but only 9630633 in a2_2011 directory
{code}
```

here,

...

'bob'

...

is

...

a

...

random

...

name

...

for

...

a

...

batch

...

job,

...

inFileList.txt

...

is

...

a

...

list

...

of

...

files

...

to

...

run

...

on,

...

it

...

has

...

the

...

format:

...

}
Code Block
```a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_10_1_Ky5/zp2mu_histos.root
a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_11_1_l3o/zp2mu_histos.root
a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_12_1_xFB/zp2mu_histos.root
a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_13_1_hlY/zp2mu_histos.root
a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_14_1_Ufv/zp2mu_histos.root
....
{code}
```

i.e.

...

the

...

absolute

...

path

...

to

...

file

...

from

...

withi

...

DYM1020

...

directory.

...

The

...

contents

...

of

...

the

...

directory

...

can

...

look

...

something

...

like

...

this:

...

drwxr-xr-x

...

71

...

asvyatko

...

phys

...

10240 Nov  1 13:02

...

a2_2011

...

-rwxr-xr-

...

1

...

asvyatko phys  6257 Nov  2 12:53

...

cmsRun.sh

...

-rwxr-xr-

...

1

...

asvyatko

...

phys

...

17621 Nov  2 12:52

...

farmoutAnalysisJobsPyList.sh

...

rw-r

...

r-

...

1 asvyatko phys  4752 Nov  2 12:48

...

inFileList.txt

...

drwxr-xr-

...

2

...

asvyatko phys  2048 Nov  2 12:33

...

xsec04w1_new

...

The

...

submission

...

directory

...

should

...

not

...

exist,

...

otherwise

...

you

...

get

...

an

...

error.

...

Note:

...

you

...

obviously

...

do

...

not

...

want

...

to

...

recalculate

...

the

...

weights,

...

numbers

...

of

...

events

...

for

...

each

...

stepwise

...

DY

...

sample.

...

For

...

Summer11

...

the

...

numbers

...

are

...

...

available

...

here:

...

...

But

...

for

...

Fall11

...

I

...

will

...

have

...

to

...

recalculate

...

it

...

and

...

update

...

the

...

corresponding

...

file.

...

...

...

...

weights

...

To

...

make

...

weights

...

one

...

needs

...

to

...

run

...

following:

...

Code Block
```python makeweights.py
{code}
```

The

...

weights

...

referred

...

here

...

are

...

the

...

FEWZ-POWHEG

...

cross

...

section

...

ratios

...

per

...

Pt-Y

...

bin

...

(see

...

one

...

of

...

the

...

...

presentations).

...

What

...

the

...

script

...

does

...

is

...

essentially

...

following:

...

it

...

takes

...

the

...

POWHEG

...

Pt-Y

...

maps

...

produced

...

on

...

the

...

previous

...

step,

...

takes

...

the

...

FEWZ

...

Pt-Y

...

maps

...

(which

...

are

...

produced

...

by

...

Alexey

...

and

...

usually

...

latest

...

are

...

found

...

here:

...

...

the

...

file

...

starting

...

with

...

map2D_*.root),

...

and

...

just

...

divides

...

it

...

bin

...

by

...

bin

...

using

...

the

...

my_divide

...

function

...

(this

...

is

...

a

...

clopper-pearson

...

divide).

...

Complications:

...

there

...

is

...

a

...

set

...

of

...

parameters

...

and

...

input

...

files

...

which

...

is

...

configures

...

inside

...

the

...

script.

...

First

...

of

...

all

...

POWHEG

...

input

...

files:

...

}
Code Block
```## ADAM for NNLO
#Get the files with POWHEG maps with fine Pt binning
fileIn10fine=ROOT.TFile("DYM1020/xsec04w1_newFine/powheg_xs_full_04_2011.root")
#coarse Pt binningfileIn10  = ROOT.TFile( "DYM1020/xsec04w1_new/powheg_xs_full_04_2011.root")
#fine Pt binningfileIn20fine=ROOT.TFile("DYM20/xsec04w1_newFine/powheg_xs_full_04_2011.root")
#coarse Pt binningfileIn20  = ROOT.TFile( "DYM20/xsec04w1_new/powheg_xs_full_04_2011.root")
fileIn200 = ROOT.TFile(  "DYM200/xsec04w1_new/powheg_xs_full_04_2011.root")
fileIn500 = ROOT.TFile(  "DYM500/xsec04w1_new/powheg_xs_full_04_2011.root")
fileIn1000 = ROOT.TFile("DYM1000/xsec04w1_new/powheg_xs_full_04_2011.root")
{code}
```

There

...

are

...

multiple

...

input

...

files,

...

because

...

we

...

use

...

STEPWISE

...

DY

...

samples,

...

they

...

are

...

split

...

in

...

generator

...

mass.

...

On

...

the

...

other

...

hand,

...

we

...

fix

...

the

...

Pt-Y

...

binning

...

on

...

the

...

previous

...

step,

...

so

...

that

...

if

...

we

...

decide

...

to

...

play

...

around

...

with

...

binning

...

we

...

need

...

to

...

provide

...

a

...

different

...

input

...

file

...

(you

...

can

...

see

...

fileIn10fine

...

and

...

fileIn10

...

for

...

instance).

...

The

...

parameter

...

finePtBins

...

controls

...

the

...

number

...

of

...

first

...

mass

...

bins

...

which

...

will

...

use

...

fine

...

binning.

...

Secondly,

...

FEWZ

...

input

...

files:

...

this

...

are

...

also

...

hardcode

...

inside

...

the

...

script,

...

because

...

multiple

...

versions

...

exist

...

(differing

...

by

...

Vegas

...

integration

...

precision

...

and

...

NNLO/NLO

...

order).

...

The

...

parameter

...

nnloInBins

...

controls

...

the

...

amount

...

of

...

first

...

mass

...

bins

...

in

...

which

...

we

...

have

...

NNLO.

...

The

...

output

...

of

...

the

...

script

...

is

...

DYMoutput/weights_stepwise_precision10-5_fine12.root

...

-

...

the

...

file

...

with

...

histograms

...

with

...

weights

...

and

...

errors.

...

...

...

...

...

...

...

...

...

...

!)

...

Inspect

...

the

...

countcorracc.py

...

script

...

in

...

the

...

directory.

...

What

...

it

...

does

...

is

...

following:

...

...

To test the script locally on few hundred of events do:

Code Block
```python countcorracc.py --r DYMoutput/fewz_powheg_weights_stepwise_2011_fine12.root --o
fewz_powheg_corracc_2011 --n 5.78216 --s 3320.0 --e 9630633.0 --l 15 --h 20
--sg DYM1020/a2_2011/AcceptanceFromPAT_2011_mapcfg-pat_9_1_WaI/zp2mu_histos.root
{code}
```

Note

...

that

...

again

...

one

...

has

...

to

...

run

...

a

...

separate

...

job

...

on

...

each

...

of

...

the

...

stepwise

...

DY

...

samples.

...

And

...

the

...

weights,

...

event

...

numbers

...

and

...

cross

...

section

...

passed

...

as

...

an

...

argument

...

would

...

have

...

to

...

be

...

different

...

for

...

each

...

sample.

...

To

...

submit

...

a

...

batch

...

job

...

do:

...

}
Code Block
``` cd /home/ba01/u112/aeverett/scratch_rcac/20112011/DYM1020

farmoutAnalysisJobsPyList.sh bob \$CMSSW_BASE /home/ba01/u112/aeverett/scratch_rcac/20112011/countcorracc.py
--skip-srmcp --submit-dir=\$PWD/corracc_stepwise_coarse7b --input-files-per-job=1  --assume-input-files-exist
--input-file-list=\$PWD/inFileList.txt --input-dir=\$PWD/ --python-arguments="
--r /home/ba01/u112/aeverett/scratch_rcac/20112011/DYMoutput/fewz_powheg_weights_stepwise_2011_coarse7.root
--o fewz_powheg_corracc_2011 --n 5.78216 --s 3320.0 --e 9630633.0 --l 15 --h 20"
{code}
```

The

...

tricky

...

part

...

...

this

...

script

...

is:

...

...

...

...

old

...

One

...

needs

...

to

...

configure

...

pT

...

and

...

eta

...

cuts

...

for

...

each

...

muon

...

in  the script.

...

This

...

is

...

done

...

very

...

easily

...

in

...

two

...

places:

...

}
Code Block
```if input_is_MC:
from UserCode.Examples.inclusiveMuonPlotsGENSIM_cfi import makeInclusiveMuonPlots;
commonInputs = cms.PSet(
muons     = cms.InputTag('cleanPatMuonsTriggerMatch'),
particleSrc = cms.InputTag('prunedGenSimLeptons'), #genParticles
dilepton_src = cms.InputTag('dimuons'), #('dimuons'), #('dyz'),
primaryVertices = cms.InputTag("offlinePrimaryVertices"),
weight = cms.untracked.double(1.0),
eta_acc1 = cms.untracked.double(2.4),
eta_acc2 = cms.untracked.double(2.4),
pt_acc1 = cms.untracked.double(15.0),
pt_acc2 = cms.untracked.double(10.0),
mother = cms.untracked.int32(23),#Z: 23, ZPrime: 32
daughter = cms.untracked.int32(13),
daughterStatus = cms.untracked.int32(1),
)
{code}
```

And

...

here:

...

}
Code Block
```loose_cut = 'isGlobalMuon && isTrackerMuon && ' \
'pt > 10. && ' \
'abs(eta) < 2.4 && ' \
'abs(dB) < 0.2 && ' \
'(isolationR03.sumPt + isolationR03.hadEt) / pt < 0.15 && ' \
'globalTrack.hitPattern.numberOfValidTrackerHits > 10 && ' \
'globalTrack.hitPattern.numberOfValidPixelHits > 0 && ' \
'globalTrack.hitPattern.numberOfValidMuonHits > 0 && ' \
'numberOfMatches > 1 && ' \
'globalTrack.normalizedChi2 < 10 ' # + trigger_match
{code}
```

To

...

configure

...

the

...

trigger

...

path

...

for

...

trigger

...

match:

...

}
Code Block
```trigger_match = ' && (' \
'!triggerObjectMatchesByPath("HLT_Mu15_*").empty()' \
')'
{code}

```

To

...

calculate

...

the

...

acceptance

...

as

...

a

...

function

...

of

...

invariant

...

mass:

...

}
Code Block
``` python AcceptanceFromPAT_a2_mapcfg.py
{code}

```

Next,

...

produce

...

histograms

...

for

...

invariant

...

mass

...

and

...

Z/lepton

...

kinematics

...

you

...

will

...

use

...

to

...

calculate

...

the

...

acceptance:

...

}
Code Block
``` root -l macroAcceptance.C
{code}
```

To

...

draw

...

the

...

plots

...

execute:

...

}
Code Block
```root -l macroDrawHwidongAcc.C
{code}
```

Weight

...

map

...

producer

...

uses

...

the

...

FEWZ

...

acceptance

...

as

...

the

...

input,

...

find

...

all

...

the

...

macros

...

here:

...

/UserCode/ASvyatkovskiy/FEWZ_scripts,

...

to

...

work

...

one

...

needs

...

to

...

do:

...

}
Code Block
```cd \$RCAC_SCRATCH/  #better to do it on scratch
cp -r /home/ba01/u115/asvyatko/TEST_FEWZ/FEWZ_2.0.1.a3/ YOUR_FEWZ_WORKING_DIR
cvs co -d TMP /UserCode/ASvyatkovskiy/FEWZ_scripts
cp TMP/* .
rm -r TMP
{code}
```

To

...

produce

...

the

...

cross

...

section

...

in

...

mass

...

bins

...

run

...

Code Block
```python nu_createInputFEWZ_mod_multiple.py
{code}

```

Note:

...

before

...

running

...

you

...

need

...

to

...

...

the

...

order

...

of

...

calculation

...

and

...

the

...

input/output

...

directories

...

and

...

also

...

the

...

PDF

...

set

...

you

...

want

...

to

...

use,

...

which

...

is

...

all

...

done

...

in

...

the

...

top

...

of

...

the

...

script:

...

}
Code Block
``` #input: binning file, pdf sets, order, number of processors and path to working dir
mass_cuts = open('input_massesPlus.txt','r')
pdfsets = ['MSTW2008NLO'] #['CTEQ66','CTEQ10','NNPDF20','MSTW2008NLO']
order = 'NLO'
nprocs = 1
path_to_wd = '/scratch/scratch95/a/asvyatko/NU_FEWZ/WorkingDir_NLO_400Plus'

mass_cuts.close()
pattern = r'(\d+\.\d*|\.\d+)(d0)'
pattern2 = r'(\'\s\d?)'
pdf_pattern = r'(CTEQ66|CTEQ10|NNPDF20|MSTW2008.*O)'
{code}
```

to

...

get

...

the

...

output

...

of

...

the

...

jobs

...

use

...

corresponding

...

get-output

...

scripts:

...

}
Code Block
```python nu_getOutputFEWZ_multiple.py
{code}

```

Which

...

requires

...

analogous

...

...

before

...

use:

...

}
Code Block
```#input: binning file, pdf sets, order, number of processors and path to working dir
mass_cuts = open('input_massesPlus.txt','r')
pdfsets = ['MSTW2008NLO'] #['CTEQ66','CTEQ10','NNPDF20','MSTW2008NLO']
order = 'NLO'
nprocs = 1
path_to_wd = '/scratch/scratch95/a/asvyatko/NU_FEWZ/WorkingDir_NLO_400Plus'
run = ''
acc = '' #acc21_, acc24_
{code}
```

After

...

the

...

maps

...

are

...

...

and

...

saved

...

in

...

the

...

root

...

file,

...

you

...

can

...

proceed

...

with

...

corrected

...

acceptance

...

calculation.

...

Before

...

that,

...

review

...

the

...

maps

...

to

...

check

...

if

...

there

...

is

...

nothing

...

strange:

...

}
Code Block
```root -l Map2D.C
{code}
*```

Q:

...

Analyze

...

2D

...

histograms

...

for

...

maps

...

If

...

you

...

do

...

not

...

have

...

time

...

to

...

produce

...

the

...

maps,

...

you

...

can

...

use

...

what

...

we

...

have,

...

kindly

...

...

the

...

description

...

in

...

the

...

...

file

...

and

...

use

...

the

...

root

...

and

...

txt

...

files

...

on

...

the

...

following

...

webpage:

...

Panel

https://test-project-aeverett.web.cern.ch/test-project-aeverett/Acceptance02/

] {panel} If everything looks reasonable (no very large weights, no pronounced

If everything looks reasonable (no very large weights, no pronounced asymmetries),

...

continue

...

with

...

corrected

...

acceptance

...

(before

...

doing

...

that

...

make

...

sure

...

to

...

carefully

...

review

...

this

...

talk

...

by

...

...

}
Code Block
```python countxsec.py DYM1020_single_tuple.root DYM20_single_tuple.root #you can find test root files here
#or use the PAT tuple produce on the step1
python makeweights.py powheg_xs_full.root fewz_xs_full.root
python countcorracc.py --sg=DYM1020_single_tuple.root,DYM20_single_tuple.root -r fewz_powheg_weights.root
{code}
```

Each

...

next

...

step

...

uses

...

the

...

output

...

of

...

the

...

previous

...

step.

...

Firstly

...

we

...

calculate

...

the

...

PT-Y

...

dimuon

...

kinematics

...

map,

...

then

...

we

...

calculate

...

weight

...

for

...

FEWZ-POWHEG

...

reweighting

...

and

...

finally

...

we

...

calculate

...

the

...

corrected

...

acceptance.

...

Note:

...

the

...

k

...

factors

...

are

...

equal

...

to

...

1

...

by

...

default

...

but

...

should

...

be

...

...

in

...

case

...

one

...

uses

...

NLO

...

FEWZ

...

maps

...

(rather

...

than

...

NNLO)

...

Finally,

...

there

...

are

...

various

...

plots

...

used

...

to

...

estimate

...

the

...

FEWZ-POWHEG

...

discrepancy

...

for

...

various

...

trigger

...

scenarios

...

as

...

well

...

as

...

NNLO-NLO

...

discrepancy

...

for

...

within

...

a

...

given

...

generator

...

and

...

a

...

given

...

PDF

...

set.

...

These

...

plots

...

can

...

be

...

reproduced

...

using

...

the

...

following

...

macros:

...

}
Code Block
```cp /UserCode/Purdue/DYAnalysis/AnalysisMacros/ControlPlots/Acceptance.C \$CONTROL_PLOTS_DIR  #Acceptance macro isn't in current dir :-/ , copy it
cd \$CONTROL_PLOTS_DIR
root -l Acceptance.C
{code}

inside this ```

inside this macro,

...

you

...

can

...

uncomment

...

what

...

you

...

need

...

to

...

plot

...

and

...

also

...

...

the

...

input

...

PDF

...

sets

...

as

...

well

...

as

...

orders.

...

Checkpoint2 With the macros and scripts described in the step4 section you should be able to *reproduce* following macros from the CMS-AN-11-013:

...

2

...

,

...

30-38,61-63

...

and

...

tables:

...

5-10

...

,

...

21-24

...

...

...

...

...

estimation

...

...

...

...

...

...

ABCD method

We estimate QCD background using ABCD method in order to improve our systematic uncertainty on the background estimation. ABCD method is very simple.

1) choose 2 variables: assume two variables are independent

2) assume the fraction should be same if there is no correlation: N_A / N_B = N_C / N_D

3) In our study, use two variables: sign of muon pair, muon isolation

4) QCD fraction in each region has a dependence. We produce the correction factor for each region: B, C, D

5) Produce N_B, N_C, N_D from data sample, and estimate N_A from them at the end (applying the correction factors)

In UserCode/Purdue/DYAnalysis/AnalysisMacros/ABCDmethod

...

QCDFrac.C:

...

to

...

produce

...

correction

...

factors

...

for

...

each

...

region

...

ABCD2vari.C:

...

to

...

produce

...

the

...

ABCD

...

results.

...

The

...

correction

...

factors

...

from

...

the

...

QCDFrac.C

...

are

...

plugged

...

in

...

this

...

macro

...

as

...

an

...

input.

...

ttbar data driven background estimation

We employ the so-called

...

e-mu

...

data

...

driven

...

background

...

estimation

...

method.

...

See

...

the

...

following

...

comprehensive

...

talk

...

for

...

more

...

details

...

on

...

the

...

method.

...

Currently

...

the

...

procedure

...

to

...

apply

...

this

...

method

...

consists

...

of

...

2

...

steps:

...

1)

...

produce

...

the

...

root

...

files

...

with

...

histograms

...

2)

...

run

...

the

...

macros

...

on

...

the

...

root

...

files

...

produced

...

For

...

both

...

steps

...

one

...

needs

...

to

...

check

...

out

...

the

...

following

...

tags:

...

Panel

V00-05-

00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MuonAnalysis/Examples&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; V01-13-00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MuonAnalysis/MuonAssociators&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; V01-01-11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RecoVertex/VertexTools&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {color:#008000}V00-05-00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SHarper/HEEPAnalyzer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{color} {color:#008000}V00-11-00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUSYBSMAnalysis/Zprime2muAnalysis&nbsp;&nbsp;&nbsp;&nbsp;{color}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; V00-03-00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserCode/Examples&nbsp; {panel} The highleted tags are important for step2). Following is the description of how to produce the root files. The mother script file is

00      MuonAnalysis/Examples
V01-13-00      MuonAnalysis/MuonAssociators
V01-01-11      RecoVertex/VertexTools
V00-05-00      SHarper/HEEPAnalyzer
V00-11-00      SUSYBSMAnalysis/Zprime2muAnalysis
V00-03-00      UserCode/Examples

The highleted tags are important for step2).

Following is the description of how to produce the root files.

The mother script file is Zprime2muAnalysis/test/DataMCSpectraComparison/histos.py

...

Instructions

...

related

...

to

...

this

...

script

...

file

...

are

...

at

...

...

The short instruction is this:

Code Block
```python histos.py submit testing no_data
{code}
```

or

...

when

...

you

...

are

...

...

Code Block
``` python histos.py submit
{code}
```

Wait

...

for

...

root

...

files

...

to

...

be

...

done.

...

Currently

...

it

...

is

...

configured

...

to

...

have

...

histograms

...

with

...

selection

...

marked

...

'VBTF'

...

as

...

what

...

we

...

have

...

in

...

DY2011.

...

Below

...

I

...

describe

...

the

...

step2

...

in

...

detail.

...

Check

...

out

...

...

macros,

...

and

...

copy

...

them

...

to

...

your

...

working

...

directory:

...

}
Code Block
```cvs co UserCode/Purdue/DYAnalysis/AnalysisMacros/TTbarEstimation
cp UserCode/Purdue/DYAnalysis/AnalysisMacros/TTbarEstimation/*
cd SUSYBSMAnalysis/Zprime2muAnalysis/test/DataMCSpectraComparison
{code}

Make sure the paths to datafiles inside the macros are pointing to the location of the root files you have produced. To produce the control plots for emu and mumu mass spectra use

{code}```

Make sure the paths to datafiles inside the macros are pointing to the location of the root files you have produced. To produce the control plots for emu and mumu mass spectra use

Code Block
``` python emu_basichists.py
{code}
```

To

...

produce

...

the

...

correction

...

factors

...

run:

...

}
Code Block
``` python emu_corrfactors.py
{code}
```

And

...

finally,

...

the

...

MC

...

expectation

...

vs.

...

data

...

driven

...

method

...

prediction

...

plots

...

are

...

produced

...

with:

...

}
Code Block
``` python emu_prediction_plots.py
{code}
```

A

...

good

...

agreement

...

between

...

data

...

and

...

MC

...

for

...

both

...

the

...

mumu

...

and

...

emu

...

spectra

...

is

...

necessary

...

for

...

a

...

method

...

to

...

work

...

reliably.

...

...

...

Step 8: FSR correction

The effect of FSR is manifested by photon emission off the final state muon. It leads to change of the dimuon invariant mass and as a result a dimuon has invariant mass distinct from the propagator (or Z/gamma*) mass.

For our analysis we estimate the effect of FSR and the corresponding correction by estimating the bin-by-bin correction in invariant mass bins. Which is done by comparing the pre-FSR and the post-FSR spectra. The pre-FSR spectrum can be obtained by requiring mother of muon to be Z/gamma*, post FSR spectrum is when the mother is whatever.. The corresponding plots in the note are: 52-55 they all can be calculated with the information avaialble in the ntuple using

Code Block
```cd \$CONTROL_PLOTS_DIR
root -l InvMassFSR.C++
{code}

To get the FSR histograms one needs to turno on *calculateFSR* flag on.

{color:#ff0000}Checkpoint{color}: this macro will allow one to get plots 52-55 from the note

h2. Step 9: Systematic uncertainty estimation

There are various sources of systematics affecting our analysis: the PDF, theoretical modeling uncertainty, efficiency estimation uncertainty, background estimation, unfolding etc.

For the *background estimation*, with the data driven method we estimate the systematic uncertainty as the difference between the result obtained with the method and that

expected from MC per mass bin. Corresponding numbers are obtained with the&nbsp; ```

To get the FSR histograms one needs to turno on calculateFSR flag on.

Checkpoint: this macro will allow one to get plots 52-55 from the note

Step 9: Systematic uncertainty estimation

There are various sources of systematics affecting our analysis: the PDF, theoretical modeling uncertainty, efficiency estimation uncertainty, background estimation, unfolding etc.

For the background estimation, with the data driven method we estimate the systematic uncertainty as the difference between the result obtained with the method and that

expected from MC per mass bin. Corresponding numbers are obtained with the  emu_prediction_plots.py

...

macro

...

(see

...

the

...

recipe

...

in

...

the

...

step

...

6

...

section).

...

PDF

...

uncertainty

...

estimation.

...

The

...

recipe

...

for

...

the

...

method

...

currently

...

used

...

(step

...

by

...

step).

...

Reweight

...

the

...

PDF

...

using

...

the

...

current

...

existing

...

MC

...

samples

...

as

...

implemented

...

in

...

CMSSW.

...

First,

...

check

...

out

...

the

...

necessary

...

packages:

...

}
Code Block
```scramv1 p CMSSW CMSSW_4_2_3
cvsco -r CMSSW_4_2_3 ElectroWeakAnalysis/Utilities
{code}

```

then

...

replace

...

the

...

LHAPDF

...

library

...

as

...

described

...

here

...

to

...

the

...

current

...

up-to-date

...

one:

...

/afs/cern.ch/cms/slc5_amd64_gcc434/external/lhapdf/5.8.5-cms2/share/lhapdf/PDFsets

...

or

...

you

...

can

...

directly

...

change

...

in:

...

CMSSW_4_2_3/config/toolbox/slc5_amd64_gcc434/tools/available/lhapdffull.xml

...

with

...

above

...

path:

...

}
Code Block
```touch \$CMSSW_BASE/src/ElectroWeakAnalysis/Utilities/BuildFile.xml
cmsenv
scramv1 b
cd ElectroWeakAnalysis/Utilities/test
{code}

```

then

...

change

...

the

...

input

...

file

...

in

...

PdfSystematicsAnalyzer.py

...

and

...

run:

...

}
Code Block
```cmsRun PdfSystematicsAnalyzer.py
{code}

```

With

...

the

...

up-to-date

...

LHAPDF,

...

one

...

can

...

use

...

CT10,

...

MSTW2008*,

...

CTEQ66,

...

NNPDF2.0,

...

and

...

other

...

PDF

...

sets.

...

Efficiency

...

estimation

...

uncertainty

...

.

...

The

...

current

...

method

...

for

...

efficiency

...

estimation

...

in

...

the

...

DY

...

analysis

...

is

...

following:

...

we

...

estimate

...

the

...

MC

...

truth

...

efficiency

...

and

...

then

...

we

...

apply

...

the

...

efficiency

...

correction

...

map

...

(Pt-eta)

...

extracted

...

using

...

the

...

data-driven

...

tag

...

and

...

probe

...

method

...

applied

...

to

...

data

...

and

...

MC

...

to

...

weight

...

the

...

MC

...

events.

...

The

...

systematic

...

uncertainty

...

associated

...

with

...

the

...

Tag-and-Probe

...

efficiency

...

estimation

...

is

...

due

...

to

...

line-shape

...

modelling,

...

the

...

difference

...

between

...

fit

...

and

...

counting

...

and

...

due

...

to

...

the

...

binning.

...

The

...

two

...

first

...

are

...

calculated

...

inside

...

the

...

macros

...

described

...

in

...

Step5.

...

The

...

binning

...

systematic

...

uncertainty

...

is

...

estimated

...

using

...

the

...

following

...

macro:

...

UserCode/Purdue/DYAnalysis/AnalysisMacros/Correction/correctionMass_systematics.C

...

it

...

takes

...

as

...

input

...

the

...

root

...

files

...

having

...

the

...

histogram

...

with

...

efficiency

...

correction

...

as

...

a

...

function

...

of

...

invariant

...

mass

...

with

...

two

...

binnings

...

(to

...

estimate

...

the

...

binning

...

uncertainty),

...

the

...

other

...

sources

...

of

...

uncertainty

...

are

...

also

...

accessed.

...

...

...

...

...

The ... main ... result ... of ... the ... measurement ... is ... the ... cross-section ... ratio ... or ... r ... (and ... R) ... shape. ... We ... distinguish ... R ... and ... r ... shapes ... (see ... the ... note ... chapter9 ... for ... details ... on ... the ... definition ... and ... also ... see ... Figures ... 64). ... The ... figure ... 64 ... shows ... the ... shape ... R ... for ... theory ... and ... measurement ... (for ... two ... independent ... trigger ... scenarios). ... It ... relies ... on ... the ... theoretical ... cross-section ... measurement ... (1-2GeV ... bin), ... the ... final ... numbers ... for ... acceptance ... correction ... and ... also ... the ... final ... numbers ... for ... cross-section ... measurement. ... To ... give ... a ... clearer ... feeling ... of ... what ... this ... plot ... depends ... on ... I ... name ... the ... tables ... that ... are ... used ... to ... produce ... the ... number ... in ... the ... plot ... 64:... PanelTable 21-24: Theoretical predictions Tables 25-26: Measurement Table 5-10: Acceptance-efficiency corrections {panel} To run the code one simply needs: {code}correctionsTo run the code one simply needs: Code Block```cd \$CMSSW_RELEASE_BASE/src cvs co UserCode/Purdue/DYAnalysis/AnalysisMacros/GautierMacro cp UserCode/Purdue/DYAnalysis/AnalysisMacros/GautirMacro/* \$CONTROL_PLOTS_DIR cd \$CONTROL_PLOTS_DIR root -l theory_plot.C++ {code} ```Use ... Gautier ... style ... macros ... to ... get ... the ... same ... plots ... with ... different ... style:...} Code Block```root -l DY.C root -l plot.C {code} ```To ... get ... all ... the ... up ... to ... date ... values ... for ... the ... shape ... r/R ... use:...} Code Block```cvs co UserCode/Purdue/DYAnalysis/AnalysisMacros/ShapeR./shapeDY.make ./shapeDY {code} ```Among ... the ... requirements ... to ... style ... of ... the ... results ... presented ... is ... to ... put ... the ... measurement ... point ... to ... the ... weighted ... position ... (i.e. ... the ... location ... of ... the ... point ... inside ... the ... bin ... makes ... the ... integral ... over ... sub-bins ... equal ... from ... both ... sides). ... The ... following ... macro ... can ... be ... used ... to ... calculate ... these ... positions ... do ... in ... root:...} Code Block```.L compare_r.cc; compare_r(); {code} h4. Useful links A lot of intersting information can be retrieved from the Zprime JTERM [SHORT|https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideCMSDataAnalysisSchoolMuonExercise] and [LONG|https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideCMSDataAnalysisSchoolZPrimeExercise] exercises (which are constructed along the same lines as this ```

A lot of intersting information can be retrieved from the Zprime JTERM SHORT and LONG exercises (which are constructed along the same lines as this tutorial).