45 #include "TLorentzVector.h"
52 #include <Math/VectorUtil.h>
84 using namespace ROOT::Math::VectorUtil;
99 hMassNoCorr = fs->
make<TH1F>(
"hMassNoCorr",
"", 100, 100, 300);
100 hMassCorFl0 = fs->
make<TH1F>(
"hMassCorFl0",
"", 100, 100, 300);
101 hMassCorFlM = fs->
make<TH1F>(
"hMassCorFlM",
"", 100, 100, 300);
102 hMassCorMix = fs->
make<TH1F>(
"hMassCorMix",
"", 100, 100, 300);
106 cout <<
"[calcTopMass] analysing event " << iEvent.
id() << endl;
108 iEvent.
getByLabel(sourceByRefer_, theJetPartonMatch);
110 cerr <<
"[calcTopMass] caught std::exception " << ce.what() << endl;
120 TLorentzVector jetsNoCorr[6];
121 TLorentzVector jetsCorFl0[6];
122 TLorentzVector jetsCorFlM[6];
123 TLorentzVector jetsCorMix[6];
125 bool isQuarkFound[6] = {
false};
127 for (JetMatchedPartonsCollection::const_iterator
j = theJetPartonMatch->begin();
j != theJetPartonMatch->end();
j++) {
133 int particPDG = thePhyDef.
get()->pdgId();
135 if (particPDG == 5) {
136 double bTcorr = bTopCorrector->
correction(theJet);
137 double tTcorr = tTopCorrector->
correction(theJet);
138 jetsNoCorr[0].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
139 jetsCorFl0[0].SetPtEtaPhiM(theJet.pt() * bTcorr, theJet.eta(), theJet.phi(), 0);
140 jetsCorFlM[0].SetPtEtaPhiM(theJet.pt() * bTcorr, theJet.eta(), theJet.phi(), bMass);
141 jetsCorMix[0].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
142 isQuarkFound[0] =
true;
143 }
else if (particPDG == -5) {
144 double bTcorr = bTopCorrector->
correction(theJet);
145 double tTcorr = tTopCorrector->
correction(theJet);
146 jetsNoCorr[3].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
147 jetsCorFl0[3].SetPtEtaPhiM(theJet.pt() * bTcorr, theJet.eta(), theJet.phi(), 0);
148 jetsCorFlM[3].SetPtEtaPhiM(theJet.pt() * bTcorr, theJet.eta(), theJet.phi(), bMass);
149 jetsCorMix[3].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
150 isQuarkFound[3] =
true;
151 }
else if (particPDG == 2) {
152 double qTcorr = qTopCorrector->
correction(theJet);
153 double tTcorr = tTopCorrector->
correction(theJet);
154 jetsNoCorr[1].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
155 jetsCorFl0[1].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), 0);
156 jetsCorFlM[1].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), qMass);
157 jetsCorMix[1].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
158 isQuarkFound[1] =
true;
159 }
else if (particPDG == 4) {
160 double cTcorr = cTopCorrector->
correction(theJet);
161 double tTcorr = tTopCorrector->
correction(theJet);
162 jetsNoCorr[1].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
163 jetsCorFl0[1].SetPtEtaPhiM(theJet.pt() * cTcorr, theJet.eta(), theJet.phi(), 0);
164 jetsCorFlM[1].SetPtEtaPhiM(theJet.pt() * cTcorr, theJet.eta(), theJet.phi(), cMass);
165 jetsCorMix[1].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
166 isQuarkFound[1] =
true;
167 }
else if (particPDG == -1) {
168 double qTcorr = qTopCorrector->
correction(theJet);
169 double tTcorr = tTopCorrector->
correction(theJet);
170 jetsNoCorr[2].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
171 jetsCorFl0[2].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), 0);
172 jetsCorFlM[2].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), qMass);
173 jetsCorMix[2].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
174 isQuarkFound[2] =
true;
175 }
else if (particPDG == -3) {
176 double qTcorr = qTopCorrector->
correction(theJet);
177 double tTcorr = tTopCorrector->
correction(theJet);
178 jetsNoCorr[2].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
179 jetsCorFl0[2].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), 0);
180 jetsCorFlM[2].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), qMass);
181 jetsCorMix[2].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
182 isQuarkFound[2] =
true;
183 }
else if (particPDG == -2) {
184 double qTcorr = qTopCorrector->
correction(theJet);
185 double tTcorr = tTopCorrector->
correction(theJet);
186 jetsNoCorr[4].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
187 jetsCorFl0[4].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), 0);
188 jetsCorFlM[4].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), qMass);
189 jetsCorMix[4].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
190 isQuarkFound[4] =
true;
191 }
else if (particPDG == -4) {
192 double qTcorr = qTopCorrector->
correction(theJet);
193 double tTcorr = tTopCorrector->
correction(theJet);
194 jetsNoCorr[4].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
195 jetsCorFl0[4].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), 0);
196 jetsCorFlM[4].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), qMass);
197 jetsCorMix[4].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
198 isQuarkFound[4] =
true;
199 }
else if (particPDG == 1) {
200 double qTcorr = qTopCorrector->
correction(theJet);
201 double tTcorr = tTopCorrector->
correction(theJet);
202 jetsNoCorr[5].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
203 jetsCorFl0[5].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), 0);
204 jetsCorFlM[5].SetPtEtaPhiM(theJet.pt() * qTcorr, theJet.eta(), theJet.phi(), qMass);
205 jetsCorMix[5].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
206 isQuarkFound[5] =
true;
207 }
else if (particPDG == 3) {
208 double cTcorr = cTopCorrector->
correction(theJet);
209 double tTcorr = tTopCorrector->
correction(theJet);
210 jetsNoCorr[5].SetPtEtaPhiM(theJet.pt(), theJet.eta(), theJet.phi(), theJet.mass());
211 jetsCorFl0[5].SetPtEtaPhiM(theJet.pt() * cTcorr, theJet.eta(), theJet.phi(), 0);
212 jetsCorFlM[5].SetPtEtaPhiM(theJet.pt() * cTcorr, theJet.eta(), theJet.phi(), cMass);
213 jetsCorMix[5].SetPtEtaPhiM(theJet.pt() * tTcorr, theJet.eta(), theJet.phi(), 0);
214 isQuarkFound[5] =
true;
219 if (isQuarkFound[0] && isQuarkFound[1] && isQuarkFound[2]) {
220 TLorentzVector *theTopPNoCorr =
new TLorentzVector(jetsNoCorr[0] + jetsNoCorr[1] + jetsNoCorr[2]);
221 TLorentzVector *theTopPCorFl0 =
new TLorentzVector(jetsCorFl0[0] + jetsCorFl0[1] + jetsCorFl0[2]);
222 TLorentzVector *theTopPCorFlM =
new TLorentzVector(jetsCorFlM[0] + jetsCorFlM[1] + jetsCorFlM[2]);
223 TLorentzVector *theTopPCorMix =
new TLorentzVector(jetsCorMix[0] + jetsCorMix[1] + jetsCorMix[2]);
224 hMassNoCorr->Fill(theTopPNoCorr->M());
225 hMassCorFl0->Fill(theTopPCorFl0->M());
226 hMassCorFlM->Fill(theTopPCorFlM->M());
227 hMassCorMix->Fill(theTopPCorMix->M());
230 if (isQuarkFound[3] && isQuarkFound[4] && isQuarkFound[5]) {
231 TLorentzVector *theTopMNoCorr =
new TLorentzVector(jetsNoCorr[3] + jetsNoCorr[4] + jetsNoCorr[5]);
232 TLorentzVector *theTopMCorFl0 =
new TLorentzVector(jetsCorFl0[3] + jetsCorFl0[4] + jetsCorFl0[5]);
233 TLorentzVector *theTopMCorFlM =
new TLorentzVector(jetsCorFlM[3] + jetsCorFlM[4] + jetsCorFlM[5]);
234 TLorentzVector *theTopMCorMix =
new TLorentzVector(jetsCorMix[3] + jetsCorMix[4] + jetsCorMix[5]);
235 hMassNoCorr->Fill(theTopMNoCorr->M());
236 hMassCorFl0->Fill(theTopMCorFl0->M());
237 hMassCorFlM->Fill(theTopMCorFlM->M());
238 hMassCorMix->Fill(theTopMCorMix->M());
static const std::string kSharedResource
bool isNonnull() const
Checks for non-null.
edm::Handle< reco::JetMatchedPartonsCollection > theJetPartonMatch
std::string m_cT_CorrectorName
#define DEFINE_FWK_MODULE(type)
edm::InputTag sourceByRefer_
T * make(const Args &...args) const
make new ROOT object
double correction(const LorentzVector &fJet) const
get correction using Jet information only
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
T const * get() const
Returns C++ pointer to the item.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
calcTopMass(const edm::ParameterSet &)
std::string m_qT_CorrectorName
const GenParticleRef & physicsDefinitionParton() const
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
T getParameter(std::string const &) const
std::string m_tT_CorrectorName
edm::InputTag sourcePartons_
std::string m_bT_CorrectorName