Skip to content

Analysis

Andrea Marini edited this page Jun 2, 2016 · 1 revision

#Analysis

How to write a simple analysis

  • Inherits from AnalysisBase, and overwrite the following functions:
    virtual int analyze(Event*,string systname){return EVENT_NOT_USED;}
    virtual void Init(){}
    virtual void End(){} // before closing files and writing
    virtual const string name() const {return "AnalysisBase";}

Init

The Init function is called at the beginnig of the job. You should book here all the histograms/tree you like:

for ( string l : AllLabel()  ) {
    Book( "ChargedHiggsZW/CutFlow/CutFlow_"+ l , "CutFlow ",100,-.5,100-.5);
}

Trees:

InitTree("ggTree");
Branch("ggTree","mgg",'F');

End

This function is call at the end of the job. You can skip it.

Analyze

The Analyze function is called at each event and each systematics shift. After the selection you want you can fill the histograms/trees:

string label = GetLabel(e);
...
// Fill (histname, systname, value, weight ) ;
Fill("ChargedHiggsZW/CutFlow/CutFlow_"+label,systname,0,e->weight());

Trees:

SetTreeVar("mgg", g1->InvMass( *g2) );
FillTree("ggTree");
Clone this wiki locally