# Difference between revisions of "Ttbar analysis skeleton"

The analysis of the Ntuples for the Rome data was done in ROOT. On this page the Analysis Skeleton is presented and instructions on how to use it.

## The 3 files that make up the Analysis Skeleton

The Analysis of the Root ntuple proceeds in a very straightforward way. Inside ROOT we used MakeClass() to get the .h and .C files. These were extended to our needs and together the following three files form the analysis skeleton:

The standard header file extended with the implementation of a few routines the user is not expected to change often. Also a new class is introduced: TLorentzVectorWIdx, which is a TLorentzVector that has an additional index that points back to it's position in the original list so we can access it's additional characteristics if we wish to do so.
The user analysis-file where the user:
o fills vectors with 'good' physics objects (leptons, jets, photons etc. passing the user's quality requirements)
o performs the top-analysis. The resulting histograms will be written out in a separate root file
The small steering-file containing the location of the ntuples and a function that decides:
o what ntuples to process (fast/full/background simulation)
o how many events to process
o name of the output file

## How to run the Analysis Skeleton in ROOT

The first step is to correctly set the location of your ntuples in the file simpleNtupleTTbarAnalysis.C. Then, to analyse the first 100 events in ntuple-set 1 (full simulation) and to store the output histograms in a file called summary_ttbar_full_test.root simply open a root session and type:

```  Root>  .L simpleTTbarAnalysis.C++;

Root>  .x  simpleNtupleTTbarAnalysis.C(1,100,"test");
```

When setting the number of events to "-1", all events are processed. If you want to analyze all events in ntuple-set 2 (W+4jets background) and to store the output histograms in a file called summary_wjets_full_test.root simly execute the following line:

```  Root>  .x  simpleNtupleTTbarAnalysis.C(2,-1,"test");
```

## Location of the Ntuples

The Ntuples were produced from the AOD as was explained before: "producing the Ntuple from the AOD". We will produce as soon as possible a web-page which will give the top group access to ALL files related to the Rome data challenge. This will include input files from the generation step (MCatNLO input-, event-, POOL- and log-files) as well as the files at reconstructionoutput both the CBNT files (thanks to SACLAY for collecting them all off the grid) and the AOD and Wouter- Ntuple files. For the moment we have only the Wouter-Ntuples on disk.

A short description of the sample necessary for the Rome tt analysis:

T1 (4100): tt events. Fully hadronic events have been rejected.

T2: tt events. Fully hadronic events have been rejected and at least one of the tops has a ${\displaystyle p_{T}}$ greater than 500 GeV/c

A7 (xxxx): (W + 4 jets)-events. The dominant background for the tt analysis.

 Sample Type Location Statistics T1 Wouter-Ntuple (Full) loctation1 (xxx) Wouter Ntuple (AtlFast) location 2 (xxx) A7 Wouter Ntuple (Full) location2 (xxx)

## Structure of the program

The '.C'-file is documented and should speak for itself. Nevertheless it is always nice to get a little bit more information on the logic behind the program:

Step 1) Reading the full event information into memory

Step 2) fillAllVectors(): This routine fills for each type of 'pseudo particle' (electrons, muons, photons, jets) a vector of TLorentzvectors-with-index to make the analysis more abstract and easily readable. There are actually TWO vectors filled, one for 'all' and one for 'good' pseudo-particles. For electrons we have for example ElectronVec and GoodElectronVec and it is up to the user to decide for each electron if it is good enough to be included in the 'good' electron list.

The routine that decides that is also contained in this file and is called isGoodElec. For muons, photons and jets we have similar routines. In these routines the 'all'-verctors are filled and for muons you can ask for example that it is isolated from all jets thay you have selected.

Standard quality plots: Finally some standard plots are produced for the various pseudo particles. These are the routines you can use to compute efficiencies or simply check what are the characteristics of the objects you have selected. For electrons we have electronQA(i_event), with smiilar routines for other psudo-particles.

Step 3) Computes the missing transverse energy. Used both in the event selection and estimation of the leptonic top mass candidate.

Step 4) The event selection. At this moment at lease one good lepton, exactly 4 good jets and large missing transverse energy.

Step 5) The selected events are treated as ttbar candidates. Here a few plots are produced that were also shown during the Rome meeting. The normalisation of the plots should be done by you of course (some numbers on this later here).

a) Plot the 3-jet mass for all combinations and the define the combination with the highest vector sum Pt as the top candidate. Millions of other algorithms are possible and we will investigate this to see if we can come up with something a bit more sophisticated.
b) For the top-candidate you have defined in a), plot the top mass if you (don't) find a 2-jet mass combination close to the W mass.
c) Decide on the W combination and plot the both 1) W mass in top signal and sideband window ands 2) the top mass in the W signal and side-band region.

Step 6) Write all histograms to a file.