def cutFlow(cutTreeMC, model) :
  out = []

  cutTreeMC.Attach(count_total)
  if isCmssm(model) :
    cutTreeMC.TAttach(count_total,selection)
    out.append( tripleScale(model = switches()["model"], cutTree = cutTreeMC, cut = count_total, label = "before") )
  elif isSms(model) :
  #  cutTreeMC.TAttach(count_total,smsFilter)
    out.append( smsOps(model = switches()["model"], cutTree = cutTreeMC, cut =
    count_total, label = "before") )
    cutTreeMC.TAttach(count_total,selection)

  if switches()["selection"]!="muon" :
    cutTreeMC.TAttach(selection,oddElectron)
    cutTreeMC.TAttach(oddElectron,oddPhoton)
    cutTreeMC.TAttach(oddPhoton,numComLeptons)
    cutTreeMC.TAttach(numComLeptons,numComPhotons)
    cutTreeMC.TAttach(numComPhotons,LeadingJetEta)
    cutTreeMC.TAttach(LeadingJetEta,badMuonInJet)
    cutTreeMC.TAttach(badMuonInJet,oddJet)
    cutTreeMC.TAttach(oddJet,numComJetsGeq2)
    cutTreeMC.TAttach(numComJetsGeq2,secondJetET)
    cutTreeMC.TAttach(secondJetET,deadECAL_MC)
    cutTreeMC.TAttach(deadECAL_MC,MHToverMET)
  else :
    cutTreeMC.TAttach(selection,oddElectron)
    cutTreeMC.TAttach(oddElectron,oddPhoton)
    cutTreeMC.TAttach(oddPhoton,numComElectrons)
    cutTreeMC.TAttach(numComElectrons,numComMuons)
    cutTreeMC.TAttach(numComMuons,minDRMuonJetCut)
    cutTreeMC.TAttach(minDRMuonJetCut,ZMassCut)
    cutTreeMC.TAttach(ZMassCut,CommonMHTovHT)
    cutTreeMC.TAttach(CommonMHTovHT,PFMTCut30)
    cutTreeMC.TAttach(PFMTCut30,numComPhotons)
    cutTreeMC.TAttach(numComPhotons,LeadingJetEta)
    cutTreeMC.TAttach(LeadingJetEta,badMuonInJet)
    cutTreeMC.TAttach(badMuonInJet,oddJet)
    cutTreeMC.TAttach(oddJet,numComJetsGeq2)
    cutTreeMC.TAttach(numComJetsGeq2,secondJetET)
    cutTreeMC.TAttach(secondJetET,deadECAL_MC)
    cutTreeMC.TAttach(deadECAL_MC,MHToverMET)
  

  alphaTSlices = [(55,None),(52,53),(53,55)]
  for slice in alphaTSlices:
     print slice
     aTlow = OP_HadAlphaTCut(slice[0]/100.)
     out.append(aTlow)
     if slice[1] is not None: 
       aThigh = OP_HadAlphaTCut(slice[1]/100.)
       out.append(aThigh)
       cutTreeMC.TAttach(MHToverMET,aThigh)
       cutTreeMC.FAttach(aThigh,aTlow)
     else:
       cutTreeMC.TAttach(MHToverMET,aTlow)
     #Need to do some btagging as well!
     out.append( addBinnedStuff(model = switches()["model"],
                            cutTree = cutTreeMC,
                            cut = aTlow,
                            htBins = [275, 325] + [375+100*i for i in range(6)],
                            label2 = "AlphaT%d_%s"%(int(slice[0]), "" if slice[1] is None else "%d_"%int(slice[1])),extra = MChiCut))


     for btags in [("==",0),("==",1),("==",2),(">",2)]:
         if slice[0]!= 55: continue
         btag = OP_NumCommonBtagJets(btags[0],5,btags[1],0.679)
         out.append(btag)
         cutTreeMC.TAttach(aTlow,btag)
         out.append( addBinnedStuff(model = switches()["model"],
                                cutTree = cutTreeMC,
                                cut = btag,
                                htBins = [275, 325] + [375+100*i for i in range(6)],
                                label2 = "btag_%s_%i_AlphaT%d_%s"%(btags[0],btags[1],int(slice[0]), "" if slice[1] is None else "%d_"%int(slice[1])),extra = MChiCut))



  if switches()["selection"]=="muon" :
    for btags in [("==",0),("==",1),("==",2),(">",2),(">=",1)]:
        BtagNoAlphaT = OP_NumCommonBtagJets(btags[0],5,btags[1],0.679)
        out.append(BtagNoAlphaT)    
        MuonEta = OP_AditionalMuonCuts(10.,2.1)
        MuonPt = OP_LeadingMuonCut(45.)
        cutTreeMC.TAttach(MHToverMET,MuonPt)   
        cutTreeMC.TAttach(MuonPt,MuonEta)
        cutTreeMC.TAttach(MuonEta,BtagNoAlphaT)
        out.append(MuonEta)
        out.append(MuonPt)
        out.append( addBinnedStuff(model = switches()["model"],
                            cutTree = cutTreeMC,
                            cut = BtagNoAlphaT,
                            htBins = [275, 325] + [375+100*i for i in range(6)],
                            label2 = "btag_%s_%i_NoAlphaT_"%(btags[0],btags[1]),extra = MChiCut))

  return out
Example #2
0
def cutFlow(cutTreeMC, model) :
  out = []

  cutTreeMC.Attach(count_total)
  if isCmssm(model) :
    cutTreeMC.TAttach(count_total,selection)
    out.append( tripleScale(model = switches()["model"], cutTree = cutTreeMC, cut = count_total, label = "before") )
  elif isSms(model) :
  #  cutTreeMC.TAttach(count_total,smsFilter)
    out.append( smsOps(model = switches()["model"], cutTree = cutTreeMC, cut =
    count_total, label = "before") )
    cutTreeMC.TAttach(count_total,selection)

  if switches()["selection"]!="muon" :
    cutTreeMC.TAttach(selection,oddMuon)
    cutTreeMC.TAttach(oddMuon,oddElectron)
    cutTreeMC.TAttach(oddElectron,oddPhoton)
    cutTreeMC.TAttach(oddPhoton,numComLeptons)
    cutTreeMC.TAttach(numComLeptons,numComPhotons)
    cutTreeMC.TAttach(numComPhotons,LeadingJetEta)
    cutTreeMC.TAttach(LeadingJetEta,badMuonInJet)
    cutTreeMC.TAttach(badMuonInJet,oddJet)
    cutTreeMC.TAttach(oddJet,numComJetsGeq2)
    cutTreeMC.TAttach(numComJetsGeq2,secondJetET)
    cutTreeMC.TAttach(secondJetET,deadECAL_MC)
    cutTreeMC.TAttach(deadECAL_MC,MHToverMET)
    cutTreeMC.TAttach(MHToverMET,alphaT)
    cutTreeMC.TAttach(MHToverMET,alphaT70)
    cutTreeMC.FAttach(alphaT70,alphaT55)
    cutTreeMC.FAttach(alphaT55,alphaT53)
  else :
    cutTreeMC.TAttach(selection,oddMuon)
    cutTreeMC.TAttach(oddMuon,oddElectron)
    cutTreeMC.TAttach(oddElectron,oddPhoton)
    cutTreeMC.TAttach(oddPhoton,numComElectrons)
    cutTreeMC.TAttach(numComElectrons,numComMuons)
    cutTreeMC.TAttach(numComMuons,minDRMuonJetCut)
    cutTreeMC.TAttach(minDRMuonJetCut,ZMassCut)
    cutTreeMC.TAttach(ZMassCut,CommonMHTovHT)
    cutTreeMC.TAttach(CommonMHTovHT,PFMTCut30)
    cutTreeMC.TAttach(PFMTCut30,numComPhotons)
    cutTreeMC.TAttach(numComPhotons,LeadingJetEta)
    cutTreeMC.TAttach(LeadingJetEta,badMuonInJet)
    cutTreeMC.TAttach(badMuonInJet,oddJet)
    cutTreeMC.TAttach(oddJet,numComJetsGeq2)
    cutTreeMC.TAttach(numComJetsGeq2,secondJetET)
    cutTreeMC.TAttach(secondJetET,deadECAL_MC)
    cutTreeMC.TAttach(deadECAL_MC,MHToverMET)
    cutTreeMC.TAttach(MHToverMET,alphaT)
    cutTreeMC.TAttach(MHToverMET,alphaT70)
    cutTreeMC.FAttach(alphaT70,alphaT55)
    cutTreeMC.FAttach(alphaT55,alphaT53)
  # out.append( addBinnedStuff(model = switches()["model"],
  #                           cutTree = cutTreeMC,
  #                           cut = alphaT,
  #                           htBins = [250, 300, 350, 450],
  #                           label2 = "") )
  out.append( addBinnedStuff(model = switches()["model"],
                            cutTree = cutTreeMC,
                            cut = alphaT,
                            htBins = [275, 325] + [375+100*i for i in range(6)],
                            label2 = ""),extra = MChiCut)

  # out.append( addBinnedStuff(model = switches()["model"],
  #                           cutTree = cutTreeMC,
  #                           cut = alphaT53,
  #                           htBins = [250, 300, 350, 450],
  #                           label2 = "AlphaT53_55_") )

  out.append( addBinnedStuff(model = switches()["model"],
                            cutTree = cutTreeMC,
                            cut = alphaT53,
                            htBins = [275, 325] + [375+100*i for i in range(6)],
                            label2 = "AlphaT53_55_"),extra = MChiCut)

  # out.append( addBinnedStuff(model = switches()["model"],
  #                           cutTree = cutTreeMC,
  #                           cut = alphaT55,
  #                           htBins = [250, 300, 350, 450],
  #                           label2 = "AlphaT55_70_") )

  out.append( addBinnedStuff(model = switches()["model"],
                            cutTree = cutTreeMC,
                            cut = alphaT55,
                            htBins = [275, 325] + [375+100*i for i in range(6)],
                            label2 = "AlphaT55_70_"),extra = MChiCut)

  # out.append( addBinnedStuff(model = switches()["model"],
  #                           cutTree = cutTreeMC,
  #                           cut = alphaT70,
  #                           htBins = [250, 300, 350, 450],
  #                           label2 = "AlphaT70_inf") )

  out.append( addBinnedStuff(model = switches()["model"],
                            cutTree = cutTreeMC,
                            cut = alphaT70,
                            htBins = [275, 325] + [375+100*i for i in range(6)],
                            label2 = "AlphaT70_inf_"),extra = MChiCut)
  return out