Esempio n. 1
0
 def beginLoop(self, setup):
     print self, self.__class__
     super(JetWeighter, self).beginLoop(setup)
     self.averages.add('weight', Average('weight'))
     self.averages.add('triggerWeight', Average('triggerWeight'))
     self.averages.add('eff_data', Average('eff_data'))
     self.averages.add('eff_MC', Average('eff_MC'))
     self.averages.add('recEffWeight', Average('recEffWeight'))
Esempio n. 2
0
 def beginLoop(self, setup):
     super(H2TauTauEventSorter, self).beginLoop(setup)
     self.counters.addCounter('Sorter')
     self.counters.counter('Sorter').register('All events')
     self.counters.counter('Sorter').register('tau iso')
     self.counters.counter('Sorter').register('Matched = None or True')
     self.averages.add('generatorWeight', Average('generatorWeight'))
     self.averages.add('eventWeight', Average('eventWeight'))
Esempio n. 3
0
 def beginLoop(self, setup):
     super(WNJetsAnalyzer, self).beginLoop(setup)
     self.averages.add('NUP', Average('NUP'))
     self.averages.add('NJets', Average('NJets'))
     self.averages.add('WJetWeight', Average('WJetWeight'))
     if self.cfg_comp.isMC:
         self.rootfile = TFile('/'.join([self.dirName, 'NUP.root']),
                               'recreate')
         self.nup = TH1F('nup', 'nup', 20, 0, 20)
         self.njets = TH1F('njets', 'njets', 10, 0, 10)
    def beginLoop(self, setup):
        print self, self.__class__
        super(LeptonWeighter, self).beginLoop(setup)
        self.averages.add('weight', Average('weight'))

        for sf_name in self.scaleFactors:
            self.averages.add('weight_' + sf_name,
                              Average('weight_' + sf_name))
            self.averages.add('eff_data_' + sf_name,
                              Average('eff_data_' + sf_name))
            self.averages.add('eff_MC_' + sf_name,
                              Average('eff_MC_' + sf_name))
Esempio n. 5
0
 def test_ave_add(self):
     c1 = Average('c1')
     c1.add(0, 1)
     c2 = Average('c2')
     c2.add(1, 3)
     c3 = c1 + c2
     ave, unc = c3.average()
     self.assertEqual(ave, 0.75)
 def beginLoop(self, setup):
     super(NJetsAnalyzer, self).beginLoop(setup)
     self.averages.add('NUP', Average('NUP'))
     self.averages.add('NJets', Average('NJets'))
     self.averages.add('NJetWeight', Average('NJetWeight'))
     if self.cfg_comp.isMC:
         self.rootfile = TFile('/'.join([self.dirName, 'NUP.root']),
                               'recreate')
         self.nup = TH1F('nup', 'nup', 20, 0, 20)
         self.njets = TH1F('njets', 'njets', 10, 0, 10)
         self.tree = TreeNumpy('tree', 'test tree for NJetsAnalyzer')
         if self.cfg_ana.fillTree:
             self.tree.var('njets', int)
             self.tree.var('nup', int)
             self.tree.var('weight')
Esempio n. 7
0
 def beginLoop(self, setup):
     super(EmbedWeighter, self).beginLoop(setup)
     self.averages.add('weight', Average('weight'))
     self.counters.addCounter('EmbedWeighter')
     count = self.counters.counter('EmbedWeighter')
     count.register('all events')
     count.register('gen Z mass > 50')
Esempio n. 8
0
 def beginLoop(self, setup):
     super(VertexAnalyzer,self).beginLoop(setup)
     self.averages.add('vertexWeight', Average('vertexWeight') )
     self.counters.addCounter('GoodVertex')
     self.count = self.counters.counter('GoodVertex')
     self.count.register('All Events')
     self.count.register('Events With Good Vertex')
Esempio n. 9
0
 def beginLoop(self, setup):
     print self, self.__class__
     super(TauDecayModeWeighter, self).beginLoop(setup)
     self.averages.add('weight', Average('weight'))
     # For 1 prong no pi-zero. Can be extended to more weights
     # if necessary
     # JAN: set to 1. until remeasured with 2015 data
     self.oneProngNoPiZeroWeight = 1.
Esempio n. 10
0
    def beginLoop(self, setup):
        print self, self.__class__
        super(MultiLeptonWeighter, self).beginLoop(setup)

        # total per-event average weight
        self.averages.add('weight_%s' % self.finalState,
                          Average('weight_%s' % self.finalState))

        # per-lepton and per-component weight
        for ii in xrange(3):
            self.averages.add('weight_%s_l%d' % (self.finalState, ii),
                              Average('weight_%s_l%d' % (self.finalState, ii)))
            for sf_name in self.scaleFactors[ii].keys():
                self.averages.add(
                    'weight_%s_l%d_%s' % (self.finalState, ii, sf_name),
                    Average('weight_%s_l%d_%s' %
                            (self.finalState, ii, sf_name)))
Esempio n. 11
0
 def beginLoop(self, setup):
     print self, self.__class__
     super(TauFakeRateWeighter,self).beginLoop(setup)
     self.averages.add('weight', Average('weight') )
Esempio n. 12
0
 def beginLoop(self, setup):
     super(PileUpAnalyzer, self).beginLoop(setup)
     self.averages.add('puWeight', Average('puWeight'))
Esempio n. 13
0
 def test_ave_wei(self):
     c = Average('TestAve')
     c.add(0, 1)
     c.add(1, 3)
     ave, unc = c.average()
     self.assertEqual(ave, 0.75)
Esempio n. 14
0
 def beginLoop(self):
     super(PileUpAnalyzer,self).beginLoop()
     self.averages.add('vertexWeight', Average('vertexWeight') )
Esempio n. 15
0
 def test_ave_unw(self):
     c = Average('TestAve')
     c.add(1, 1)
     c.add(2, 1)
     ave, unc = c.average()
     self.assertEqual(ave, 1.5)
Esempio n. 16
0
 def beginLoop(self, setup):
     print self, self.__class__
     super(BTagEffWeighter,self).beginLoop(setup)
     self.averages.add('btagEffWeight', Average('btagEffWeight') )
Esempio n. 17
0
 def beginLoop(self, setup):
     print self, self.__class__
     super(HiggsPtWeighter,self).beginLoop(setup)
     self.averages.add('weight', Average('weight') )