-- LimingChen - 30-Nov-2011

2011 W Helicity Measurment(EPS): 2011.01.16 ~ 2011.11.30

Top Common Object and cut flow

B Tagging Benchmarks

cuts defination

if ( fabs( el_trackphi->at(elIndex)- mu_trackphi->at(imuon) )<0.005 && fabs( el_tracktheta->at(elIndex)-mu_tracktheta->at(imuon) )<0.005 ) {
  isOverlap=true; if ( isOverlap ) continue; 

Despite efforts to correct the trigger matching in AtlasPhysics,, the trigger matching is partially broken in D3PDs created with this release.

Electron trigger matching

  • Loop from 0 to trig_EF_el_n
    • Skip trigger objects where trig_EF_el_EF_e20_medium->at(i) is false.
    • Calculate the delta R between trig_EF_el_eta->at(i), trig_EF_el_phi->at(i), el_tracketa->at(ielec), and el_trackphi->at(ielec), where ielec is the index of the selected electron.
    • If any delta R is less than 0.15 the trigger matching passes.

Muon trigger matching

  • Loop from 0 to trig_L2_combmuonfeature_n
    • Skip trigger objects where trig_L2_combmuonfeature_L2_mu18->at(i) is false.
    • Calculate the delta R between trig_L2_combmuonfeature_eta->at(i), trig_L2_combmuonfeature_phi->at(i), mu_eta->at(imuon), and mu_phi->at(imuon), where imuon is the index of the selected muon.
    • If any delta R is less than 0.15 the trigger matching passes the L2 check. The EF object must be then checked.

  • Loop from 0 to trig_EF_trigmuonef_n
    • Skip trigger objects which fail the trigger hypothesis algorithm (documented below).
    • Loop from 0 to trig_EF_trigmuonef_track_n->at(i)
      • Calculate the delta R between (trig_EF_trigmuonef_track_CB_eta->at(i))[itrk], (trig_EF_trigmuonef_track_CB_phi->at(i))[itrk], mu_eta->at(imuon), and mu_phi->at(imuon), where imuon is the index of the selected muon.
      • If any delta R is less than 0.15 the trigger matching passes.

The trigger hypothesis algorithm for EF_mu18 is,

for(itrk = 0; itrk<trig_EF_trigmuonef_track_n->at(i); itrk++) {

    eta = std::fabs((trig_EF_trigmuonef_track_CB_eta->at(i))[itrk]);
    pt = (trig_EF_trigmuonef_track_CB_pt->at(i))[itrk]/1.e+3;
    if(eta < 1.05) {
      if(pt > 17.53) return true;
    } else if(eta < 1.5) {
      if(pt > 17.39) return true;
    } else if(eta < 2.0) {
      if(pt > 17.34) return true;
    } else {
      if(pt > 17.28) return true;
  return false;
where i is the index of the trigger object being tested.

Systematic uncertainty

How to calculate systematics in your analysis: TopSystematicsHowTo

Muon momentum scale

  • export svnoff=svn+ssh://svn.cern.ch/reps/atlasoff
  • svn co $svnoff/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/tags/MuonMomentumCorrections-00-03-02

b tag

Jet Energy Resolution

check out: cmt co -r JetResolution-00-00-03 Reconstruction/Jet/JetResolution
How to use it
* The following tool is available to get the resolution and its uncertainty: JetEnergyResolutionProvider.

  • To be applied only for systematic studies ONLY! NO SMEARING SHOULD BE APPLIED BY DEFAULT TO JETS!

  • the technical implementation reads:

//at the beginning, before the event loop, instanciate a JERProvider object:
JERProvider* m_JERProvider = new JERProvider("AntiKt4TopoJES","Truth","JERProviderPlots.root");

//in the event loop, apply the smearing for systematics studies to all jets before selection!
the resolution S and its associated uncertainty are given by:
        double S = m_JERProvider->getSigma(jets->at(i)->pt()/GeV,EMy);
        double U = m_JERProvider->getUncert(jets->at(i)->pt()/GeV,EMy);
with EMy, the pseudo -rapidity. Comparison studies were performed with the usage of the rapidity and do not show significant differences. So one can use the pseudo-rapidity at EM scale which can be found in the D3PD as jet_emscale_eta

the smearing extra factor is defined as:
        D = TMath::Sqrt((S+U)*(S+U) -  S   * S   );
and the smearing to the jet pt should be applied like: 
        jet_smeared_pt = jets->at(i)->pt() * (1 + m_Random->Gaus(0, D));

with:  m_Random = new TRandom(); // the ROOT TRandom class.

Pile up Uncertainty


Step 1:
export svnoff=svn+ssh://svn.cern.ch/reps/atlasoff
svn co $svnoff/Trigger/TrigAnalysis/TrigBunchCrossingTool/tags/TrigBunchCrossingTool-00-01-06
cmt co -r TrigBunchCrossingTool-00-01-06 Trigger/TrigAnalysis/TrigBunchCrossingTool

Step 2:
svn co $svnoff/Trigger/TrigAnalysis/TrigAnalysisInterfaces/tags/TrigAnalysisInterfaces-00-00-02

Step 3:
cp -r TrigAnalysisInterfaces-00-00-02/TrigAnalysisInterfaces  TrigBunchCrossingTool-00-01-06

1) include the header
#include "D3PDBunchCrossingToolSA.h"

2) create an object:

Trig::D3PDBunchCrossingToolSA m_tool;

3) modify the function Notify to look like:

Bool_t NtupleReader::Notify()
   // The Notify() function is called when a new file is opened. This
   // can be either for a new TTree in a TChain or when when a new TTree
   // is started when using PROOF. It is normally not necessary to make changes
   // to the generated code, but the routine can be extended by the
   // user if needed. The return value is currently not used.
  std::cout << "NtupleReader::Notify" << std::endl;

  TChain* chain = 0;
  TFile* file = 0;
  if( ( chain = dynamic_cast< TChain* >( fChain ) ) ) {
    file = chain->GetFile();
  } else {
    file = fChain->GetCurrentFile();
  if( ! file ) {
    std::cerr << "Couldn't get pointer to the input file!" << std::endl;
    return kFALSE;

  TTree* metaTree = dynamic_cast< TTree* >( file->Get( "physicsMeta/BunchConfTree" ) ); // for the Top D3PDs location may vary for other D3PDs 
  m_tool.cacheConfig( metaTree );
   return kTRUE;

Note: you may need to modify "qcdMeta/BunchConfTree" to point to the "XXX/BunchConfTree" in your d3pd.

4) call the tool from your code but remember for each event you must call loadConfig before calling the other functions

    m_tool.loadConfig( this->bunch_configID );
    int btp=m_tool.bcType(this->bcid);  // get enum correspnding to funt,tail,middle...  see IIBunchCrossingTool.h
    double t=(double)(m_tool.distanceFromFront( this->bcid, Trig::IIBunchCrossingTool::NanoSec ));  // bunch position in nanosecons
    double t=(double)(m_tool.distanceFromFront( this->bcid, Trig::IIBunchCrossingTool::FilledBunches )); //bunch position number


  export SVNROOT=svn+ssh://svn.cern.ch/reps/atlasgrp
  svn co $SVNROOT/CombPerf/EGamma/EGammaOQ/EGammaOQ_2011/tags/EGammaOQ_2011-00-00-04
  // run_cint.C
  gROOT->ProcessLine(".L EGammaOQ_2011-00-00-04/checkOQ.C+");
  // physics.h
  #include "EGammaOQ_2011-00-00-04/checkOQ.C"
  egammaOQ* myOQ;
  // physics.C
  myOQ = new egammaOQ::egammaOQ();

  // checkOQ in ObjSelection.C
  #ifdef __MC__
  for( unsigned int i=0; i<ele.size(); i++){
    int OQstatus = myOQ->checkOQClusterElectron(180614, ele[i].clusterP.Eta(), ele[i].clusterP.Phi());
    if( OQstatus == 3 ) m_aan_OQweight *= 163.5/689.508;
    else m_aan_OQweight *= 1;


  • Get the package(Top_MET_Tool_00_00_04):
   export SVNROOT=svn+ssh://svn.cern.ch/reps/atlasgrp
   svn co $SVNROOT/Physics/Top/Software/Liaisons/Met/Top_MET_Tool/Top_MET_Tool_00_00_04

MultijetJESUncertaintyProvider for Top

  • Checking out the code cmt co -r JetUncertainties-00-03-04 Reconstruction/Jet/JetUncertainties

  • Prepare your work area and code for ROOT/C++ analysis
    • gmake -f Makefile.Standalone
    • gSystem->Load("(/StandAlone/JetUncertainties.so");

  • Create an instance of the MultijetJESUncertaintyProvider and initialize:
      MultijetJESUncertaintyProvider* myTopJES;
      JESUncertaintyProvider::Components JComps;
      myTopJES = new MultijetJESUncertaintyProvider::MultijetJESUncertaintyProvider("AntiKt4EMJESTopoJets", "MJESttbarSemi_rel16.root");
      //myTopJES = new MultijetJESUncertaintyProvider::MultijetJESUncertaintyProvider("AntiKt4EMJESTopoJets", "UnknownFlavourComp.root");
      JComps = JESUncertaintyProvider::NOPILEUPNOCLOSURE;
  • JetUncertainties-00-03-04:
    • myTopJES.getRelPosUncert(myPt, myEta, myDR, myComps, myNVtx); // for the relative positive uncertainty
    • myTopJES.getRelNegUncert(myPt, myEta, myDR, myComps, myNVtx); // for the relative negative uncertainty
    • myPt (in MeV) and myEta D3PD variables: jet_pt and jet_eta
    • myNVtx is the number of vertices (including any type PriVtx and PileUp vertex in the VxPrimaryCandidate container with number of tracks N > 4)
    • myDR is the distance to the closest reconstructed jet with em scale pT>7GeV (D3PD variable: jet_emscale_pt).
    • use myComps = JESUncertaintyProvider::NOPILEUPNOCLOSURE to retrieve the uncertainty without the closure and the pile-up contribution
    • myTopJES.getRelPosUncert(myPt, myEta, myDR, JESUncertaintyProvider::NOCLOSURE, myNVtx);
    • myTopJES.getRelNegUncert(myPt, myEta, myDR, JESUncertaintyProvider::NOCLOSURE, myNVtx);

    // Count the number of PVtx with at least 5 tracks
    int myNVtx = 0;
    for ( unsigned pvi=0; pvi<vxp_nTracks->size(); ++ pvi )
      if ( vxp_nTracks->at(pvi) > 4 ) ++myNVtx;

    double myDR = 9.9;
    double tDR = 9.9;
    TLorentzVector tP(0., 0., 0., 0.);
    if (jePt>7.0*GeV){
      for (int j=0; j<jet_n; j++){
        if ( i==j ) continue;
        tP.SetPtEtaPhiE((*jet_pt)[j], (*jet_eta)[j], (*jet_phi)[j], (*jet_E)[j]);
        tDR = j_tmp.P.DeltaR(tP);
        if ( tDR>myDR ) continue;
        myDR = tDR;

    double smearscal = 0.;
    if( fabs(j_Eta)<4.5 && j_Pt>15*GeV && j_Pt<7000*GeV ) {
      smearscal = myTopJES->getRelPosUncert(j_Pt, j_Eta, myDR, JComps, myNVtx);
      //smearscal = -1.0*(myTopJES->getRelNegUncert(j_Pt, j_Eta, myDR, JComps, myNVtx));
      if(verbose) cout<<"  smearscal = "<<smearscal<<endl;
      j_Pt *= (1+smearscal);
      j_E  *= (1+smearscal);

JES: jet energy scale

  • Checking out the code cmt co -r JetUncertainties-00-03-03 Reconstruction/Jet/JetUncertainties
  • Prepare your work area and code for ROOT/C++ analysis
    • gmake -f Makefile.Standalone
    • gSystem->Load("(/StandAlone/JetUncertainties.so");
  • Using the JESUncertaintyProvider
    • Create an instance of the JESUncertaintyProvider, ie: JESUncertaintyProvider myJES;
    • Initialize the instance myJES.init();
    • Dependence of pileup uncertainty on number of vertices double getRelUncert(double pT, double Eta, Components UncertComps = JESUncertaintyProvider::NOPILEUP, int nVtx=1);
    • For mc JComps = JESUncertaintyProvider::NOPILEUP ;
    • For data JComps = JESUncertaintyProvider::ALL;
    • The .root file with the uncertainty plots is located in the share/ directory. The ROOT file (JESUncertainty.root) needs to be placed in the same directory where the JESUncertaintyProvider is run.

PDF uncertainty

Recommended tools

Muon efficiency scale factors (2011-9-4)

  • Packages link
  • How to get
    • export svnoff=svn+ssh://svn.cern.ch/reps/atlasoff
    • svn co $svnoff/PhysicsAnalysis/TopPhys/TopPhysUtils/TopMuonSFUtils/tags/TopMuonSFUtils-00-00-07
  • How to use
    • Copy muon_SF_LP11.h from the package.
    • The SF methods are: mu_trigger_SF(double eta, double phi, double pt) and mu_trigger_SF_err(double eta, double phi, double pt, bool isUp);
    • The data efficiency methods are: mu_trigger_eff(double eta, double phi, double pt); and mu_trigger_eff_err(double eta, double phi, double pt);

Electron energy scale(2011-9-4)

  • How to get the code

The code can be checked out from egamma SVN group area by doing( latest tag is EnergyRescalerTool-00-00-09),

svn co $SVNGRP/CombPerf/EGamma/Calibrations/EnergyRescalerTool/tags/EnergyRescalerTool-00-00-09  EnergyRescalerTool
 $SVNGRP = svn+ssh://svn.cern.ch/reps/atlasgrp
The code can also be copied from the egamma afs area, both afs and svn are synchronized. The afs location is,

Warning, important Please don't use the Alpha file attached to this twiki but use the default numbers by calling useDefaultCalibConstants(std::string corr_version) method as explained above,

  • How to use the code

To use the code in Athena one simply needs to put the header/source files in the respective directories of analysis package. First you need to create an instance of EnergyRescaler by doing,

Say you already have created an instance i,e,

EnergyRescaler  m_eRescaler; 

Then EnergyRescaler can be initialized in the initialize of algorithm/tool by doing the following if one wants to use default correction embedded in the code,


To correct energy please use the following function In the execute method(or the overloaded one if you also need the upper and lower bound of corrected energy),

double cl_e_corr = eRescale.applyEnergyCorrection(cl_eta, cl_phi, unCorrE, eT, 0, part_type );

To use the code in ROOT please have a look at the example macro (useERescaler.C).

Top dataset

mc10_7TeV.105200.T1_McAtNlo_Jimmy.merge.NTUP_TOP.e598_s933_s946_r2372_r2300_p572/  #150   files
mc10_7TeV.105200.T1_McAtNlo_Jimmy.merge.NTUP_TOP.e598_s933_s946_r2302_r2300_p572/  #1497 files

#Color reconnection (100 Files)

#########################mc10b back up
#top mass

#Color reconnection (20  Files)

#top mass ntuple

pile-up re-weighting tool

Please read this site: The new pile-up re-weighting tool from the PAT group for the 2011 data carefully first.
         Luminosity Tag:OflLumi-7TeV-001
         Live fraction trigger: L1_EM14
         Physics trigger: EF_e20_medium
         GRL file: data11_7TeV.periodAllYear_DetStatus-v13-pro08-02_Top_allchannels.xml
         Other options: --plots modifier

  • install it under root macro
    • source root
    • gmake -f Makefile.Standalone In cmt/
    • gSystem->Load("libPileupReweighting.so"); in run_cint.C
    • #include "PileupReweighting-00-00-12/PileupReweighting/TPileupReweighting.h" Only include this will be fine.

Then, before the event loop starts, you need to create an instance of the TPileupReweighting tool and initialize it with the correct root files and histograms:
Root::TPileupReweighting* m_tPileUp = new Root::TPileupReweighting( "NameThatYouWantToGiveYourPileupReweightingTool" );
// All four arguments are of type TString
int isGood = m_tPileUp->initialize( m_dataRootFileName, m_dataRootHistName,   m_mcRootFileName,    m_mcRootHistName );
You should check that the initialization went OK. It did go all right if isGood == 0.

Now, you have two options how to use it during the event loop, once per event:

float pileupEventWeight = m_tPileUp->getPileupWeight( mu );

mc, GRL and others

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2011-12-07 - LimingChen
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback