コード例 #1
0
    def process(self, event):

        super(H2TauTauTreeProducerTauTau, self).process(event)

        tau1 = event.diLepton.leg1()
        tau2 = event.diLepton.leg2()

        self.fillTau(self.tree, 'l1', tau1)
        self.fillTau(self.tree, 'l2', tau2)

        if hasattr(tau1, 'genp'):
            if tau1.genp: self.fillGenParticle(self.tree, 'l1_gen', tau1.genp)
        if hasattr(tau2, 'genp'):
            if tau2.genp: self.fillGenParticle(self.tree, 'l2_gen', tau2.genp)

        # save the p4 of the visible tau products at the generator level
        # make sure that the reco tau matches with a gen tau that decays into hadrons

        if tau1.genJet() and hasattr(tau1, 'genp') and tau1.genp and abs(
                tau1.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l1_gen_vis', tau1.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(
                tauDecayModes.genDecayModeFromGenJet(tau1.physObj.genJet()))
            self.fill(self.tree, 'l1_gen_decaymode', tau_gen_dm)

        if tau2.genJet() and hasattr(tau2, 'genp') and tau2.genp and abs(
                tau2.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau2.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(
                tauDecayModes.genDecayModeFromGenJet(tau2.physObj.genJet()))
            self.fill(self.tree, 'l2_gen_decaymode', tau_gen_dm)

        self.fillTree(event)
コード例 #2
0
    def process(self, event):

        super(H2TauTauTreeProducerTauMu, self).process(event)

        tau = event.diLepton.leg2()
        muon = event.diLepton.leg1()

        self.fillTau(self.tree, 'l2', tau)
        self.fillMuon(self.tree, 'l1', muon)

        if hasattr(tau, 'genp') and tau.genp:
            self.fillGenParticle(self.tree, 'l2_gen', tau.genp)
            self.fill(self.tree, 'l2_gen_lepfromtau', tau.isTauLep)

        if hasattr(muon, 'genp') and muon.genp:
            self.fillGenParticle(self.tree, 'l1_gen', muon.genp)
            self.fill(self.tree, 'l1_gen_lepfromtau', muon.isTauLep)

        # save the p4 of the visible tau products at the generator level
        if tau.genJet() and hasattr(tau, 'genp') and tau.genp and abs(
                tau.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau.physObj.genJet())
            self.fill(
                self.tree, 'l2_gen_decaymode',
                tauDecayModes.translateGenModeToInt(
                    tauDecayModes.genDecayModeFromGenJet(
                        tau.physObj.genJet())))

        self.fill(self.tree, 'l2_weight_fakerate', event.tauFakeRateWeightUp)
        self.fill(self.tree, 'l2_weight_fakerate_up',
                  event.tauFakeRateWeightDown)
        self.fill(self.tree, 'l2_weight_fakerate_down',
                  event.tauFakeRateWeight)

        if hasattr(self.cfg_ana, 'addIsoInfo') and self.cfg_ana.addIsoInfo:
            self.fill(self.tree, 'l1_puppi_iso_pt', muon.puppi_iso_pt)
            self.fill(self.tree, 'l1_puppi_iso04_pt', muon.puppi_iso04_pt)
            self.fill(self.tree, 'l1_puppi_iso03_pt', muon.puppi_iso03_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso_pt',
                      muon.puppi_no_muon_iso_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso04_pt',
                      muon.puppi_no_muon_iso04_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso03_pt',
                      muon.puppi_no_muon_iso03_pt)
            self.fill(self.tree, 'l2_puppi_iso_pt', tau.puppi_iso_pt)
            self.fill(self.tree, 'l2_puppi_iso04_pt', tau.puppi_iso04_pt)
            self.fill(self.tree, 'l2_puppi_iso03_pt', tau.puppi_iso03_pt)
            self.fill(self.tree, 'l1_mini_iso', muon.miniAbsIso)
            self.fill(self.tree, 'l1_mini_reliso', muon.miniRelIso)

        self.fillTree(event)
コード例 #3
0
    def process(self, event):

        super(H2TauTauTreeProducerTauMu, self).process(event)

        tau = event.diLepton.leg2()
        muon = event.diLepton.leg1()

        self.fillTau(self.tree, 'l2', tau)
        self.fillMuon(self.tree, 'l1', muon)

        if hasattr(tau, 'genp') and tau.genp:
            self.fillGenParticle(self.tree, 'l2_gen', tau.genp)
            self.fill(self.tree, 'l2_gen_lepfromtau', tau.isTauLep)

        if hasattr(muon, 'genp') and muon.genp:
            self.fillGenParticle(self.tree, 'l1_gen', muon.genp)
            self.fill(self.tree, 'l1_gen_lepfromtau', muon.isTauLep)

        # save the p4 of the visible tau products at the generator level
        if tau.genJet() and hasattr(tau, 'genp') and tau.genp and abs(tau.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau.physObj.genJet())
            self.fill(self.tree, 'l2_gen_decaymode', tauDecayModes.translateGenModeToInt(tauDecayModes.genDecayModeFromGenJet(tau.physObj.genJet())))

        self.fill(self.tree, 'l2_weight_fakerate', event.tauFakeRateWeightUp)
        self.fill(self.tree, 'l2_weight_fakerate_up', event.tauFakeRateWeightDown)
        self.fill(self.tree, 'l2_weight_fakerate_down', event.tauFakeRateWeight)

        if hasattr(self.cfg_ana, 'addIsoInfo') and self.cfg_ana.addIsoInfo:
            self.fill(self.tree, 'l1_puppi_iso_pt', muon.puppi_iso_pt)
            self.fill(self.tree, 'l1_puppi_iso04_pt', muon.puppi_iso04_pt)
            self.fill(self.tree, 'l1_puppi_iso03_pt', muon.puppi_iso03_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso_pt', muon.puppi_no_muon_iso_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso04_pt', muon.puppi_no_muon_iso04_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso03_pt', muon.puppi_no_muon_iso03_pt)
            self.fill(self.tree, 'l2_puppi_iso_pt', tau.puppi_iso_pt)
            self.fill(self.tree, 'l2_puppi_iso04_pt', tau.puppi_iso04_pt)
            self.fill(self.tree, 'l2_puppi_iso03_pt', tau.puppi_iso03_pt)
            self.fill(self.tree, 'l1_mini_iso', muon.miniAbsIso)
            self.fill(self.tree, 'l1_mini_reliso', muon.miniRelIso)

        self.fillTree(event)
コード例 #4
0
    def process(self, event):

        super(H2TauTauTreeProducerTauTau, self).process(event)

        tau1 = event.diLepton.leg1()
        tau2 = event.diLepton.leg2()

        self.fillTau(self.tree, 'l1', tau1)
        self.fillTau(self.tree, 'l2', tau2)

        if hasattr(tau1, 'genp'):
            if tau1.genp:
                self.fillGenParticle(self.tree, 'l1_gen', tau1.genp)
        if hasattr(tau2, 'genp'):
            if tau2.genp:
                self.fillGenParticle(self.tree, 'l2_gen', tau2.genp)

        # save the p4 of the visible tau products at the generator level
        # make sure that the reco tau matches with a gen tau that decays into hadrons

        if tau1.genJet() and hasattr(tau1, 'genp') and tau1.genp and abs(
                tau1.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l1_gen_vis', tau1.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(
                tauDecayModes.genDecayModeFromGenJet(tau1.physObj.genJet()))
            self.fill(self.tree, 'l1_gen_decaymode', tau_gen_dm)

        if tau2.genJet() and hasattr(tau2, 'genp') and tau2.genp and abs(
                tau2.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau2.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(
                tauDecayModes.genDecayModeFromGenJet(tau2.physObj.genJet()))
            self.fill(self.tree, 'l2_gen_decaymode', tau_gen_dm)

        if hasattr(tau1, 'weight_trigger'):
            self.fill(self.tree, 'l1_trigger_weight', tau1.weight_trigger)
            self.fill(self.tree, 'l1_trigger_weight_up',
                      getattr(tau1, 'weight_trigger_up', 1.))
            self.fill(self.tree, 'l1_trigger_weight_down',
                      getattr(tau1, 'weight_trigger_down', 1.))

            self.fill(self.tree, 'l2_trigger_weight', tau2.weight_trigger)
            self.fill(self.tree, 'l2_trigger_weight_up',
                      getattr(tau2, 'weight_trigger_up', 1.))
            self.fill(self.tree, 'l2_trigger_weight_down',
                      getattr(tau2, 'weight_trigger_down', 1.))

        self.fill(self.tree, 'mt2', event.mt2_lep)

        if self.cfg_comp.isMC:
            self.fill(self.tree, 'GenSusyMScan1', event.genSusyMScan1)
            self.fill(self.tree, 'GenSusyMScan2', event.genSusyMScan2)
            self.fill(self.tree, 'GenSusyMScan3', event.genSusyMScan3)
            self.fill(self.tree, 'GenSusyMScan4', event.genSusyMScan4)
            self.fill(self.tree, 'GenSusyMNeutralino',
                      event.genSusyMNeutralino)
            self.fill(self.tree, 'GenSusyMChargino', event.genSusyMChargino)
            self.fill(self.tree, 'GenSusyMStau', event.genSusyMStau)
            self.fill(self.tree, 'GenSusyMStau2', event.genSusyMStau2)

        self.fillTree(event)
コード例 #5
0
    def process(self, event):

        super(H2TauTauTreeProducerTauMu, self).process(event)

        tau = event.diLepton.leg2()
        muon = event.diLepton.leg1()

        self.fillTau(self.tree, 'l2', tau)
        self.fillMuon(self.tree, 'l1', muon)

        if hasattr(tau, 'genp') and tau.genp:
            self.fillGenParticle(self.tree, 'l2_gen', tau.genp)
            self.fill(self.tree, 'l2_gen_lepfromtau', tau.isTauLep)

        if hasattr(muon, 'genp') and muon.genp:
            self.fillGenParticle(self.tree, 'l1_gen', muon.genp)
            self.fill(self.tree, 'l1_gen_lepfromtau', muon.isTauLep)

        # save the p4 of the visible tau products at the generator level
        if tau.genJet() and hasattr(tau, 'genp') and tau.genp and abs(
                tau.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(
                tauDecayModes.genDecayModeFromGenJet(tau.physObj.genJet()))
            self.fill(self.tree, 'l2_gen_decaymode', tau_gen_dm)
            if tau_gen_dm in [1, 2, 3, 4]:
                pt_neutral = 0.
                pt_charged = 0.
                for daughter in tau.genJet().daughterPtrVector():
                    id = abs(daughter.pdgId())
                    if id in [22, 11]:
                        pt_neutral += daughter.pt()
                    elif id not in [11, 13, 22] and daughter.charge():
                        if daughter.pt() > pt_charged:
                            pt_charged = daughter.pt()
                if pt_charged > 0.:
                    self.fill(self.tree, 'l2_gen_nc_ratio',
                              (pt_charged - pt_neutral) /
                              (pt_charged + pt_neutral))

        if tau.decayMode() in [1, 2, 3, 4]:
            pt_neutral = 0.
            pt_charged = 0.
            # for cand_ptr in tau.signalCands(): # THIS CRASHES
            for i_cand in xrange(len(tau.signalCands())):
                cand = tau.signalCands()[i_cand]
                id = abs(cand.pdgId())
                if id in [11, 22, 130]:
                    pt_neutral += cand.pt()
                elif id in [211]:
                    if cand.pt() > pt_charged:
                        pt_charged = cand.pt()
            if pt_charged > 0.:
                self.fill(self.tree, 'l2_nc_ratio', (pt_charged - pt_neutral) /
                          (pt_charged + pt_neutral))

        self.fill(self.tree, 'l2_weight_fakerate', event.tauFakeRateWeightUp)
        self.fill(self.tree, 'l2_weight_fakerate_up',
                  event.tauFakeRateWeightDown)
        self.fill(self.tree, 'l2_weight_fakerate_down',
                  event.tauFakeRateWeight)

        fired_triggers = [
            info.name for info in getattr(event, 'trigger_infos', [])
            if info.fired
        ]

        self.fill(self.tree, 'trigger_isomu22',
                  any('IsoMu22_v' in name for name in fired_triggers))
        self.fill(self.tree, 'trigger_isotkmu22',
                  any('IsoTkMu22_v' in name for name in fired_triggers))
        self.fill(
            self.tree, 'trigger_isomu19tau20',
            any('IsoMu19_eta2p1_LooseIsoPFTau20_v' in name
                for name in fired_triggers))

        matched_paths = getattr(event.diLepton, 'matchedPaths', [])
        self.fill(self.tree, 'trigger_matched_isomu22',
                  any('IsoMu22_v' in name for name in matched_paths))
        self.fill(self.tree, 'trigger_matched_isotkmu22',
                  any('IsoTkMu22_v' in name for name in matched_paths))
        self.fill(
            self.tree, 'trigger_matched_isomu19tau20',
            any('IsoMu19_eta2p1_LooseIsoPFTau20_v' in name
                for name in matched_paths))

        if hasattr(self.cfg_ana,
                   'addTauTrackInfo') and self.cfg_ana.addTauTrackInfo:
            # Leading CH part
            if tau.signalChargedHadrCands().size() == 0:
                print 'Uh, tau w/o charged hadron???'

            leading_ch = tau.signalChargedHadrCands()[0].get()
            self.fillTrackInfo(leading_ch, 'tau_lead_ch')

            # Iso part
            i_lead_ch = -1
            n_ch = len(tau.isolationChargedHadrCands())
            n_gamma = len(tau.isolationGammaCands())

            self.fill(self.tree, 'tau_iso_n_ch', n_ch)
            self.fill(self.tree, 'tau_iso_n_gamma', n_gamma)

            for i_cand in xrange(n_ch):
                if i_lead_ch >= 0:
                    if tau.isolationChargedHadrCands()[i_cand].get().pt(
                    ) > tau.isolationChargedHadrCands()[i_lead_ch].get().pt():
                        i_lead_ch = i_cand
                else:
                    i_lead_ch = i_cand

            if i_lead_ch >= 0 and tau.isolationChargedHadrCands(
            )[i_lead_ch].get().pt() > 0.95:
                track = tau.isolationChargedHadrCands()[i_lead_ch].get()
                self.fillTrackInfo(track, 'tau_leadiso_ch')

        if hasattr(self.cfg_ana, 'addIsoInfo') and self.cfg_ana.addIsoInfo:
            self.fill(self.tree, 'l1_puppi_iso_pt', muon.puppi_iso_pt)
            self.fill(self.tree, 'l1_puppi_iso04_pt', muon.puppi_iso04_pt)
            self.fill(self.tree, 'l1_puppi_iso03_pt', muon.puppi_iso03_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso_pt',
                      muon.puppi_no_muon_iso_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso04_pt',
                      muon.puppi_no_muon_iso04_pt)
            self.fill(self.tree, 'l1_puppi_no_muon_iso03_pt',
                      muon.puppi_no_muon_iso03_pt)
            self.fill(self.tree, 'l2_puppi_iso_pt', tau.puppi_iso_pt)
            self.fill(self.tree, 'l2_puppi_iso04_pt', tau.puppi_iso04_pt)
            self.fill(self.tree, 'l2_puppi_iso03_pt', tau.puppi_iso03_pt)
            self.fill(self.tree, 'l1_mini_iso', muon.miniAbsIso)
            self.fill(self.tree, 'l1_mini_reliso', muon.miniRelIso)

        if hasattr(self.cfg_ana, 'addTnPInfo') and self.cfg_ana.addTnPInfo:
            self.fill(self.tree, 'tag', event.tag)
            self.fill(self.tree, 'probe', event.probe)
            if hasattr(muon, 'to'):
                self.fillParticle(self.tree, 'l1_trig_obj', muon.to)
            if hasattr(tau, 'to'):
                self.fillParticle(self.tree, 'l2_trig_obj', tau.to)
            if hasattr(muon, 'L1'):
                self.fillParticle(self.tree, 'l1_L1', muon.L1)
                self.fill(self.tree, 'l1_L1_type', muon.L1flavour)
            if hasattr(tau, 'L1'):
                self.fillParticle(self.tree, 'l2_L1', tau.L1)
                self.fill(self.tree, 'l2_L1_type', tau.L1flavour)
            # RM add further branches related to the HLT filter matching by hand.
            #    I cannot find a better solution for the moment 14/10/2015
            if hasattr(tau, 'hltL2Tau30eta2p2'):
                self.fillParticle(self.tree, 'l2_hltL2Tau30eta2p2',
                                  tau.hltL2Tau30eta2p2)

        self.fillTree(event)
コード例 #6
0
    def process(self, event):

        super(H2TauTauTreeProducerTauTau, self).process(event)

        isSUSY = getattr(self.cfg_ana, 'isSUSY', False)

        tau1 = event.diLepton.leg1()
        tau2 = event.diLepton.leg2()

        self.fillTau(self.tree, 'l1', tau1)
        self.fillTau(self.tree, 'l2', tau2)

        if hasattr(tau1, 'genp'):
            if tau1.genp:
                self.fillGenParticle(self.tree, 'l1_gen', tau1.genp)
        if hasattr(tau2, 'genp'):
            if tau2.genp:
                self.fillGenParticle(self.tree, 'l2_gen', tau2.genp)

        # save the p4 of the visible tau products at the generator level
        # make sure that the reco tau matches with a gen tau that decays into hadrons

        if tau1.genJet() and hasattr(tau1, 'genp') and tau1.genp and abs(tau1.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l1_gen_vis', tau1.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(tauDecayModes.genDecayModeFromGenJet(tau1.physObj.genJet()))
            self.fill(self.tree, 'l1_gen_decaymode', tau_gen_dm)

        if tau2.genJet() and hasattr(tau2, 'genp') and tau2.genp and abs(tau2.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau2.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(tauDecayModes.genDecayModeFromGenJet(tau2.physObj.genJet()))
            self.fill(self.tree, 'l2_gen_decaymode', tau_gen_dm)

        if hasattr(tau1, 'weight_trigger'):
            self.fill(self.tree, 'l1_trigger_weight', tau1.weight_trigger)
            self.fill(self.tree, 'l1_trigger_weight_up', getattr(tau1, 'weight_trigger_up', 1.))
            self.fill(self.tree, 'l1_trigger_weight_down', getattr(tau1, 'weight_trigger_down', 1.))

            self.fill(self.tree, 'l2_trigger_weight', tau2.weight_trigger)
            self.fill(self.tree, 'l2_trigger_weight_up', getattr(tau2, 'weight_trigger_up', 1.))
            self.fill(self.tree, 'l2_trigger_weight_down', getattr(tau2, 'weight_trigger_down', 1.))

        self.fill(self.tree, 'mt2',  event.mt2)
        self.fill(self.tree, 'mt2_lep',  event.mt2_lep)
        self.fill(self.tree, 'mt2_mvamet',  event.mt2_mvamet)
        self.fill(self.tree, 'mt2_rawpfmet',  event.mt2_rawpfmet)
        
        self.fill(self.tree, 'minDphiMETJets', event.minDphiMETJets)


        fired_triggers = [info.name for info in getattr(event, 'trigger_infos', []) if info.fired]

        self.fill(self.tree, 'trigger_ditau35', any('HLT_DoubleMediumIsoPFTau35_Trk1_eta2p1_Reg_v' in name for name in fired_triggers) or isSUSY)
        self.fill(self.tree, 'trigger_ditau35_combiso', any('HLT_DoubleMediumCombinedIsoPFTau35_Trk1_eta2p1_Reg_' in name for name in fired_triggers) or isSUSY)
        self.fill(self.tree, 'trigger_singletau140', any('HLT_VLooseIsoPFTau140_Trk50_eta2p1_v' in name for name in fired_triggers) or isSUSY)
        self.fill(self.tree, 'trigger_singletau120', any('HLT_VLooseIsoPFTau120_Trk50_eta2p1_v' in name for name in fired_triggers) or isSUSY)

        matched_paths = getattr(event.diLepton, 'matchedPaths', [])
        self.fill(self.tree, 'trigger_matched_ditau35', any('HLT_DoubleMediumIsoPFTau35_Trk1_eta2p1_Reg_v' in name for name in matched_paths) or isSUSY)
        self.fill(self.tree, 'trigger_matched_ditau35_combiso', any('HLT_DoubleMediumCombinedIsoPFTau35_Trk1_eta2p1_Reg_' in name for name in matched_paths) or isSUSY)
        self.fill(self.tree, 'trigger_matched_singletau140', any('HLT_VLooseIsoPFTau140_Trk50_eta2p1_v' in name for name in matched_paths) or isSUSY)
        self.fill(self.tree, 'trigger_matched_singletau120', any('HLT_VLooseIsoPFTau120_Trk50_eta2p1_v' in name for name in matched_paths) or isSUSY)

        if self.cfg_comp.isMC and isSUSY:
            self.fill(self.tree, 'GenSusyMScan1',  getattr(event, 'genSusyMScan1', -999.))
            self.fill(self.tree, 'GenSusyMScan2',  getattr(event, 'genSusyMScan2', -999.))
            self.fill(self.tree, 'GenSusyMScan3',  getattr(event, 'genSusyMScan3', -999.))
            self.fill(self.tree, 'GenSusyMScan4',  getattr(event, 'genSusyMScan4', -999.))
            self.fill(self.tree, 'GenSusyMNeutralino',  getattr(event, 'genSusyMNeutralino', -999.))
            self.fill(self.tree, 'GenSusyMChargino',  getattr(event, 'genSusyMChargino', -999.))
            self.fill(self.tree, 'GenSusyMStau',  getattr(event, 'genSusyMStau', -999.))
            self.fill(self.tree, 'GenSusyMStau2',  getattr(event, 'genSusyMStau2', -999.))

        
            self.fillLHEWeights(self.tree, event)

            self.fill(self.tree, 'gen_dichargino_pt', HTTGenAnalyzer.getSusySystem(event).pt())

        self.fillTree(event)
コード例 #7
0
    def process(self, event):

        super(H2TauTauTreeProducerTauEle, self).process(event)

        tau = event.diLepton.leg2()
        ele = event.diLepton.leg1()

        self.fillTau(self.tree, 'l2', tau)
        self.fillEle(self.tree, 'l1', ele)

        if hasattr(tau, 'genp') and tau.genp:
            self.fillGenParticle(self.tree, 'l2_gen', tau.genp)
            self.fill(self.tree, 'l2_gen_lepfromtau', tau.isTauLep)
        if hasattr(ele, 'genp') and ele.genp:
            self.fillGenParticle(self.tree, 'l1_gen', ele.genp)
            self.fill(self.tree, 'l1_gen_lepfromtau', ele.isTauLep)

        if hasattr(ele, 'triggerobjects'):
            n_triggerobjects = len(ele.triggerobjects)
            self.fill(self.tree, 'l1_ntriggerobjects', n_triggerobjects)
            if n_triggerobjects >= 1:
                self.fillParticle(self.tree, 'l1_triggerobject1',
                                  ele.triggerobjects[0])
            if n_triggerobjects >= 2:
                self.fillParticle(self.tree, 'l1_triggerobject2',
                                  ele.triggerobjects[1])

        # save the p4 of the visible tau products at the generator level
        if tau.genJet() and hasattr(tau, 'genp') and tau.genp and abs(
                tau.genp.pdgId()) == 15:
            self.fillParticle(self.tree, 'l2_gen_vis', tau.physObj.genJet())
            tau_gen_dm = tauDecayModes.translateGenModeToInt(
                tauDecayModes.genDecayModeFromGenJet(tau.physObj.genJet()))
            self.fill(self.tree, 'l2_gen_decaymode', tau_gen_dm)
            if tau_gen_dm in [1, 2, 3, 4]:
                pt_neutral = 0.
                pt_charged = 0.
                for daughter in tau.genJet().daughterPtrVector():
                    id = abs(daughter.pdgId())
                    if id in [22, 11]:
                        pt_neutral += daughter.pt()
                    elif id not in [11, 13, 22] and daughter.charge():
                        if daughter.pt() > pt_charged:
                            pt_charged = daughter.pt()
                if pt_charged > 0.:
                    self.fill(self.tree, 'l2_gen_nc_ratio',
                              (pt_charged - pt_neutral) /
                              (pt_charged + pt_neutral))

        if tau.decayMode() in [1, 2, 3, 4]:
            pt_neutral = 0.
            pt_charged = 0.
            # for cand_ptr in tau.signalCands(): # THIS CRASHES
            for i_cand in xrange(len(tau.signalCands())):
                cand = tau.signalCands()[i_cand]
                id = abs(cand.pdgId())
                if id in [11, 22, 130]:
                    pt_neutral += cand.pt()
                elif id in [211]:
                    if cand.pt() > pt_charged:
                        pt_charged = cand.pt()
            if pt_charged > 0.:
                self.fill(self.tree, 'l2_nc_ratio', (pt_charged - pt_neutral) /
                          (pt_charged + pt_neutral))

        self.fill(self.tree, 'l2_weight_fakerate', event.tauFakeRateWeight)
        self.fill(self.tree, 'l2_weight_fakerate_up',
                  event.tauFakeRateWeightUp)
        self.fill(self.tree, 'l2_weight_fakerate_down',
                  event.tauFakeRateWeightDown)

        fired_triggers = [
            info.name for info in getattr(event, 'trigger_infos', [])
            if info.fired
        ]

        if hasattr(self.cfg_ana,
                   'addTauTrackInfo') and self.cfg_ana.addTauTrackInfo:
            # Leading CH part
            if tau.signalChargedHadrCands().size() == 0:
                print 'Uh, tau w/o charged hadron???'

            leading_ch = tau.signalChargedHadrCands()[0].get()
            self.fillTrackInfo(leading_ch, 'tau_lead_ch')

            # Iso part
            i_lead_ch = -1
            n_ch = len(tau.isolationChargedHadrCands())
            n_gamma = len(tau.isolationGammaCands())

            self.fill(self.tree, 'tau_iso_n_ch', n_ch)
            self.fill(self.tree, 'tau_iso_n_gamma', n_gamma)

            for i_cand in xrange(n_ch):
                if i_lead_ch >= 0:
                    if tau.isolationChargedHadrCands()[i_cand].get().pt(
                    ) > tau.isolationChargedHadrCands()[i_lead_ch].get().pt():
                        i_lead_ch = i_cand
                else:
                    i_lead_ch = i_cand

            if i_lead_ch >= 0 and tau.isolationChargedHadrCands(
            )[i_lead_ch].get().pt() > 0.95:
                track = tau.isolationChargedHadrCands()[i_lead_ch].get()
                self.fillTrackInfo(track, 'tau_leadiso_ch')

        #self.fill(self.tree, 'weight_zll', event.zllWeight)

        self.fillTree(event)