class TrueTauSelection(EventFilter): """ True tau selection from the truth particle container using the official tool (does it work for all the generators ?) """ def __init__(self, passthrough=False, **kwargs): super(TrueTauSelection, self).__init__( passthrough=passthrough, **kwargs) if not passthrough: from ROOT.TauAnalysisTools import TauTruthMatchingTool self.tau_truth_tool = TauTruthMatchingTool('tau_truth_tool') # Should add an argument for the sample type self.tau_truth_tool.initialize() truth_matching_tool = self.tau_truth_tool def passes(self, event): self.tau_truth_tool.setTruthParticleContainer(event.truetaus.collection) self.tau_truth_tool.createTruthTauContainer() truth_taus = self.tau_truth_tool.getTruthTauContainer() truth_taus_aux = self.tau_truth_tool.getTruthTauAuxContainer() truth_taus.setNonConstStore(truth_taus_aux) event.truetaus.collection = truth_taus # OLD METHOD using the edm itself # event.truetaus.select(lambda p: p.isTau() and p.status() in (2,)) return True
def __init__(self, passthrough=False, **kwargs): super(TrueTauSelection, self).__init__( passthrough=passthrough, **kwargs) if not passthrough: from ROOT.TauAnalysisTools import TauTruthMatchingTool self.tau_truth_tool = TauTruthMatchingTool('tau_truth_tool') # Should add an argument for the sample type self.tau_truth_tool.initialize() truth_matching_tool = self.tau_truth_tool