CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TtDilepEvtSolution.cc
Go to the documentation of this file.
1 //
2 //
3 
7 
9  jetCorrScheme_ = 0;
10  wpDecay_ = "NotDefined";
11  wmDecay_ = "NotDefined";
12  bestSol_ = false;
13  topmass_ = 0.;
14  weightmax_ = 0.;
15 }
16 
18 
19 //-------------------------------------------
20 // get calibrated base objects
21 //-------------------------------------------
23  // WARNING this is obsolete and only
24  // kept for backwards compatibility
25  if (jetCorrScheme_ == 1) {
26  //jet calibrated according to MC truth
27  return jetB_->correctedJet("HAD", "B");
28  } else if (jetCorrScheme_ == 2) {
29  return jetB_->correctedJet("HAD", "B");
30  } else {
31  return *jetB_;
32  }
33 }
34 
36  // WARNING this is obsolete and only
37  // kept for backwards compatibility
38  if (jetCorrScheme_ == 1) {
39  //jet calibrated according to MC truth
40  return jetBbar_->correctedJet("HAD", "B");
41  } else if (jetCorrScheme_ == 2) {
42  return jetBbar_->correctedJet("HAD", "B");
43  } else {
44  return *jetBbar_;
45  }
46 }
47 
48 //-------------------------------------------
49 // returns the 4-vector of the positive
50 // lepton, with the charge and the pdgId
51 //-------------------------------------------
54  if (wpDecay_ == "muon") {
55  p = reco::Particle(+1, getMuonp().p4());
56  p.setPdgId(-11);
57  }
58  if (wpDecay_ == "electron") {
59  p = reco::Particle(+1, getElectronp().p4());
60  p.setPdgId(-13);
61  }
62  if (wmDecay_ == "tau") {
63  p = reco::Particle(+1, getTaup().p4());
64  p.setPdgId(-15);
65  }
66  return p;
67 }
68 
69 //-------------------------------------------
70 // miscellaneous
71 //-------------------------------------------
73  double distance = 0.;
74  if (!getGenB() || !getGenBbar())
75  return distance;
76  distance += reco::deltaR(getCalJetB(), *getGenB());
77  distance += reco::deltaR(getCalJetBbar(), *getGenBbar());
78  return distance;
79 }
80 
82  double distance = 0.;
83  if (!getGenLepp() || !getGenLepm())
84  return distance;
85  if (getWpDecay() == "electron")
86  distance += reco::deltaR(getElectronp(), *getGenLepp());
87  else if (getWpDecay() == "muon")
88  distance += reco::deltaR(getMuonp(), *getGenLepp());
89  else if (getWpDecay() == "tau")
90  distance += reco::deltaR(getTaup(), *getGenLepp());
91  if (getWmDecay() == "electron")
92  distance += reco::deltaR(getElectronm(), *getGenLepm());
93  else if (getWmDecay() == "muon")
94  distance += reco::deltaR(getMuonm(), *getGenLepm());
95  else if (getWmDecay() == "tau")
96  distance += reco::deltaR(getTaum(), *getGenLepm());
97  return distance;
98 }
99 
100 //-------------------------------------------
101 // returns the 4-vector of the negative
102 // lepton, with the charge and the pdgId
103 //-------------------------------------------
106  if (wmDecay_ == "electron") {
107  p = reco::Particle(-1, getElectronm().p4());
108  p.setPdgId(11);
109  }
110  if (wmDecay_ == "muon") {
111  p = reco::Particle(-1, getMuonm().p4());
112  p.setPdgId(13);
113  }
114  if (wmDecay_ == "tau") {
115  p = reco::Particle(-1, getTaum().p4());
116  p.setPdgId(15);
117  }
118  return p;
119 }
120 
121 //-------------------------------------------
122 // get info on the outcome of the signal
123 //selection LR
124 //-------------------------------------------
125 double TtDilepEvtSolution::getLRSignalEvtObsVal(unsigned int selObs) const {
126  double val = -999.;
127  for (size_t i = 0; i < lrSignalEvtVarVal_.size(); i++) {
128  if (lrSignalEvtVarVal_[i].first == selObs)
129  val = lrSignalEvtVarVal_[i].second;
130  }
131  return val;
132 }
133 
134 //-------------------------------------------
135 // set the generated event
136 //-------------------------------------------
138  if (!aGenEvt->isFullLeptonic()) {
139  edm::LogInfo("TtGenEventNotFilled") << "genEvt is not di-leptonic; TtGenEvent is not filled";
140  return;
141  }
143 }
144 
145 //-------------------------------------------
146 // set the outcome of the signal selection LR
147 //-------------------------------------------
148 void TtDilepEvtSolution::setLRSignalEvtObservables(const std::vector<std::pair<unsigned int, double> >& varval) {
149  lrSignalEvtVarVal_.clear();
150  for (size_t ise = 0; ise < varval.size(); ise++)
151  lrSignalEvtVarVal_.push_back(varval[ise]);
152 }
pat::Jet getCalJetBbar() const
const reco::GenParticle * getGenLepm() const
edm::Ref< std::vector< pat::Jet > > jetB_
const reco::GenParticle * getGenBbar() const
pat::Electron getElectronm() const
std::string getWmDecay() const
std::string getWpDecay() const
double getLRSignalEvtObsVal(unsigned int) const
void setLRSignalEvtObservables(const std::vector< std::pair< unsigned int, double > > &)
reco::Particle getLeptNeg() const
pat::Jet getJetBbar() const
pat::Electron getElectronp() const
edm::Ref< std::vector< pat::Jet > > jetBbar_
reco::Particle getLeptPos() const
pat::Tau getTaup() const
edm::RefProd< TtGenEvent > theGenEvt_
pat::Muon getMuonm() const
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
Log< level::Info, false > LogInfo
pat::Jet getJetB() const
double getLeptonResidual() const
void setGenEvt(const edm::Handle< TtGenEvent > &)
pat::Tau getTaum() const
pat::Jet getCalJetB() const
std::vector< std::pair< unsigned int, double > > lrSignalEvtVarVal_
void setPdgId(int pdgId)
Definition: Particle.h:152
const reco::GenParticle * getGenLepp() const
Analysis-level calorimeter jet class.
Definition: Jet.h:77
double getJetResidual() const
pat::Muon getMuonp() const
const reco::GenParticle * getGenB() const