def beginLoop (self) : super (SimpleJetPlots,self).beginLoop () self.file = TFile ('/'.join ([self.looperName, 'testJetsPlot.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor(0,PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind nor PFJetIDSelectionFunctor(Jet)PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF","NHF","CEF","NEF","NCH","nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x : self.isPFLooseFunc(x,self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x : True self.h_NVTXnum = TH1F ("h_NVTXnum", "", 100, 0, 100) self.h_NoCHS_genjetsnum = TH1F ("h_NoCHS_genjetsnum", "", 100, 0, 100) self.h_NoCHS_genjetspt = TH1F ("h_NoCHS_genjetspt", "" ,500, 0, 500) self.h_NoCHS_genjetseta = TH1F ("h_NoCHS_genjetseta", "" ,48, -6, 6) self.h_YeCHS_genjetspt = TH1F ("h_YeCHS_genjetspt", "" ,500, 0, 500) self.h_YeCHS_genjetseta = TH1F ("h_YeCHS_genjetseta", "" ,48, -6, 6) self.h_NoCHS_genjetspt_match = TH1F ("h_NoCHS_genjetspt_match", "" ,500, 0, 500) self.h_NoCHS_genjetseta_match = TH1F ("h_NoCHS_genjetseta_match", "" ,48, -6, 6) self.h_YeCHS_genjetspt_match = TH1F ("h_YeCHS_genjetspt_match", "" ,500, 0, 500) self.h_YeCHS_genjetseta_match = TH1F ("h_YeCHS_genjetseta_match", "" ,48, -6, 6) self.h_NoCHS_recjetspt = TH1F ("h_NoCHS_recjetspt", "" ,500, 0, 500) self.h_NoCHS_recjetspt_match = TH1F ("h_NoCHS_recjetspt_match", "" ,500, 0, 500) self.h_NoCHS_recjetseta = TH1F ("h_NoCHS_recjetseta", "" ,48, -6, 6) self.h_NoCHS_recjetseta_match = TH1F ("h_NoCHS_recjetseta_match", "" ,48, -6, 6) self.h_YeCHS_recjetspt = TH1F ("h_YeCHS_recjetspt", "" ,500, 0, 500) self.h_YeCHS_recjetspt_match = TH1F ("h_YeCHS_recjetspt_match", "" ,500, 0, 500) self.h_YeCHS_recjetseta = TH1F ("h_YeCHS_recjetseta", "" ,48, -6, 6) self.h_YeCHS_recjetseta_match = TH1F ("h_YeCHS_recjetseta_match", "" ,48, -6, 6) self.h_YeCHS_response = TH1F ("h_YeCHSresponse", "" ,100, -2, 2) ; self.h_NoCHS_response = TH1F ("h_NoCHSresponse", "" ,100, -2, 2) ; self.h_NoCHS_correction = TH2F ("h_NoCHS_correction", "", 48, -6, 6, 1000, 0, 10) ; self.h_YeCHS_correction = TH2F ("h_YeCHS_correction", "", 48, -6, 6, 1000, 0, 10) ; self.YeNoCHSRatio_eta = TH2F ("YeNoCHSRatio_eta", "", 48, -6, 6, 100, 0, 2) self.h_NoCHS_correction_ptcut = TH2F ("h_NoCHS_correction_ptcut", "", 48, -6, 6, 1000, 0, 10) ; self.h_YeCHS_correction_ptcut = TH2F ("h_YeCHS_correction_ptcut", "", 48, -6, 6, 1000, 0, 10) ; self.YeNoCHSRatio_eta_ptcut = TH2F ("YeNoCHSRatio_eta_ptcut", "", 48, -6, 6, 100, 0, 2) self.h_NoCHS_correction_ptcut_PUcut = TH2F ("h_NoCHS_correction_ptcut_PUcut", "", 48, -6, 6, 1000, 0, 10) ; self.h_YeCHS_correction_ptcut_PUcut = TH2F ("h_YeCHS_correction_ptcut_PUcut", "", 48, -6, 6, 1000, 0, 10) ; self.YeNoCHSRatio_eta_ptcut_PUcut = TH2F ("YeNoCHSRatio_eta_ptcut_PUcut", "", 48, -6, 6, 100, 0, 2) self.h_NoCHS_correction_PUcut = TH2F ("h_NoCHS_correction_PUcut", "", 48, -6, 6, 1000, 0, 10) ; self.h_YeCHS_correction_PUcut = TH2F ("h_YeCHS_correction_PUcut", "", 48, -6, 6, 1000, 0, 10) ; self.YeNoCHSRatio_eta_PUcut = TH2F ("YeNoCHSRatio_eta_PUcut", "", 48, -6, 6, 100, 0, 2)
def beginLoop (self) : super (SimpleJetNTupler,self).beginLoop () self.file = TFile ('/'.join ([self.looperName, 'testJetsNT.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor(0,PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind nor PFJetIDSelectionFunctor(Jet)PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF","NHF","CEF","NEF","NCH","nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x : self.isPFLooseFunc(x,self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x : True self.myntuple = TNtuple (self.cfg_ana.ntupleName, self.cfg_ana.ntupleName, 'genPt:recoPt:genEta:recoEta:genPhi:recoPhi:nvtx')
def beginLoop(self): super(SimpleJetNTupler, self).beginLoop() self.file = TFile('/'.join([self.looperName, 'testJetsNT.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor( 0, PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind nor PFJetIDSelectionFunctor(Jet)PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF", "NHF", "CEF", "NEF", "NCH", "nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x: self.isPFLooseFunc( x, self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x: True self.myntuple = TNtuple( self.cfg_ana.ntupleName, self.cfg_ana.ntupleName, 'genPt:recoPt:genEta:recoEta:genPhi:recoPhi:nvtx')
def beginLoop(self): super(JetStudiesAnalyzer, self).beginLoop() self.file = TFile("/".join([self.looperName, "testJets.root"]), "recreate") if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor(0, PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind nor PFJetIDSelectionFunctor(Jet)PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF", "NHF", "CEF", "NEF", "NCH", "nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x: self.isPFLooseFunc(x, self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x: True # general histograms self.jetHistos = JetHistograms("Jets") self.cleanJetHistos = JetHistograms("CleanJets") self.cleanJetHistos_barrel = JetHistograms("CleanJets_barrel") self.cleanJetHistos_endtk = JetHistograms("CleanJets_endtk") self.cleanJetHistos_endNOtk = JetHistograms("CleanJets_endNOtk") self.cleanJetHistos_fwd = JetHistograms("CleanJets_fwd") self.matchedCleanJetHistos = JetHistograms("MatchedCleanJets") self.matchedCleanJetHistos_barrel = JetHistograms("MatchedCleanJets_barrel") self.matchedCleanJetHistos_endtk = JetHistograms("MatchedCleanJets_endtk") self.matchedCleanJetHistos_endNOtk = JetHistograms("MatchedCleanJets_endNOtk") self.matchedCleanJetHistos_fwd = JetHistograms("MatchedCleanJets_fwd") self.matchedCleanJetHistos_PtL = JetHistograms("MatchedCleanJets_ptLow") self.matchedCleanJetHistos_PtM = JetHistograms("MatchedCleanJets_ptMed") self.matchedCleanJetHistos_PtH = JetHistograms("MatchedCleanJets_ptHi") self.matchedCleanJetHistos_PtV = JetHistograms("MatchedCleanJets_ptVHi") self.LPtmatchedCleanJetHistos = JetHistograms("LPtMatchedCleanJets") self.HPtmatchedCleanJetHistos = JetHistograms("HPtMatchedCleanJets") self.unmatchedCleanJetHistos = JetHistograms("UnmatchedCleanJets") self.LPtUnmatchedCleanJetHistos = JetHistograms("LPtUnmatchedCleanJets") self.HPtUnmatchedCleanJetHistos = JetHistograms("HPtUnmatchedCleanJets") # histograms of the components fraction self.matchedCleanJetHistosComponents = FractionJetHistograms("MatchedCleanJetsCompontents") self.unmatchedCleanJetHistosComponents = FractionJetHistograms("UnmatchedCleanJetsCompontents") # histograms for the resolution of matched jets self.matchedCleanJetHistosResolution = ResolutionJetHistograms("MatchedCleanJetsResolution", 50, 1) self.matchedCleanJetHistosResolution_barrel = ResolutionJetHistograms( "MatchedCleanJetsResolution_barrel", 50, 1 ) self.matchedCleanJetHistosResolution_endtk = ResolutionJetHistograms("MatchedCleanJetsResolution_endtk", 50, 1) self.matchedCleanJetHistosResolution_endNOtk = ResolutionJetHistograms( "MatchedCleanJetsResolution_endNOtk", 50, 1 ) self.matchedCleanJetHistosResolution_fwd = ResolutionJetHistograms("MatchedCleanJetsResolution_fwd", 50, 1) # resolution of matched jets, all eta, bins of pt self.matchedCleanJetHistosResolution_PtL = ResolutionJetHistograms( "MatchedCleanJetsResolution_ptLow", 50, 1 ) # <20 self.matchedCleanJetHistosResolution_PtM = ResolutionJetHistograms( "MatchedCleanJetsResolution_ptMed", 50, 1 ) # <40 self.matchedCleanJetHistosResolution_PtH = ResolutionJetHistograms( "MatchedCleanJetsResolution_ptHi", 50, 1 ) # <80 self.matchedCleanJetHistosResolution_PtV = ResolutionJetHistograms( "MatchedCleanJetsResolution_ptVHi", 50, 1 ) # >80 self.doJetIdHisto = False if self.cfg_ana.doJetIdHisto: # histograms for pileup jet identification variables self.vtxBins = (0, 5, 10, 15, 20, 30) ## (0,2,4,6,10,15,20,30,35) self.ptBins = (20, 30, 50) ## (20,30,40,50,100) self.etaBins = (0, 1.4, 2.5, 3.0) self.puEtaLables = ["_barrel", "_endtk", "_endNOtk", "_fwd"] reweight_f = TF1("f", "pol2(0)+expo(3)") reweight_f.SetParameters(0.1955298, -0.003830591, 1.944794e-05, 4.649755, -0.1722024) self.reweight = ("pt", reweight_f) self.doJetIdHisto = True self.gluCleanHistosId = PileupJetHistograms( "GluonMatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, reweight=self.reweight, jetIdMva=self.cfg_ana.jetIdMva, ) self.quarkCleanHistosId = PileupJetHistograms( "QuarkMatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, reweight=self.reweight, jetIdMva=self.cfg_ana.jetIdMva, ) self.reweiMatchedCleanHistosId = PileupJetHistograms( "ReweiMatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, reweight=self.reweight, jetIdMva=self.cfg_ana.jetIdMva, ) self.unmatchedCleanHistosId = PileupJetHistograms( "UnmatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, jetIdMva=self.cfg_ana.jetIdMva, ) self.h_nvtx = TH1F("h_nvtx", "", 50, 0, 50) self.h_genjetspt = TH1F("h_genjetspt", "", 500, 0, 500) self.h_genjetspt2 = TH1F("h_genjetsptZOOM", "", 100, 0, 200) self.h_genjetspt_barrel = TH1F("h_genjetspt_barrel", "", 100, 0, 200) self.h_genjetspt_endtk = TH1F("h_genjetspt_endtk", "", 100, 0, 200) self.h_genjetspt_endNOtk = TH1F("h_genjetspt_endNOtk", "", 100, 0, 200) self.h_genjetspt_fwd = TH1F("h_genjetspt_fwd", "", 100, 0, 200) self.h_genjetspt_MR_barrel = TH1F("h_genjetspt_MatchedCleanReco_barrel", "", 100, 0, 200) self.h_genjetspt_MR_endtk = TH1F("h_genjetspt_MatchedCleanReco_endtk", "", 100, 0, 200) self.h_genjetspt_MR_endNOtk = TH1F("h_genjetspt_MatchedCleanReco_endNOtk", "", 100, 0, 200) self.h_genjetspt_MR_fwd = TH1F("h_genjetspt_MatchedCleanReco_fwd", "", 100, 0, 200) self.h_secondClosestVsPtratio = TH2F("h_secondClosestVsPtratio", "", 100, 0, 2, 100, 0, 6) self.h_avedistanceVSNvtx = TH2F("h_avedistanceVSNvtx", "", 50, 0, 50, 100, 0, 6) self.h_PTRatioVSgenEta = TH2F("h_PTRatioVSgenEta", "", 150, -5, 5, 100, 0, 2) self.h_PTRatioVSgenPt = TH2F("h_PTRatioVSgenPt", "", 200, 0, 100, 100, 0, 2) self.h_matchDR = TH1F("h_matchDR", "", 60, 0, 0.30) self.h_relPtVSmatchDR = TH2F("h_relPtVSmatchDR", "", 60, 0, 0.30, 100, 0, 2) self.h_relPtVSchFrac = TH2F("h_relPtVSchFrac", "", 100, 0, 1, 100, 0, 2)
def beginLoop(self): super(SimpleJetPlots, self).beginLoop() self.file = TFile('/'.join([self.looperName, 'testJetsPlot.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor( 0, PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind nor PFJetIDSelectionFunctor(Jet)PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF", "NHF", "CEF", "NEF", "NCH", "nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x: self.isPFLooseFunc( x, self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x: True self.h_NVTXnum = TH1F("h_NVTXnum", "", 100, 0, 100) self.h_NoCHS_genjetsnum = TH1F("h_NoCHS_genjetsnum", "", 100, 0, 100) self.h_NoCHS_genjetspt = TH1F("h_NoCHS_genjetspt", "", 500, 0, 500) self.h_NoCHS_genjetseta = TH1F("h_NoCHS_genjetseta", "", 48, -6, 6) self.h_YeCHS_genjetspt = TH1F("h_YeCHS_genjetspt", "", 500, 0, 500) self.h_YeCHS_genjetseta = TH1F("h_YeCHS_genjetseta", "", 48, -6, 6) self.h_NoCHS_genjetspt_match = TH1F("h_NoCHS_genjetspt_match", "", 500, 0, 500) self.h_NoCHS_genjetseta_match = TH1F("h_NoCHS_genjetseta_match", "", 48, -6, 6) self.h_YeCHS_genjetspt_match = TH1F("h_YeCHS_genjetspt_match", "", 500, 0, 500) self.h_YeCHS_genjetseta_match = TH1F("h_YeCHS_genjetseta_match", "", 48, -6, 6) self.h_NoCHS_recjetspt = TH1F("h_NoCHS_recjetspt", "", 500, 0, 500) self.h_NoCHS_recjetspt_match = TH1F("h_NoCHS_recjetspt_match", "", 500, 0, 500) self.h_NoCHS_recjetseta = TH1F("h_NoCHS_recjetseta", "", 48, -6, 6) self.h_NoCHS_recjetseta_match = TH1F("h_NoCHS_recjetseta_match", "", 48, -6, 6) self.h_YeCHS_recjetspt = TH1F("h_YeCHS_recjetspt", "", 500, 0, 500) self.h_YeCHS_recjetspt_match = TH1F("h_YeCHS_recjetspt_match", "", 500, 0, 500) self.h_YeCHS_recjetseta = TH1F("h_YeCHS_recjetseta", "", 48, -6, 6) self.h_YeCHS_recjetseta_match = TH1F("h_YeCHS_recjetseta_match", "", 48, -6, 6) self.h_YeCHS_response = TH1F("h_YeCHSresponse", "", 100, -2, 2) self.h_NoCHS_response = TH1F("h_NoCHSresponse", "", 100, -2, 2) self.h_NoCHS_correction = TH2F("h_NoCHS_correction", "", 48, -6, 6, 1000, 0, 10) self.h_YeCHS_correction = TH2F("h_YeCHS_correction", "", 48, -6, 6, 1000, 0, 10) self.YeNoCHSRatio_eta = TH2F("YeNoCHSRatio_eta", "", 48, -6, 6, 100, 0, 2) self.h_NoCHS_correction_ptcut = TH2F("h_NoCHS_correction_ptcut", "", 48, -6, 6, 1000, 0, 10) self.h_YeCHS_correction_ptcut = TH2F("h_YeCHS_correction_ptcut", "", 48, -6, 6, 1000, 0, 10) self.YeNoCHSRatio_eta_ptcut = TH2F("YeNoCHSRatio_eta_ptcut", "", 48, -6, 6, 100, 0, 2) self.h_NoCHS_correction_ptcut_PUcut = TH2F( "h_NoCHS_correction_ptcut_PUcut", "", 48, -6, 6, 1000, 0, 10) self.h_YeCHS_correction_ptcut_PUcut = TH2F( "h_YeCHS_correction_ptcut_PUcut", "", 48, -6, 6, 1000, 0, 10) self.YeNoCHSRatio_eta_ptcut_PUcut = TH2F( "YeNoCHSRatio_eta_ptcut_PUcut", "", 48, -6, 6, 100, 0, 2) self.h_NoCHS_correction_PUcut = TH2F("h_NoCHS_correction_PUcut", "", 48, -6, 6, 1000, 0, 10) self.h_YeCHS_correction_PUcut = TH2F("h_YeCHS_correction_PUcut", "", 48, -6, 6, 1000, 0, 10) self.YeNoCHSRatio_eta_PUcut = TH2F("YeNoCHSRatio_eta_PUcut", "", 48, -6, 6, 100, 0, 2)
def beginLoop (self) : super (JetIDAnalyzer,self).beginLoop () self.file = TFile ('/'.join ([self.looperName, 'testJets.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor(0,PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind PFJetIDSelectionFunctor(Jet) nor PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF","NHF","CEF","NEF","NCH","nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x : self.isPFLooseFunc(x,self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x : True # general histograms self.jetHistos = JetHistograms ('Jets') self.cleanJetHistos = JetHistograms ('CleanJets') self.matchedCleanJetHistos = JetHistograms ('MatchedCleanJets') self.unmatchedCleanJetHistos = JetHistograms ('UnmatchedCleanJets') ## Pileup JetID if self.cfg_ana.jetIdMva: self.puidalgo = PileupJetIdNtupleAlgo(*self.cfg_ana.jetIdMva) self.runMva = True else: self.puidalgo = PileupJetIdNtupleAlgo() self.runMva = False self.vtxBins = (0,10,15,20,30) ## (0,2,4,6,10,15,20,30,35) self.vtxBinLabels = mkBinLabels(self.vtxBins) self.ptBins = (20,30,50) ## (20,30,40,50,100) self.etaBins = (0,1.4,2.5,3.0) self.puEtaLables = ["_barrel","_endtk","_endNOtk","_fwd"] reweight_f = TF1("f","pol2(0)+expo(3)") reweight_f.SetParameters(0.1955298,-0.003830591,1.944794e-05,4.649755,-0.1722024) self.reweight = ("pt", reweight_f) ## PileUp histograms if self.cfg_ana.doJetIdHisto: # histograms for pileup jet identification variables self.gluCleanHistosId = PileupJetHistograms("GluonMatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables,reweight=self.reweight) self.quarkCleanHistosId = PileupJetHistograms("QuarkMatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables,reweight=self.reweight) self.reweiMatchedCleanHistosId = PileupJetHistograms("ReweiMatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables,reweight=self.reweight) self.unmatchedCleanHistosId = PileupJetHistograms("UnmatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables) ### self.jetKin = [] ### for vtx in self.vtxBinLabels: ### self.jetKin.append([]) ### for eta in self.puEtaLables: ### self.jetKin[-1].append( JetHistograms('Jets%s%s' % (vtx,eta) ) ) if self.cfg_ana.dumpTree: self.tree = TTree("tree","tree") self.tree.SetDirectory(self.file) self.puidalgo.bookBranches(self.tree) gROOT.ProcessLine("""struct MyTreeVars{ Int_t nvtx; Bool_t isMatched; Int_t jetFlavour; Float_t partonPt; Float_t genPt; Float_t genDr; }""") from ROOT import MyTreeVars self.treevars = MyTreeVars() for i,j in ("nvtx","I"),("isMatched","O"),("jetFlavour","I"),("partonPt","F"),("genPt","F"),("genDr","F"): self.tree.Branch(i,AddressOf(self.treevars,i),"%s/%s"%(i,j)) self.h_nvtx = TH1F ("h_nvtx", "" ,50, 0, 50) self.h_genjetspt = TH1F ("h_genjetspt", "" ,500, 0, 500) ;
def beginLoop(self): super(JetIDAnalyzer, self).beginLoop() self.file = TFile('/'.join([self.looperName, 'testJets.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor( 0, PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind PFJetIDSelectionFunctor(Jet) nor PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF", "NHF", "CEF", "NEF", "NCH", "nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x: self.isPFLooseFunc( x, self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x: True # general histograms self.jetHistos = JetHistograms('Jets') self.cleanJetHistos = JetHistograms('CleanJets') self.matchedCleanJetHistos = JetHistograms('MatchedCleanJets') self.unmatchedCleanJetHistos = JetHistograms('UnmatchedCleanJets') ## Pileup JetID if self.cfg_ana.jetIdMva: self.puidalgo = PileupJetIdNtupleAlgo(*self.cfg_ana.jetIdMva) self.runMva = True else: self.puidalgo = PileupJetIdNtupleAlgo() self.runMva = False self.vtxBins = (0, 10, 15, 20, 30) ## (0,2,4,6,10,15,20,30,35) self.vtxBinLabels = mkBinLabels(self.vtxBins) self.ptBins = (20, 30, 50) ## (20,30,40,50,100) self.etaBins = (0, 1.4, 2.5, 3.0) self.puEtaLables = ["_barrel", "_endtk", "_endNOtk", "_fwd"] reweight_f = TF1("f", "pol2(0)+expo(3)") reweight_f.SetParameters(0.1955298, -0.003830591, 1.944794e-05, 4.649755, -0.1722024) self.reweight = ("pt", reweight_f) ## PileUp histograms if self.cfg_ana.doJetIdHisto: # histograms for pileup jet identification variables self.gluCleanHistosId = PileupJetHistograms( "GluonMatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, reweight=self.reweight) self.quarkCleanHistosId = PileupJetHistograms( "QuarkMatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, reweight=self.reweight) self.reweiMatchedCleanHistosId = PileupJetHistograms( "ReweiMatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables, reweight=self.reweight) self.unmatchedCleanHistosId = PileupJetHistograms( "UnmatchedCleanHistosId", self.vtxBins, self.ptBins, self.etaBins, etalabels=self.puEtaLables) ### self.jetKin = [] ### for vtx in self.vtxBinLabels: ### self.jetKin.append([]) ### for eta in self.puEtaLables: ### self.jetKin[-1].append( JetHistograms('Jets%s%s' % (vtx,eta) ) ) if self.cfg_ana.dumpTree: self.tree = TTree("tree", "tree") self.tree.SetDirectory(self.file) self.puidalgo.bookBranches(self.tree) gROOT.ProcessLine( """struct MyTreeVars{ Int_t nvtx; Bool_t isMatched; Int_t jetFlavour; Float_t partonPt; Float_t genPt; Float_t genDr; }""" ) from ROOT import MyTreeVars self.treevars = MyTreeVars() for i, j in ("nvtx", "I"), ("isMatched", "O"), ("jetFlavour", "I"), ("partonPt", "F"), ("genPt", "F"), ("genDr", "F"): self.tree.Branch(i, AddressOf(self.treevars, i), "%s/%s" % (i, j)) self.h_nvtx = TH1F("h_nvtx", "", 50, 0, 50) self.h_genjetspt = TH1F("h_genjetspt", "", 500, 0, 500)
def beginLoop (self) : super (SimpleJetAnalyzer,self).beginLoop () self.file = TFile ('/'.join ([self.looperName, 'testJets.root']), 'recreate') if self.cfg_ana.applyPFLooseId: from ROOT import PFJetIDSelectionFunctor self.isPFLooseFunc = PFJetIDSelectionFunctor(0,PFJetIDSelectionFunctor.LOOSE) ## Workaround: for some reason PyROOT does not bind nor PFJetIDSelectionFunctor(Jet)PFJetIDSelectionFunctor.getBitsTemplates from ROOT import pat self.isPFLooseFunc.bits = pat.strbitset() for i in "CHF","NHF","CEF","NEF","NCH","nConstituents": self.isPFLooseFunc.bits.push_back(i) ## /Workaround self.isPFLoose = lambda x : self.isPFLooseFunc(x,self.isPFLooseFunc.bits) else: self.isPFLoose = lambda x : True # general histograms self.jetHistos = JetHistograms ('Jets') self.cleanJetHistos = JetHistograms ('CleanJets') self.matchedCleanJetHistos = JetHistograms ('MatchedCleanJets') self.matchedCleanJetHistos_barrel = JetHistograms ('MatchedCleanJets_barrel') self.matchedCleanJetHistos_endtk = JetHistograms ('MatchedCleanJets_endtk') self.matchedCleanJetHistos_endNOtk = JetHistograms ('MatchedCleanJets_endNOtk') self.matchedCleanJetHistos_fwd = JetHistograms ('MatchedCleanJets_fwd') self.LPtmatchedCleanJetHistos = JetHistograms ('LPtMatchedCleanJets') self.HPtmatchedCleanJetHistos = JetHistograms ('HPtMatchedCleanJets') self.unmatchedCleanJetHistos = JetHistograms ('UnmatchedCleanJets') self.LPtUnmatchedCleanJetHistos = JetHistograms ('LPtUnmatchedCleanJets') self.HPtUnmatchedCleanJetHistos = JetHistograms ('HPtUnmatchedCleanJets') # histograms of the components fraction self.matchedCleanJetHistosComponents = FractionJetHistograms ('MatchedCleanJetsCompontents') self.unmatchedCleanJetHistosComponents = FractionJetHistograms ('UnmatchedCleanJetsCompontents') # histograms for the resolution of matched jets self.matchedCleanJetHistosResolution = ResolutionJetHistograms ('MatchedCleanJetsResolution', 50, 1) self.matchedCleanJetHistosResolution_barrel = ResolutionJetHistograms ('MatchedCleanJetsResolution_barrel', 50, 1) self.matchedCleanJetHistosResolution_endtk = ResolutionJetHistograms ('MatchedCleanJetsResolution_endtk', 50, 1) self.matchedCleanJetHistosResolution_endNOtk = ResolutionJetHistograms ('MatchedCleanJetsResolution_endNOtk', 50, 1) self.matchedCleanJetHistosResolution_fwd = ResolutionJetHistograms ('MatchedCleanJetsResolution_fwd', 50, 1) print 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' self.doJetIdHisto = False if self.cfg_ana.doJetIdHisto: print 'doing jet ID' # histograms for pileup jet identification variables self.vtxBins = (0,5,10,15,20,30) ## (0,2,4,6,10,15,20,30,35) self.ptBins = (20,30,50) ## (20,30,40,50,100) self.etaBins = (0,1.4,2.5,3.0) self.puEtaLables = ["_barrel","_endtk","_endNOtk","_fwd"] reweight_f = TF1("f","pol2(0)+expo(3)") reweight_f.SetParameters(0.1955298,-0.003830591,1.944794e-05,4.649755,-0.1722024) self.reweight = ("pt", reweight_f) self.doJetIdHisto = True self.gluCleanHistosId = PileupJetHistograms("GluonMatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables,reweight=self.reweight, jetIdMva=self.cfg_ana.jetIdMva) self.quarkCleanHistosId = PileupJetHistograms("QuarkMatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables,reweight=self.reweight, jetIdMva=self.cfg_ana.jetIdMva) self.reweiMatchedCleanHistosId = PileupJetHistograms("ReweiMatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables,reweight=self.reweight, jetIdMva=self.cfg_ana.jetIdMva) self.unmatchedCleanHistosId = PileupJetHistograms("UnmatchedCleanHistosId",self.vtxBins,self.ptBins,self.etaBins,etalabels=self.puEtaLables, jetIdMva=self.cfg_ana.jetIdMva) self.h_nvtx = TH1F ("h_nvtx", "" ,50, 0, 50) self.h_genjetspt = TH1F ("h_genjetspt", "" ,500, 0, 500) self.h_secondClosestVsPtratio = TH2F ("h_secondClosestVsPtratio", "" ,100, 0, 2, 100, 0, 6) self.h_avedistanceVSNvtx = TH2F ("h_avedistanceVSNvtx", "" ,50, 0, 50, 100, 0, 6) self.h_PTRatioVSgenEta = TH2F ("h_PTRatioVSgenEta", "" ,150, -5, 5, 100, 0, 2) self.h_PTRatioVSgenPt = TH2F ("h_PTRatioVSgenPt", "" ,200, 0, 100, 100, 0, 2) self.h_matchDR = TH1F ("h_matchDR", "" ,60, 0, 0.30) self.h_relPtVSmatchDR = TH2F ("h_relPtVSmatchDR", "" ,60, 0, 0.30, 100, 0, 2) self.h_relPtVSchFrac = TH2F ("h_relPtVSchFrac", "" ,100, 0, 1, 100, 0, 2)