Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-19 23:20:32

0001 from ROOT import TFile, TH1D
0002 import argparse
0003 
0004 parser = argparse.ArgumentParser()
0005 parser.add_argument("--infile", type=str, default="debug.root", help="Input file name (include '.root' suffix). Full or relative directory path allowed.")
0006 parser.add_argument("--maxEvents", type=int, default=20, help="Define maximum number of events to run on.")
0007 parser.add_argument("--dontRunTCs", action="store_true", default=False, help="Don't check for duplicates in the TC collection.")
0008 parser.add_argument("--runExtraObjects", action="store_true", default=False, help="Also check for duplicates in the full pT5, pT3 and T5 collections.")
0009 parser.add_argument("--debugLevel", type=int, default=0, choices=[0,1,2], help="0: No debug output, 1: Event per event output, 2: Object level output.")
0010 args = parser.parse_args()
0011 
0012 
0013 infile = TFile(args.infile,"read")
0014 intree = infile.Get("tree")
0015 
0016 
0017 def simTrkInfo(event,dict_):
0018   dict_["N"] = dict_["N"] + len(event.sim_pt)
0019   for simTrk in range(len(event.sim_pt)):
0020     isGood = False
0021     if event.sim_isGood[simTrk]:
0022       isGood = True
0023       dict_["N_good"] = dict_["N_good"] + 1
0024     if event.sim_TC_matched[simTrk] > 0:
0025       dict_["N_matched"] = dict_["N_matched"] + 1
0026       if isGood: dict_["N_goodMatched"] = dict_["N_goodMatched"] + 1
0027       if event.sim_TC_matched[simTrk] == 1:
0028         dict_["N_singleMatched"] = dict_["N_singleMatched"] + 1
0029         if isGood: dict_["N_goodSingleMatched"] = dict_["N_goodSingleMatched"] + 1
0030       if event.sim_TC_matched[simTrk] > 1:
0031         dict_["N_dup"] = dict_["N_dup"] + 1
0032         if isGood: dict_["N_goodDup"] = dict_["N_goodDup"] + 1
0033       for tc in range(len(event.tc_matched_simIdx)):
0034         for simIdxOther in range(len(event.tc_matched_simIdx[tc])):
0035           if event.tc_matched_simIdx[tc][simIdxOther] == simTrk:
0036             if event.tc_type[tc] == 7:
0037               dict_["N_matchedWpT5"] = dict_["N_matchedWpT5"] + 1
0038               if isGood: dict_["N_goodMatchedWpT5"] = dict_["N_goodMatchedWpT5"] + 1
0039             if event.tc_type[tc] == 5:
0040               dict_["N_matchedWpT3"] = dict_["N_matchedWpT3"] + 1
0041               if isGood: dict_["N_goodMatchedWpT3"] = dict_["N_goodMatchedWpT3"] + 1
0042             if event.tc_type[tc] == 4:
0043               dict_["N_matchedWT5"] = dict_["N_matchedWT5"] + 1
0044               if isGood: dict_["N_goodMatchedWT5"] = dict_["N_goodMatchedWT5"] + 1
0045             if event.tc_type[tc] == 8:
0046               dict_["N_matchedWpLS"] = dict_["N_matchedWpLS"] + 1
0047               if isGood: dict_["N_goodMatchedWpLS"] = dict_["N_goodMatchedWpLS"] + 1
0048 
0049   return dict_
0050 
0051 
0052 def dupOfTCObj(tc,objType,event,dict_,debug=False):
0053   isDuplicate = False
0054   isDuplicateWpT5 = False
0055   isDuplicateWpT3 = False
0056   isDuplicateWT5 = False
0057   isDuplicateWpLS = False
0058 
0059   dict_["N_"+objType] = dict_["N_"+objType] + 1
0060 
0061   if event.tc_isFake[tc] == 1: dict_["N_"+objType+"fakes"] = dict_["N_"+objType+"fakes"] + 1
0062   for simIdx in range(len(event.tc_matched_simIdx[tc])):
0063     for tcOther in range(len(event.tc_pt)):
0064       if tc==tcOther: continue
0065       for simIdxOther in range(len(event.tc_matched_simIdx[tcOther])):
0066         if event.tc_matched_simIdx[tc][simIdx] == event.tc_matched_simIdx[tcOther][simIdxOther]:
0067           isDuplicate = True
0068           if debug:
0069             print ""
0070             print "TC_"+objType+"[%d] pt = %.2f, eta = %.2f, phi = %.2f" %( tc, event.tc_pt[tc], event.tc_eta[tc], event.tc_phi[tc] )
0071             print "Matched simTrk pt = %.2f" %event.sim_pt[event.tc_matched_simIdx[tc][simIdx]]
0072             print "Duplicate of type %d:" %event.tc_type[tcOther]
0073             print "\tTC_[%d] pt = %.2f, eta = %.2f, phi = %.2f" %( tcOther, event.tc_pt[tcOther], event.tc_eta[tcOther], event.tc_phi[tcOther] )
0074           if event.tc_type[tcOther] == 7: isDuplicateWpT5 = True
0075           if event.tc_type[tcOther] == 5: isDuplicateWpT3 = True
0076           if event.tc_type[tcOther] == 4: isDuplicateWT5 = True
0077           if event.tc_type[tcOther] == 8: isDuplicateWpLS = True
0078 
0079   if isDuplicate: dict_["Ndup_"+objType+"Total"] = dict_["Ndup_"+objType+"Total"] + 1
0080   if isDuplicateWpT5: dict_["Ndup_"+objType+"WpT5"] = dict_["Ndup_"+objType+"WpT5"] + 1
0081   if isDuplicateWpT3: dict_["Ndup_"+objType+"WpT3"] = dict_["Ndup_"+objType+"WpT3"] + 1
0082   if isDuplicateWT5: dict_["Ndup_"+objType+"WT5"] = dict_["Ndup_"+objType+"WT5"] + 1
0083   if isDuplicateWpLS: dict_["Ndup_"+objType+"WpLS"] = dict_["Ndup_"+objType+"WpLS"] + 1
0084 
0085   return dict_
0086 
0087 
0088 def dupOfTC(event,dict_,debug=False):
0089   for tc in range(len(event.tc_pt)):
0090     if event.tc_type[tc] == 7: dict_ = dupOfTCObj(tc,"pT5",event,dict_,debug=debug)
0091     if event.tc_type[tc] == 5: dict_ = dupOfTCObj(tc,"pT3",event,dict_,debug=debug)
0092     if event.tc_type[tc] == 4: dict_ = dupOfTCObj(tc,"T5",event,dict_,debug=debug)
0093     if event.tc_type[tc] == 8: dict_ = dupOfTCObj(tc,"pLS",event,dict_,debug=debug)
0094 
0095   return dict_
0096 
0097 
0098 def dupOfpT5(event,dict_,debug=False):
0099   if debug: print "Number of pT5: ",len(event.pT5_pt)
0100   dict_["N"] = dict_["N"] + len(event.pT5_pt)
0101   for pT5 in range(len(event.pT5_pt)):
0102     isDuplicateWpT5 = False
0103     isDuplicateWpT3 = False
0104     isDuplicateWT5 = False
0105 
0106     if event.pT5_isFake[pT5] == 1: dict_["Nfakes"] = dict_["Nfakes"] + 1
0107     if event.pT5_isDuplicate[pT5] == 1: isDuplicateWpT5 = True
0108 
0109     for j in range(len(event.pT5_matched_simIdx[pT5])):
0110       if debug:
0111         if event.pT5_isDuplicate[pT5]:
0112           print "pT5[",pT5,"]"
0113           print "simTrk_pt = ",event.sim_pt[event.pT5_matched_simIdx[pT5][j]]
0114 
0115       if event.sim_pT3_matched[event.pT5_matched_simIdx[pT5][j]] > 0:
0116         isDuplicateWpT3 = True
0117         if debug:
0118           print ""
0119           print "pT5_pt = ",event.pT5_pt[pT5]
0120           print "simTrk_pt = ",event.sim_pt[event.pT5_matched_simIdx[pT5][j]]
0121           for pT3 in range(len(event.pT3_pt)):
0122             for k in range(len(event.pT3_matched_simIdx[pT3])):
0123               if event.pT5_matched_simIdx[pT5][j] == event.pT3_matched_simIdx[pT3][k]:
0124                 print ""
0125                 print "pT3_pt = ",event.pT3_pt[pT3]
0126                 print "simTrk_pt = ",event.sim_pt[event.pT3_matched_simIdx[pT3][k]]
0127                 
0128       if event.sim_T5_matched[event.pT5_matched_simIdx[pT5][j]] > 0:
0129         isDuplicateWT5 = True
0130         if debug:
0131           print ""
0132           print "pT5_pt = ",event.pT5_pt[pT5]
0133           print "simTrk_pt = ",event.sim_pt[event.pT5_matched_simIdx[pT5][j]]
0134           for T5 in range(len(event.t5_pt)):
0135             for k in range(len(event.t5_matched_simIdx[T5])):
0136               if event.pT5_matched_simIdx[pT5][j] == event.t5_matched_simIdx[T5][k]:
0137                 print ""
0138                 print "T5_pt = ",event.t5_pt[T5]
0139                 print "simTrk_pt = ",event.sim_pt[event.t5_matched_simIdx[T5][k]]
0140 
0141     if isDuplicateWpT5:
0142       if isDuplicateWpT3:
0143         if isDuplicateWT5:
0144           dict_["Ndup_Wall"] = dict_["Ndup_Wall"] + 1
0145         else:
0146           dict_["Ndup_WpT5ApT3"] = dict_["Ndup_WpT5ApT3"] + 1
0147       else:
0148         if isDuplicateWT5:
0149           dict_["Ndup_WpT5AT5"] = dict_["Ndup_WpT5AT5"] + 1
0150         else:
0151           dict_["Ndup_WpT5"] = dict_["Ndup_WpT5"] + 1
0152     else:
0153       if isDuplicateWpT3:
0154         if isDuplicateWT5:
0155           dict_["Ndup_WpT3AT5"] = dict_["Ndup_WpT3AT5"] + 1
0156         else:
0157           dict_["Ndup_WpT3"] = dict_["Ndup_WpT3"] + 1
0158       else:
0159         if isDuplicateWT5:
0160           dict_["Ndup_WT5"] = dict_["Ndup_WT5"] + 1
0161 
0162   return dict_
0163 
0164 
0165 def dupOfpT3(event,dict_,debug=False):
0166   if debug: print "Number of pT3: ",len(event.pT3_pt)
0167   dict_["N"] = dict_["N"] + len(event.pT3_pt)
0168   for pT3 in range(len(event.pT3_pt)):
0169     isDuplicateWpT5 = False
0170     isDuplicateWpT3 = False
0171     isDuplicateWT5 = False
0172 
0173     if event.pT3_isFake[pT3] == 1: dict_["Nfakes"] = dict_["Nfakes"] + 1
0174     if event.pT3_isDuplicate[pT3] == 1: isDuplicateWpT3 = True
0175 
0176     for j in range(len(event.pT3_matched_simIdx[pT3])):
0177       if debug:
0178         if event.pT3_isDuplicate[pT3]:
0179           print "pT3[",pT3,"]"
0180           print "simTrk_pt = ",event.sim_pt[event.pT3_matched_simIdx[pT3][j]]
0181 
0182       if event.sim_pT5_matched[event.pT3_matched_simIdx[pT3][j]] > 0:
0183         isDuplicateWpT5 = True
0184         if debug:
0185           print ""
0186           print "pT3_pt = ",event.pT3_pt[pT3]
0187           print "simTrk_pt = ",event.sim_pt[event.pT3_matched_simIdx[pT3][j]]
0188           for pT5 in range(len(event.pT5_pt)):
0189             for k in range(len(event.pT5_matched_simIdx[pT5])):
0190               if event.pT3_matched_simIdx[pT3][j] == event.pT5_matched_simIdx[pT5][k]:
0191                 print ""
0192                 print "pT5_pt = ",event.pT5_pt[pT5]
0193                 print "simTrk_pt = ",event.sim_pt[event.pT5_matched_simIdx[pT5][k]]
0194                 
0195       if event.sim_T5_matched[event.pT3_matched_simIdx[pT3][j]] > 0:
0196         isDuplicateWT5 = True
0197         if debug:
0198           print ""
0199           print "pT3_pt = ",event.pT3_pt[pT3]
0200           print "simTrk_pt = ",event.sim_pt[event.pT3_matched_simIdx[pT3][j]]
0201           for T5 in range(len(event.t5_pt)):
0202             for k in range(len(event.t5_matched_simIdx[T5])):
0203               if event.pT3_matched_simIdx[pT3][j] == event.t5_matched_simIdx[T5][k]:
0204                 print ""
0205                 print "T5_pt = ",event.t5_pt[T5]
0206                 print "simTrk_pt = ",event.sim_pt[event.t5_matched_simIdx[T5][k]]
0207 
0208     if isDuplicateWpT5:
0209       if isDuplicateWpT3:
0210         if isDuplicateWT5:
0211           dict_["Ndup_Wall"] = dict_["Ndup_Wall"] + 1
0212         else:
0213           dict_["Ndup_WpT5ApT3"] = dict_["Ndup_WpT5ApT3"] + 1
0214       else:
0215         if isDuplicateWT5:
0216           dict_["Ndup_WpT5AT5"] = dict_["Ndup_WpT5AT5"] + 1
0217         else:
0218           dict_["Ndup_WpT5"] = dict_["Ndup_WpT5"] + 1
0219     else:
0220       if isDuplicateWpT3:
0221         if isDuplicateWT5:
0222           dict_["Ndup_WpT3AT5"] = dict_["Ndup_WpT3AT5"] + 1
0223         else:
0224           dict_["Ndup_WpT3"] = dict_["Ndup_WpT3"] + 1
0225       else:
0226         if isDuplicateWT5:
0227           dict_["Ndup_WT5"] = dict_["Ndup_WT5"] + 1
0228 
0229   return dict_
0230 
0231 
0232 def dupOfT5(event,dict_,debug=False):
0233   if debug: print "Number of T5: ",len(event.t5_pt)
0234   dict_["N"] = dict_["N"] + len(event.t5_pt)
0235   for t5 in range(len(event.t5_pt)):
0236     isDuplicateWpT5 = False
0237     isDuplicateWpT3 = False
0238     isDuplicateWT5 = False
0239 
0240     if event.t5_isFake[t5] == 1: dict_["Nfakes"] = dict_["Nfakes"] + 1
0241     if event.t5_isDuplicate[t5] == 1: isDuplicateWT5 = True
0242 
0243     for j in range(len(event.t5_matched_simIdx[t5])):
0244       if debug:
0245         if event.t5_isDuplicate[t5]:
0246           print "T5[",t5,"]"
0247           print "simTrk_pt = ",event.sim_pt[event.t5_matched_simIdx[t5][j]]
0248 
0249       if event.sim_pT5_matched[event.t5_matched_simIdx[t5][j]] > 0:
0250         isDuplicateWpT5 = True
0251         if debug:
0252           print ""
0253           print "T5_pt = ",event.t5_pt[t5]
0254           print "simTrk_pt = ",event.sim_pt[event.t5_matched_simIdx[t5][j]]
0255           for pT5 in range(len(event.pT5_pt)):
0256             for k in range(len(event.pT5_matched_simIdx[pT5])):
0257               if event.t5_matched_simIdx[t5][j] == event.pT5_matched_simIdx[pT5][k]:
0258                 print ""
0259                 print "pT5_pt = ",event.pT5_pt[pT5]
0260                 print "simTrk_pt = ",event.sim_pt[event.pT5_matched_simIdx[pT5][k]]
0261                 
0262       if event.sim_pT3_matched[event.t5_matched_simIdx[t5][j]] > 0:
0263         isDuplicateWpT3 = True
0264         if debug:
0265           print ""
0266           print "T5_pt = ",event.t5_pt[t5]
0267           print "simTrk_pt = ",event.sim_pt[event.t5_matched_simIdx[t5][j]]
0268           for pT3 in range(len(event.pT3_pt)):
0269             for k in range(len(event.pT3_matched_simIdx[pT3])):
0270               if event.t5_matched_simIdx[t5][j] == event.pT3_matched_simIdx[pT3][k]:
0271                 print ""
0272                 print "pT3_pt = ",event.pT3_pt[pT3]
0273                 print "simTrk_pt = ",event.sim_pt[event.pT3_matched_simIdx[pT3][k]]
0274 
0275     if isDuplicateWpT5:
0276       if isDuplicateWpT3:
0277         if isDuplicateWT5:
0278           dict_["Ndup_Wall"] = dict_["Ndup_Wall"] + 1
0279         else:
0280           dict_["Ndup_WpT5ApT3"] = dict_["Ndup_WpT5ApT3"] + 1
0281       else:
0282         if isDuplicateWT5:
0283           dict_["Ndup_WpT5AT5"] = dict_["Ndup_WpT5AT5"] + 1
0284         else:
0285           dict_["Ndup_WpT5"] = dict_["Ndup_WpT5"] + 1
0286     else:
0287       if isDuplicateWpT3:
0288         if isDuplicateWT5:
0289           dict_["Ndup_WpT3AT5"] = dict_["Ndup_WpT3AT5"] + 1
0290         else:
0291           dict_["Ndup_WpT3"] = dict_["Ndup_WpT3"] + 1
0292       else:
0293         if isDuplicateWT5:
0294           dict_["Ndup_WT5"] = dict_["Ndup_WT5"] + 1
0295 
0296   return dict_
0297 
0298 
0299 def printSimComp(dict_):
0300   if dict_["N"] == 0:
0301     print "No sim  object found!"
0302     return
0303 
0304   print ""
0305   print "Total sim multiplicity = %d" %dict_["N"]
0306   print "Matched sim = %d (%.2f%%)" %( dict_["N_matched"], float(dict_["N_matched"])/float(dict_["N"])*100 )
0307   print "Single matched sim = %d (%.2f%%)" %( dict_["N_singleMatched"], float(dict_["N_singleMatched"])/float(dict_["N"])*100 )
0308   print "Duplicate sim = %d (%.2f%%)" %( dict_["N_dup"], float(dict_["N_dup"])/float(dict_["N"])*100 )
0309   print "Matched with pT5 = %d (%.2f%%)" %( dict_["N_matchedWpT5"], float(dict_["N_matchedWpT5"])/float(dict_["N"])*100 )
0310   print "Matched with pT3 = %d (%.2f%%)" %( dict_["N_matchedWpT3"], float(dict_["N_matchedWpT3"])/float(dict_["N"])*100 )
0311   print "Matched with T5 = %d (%.2f%%)" %( dict_["N_matchedWT5"], float(dict_["N_matchedWT5"])/float(dict_["N"])*100 )
0312   print "Matched with pLS = %d (%.2f%%)" %( dict_["N_matchedWpLS"], float(dict_["N_matchedWpLS"])/float(dict_["N"])*100 )
0313   print ""
0314   print "Good sim = %d (%.2f%%)" %( dict_["N_good"], float(dict_["N_good"])/float(dict_["N"])*100 )
0315   print "Matched good sim = %d (%.2f%%)" %( dict_["N_goodMatched"], float(dict_["N_goodMatched"])/float(dict_["N_good"])*100 )
0316   print "Single matched good sim = %d (%.2f%%)" %( dict_["N_goodSingleMatched"], float(dict_["N_goodSingleMatched"])/float(dict_["N_good"])*100 )
0317   print "Duplicate good sim = %d (%.2f%%)" %( dict_["N_goodDup"], float(dict_["N_goodDup"])/float(dict_["N_good"])*100 )
0318   print "Good sim matched with pT5 = %d (%.2f%%)" %( dict_["N_goodMatchedWpT5"], float(dict_["N_goodMatchedWpT5"])/float(dict_["N_good"])*100 )
0319   print "Good sim matched with pT3 = %d (%.2f%%)" %( dict_["N_goodMatchedWpT3"], float(dict_["N_goodMatchedWpT3"])/float(dict_["N_good"])*100 )
0320   print "Good sim matched with T5 = %d (%.2f%%)" %( dict_["N_goodMatchedWT5"], float(dict_["N_goodMatchedWT5"])/float(dict_["N_good"])*100 )
0321   print "Good sim matched with pLS = %d (%.2f%%)" %( dict_["N_goodMatchedWpLS"], float(dict_["N_goodMatchedWpLS"])/float(dict_["N_good"])*100 )
0322   print ""
0323   return
0324 
0325 
0326 def printTCComp(objType,dict_):
0327   if dict_["N_"+objType] == 0:
0328     print "No "+objType+" object found in TC collection!"
0329     return
0330   dict_["N_"+objType+"singleMatched"] = dict_["N_"+objType]-dict_["N_"+objType+"fakes"]-dict_["Ndup_"+objType+"Total"]
0331 
0332   print ""
0333   print "Total "+objType+" multiplicity in TC collection = %d" %dict_["N_"+objType]
0334   print objType+" Fakes = %d (%.2f%%)" %( dict_["N_"+objType+"fakes"], float(dict_["N_"+objType+"fakes"])/float(dict_["N_"+objType])*100 )
0335   print objType+" Duplicates with pT5 = %d (%.2f%%)" %( dict_["Ndup_"+objType+"WpT5"], float(dict_["Ndup_"+objType+"WpT5"])/float(dict_["N_"+objType])*100 )
0336   print objType+" Duplicates with pT3 = %d (%.2f%%)" %( dict_["Ndup_"+objType+"WpT3"], float(dict_["Ndup_"+objType+"WpT3"])/float(dict_["N_"+objType])*100 )
0337   print objType+" Duplicates with T5 = %d (%.2f%%)" %( dict_["Ndup_"+objType+"WT5"], float(dict_["Ndup_"+objType+"WT5"])/float(dict_["N_"+objType])*100 )
0338   print objType+" Duplicates with pLS = %d (%.2f%%)" %( dict_["Ndup_"+objType+"WpLS"], float(dict_["Ndup_"+objType+"WpLS"])/float(dict_["N_"+objType])*100 )
0339   print objType+" Total duplicates = %d (%.2f%%)" %( dict_["Ndup_"+objType+"Total"], float(dict_["Ndup_"+objType+"Total"])/float(dict_["N_"+objType])*100 )
0340   print objType+" Single matched non-fakes = %d (%.2f%%)" %( dict_["N_"+objType+"singleMatched"], float(dict_["N_"+objType+"singleMatched"])/float(dict_["N_"+objType])*100 )
0341   print ""
0342   return
0343 
0344 
0345 def printObjComp(objType,dict_):
0346   if dict_["N"] == 0:
0347     print "No "+objType+" object found!"
0348     return
0349   dict_["Ndup_Total"] = dict_["Ndup_WpT5"]+dict_["Ndup_WpT3"]+dict_["Ndup_WT5"]+dict_["Ndup_WpT5ApT3"]+dict_["Ndup_WpT5AT5"]+dict_["Ndup_WpT3AT5"]+dict_["Ndup_Wall"]
0350   dict_["NsingleMatched"] = dict_["N"]-dict_["Nfakes"]-dict_["Ndup_Total"]
0351 
0352   print ""
0353   print "Total "+objType+" multiplicity = %d" %dict_["N"]
0354   print objType+" Fakes = %d (%.2f%%)" %( dict_["Nfakes"], float(dict_["Nfakes"])/float(dict_["N"])*100 )
0355   print objType+" Duplicates with pT5 only = %d (%.2f%%)" %( dict_["Ndup_WpT5"], float(dict_["Ndup_WpT5"])/float(dict_["N"])*100 )
0356   print objType+" Duplicates with pT3 only = %d (%.2f%%)" %( dict_["Ndup_WpT3"], float(dict_["Ndup_WpT3"])/float(dict_["N"])*100 )
0357   print objType+" Duplicates with T5 only = %d (%.2f%%)" %( dict_["Ndup_WT5"], float(dict_["Ndup_WT5"])/float(dict_["N"])*100 )
0358   print objType+" Duplicates with pT5 and pT3 only = %d (%.2f%%)" %( dict_["Ndup_WpT5ApT3"], float(dict_["Ndup_WpT5ApT3"])/float(dict_["N"])*100 )
0359   print objType+" Duplicates with pT5 and T5 only = %d (%.2f%%)" %( dict_["Ndup_WpT5AT5"], float(dict_["Ndup_WpT5AT5"])/float(dict_["N"])*100 )
0360   print objType+" Duplicates with pT3 and T5 only = %d (%.2f%%)" %( dict_["Ndup_WpT3AT5"], float(dict_["Ndup_WpT3AT5"])/float(dict_["N"])*100 )
0361   print objType+" Duplicates with all = %d (%.2f%%)" %( dict_["Ndup_Wall"], float(dict_["Ndup_Wall"])/float(dict_["N"])*100 )
0362   print objType+" Total duplicates = %d (%.2f%%)" %( dict_["Ndup_Total"], float(dict_["Ndup_Total"])/float(dict_["N"])*100 )
0363   print objType+" Single matched non-fakes = %d (%.2f%%)" %( dict_["NsingleMatched"], float(dict_["NsingleMatched"])/float(dict_["N"])*100 )
0364   print ""
0365   return
0366 
0367 
0368 dict_sim = { "N": 0, "N_matched": 0, "N_singleMatched": 0, "N_dup": 0, "N_matchedWpT5": 0, "N_matchedWpT3": 0, "N_matchedWT5": 0, "N_matchedWpLS": 0,\
0369     "N_good": 0, "N_goodMatched": 0, "N_goodSingleMatched": 0, "N_goodDup": 0, "N_goodMatchedWpT5": 0, "N_goodMatchedWpT3": 0, "N_goodMatchedWT5": 0, "N_goodMatchedWpLS": 0 }
0370 dict_TCTot = { "N_": 0, "N_fakes": 0, "Ndup_WpT5": 0, "Ndup_WpT3": 0, "Ndup_WT5": 0, "Ndup_WpLS": 0, "Ndup_Total": 0, "N_singleMatched": 0 }
0371 dict_TC = { "N_pT5": 0, "N_pT5fakes": 0, "Ndup_pT5WpT5": 0, "Ndup_pT5WpT3": 0, "Ndup_pT5WT5": 0, "Ndup_pT5WpLS": 0, "Ndup_pT5Total": 0, "N_pT5singleMatched": 0,\
0372     "N_pT3": 0, "N_pT3fakes": 0, "Ndup_pT3WpT5": 0, "Ndup_pT3WpT3": 0, "Ndup_pT3WT5": 0, "Ndup_pT3WpLS": 0, "Ndup_pT3Total": 0, "N_pT3singleMatched": 0,\
0373     "N_T5": 0, "N_T5fakes": 0, "Ndup_T5WpT5": 0, "Ndup_T5WpT3": 0, "Ndup_T5WT5": 0, "Ndup_T5WpLS": 0, "Ndup_T5Total": 0, "N_T5singleMatched": 0,\
0374     "N_pLS": 0, "N_pLSfakes": 0, "Ndup_pLSWpT5": 0, "Ndup_pLSWpT3": 0, "Ndup_pLSWT5": 0, "Ndup_pLSWpLS": 0, "Ndup_pLSTotal": 0, "N_pLSsingleMatched": 0 }
0375 dict_pT5 = { "N": 0, "Nfakes": 0, "Ndup_WpT5": 0, "Ndup_WpT3": 0, "Ndup_WT5": 0, "Ndup_WpT5ApT3": 0, "Ndup_WpT5AT5": 0, "Ndup_WpT3AT5": 0, "Ndup_Wall": 0, "Ndup_Total": 0, "NsingleMatched": 0 }
0376 dict_pT3 = { "N": 0, "Nfakes": 0, "Ndup_WpT5": 0, "Ndup_WpT3": 0, "Ndup_WT5": 0, "Ndup_WpT5ApT3": 0, "Ndup_WpT5AT5": 0, "Ndup_WpT3AT5": 0, "Ndup_Wall": 0, "Ndup_Total": 0, "NsingleMatched": 0 }
0377 dict_T5 = { "N": 0, "Nfakes": 0, "Ndup_WpT5": 0, "Ndup_WpT3": 0, "Ndup_WT5": 0, "Ndup_WpT5ApT3": 0, "Ndup_WpT5AT5": 0, "Ndup_WpT3AT5": 0, "Ndup_Wall": 0, "Ndup_Total": 0, "NsingleMatched": 0 }
0378 
0379 debug = False
0380 if args.debugLevel==2: debug=True # Object level debugging
0381 
0382 for i,event in enumerate(intree):
0383   if i==args.maxEvents: break
0384   print "Event : %d" %i
0385 
0386   dict_sim = simTrkInfo(event,dict_sim)
0387   if not args.dontRunTCs: dict_TC = dupOfTC(event,dict_TC,debug=debug)
0388   if args.runExtraObjects:
0389     dict_pT5 = dupOfpT5(event,dict_pT5,debug=debug)
0390     dict_pT3 = dupOfpT3(event,dict_pT3,debug=debug)
0391     dict_T5 = dupOfT5(event,dict_T5,debug=debug)
0392 
0393   if args.debugLevel>0: # Event per event debugging
0394     printSimComp(dict_sim)
0395     printTCComp("pT5",dict_TC)
0396     printTCComp("pT3",dict_TC)
0397     printTCComp("T5",dict_TC)
0398     printTCComp("pLS",dict_TC)
0399     if args.runExtraObjects:
0400       printObjComp("pT5",dict_pT5)
0401       printObjComp("pT3",dict_pT3)
0402       printObjComp("T5",dict_T5)
0403     print ""
0404     if i==2: break
0405 
0406 printSimComp(dict_sim)
0407 if not args.dontRunTCs:
0408   dict_TCTot["N_"] = dict_TC["N_pT5"] + dict_TC["N_pT3"] + dict_TC["N_T5"] + dict_TC["N_pLS"]
0409   dict_TCTot["N_fakes"] = dict_TC["N_pT5fakes"] + dict_TC["N_pT3fakes"] + dict_TC["N_T5fakes"] + dict_TC["N_pLSfakes"]
0410   dict_TCTot["Ndup_WpT5"] = dict_TC["Ndup_pT5WpT5"] + dict_TC["Ndup_pT3WpT5"] + dict_TC["Ndup_T5WpT5"] + dict_TC["Ndup_pLSWpT5"]
0411   dict_TCTot["Ndup_WpT3"] = dict_TC["Ndup_pT5WpT3"] + dict_TC["Ndup_pT3WpT3"] + dict_TC["Ndup_T5WpT3"] + dict_TC["Ndup_pLSWpT3"]
0412   dict_TCTot["Ndup_WT5"] = dict_TC["Ndup_pT5WT5"] + dict_TC["Ndup_pT3WT5"] + dict_TC["Ndup_T5WT5"] + dict_TC["Ndup_pLSWT5"]
0413   dict_TCTot["Ndup_WpLS"] = dict_TC["Ndup_pT5WpLS"] + dict_TC["Ndup_pT3WpLS"] + dict_TC["Ndup_T5WpLS"] + dict_TC["Ndup_pLSWpLS"]
0414   dict_TCTot["Ndup_Total"] = dict_TC["Ndup_pT5Total"] + dict_TC["Ndup_pT3Total"] + dict_TC["Ndup_T5Total"] + dict_TC["Ndup_pLSTotal"]
0415   dict_TCTot["N_singleMatched"] = dict_TC["N_pT5singleMatched"] + dict_TC["N_pT3singleMatched"] + dict_TC["N_T5singleMatched"] + dict_TC["N_pLSsingleMatched"]
0416 
0417   printTCComp("",dict_TCTot)
0418   printTCComp("pT5",dict_TC)
0419   printTCComp("pT3",dict_TC)
0420   printTCComp("T5",dict_TC)
0421   printTCComp("pLS",dict_TC)
0422 if args.runExtraObjects:
0423   printObjComp("pT5",dict_pT5)
0424   printObjComp("pT3",dict_pT3)
0425   printObjComp("T5",dict_T5)