204 std::map<int, int> bJetFromTopIds;
206 std::map<int, int> bJetFromWIds;
208 std::map<int, int> cJetFromWIds;
210 std::map<int, int> bJetAdditionalIds;
212 std::map<int, int> cJetAdditionalIds;
215 for (
size_t hadronId = 0; hadronId < genBHadIndex->size(); ++hadronId) {
217 const int jetIndex = genBHadJetIndex->at(hadronId);
227 const int flavour = genBHadFlavour->at(hadronId);
230 if (bJetFromTopIds.count(jetIndex) < 1)
231 bJetFromTopIds[jetIndex] = 1;
233 bJetFromTopIds[jetIndex]++;
238 if (bJetFromWIds.count(jetIndex) < 1)
239 bJetFromWIds[jetIndex] = 1;
241 bJetFromWIds[jetIndex]++;
245 if (bJetAdditionalIds.count(jetIndex) < 1)
246 bJetAdditionalIds[jetIndex] = 1;
248 bJetAdditionalIds[jetIndex]++;
252 for (std::map<int, int>::iterator it = bJetFromWIds.begin(); it != bJetFromWIds.end();) {
254 if (bJetFromTopIds.count(it->first) > 0)
255 bJetFromWIds.erase(it++);
261 for (std::map<int, int>::iterator it = bJetAdditionalIds.begin(); it != bJetAdditionalIds.end();) {
263 if (bJetFromTopIds.count(it->first) > 0)
264 bJetAdditionalIds.erase(it++);
266 else if (bJetFromWIds.count(it->first) > 0)
267 bJetAdditionalIds.erase(it++);
273 for (
size_t hadronId = 0; hadronId < genCHadJetIndex->size(); ++hadronId) {
275 const int jetIndex = genCHadJetIndex->at(hadronId);
280 if (genCHadBHadronId->at(hadronId) >= 0)
288 if (bJetFromTopIds.count(jetIndex) > 0)
290 if (bJetFromWIds.count(jetIndex) > 0)
292 if (bJetAdditionalIds.count(jetIndex) > 0)
295 const int flavour = genCHadFlavour->at(hadronId);
298 if (cJetFromWIds.count(jetIndex) < 1)
299 cJetFromWIds[jetIndex] = 1;
301 cJetFromWIds[jetIndex]++;
305 if (cJetAdditionalIds.count(jetIndex) < 1)
306 cJetAdditionalIds[jetIndex] = 1;
308 cJetAdditionalIds[jetIndex]++;
312 for (std::map<int, int>::iterator it = cJetAdditionalIds.begin(); it != cJetAdditionalIds.end();) {
314 if (cJetFromWIds.count(it->first) > 0)
315 cJetAdditionalIds.erase(it++);
322 int additionalJetEventId = bJetFromTopIds.size() * 100 + bJetFromWIds.size() * 1000 + cJetFromWIds.size() * 10000;
324 if (bJetAdditionalIds.size() == 1) {
325 const int nHadronsInJet = bJetAdditionalIds.begin()->second;
327 if (nHadronsInJet == 1)
328 additionalJetEventId += 51;
331 additionalJetEventId += 52;
334 else if (bJetAdditionalIds.size() > 1) {
337 int nHadronsInJet1 = bJetAdditionalIds.at(orderedJetIndices.at(0));
338 int nHadronsInJet2 = bJetAdditionalIds.at(orderedJetIndices.at(1));
340 if (
std::max(nHadronsInJet1, nHadronsInJet2) == 1)
341 additionalJetEventId += 53;
343 else if (
std::min(nHadronsInJet1, nHadronsInJet2) == 1 &&
std::max(nHadronsInJet1, nHadronsInJet2) > 1)
344 additionalJetEventId += 54;
346 else if (
std::min(nHadronsInJet1, nHadronsInJet2) > 1)
347 additionalJetEventId += 55;
352 if (cJetAdditionalIds.size() == 1) {
353 const int nHadronsInJet = cJetAdditionalIds.begin()->second;
355 if (nHadronsInJet == 1)
356 additionalJetEventId += 41;
359 additionalJetEventId += 42;
362 else if (cJetAdditionalIds.size() > 1) {
365 int nHadronsInJet1 = cJetAdditionalIds.at(orderedJetIndices.at(0));
366 int nHadronsInJet2 = cJetAdditionalIds.at(orderedJetIndices.at(1));
368 if (
std::max(nHadronsInJet1, nHadronsInJet2) == 1)
369 additionalJetEventId += 43;
371 else if (
std::min(nHadronsInJet1, nHadronsInJet2) == 1 &&
std::max(nHadronsInJet1, nHadronsInJet2) > 1)
372 additionalJetEventId += 44;
374 else if (
std::min(nHadronsInJet1, nHadronsInJet2) > 1)
375 additionalJetEventId += 45;
380 additionalJetEventId += 0;
384 std::unique_ptr<int> ttbarId(
new int);
385 *ttbarId = additionalJetEventId;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::EDGetTokenT< std::vector< int > > genBHadFromTopWeakDecayToken_
const edm::EDGetTokenT< std::vector< int > > genBHadJetIndexToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< std::vector< int > > genCHadFromTopWeakDecayToken_
const double genJetPtMin_
const edm::EDGetTokenT< std::vector< int > > genCHadFlavourToken_
const double genJetAbsEtaMax_
std::vector< int > nHadronsOrderedJetIndices(const std::map< int, int > &m_jetIndex)
const edm::EDGetTokenT< std::vector< int > > genBHadFlavourToken_
Abs< T >::type abs(const T &t)
genBHadPlusMothersIndices
const edm::EDGetTokenT< std::vector< std::vector< int > > > genBHadPlusMothersIndicesToken_
const edm::EDGetTokenT< std::vector< int > > genBHadLeptonHadronIndexToken_
const edm::EDGetTokenT< std::vector< int > > genBHadIndexToken_
const edm::EDGetTokenT< std::vector< int > > genBHadLeptonViaTauToken_
const edm::EDGetTokenT< std::vector< reco::GenParticle > > genBHadPlusMothersToken_
const edm::EDGetTokenT< std::vector< int > > genCHadJetIndexToken_
const edm::EDGetTokenT< std::vector< int > > genCHadBHadronIdToken_
const edm::EDGetTokenT< reco::GenJetCollection > genJetsToken_