Go to the documentation of this file.00001
00002
00003
00004
00005
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef RecoJets_FFTJetProducers_FFTJetProducer_h
00029 #define RecoJets_FFTJetProducers_FFTJetProducer_h
00030
00031 #include <memory>
00032
00033
00034 #include "fftjet/AbsRecombinationAlg.hh"
00035 #include "fftjet/AbsVectorRecombinationAlg.hh"
00036 #include "fftjet/SparseClusteringTree.hh"
00037
00038
00039 #include "FWCore/Framework/interface/Frameworkfwd.h"
00040 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00041 #include "FWCore/Framework/interface/EDProducer.h"
00042 #include "FWCore/Framework/interface/Event.h"
00043
00044 #include "DataFormats/Candidate/interface/CandidateFwd.h"
00045
00046
00047 #include "RecoJets/FFTJetAlgorithms/interface/fftjetTypedefs.h"
00048 #include "RecoJets/FFTJetProducers/interface/FFTJetInterface.h"
00049
00050 namespace fftjetcms {
00051 class DiscretizedEnergyFlow;
00052 }
00053
00054
00055
00056
00057 class FFTJetProducer : public edm::EDProducer,
00058 public fftjetcms::FFTJetInterface
00059 {
00060 public:
00061 typedef fftjet::RecombinedJet<fftjetcms::VectorLike> RecoFFTJet;
00062 typedef fftjet::SparseClusteringTree<fftjet::Peak,long> SparseTree;
00063
00064 enum Resolution
00065 {
00066 FIXED = 0,
00067 MAXIMALLY_STABLE,
00068 GLOBALLY_ADAPTIVE,
00069 LOCALLY_ADAPTIVE
00070 };
00071
00072 explicit FFTJetProducer(const edm::ParameterSet&);
00073 virtual ~FFTJetProducer();
00074
00075
00076 static Resolution parse_resolution(const std::string& name);
00077
00078 protected:
00079
00080 virtual void beginJob();
00081 virtual void produce(edm::Event&, const edm::EventSetup&);
00082 virtual void endJob();
00083
00084
00085
00086
00087
00088
00089 virtual void selectPreclusters(
00090 const SparseTree& tree,
00091 const fftjet::Functor1<bool,fftjet::Peak>& peakSelector,
00092 std::vector<fftjet::Peak>* preclusters);
00093
00094
00095
00096
00097
00098 virtual void assignMembershipFunctions(
00099 std::vector<fftjet::Peak>* preclusters);
00100
00101
00102 virtual std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> >
00103 parse_peakSelector(const edm::ParameterSet&);
00104
00105
00106 virtual std::auto_ptr<fftjet::ScaleSpaceKernel>
00107 parse_jetMembershipFunction(const edm::ParameterSet&);
00108
00109
00110 virtual std::auto_ptr<fftjetcms::AbsBgFunctor>
00111 parse_bgMembershipFunction(const edm::ParameterSet&);
00112
00113
00114 virtual std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
00115 parse_recoScaleCalcPeak(const edm::ParameterSet&);
00116
00117
00118 virtual std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
00119 parse_recoScaleRatioCalcPeak(const edm::ParameterSet&);
00120
00121
00122 virtual std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
00123 parse_memberFactorCalcPeak(const edm::ParameterSet&);
00124
00125
00126 virtual std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> >
00127 parse_recoScaleCalcJet(const edm::ParameterSet&);
00128
00129 virtual std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> >
00130 parse_recoScaleRatioCalcJet(const edm::ParameterSet&);
00131
00132 virtual std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> >
00133 parse_memberFactorCalcJet(const edm::ParameterSet&);
00134
00135
00136
00137 virtual std::auto_ptr<fftjet::Functor2<double,RecoFFTJet,RecoFFTJet> >
00138 parse_jetDistanceCalc(const edm::ParameterSet&);
00139
00140
00141
00142
00143 void selectTreeNodes(const SparseTree& tree,
00144 const fftjet::Functor1<bool,fftjet::Peak>& peakSelect,
00145 std::vector<SparseTree::NodeId>* nodes);
00146 private:
00147 typedef fftjet::AbsVectorRecombinationAlg<
00148 fftjetcms::VectorLike,fftjetcms::BgData> RecoAlg;
00149 typedef fftjet::AbsRecombinationAlg<
00150 fftjetcms::Real,fftjetcms::VectorLike,fftjetcms::BgData> GridAlg;
00151
00152
00153 FFTJetProducer();
00154 FFTJetProducer(const FFTJetProducer&);
00155 FFTJetProducer& operator=(const FFTJetProducer&);
00156
00157
00158 template<class Real>
00159 void loadSparseTreeData(const edm::Event&);
00160
00161
00162 void buildGridAlg();
00163 void prepareRecombinationScales();
00164 void loadEnergyFlow(const edm::Event& iEvent);
00165 bool checkConvergence(const std::vector<RecoFFTJet>& previousIterResult,
00166 std::vector<RecoFFTJet>& thisIterResult);
00167 void determineGriddedConstituents();
00168 void determineVectorConstituents();
00169 void saveResults(edm::Event& iEvent, const edm::EventSetup&);
00170
00171 template <typename Jet>
00172 void writeJets(edm::Event& iEvent, const edm::EventSetup&);
00173
00174 template <typename Jet>
00175 void makeProduces(const std::string& alias, const std::string& tag);
00176
00177
00178
00179
00180
00181
00182
00183 unsigned iterateJetReconstruction();
00184
00185
00186
00187
00188
00189
00190 const edm::ParameterSet myConfiguration;
00191
00192
00193 const edm::InputTag treeLabel;
00194
00195
00196
00197 const bool useGriddedAlgorithm;
00198
00199
00200
00201 const bool reuseExistingGrid;
00202
00203
00204 const unsigned maxIterations;
00205
00206
00207 const unsigned nJetsRequiredToConverge;
00208 const double convergenceDistance;
00209
00210
00211 const bool assignConstituents;
00212
00213
00214
00215
00216 const bool resumConstituents;
00217
00218
00219 const double fixedScale;
00220
00221
00222 const double minStableScale;
00223 const double maxStableScale;
00224
00225
00226 const double stabilityAlpha;
00227
00228
00229
00230 const double noiseLevel;
00231
00232
00233 const unsigned nClustersRequested;
00234
00235
00236 const double gridScanMaxEta;
00237
00238
00239 const std::string recombinationAlgorithm;
00240 const bool isCrisp;
00241 const double unlikelyBgWeight;
00242 const double recombinationDataCutoff;
00243
00244
00245
00246
00247 Resolution resolution;
00248
00249
00250 std::auto_ptr<std::vector<double> > iniScales;
00251
00252
00253 SparseTree sparseTree;
00254
00255
00256 std::auto_ptr<fftjet::Functor1<bool,fftjet::Peak> > peakSelector;
00257
00258
00259 std::auto_ptr<RecoAlg> recoAlg;
00260 std::auto_ptr<GridAlg> gridAlg;
00261 std::auto_ptr<fftjet::ScaleSpaceKernel> jetMembershipFunction;
00262 std::auto_ptr<fftjetcms::AbsBgFunctor> bgMembershipFunction;
00263
00264
00265 std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> > recoScaleCalcPeak;
00266
00267
00268 std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> >
00269 recoScaleRatioCalcPeak;
00270
00271
00272 std::auto_ptr<fftjet::Functor1<double,fftjet::Peak> > memberFactorCalcPeak;
00273
00274
00275 std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> > recoScaleCalcJet;
00276 std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> > recoScaleRatioCalcJet;
00277 std::auto_ptr<fftjet::Functor1<double,RecoFFTJet> > memberFactorCalcJet;
00278
00279
00280
00281 std::auto_ptr<fftjet::Functor2<double,RecoFFTJet,RecoFFTJet> >
00282 jetDistanceCalc;
00283
00284
00285 std::vector<SparseTree::NodeId> nodes;
00286
00287
00288 std::vector<fftjet::Peak> preclusters;
00289
00290
00291 std::vector<RecoFFTJet> recoJets;
00292
00293
00294 std::vector<unsigned> occupancy;
00295
00296
00297 std::vector<double> thresholds;
00298
00299
00300 unsigned minLevel, maxLevel, usedLevel;
00301
00302
00303 fftjetcms::VectorLike unclustered;
00304 double unused;
00305
00306
00307 std::vector<fftjet::Peak> iterPreclusters;
00308 std::vector<RecoFFTJet> iterJets;
00309 unsigned iterationsPerformed;
00310
00311
00312 std::vector<std::vector<reco::CandidatePtr> > constituents;
00313 };
00314
00315 #endif // RecoJets_FFTJetProducers_FFTJetProducer_h