def mAnalysis(photons, electrons, muons, nu_es, nu_ms, h2M3M4, suffix): # Leading/Sub-leading Photon Analysis leptons = electrons + muons nus = nu_es + nu_ms leadPhoton = selectLead(photons) subPhoton = selectSub(photons) lepton = selectLead(leptons) # Let signal lepton be the one w/ highest PT nu = selectLead(nus) if leadPhoton != None : histogramBuilder.fillPtHistograms([leadPhoton], 'Photon(Leading)_Pt_' + suffix) histogramBuilder.fillEtaHistograms([leadPhoton], 'Photon(Leading)_Eta_' + suffix) # Near-Z-Mass checks if(leadPhoton != None and subPhoton != None and lepton != None): m2_L = (leadPhoton + lepton).M() m2_S = (subPhoton + lepton).M() m3 = (leadPhoton + subPhoton + lepton).M() histogramBuilder.fillMHistograms(m2_L, 'Z2M(A_Lead+L)_' + suffix) histogramBuilder.fillMHistograms(m2_S, 'Z2M(A_Sub+L)_' + suffix) histogramBuilder.fillMHistograms(m3, 'Z3M(A+A+L)_' + suffix) # Near-W-Mass checks if(leadPhoton != None and subPhoton != None and lepton != None and nu != None): m3 = (leadPhoton + lepton + nu).M() # no sub leading lepton m4 = (leadPhoton + subPhoton + lepton + nu).M() histogramBuilder.fillMHistograms(m3, '3M(A+L+Nu)_' + suffix) histogramBuilder.fillMHistograms(m4, '4M(A+A+L+Nu)_' + suffix) h2M3M4.Fill(m3, m4)
def selectOnElectronKinematics(electrons): #if electrons != None: electrons = filter(lambda electron: electron.Pt() > minElectronPt, electrons) histogramBuilder.fillPtHistograms(electrons, 'Electron_Pt_PostElectronPtCut') electrons = filter(lambda electron: abs(electron.Eta()) < maxElectronEta, electrons) histogramBuilder.fillEtaHistograms(electrons, 'Electron_Eta_PostElectronEtaCut') return electrons
def MakeHistograms(tree, channel, weight): histogramBuilder.fillPtHistograms(channel, tree.pt_leadph12, weight) histogramBuilder.fillPtCategoryHistograms(channel, tree.pt_leadph12, weight) # Hack to Change Selection to Photon Pt > 40 if(tree.pt_leadph12 > 40): histogramBuilder.fillCountHistograms(channel, weight)
def MakeHistograms(tree, channel, aqgc_weight_index, aqgc_weight, sm_weight): histogramBuilder.fillCountHistograms( channel + "_All_aQGC_Weight_" + str(aqgc_weight_index), aqgc_weight) histogramBuilder.fillPtHistograms( channel + "_All_LeadPhoton_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight) histogramBuilder.fillPtHistograms( channel + "_All_SublPhoton_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_sublph12, aqgc_weight) histogramBuilder.fill2DPtHistograms( channel + "_All_LeadAndSublPhoton_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_leadph12, tree.pt_sublph12, aqgc_weight) histogramBuilder.fillPtCategoryHistograms( channel + "All_LeadPhoton_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight) MakeCovarianceHistograms(tree, channel + "_All", aqgc_weight_index, aqgc_weight, sm_weight) # Make Separate Histograms for EBEB, EB EE, and EE EB Cateogries MakePhotonLocationHistograms(tree, channel, aqgc_weight_index, aqgc_weight, sm_weight) # Make Histograms for Different Cuts on the SubLeading Photon Pt MakeSubPhotonCutHistograms(tree, channel, aqgc_weight_index, aqgc_weight, sm_weight)
def MakeHistograms(prefix, photons, weight): leadPhoton = selectLead(photons) histogramBuilder.fillPtHistograms(prefix, leadPhoton.Pt(), weight) histogramBuilder.fillPtCategoryHistograms(prefix, leadPhoton.Pt(), weight) if(leadPhoton.Pt() > 40): histogramBuilder.fillCountHistograms(prefix, weight)
def MakeCovarianceHistograms(tree, channel, aqgc_weight_index, aqgc_weight, sm_weight): histogramBuilder.fillPtCategoryHistograms( channel + "_aQGC_Covariance_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight * sm_weight) histogramBuilder.fillPtHistograms( channel + "_aQGC_Covariance_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight * sm_weight) """
def MakeMtHistograms(prefix, leptons, neutrinos): summed_nu=TLorentzVector() for nu in neutrinos: summed_nu += nu histogramBuilder.fillPtHistograms(prefix+"Summed_Nu", summed_nu.Pt()) for lepton in leptons: Mt2 = 2*lepton.Et()*summed_nu.Et()*(1-cos(lepton.DeltaPhi(summed_nu))) Mt = sqrt(Mt2) histogramBuilder.fillMtHistograms(prefix, Mt)
def MakeParticleTypeHistograms(prefix, particles, particleType): histogramBuilder.fillMultiplicityHistograms(prefix+"_"+particleType, len(particles)) for particle in particles: histogramBuilder.fillPtHistograms(prefix+"_"+particleType,particle.Pt()) histogramBuilder.fillEtaHistograms(prefix+"_"+particleType, particle.Eta()) histogramBuilder.fillStatusHistograms(prefix+"_" + particleType, particle.Status()) histogramBuilder.fillPDGIDHistograms(prefix+"_"+particleType, particle.PID()) histogramBuilder.fillPDGIDHistograms(prefix+"_"+particleType+"Mother", particle.MomPID())
def selectOnPhotonKinematics(photons): #if photons != None: # Post Cut Histograms photons = filter(lambda photon: photon.Pt() > minPhotonPt, photons) histogramBuilder.fillPtHistograms(photons, 'Photon_Pt_PostPhotonPtCut') photons = filter(lambda photon: abs(photon.Eta()) < maxPhotonEta, photons) #photons = filter(lambda photon: abs(photon.Eta()) < minPhotonEndCapEta # or abs(photon.Eta()) > maxPhotonEndCapEta, photons) histogramBuilder.fillEtaHistograms(photons, 'Photon_Eta_PostPhotonEtaCut') return photons
def MakePhotonLocationHistograms(tree, channel, aqgc_weight_index, aqgc_weight, sm_weight): if (tree.isEB_leadph12 and tree.isEB_sublph12): histogramBuilder.fillPtHistograms( channel + "_EBEB_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight) MakeCovarianceHistograms(tree, channel + "_EBEB", aqgc_weight_index, aqgc_weight, sm_weight) if (tree.isEB_leadph12 and tree.isEE_sublph12): histogramBuilder.fillPtHistograms( channel + "_EBEE_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight) MakeCovarianceHistograms(tree, channel + "_EBEE", aqgc_weight_index, aqgc_weight, sm_weight) #histogramBuilder.fillPtHistograms(channel+"_EBEEandEEEB_aQGC_Weight_"+str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight) if (tree.isEE_leadph12 and tree.isEB_sublph12): histogramBuilder.fillPtHistograms( channel + "_EEEB_aQGC_Weight_" + str(aqgc_weight_index), tree.pt_leadph12, aqgc_weight) MakeCovarianceHistograms(tree, channel + "_EEEB", aqgc_weight_index, aqgc_weight, sm_weight)
def selectOnMuonParent(muons): #if muons != None: muons = filter(lambda muon: abs(muon.MomPID()) == 24, muons) histogramBuilder.fillPtHistograms(muons, 'Muon_Pt_PostWParentCut') histogramBuilder.fillEtaHistograms(muons, 'Muon_Eta_PostWParentCut') return muons
def selectOnElectronParent(electrons): #if electrons != None: electrons = filter(lambda electron: abs(electron.MomPID()) == 24, electrons) histogramBuilder.fillPtHistograms(electrons, 'Electron_Pt_PostWParentCut') histogramBuilder.fillEtaHistograms(electrons, 'Electron_Eta_PostWParentCut') return electrons
def selectOnPhotonParent(photons): #if photons != None: filter_photons = filter(lambda photon: abs(photon.MomPID()) < 25, photons) histogramBuilder.fillPtHistograms(filter_photons, 'Photon_Pt_PostParentCut') histogramBuilder.fillEtaHistograms(filter_photons, 'Photon_Eta_PostParentCut') return filter_photons
def selectOnMuonKinematics(muons): muons = filter(lambda muon: muon.Pt() > minMuonPt, muons) histogramBuilder.fillPtHistograms(muons, 'Muon_Pt_PostMuonPtCut') muons = filter(lambda muon: abs(muon.Eta()) < maxMuonEta, muons) histogramBuilder.fillEtaHistograms(muons, 'Muon_Eta_PostMuonEtaCut') return muons