CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoJets/JetProducers/plugins/InputGenJetsParticleSelector.h

Go to the documentation of this file.
00001 #ifndef __InputGenJetsParticleSelector__
00002 #define __InputGenJetsParticleSelector__
00003 
00004 /* \class InputGenJetsParticleSelector
00005  * 
00006  * Selects particles for the GenJet input.
00007  * Deselect specified particles, also radiation from resoances.
00008  * Or only select partonic final state.
00009  * The algorithm is based on code of Christophe Saout. 
00010  *
00011  * \author: Andreas Oehler
00012  * 
00013  * 
00014  */
00015 
00016 #include "DataFormats/Provenance/interface/Provenance.h"
00017 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "DataFormats/Candidate/interface/Candidate.h"
00020 
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 
00023 #include "FWCore/Framework/interface/EDProducer.h"
00024 #include "DataFormats/Common/interface/EDProductfwd.h"
00025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00026 
00027 
00028 class InputGenJetsParticleSelector : public edm::EDProducer {
00029   // collection type
00030  public:
00031   typedef std::vector<bool>     ParticleBitmap;
00032   typedef std::vector<const reco::GenParticle*> ParticleVector;
00033       
00034   InputGenJetsParticleSelector(const edm::ParameterSet & ); 
00035   ~InputGenJetsParticleSelector(); 
00036   // select object from a collection and 
00037   // possibly event content
00038   virtual void produce (edm::Event &evt, const edm::EventSetup &evtSetup);
00039       
00040   bool getPartonicFinalState() const { return partonicFinalState; }
00041   bool getExcludeResonances() const { return excludeResonances; }
00042   bool getTausAndJets() const { return tausAsJets; }
00043   double getPtMin() const { return ptMin; }
00044   const std::vector<unsigned int> &getIgnoredParticles() const
00045     { return ignoreParticleIDs; }
00046   
00047   void setPartonicFinalState(bool flag = true)
00048   { partonicFinalState = flag; }
00049   void setExcludeResonances(bool flag = true)
00050   { excludeResonances = flag; }
00051   void setTausAsJets(bool flag = true) { tausAsJets = flag; }
00052   void setPtMin(double ptMin) { this->ptMin = ptMin; }
00053   bool isParton(int pdgId) const;
00054   static bool isHadron(int pdgId);
00055   static bool isResonance(int pdgId);
00056 
00057   bool isIgnored(int pdgId) const;
00058   bool hasPartonChildren(ParticleBitmap &invalid,
00059                          const ParticleVector &p,
00060                          const reco::GenParticle *particle) const;
00061   
00062   enum ResonanceState {
00063     kNo = 0,
00064     kDirect,
00065     kIndirect
00066   };
00067   ResonanceState fromResonance(ParticleBitmap &invalid,
00068                                const ParticleVector &p,
00069                                const reco::GenParticle *particle) const;
00070   
00071   
00072   // iterators over selected objects: collection begin
00073   
00074  private:
00075   //container selected_;  //container required by selector
00076   InputGenJetsParticleSelector(){} //should not be used!
00077   
00078   edm::InputTag inTag;
00079   int testPartonChildren(ParticleBitmap &invalid,
00080                          const ParticleVector &p,
00081                          const reco::GenParticle *particle) const;
00082   
00083   std::vector<unsigned int>     ignoreParticleIDs;
00084   std::vector<unsigned int> excludeFromResonancePids;
00085   void setExcludeFromResonancePids(const std::vector<unsigned int> &particleIDs);
00086   void setIgnoredParticles(const std::vector<unsigned int> &particleIDs);
00087   bool isExcludedFromResonance(int pdgId) const;
00088   
00089   bool                  partonicFinalState;
00090   bool                  excludeResonances;
00091   bool                  tausAsJets;
00092   double                        ptMin;
00093   
00094   
00095   
00096 };
00097 
00098 #endif