ATLAS Offline Software
LhoodMMFitInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "TDirectory.h"
7 #include "TTree.h"
8 #include <string.h>
9 
10 using namespace CP;
11 
13  reset();
14  resizeVectors(nlep);
15 }
16 
18 
19  totEvents = 0;
20 
21  event_cat.clear();
22  event_sumw2.clear();
23  coeffs_num.clear();
24 
25  normterms.clear();
26 
27  OSfrac_num.clear();
28  OSfrac_denom.clear();
29 
30  // start out with vectors large enough to hold info from single-lepton events
31  resizeVectors(1);
32 
33 }
34 
35 void LhoodMMFitInfo::add(LhoodMMFitInfo& rhs, int nLepMax) {
36 
37 
38  totEvents += rhs.totEvents;
39 
40  for (int ilep = 0; ilep < nLepMax; ilep++) {
41  eventCount[ilep] += rhs.eventCount[ilep];
42  }
43 
44  for (int ilep = 0; ilep < nLepMax; ilep++) {
45  for (int jlep = 0; jlep < (0x1 << (ilep+1)); jlep++) {
46  for (int klep = 0; klep < (0x1 << (ilep+1)); klep++) {
47  coeffs_num[ilep][jlep][klep].add(rhs.coeffs_num[ilep][jlep][klep]);
48  }
49  }
50 
51  for (int ientry = 0; ientry < (0x1 << (ilep+1)); ientry++) {
52  event_cat[ilep][ientry] += rhs.event_cat[ilep][ientry];
53  event_sumw2[ilep][ientry] += rhs.event_sumw2[ilep][ientry];
54  }
55 
56  }
57 
58  for (int ilep = 0; ilep <nLepMax; ilep++) {
59  for (int jlep = 0; jlep < pow(2,2*(ilep+1)); jlep++) {
60  normterms[ilep][jlep].add(rhs.normterms[ilep][jlep]);
61  }
62  }
63 
64  for (int ilep = 0; ilep <nLepMax; ilep++) {
65  for (int jlep = 0; jlep < ilep; jlep++) {
66  OSfrac_num[ilep][jlep]+=rhs.OSfrac_num[ilep][jlep];
67  OSfrac_denom[ilep][jlep]+=rhs.OSfrac_denom[ilep][jlep];
68  }
69  }
70 
71 }
72 
73 void LhoodMMFitInfo::resizeVectors(unsigned nlep) {
74 
75  // check that we're not being asked to shrink...
76  if (nlep < event_cat.size()) {
77  return;
78  }
79 
80  event_cat.resize(nlep);
81  event_sumw2.resize(nlep);
82  coeffs_num.resize(nlep);
83  eventCount.resize(nlep);
84 
85  for (unsigned ilep = 0; ilep < nlep; ilep++) {
86  coeffs_num[ilep].resize(pow(2,ilep+1));
87  event_cat[ilep].resize(pow(2,ilep+1));
88  event_sumw2[ilep].resize(pow(2,ilep+1));
89  for (int jlep = 0; jlep < pow(2,ilep+1); jlep++) {
90  coeffs_num[ilep][jlep].resize(pow(2,ilep+1));
91  }
92  }
93 
94  normterms.resize(nlep);
95  for (unsigned ilep = 0; ilep <nlep; ilep++) {
96  normterms[ilep].resize(pow(2,2*(ilep+1)));
97  }
98 
99  OSfrac_num.resize(nlep);
100  OSfrac_denom.resize(nlep);
101  for (unsigned ilep = 0; ilep <nlep; ilep++) {
102  OSfrac_num[ilep].resize(ilep+2);
103  OSfrac_denom[ilep].resize(ilep+2);
104  }
105 
106 }
CP::LhoodMMFitInfo::totEvents
int totEvents
Definition: LhoodMMFitInfo.h:23
CP::LhoodMMFitInfo::OSfrac_denom
std::vector< std::vector< double > > OSfrac_denom
Definition: LhoodMMFitInfo.h:22
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CP::LhoodMMFitInfo::add
void add(LhoodMMFitInfo &rhs, int nLepMax)
Definition: LhoodMMFitInfo.cxx:35
CP::LhoodMMFitInfo::LhoodMMFitInfo
LhoodMMFitInfo(int nlep=1)
Definition: LhoodMMFitInfo.cxx:12
CP::LhoodMMFitInfo::resizeVectors
void resizeVectors(unsigned nlep)
Definition: LhoodMMFitInfo.cxx:73
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::LhoodMMFitInfo::eventCount
std::vector< double > eventCount
Definition: LhoodMMFitInfo.h:24
CP::LhoodMMFitInfo::OSfrac_num
std::vector< std::vector< double > > OSfrac_num
Definition: LhoodMMFitInfo.h:21
CP::LhoodMMFitInfo::event_sumw2
std::vector< std::vector< double > > event_sumw2
Definition: LhoodMMFitInfo.h:20
CP::LhoodMMFitInfo::event_cat
std::vector< std::vector< double > > event_cat
Definition: LhoodMMFitInfo.h:19
CP::LhoodMMFitInfo::coeffs_num
std::vector< std::vector< std::vector< FakeBkgTools::Efficiency > > > coeffs_num
Definition: LhoodMMFitInfo.h:17
CP::LhoodMMFitInfo
Definition: LhoodMMFitInfo.h:13
LhoodMMFitInfo.h
CP::LhoodMMFitInfo::reset
void reset()
Definition: LhoodMMFitInfo.cxx:17
CP::LhoodMMFitInfo::normterms
std::vector< std::vector< FakeBkgTools::Efficiency > > normterms
Definition: LhoodMMFitInfo.h:18