CMS 3D CMS Logo

InputGenJetsParticleSelector.h
Go to the documentation of this file.
1 #ifndef __InputGenJetsParticleSelector__
2 #define __InputGenJetsParticleSelector__
3 
4 /* \class InputGenJetsParticleSelector
5  *
6  * Selects particles for the GenJet input.
7  * Deselect specified particles, also radiation from resoances.
8  * Or only select partonic final state.
9  * The algorithm is based on code of Christophe Saout.
10  *
11  * \author: Andreas Oehler
12  *
13  *
14  */
15 
20 
22 
26 
27 
29  // collection type
30  public:
31  typedef std::vector<bool> ParticleBitmap;
32  typedef std::vector<const reco::Candidate*> ParticleVector;
33 
36  // select object from a collection and
37  // possibly event content
38  virtual void produce (edm::StreamID, edm::Event &evt, const edm::EventSetup &evtSetup) const override;
39 
40  bool getPartonicFinalState() const { return partonicFinalState; }
41  bool getExcludeResonances() const { return excludeResonances; }
42  bool getTausAndJets() const { return tausAsJets; }
43  double getPtMin() const { return ptMin; }
44  const std::vector<unsigned int> &getIgnoredParticles() const
45  { return ignoreParticleIDs; }
46 
47  void setPartonicFinalState(bool flag = true)
49  void setExcludeResonances(bool flag = true)
50  { excludeResonances = flag; }
51  void setTausAsJets(bool flag = true) { tausAsJets = flag; }
52  void setPtMin(double ptMin) { this->ptMin = ptMin; }
53  bool isParton(int pdgId) const;
54  static bool isHadron(int pdgId);
55  static bool isResonance(int pdgId);
56 
57  bool isIgnored(int pdgId) const;
58  bool hasPartonChildren(ParticleBitmap &invalid,
59  const ParticleVector &p,
60  const reco::Candidate *particle) const;
61 
63  kNo = 0,
66  };
67  ResonanceState fromResonance(ParticleBitmap &invalid,
68  const ParticleVector &p,
69  const reco::Candidate *particle) const;
70 
71 
72  // iterators over selected objects: collection begin
73 
74  private:
75  //container selected_; //container required by selector
76  InputGenJetsParticleSelector(){} //should not be used!
77 
80  int testPartonChildren(ParticleBitmap &invalid,
81  const ParticleVector &p,
82  const reco::Candidate *particle) const;
83 
84  std::vector<unsigned int> ignoreParticleIDs;
85  std::vector<unsigned int> excludeFromResonancePids;
86  void setExcludeFromResonancePids(const std::vector<unsigned int> &particleIDs);
87  void setIgnoredParticles(const std::vector<unsigned int> &particleIDs);
88  bool isExcludedFromResonance(int pdgId) const;
89 
92  bool tausAsJets;
93  bool isMiniAOD;
94  double ptMin;
95 
98 
99 };
100 
101 #endif
bool hasPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
virtual void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &evtSetup) const override
edm::EDGetTokenT< reco::CandidateView > input_genpartcoll_token_
const std::vector< unsigned int > & getIgnoredParticles() const
std::vector< unsigned int > excludeFromResonancePids
int testPartonChildren(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
void setIgnoredParticles(const std::vector< unsigned int > &particleIDs)
edm::EDGetTokenT< reco::CandidateView > input_prunedgenpartcoll_token_
ResonanceState fromResonance(ParticleBitmap &invalid, const ParticleVector &p, const reco::Candidate *particle) const
std::vector< unsigned int > ignoreParticleIDs
std::vector< const reco::Candidate * > ParticleVector
void setExcludeFromResonancePids(const std::vector< unsigned int > &particleIDs)