CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GenTtbarCategorizer Class Reference

#include <TopQuarkAnalysis/TopTools/plugins/GenTtbarCategorizer.cc>

Inheritance diagram for GenTtbarCategorizer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GenTtbarCategorizer (const edm::ParameterSet &)
 
 ~GenTtbarCategorizer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
std::vector< int > nHadronsOrderedJetIndices (const std::map< int, int > &m_jetIndex)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const edm::EDGetTokenT< std::vector< int > > genBHadFlavourToken_
 
const edm::EDGetTokenT< std::vector< int > > genBHadFromTopWeakDecayToken_
 
const edm::EDGetTokenT< std::vector< int > > genBHadIndexToken_
 
const edm::EDGetTokenT< std::vector< int > > genBHadJetIndexToken_
 
const edm::EDGetTokenT< std::vector< int > > genBHadLeptonHadronIndexToken_
 
const edm::EDGetTokenT< std::vector< int > > genBHadLeptonViaTauToken_
 
const edm::EDGetTokenT< std::vector< std::vector< int > > > genBHadPlusMothersIndicesToken_
 
const edm::EDGetTokenT< std::vector< reco::GenParticle > > genBHadPlusMothersToken_
 
const edm::EDGetTokenT< std::vector< int > > genCHadBHadronIdToken_
 
const edm::EDGetTokenT< std::vector< int > > genCHadFlavourToken_
 
const edm::EDGetTokenT< std::vector< int > > genCHadFromTopWeakDecayToken_
 
const edm::EDGetTokenT< std::vector< int > > genCHadJetIndexToken_
 
const double genJetAbsEtaMax_
 
const double genJetPtMin_
 
const edm::EDGetTokenT< reco::GenJetCollectiongenJetsToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Categorization of different tt+xx processes, returning unique ID for each process as e.g. tt+bb, tt+b, tt+2b, tt+cc, ...

Implementation:

The classification scheme returns an ID per event, and works as follows:

All jets in the following need to be in the acceptance as given by the config parameters |eta|, pt.
A c jet must contain at least one c hadron and should contain no b hadrons

First, b jets from top are identified, i.e. jets containing a b hadron from t->b decay
They are encoded in the ID as numberOfBjetsFromTop*100, i.e.
0xx: no b jets from top in acceptance
1xx: 1 b jet from top in acceptance
2xx: both b jets from top in acceptance

Then, b jets from W are identified, i.e. jets containing a b hadron from W->b decay
They are encoded in the ID as numberOfBjetsFromW*1000, i.e.
0xxx: no b jets from W in acceptance
1xxx: 1 b jet from W in acceptance
2xxx: 2 b jets from W in acceptance

Then, c jets from W are identified, i.e. jets containing a c hadron from W->c decay, but no b hadrons
They are encoded in the ID as numberOfCjetsFromW*10000, i.e.
0xxxx: no c jets from W in acceptance
1xxxx: 1 c jet from W in acceptance
2xxxx: 2 c jets from W in acceptance

From the remaining jets, the ID is formed based on the additional b jets (IDs x5x) and c jets (IDs x4x) in the following order:
x55: at least 2 additional b jets with at least two of them having >= 2 b hadrons in each
x54: at least 2 additional b jets with one of them having >= 2 b hadrons, the others having =1 b hadron
x53: at least 2 additional b jets with all having =1 b hadron
x52: exactly 1 additional b jet having >=2 b hadrons
x51: exactly 1 additional b jet having =1 b hadron
x45: at least 2 additional c jets with at least two of them having >= 2 c hadrons in each
x44: at least 2 additional c jets with one of them having >= 2 c hadrons, the others having =1 c hadron
x43: at least 2 additional c jets with all having =1 c hadron
x42: exactly 1 additional c jet having >=2 c hadrons
x41: exactly 1 additional c jet having =1 c hadron
x00: No additional b or c jet, i.e. only light flavour jets or no additional jets

Definition at line 73 of file GenTtbarCategorizer.cc.

Constructor & Destructor Documentation

GenTtbarCategorizer::GenTtbarCategorizer ( const edm::ParameterSet iConfig)
explicit

Definition at line 127 of file GenTtbarCategorizer.cc.

128  : genJetPtMin_(iConfig.getParameter<double>("genJetPtMin")),
129  genJetAbsEtaMax_(iConfig.getParameter<double>("genJetAbsEtaMax")),
130  genJetsToken_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("genJets"))),
131  genBHadJetIndexToken_(consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genBHadJetIndex"))),
132  genBHadFlavourToken_(consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genBHadFlavour"))),
134  consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genBHadFromTopWeakDecay"))),
136  consumes<std::vector<reco::GenParticle> >(iConfig.getParameter<edm::InputTag>("genBHadPlusMothers"))),
138  consumes<std::vector<std::vector<int> > >(iConfig.getParameter<edm::InputTag>("genBHadPlusMothersIndices"))),
139  genBHadIndexToken_(consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genBHadIndex"))),
141  consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genBHadLeptonHadronIndex"))),
143  consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genBHadLeptonViaTau"))),
144  genCHadJetIndexToken_(consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genCHadJetIndex"))),
145  genCHadFlavourToken_(consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genCHadFlavour"))),
147  consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genCHadFromTopWeakDecay"))),
148  genCHadBHadronIdToken_(consumes<std::vector<int> >(iConfig.getParameter<edm::InputTag>("genCHadBHadronId"))) {
149  produces<int>("genTtbarId");
150 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< std::vector< int > > genBHadFromTopWeakDecayToken_
const edm::EDGetTokenT< std::vector< int > > genBHadJetIndexToken_
const edm::EDGetTokenT< std::vector< int > > genCHadFromTopWeakDecayToken_
const edm::EDGetTokenT< std::vector< int > > genCHadFlavourToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< std::vector< int > > genBHadFlavourToken_
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_
GenTtbarCategorizer::~GenTtbarCategorizer ( )
override

Definition at line 152 of file GenTtbarCategorizer.cc.

152 {}

Member Function Documentation

void GenTtbarCategorizer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 390 of file GenTtbarCategorizer.cc.

390 {}
void GenTtbarCategorizer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 393 of file GenTtbarCategorizer.cc.

393 {}
void GenTtbarCategorizer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 452 of file GenTtbarCategorizer.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

452  {
453  //The following says we do not know what parameters are allowed so do no validation
454  // Please change this to state exactly what you do use, even if it is no parameters
456  desc.setUnknown();
457  descriptions.addDefault(desc);
458 }
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< int > GenTtbarCategorizer::nHadronsOrderedJetIndices ( const std::map< int, int > &  m_jetIndex)
private

Definition at line 428 of file GenTtbarCategorizer.cc.

Referenced by produce().

428  {
429  const int nElements = m_jetIndex.size();
430  std::vector<std::pair<int, int> > v_jetNhadIndexPair;
431  v_jetNhadIndexPair.reserve(nElements);
432  for (std::map<int, int>::const_iterator it = m_jetIndex.begin(); it != m_jetIndex.end(); ++it) {
433  const int jetIndex = it->first;
434  const int nHadrons = it->second;
435  v_jetNhadIndexPair.push_back(std::pair<int, int>(nHadrons, jetIndex));
436  }
437  // Sorting the vector of pairs by their key value
438  std::sort(v_jetNhadIndexPair.begin(), v_jetNhadIndexPair.end(), std::greater<std::pair<int, int> >());
439  // Building the vector of indices in the proper order
440  std::vector<int> v_orderedJetIndices;
441  v_orderedJetIndices.reserve(nElements);
442  for (std::vector<std::pair<int, int> >::const_iterator it = v_jetNhadIndexPair.begin();
443  it != v_jetNhadIndexPair.end();
444  ++it) {
445  v_orderedJetIndices.push_back(it->second);
446  }
447 
448  return v_orderedJetIndices;
449 }
void GenTtbarCategorizer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 159 of file GenTtbarCategorizer.cc.

References funct::abs(), GenHFHadronMatcher_cff::flavour, ttHFGenFilter_cfi::genBHadFlavour, genBHadFlavourToken_, ttHFGenFilter_cfi::genBHadFromTopWeakDecay, genBHadFromTopWeakDecayToken_, ttHFGenFilter_cfi::genBHadIndex, genBHadIndexToken_, GenTtbarCategorizer_cfi::genBHadJetIndex, genBHadJetIndexToken_, GenTtbarCategorizer_cfi::genBHadLeptonHadronIndex, genBHadLeptonHadronIndexToken_, GenTtbarCategorizer_cfi::genBHadLeptonViaTau, genBHadLeptonViaTauToken_, ttHFGenFilter_cfi::genBHadPlusMothers, ttHFGenFilter_cfi::genBHadPlusMothersIndices, genBHadPlusMothersIndicesToken_, genBHadPlusMothersToken_, GenTtbarCategorizer_cfi::genCHadBHadronId, genCHadBHadronIdToken_, GenTtbarCategorizer_cfi::genCHadFlavour, genCHadFlavourToken_, GenTtbarCategorizer_cfi::genCHadFromTopWeakDecay, genCHadFromTopWeakDecayToken_, GenTtbarCategorizer_cfi::genCHadJetIndex, genCHadJetIndexToken_, genJetAbsEtaMax_, genJetPtMin_, ttbarCategorization_cff::genJets, genJetsToken_, edm::Event::getByToken(), SiStripPI::max, min(), eostools::move(), nHadronsOrderedJetIndices(), and edm::Event::put().

159  {
160  // Access gen jets
162  iEvent.getByToken(genJetsToken_, genJets);
163 
164  // Access B hadrons information
166  iEvent.getByToken(genBHadFlavourToken_, genBHadFlavour);
167 
169  iEvent.getByToken(genBHadJetIndexToken_, genBHadJetIndex);
170 
172  iEvent.getByToken(genBHadFromTopWeakDecayToken_, genBHadFromTopWeakDecay);
173 
175  iEvent.getByToken(genBHadPlusMothersToken_, genBHadPlusMothers);
176 
178  iEvent.getByToken(genBHadPlusMothersIndicesToken_, genBHadPlusMothersIndices);
179 
181  iEvent.getByToken(genBHadIndexToken_, genBHadIndex);
182 
184  iEvent.getByToken(genBHadLeptonHadronIndexToken_, genBHadLeptonHadronIndex);
185 
187  iEvent.getByToken(genBHadLeptonViaTauToken_, genBHadLeptonViaTau);
188 
189  // Access C hadrons information
191  iEvent.getByToken(genCHadFlavourToken_, genCHadFlavour);
192 
194  iEvent.getByToken(genCHadJetIndexToken_, genCHadJetIndex);
195 
197  iEvent.getByToken(genCHadFromTopWeakDecayToken_, genCHadFromTopWeakDecay);
198 
200  iEvent.getByToken(genCHadBHadronIdToken_, genCHadBHadronId);
201 
202  // Map <jet index, number of specific hadrons in jet>
203  // B jets with b hadrons directly from t->b decay
204  std::map<int, int> bJetFromTopIds;
205  // B jets with b hadrons from W->b decay
206  std::map<int, int> bJetFromWIds;
207  // C jets with c hadrons from W->c decay
208  std::map<int, int> cJetFromWIds;
209  // B jets with b hadrons before top quark decay chain
210  std::map<int, int> bJetAdditionalIds;
211  // C jets with c hadrons before top quark decay chain
212  std::map<int, int> cJetAdditionalIds;
213 
214  // Count number of specific b hadrons in each jet
215  for (size_t hadronId = 0; hadronId < genBHadIndex->size(); ++hadronId) {
216  // Index of jet associated to the hadron
217  const int jetIndex = genBHadJetIndex->at(hadronId);
218  // Skip hadrons which have no associated jet
219  if (jetIndex < 0)
220  continue;
221  // Skip if jet is not in acceptance
222  if (genJets->at(jetIndex).pt() < genJetPtMin_)
223  continue;
224  if (std::fabs(genJets->at(jetIndex).eta()) > genJetAbsEtaMax_)
225  continue;
226  // Flavour of the hadron's origin
227  const int flavour = genBHadFlavour->at(hadronId);
228  // Jet from t->b decay [pdgId(top)=6]
229  if (std::abs(flavour) == 6) {
230  if (bJetFromTopIds.count(jetIndex) < 1)
231  bJetFromTopIds[jetIndex] = 1;
232  else
233  bJetFromTopIds[jetIndex]++;
234  continue;
235  }
236  // Jet from W->b decay [pdgId(W)=24]
237  if (std::abs(flavour) == 24) {
238  if (bJetFromWIds.count(jetIndex) < 1)
239  bJetFromWIds[jetIndex] = 1;
240  else
241  bJetFromWIds[jetIndex]++;
242  continue;
243  }
244  // Identify jets with b hadrons not from top-quark or W-boson decay
245  if (bJetAdditionalIds.count(jetIndex) < 1)
246  bJetAdditionalIds[jetIndex] = 1;
247  else
248  bJetAdditionalIds[jetIndex]++;
249  }
250 
251  // Cleaning up b jets from W->b decays
252  for (std::map<int, int>::iterator it = bJetFromWIds.begin(); it != bJetFromWIds.end();) {
253  // Cannot be a b jet from t->b decay
254  if (bJetFromTopIds.count(it->first) > 0)
255  bJetFromWIds.erase(it++);
256  else
257  ++it;
258  }
259 
260  // Cleaning up additional b jets
261  for (std::map<int, int>::iterator it = bJetAdditionalIds.begin(); it != bJetAdditionalIds.end();) {
262  // Cannot be a b jet from t->b decay
263  if (bJetFromTopIds.count(it->first) > 0)
264  bJetAdditionalIds.erase(it++);
265  // Cannot be a b jet from W->b decay
266  else if (bJetFromWIds.count(it->first) > 0)
267  bJetAdditionalIds.erase(it++);
268  else
269  ++it;
270  }
271 
272  // Count number of specific c hadrons in each c jet
273  for (size_t hadronId = 0; hadronId < genCHadJetIndex->size(); ++hadronId) {
274  // Index of jet associated to the hadron
275  const int jetIndex = genCHadJetIndex->at(hadronId);
276  // Skip hadrons which have no associated jet
277  if (jetIndex < 0)
278  continue;
279  // Skip c hadrons that are coming from b hadrons
280  if (genCHadBHadronId->at(hadronId) >= 0)
281  continue;
282  // Skip if jet is not in acceptance
283  if (genJets->at(jetIndex).pt() < genJetPtMin_)
284  continue;
285  if (std::fabs(genJets->at(jetIndex).eta()) > genJetAbsEtaMax_)
286  continue;
287  // Skip if jet contains a b hadron
288  if (bJetFromTopIds.count(jetIndex) > 0)
289  continue;
290  if (bJetFromWIds.count(jetIndex) > 0)
291  continue;
292  if (bJetAdditionalIds.count(jetIndex) > 0)
293  continue;
294  // Flavour of the hadron's origin
295  const int flavour = genCHadFlavour->at(hadronId);
296  // Jet from W->c decay [pdgId(W)=24]
297  if (std::abs(flavour) == 24) {
298  if (cJetFromWIds.count(jetIndex) < 1)
299  cJetFromWIds[jetIndex] = 1;
300  else
301  cJetFromWIds[jetIndex]++;
302  continue;
303  }
304  // Identify jets with c hadrons not from W-boson decay
305  if (cJetAdditionalIds.count(jetIndex) < 1)
306  cJetAdditionalIds[jetIndex] = 1;
307  else
308  cJetAdditionalIds[jetIndex]++;
309  }
310 
311  // Cleaning up additional c jets
312  for (std::map<int, int>::iterator it = cJetAdditionalIds.begin(); it != cJetAdditionalIds.end();) {
313  // Cannot be a c jet from W->c decay
314  if (cJetFromWIds.count(it->first) > 0)
315  cJetAdditionalIds.erase(it++);
316  else
317  ++it;
318  }
319 
320  // Categorize event based on number of additional b/c jets
321  // and number of corresponding hadrons in each of them
322  int additionalJetEventId = bJetFromTopIds.size() * 100 + bJetFromWIds.size() * 1000 + cJetFromWIds.size() * 10000;
323  // tt + 1 additional b jet
324  if (bJetAdditionalIds.size() == 1) {
325  const int nHadronsInJet = bJetAdditionalIds.begin()->second;
326  // tt + 1 additional b jet from 1 additional b hadron
327  if (nHadronsInJet == 1)
328  additionalJetEventId += 51;
329  // tt + 1 additional b jet from >=2 additional b hadrons
330  else
331  additionalJetEventId += 52;
332  }
333  // tt + >=2 additional b jets
334  else if (bJetAdditionalIds.size() > 1) {
335  // Check first two additional b jets (rare cases could have more)
336  const std::vector<int> orderedJetIndices = nHadronsOrderedJetIndices(bJetAdditionalIds);
337  int nHadronsInJet1 = bJetAdditionalIds.at(orderedJetIndices.at(0));
338  int nHadronsInJet2 = bJetAdditionalIds.at(orderedJetIndices.at(1));
339  // tt + >=2 additional b jets each from 1 additional b hadron
340  if (std::max(nHadronsInJet1, nHadronsInJet2) == 1)
341  additionalJetEventId += 53;
342  // tt + >=2 additional b jets one of which from >=2 additional b hadrons
343  else if (std::min(nHadronsInJet1, nHadronsInJet2) == 1 && std::max(nHadronsInJet1, nHadronsInJet2) > 1)
344  additionalJetEventId += 54;
345  // tt + >=2 additional b jets each from >=2 additional b hadrons
346  else if (std::min(nHadronsInJet1, nHadronsInJet2) > 1)
347  additionalJetEventId += 55;
348  }
349  // tt + no additional b jets
350  else {
351  // tt + 1 additional c jet
352  if (cJetAdditionalIds.size() == 1) {
353  const int nHadronsInJet = cJetAdditionalIds.begin()->second;
354  // tt + 1 additional c jet from 1 additional c hadron
355  if (nHadronsInJet == 1)
356  additionalJetEventId += 41;
357  // tt + 1 additional c jet from >=2 additional c hadrons
358  else
359  additionalJetEventId += 42;
360  }
361  // tt + >=2 additional c jets
362  else if (cJetAdditionalIds.size() > 1) {
363  // Check first two additional c jets (rare cases could have more)
364  const std::vector<int> orderedJetIndices = nHadronsOrderedJetIndices(cJetAdditionalIds);
365  int nHadronsInJet1 = cJetAdditionalIds.at(orderedJetIndices.at(0));
366  int nHadronsInJet2 = cJetAdditionalIds.at(orderedJetIndices.at(1));
367  // tt + >=2 additional c jets each from 1 additional c hadron
368  if (std::max(nHadronsInJet1, nHadronsInJet2) == 1)
369  additionalJetEventId += 43;
370  // tt + >=2 additional c jets one of which from >=2 additional c hadrons
371  else if (std::min(nHadronsInJet1, nHadronsInJet2) == 1 && std::max(nHadronsInJet1, nHadronsInJet2) > 1)
372  additionalJetEventId += 44;
373  // tt + >=2 additional c jets each from >=2 additional c hadrons
374  else if (std::min(nHadronsInJet1, nHadronsInJet2) > 1)
375  additionalJetEventId += 45;
376  }
377  // tt + no additional c jets
378  else {
379  // tt + light jets
380  additionalJetEventId += 0;
381  }
382  }
383 
384  std::unique_ptr<int> ttbarId(new int);
385  *ttbarId = additionalJetEventId;
386  iEvent.put(std::move(ttbarId), "genTtbarId");
387 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const edm::EDGetTokenT< std::vector< int > > genBHadFromTopWeakDecayToken_
const edm::EDGetTokenT< std::vector< int > > genBHadJetIndexToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const edm::EDGetTokenT< std::vector< int > > genCHadFromTopWeakDecayToken_
const edm::EDGetTokenT< std::vector< int > > genCHadFlavourToken_
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)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
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_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genBHadFlavourToken_
private

Definition at line 102 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genBHadFromTopWeakDecayToken_
private

Definition at line 103 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genBHadIndexToken_
private

Definition at line 106 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genBHadJetIndexToken_
private

Definition at line 101 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genBHadLeptonHadronIndexToken_
private

Definition at line 107 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genBHadLeptonViaTauToken_
private

Definition at line 108 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<std::vector<int> > > GenTtbarCategorizer::genBHadPlusMothersIndicesToken_
private

Definition at line 105 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<reco::GenParticle> > GenTtbarCategorizer::genBHadPlusMothersToken_
private

Definition at line 104 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genCHadBHadronIdToken_
private

Definition at line 113 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genCHadFlavourToken_
private

Definition at line 111 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genCHadFromTopWeakDecayToken_
private

Definition at line 112 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<std::vector<int> > GenTtbarCategorizer::genCHadJetIndexToken_
private

Definition at line 110 of file GenTtbarCategorizer.cc.

Referenced by produce().

const double GenTtbarCategorizer::genJetAbsEtaMax_
private

Definition at line 96 of file GenTtbarCategorizer.cc.

Referenced by produce().

const double GenTtbarCategorizer::genJetPtMin_
private

Definition at line 95 of file GenTtbarCategorizer.cc.

Referenced by produce().

const edm::EDGetTokenT<reco::GenJetCollection> GenTtbarCategorizer::genJetsToken_
private

Definition at line 99 of file GenTtbarCategorizer.cc.

Referenced by produce().