Go to the documentation of this file.00001 #ifndef RecoJets_JetProducers_plugins_VirtualJetProducer_h
00002 #define RecoJets_JetProducers_plugins_VirtualJetProducer_h
00003
00004
00005 #include "FWCore/Framework/interface/EDProducer.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007 #include "DataFormats/Candidate/interface/Candidate.h"
00008 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00009 #include "DataFormats/JetReco/interface/Jet.h"
00010 #include "DataFormats/JetReco/interface/CaloJet.h"
00011 #include "DataFormats/JetReco/interface/PFJet.h"
00012 #include "DataFormats/JetReco/interface/BasicJet.h"
00013 #include "DataFormats/JetReco/interface/GenJet.h"
00014
00015 #include "RecoJets/JetProducers/interface/PileUpSubtractor.h"
00016 #include "RecoJets/JetProducers/interface/AnomalousTower.h"
00017
00018 #include "fastjet/JetDefinition.hh"
00019 #include "fastjet/ClusterSequence.hh"
00020 #include "fastjet/ClusterSequenceArea.hh"
00021 #include "fastjet/PseudoJet.hh"
00022 #include "fastjet/ActiveAreaSpec.hh"
00023
00024 #include <memory>
00025 #include <vector>
00026 #include <boost/shared_ptr.hpp>
00027
00028
00029 class VirtualJetProducer : public edm::EDProducer
00030 {
00031 protected:
00032
00033
00034
00035 struct JetType {
00036 enum Type {
00037 BasicJet,
00038 GenJet,
00039 CaloJet,
00040 PFJet,
00041 TrackJet,
00042 PFClusterJet,
00043 LastJetType
00044 };
00045 static const char *names[];
00046 static Type byName(const std::string &name);
00047 };
00048
00049 JetType::Type jetTypeE;
00050
00051 inline bool makeCaloJet(const JetType::Type &fTag) {
00052 return fTag == JetType::CaloJet;
00053 }
00054 inline bool makePFJet(const JetType::Type &fTag) {
00055 return fTag == JetType::PFJet;
00056 }
00057 inline bool makeGenJet(const JetType::Type &fTag) {
00058 return fTag == JetType::GenJet;
00059 }
00060 inline bool makeTrackJet(const JetType::Type &fTag) {
00061 return fTag == JetType::TrackJet;
00062 }
00063 inline bool makePFClusterJet(const JetType::Type &fTag) {
00064 return fTag == JetType::PFClusterJet;
00065 }
00066 inline bool makeBasicJet(const JetType::Type &fTag) {
00067 return fTag == JetType::BasicJet;
00068 }
00069
00070
00071
00072
00073
00074 public:
00075 explicit VirtualJetProducer(const edm::ParameterSet& iConfig);
00076 virtual ~VirtualJetProducer();
00077
00078
00079 typedef boost::shared_ptr<fastjet::ClusterSequence> ClusterSequencePtr;
00080 typedef boost::shared_ptr<fastjet::JetDefinition::Plugin> PluginPtr;
00081 typedef boost::shared_ptr<fastjet::JetDefinition> JetDefPtr;
00082 typedef boost::shared_ptr<fastjet::ActiveAreaSpec> ActiveAreaSpecPtr;
00083 typedef boost::shared_ptr<fastjet::RangeDefinition> RangeDefPtr;
00084
00085
00086
00087
00088 public:
00089 virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
00090 std::string jetType() const { return jetType_; }
00091
00092 protected:
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 virtual void makeProduces( std::string s, std::string tag = "" );
00103
00104
00105
00106 virtual void inputTowers();
00107
00108
00109 virtual bool isAnomalousTower(reco::CandidatePtr input);
00110
00111
00112 virtual void copyConstituents(const std::vector<fastjet::PseudoJet>&fjConstituents,
00113 reco::Jet* jet);
00114
00115
00116
00117 virtual void runAlgorithm( edm::Event& iEvent, const edm::EventSetup& iSetup) = 0;
00118
00119
00120
00121 void offsetCorrectJets(std::vector<fastjet::PseudoJet> & orphanInput);
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 virtual void output( edm::Event & iEvent, edm::EventSetup const& iSetup );
00132 template< typename T >
00133 void writeJets( edm::Event & iEvent, edm::EventSetup const& iSetup );
00134
00135
00136
00137 virtual std::vector<reco::CandidatePtr>
00138 getConstituents(const std::vector<fastjet::PseudoJet>&fjConstituents);
00139
00140
00141
00142
00143 protected:
00144 std::string moduleLabel_;
00145 edm::InputTag src_;
00146 edm::InputTag srcPVs_;
00147 std::string jetType_;
00148 std::string jetAlgorithm_;
00149 double rParam_;
00150 double inputEtMin_;
00151 double inputEMin_;
00152 double jetPtMin_;
00153 bool doPVCorrection_;
00154
00155
00156 bool restrictInputs_;
00157 unsigned int maxInputs_;
00158
00159
00160 bool doAreaFastjet_;
00161 bool doAreaDiskApprox_;
00162
00163 bool doRhoFastjet_;
00164 bool doFastJetNonUniform_;
00165 double voronoiRfact_;
00166
00167
00168 bool doPUOffsetCorr_;
00169 std::string puSubtractorName_;
00170
00171
00172 std::vector<edm::Ptr<reco::Candidate> > inputs_;
00173 reco::Particle::Point vertex_;
00174 ClusterSequencePtr fjClusterSeq_;
00175 JetDefPtr fjJetDefinition_;
00176 PluginPtr fjPlugin_;
00177 ActiveAreaSpecPtr fjActiveArea_;
00178 RangeDefPtr fjRangeDef_;
00179 std::vector<fastjet::PseudoJet> fjInputs_;
00180 std::vector<fastjet::PseudoJet> fjJets_;
00181
00182
00183 std::vector<double> puCenters_;
00184 double puWidth_;
00185 unsigned int nExclude_;
00186
00187 std::string jetCollInstanceName_;
00188 boost::shared_ptr<PileUpSubtractor> subtractor_;
00189
00190 bool useDeterministicSeed_;
00191 unsigned int minSeed_;
00192
00193 private:
00194 std::auto_ptr<AnomalousTower> anomalousTowerDef_;
00195 };
00196
00197
00198
00199
00200
00201 #endif