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/GhostedAreaSpec.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::GhostedAreaSpec> ActiveAreaSpecPtr;
00083 typedef boost::shared_ptr<fastjet::AreaDefinition> AreaDefinitionPtr;
00084 typedef boost::shared_ptr<fastjet::RangeDefinition> RangeDefPtr;
00085
00086
00087
00088
00089 public:
00090 virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup);
00091 std::string jetType() const { return jetType_; }
00092
00093 protected:
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 virtual void makeProduces( std::string s, std::string tag = "" );
00104
00105
00106
00107 virtual void inputTowers();
00108
00109
00110 virtual bool isAnomalousTower(reco::CandidatePtr input);
00111
00112
00113 virtual void copyConstituents(const std::vector<fastjet::PseudoJet>&fjConstituents,
00114 reco::Jet* jet);
00115
00116
00117
00118 virtual void runAlgorithm( edm::Event& iEvent, const edm::EventSetup& iSetup) = 0;
00119
00120
00121
00122 void offsetCorrectJets(std::vector<fastjet::PseudoJet> & orphanInput);
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 virtual void output( edm::Event & iEvent, edm::EventSetup const& iSetup );
00133 template< typename T >
00134 void writeJets( edm::Event & iEvent, edm::EventSetup const& iSetup );
00135
00136 template< typename T>
00137 void writeCompoundJets( edm::Event & iEvent, edm::EventSetup const& iSetup);
00138
00139
00140
00141
00142 virtual std::vector<reco::CandidatePtr>
00143 getConstituents(const std::vector<fastjet::PseudoJet>&fjConstituents);
00144
00145
00146
00147
00148 protected:
00149 std::string moduleLabel_;
00150 edm::InputTag src_;
00151 edm::InputTag srcPVs_;
00152 std::string jetType_;
00153 std::string jetAlgorithm_;
00154 double rParam_;
00155 double inputEtMin_;
00156 double inputEMin_;
00157 double jetPtMin_;
00158 bool doPVCorrection_;
00159
00160
00161 bool restrictInputs_;
00162 unsigned int maxInputs_;
00163
00164
00165 bool doAreaFastjet_;
00166 bool useExplicitGhosts_;
00167 bool doAreaDiskApprox_;
00168
00169 bool doRhoFastjet_;
00170 bool doFastJetNonUniform_;
00171 double voronoiRfact_;
00172
00173
00174 bool doPUOffsetCorr_;
00175 std::string puSubtractorName_;
00176
00177
00178 std::vector<edm::Ptr<reco::Candidate> > inputs_;
00179 reco::Particle::Point vertex_;
00180 ClusterSequencePtr fjClusterSeq_;
00181 JetDefPtr fjJetDefinition_;
00182 PluginPtr fjPlugin_;
00183 ActiveAreaSpecPtr fjActiveArea_;
00184 AreaDefinitionPtr fjAreaDefinition_;
00185 RangeDefPtr fjRangeDef_;
00186 std::vector<fastjet::PseudoJet> fjInputs_;
00187 std::vector<fastjet::PseudoJet> fjJets_;
00188
00189
00190 std::vector<double> puCenters_;
00191 double puWidth_;
00192 unsigned int nExclude_;
00193
00194 std::string jetCollInstanceName_;
00195 bool writeCompound_;
00196 boost::shared_ptr<PileUpSubtractor> subtractor_;
00197
00198 bool useDeterministicSeed_;
00199 unsigned int minSeed_;
00200
00201 private:
00202 std::auto_ptr<AnomalousTower> anomalousTowerDef_;
00203 };
00204
00205
00206
00207
00208
00209 #endif