Commit 0a029958 authored by Johannes Junggeburth's avatar Johannes Junggeburth
Browse files

Merge branch '21.2' of ssh://gitlab.cern.ch:7999/atlas/athena into anatool_fix

parents 12c502b8 fede6feb
......@@ -77,6 +77,11 @@ if DerivationFrameworkIsMonteCarlo:
ToolSvc += EXOT2MCThinningTool
thinningTools += EXOT2MCThinningTool
import DerivationFrameworkMCTruth.MCTruthCommon as MCTruthCommon
if DerivationFrameworkIsMonteCarlo:
MCTruthCommon.addStandardTruthContents()
#further truth thinning to ensure useful parton info
if DerivationFrameworkIsMonteCarlo:
truth_cond_jets = "(((abs(TruthParticles.pdgId) > 0) && (abs(TruthParticles.pdgId) <= 7) || (abs(TruthParticles.pdgId) == 21)) && (TruthParticles.pt > 1*GeV) && ((TruthParticles.status ==1) || (TruthParticles.status ==2) || (TruthParticles.status ==3) || (TruthParticles.status ==23)) && (TruthParticles.barcode<200000))"
......
......@@ -13,7 +13,8 @@ if DerivationFrameworkIsMonteCarlo:
# Build truth collection if input is HepMC. Must be scheduled first to allow slimming.
# Input file is EVNT
if objKeyStore.isInInput( "McEventCollection", "GEN_EVENT" ):
DerivationFrameworkJob.insert(0,xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="GEN_EVENT"))
if not hasattr(DerivationFrameworkJob,'GEN_EVNT2xAOD'):
DerivationFrameworkJob.insert(0,xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="GEN_EVENT"))
dfInputIsEVNT = True
# Input file is HITS and translation hasn't been scheduled - careful with the name difference!
elif objKeyStore.isInInput( "McEventCollection", "TruthEvent"):
......
......@@ -15,7 +15,8 @@ if ("EventInfo#McEventInfo" not in inputFileSummary['eventdata_itemsList']) and
# Decide what kind of input HepMC container we are dealing with
if ("McEventCollection#GEN_EVENT" in inputFileSummary['eventdata_itemsList']):
DerivationFrameworkJob += xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="GEN_EVENT")
if not hasattr(DerivationFrameworkJob,'GEN_EVNT2xAOD'):
DerivationFrameworkJob += xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="GEN_EVENT")
elif ("McEventCollection#TruthEvent" in inputFileSummary['eventdata_itemsList']):
if not hasattr(DerivationFrameworkJob,'GEN_AOD2xAOD'):
DerivationFrameworkJob += xAODMaker__xAODTruthCnvAlg("GEN_EVNT2xAOD",AODContainerName="TruthEvent")
......
......@@ -51,7 +51,7 @@ int DerivationFramework::CollectionMakerHelpers::addTruthVertex( const xAOD::Tru
int DerivationFramework::CollectionMakerHelpers::addTruthParticle( const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont,
xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles,
const int generations) {
const int generations, bool includeVertex) {
// See if we've seen it - note, could also do this with a unary function on the container itself
if (std::find(seenParticles.begin(),seenParticles.end(),oldPart.barcode())!=seenParticles.end()){
for (size_t p=0;p<partCont->size();++p){
......@@ -61,25 +61,32 @@ int DerivationFramework::CollectionMakerHelpers::addTruthParticle( const xAOD::T
} // Found it in the old container
// Now we have seen it
seenParticles.push_back(oldPart.barcode());
// Set up decorators
const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin");
const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType");
const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome");
const static SG::AuxElement::Decorator< int > motherIDDecorator("motherID");
const static SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID");
// Make a truth particle and add it to the container
xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
partCont->push_back( xTruthParticle );
// Make a nw truth particle
xAOD::TruthParticle* xTruthParticle = setupTruthParticle(oldPart,partCont);
// Make a link to this particle
int myIndex = partCont->size()-1;
ElementLink<xAOD::TruthParticleContainer> eltp(*partCont, myIndex);
// Decay vertex information
if (oldPart.hasDecayVtx()) {
if (oldPart.hasDecayVtx() && includeVertex) {
int vertIndex = CollectionMakerHelpers::addTruthVertex( *oldPart.decayVtx(), partCont, vertCont, seenParticles, generations);
ElementLink<xAOD::TruthVertexContainer> eltv( *vertCont, vertIndex );
xTruthParticle->setDecayVtxLink( eltv );
(*vertCont)[vertIndex]->addIncomingParticleLink( eltp );
}
// Return a link to this particle
return myIndex;
}
xAOD::TruthParticle* DerivationFramework::CollectionMakerHelpers::setupTruthParticle(const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont){
// Set up decorators
const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin");
const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType");
const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome");
const static SG::AuxElement::Decorator< int > motherIDDecorator("motherID");
const static SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID");
// Make a truth particle and add it to the container
xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
partCont->push_back( xTruthParticle );
// Fill with numerical content
xTruthParticle->setPdgId(oldPart.pdgId());
xTruthParticle->setBarcode(oldPart.barcode());
......@@ -104,6 +111,5 @@ int DerivationFramework::CollectionMakerHelpers::addTruthParticle( const xAOD::T
if (oldPart.isAvailable<unsigned int>("classifierParticleOutCome")) {
outcomeDecorator(*xTruthParticle) = oldPart.auxdata< unsigned int >( "classifierParticleOutCome" );
} else {outcomeDecorator(*xTruthParticle) = 0;}
// Return a link to this particle
return myIndex;
return xTruthParticle;
}
......@@ -23,11 +23,13 @@ namespace DerivationFramework {
//!< Helper function to add truth particles to a collection
static int addTruthParticle(const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont,
xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles,
const int generations);
const int generations, bool includeVertex=true);
//!< Helper function to add truth vertices to a collection
static int addTruthVertex( const xAOD::TruthVertex& oldVert, xAOD::TruthParticleContainer* partCont,
xAOD::TruthVertexContainer* vertCont, std::vector<int>& seenParticles,
const int generations);
//!< Helper function to set up a truth particle based on an old particle
static xAOD::TruthParticle* setupTruthParticle(const xAOD::TruthParticle& oldPart, xAOD::TruthParticleContainer* partCont);
};
}
......
......@@ -15,9 +15,17 @@
#include "xAODTruth/TruthVertexContainer.h"
#include "xAODTruth/TruthVertexAuxContainer.h"
// To look up which generator is being used
#include "StoreGate/StoreGateSvc.h"
#include "xAODTruth/TruthMetaDataContainer.h"
// STL includes
#include <vector>
#include <string>
#include <algorithm>
// For string manipulation
#include <boost/algorithm/string.hpp>
// Constructor
DerivationFramework::HardScatterCollectionMaker::HardScatterCollectionMaker(const std::string& t,
......@@ -26,11 +34,13 @@ DerivationFramework::HardScatterCollectionMaker::HardScatterCollectionMaker(cons
: AthAlgTool(t,n,p)
, m_eventsKey("TruthEvents")
, m_collectionName("")
, m_metaStore( "MetaDataStore", n )
{
declareInterface<DerivationFramework::IAugmentationTool>(this);
declareProperty("TruthEventKey", m_eventsKey);
declareProperty("NewCollectionName", m_collectionName);
declareProperty("Generations", m_generations=1, "Number of generations after the particle in question to keep (-1 for all)");
declareProperty("MetaDataStore", m_metaStore );
}
// Destructor
......@@ -59,6 +69,41 @@ StatusCode DerivationFramework::HardScatterCollectionMaker::initialize()
// Selection and collection creation
StatusCode DerivationFramework::HardScatterCollectionMaker::addBranches() const
{
// Set up for some metadata handling
static int is_pure_pythia8 = -1;
if (is_pure_pythia8<0 && m_metaStore->contains<xAOD::TruthMetaDataContainer>("TruthMetaData")){
// Note that I'd like to get this out of metadata in general, but it seems that the
// metadata isn't fully available in initialize, and since this is a const function
// I can only do the retrieve every event, rather than lazy-initializing, since this
// metadata ought not change during a run
const DataHandle<xAOD::TruthMetaDataContainer> truthMetaData(nullptr);
// Shamelessly stolen from the file meta data tool
ATH_CHECK( m_metaStore->retrieve(truthMetaData) );
if (truthMetaData->size()>0){
// Let's just be super sure...
const std::string gens = boost::algorithm::to_lower_copy(truthMetaData->at(0)->generators());
// Check if it has Pythia8 in it
is_pure_pythia8 = (gens.find("pythia8")==std::string::npos)?0:1;
// Check if it has something *else* in it
std::string remainder = boost::algorithm::erase_all_copy(gens,"pythia8");
boost::algorithm::erase_all(remainder,"evtgen");
boost::algorithm::erase_all(remainder,"+");
if (remainder!=""){
ATH_MSG_INFO("Ideentified sample as not pure-Pythia8. Gen info was " << gens);
is_pure_pythia8=0;
} else if (is_pure_pythia8){
ATH_MSG_INFO("Identified sample as pure-Pythia8. Reconfiguring accordingly. Gen info was " << gens);
}
} // Seems to be the only sure way...
else {
ATH_MSG_WARNING("Found xAODTruthMetaDataContainer empty! Configuring to be NOT pure Pythia8.");
}
} else if (is_pure_pythia8<0){
ATH_MSG_WARNING("Could not find metadata container in storegate; assuming NOT pure Pythia8");
is_pure_pythia8=0;
}
// Retrieve truth collections
const xAOD::TruthEventContainer* importedTruthEvents(nullptr);
if (evtStore()->retrieve(importedTruthEvents,m_eventsKey).isFailure()) {
......@@ -100,22 +145,91 @@ StatusCode DerivationFramework::HardScatterCollectionMaker::addBranches() const
newVertexCollection->setStore( newVertexAuxCollection );
ATH_MSG_DEBUG( "Recorded new TruthVertexContainer with key: " << (m_collectionName+"Vertices"));
std::vector<int> seen_particles; // Loop protection
// If this was pure Pythia8, we are going to fake the collection
if (is_pure_pythia8){
// Make a dummy vertex
xAOD::TruthVertex* xTruthVertex0 = new xAOD::TruthVertex();
newVertexCollection->push_back( xTruthVertex0 );
// Get a link to this vertex -- will be used to set production vertices on all the next particles
int myIndex0 = newVertexCollection->size()-1;
ElementLink<xAOD::TruthVertexContainer> eltv0(*newVertexCollection, myIndex0);
// Set properties. Cheating here; if we had a signal process vertex, use its properties
xTruthVertex0->setId(my_tv->id());
xTruthVertex0->setBarcode(my_tv->barcode());
xTruthVertex0->setX(my_tv->x());
xTruthVertex0->setY(my_tv->y());
xTruthVertex0->setZ(my_tv->z());
xTruthVertex0->setT(my_tv->t());
// Same story, but for the completed intermediate particles
xAOD::TruthVertex* xTruthVertex1 = new xAOD::TruthVertex();
newVertexCollection->push_back( xTruthVertex1 );
// Get a link to this vertex -- will be used to set production vertices on all the next particles
int myIndex1 = newVertexCollection->size()-1;
ElementLink<xAOD::TruthVertexContainer> eltv1(*newVertexCollection, myIndex1);
// Set properties. Cheating here; if we had a signal process vertex, use its properties
xTruthVertex1->setId(my_tv->id());
xTruthVertex1->setBarcode(my_tv->barcode()-1);
xTruthVertex1->setX(my_tv->x());
xTruthVertex1->setY(my_tv->y());
xTruthVertex1->setZ(my_tv->z());
xTruthVertex1->setT(my_tv->t());
// Now run through the particles...
for (size_t np=0;np<importedTruthEvents->at(0)->nTruthParticles();++np){
// Get the particle
const xAOD::TruthParticle* tp = importedTruthEvents->at(0)->truthParticle(np);
// Better not be a null pointer
if (!tp) continue;
// Attach based on status codes!
// status 21 means incoming
if (tp->status()==21){
xAOD::TruthParticle *xTruthParticle = CollectionMakerHelpers::setupTruthParticle( *tp , newParticleCollection );
// Make a link to this particle
int myIndex = newParticleCollection->size()-1;
ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, myIndex);
// Add it to the vertex
xTruthParticle->setDecayVtxLink( eltv0 );
(*newVertexCollection)[myIndex0]->addIncomingParticleLink( eltp );
seen_particles.push_back(tp->barcode());
}
// Status 23 means outgoing - include requested generations (less this one)
else if (tp->status()==23){
int handyIndex = CollectionMakerHelpers::addTruthParticle( *tp, newParticleCollection, newVertexCollection, seen_particles, m_generations-1 );
// Make a link to this particle
ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, handyIndex);
// Add it to the vertex
(*newParticleCollection)[handyIndex]->setProdVtxLink( eltv1 );
(*newVertexCollection)[myIndex1]->addOutgoingParticleLink( eltp );
seen_particles.push_back(tp->barcode());
}
// Status 22 or 62 means intermediate - only save bosons
else if ((tp->status()==22 || tp->status()==62) && (tp->isW() || tp->isZ() || tp->isHiggs() || tp->isBSM())){
xAOD::TruthParticle *xTruthParticle = CollectionMakerHelpers::setupTruthParticle( *tp , newParticleCollection );
// Make a link to this particle
int myIndex = newParticleCollection->size()-1;
ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, myIndex);
// Add it to both the vertices
xTruthParticle->setProdVtxLink( eltv0 );
(*newVertexCollection)[myIndex0]->addOutgoingParticleLink( eltp );
xTruthParticle->setDecayVtxLink( eltv1 );
(*newVertexCollection)[myIndex1]->addIncomingParticleLink( eltp );
seen_particles.push_back(tp->barcode());
}
}
// Done with my new collection for Pythia8
return StatusCode::SUCCESS;
}
// Get the signal process vertex. Get the incoming particles and outgoing particles and
// make a mini truth collection based on those
std::vector<int> seen_particles; // Loop protection
// Let's assume a reasonable case...
CollectionMakerHelpers::addTruthParticle( *(my_tv->incomingParticle(0)), newParticleCollection, newVertexCollection, seen_particles, m_generations );
// Are there any other incoming particles we need to add?
for (size_t i=1;i<my_tv->nIncomingParticles();++i){
// Set up decorators
const static SG::AuxElement::Decorator< unsigned int > originDecorator("classifierParticleOrigin");
const static SG::AuxElement::Decorator< unsigned int > typeDecorator("classifierParticleType");
const static SG::AuxElement::Decorator< unsigned int > outcomeDecorator("classifierParticleOutCome");
const static SG::AuxElement::Decorator< int > motherIDDecorator("motherID");
const static SG::AuxElement::Decorator< int > daughterIDDecorator("daughterID");
// Make a truth particle and add it to the container
xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
newParticleCollection->push_back( xTruthParticle );
// Set up the truth particle
xAOD::TruthParticle* xTruthParticle = CollectionMakerHelpers::setupTruthParticle(*(my_tv->incomingParticle(i)),newParticleCollection);
// Make a link to this particle
int my_index = newParticleCollection->size()-1;
ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, my_index);
......@@ -123,31 +237,35 @@ StatusCode DerivationFramework::HardScatterCollectionMaker::addBranches() const
ElementLink<xAOD::TruthVertexContainer> eltv( *newVertexCollection, 0 ); // First one we added in
xTruthParticle->setDecayVtxLink( eltv );
(*newVertexCollection)[0]->addIncomingParticleLink( eltp );
// Fill with numerical content
xTruthParticle->setPdgId(my_tv->incomingParticle(i)->pdgId());
xTruthParticle->setBarcode(my_tv->incomingParticle(i)->barcode());
xTruthParticle->setStatus(my_tv->incomingParticle(i)->status());
xTruthParticle->setM(my_tv->incomingParticle(i)->m());
xTruthParticle->setPx(my_tv->incomingParticle(i)->px());
xTruthParticle->setPy(my_tv->incomingParticle(i)->py());
xTruthParticle->setPz(my_tv->incomingParticle(i)->pz());
xTruthParticle->setE(my_tv->incomingParticle(i)->e());
// Copy over the polarization information if it's there
if (my_tv->incomingParticle(i)->polarization().valid()){
xTruthParticle->setPolarizationParameter( my_tv->incomingParticle(i)->polarizationParameter( xAOD::TruthParticle::polarizationPhi ) , xAOD::TruthParticle::polarizationPhi );
xTruthParticle->setPolarizationParameter( my_tv->incomingParticle(i)->polarizationParameter( xAOD::TruthParticle::polarizationTheta ) , xAOD::TruthParticle::polarizationTheta );
}
// Copy over the decorations if they are available
if (my_tv->incomingParticle(i)->isAvailable<unsigned int>("classifierParticleType")) {
typeDecorator(*xTruthParticle) = my_tv->incomingParticle(i)->auxdata< unsigned int >( "classifierParticleType" );
} else {typeDecorator(*xTruthParticle) = 0;}
if (my_tv->incomingParticle(i)->isAvailable<unsigned int>("classifierParticleOrigin")) {
originDecorator(*xTruthParticle) = my_tv->incomingParticle(i)->auxdata< unsigned int >( "classifierParticleOrigin" );
} else {originDecorator(*xTruthParticle) = 0;}
if (my_tv->incomingParticle(i)->isAvailable<unsigned int>("classifierParticleOutCome")) {
outcomeDecorator(*xTruthParticle) = my_tv->incomingParticle(i)->auxdata< unsigned int >( "classifierParticleOutCome" );
} else {outcomeDecorator(*xTruthParticle) = 0;}
// Note that we did it
seen_particles.push_back( xTruthParticle->barcode() );
} // Done adding incoming particles -- all finished!
// Extra check, because truth records are complicated, based on studies by Dan Hayden (thanks!)
for (size_t np=0;np<importedTruthEvents->at(0)->nTruthParticles();++np){
// Get the particle
const xAOD::TruthParticle* tp = importedTruthEvents->at(0)->truthParticle(np);
// Better not be a null pointer
if (!tp) continue;
// Attach based on status codes!
// status 21 means incoming
if (tp->status()!=21) continue;
// See if we already got this one
if (std::find(seen_particles.begin(),seen_particles.end(),tp->barcode())!=seen_particles.end()){
continue;
} // Found it in the old container
// Otherwise, add it
xAOD::TruthParticle *xTruthParticle = CollectionMakerHelpers::setupTruthParticle( *tp , newParticleCollection );
// Make a link to this particle
int myIndex = newParticleCollection->size()-1;
ElementLink<xAOD::TruthParticleContainer> eltp(*newParticleCollection, myIndex);
// Add it to the vertex
ElementLink<xAOD::TruthVertexContainer> eltv( *newVertexCollection, 0 ); // First one we added in
xTruthParticle->setDecayVtxLink( eltv );
(*newVertexCollection)[0]->addIncomingParticleLink( eltp );
// Note that we did it
seen_particles.push_back( xTruthParticle->barcode() );
}
return StatusCode::SUCCESS;
}
......@@ -12,9 +12,14 @@
// Base classes
#include "AthenaBaseComps/AthAlgTool.h"
#include "DerivationFrameworkInterfaces/IAugmentationTool.h"
// For handles
#include "GaudiKernel/ServiceHandle.h"
// Standard library includes
#include <string>
// Forward declaration
class StoreGateSvc;
namespace DerivationFramework {
class HardScatterCollectionMaker : public AthAlgTool, public IAugmentationTool {
......@@ -28,6 +33,7 @@ namespace DerivationFramework {
std::string m_eventsKey; //!< Input particle collection (navigates to the vertices)
std::string m_collectionName; //!< Output collection name stem
int m_generations; //!< Number of generations after the particle in question to keep
ServiceHandle<StoreGateSvc> m_metaStore; //!< Handle on the metadata store for init
};
}
......
......@@ -45,7 +45,7 @@ DerivationFramework::TruthCollectionMaker::TruthCollectionMaker(const std::strin
declareProperty("Do_Compress",m_do_compress=false);
declareProperty("Do_Sherpa",m_do_sherpa=false);
declareProperty("KeepNavigationInfo",m_keep_navigation_info=true);
declareProperty( "MetaDataStore", m_metaStore );
declareProperty("MetaDataStore", m_metaStore );
}
// Destructor
......
......@@ -38,11 +38,34 @@ def setup(TOPQname, stream):
"BTagging_AntiKtVR30Rmax4Rmin02TrackAux" : "xAOD::BTaggingAuxContainer",
}
#================================
# SMART SLIMMING
#================================
TOPQSlimmingHelper.SmartCollections = []
TOPQSlimmingHelper.SmartCollections += TOPQSmartSlimmingCollections
# list of existing containers with a smart list is available here :
# DerivationFrameworkCore/python/FullListOfSmartContainers.py
TOPQSlimmingHelper.SmartCollections = [
"AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
"AntiKt10TrackCaloClusterTrimmedPtFrac5SmallR20Jets",
"AntiKt4EMPFlowJets",
"AntiKt4EMPFlowJets_BTagging201810",
"AntiKt4EMPFlowJets_BTagging201903",
"AntiKt4EMTopoJets",
"AntiKt4EMTopoJets_BTagging201810",
"AntiKt4TruthDressedWZJets",
"AntiKt4TruthJets",
"AntiKt4TruthWZJets",
"BTagging_AntiKt4EMPFlow_201810",
"BTagging_AntiKt4EMPFlow_201903",
"BTagging_AntiKt4EMTopo_201810",
"BTagging_AntiKtVR30Rmax4Rmin02Track",
"Electrons",
"HLT_xAOD__JetContainer_a4tcemsubjesFS",
"HLT_xAOD__TrigMissingETContainer_TrigEFMissingET",
"InDetTrackParticles",
"MET_Reference_AntiKt4EMPFlow",
"MET_Reference_AntiKt4EMTopo",
"Muons",
"Photons",
"PrimaryVertices",
"TauJets",
]
print "TOPQSlimmingHelper.SmartCollections: " , TOPQSlimmingHelper.SmartCollections
......@@ -52,46 +75,24 @@ def setup(TOPQname, stream):
TOPQSlimmingHelper.ExtraVariables = []
# for jets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMTopoJets
# for TOPQDERIV-62
if TOPQname == 'TOPQ1' or TOPQname == 'TOPQ6':
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMPFlowJets_ForTOPQ1
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMPFlowJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTagging_AntiKt4EMPFlow_201810
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTagging_AntiKt4EMPFlow_201903
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTagging_AntiKt4EMTopo_201810
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets
# For TCC W/Z taggers, see TOPQDERIV-80
if TOPQname == 'TOPQ1' or TOPQname == 'TOPQ4':
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt10TrackCaloClusterJets
# see TOPQDERIV70
if TOPQname == 'TOPQ1' or TOPQname == 'TOPQ4':
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKtVR30Rmax4Rmin02TrackJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTagging_AntiKtVR30Rmax4Rmin02Track
# Xbb tagger extra variables
if TOPQname == 'TOPQ1':
from DerivationFrameworkFlavourTag.HbbCommon import xbbTaggerExtraVariables
TOPQSlimmingHelper.ExtraVariables += xbbTaggerExtraVariables
# additional variables for electrons/photons objects
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Electrons
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_ForwardElectrons
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Photons
# additional variables for muons (and associated tracks)
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Muons
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_CombinedMuonTrackParticles
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_ExtrapolatedMuonTrackParticles
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_MuonSpectrometerTrackParticles
TOPQSlimmingHelper.AllVariables += ["CombinedMuonTrackParticles"]
TOPQSlimmingHelper.AllVariables += ["ExtrapolatedMuonTrackParticles"]
TOPQSlimmingHelper.AllVariables += ["MuonSpectrometerTrackParticles"]
# additional variables for inner detector
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_InDetTrackParticles
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_PrimaryVertices
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_InDetForwardTrackParticles
TOPQSlimmingHelper.AllVariables += ["InDetForwardTrackParticles"]
# additional variables for tau
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Taus
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_TauJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_TauTracks
# additional variables for tracks in jets
#TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt2PV0TrackJets
......@@ -111,57 +112,92 @@ def setup(TOPQname, stream):
addOriginCorrectedClusters(TOPQSlimmingHelper, writeLC=True, writeEM=True)
if DFisMC:
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Photons_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Electrons_Truth
# Additional truth variables for existing collections
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_ForwardElectrons_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Muons_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_CombinedMuonTrackParticles_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_MuonSpectrometerTrackParticles_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_ExtrapolatedMuonTrackParticles_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_IndetForwardTrackParticles_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_Taus_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMTopoJets_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMPFlowJets_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt2PV0TrackJets_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets_Truth
# add these trigger variables to all MC and data (TOPQ4 only)
if DFisMC or TOPQname == 'TOPQ4':
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTag_HLT
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_EFJet
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_GSCJet
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_SplitJet
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_a10r_tcemsubjesFS
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_a10r_tcemsubjesISFS
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_a10tclcwsubjesFS
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_a10ttclcwjesFS
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_a4tcemsubjesISFS
TOPQSlimmingHelper.ExtraVariables + TOPQExtraVariables_LVL1EnergySumRoI
# at truth level
if DFisMC:
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4TruthJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4TruthWZJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4TruthDressedWZJets
# Additional variables for truth-only collections
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_TruthEvents
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_TruthParticles
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_TruthVertices
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_MET_Truth
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_MET_TruthRegions
# Additional trigger information for MC
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTag_HLT
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_EFJet
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_SplitJet
if TOPQname == 'TOPQ1':
# for TOPQDERIV-62
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMPFlowJets_ForTOPQ1
# see TOPQDERIV70
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKtVR30Rmax4Rmin02TrackJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTagging_AntiKtVR30Rmax4Rmin02Track
# Xbb tagger extra variables
from DerivationFrameworkFlavourTag.HbbCommon import xbbTaggerExtraVariables
TOPQSlimmingHelper.ExtraVariables += xbbTaggerExtraVariables
elif TOPQname == 'TOPQ4':
# see TOPQDERIV70
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKtVR30Rmax4Rmin02TrackJets
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTagging_AntiKtVR30Rmax4Rmin02Track
# add these trigger variables to both data and MC
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_BTag_HLT
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_EFJet
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_HLT_SplitJet
elif TOPQname == 'TOPQ6':
# for TOPQDERIV-62
TOPQSlimmingHelper.ExtraVariables += TOPQExtraVariables_AntiKt4EMPFlowJets_ForTOPQ1
print "TOPQSlimmingHelper.ExtraVariables: " , TOPQSlimmingHelper.ExtraVariables
#================================
# CREATED ON-THE-FLY COLLECTIONS
#================================
TOPQSlimmingHelper.StaticContent = []
TOPQSlimmingHelper.StaticContent += TOPQStaticContent
TOPQSlimmingHelper.StaticContent = [
'xAOD::JetContainer#AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets',
'xAOD::JetAuxContainer#AntiKt10LCTopoTrimmedPtFrac5SmallR20JetsAux.',