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