Code Monkey home page Code Monkey logo

egm_tnp_analysis's Introduction

egm_tnp_analysis

Install stable branch

git clone -b egm_tnp_Moriond17_v2.0 [email protected]:fcouderc/egm_tnp_analysis.git

cd egm_tnp_analysis

no compilation is required (this will auto compile the C++ code automatically) but you need ROOT and RooFit installed.

This can be run on a laptop, does not require cmssw environment (still requires the setup to be run)

Quick description

First you need to setup the environment, especially on lxplus (do not use cmsenv from cmssw)

source etc/scritps/setup.sh

Package to handle analysis of tnp trees. The main tool is the python fitter

===> tnpEGM_fitter.py

The interface between the user and the fitter is solely done via the settings file

===> etc/config/settings.py - set the flags (i.e. Working points) that can be tested - set the different samples and location - set the fitting bins - set the different cuts to be used - set the output directory

Help message:

python tnpEGM_fitter.py --help

The settings have always to be passed to the fitter

python tnpEGM_fitter.py etc/config/settings.py

Therefore several "settings.py" files can be setup (for different run period for instance)

The different fitting steps

Everything will be done for a specific flag (so the settings can be the same for different flags). Hence, the flag to be used must be specified each time (named myWP in following).

1. Create the bining. To each bin is associated a cut that can be tuned bin by bin in the settings.py

  • After setting up the settings.py check bins

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --checkBins

  • if you need additinal cuts for some bins (cleaning cuts), tune cuts in the settings.py, then recheck. Once satisfied, create the bining

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --createBins

  • CAUTION: when recreacting bins, the output directory is overwritten! So be sure to not redo that once you are at step2

2. Create the histograms with the different cuts... this is the longest step. Histograms will not be re-done later

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --createHists

3. Do your first round of fits.

  • nominal fit

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --doFit

  • MC fit to constrain alternate signal parameters [note this is the only MC fit that makes sense]

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --doFit --mcSig --altSig

  • Alternate signal fit (using constraints from previous fits)

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --doFit --altSig

  • Alternate background fit (using constraints from previous fits)

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --doFit --altBkg

4. Check fits and redo failed ones. (there is a web index.php in the plot directory to vizualize from the web)

  • can redo a given bin using its bin number ib. The bin number can be found from --checkBins, directly in the ouput dir (or web interface)

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --doFit --iBin ib

  • the initial parameters can be tuned for this particular bin in the settings.py file. Once the fit is good enough, do not redo all fits, just fix next failed fit. One can redo any kind of fit bin by bin. For instance the MC with altSig fit (if the constraint parameters were bad in the altSig for instance)

python tnpEGM_fitter.py etc/config/settings.py --flag myWP --doFit --mcSig --altSig --iBin ib

5. egm txt ouput file. Once all fits are fine, put everything in the egm format txt file

python tnpEGM_fitter.py etc/config/setting.py --flag myWP --sumUp

The settings file

The settings file includes all the necessary information for a given setup of fit

- General settings.

* flag: this is the Working point in the tnpTree  (pass: flagCut ; fail !flagCut). The name of the flag myWP is the one to be passed

to the fitter. One can handle complex flags with a cut string (root cut string):

flag = { 'myWP' : myWPCutString }

* baseOutDir: the output directory (will be created by the fitter)

- Sample definition.

* tnpTreeDir: the directory in the tnpTree (different for phoID, eleID, reco, hlt)

* samplesDef: these are the main info
  - data: data ntuple
  - mcNom: nominal MC sample
  - mcAlt: MC for generator syst
  - tagSel: usually same as nominal MC + different base cuts: check the tag selection syst

 The sample themselves are defined in etc/inputs/tnpSampleDef.py  (the attribute nEvts, lumi are not necessary for the fit per-se and can be omitted). 
 A list of samples for ICHEP2016 from official egm production is already setup properly in the package. 
 Then in the settings.py the sample can be specified further:
 - sample.set_mctruth() : force mc truth on a MC sample
 - sample.rename('xxx') : if a sample is used 2 times (like with 2 different sets of cuts), it has to be renamed for the second use
 - sample.set_cut(cut)  : add a cut to define the sample (like a run range for data or an additional tag selection for alt tag selection syst)
 - sample.set_weight('totWeight') : name of the weight to be used for MC reweighting (totWeight in this example). Note: the tool can handle a pu Tree to reweight a MC with different PU scenario (ask for further explanations and/or settings_rwPU.py example)

- Cuts.

* cutBase: Define here the main cut
* additionalCuts: can be used for cleaning cuts (or put additionalCuts = None)

- Fitting parameters.

Define in this section the init parameters for the different fit, can be tuned to improve convergence.

====================

adding remote (Fabrice version)

git remote add origin [email protected]:fcouderc/egm_tnp_analysis.git

egm_tnp_analysis's People

Contributors

fcouderc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.