CMS 3D CMS Logo

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 "RecoJets/JetAlgorithms/interface/JetRecoTypes.h"
00026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00027 
00028 
00029 class InputGenJetsParticleSelector : public edm::EDProducer {
00030   // collection type
00031  public:
00032   typedef std::vector<bool>     ParticleBitmap;
00033   typedef std::vector<const reco::GenParticle*> ParticleVector;
00034       
00035   InputGenJetsParticleSelector(const edm::ParameterSet & ); 
00036   ~InputGenJetsParticleSelector(); 
00037   // select object from a collection and 
00038   // possibly event content
00039   virtual void produce (edm::Event &evt, const edm::EventSetup &evtSetup);
00040       
00041   bool getPartonicFinalState() const { return partonicFinalState; }
00042   bool getExcludeResonances() const { return excludeResonances; }
00043   bool getTausAndJets() const { return tausAsJets; }
00044   double getPtMin() const { return ptMin; }
00045   const std::vector<unsigned int> &getIgnoredParticles() const
00046     { return ignoreParticleIDs; }
00047   
00048   void setPartonicFinalState(bool flag = true)
00049   { partonicFinalState = flag; }
00050   void setExcludeResonances(bool flag = true)
00051   { excludeResonances = flag; }
00052   void setTausAsJets(bool flag = true) { tausAsJets = flag; }
00053   void setPtMin(double ptMin) { this->ptMin = ptMin; }
00054   bool isParton(int pdgId) const;
00055   static bool isHadron(int pdgId);
00056   static bool isResonance(int pdgId);
00057 
00058   bool isIgnored(int pdgId) const;
00059   bool hasPartonChildren(ParticleBitmap &invalid,
00060                          const ParticleVector &p,
00061                          const reco::GenParticle *particle) const;
00062   
00063   enum ResonanceState {
00064     kNo = 0,
00065     kDirect,
00066     kIndirect
00067   };
00068   ResonanceState fromResonance(ParticleBitmap &invalid,
00069                                const ParticleVector &p,
00070                                const reco::GenParticle *particle) const;
00071   
00072   
00073   // iterators over selected objects: collection begin
00074   
00075  private:
00076   //container selected_;  //container required by selector
00077   InputGenJetsParticleSelector(){} //should not be used!
00078   
00079   edm::InputTag inTag;
00080   int testPartonChildren(ParticleBitmap &invalid,
00081                          const ParticleVector &p,
00082                          const reco::GenParticle *particle) const;
00083   
00084   std::vector<unsigned int>     ignoreParticleIDs;
00085   std::vector<unsigned int> excludeFromResonancePids;
00086   void setExcludeFromResonancePids(const std::vector<unsigned int> &particleIDs);
00087   void setIgnoredParticles(const std::vector<unsigned int> &particleIDs);
00088   bool isExcludedFromResonance(int pdgId) const;
00089   
00090   bool                  partonicFinalState;
00091   bool                  excludeResonances;
00092   bool                  tausAsJets;
00093   double                        ptMin;
00094   
00095   
00096   
00097 };
00098 
00099 #endif

Generated on Tue Jun 9 17:43:43 2009 for CMSSW by  doxygen 1.5.4