Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14:22

0001 import os.path, glob, sys
0002 import ROOT
0003 
0004 arch   = sys.argv[1]
0005 sample = sys.argv[2]
0006 build  = sys.argv[3]
0007 suffix = sys.argv[4]
0008 
0009 g = ROOT.TFile("test_"+arch+"_"+sample+"_"+build+"_"+suffix+".root","recreate")
0010 
0011 # declare hists: reco only
0012 h_MXNH  = ROOT.TH1F("h_MXNH_"+suffix, "nHits/Track", 35, 0, 35)
0013 h_MXPT  = ROOT.TH1F("h_MXPT_"+suffix, "p_{T}^{mkFit}", 100, 0, 100)
0014 h_MXETA = ROOT.TH1F("h_MXETA_"+suffix, "#eta^{mkFit}", 25, -2.5, 2.5)
0015 h_MXPHI = ROOT.TH1F("h_MXPHI_"+suffix, "#phi^{mkFit}", 32, -3.2, 3.2)
0016 
0017 h_MXNH.Sumw2()
0018 h_MXPT.Sumw2()
0019 h_MXETA.Sumw2()
0020 h_MXPHI.Sumw2()
0021 
0022 # declare hists: diffs 
0023 h_DCNH  = ROOT.TH1F("h_DCNH_"+suffix, "#DeltanHits(mkFit,CMSSW)", 46, -20.5, 25.5)
0024 h_DCPT  = ROOT.TH1F("h_DCPT_"+suffix, "#Deltap_{T}(mkFit,CMSSW)", 63, -2.5, 2.5)
0025 h_DCETA = ROOT.TH1F("h_DCETA_"+suffix, "#Delta#eta(mkFit,CMSSW)", 45, -0.5, 0.5)
0026 h_DCPHI = ROOT.TH1F("h_DCPHI_"+suffix, "#Delta#phi(mkFit,CMSSW)", 45, -0.5, 0.5)
0027 
0028 h_DCNH.Sumw2()
0029 h_DCPT.Sumw2()
0030 h_DCETA.Sumw2()
0031 h_DCPHI.Sumw2()
0032 
0033 with open('log_'+arch+'_'+sample+'_'+build+'_'+suffix+'_DumpForPlots.txt') as f :
0034     for line in f :
0035         if "MX - found track with chi2" in line :
0036             lsplit = line.split()
0037 
0038             NH = float(lsplit[8])
0039             h_MXNH.Fill(NH)
0040 
0041             PT = float(lsplit[10])
0042             h_MXPT.Fill(PT)
0043 
0044             ETA = float(lsplit[12])
0045             h_MXETA.Fill(ETA)
0046 
0047             PHI = float(lsplit[14])
0048             h_MXPHI.Fill(PHI)
0049 
0050             NHC = float(lsplit[24])
0051             if NHC > 0 :
0052                 h_DCNH.Fill(NH-NHC)
0053 
0054                 PTC = float(lsplit[26])
0055                 h_DCPT.Fill(PT-PTC)
0056                 
0057                 ETAC = float(lsplit[28])
0058                 h_DCETA.Fill(ETA-ETAC)
0059                 
0060                 PHIC = float(lsplit[30])
0061                 h_DCPHI.Fill(PHI-PHIC)
0062 
0063 g.Write()
0064 g.Close()