JetEtmissRecommendations2012CaterinaDoglioni
Introduction
This Twiki page contains the official recommendations for analyses using jets in 2012 data and simulation.
There are two datasets considered for the recommendations below:
- the Moriond dataset, which refers to the full 2012 data with
including the reprocessed data (periods A-G)
- the HCP dataset, which refers to the
sample (periods A-G only), and is not reprocessed.
This page only contains code snippets regarding the tools. For more information, please see the following pages:
Instructions for Moriond Dataset using Reprocessed Data
D3PD-based Analyses
D3PD from the reprocessed data must either:
- use the physics cache 17.2.7.5.2, with the fix applied to the preExec flag as in the p1328 tag
- be produced from the release 17.2.7.5.3 (tag p1344) or later.
There have been many changes to both jets and ETmiss in these caches and we do not expect the results to be exactly the same as in
D3PD produced with earlier physics caches.
Calibration of jets
Instructions for recalibration of data
Package and tag: ApplyJetCalibration-00-03-02
svn co $SVNOFF/Reconstruction/Jet/ApplyJetCalibration/tags/ApplyJetCalibration-00-03-02 ApplyJetCalibration
Initializing the JetCalibrationTool: call the constructor before the event loop with the
JES_Full2012dataset_Preliminary_Jan13.config
config file
//before the event loop
JetCalibrationTool *myJES;
TString jetAlgo="AntiKt4TopoEM"; //Can also be set to the other jet collections "AntiKt4LCTopo", "AntiKt6TopoEM", "AntiKt6LCTopo"
TString JES_config_file="ApplyJetCalibration/data/CalibrationConfigs/JES_Full2012dataset_Preliminary_Jan13.config";
bool isData = true;
myJES = new JetCalibrationTool(jetAlgo,JES_config_file, isData);
Variables to use in the
ApplyJetAreaOffsetEtaJES
function for
EM+JES jets:
//inside the event loop
double Eraw = jet_AntiKt4TopoEM_emscale_E->at(jeti);
double eta_det = jet_AntiKt4TopoEM_emscale_eta->at(jeti);
double phi = jet_AntiKt4TopoEM_emscale_phi->at(jeti);
double m = jet_AntiKt4TopoEM_emscale_m->at(jeti);
double Ax = jet_AntiKt4TopoEM_ActiveAreaPx->at(jeti);
double Ay = jet_AntiKt4TopoEM_ActiveAreaPy->at(jeti);
double Az = jet_AntiKt4TopoEM_ActiveAreaPz->at(jeti);
double Ae = jet_AntiKt4TopoEM_ActiveAreaE->at(jeti);
double rho = Eventshape_rhoKt4EM;
// For the pile-up correction, we need mu and NPV(2+ tracks)
double mu = averageIntPerXing;
int NPV=0; // count the number of vertices with 2 or more tracks
for ( unsigned tracki=0; tracki<vxp_nTracks->size(); tracki++)
if ( vxp_nTracks->at(tracki) >= 2 ) NPV++; //For SUSY D3PDs use the vx_nTracks TBranch
Variables to use in the
ApplyJetAreaOffsetEtaJES
function for
LC+JES jets:
//inside the event loop
double Eraw = jet_AntiKt4LCTopoJets_constscale_E->at(jeti);
double eta_det = jet_AntiKt4LCTopoJets_constscale_eta->at(jeti);
double phi = jet_AntiKt4LCTopoJets_constscale_phi->at(jeti);
double m = jet_AntiKt4LCTopoJets_constscale_m->at(jeti);
double Ax = jet_AntiKt4LCTopo_ActiveAreaPx->at(jeti);
double Ay = jet_AntiKt4LCTopo_ActiveAreaPy->at(jeti);
double Az = jet_AntiKt4LCTopo_ActiveAreaPz->at(jeti);
double Ae = jet_AntiKt4LCTopo_ActiveAreaE->at(jeti);
double rho = Eventshape_rhoKt4LC;
// For the pile-up correction, we need mu and NPV(2+ tracks)
double mu = averageIntPerXing;
int NPV=0; // count the number of vertices with 2 or more tracks
for ( unsigned tracki=0; tracki<vxp_nTracks->size(); tracki++)
if ( vxp_nTracks->at(tracki) >= 2 ) NPV++; //For SUSY D3PDs use the vx_nTracks TBranch
Creating a calibrated jet object:
Note: Please make sure to give the raw mu and NPV (as obtained just above) to the ApplyJetAreaOffsetEtaJES method. The ApplyJetAreaOffsetEtaJES method internally rescales mu and corrects NPV in accordance with the
inner detector tracking performance guidelines.
TLorentzVector jet = myJES->ApplyJetAreaOffsetEtaJES(Eraw,eta_det,phi,m,Ax,Ay,Az,Ae,rho,mu,NPV);
Instructions for recalibration of MC, full simulation
The instructions follow exactly those for data above, with one important difference:
- the parameter
isData
in the constructor of the JetCalibrationTool
needs to be set to false.
Initializing the JetCalibrationTool:
//before the event loop
JetCalibrationTool *myJES;
TString jetAlgo="AntiKt4TopoEM"; //Can also be set to "AntiKt4LCTopo", "AntiKt6TopoEM", "AntiKt6LCTopo"
TString JES_config_file="ApplyJetCalibration/data/CalibrationConfigs/JES_Full2012dataset_Preliminary_Jan13.config";
bool isData = false;
myJES = new JetCalibrationTool(jetAlgo,JES_config_file, isData);
Instructions for recalibration of MC, AFII
The instructions follow exactly those for data above, with three important differences:
- the configuration file passed to the constructor of the
JetCalibrationTool
is ApplyJetCalibration/data/CalibrationConfigs/JES_Full2012dataset_Preliminary_AFII_Jan13.config
- the parameter
isData
in the constructor of the JetCalibrationTool
needs to be set to false.
- AntiKt R=0.6 LC jets are not available
Initializing the JetCalibrationTool:
//before the event loop
JetCalibrationTool *myJES;
TString jetAlgo="AntiKt4TopoEM"; //Can also be set to "AntiKt4LCTopo", "AntiKt6TopoEM"
TString JES_config_file="ApplyJetCalibration/data/CalibrationConfigs/JES_Full2012dataset_Preliminary_AFII_Jan13.config";
bool isData = false;
myJES = new JetCalibrationTool(jetAlgo,JES_config_file, isData);
Jet energy scale (JES) uncertainty
Instructions for retrieving the JES uncertainty for data and fullSim MC
Note that you will have to apply the JES uncertainty either to data or to MC, not to both.
Package and tag: JetUncertainties-00-08-01
svn co $SVNOFF/Reconstruction/Jet/JetUncertainties/tags/JetUncertainties-00-08-01 JetUncertainties
OR
cmt co Reconstruction/Jet/JetUncertainties -r JetUncertainties-00-08-01
Initializing the MultijetJESUncertaintyProvider:
// Before the event loop
MultijetJESUncertaintyProvider *mjp;
TString multijetConfig = "JES_2012/Moriond2013/MultijetJES_2012.config";
TString jesprovConfig = "JES_2012/Moriond2013/InsituJES2012_14NP.config"; // Two other options
TString jetAlgorithm = "AntiKt4TopoEM"; // Also accepts {AntiKt4LCTopo,AntiKt6TopoEM,AntiKt6LCTopo}
TString mcType = "MC12a"; // Also accepts {Pythia8,AFII} (note: MC12a==Pythia8) - this is also valid for data
TString path = "share/"; // Path to the share directory
mjp = new MultijetJESUncertaintyProvider(multijetConfig,jesprovConfig,jetAlgorithm,mcType,path);
Variables to use for the various uncertainty components:
// Inside the event loop
double pt = jet.Pt(); // Fully calibrated pT (from after using ApplyJetCalibration)
double eta_det = jet_AntiKt4TopoEM_emscale_eta->at(jeti); // Or Kt6, or _constscale_ for LCTopo jets (this needs to be the raw eta before JES calibration)
double mu = averageIntPerXing; // For pileup uncertainty terms
int NPV = 0; // For pileup uncertainty terms
// Count the number of vertices with 2 or more tracks
for (unsigned tracki=0; tracki<vxp_nTracks->size(); tracki++)
if (vxp_nTracks->at(tracki) >= 2) NPV++; // vx_nTracks instead for SUSY D3PDs
double fCloseBy; // See full explanation at https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertainties#CloseBy
// NOTE: 2011 data still use DRmin-based close-by uncertainty
Instructions for retrieving the JES uncertainty for AFII MC
Note that you will have to apply the JES uncertainty either to data or to MC, not to both.
The instructions follow exactly those for data/MC above, with one important difference:
- the parameter
MCType
in the constructor of the JetCalibrationTool
needs to be set to AFII.
Initializing the MultijetJESUncertaintyProvider:
// Before the event loop
MultijetJESUncertaintyProvider *mjp;
TString multijetConfig = "JES_2012/Moriond2013/MultijetJES_2012.config";
TString jesprovConfig = "JES_2012/Moriond2013/InsituJES2012_14NP.config"; // Two other options
TString jetAlgorithm = "AntiKt4TopoEM"; // Also accepts {AntiKt4LCTopo,AntiKt6TopoEM, but NOT AntiKt6LCTopo}
TString mcType = "AFII"; // Very important: AFII is for fast simulation, Pythia8 for full simulation
TString path = "share/"; // Path to the share directory
mjp = new MultijetJESUncertaintyProvider(multijetConfig,jesprovConfig,jetAlgorithm,mcType,path);
Jet energy resolution (JER) uncertainty
Instructions for retrieving the JER uncertainty for fullSim MC
Packages and Tags: ApplyJetResolutionSmearing-00-01-00 and JetResolution-02-00-00
svn co $SVNPERF/CombPerf/JetETMiss/JetCalibrationTools/ApplyJetResolutionSmearing/tags/ApplyJetResolutionSmearing-00-01-00 ApplyJetResolutionSmearing
svn co $SVNOFF/Reconstruction/Jet/JetResolution/tags/JetResolution-02-00-00 JetResolution
Smear Jets: in the code
// initialization
TString jetAlgo = "AntiKt4TopoEM"; // Also accepts {AntiKt4LCTopo,AntiKt6TopoEM,AntiKt6LCTopo}
JetSmearingTool *myJER = new JetSmearingTool(jetAlgo);
// for each event - to make results randomly reproducible
myJER->SetSeed(EventNumber);
// for each jet AFTER calibration - will adjust jet 4-vector
myJER->SmearJet_Syst(jet); // jet is the calibrated TLorentzVector of the jet
Note: more information is available in
ApplyJetResolutionSmearing and
JERprovider2012
Instructions for retrieving the JER uncertainty for AFII MC
The instructions follow exactly those for data above, with one important difference:
- The function that needs to be called to smear jets is now
myJER->SmearJet_Syst_AFII(jet);
Smear Jets: in the jet loop, after calibration
// initialization
TString jetAlgo = "AntiKt4TopoEM"; // Also accepts {AntiKt4LCTopo,AntiKt6TopoEM,AntiKt6LCTopo}
JetSmearingTool *myJER = new JetSmearingTool(jetAlgo);
// for each event - to make results randomly reproducible
myJER->SetSeed(EventNumber);
// for each jet AFTER calibration - will adjust jet 4-vector
myJER->SmearJet_Syst_AFII(jet); //jet is the calibrated TLorentzVector of the jet
MET
For info, the MET_RefFinal and MET_RefFinal_STVF as in p1328
D3PDs used the August 2012 calibration for jets consisting the
RefJet term.
AOD/dESD-based Analyses
WARNING: These instructions are still untested on dESD. Please contact the jet calibration mailing list (atlas-cp-jet-calibration@cernNOSPAMPLEASE.ch) if you run into problems.
JES calibration
The instructions follow exactly the same procedure as above for data, MC (both fullSim and AFII).
The difference lies in the way the variables are retrieved as there are no D3PD branches here. So some important jet moments need to be recomputed: see JetMomentsRecommendations, in particular the "Configuration for AOD based analysis" section.
Variables to use in the ApplyJetAreaOffsetEtaJES
function for EM+JES jets:
//inside the event loop
const EventInfo* evt;
StatusCode sc = (*storeGate)->retrieve(evt);
double mu = evt->averageInteractionsPerCrossing();
const VxContainer* priVertexContainer;
sc = (*storeGate)->retrieve(priVertexContainer, "VxPrimaryCandidate");
DataVector<Trk::VxCandidate>::const_iterator vtxItr = priVertexContainer->begin();
DataVector<Trk::VxCandidate>::const_iterator vtxItrE = priVertexContainer->end();
int NPV = 0;
for (; vtxItr != vtxItrE; ++vtxItr) if ((*vtxItr)->vxTrackAtVertex()->size() >=2) NPV++:
double rho = EtDensityTool->rho(); //Note you will need to have defined ToolHandle<IEventEtDensityProvider> EtDensityTool somewhere in your code.
sc = (*storeGate)->retrieve( jetCollection, "AntiKt4TopoEMJets"); //For R=0.6 jets change to "AntiKt6TopoEMJets"
// iterate over jets in the event
fvCS = jetFourVectorCS();
double Ax = jet->getMoment("ActiveAreaPx");
double Ay = jet->getMoment("ActiveAreaPy");
double Az = jet->getMoment("ActiveAreaPz");
double Ae = jet->getMoment("ActiveAreaE");
Variables to use in the ApplyJetAreaOffsetEtaJES
function for LC+JES jets:
//inside the event loop
const EventInfo* evt;
StatusCode sc = (*storeGate)->retrieve(evt);
double mu = evt->averageInteractionsPerCrossing();
const VxContainer* priVertexContainer;
sc = (*storeGate)->retrieve(priVertexContainer, "VxPrimaryCandidate");
DataVector<Trk::VxCandidate>::const_iterator vtxItr = priVertexContainer->begin();
DataVector<Trk::VxCandidate>::const_iterator vtxItrE = priVertexContainer->end();
int NPV = 0;
for (; vtxItr != vtxItrE; ++vtxItr) if ((*vtxItr)->vxTrackAtVertex()->size() >=2) NPV++:
double rho = EtDensityTool->rho(); //Note you will need to have defined ToolHandle<IEventEtDensityProvider> EtDensityTool somewhere in your code.
sc = (*storeGate)->retrieve( jetCollection, "AntiKt4LCTopoJets"); //For R=0.6 jets change to "AntiKt6LCTopoJets"
// iterate over jets in the event
fvCS = jetFourVectorCS();
double Ax = jet_uncorr->getMoment("ActiveAreaPx");
double Ay = jet_uncorr->getMoment("ActiveAreaPy");
double Az = jet_uncorr->getMoment("ActiveAreaPz");
double Ae = jet_uncorr->getMoment("ActiveAreaE");
Creating a calibrated jet object:
Note: Please make sure to give the raw mu and NPV (as obtained just above) to the ApplyJetAreaOffsetEtaJES method. The ApplyJetAreaOffsetEtaJES method internally rescales mu and corrects NPV in accordance with the inner detector tracking performance guidelines.
TLorentzVector jet = ApplyJetAreaOffsetEtaJES(fvCS.E(),fvCS.Eta(),fvCS.Phi(),fvCS.M(),Ax,Ay,Az,Ae,rho,mu,NPV);
JES uncertainty
The instructions follow exactly the same procedure as above for data, MC (both fullSim and AFII).
The difference only lies in the way the variables are retrieved as there are no D3PD branches here.
Variables to use in the for the various uncertainty components:
// Inside the event loop
const EventInfo* evt;
StatusCode sc = (*storeGate)->retrieve(evt);
double mu = evt->averageInteractionsPerCrossing();
const VxContainer* primaryVertexContainer;
sc = (*storeGate)->retrieve(pimaryVertexContainer,"VxPrimaryCandidate");
int NPV = 0;
for(DataVector<Trk::VxCandidate>::const_iterator vtxItr=primaryVertexContainer->begin();
vtxItr != primaryVertexContainer->end(); ++vtxItr)
if ((*vtxItr)->vxTrackAtVertex()->size() >= 2) NPV++;
sc = (*storeGate)->retrieve(jetCollection,"AntiKt4TopoEMJets"); // Change for desired jet type
double eta = jet.Eta(); // storegate version of jet (uncorrected)
double pt = calibratedJet.Pt(); // jets from output of ApplyJetCalibration
double fCloseBy; // Explained at https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertainties#CloseBy
// NOTE: 2011 data still use DRmin-based close-by uncertainty
JER uncertainty
FIXME! The instructions are the same as above, the only change is creating a 4vector out of the calibrated quantities above.
MET
- ETmiss variables MET_RefFinal and MET_RefFinal_STVF have to be re-calculated using MissingET-03-03-60 and MissingETEvent-00-41-23 (contained in AtlasPhysics 17.2.7.5.2 or later).The MET_RefFinal as in the AODs is not recommended for usage in analyses. The corresponding uncerainties are in MissingETutility-01-01-03.
HCP is still to come, but it follows the same scheme